We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Syntax highlighting for a SAS code

Thread ID:

Created:

Updated:

Platform:

Replies:

75411 Jul 24,2008 04:09 PM Aug 20,2008 09:46 PM Windows Forms 12
loading
Tags: EditControl
Administrator [Syncfusion]
Asked On July 24, 2008 04:09 PM

Hello,

I'm evaluating your product to see if it can be used to write a commercial SAS editor. Is it possible to highlight the following variants of a SAS code (keywords: data, run):

(1) Variation 1 (collapsible, priority 1, with "run;" statement as end of block)

data mydata;
...line of code 1
...line of code 2
run;

(2) Variation 2 (collapsible, priority 2, no "run;" statement; last statement ends the block)

data mydata;
...line of code 1
...line of code 2

Thanks, Audi






Administrator [Syncfusion]
Replied On July 30, 2008 09:54 AM

Hi Audi,

Sorry for the delay response.

It is possible to highlight the variants of SAS code.

Please refer the code below for Variation 1:








txt


IsCollapsable="true" CollapseName="(...)" AllowTriggers="false" Priority="0">







data
run;




Please refer the below sample for more detail.
http://websamples.syncfusion.com/samples/edit/F75411/main.htm

Please refer the tutorial link for more detail:
http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Edit/Documents/411creatingacustomlanguageconfigurationfile.htm
http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Edit/Documents/45syntaxhighlightingandcodecoloring.htm

Variantion 2:

Without run its automatically collapse to last available token. This is default behavior. if there is no EndBlock, the lexem will not be closed until it's find the end token.

Please let me know if any concern.

Regards,
Hema




Administrator [Syncfusion]
Replied On August 1, 2008 03:46 PM

Hi Hema,

Thank you for your sample code! I have some follow-up questions:

(1) I have a two-word beginning of a block, with same first word ("proc") but with a variable second word (varies according to the name of the procedure). For example:

proc report data=mydata;
...lines of code;
run;

proc means data=mydata;
...lines of code;
run;


I want "proc report" and "proc means" (including the end of block "run;") to be in dark navy blue color. I tried the following regex pattern but it doesn't work:

"proc\s+\w{1}"

Could it be because the line where "proc" starting block begins contains other codes after the procedure name?

(2) Is there a workaround to the default behavior of automatically collapsing to last available token when there is no end block? (like not collapsing when the collapse/expand icon is clicked)

Thank you in advance!

Regards, Audi



>Hi Audi,

Sorry for the delay response.

It is possible to highlight the variants of SAS code.

Please refer the code below for Variation 1:








txt


IsCollapsable="true" CollapseName="(...)" AllowTriggers="false" Priority="0">







data
run;




Please refer the below sample for more detail.
http://websamples.syncfusion.com/samples/edit/F75411/main.htm

Please refer the tutorial link for more detail:
http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Edit/Documents/411creatingacustomlanguageconfigurationfile.htm
http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Edit/Documents/45syntaxhighlightingandcodecoloring.htm

Variantion 2:

Without run its automatically collapse to last available token. This is default behavior. if there is no EndBlock, the lexem will not be closed until it's find the end token.

Please let me know if any concern.

Regards,
Hema






Administrator [Syncfusion]
Replied On August 5, 2008 06:45 AM

Hi Audi,

Thank you for your patience.

We can able to change the color of the word.

Please refer the below code snippet for changing the color of word.





2. To avoid the behavior of collapsable, set the false to IsCollapsable property. Please refer the below code for your reference.


Please refer the modified sample as per your requirement.
http://websamples.syncfusion.com/samples/edit/F75411_2/main.htm

Please let me know if any concern.

Regards,
Hema



Administrator [Syncfusion]
Replied On August 5, 2008 10:40 AM

Hi Hema,

Thank you for your response. Unfortunately, they were not exactly what I wanted:

(1) I wanted to highlight a two-word startblock, with the second word varying according to the name of the procedure. For example:

proc means data=mydata;
...lines of code;
run;

proc report data=mydata;
...lines of code;
run;

