regex_syntax::hir - Rust (original) (raw)

Expand description

Defines a high-level intermediate (HIR) representation for regular expressions.

The HIR is represented by the Hir type, and it principally constructed viatranslation from an Ast. Alternatively, users may use the smart constructors defined on Hir to build their own by hand. The smart constructors simultaneously simplify and “optimize” the HIR, and are also the same routines used by translation.

Most regex engines only have an HIR like this, and usually construct it directly from the concrete syntax. This crate however first parses the concrete syntax into an Ast, and only then creates the HIR from the Ast, as mentioned above. It’s done this way to facilitate better error reporting, and to have a structured representation of a regex that faithfully represents its concrete syntax. Namely, while an Hir value can be converted back to an equivalent regex pattern string, it is unlikely to look like the original due to its simplified structure.

literal

Provides literal extraction from Hir expressions.

print

This module provides a regular expression printer for Hir.

translate

Defines a translator that converts an Ast to an Hir.

Capture

The high-level intermediate representation for a capturing group.

CaseFoldError

An error that occurs when Unicode-aware simple case folding fails.

ClassBytes

A set of characters represented by arbitrary bytes.

ClassBytesIter

An iterator over all ranges in a byte character class.

ClassBytesRange

A single range of characters represented by arbitrary bytes.

ClassUnicode

A set of characters represented by Unicode scalar values.

ClassUnicodeIter

An iterator over all ranges in a Unicode character class.

ClassUnicodeRange

A single range of characters represented by Unicode scalar values.

Error

An error that can occur while translating an Ast to a Hir.

Hir

A high-level intermediate representation (HIR) for a regular expression.

Literal

The high-level intermediate representation of a literal.

LookSet

A set of look-around assertions.

LookSetIter

An iterator over all look-around assertions in a LookSet.

Properties

A type that collects various properties of an HIR value.

Repetition

The high-level intermediate representation of a repetition operator.

Class

The high-level intermediate representation of a character class.

Dot

A type describing the different flavors of ..

ErrorKind

The type of an error that occurred while building an Hir.

HirKind

The underlying kind of an arbitrary Hir expression.

Look

The high-level intermediate representation for a look-around assertion.

Visitor

A trait for visiting the high-level IR (HIR) in depth first order.

visit

Executes an implementation of Visitor in constant stack space.