rust/compiler/rustc_parse/src/parser
Nicholas Nethercote 9d31f86f0d Overhaul token collection.
This commit does the following.

- Renames `collect_tokens_trailing_token` as `collect_tokens`, because
  (a) it's annoying long, and (b) the `_trailing_token` bit is less
  accurate now that its types have changed.

- In `collect_tokens`, adds a `Option<CollectPos>` argument and a
  `UsePreAttrPos` in the return type of `f`. These are used in
  `parse_expr_force_collect` (for vanilla expressions) and in
  `parse_stmt_without_recovery` (for two different cases of expression
  statements). Together these ensure are enough to fix all the problems
  with token collection and assoc expressions. The changes to the
  `stringify.rs` test demonstrate some of these.

- Adds a new test. The code in this test was causing an assertion
  failure prior to this commit, due to an invalid `NodeRange`.

The extra complexity is annoying, but necessary to fix the existing
problems.
2024-08-16 09:07:55 +10:00
..
mut_visit Reformat use declarations. 2024-07-29 08:26:52 +10:00
tokenstream Reformat use declarations. 2024-07-29 08:26:52 +10:00
attr_wrapper.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
attr.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
diagnostics.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
expr.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
generics.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
item.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
mod.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
nonterminal.rs Rollup merge of #126697 - vincenzopalazzo:macros/find_the_expression_tok, r=eholk,compiler-errors 2024-07-31 23:20:09 +02:00
pat.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
path.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
stmt.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
tests.rs Use assert_matches around the compiler 2024-08-11 12:25:39 -04:00
ty.rs Use impl PartialEq<TokenKind> for Token more. 2024-08-14 16:37:09 +10:00