pub enum Lookahead {
Positive,
Negative,
None,
}
Expand description
The current lookahead status of a ParserState
.
Variants§
Positive
The positive predicate, written as an ampersand &, attempts to match its inner expression. If the inner expression succeeds, parsing continues, but at the same position as the predicate — &foo ~ bar is thus a kind of “AND” statement: “the input string must match foo AND bar”. If the inner expression fails, the whole expression fails too.
Negative
The negative predicate, written as an exclamation mark !, attempts to match its inner expression. If the inner expression fails, the predicate succeeds and parsing continues at the same position as the predicate. If the inner expression succeeds, the predicate fails — !foo ~ bar is thus a kind of “NOT” statement: “the input string must match bar but NOT foo”.
None
No lookahead (i.e. it will consume input).