Ast in regex_syntax::ast - Rust (original) (raw)

pub enum Ast {
    Empty(Box<Span>),
    Flags(Box<SetFlags>),
    Literal(Box<Literal>),
    Dot(Box<Span>),
    Assertion(Box<Assertion>),
    ClassUnicode(Box<ClassUnicode>),
    ClassPerl(Box<ClassPerl>),
    ClassBracketed(Box<ClassBracketed>),
    Repetition(Box<Repetition>),
    Group(Box<Group>),
    Alternation(Box<Alternation>),
    Concat(Box<Concat>),
}

Expand description

An abstract syntax tree for a single regular expression.

An Ast’s fmt::Display implementation uses constant stack space and heap space proportional to the size of the Ast.

This type defines its own destructor that uses constant stack space and heap space proportional to the size of the Ast.

§

An empty regex that matches everything.

§

A set of flags, e.g., (?is).

§

A single character literal, which includes escape sequences.

§

The “any character” class.

§

A single zero-width assertion.

§

A single Unicode character class, e.g., \pL or \p{Greek}.

§

A single perl character class, e.g., \d or \W.

§

A single bracketed character class set, which may contain zero or more character ranges and/or zero or more nested classes. e.g.,[a-zA-Z\pL].

§

A repetition operator applied to an arbitrary regular expression.

§

A grouped regular expression.

§

An alternation of regular expressions.

§

A concatenation of regular expressions.

Source§

Source

Create an “empty” AST item.

Source

Create a “flags” AST item.

Source

Create a “literal” AST item.

Source

Create a “dot” AST item.

Source

Create a “assertion” AST item.

Source

Create a “Unicode class” AST item.

Source

Create a “Perl class” AST item.

Source

Create a “bracketed class” AST item.

Source

Create a “repetition” AST item.

Source

Create a “group” AST item.

Source

Create a “alternation” AST item.

Source

Create a “concat” AST item.

Source

Return the span of this abstract syntax tree.

Source

Return true if and only if this Ast is empty.

Source§

Source§

Generate an arbitrary value of Self from the given unstructured data. Read more

Source§

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Source§

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Source§

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Source§

Source§

Source§

Print a display representation of this Ast.

This does not preserve any of the original whitespace formatting that may have originally been present in the concrete syntax from which this Ast was generated.

This implementation uses constant stack space and heap space proportional to the size of the Ast.

Source§

A custom Drop impl is used for Ast such that it uses constant stack space but heap space proportional to the depth of the Ast.

Source§

Source§

Tests for self and other values to be equal, and is used by ==.

1.0.0 · Source§

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Source§

Source§

§

§

§

§

§

§