Sublime Forum

Syntax context: matching without consuming?

#1

Refering to Sublime 3 syntax definition file:
Sometimes, while within a context you encounter a match that signals the end of this context. This match, however, might not belong to the current context, but to another context.
Is there a way not to “consume” a match? That is, if a context encounter this match it can act upon it (for example poping itself), but leave it on the input stream for another context to deal with?
Thanks

1 Like

#2

of course, just look a regex lookahead (?=match)

most famous example, HTML pushing into JavaScript and popping back to HTML at </script:

5 Likes

#3

Thanks! I didn’t know about look-arounds, very useful.

0 Likes