Struct syntax::ext::tt::macro_parser::MatcherPos[][src]

struct MatcherPos {
    top_elts: TokenTreeOrTokenTreeVec,
    idx: usize,
    sp_lo: BytePos,
    matches: Vec<Rc<Vec<NamedMatch>>>,
    match_lo: usize,
    match_cur: usize,
    match_hi: usize,
    seq_op: Option<KleeneOp>,
    sep: Option<Token>,
    up: Option<Box<MatcherPos>>,
    stack: Vec<MatcherTtFrame>,
}
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Represents a single "position" (aka "matcher position", aka "item"), as described in the module documentation.

Fields

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The token or sequence of tokens that make up the matcher

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The position of the "dot" in this matcher

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The beginning position in the source that the beginning of this matcher corresponds to. In other words, the token in the source at sp_lo is matched against the first token of the matcher.

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

For each named metavar in the matcher, we keep track of token trees matched against the metavar by the black box parser. In particular, there may be more than one match per metavar if we are in a repetition (each repetition matches each of the variables). Moreover, matchers and repetitions can be nested; the matches field is shared (hence the Rc) among all "nested" matchers. match_lo, match_cur, and match_hi keep track of the current position of the self matcher position in the shared matches list.

Also, note that while we are descending into a sequence, matchers are given their own matches vector. Only once we reach the end of a full repetition of the sequence do we add all bound matches from the submatcher into the shared top-level matches vector. If sep and up are Some, then matches is not the shared top-level list. Instead, if one wants the shared matches, one should use up.matches.

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The position in matches corresponding to the first metavar in this matcher's sequence of token trees. In other words, the first metavar in the first token of top_elts corresponds to matches[match_lo].

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The position in matches corresponding to the metavar we are currently trying to match against the source token stream. match_lo <= match_cur <= match_hi.

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Similar to match_lo except match_hi is the position in matches of the last metavar in this matcher.

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The KleeneOp of this sequence if we are in a repetition.

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The separator if we are in a repetition

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The "parent" matcher position if we are in a repetition. That is, the matcher position just before we enter the sequence.

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

When matching against matchers with nested delimited submatchers (e.g. pat ( pat ( .. ) pat ) pat), we need to keep track of the matchers we are descending into. This stack does that where the bottom of the stack is the outermost matcher.

Methods

impl MatcherPos
[src]

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

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Add m as a named match for the idx-th metavar.

Trait Implementations

impl Clone for MatcherPos
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl !Send for MatcherPos

impl !Sync for MatcherPos