Matching multiline string for syntax highlighting


#1

I’m creating a custom language grammar and I want to match this:

@IGNORE
TESTCASE lorem ipsum…

My regexp for matching “@ignore”, ignore whitespaces/newlines, “testcase” is:
(@\b(?i:ignore)(\W*)(?im:(.*)testcase))

According to an online oniguruma engine this regexp correctly matches e.g. @Ignore \n TESTcase, but however in my language.cson this does not work:
{
“begin”: “(@\b(?i:ignore)(\W*)(?im:(.*)testcase))”,
“end”: “(?=(?i:end-testcase))”,
“name”: “comment.test”
}

So I am wondering if the string to be matched with the begin regexp is always only one line?
If so, how could I solve my problem?

Until now, everything works fine if the user writes

@Ignore Testcase lorem ipsum…

but adding a newline after @Ignore breaks the highlighting…and that is bad.

Any ideas?


#2

Yes, matches are single line only. There’s no way around that in a pure language grammar.