Commit e8eb433
## Summary
Extends \`lower_ident_start\` from a single \`lower\` to \`lower | ('_',
alphanum)\` — a lowercase letter, OR underscore followed by at least one
alphanum. This is the conventional Rust-idiom spelling for
"intentionally unused" bindings and parameters.
Bare \`_\` (the wildcard pattern) is preserved as the distinct
\`UNDERSCORE\` token: sedlex applies maximal munch, and the underscore
branch of \`lower_ident_start\` requires at least one trailing alphanum,
so \`_\` standalone falls through to the existing UNDERSCORE rule.
## Test changes
\`test/test_lexer.ml::test_identifiers\` now asserts the new
tokenisation:
- \`_test\` is a single \`LOWER_IDENT "_test"\` (was \`UNDERSCORE;
LOWER_IDENT "test"\`).
- Bare \`_\` still emits \`UNDERSCORE\`.
327/327 tests pass.
## Why
Required by sustainabot hand-port (gitbot-fleet#148) —
\`GitHubApp.affine\` declares unused cache-stub bindings as \`let _key =
...; let _value = ...;\`. Without this, every \`_x\` parses as wildcard
+ binding-name and breaks downstream pattern resolution.
## Test plan
- [x] \`dune build\` green
- [x] \`dune test\` green (327/327)
- [ ] CI green
- [ ] Smoke: \`let _key = json::encode(x);\` parses
## Companion PRs (gitbot-fleet#148 spine)
1. trailing-comma in fn params + expr lists (#370)
2. fn-type with effect arrow in type position (#371)
3. builtin/lowercase qualified paths + TOTAL field name (#372)
4. **this PR** — lexer \`_\`-prefix idents
5. (hypatia) Levenshtein perf fix
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 29c1bc8 commit e8eb433
2 files changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | | - | |
30 | | - | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
0 commit comments