Enum rslint_regex::Node [−][src]
pub enum Node {
Empty,
Disjunction(Span, Vec<Node>),
Assertion(Span, AssertionKind),
Alternative(Span, Vec<Node>),
Literal(Span, char, String),
PerlClass(Span, ClassPerlKind, bool),
BackReference(Span, u32),
Dot(Span),
CharacterClass(Span, CharacterClass),
Group(Span, Group),
Quantifier(Span, Box<Node>, QuantifierKind, bool),
NamedBackReference(Span, String),
}
Expand description
The tree structure that is used to represent parsed RegEx patterns.
Variants
An empty regex node.
An “either or”. (e.g. a|b
)
Assertion(Span, AssertionKind)
A single assertion.
Tuple Fields of Assertion
0: Span
1: AssertionKind
A concatenation of regex nodes. (e.g. ab
)
A single character literal. The String represents the raw string representing the literal which is used to turn the node back into a string without writing explicit newlines for example.
PerlClass(Span, ClassPerlKind, bool)
Matches a character class (e.g. \d
or \w
).
The bool argument indicates if this perl class is negated.
Tuple Fields of PerlClass
A back reference to a previous group (\1
, \2
, …).
Dot(Span)
A .
that matches everything.
Tuple Fields of Dot
0: Span
CharacterClass(Span, CharacterClass)
A class of multiple characters such as [A-Z0-9]
Tuple Fields of CharacterClass
0: Span
1: CharacterClass
A grouped pattern
Quantifier(Span, Box<Node>, QuantifierKind, bool)
A quantifier which optionally matches or matches multiple times.
bool
indicates whether a lazy quantifier (?
) is present after it.
Tuple Fields of Quantifier
A reference to a group using a name
Implementations
if this node is an alternative, yield an iterator over those nodes, otherwise yield the node itself.
get the span of this node, returns None
if the node is an empty node.
check if this node is equal to some text
create a new node from a string. This method is mostly just used for making simple nodes for replacement.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Node
impl UnwindSafe for Node
Blanket Implementations
Mutably borrows from an owned value. Read more