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. Image for the cookie policy date
close icon

Lexems with same BeginBlock and different EndBlock


Hello,

I've got difficulties to get complex lexems highlighted correctly, when different lexems have the same BeginBlock:

------------------------
lexem BeginBlock="IF" EndBlock="GOTO" Type="KeyWord" IsComplex="true" IsCollapsable="false"
SubLexems/
References/
/lexem

lexem BeginBlock="IF" EndBlock="END_IF" Type="KeyWord" IsComplex="true" IsCollapsable="true" CollapseName="IF STATEMENT" Indent="true" IndentationGuideline="true"
SubLexems
lexem BeginBlock="THEN" Type="KeyWord"
lexem BeginBlock="ELSE" Type="KeyWord"
lexem BeginBlock="ELSIF" Type="KeyWord"
lexem BeginBlock="" IsBeginRegex="true"
/SubLexems
References/
/lexem

lexem BeginBlock="GOTO" Type="KeyWord">
SubLexems/
References/
/lexem
------------------------

Is there a possibility to get the following highlighted correctly?

------------------------
IF a < b THEN
GOTO label1
ELSIF a > b THEN
GOTO label2
END_IF

IF a < b GOTO label3

IF a < b THEN
a := 4
ELSE
b := 5
END_IF
------------------------

Thanks in advance!
Steffen

(used Version 5.2.0.25/.NET1.1)



5 Replies

BP Bhuvaneswari P Syncfusion Team November 26, 2007 11:20 AM UTC

Hi Steffen,

Thank you for your interest in Syncfusion products.

We have created sample as you expected. Please download the sample from the below link:
http://websamples.syncfusion.com/samples/Edit/F70031/main.htm

You can get more regarding this from the Browser sample from the below link:
\\Syncfusion\EssentialStudio\5.2.0.25\Windows\Edit.Windows\Samples\2.0\Syntax Highlighting\SyntaxColoringDemo

Please let me know if you have any other queries.

Best Regards,
Bhuvana





SS Steffen Schurg, SD-ES November 26, 2007 03:56 PM UTC


Hello Bhuvana,

thank you for your quick reply!

Unfortunately your example doesn't fully solve my issue as you presumend the GOTO statement is only a separate lexem. But there is a IF ... GOTO statement in that language as well.

To be clear three different statements exist:

- IF THEN [ELSIF THEN ] [ELSE ] END_IF
- IF GOTO


BP Bhuvaneswari P Syncfusion Team November 27, 2007 06:32 AM UTC

Hi Steffen,

Thanks for the update.

Here is the code snippet for the below conditions
1. IF THEN [ELSIF THEN ] [ELSE ] END_IF

CollapseName="IF..END_IF" >








2. GOTO


SS Steffen Schurg, SD-ES November 27, 2007 02:24 PM UTC

Hi Bhuvana,

sorry, that didn't solve it either.

The lexems 1 and 2 (in that order) on their own work quite well - as long as there is no IF..GOTO statement.

Adding lexem 3 to config.xml doesn't make any difference to highlighting, but you can see at the collapse lines, that with added lexem 3 the IF..GOTO statement is wrongly ended with END_IF and in the other case (lexem 3 left away) the collapse line doesn't end at all.

Please add CollapseName attributes to the lexem tags and try to collapse the different blocks so you can see where the different lexems terminate. In addition please remove the stand-alone THEN lexem as THEN should be only highlighted within IF context.

I'm still quite at a loss.

Best Regards,
Steffen




BP Bhuvaneswari P Syncfusion Team December 27, 2007 09:40 AM UTC

Hi Steffen,

Thanks for the update.

Already we have forward this to our development team. We will let you know once we get back from them.

Please let me know if you have any other questions.

Best Regards,
Bhuvana



Loader.
Live Chat Icon For mobile
Up arrow icon