-
Is there a way? I have a situation in my grammar, I allow an
The closing
Because it will see the This rule "works" ifEnd
: END activeStmt?
| END IF?
; But attaches that possible valid statement to the parse tree as if it was part of the statement. I want to only match the END in that first case so that the ifEnd
: END activeStmt -> END // pretend we only saw 'end' and push all other tokens back into the stream and let the rest of the parse continue.
| END IF? // what follows 'end' is not another legal statement, so if its an 'if' consume that and let the rest of the parse continue.
; That kind of thing, but I have no idea if Antlr supports this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm closing this. The reason the parse failed was legitimate in the actual test case, also I think the behavior I want is already present as I found, described in this post. |
Beta Was this translation helpful? Give feedback.
I'm closing this. The reason the parse failed was legitimate in the actual test case, also I think the behavior I want is already present as I found, described in this post.
#4130