EBNF Rule: And

Prev:EBNF Rule: Zero or more
Next:EBNF Rule: Not

Any rule element prefixed by an ampersand (&) performs the Parsing Expression Grammar 'And Predicate' match. It attempts to match the rule against the input string. It will cause the parse to succeed or fail depending on if the rule succeeds or fails. It will not consume anything from the input string however and does not leave any result in the AST. This can be used for lookahead and disambiguation in choices.

USING: prettyprint peg.ebnf ; "ab" EBNF[[ rule=&("a") "a" "b" ]] .
V{ "a" "b" }