Welcome Guest Search | Active Topics | Sign In | Register

How to add method names to the Syntax Editor so they will be highlighted? Options
Tom
Posted: Friday, January 22, 2010 10:25:09 AM
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
eo_support
Posted: Friday, January 22, 2010 10:49:20 AM
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!
Tom
Posted: Sunday, January 24, 2010 9:54:58 PM
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.
eo_support
Posted: Monday, January 25, 2010 9:59:09 AM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.