Unsure how to capture optional tokens after recursively capturing a list #412
-
Participle is a fantastic resource which I'm enjoying thoroughly. I'm sure that my issue is simply a lack of understanding parser internals on my part, but I'm stymied - hopefully someone can point me in the right direction. If so, I'll be quite grateful for the help. I'm implementing a parser for Visual Format Language - grammar at the bottom of the linked page - and I've hit an issue where I'm unable to capture an optional grammar element which comes after one or more instances of another grammar element. A specific example:
In this example, the Code is as follows, with the final test case being the one which fails.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I haven't looked in detail, but using |
Beta Was this translation helpful? Give feedback.
I haven't looked in detail, but using
participle.UseLookahead()
fixes this. What's likely happening is that there is some ambiguity between the inner case andTrailingSuperViewConnection
, so the inner case partially matches, but fails to match completely.