Commit 54f9f7a
authored
[NFC] Simplify lexer and move to header (#8597)
The lexer previously used its own internal `LexerCtx` abstraction that
allowed it to consume the characters that made up a token without
changing the lexer state, then update the state at once when committing
to consuming the characters. However, manually resetting the lexer to
the original position when giving up on parsing a token is simple enough
that this abstraction was not holding its weight. Simplify the lexer by
removing internal contexts, and move the simplified method bodies to
lexer.h. Generally we try to avoid putting lots of code in headers, but
in this case making the code available to the inliner, along with
removing the extra layer of abstraction, makes the parser about 20%
faster.1 parent 1f65c57 commit 54f9f7a
File tree
5 files changed
+1038
-1259
lines changed- src/parser
- test/gtest
5 files changed
+1038
-1259
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1985 | 1985 | | |
1986 | 1986 | | |
1987 | 1987 | | |
1988 | | - | |
| 1988 | + | |
1989 | 1989 | | |
1990 | 1990 | | |
1991 | 1991 | | |
| |||
0 commit comments