]> git.lizzy.rs Git - rust.git/commit
Remove `TokenCursorFrame`.
authorNicholas Nethercote <n.nethercote@gmail.com>
Wed, 1 Feb 2023 01:43:13 +0000 (12:43 +1100)
committerNicholas Nethercote <n.nethercote@gmail.com>
Thu, 2 Feb 2023 23:06:52 +0000 (10:06 +1100)
commitb5ecbbb998aae80541d70bf5c93be92e6c59a7a8
tree5113f17ff004a5b175a4d5a23e0f17b14e1c79dd
parentb23f272db017c3bfd8cdf57fad6e5fdd057168c6
Remove `TokenCursorFrame`.

The motivation here is to eliminate the `Option<(Delimiter,
DelimSpan)>`, which is `None` for the outermost token stream and `Some`
for all other token streams.

We are already treating the innermost frame specially -- this is the
`frame` vs `stack` distinction in `TokenCursor`. We can push that
further so that `frame` only contains the cursor, and `stack` elements
contain the delimiters for their children. When we are in the outermost
token stream `stack` is empty, so there are no stored delimiters, which
is what we want because the outermost token stream *has* no delimiters.

This change also shrinks `TokenCursor`, which shrinks `Parser` and
`LazyAttrTokenStreamImpl`, which is nice.
compiler/rustc_parse/src/parser/attr_wrapper.rs
compiler/rustc_parse/src/parser/expr.rs
compiler/rustc_parse/src/parser/mod.rs