Page 1 of 2

Creating New Lexer for a relatively lesser used language

Posted: 05.03.2013 14:06
by checkid
Hello all,
I started using SynWrite as my alternative source code editor and so far have found it useful.
I tried to create a new lexer, but could not make the rules working for my language to highlight a list of keywords.
I have the styles & parser to work, but rules seems to be more complex to make it work.

Can someone provide me any hints or documentation on how to make the rules work and highlight the list of keywords.

Thx & Regards.

Posted: 05.03.2013 14:13
by Alexey
If u see lexers such as C or Pascal, see "Key words" rule at start.Its words are listed on right tabs.

Posted: 05.03.2013 14:33
by checkid
Hi Alexey,
Thx for the very quick reply.
I was actually importing the styles/parsers from C as I am creating a lexer which is somewhat similar to C.
The import of keywords alone did not work and hence I am trying to create the rules alone manually.

I actually imported the Keywords rule from C and then changed the keywords list under the conditions tab.
As it did not work, I am trying other manual means and looking for documents.

Thx & Regards.

Posted: 05.03.2013 14:43
by Alexey
send me Ur lexer LCF file. and *small* sample file.

Posted: 05.03.2013 15:23
by checkid
Hi Alexey,
Attached both the files. Remove the ".txt" extension in both of them.

Thx & Regards.

Posted: 05.03.2013 15:49
by Alexey
Parser tab-- no rule for/with "Identifier" type. make it.
Styles tab-- rule for Identifier is disabled.

Posted: 06.03.2013 13:16
by checkid
Thx Alexey for your suggetion.
I tried what you mentioned... but could not figure out what should be regex values for the parser.
I tried /w+ as mentioned in yet another thread. But it started highlighting all the words (Which I believe is right for this regex).

In short, I could not still complete this task. Anyway, thx for your time.

Thx & Regards.

Posted: 06.03.2013 13:36
by Alexey
-But it started highlighting all the words
It OK. Change style for "Identifier" to black color. now all words hilited black. change style for "Keyword" to purple, set this stl for your Keywords rule (Rules tab). now all keywords hilited purple. (other are black)

Posted: 06.03.2013 15:27
by checkid
Alexey.
Problem is resolved. Thx for your support. :)
Btw is there a possibility for creating two rules with two different sets of keywords.

It is not mandatory, but just wondering.
Any case... I will try it on my own and see how it is workings.

Thx & Regards.

Posted: 22.03.2013 02:50
by Alexey
ye.of course. Create 2nd rule, set its override style to other one.