Commit e00522b
committed
Restructure rustc_lexer::unescape
Separate the functions for unescaping each kind of string and unit:
- this duplicates some code, but also gets rid of code that is only there for genericity
- each function is now simpler by inlining booleans, which might lead to faster code
Use a Peekable<CharIndices<'_>> instead of going back and forth between string slice and chars iterator.
- this gets rid of most position computations
- allows removal of double traversal for correct backslash newline escapes in skip_ascii_whitespace
Improves documentation1 parent 8239a37 commit e00522b
File tree
7 files changed
+443
-371
lines changed- compiler
- rustc_ast/src/util
- rustc_lexer/src
- unescape
- rustc_parse/src/lexer
- src/tools/rust-analyzer/crates
- parser/src
- syntax/src
- ast
7 files changed
+443
-371
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | | - | |
93 | 92 | | |
94 | | - | |
| 93 | + | |
95 | 94 | | |
96 | 95 | | |
97 | 96 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | | - | |
| 113 | + | |
| 114 | + | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
| |||
128 | 127 | | |
129 | 128 | | |
130 | 129 | | |
131 | | - | |
| 130 | + | |
132 | 131 | | |
133 | 132 | | |
134 | 133 | | |
| |||
0 commit comments