-
Currently the following expression will always succeed for the B segments...
How can we implement grammar so that the rule is optional, and it only fails when something is provided? So for the above example:
|
Beta Was this translation helpful? Give feedback.
Answered by
CAD97
Jun 28, 2022
Replies: 1 comment 1 reply
-
The EOI rule requires the End of Input, so More generally, you need to use As an example:
- list
- a: "a"
- a: "abbbb"
- error: "a##bb"
- a: "a" |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
chichid
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The EOI rule requires the End of Input, so
{ "a" ~ B* ~ EOI }
works here as specifically what you asked for.More generally, you need to use
&
or!
lookahead; you could use!"#"
to require that the following is not#
, or&"b"
to require that ab
follows.As an example: