tmLanguage support for strange multiline string literal

164 Views Asked by At

I've got an extension for the LPC programming language for Visual Studio Code. I'm using tmLanguage grammars. However, I haven't figure out a way to support the language's multiline string literals.

regex would be: @{1,2}(\w*)\n((.|\n)*?)\n(###\s*)?(\1)\b

example syntax to match:

  set_help_str(@HELP
Lorem ipsum dolor sit amet, "Consectetur adipiscing elit," sed do 
eiusmod tempor incididunt ut's labore et dolore magna aliqua. Ut 
enim ad minim veniam, quis nostrud exercitation ullamco laboris.
HELP);

This is basically the last bit of syntax I need to get right and I really haven't figured out a way to handle it.

Any help would be greatly appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

This can't really be done with tmLanguage since their regex only reads a single line at a time and wouldn't really support this.

I'll have to write a language server to handle this.