Setting up new language RegEx matching?

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
TXHank
Posts: 2
Joined: Fri Jul 11, 2014 6:42 pm

Setting up new language RegEx matching?

Post by TXHank »

I am working on setting up a new language in the editor.

How do I specify a regex in the keywords?

For example, if I wanted to highlight all of the words that start with xls?

xls\w+ would be a valid regex for this example, but I can not get it to work within the editor.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

How do I specify a regex in the keywords?

Each section of keywords (ie, reserved, user1, user2 etc) has room for one and only pattern and this takes a wildcard pattern.

For details on what patterns can be used open the help and search for: patterns.
For example, if I wanted to highlight all of the words that start with xls?

You would use this pattern:

Code: Select all

xls*
xls\w+ would be a valid regex for this example, but I can not get it to work within the editor.
For speed reasons the patterns used for coloring are not full regexp engines.

Cheers Jussi

PS: One thing I do a lot when setting up a new language is use the Export option found in the Keywords section.

This lets me configure the language as a text file and them when I'm ready I just re-import those keyword settings.
TXHank
Posts: 2
Joined: Fri Jul 11, 2014 6:42 pm

Post by TXHank »

jussij wrote:For details on what patterns can be used open the help and search for: patterns.
jussij,

Thank you for the help. I apologize for the delay in responding. I am working with zeus lite until I get the syntax highlight set up the way I want it. Then I will work with the ide to see if I can get it set up.

I am working on another project at the same time so my time to do the trial is limited and I didn't want to lose a lot of time during the trial messing with syntax highlighting instead of working on editor functionality to see if I can replace mine with this one.

With all of that being said, the help file I have does not have a 'patterns' section in the index. I am not sure if that is because I have the lite version or if it is for another reason.

Your example did help me but now I am needing a more in depth version of a regular expression to catch class methods vs class vars. i.e. :assign( vs :count and I can not continue on in that path until I figure out the stripped down version of regex that can be used.

Thank you again
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

I am working with zeus lite until I get the syntax highlight set up the way I want it.
I think you are wasting you time with the lite version. It is nearly 10 year old :!:

The Zeus Lite should be used for nothing more than what it is, a good all round editor.
With all of that being said, the help file I have does not have a 'patterns' section in the index.

Because of it's age I suspect it does not have the feature.

My original advice was given based on the assumption that you where running the current Zeus ;)
I am not sure if that is because I have the lite version.

Almost certain this is the case.
I am needing a more in depth version of a regular expression to catch class methods vs class vars.
It is hard to tell what type of highlighting you are after, but from that short description it sounds like the highliting is context based.

For that type of highlighting you are going to need AST information to help define the context and that is only possible if the IDE contains an embedded compiler for the language (i.e. Visual Studio and C#, Eclipse and Java).

IMHO trying to get a regular expression to do the work of proper AST information is not going to work.

Cheers Jussi
Post Reply