Capture in regex_syntax::hir - Rust (original) (raw)
pub struct Capture {
pub index: u32,
pub name: Option<Box<str>>,
pub sub: Box<Hir>,
}
Expand description
The high-level intermediate representation for a capturing group.
A capturing group always has an index and a child expression. It may also have a name associated with it (e.g., (?P<foo>\w)
), but it’s not necessary.
Note that there is no explicit representation of a non-capturing group in a Hir
. Instead, non-capturing grouping is handled automatically by the recursive structure of the Hir
itself.
The capture index of the capture.
The name of the capture, if it exists.
The expression inside the capturing group, which may be empty.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient, and should not be overridden without very good reason.