pub enum AstNode {
Show 19 variants
Literal(char),
CharClass(CharClass),
StartAnchor,
EndAnchor,
WordBoundary,
StartWord,
EndWord,
SetMatchStart,
SetMatchEnd,
ZeroOrMore {
node: Box<AstNode>,
greedy: bool,
},
OneOrMore {
node: Box<AstNode>,
greedy: bool,
},
Optional {
node: Box<AstNode>,
greedy: bool,
},
Exact {
node: Box<AstNode>,
count: usize,
},
Range {
node: Box<AstNode>,
min: usize,
max: Option<usize>,
greedy: bool,
},
Group {
nodes: Vec<AstNode>,
name: Option<String>,
capture: bool,
index: Option<usize>,
},
Alternation(Vec<Vec<AstNode>>),
Backref(usize),
LookAhead {
nodes: Vec<AstNode>,
positive: bool,
},
LookBehind {
nodes: Vec<AstNode>,
positive: bool,
},
}Expand description
Represents a node in the Abstract Syntax Tree (AST) of a regular expression.
Variants§
Literal(char)
A literal character match.
CharClass(CharClass)
A character class (e.g., \d, [a-z], .).
StartAnchor
Start of string (or line in multiline mode) anchor ^.
EndAnchor
End of string (or line in multiline mode) anchor $.
WordBoundary
Word boundary anchor \b.
StartWord
Start of word anchor \<.
EndWord
End of word anchor \>.
SetMatchStart
Sets the start of the match \zs.
SetMatchEnd
Sets the end of the match \ze.
ZeroOrMore
Zero or more repetitions *.
Fields
OneOrMore
One or more repetitions +.
Fields
Optional
Zero or one repetition ?.
Fields
Exact
Exact number of repetitions {n}.
Range
Range of repetitions {n,m} or {n,}.
Fields
Group
A capturing or non-capturing group (...).
Fields
Alternation(Vec<Vec<AstNode>>)
Alternation |.
Backref(usize)
Backreference to a captured group \n.
LookAhead
Lookahead assertion (?>=...) or (?>!...).
Fields
LookBehind
Lookbehind assertion (?<=...) or (?<!...).
Trait Implementations§
impl StructuralPartialEq for AstNode
Auto Trait Implementations§
impl Freeze for AstNode
impl RefUnwindSafe for AstNode
impl Send for AstNode
impl Sync for AstNode
impl Unpin for AstNode
impl UnwindSafe for AstNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more