Replies: 3 comments
-
Note: as a workaround, the case above would work if separated in multiple rules:
|
Beta Was this translation helpful? Give feedback.
-
You are correct. Behind the scenes, the tokenizer is "compiled" and actually all regular expressions get transformed to the form
But the transformation basically disables any effect So I think this is a permanent limitation of Monarch (using |
Beta Was this translation helpful? Give feedback.
-
Seems fair to me and as the workaround is straightforward I think it doesn't really need to be 'fixed' -- maybe a log warning as you mentioned would be interesting -- the limitation is already documented in this bug report, so, that's enough for me... p.s.: thanks for the prompt support ;) |
Beta Was this translation helpful? Give feedback.
-
It's possible to reproduce this in the playground (https://microsoft.github.io/monaco-editor/monarch.html) with:
Language syntax definition
:Language editor
:So,
#
shouldn't match a comment unless it's at the start of the line or if it's preceded by 2 spaces, but in this case it's still matching.Apparently, the
^
stops matching when the rule is put inside of a parenthesis (so, if the rule is just:/^#.*
, it works, but when it becomes/(^#.*)/
it stops working (even without the|
above).Note: something similar was previously reported at: #1818, but the specific case there still seems to be working, so, this is probably a different issue.
Beta Was this translation helpful? Give feedback.
All reactions