pub enum ParserPredicate {
True,
False,
FalseWithMessage {
message: &'static str,
},
Invoke {
value: bool,
},
LookaheadTextEquals {
offset: isize,
text: &'static str,
},
LookaheadNotEquals {
offset: isize,
token_type: i32,
},
LocalIntEquals {
value: i64,
},
LocalIntLessOrEqual {
value: i64,
},
MemberModuloEquals {
member: usize,
modulus: i64,
value: i64,
equals: bool,
},
}Expand description
Parser semantic predicate rendered from a supported target template.
The metadata recognizer evaluates these at the token-stream index where the predicate transition is reached. Unsupported or absent predicate templates remain unconditional so existing generated parsers keep their previous behavior unless the generator opts into this table.
Variants§
True
False
FalseWithMessage
Predicate that always fails and carries ANTLR’s <fail='...'> message.
Invoke
Target-template test helper that reports predicate evaluation before returning the wrapped boolean value.
LookaheadTextEquals
LookaheadNotEquals
LocalIntEquals
Compares the current rule invocation’s integer argument with a literal
value from a supported ValEquals("$i", "...") target template.
LocalIntLessOrEqual
Checks ANTLR-style raw predicates like 5 >= $_p against the current
rule invocation’s integer argument.
MemberModuloEquals
Compares a generated parser integer member modulo a literal value.
Trait Implementations§
Source§impl Clone for ParserPredicate
impl Clone for ParserPredicate
Source§fn clone(&self) -> ParserPredicate
fn clone(&self) -> ParserPredicate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParserPredicate
impl Debug for ParserPredicate
Source§impl Ord for ParserPredicate
impl Ord for ParserPredicate
Source§fn cmp(&self, other: &ParserPredicate) -> Ordering
fn cmp(&self, other: &ParserPredicate) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ParserPredicate
impl PartialEq for ParserPredicate
Source§fn eq(&self, other: &ParserPredicate) -> bool
fn eq(&self, other: &ParserPredicate) -> bool
self and other values to be equal, and is used by ==.