I know that I can use Ruby's regular expressions in a tmLanguage file, however that seems not to be the case in other configuration files, e.g. for extensions. Take for example the firstLine
value in the language contribution. I get errors when I use character classes (e.g. \s
or \p{L}
). Hence I wonder what is actually allowed there. How would you match whitespaces there?
Update: After the comments I tried this:
"firstLine": "^(lexer|parser)?\\s*grammar\\w+;"
which is supposed to match a first line like lexer grammar G1;
or just grammar G1;
. Is there a way to test if that RE works, because I have no validation otherwise?
Update 2:
It's essential to use the correct grammar and it will magically work:
"firstLine": "^(lexer|parser)?\\s*grammar\\s*\\w+\\s*;"