There is persistent problem with injected languages where unclosed parentheses or quotes eat whole document.
I'm proposing to add option e.g. applyEndPatternFirst. This would check such end pattern at every line before anything else. I've looked at code a bit and it seems possible, but I'm not familiar enough with engine to correctly implement this (at least without trashing performance).
Details:
- On
end match - everything before end would be extracted and checked again with sub-patterns and merged with end's tokens, while rest of line would be checked normally. Without match - business as usual.
- When multiple
end patterns with this option will be present, they should be stored and checked from first to last, at every line until any of them matches. There shouldn't be too many of them, since this should be used mainly with injected languages.
- Successful match will terminate all descendant rules, after matching "before end" part of line.
end with option should also match in line where before was found.
Why not use while? While while (sic) is great addition, it can only exclude whole line. Proposed option would allow stopping in mid-line.
There is persistent problem with injected languages where unclosed parentheses or quotes eat whole document.
I'm proposing to add option e.g.
applyEndPatternFirst. This would check suchendpattern at every line before anything else. I've looked at code a bit and it seems possible, but I'm not familiar enough with engine to correctly implement this (at least without trashing performance).Details:
endmatch - everything beforeendwould be extracted and checked again with sub-patterns and merged withend's tokens, while rest of line would be checked normally. Without match - business as usual.endpatterns with this option will be present, they should be stored and checked from first to last, at every line until any of them matches. There shouldn't be too many of them, since this should be used mainly with injected languages.endwith option should also match in line wherebeforewas found.Why not use
while? Whilewhile(sic) is great addition, it can only exclude whole line. Proposed option would allow stopping in mid-line.