Creating New Lexer for a relatively lesser used language

All questions regarding lexer highlighting schemes are discussed here...
checkid

Creating New Lexer for a relatively lesser used language

Post 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.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

If u see lexers such as C or Pascal, see "Key words" rule at start.Its words are listed on right tabs.
checkid

Post 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.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

send me Ur lexer LCF file. and *small* sample file.
checkid
Posts: 14
Joined: 05.03.2013 15:09

Post by checkid »

Hi Alexey,
Attached both the files. Remove the ".txt" extension in both of them.

Thx & Regards.
Attachments
sample.bc.txt
(3.87 KiB) Downloaded 292 times
MyOwn.lcf.txt
(10.44 KiB) Downloaded 298 times
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Parser tab-- no rule for/with "Identifier" type. make it.
Styles tab-- rule for Identifier is disabled.
checkid
Posts: 14
Joined: 05.03.2013 15:09

Post 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.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post 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)
checkid
Posts: 14
Joined: 05.03.2013 15:09

Post 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.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

ye.of course. Create 2nd rule, set its override style to other one.
Locked