And are there any general guidelines for how to approach writing a language definition? For example I use a lot of code like this:
match: (?=some_lookahead)
push:
- meta_scope: meta.some_statement
- match: some_lookahead
scope: keyword
- match: next_word
scope: variable.other
- include: expression
- match: \(\)
scope: parens
which is intended to match lines like some_lookahead next_word (2+1)*3 ()
. However I don’t know if this is the right way to do this, it is just based on examples I have seen and I don’t know the theory behind its use or when to apply this trick. For example, the MagicPython
package seems to be very well structured but I’m not sure what the reasoning behind it was.