Regex creating language packet with multiline comment


#1

I’m making a language package for a language that has a very strange comment syntax that works like this:

remark

the actual comment
/

I’ve managed to get it to work so that it would only recognize the ‘remark’ as the begin and ‘/’ as the end variable, but that’s not strictly accurate. I then attempted to add the ‘’ to the begin, but without any success.

patterns: [ # An array of individual pattern declarations.
{
name: ‘comment.block.wts’
begin: ‘^remark$(\r\n|\r|\n)^\$’
end: ‘/’
}

I figured that atom might have certain conditions for begin and end so that they could only be 1 line so I made a regex pattern that would take everything into account as a multiline regex, but it doesn’t seem to work either.

{
name: ‘comment.block.wts’
match: ‘^remark$(\r\n|\r|\n)^\$[\s\S]*(\r\n|\r|\n)/’
}
]


#2

Just noticed that the first section has the \ missing and I can’t edit or delete the post, the comment syntax works like this:
remark

the actual comment
/

I then attempted to add the ‘’ to the begin, but without success*

Sorry for the confusion.


#3

Only one line is possible with TextMate grammars (that kind). There’s no way around it, because the regex is tested on one line at a time.


#4

When posting code, don’t forget to mark it as code by highlighting it and pressing the </> button above the editor. Then we will actually be able to see what you want us to see.