Commit dce0f7f
committed
Clarify
For the `MiddleDot` case, current behaviour:
- For a case like `1.2`, `sym1` is `1` and `sym2` is `2`, and `self.token`
holds `1.2`.
- It creates a new ident token from `sym1` that it puts into `self.token`.
- Then it does `bump_with` with a new dot token, which moves the `sym1`
token into `prev_token`.
- Then it does `bump_with` with a new ident token from `sym2`, which moves the
`dot` token into `prev_token` and discards the `sym1` token.
- Then it does `bump`, which puts whatever is next into `self.token`,
moves the `sym2` token into `prev_token`, and discards the `dot` token
altogether.
New behaviour:
- Skips creating and inserting the `sym1` and dot tokens, because they are
unnecessary.
- This also demonstrates that the comment about `Spacing::Alone` is
wrong -- that value is never used. That comment was added in #77250,
and AFAICT it has always been incorrect.
The commit also expands comments. I found this code hard to read
previously, the examples in comments make it easier.parse_dot_suffix_expr.1 parent 9c09116 commit dce0f7f
1 file changed
+19
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
999 | 998 | | |
1000 | 999 | | |
1001 | 1000 | | |
| 1001 | + | |
| 1002 | + | |
1002 | 1003 | | |
1003 | 1004 | | |
1004 | 1005 | | |
| |||
1010 | 1011 | | |
1011 | 1012 | | |
1012 | 1013 | | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
1013 | 1017 | | |
1014 | 1018 | | |
1015 | 1019 | | |
1016 | 1020 | | |
1017 | 1021 | | |
1018 | 1022 | | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
1019 | 1026 | | |
1020 | 1027 | | |
1021 | | - | |
1022 | 1028 | | |
1023 | 1029 | | |
1024 | 1030 | | |
1025 | 1031 | | |
1026 | 1032 | | |
1027 | | - | |
| 1033 | + | |
1028 | 1034 | | |
1029 | | - | |
1030 | | - | |
| 1035 | + | |
| 1036 | + | |
1031 | 1037 | | |
1032 | 1038 | | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
1040 | 1042 | | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
| 1043 | + | |
| 1044 | + | |
1044 | 1045 | | |
1045 | | - | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1046 | 1049 | | |
1047 | 1050 | | |
1048 | 1051 | | |
| |||
0 commit comments