Print Page | Close Window

Coloring Class Begin and End Keywords

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Syntax Edit
Forum Description: Topics Related to Codejock Syntax Edit
URL: http://forum.codejock.com/forum_posts.asp?TID=20019
Printed Date: 21 November 2024 at 3:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Coloring Class Begin and End Keywords
Posted By: The General
Subject: Coloring Class Begin and End Keywords
Date Posted: 05 August 2012 at 7:15pm
Hi All,

Would like to know how to go about coloring the start and end keywords of a class. The below is a prime example:

Private Sub
.....
.....
End Sub

Now each of those words is defined as a keyword and formatted properly on their own but when used to gether (and therefore qualify for a class sytart / end descriptor), the colorisation goes to the default (eg black). Naturally I cannot simply set the text forecolor for the class as this will color each word within the class (ie within the class start and end descriptors).

The only way that I can see (which seems like overkill) is to define (eg) 'Private Sub' as it's own class, colorise that, do the same for 'End Sub' and then have another class which starts and ends with these classes.

There must be an easier way I'm overlooking, right ?? Any and all help appreciated ! Smile

The General.



Replies:
Posted By: SuperMario
Date Posted: 15 August 2012 at 1:37pm

Here is a very basic class to do this.  You will also need those keywords defined in the keywords section if you want them colored when not used in a block or as they type them.

lexClass:
 name   = c_Basic
 parent:file  = <*.vbs>
 caseSensitive  = 0

lexClass:
 name  = c_BasicCodeBlock_Start 
 parent  = c_Basic, c_BasicCodeBlock
 children = 0
 start:Tag = 'Private Sub'
 end:Separators = '\t', ' ', @eol
 txt:colorFG = 0x0000FF
 
lexClass:
 name  = c_BasicCodeBlock_End 
 parent  = c_Basic, c_BasicCodeBlock
 children = 0
 previous:tag = @specs, ' ', '\t', @eol
 start:Tag = 'End Sub'
 end:Separators = @specs, @eol
 txt:colorFG = 0x0000FF

lexClass:
 name  = c_BasicCodeBlock
 parent  = c_Basic, c_BasicCodeBlock
 start:CLASS = c_BasicCodeBlock_Start
 end:CLASS = c_BasicCodeBlock_End
 Collapsable = 1
 CollapsedText = '...'



Posted By: SuperMario
Date Posted: 16 August 2012 at 3:20pm
Attached updated vb.net style schema to your support ticket


Posted By: The General
Date Posted: 22 August 2012 at 12:57am
A little belated but thanks for the support. Smile



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net