I am currently writing a syntax shortcut for the Monaco editor using Monarch .
I use statesto work with tokens differently depending on where they are in the string.
What I would like to do is states when I reach the end of the line , since all the lines are independent. @popall
Right now, the only way I've found is to add conditions at the end of all my rules, something like this:
[/\}/, {cases: {'@eos':{token: 'keyword', next:'@popall'},
'@default':{token: 'keyword', next:'@pop'}}}],
which is really redundant, obviously, since my 50+ rules have this case.
What is the clean way to do this?
source
share