Here, the startblocks are "proc means" and "proc report", both with an endblock "run;". How do you highlight the two-word startblock with a regex pattern? I tried the pattern

"proc\s+\w{1}\s+.*"

but it doesn't work.


(2) How do you turn off collapsing when the endblock "run;" is not used?

Thanks, Audi


Administrator [Syncfusion]
Replied On August 11, 2008 09:35 AM

Hello,

Our decision to buy this control will depend on the ability to implement the cases described in the previous post, especially the ability to highlight a two-word startblock (or beginning block) when the second word is variable. There are more than a hundred possible second words, corresponding to SAS procedure names). It is very inconvenient to create a lexem for each of them.

Thanks, Audi

>Hello,

I'm evaluating your product to see if it can be used to write a commercial SAS editor. Is it possible to highlight the following variants of a SAS code (keywords: data, run):

(1) Variation 1 (collapsible, priority 1, with "run;" statement as end of block)

data mydata;
...line of code 1
...line of code 2
run;

(2) Variation 2 (collapsible, priority 2, no "run;" statement; last statement ends the block)

data mydata;
...line of code 1
...line of code 2

Thanks, Audi








Administrator [Syncfusion]
Replied On August 14, 2008 12:10 PM

Hello, may I have your confirmation that the cases I have described previously cannot be implemented using the Syncfusion Edit control?

Thanks, Audi


Administrator [Syncfusion]
Replied On August 18, 2008 12:57 AM

Hi Audi,

Sorry for the delay.

It is possible to Highlight the Two word contruct using the following Lexem definition[regex pattern]. Please refer the below code snippets.

[C#]







...
...

proc\s\w+


Please refer the below sample for you reference.
http://websamples.syncfusion.com/samples/Edit/75411_3/main.htm


It is not possible to Disallow collapsible for same lexem definition with and without EndBlock with the current architecture of EditControl.

Please let me know if any concerns.

Regards,
Hema




Administrator [Syncfusion]
Replied On August 18, 2008 07:54 AM

Hema, excellent! I'll try highlighting other SAS language constructs and see if they can be done using this control. Very promising so far!

Thanks a lot for your help.

Regards, Audi :-)


Administrator [Syncfusion]
Replied On August 18, 2008 08:34 AM

Hi Audi,

Thank you for the update.

Regards,
Hema


Administrator [Syncfusion]
Replied On August 18, 2008 05:54 PM

Hi Hema,

Attached shows a SAS language construct involving data blocks that begin with the statement "datalines;" or "datalines4;", and ending with one semicolon ";" or 4 semicolons ";;;;", respectively. For example:

data one;
set two;
datalines;
1 2 3 4
6 7 8 9
;
run;

data one;
set two;
datalines4;
1 2 3 4
6 7 8 9
;;;;
run;

What appropriate lexem would highlight the data rows "1 2 3 4" and "6 7 8 9" with a backcolor of light yellow?

Thanks for your help!

Audimar



sas_datalines_879b22de.zip

Administrator [Syncfusion]
Replied On August 20, 2008 06:01 AM

Hi Audi,

Sorry for the delay,

It is possible to Hightlight the SAS language construct involving data blocks that begin like "datalines;" or "datalines4;" following lexem definition, Please refer the below code snippets.

[C#]




....

IsCollapsable="true" CollapseName="(...)" AllowTriggers="false" Priority="0">





IsCollapsable="true" CollapseName="(...)" AllowTriggers="false" Priority="0">








proc\s\w+
data
run;
[0 -9]{7}

datalines\W
datalines\w



Please refer the sample for your reference and let me know if this meets your requirement.
http://websamples.syncfusion.com/samples/Edit/F75411_4/main.htm

Please let me know if any concerns.

Regards,
Hema



Administrator [Syncfusion]
Replied On August 20, 2008 09:46 PM

Hi Hema -- great! So far so good (thanks!). :-)

I'm now going to explore the IntelliSense feature of this control, and will post here if I run into a problem.

Thanks again, Audi


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;