pub enum PExpr {
Show 20 variants
Bool(bool),
Int(i64),
Str(StrId),
La(isize),
TokenText(isize),
TokenIndexAdjacent,
CtxRuleText(usize),
Member(usize),
LocalArg,
Column,
TokenStartColumn,
TokenTextSoFar,
IsNull(ExprId),
Not(ExprId),
And(Box<[ExprId]>),
Or(Box<[ExprId]>),
Cmp(CmpOp, ExprId, ExprId),
Arith(ArithOp, ExprId, ExprId),
Hook(HookId),
EvalTrace(bool),
}Expand description
Pure predicate expression node.
Text-valued nodes (Self::Str, Self::TokenText,
Self::CtxRuleText, Self::TokenTextSoFar) are only meaningful as
operands of Self::Cmp or Self::IsNull; evaluating one in any other
position yields Value::Null.
Variants§
Bool(bool)
Boolean literal.
Int(i64)
Integer literal.
Str(StrId)
Interned text literal (comparison operand only).
La(isize)
Token type of LT(offset) (parser) or lookahead char (lexer).
TokenText(isize)
Text of the token at LT(offset); Null when the token is absent.
TokenIndexAdjacent
Whether the two most recently consumed tokens were adjacent in the
token stream (LT(-2).index + 1 == LT(-1).index); false when either
is absent.
CtxRuleText(usize)
Text of the current rule context’s first child with this rule index; Null when the context or child is absent.
Member(usize)
Integer state slot declared by the grammar (@members counters).
LocalArg
Integer argument of the current rule invocation; Null when the rule was invoked without one.
Column
Lexer: current character position within the line.
TokenStartColumn
Lexer: character position of the current token’s first character.
TokenTextSoFar
Lexer: text matched so far for the in-progress token.
IsNull(ExprId)
True when the operand evaluates to Null (or, for a text-valued operand, when its text is absent).
Not(ExprId)
Logical negation of the operand’s truthiness.
And(Box<[ExprId]>)
Short-circuit conjunction, evaluated left to right.
Or(Box<[ExprId]>)
Short-circuit disjunction, evaluated left to right.
Cmp(CmpOp, ExprId, ExprId)
Comparison; text operands take the text-comparison path.
Arith(ArithOp, ExprId, ExprId)
Integer arithmetic with Null propagation.
Hook(HookId)
Defer to the context’s hook table.
EvalTrace(bool)
Return a boolean while letting the recognizer report the evaluation.
This keeps ANTLR runtime-testsuite Invoke_pred templates data-driven
without making ordinary predicates effectful.