-
Maybe I missed it somewhere in the docs, but it's unclear to me whether the JS regex (or Chevrotain/regexp-to-ast?) supports positive lookbehind or not? langium terminal: hidden terminal HeaderComment: /(?<=(TDB|SDB)\n)([\s\S]*)(?=(REPLACE|INSERT))/; Error Message:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
Hi @snarkipus, I imagine it supports it, but it will probably require some additional input from the dev to determine the first character which actually might match this regular expression (see here). In theory, you can override the I'm wondering a bit though, why does your terminal require positive lookbehind? Is the start of the comment not actually part of the comment? Maybe with a bit more context, we can work out a simpler solution for this. |
Beta Was this translation helpful? Give feedback.
-
Ok - so coming back to this (finally). I happened to notice that while this does work, it assigns the entire parsed section as the name of the node. This somewhat breaks a lot of other things in the process though. For instance, I'm trying to wrap my head around how the outline/breadcrumbs would work with the symbol and name providers. Any thoughts? Is it just a matter of hard coding the 'SDB' name into the language symbol provider? Does that seem like a reasonable solution? Working Terminalterminal SDBBlockHeader: /(SDB)([\s\S]*?)(?=(RANDOM-NUMBER-SEED:))/; |
Beta Was this translation helpful? Give feedback.
-
Hey @msujew , Does #917 improve (or is it applicable) for this use case? Maybe I'm not fully understanding fully the change since the following terminal rule works today and uses positive lookahead: terminal SDBBlockHeader: /(SDB)([\s\S]*?)(?=(RANDOM-NUMBER-SEED:))/; |
Beta Was this translation helpful? Give feedback.
Hi @snarkipus,
I imagine it supports it, but it will probably require some additional input from the dev to determine the first character which actually might match this regular expression (see here). In theory, you can override the
DefaultTokenBuilder.buildTerminalToken
method to add/calculate this token property manually.I'm wondering a bit though, why does your terminal require positive lookbehind? Is the start of the comment not actually part of the comment? Maybe with a bit more context, we can work out a simpler solution for this.