I've just started trying SynWrite because it seems to have a great flexibility my current editor doesn't have.
I've read the tutorials about how to write new lexers, but still have many questions.
For instance, how do I distinguish these construct:
Code: Select all
Class SomeClass
Procedure SomeProcedure
a=1
return
EndClass
Code: Select all
set procedure to AnotherFile.PRG additive
For the "Class ... EndClass" part I've defined one '_Class' rule of "Block type"="Range start" and one '_EndClass' rule of "BlockType"="Range end", and linked both with the respective "Range end" and "Range start" conditions.
For the "Procedure" part I've defined a '_Procedure' rule of type "Range start", I've assigned the "Range end condition"='_EndClass', I've marked it as a "Self closing range" (because there is no "EndProcedure" keyword in the language).
The problem is that the sentence "set procedure to..." is matched by the '_Procedure' rule and it should not.
To prevent that, I've defined a 'SetProcedureTo' parser with the regexp
Code: Select all
set\s+proc(edure)?\s+to
A second question (for now) is about keywords:
The language allows the programmer to be lazy (by writing only the first 4 characters of some keywords) and I've to deal with a lot of code where the original programmer does have been lazy and instead of "procedure", "enddo", "while", "endif", he has used "proc", "endd", "whil", "endi". Is there a why I can configure keywords that match with the trimmed version?
Thanks,
Senen