Enum regex_syntax::hir::translate::HirFrame[][src]

enum HirFrame {
    Expr(Hir),
    ClassUnicode(ClassUnicode),
    ClassBytes(ClassBytes),
    Group {
        old_flags: Option<Flags>,
    },
    Concat,
    Alternation,
}

An HirFrame is a single stack frame, represented explicitly, which is created for each item in the Ast that we traverse.

Note that technically, this type doesn't represent our entire stack frame. In particular, the Ast visitor represents any state associated with traversing the Ast itself.

Variants

An arbitrary HIR expression. These get pushed whenever we hit a base case in the Ast. They get popped after an inductive (i.e., recursive) step is complete.

A Unicode character class. This frame is mutated as we descend into the Ast of a character class (which is itself its own mini recursive structure).

A byte-oriented character class. This frame is mutated as we descend into the Ast of a character class (which is itself its own mini recursive structure).

Byte character classes are created when Unicode mode (u) is disabled. If allow_invalid_utf8 is disabled (the default), then a byte character is only permitted to match ASCII text.

This is pushed on to the stack upon first seeing any kind of group, indicated by parentheses (including non-capturing groups). It is popped upon leaving a group.

Fields of Group

The old active flags, if any, when this group was opened.

If this group sets flags, then the new active flags are set to the result of merging the old flags with the flags introduced by this group.

When this group is popped, the active flags should be restored to the flags set here.

The "active" flags correspond to whatever flags are set in the Translator.

This is pushed whenever a concatenation is observed. After visiting every sub-expression in the concatenation, the translator's stack is popped until it sees a Concat frame.

This is pushed whenever an alternation is observed. After visiting every sub-expression in the alternation, the translator's stack is popped until it sees an Alternation frame.

Methods

impl HirFrame
[src]

Assert that the current stack frame is an Hir expression and return it.

Assert that the current stack frame is a Unicode class expression and return it.

Assert that the current stack frame is a byte class expression and return it.

Assert that the current stack frame is a group indicator and return its corresponding flags (the flags that were active at the time the group was entered) if they exist.

Trait Implementations

impl Clone for HirFrame
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for HirFrame
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for HirFrame

impl Sync for HirFrame