Replies: 7 comments 1 reply
-
Maybe it's too late, but the problem is the newline in the example code
I think that if you use raw strings the newline will be processed correctly, but aside from that the last grammar works correctly because I tested in pest editor |
Beta Was this translation helpful? Give feedback.
-
@siberianbluerobin I just tried a simplified version of the last grammar in the editor and it fails to parse even when there is whitespace.
It seems the |
Beta Was this translation helpful? Give feedback.
-
@dragazo My mistake, you are right, when I tested the grammar I didn't copy and paste just write short names for the identifiers This works
Sound like the WHITESPACE rule isn't replaced |
Beta Was this translation helpful? Give feedback.
-
@siberianbluerobin Yeah, by not defining |
Beta Was this translation helpful? Give feedback.
-
I'm facing a similar situation. Assuming we can't make rules both non-atomic, and silent, something that would be helpful for this is a rule type which is atomic only for that rule — no inheritance. So:
...forces whitespace between If |
Beta Was this translation helpful? Give feedback.
-
I'd like to use
and it failed to consume newline between stmt,
Is it an option to let parser take WHITESPACE non-greedily? |
Beta Was this translation helpful? Give feedback.
-
Having space delimited identifiers is really common and it's a shame to have to write what amount to a huge amount of boilerplate if you want this effect.
For me what makes it heavy is the lack of fine grained atomicity control inside the rule itself, since I often only want this behaviour in one specific place. |
Beta Was this translation helpful? Give feedback.
-
I want to match
"aaa bbb"
there must be at least one space between the two tokens "aaa" and "bbb"
the following works,
but is very inconvenient, because $ disables implicit whitespaces. So I have to manually add whitespace+ between all tokens. (this is fine, but I also need to add comments /**/ , as according to the doc, $ disables both )
Then I tried this,
this works too, however it also matches "aaabbb". I want to make sure there is at least one space.
In my opinion, the correct way should be
I thought this would enforce at least one space between "aaa" and "bbb".
however I got parsing error:
This I don't understand?
Beta Was this translation helpful? Give feedback.
All reactions