Enum rslint_regex::Node[][src]

pub enum Node {
    Empty,
    Disjunction(SpanVec<Node>),
    Assertion(SpanAssertionKind),
    Alternative(SpanVec<Node>),
    Literal(SpancharString),
    PerlClass(SpanClassPerlKindbool),
    BackReference(Spanu32),
    Dot(Span),
    CharacterClass(SpanCharacterClass),
    Group(SpanGroup),
    Quantifier(SpanBox<Node>, QuantifierKindbool),
    NamedBackReference(SpanString),
}
Expand description

The tree structure that is used to represent parsed RegEx patterns.

Variants

Empty

An empty regex node.

Disjunction(SpanVec<Node>)

An “either or”. (e.g. a|b)

Tuple Fields of Disjunction

0: Span1: Vec<Node>
Assertion(SpanAssertionKind)

A single assertion.

Tuple Fields of Assertion

0: Span1: AssertionKind
Alternative(SpanVec<Node>)

A concatenation of regex nodes. (e.g. ab)

Tuple Fields of Alternative

0: Span1: Vec<Node>
Literal(SpancharString)

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.

Tuple Fields of Literal

0: Span1: char2: String
PerlClass(SpanClassPerlKindbool)

Matches a character class (e.g. \d or \w).

The bool argument indicates if this perl class is negated.

Tuple Fields of PerlClass

0: Span1: ClassPerlKind2: bool
BackReference(Spanu32)

A back reference to a previous group (\1, \2, …).

Tuple Fields of BackReference

0: Span1: u32
Dot(Span)

A . that matches everything.

Tuple Fields of Dot

0: Span
CharacterClass(SpanCharacterClass)

A class of multiple characters such as [A-Z0-9]

Tuple Fields of CharacterClass

0: Span1: CharacterClass
Group(SpanGroup)

A grouped pattern

Tuple Fields of Group

0: Span1: Group
Quantifier(SpanBox<Node>, QuantifierKindbool)

A quantifier which optionally matches or matches multiple times. bool indicates whether a lazy quantifier (?) is present after it.

Tuple Fields of Quantifier

0: Span1: Box<Node>2: QuantifierKind3: bool
NamedBackReference(SpanString)

A reference to a group using a name

Tuple Fields of NamedBackReference

0: Span1: String

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Converts the given value to a String. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.