Enum pest_meta::optimizer::OptimizedExpr
source · [−]pub enum OptimizedExpr {
Show 14 variants
Str(String),
Insens(String),
Range(String, String),
Ident(String),
PeekSlice(i32, Option<i32>),
PosPred(Box<OptimizedExpr>),
NegPred(Box<OptimizedExpr>),
Seq(Box<OptimizedExpr>, Box<OptimizedExpr>),
Choice(Box<OptimizedExpr>, Box<OptimizedExpr>),
Opt(Box<OptimizedExpr>),
Rep(Box<OptimizedExpr>),
Skip(Vec<String>),
Push(Box<OptimizedExpr>),
RestoreOnErr(Box<OptimizedExpr>),
}
Expand description
The optimized version of the pest AST’s Expr
.
Variants
Str(String)
Matches an exact string, e.g. "a"
Insens(String)
Matches an exact string, case insensitively (ASCII only), e.g. ^"a"
Range(String, String)
Matches one character in the range, e.g. 'a'..'z'
Ident(String)
Matches the rule with the given name, e.g. a
PeekSlice(i32, Option<i32>)
Matches a custom part of the stack, e.g. PEEK[..]
PosPred(Box<OptimizedExpr>)
Positive lookahead; matches expression without making progress, e.g. &e
NegPred(Box<OptimizedExpr>)
Negative lookahead; matches if expression doesn’t match, without making progress, e.g. !e
Seq(Box<OptimizedExpr>, Box<OptimizedExpr>)
Matches a sequence of two expressions, e.g. e1 ~ e2
Choice(Box<OptimizedExpr>, Box<OptimizedExpr>)
Matches either of two expressions, e.g. e1 | e2
Opt(Box<OptimizedExpr>)
Optionally matches an expression, e.g. e?
Rep(Box<OptimizedExpr>)
Matches an expression zero or more times, e.g. e*
Skip(Vec<String>)
Continues to match expressions until one of the strings in the Vec
is found
Push(Box<OptimizedExpr>)
Matches an expression and pushes it to the stack, e.g. push(e)
RestoreOnErr(Box<OptimizedExpr>)
Restores an expression’s checkpoint
Implementations
sourceimpl OptimizedExpr
impl OptimizedExpr
sourcepub fn iter_top_down(&self) -> OptimizedExprTopDownIteratorⓘNotable traits for OptimizedExprTopDownIteratorimpl Iterator for OptimizedExprTopDownIterator type Item = OptimizedExpr;
pub fn iter_top_down(&self) -> OptimizedExprTopDownIteratorⓘNotable traits for OptimizedExprTopDownIteratorimpl Iterator for OptimizedExprTopDownIterator type Item = OptimizedExpr;
Returns a top-down iterator over the OptimizedExpr
.
sourcepub fn map_top_down<F>(self, f: F) -> OptimizedExpr where
F: FnMut(OptimizedExpr) -> OptimizedExpr,
pub fn map_top_down<F>(self, f: F) -> OptimizedExpr where
F: FnMut(OptimizedExpr) -> OptimizedExpr,
Applies f
to the OptimizedExpr
top-down.
sourcepub fn map_bottom_up<F>(self, f: F) -> OptimizedExpr where
F: FnMut(OptimizedExpr) -> OptimizedExpr,
pub fn map_bottom_up<F>(self, f: F) -> OptimizedExpr where
F: FnMut(OptimizedExpr) -> OptimizedExpr,
Applies f
to the OptimizedExpr
bottom-up.
Trait Implementations
sourceimpl Clone for OptimizedExpr
impl Clone for OptimizedExpr
sourcefn clone(&self) -> OptimizedExpr
fn clone(&self) -> OptimizedExpr
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for OptimizedExpr
impl Debug for OptimizedExpr
sourceimpl PartialEq<OptimizedExpr> for OptimizedExpr
impl PartialEq<OptimizedExpr> for OptimizedExpr
sourcefn eq(&self, other: &OptimizedExpr) -> bool
fn eq(&self, other: &OptimizedExpr) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &OptimizedExpr) -> bool
fn ne(&self, other: &OptimizedExpr) -> bool
This method tests for !=
.
impl Eq for OptimizedExpr
impl StructuralEq for OptimizedExpr
impl StructuralPartialEq for OptimizedExpr
Auto Trait Implementations
impl RefUnwindSafe for OptimizedExpr
impl Send for OptimizedExpr
impl Sync for OptimizedExpr
impl Unpin for OptimizedExpr
impl UnwindSafe for OptimizedExpr
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more