Closed oOosys closed 4 months ago
Thanks for the report. I'll fix this when I get the chance.
... Thanks for the reply. No urge in fixing ... if it were very important to me I would have sure already provided a fix myself. Just wanted to mention this issue for the sake of it.
OK ... it works like a charm :) and it was so easy to fix, that it can't be called a bug or issue but a simple oversight in first place, so it appears a bit strange that it wasn't over the years yet reported.
May you please explain a bit the mechanism used in this fix? It appears to demonstrate how to include exceptions from a rule triggered by a pattern by specifying a prefix one with -B('CharacterOrStringOrAnyRegex?')
to the pattern to_eol('CharacterOrStringOrAnyRegex?')
:
lex:add_rule('comment', lex:tag(lexer.COMMENT, -B('\\') * lexer.to_eol('#')))
I mean learning how things work by fixing issues is a much better way to make progress in understanding the underlying mechanisms than reading the manuals ...
It's kind of like regex look-behind. LPeg matches '#' (in lexer.to_eol('#')
), but only if it's not preceded by a '\' character.
Note: SciTE does it the right way ...