Rank: Newbie Groups: Member
Joined: 1/22/2010 Posts: 2
|
Hello,
I would like have the Syntax Editor highlight additional VB.NET method names. Is it possible to do this? If so, how?
Thank you
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
It is possible with a CustomParser or DynamicParser, but not with the built-in VB parsers. Using a CustomParser means you will have to parse the whole syntax yourself, so it provides the ultimate flexibility but also requires a lot of coding. DynamicParser is regular expression based. It can do a lot based on regular expression matching. Most of the time it should be sufficient just for highlighting purpose. So you may want to take a look of that.
Thanks!
|
Rank: Newbie Groups: Member
Joined: 1/22/2010 Posts: 2
|
Thanks for your reply. I have tried to use the DynamicParser. It is not real clear on how what to enter in the token Rules editor. I read the TokenRule Class in the EO.WinForm Help, but it still is not clear how to use it. Could you possibly give me one example which would highlight the word "Then"?
Thank you very much.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You would just add a new rule, then set the rule's Expression property to "Then". If you need to highlight multiple keywords, you can separate them with vertical bars, for example "If|Then".
Once you define the rule, you need to associate the rule to a style by setting the rule's Style property. For example, if you set the rule's Style property to "Keyword", then "If" and "Then" will be highlighted using “Keyword” style.
Styles are defined on the Editor control, not on the Parser control (rules are defined on the Parser control). To edit styles, you would edit the Editor's HighlightStyles collection. For example, to add a "Keyword" style, you would add a style, set its name to "Keyword", then set the font, color etc on the style.
Once you set both rule and styles and associate them together (by setting the rule's Style property to the name of the style), you are ready to go. You can take a look of the DynamicParser sample to see how this works.
Hope this helps.
Thanks!
|