I’m currently writing a Sublime syntax mode (YAML, for v3) for a language which has an unusual comment format.
Documentation comments:
- start with the symbol
#
as the first character in a LOC, and - end with two newlines
A simple example is this:
# The following function returns
the opposite of what you think it does.
code...
and a worst-case example:
#
This is a comment,
this is still the same comment.
This, too. These don't matter: # foobar ##
code...
My current approach is to use the stack.
Push:
- match: '#'
scope: punctuation.definition.comment.mona
push: doc_comment
Pop:
line_comment:
- meta_scope: comment.line.mona
- match: '\n\n'
pop: true
That doesn’t work though. I tried to fix this by using s
, thinking that it would produce behavior like this, but it produces a Sublime error (invalid option for capture group).
How can I match this comment format correctly with S3 YAML?