Skip to main content

PExpr

Enum PExpr 

Source
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.

Trait Implementations§

Source§

impl Clone for PExpr

Source§

fn clone(&self) -> PExpr

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PExpr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PExpr

Source§

impl PartialEq for PExpr

Source§

fn eq(&self, other: &PExpr) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PExpr

Auto Trait Implementations§

§

impl Freeze for PExpr

§

impl RefUnwindSafe for PExpr

§

impl Send for PExpr

§

impl Sync for PExpr

§

impl Unpin for PExpr

§

impl UnsafeUnpin for PExpr

§

impl UnwindSafe for PExpr

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.