Commit 3227543
Fix 35 grammar bugs and add comprehensive test coverage (575 tests) (#22)
* feat: fix 35 grammar bugs across 8 root causes
Resolve all bugs from grammar-bug-list.md traced to 8 root causes:
- Root Cause B: whitespace/semicolons — newlines and semicolons as skip tokens
- Root Cause A: hash symbol-key shorthand — KeywordParam/KeywordArg with colonOp
- Root Cause C: bare method calls — Rails DSL methods, raise as bareMethod
- Root Cause G: rescue clause — bare rescue (=> e), multiple exception classes
- Root Cause D: operators — bitwise/shift via external tokenizers, token precedence
DFA fix (AssignOp above ArithOp), greaterThanTokenizer for >/>=/>>/>>= family
- Root Cause H: block pass — BlockPassExpression in ParenExpression, BlockParam GLR
- Root Cause E: scoped class names — className with :: separators, GLR on Constant
- Root Cause F: statements as expressions — if/unless/case/begin in expression via GLR
Additional fixes:
- BUG-009: statements as expressions (x = if/case/begin)
- BUG-012: Rails DSL bare methods (validates, has_many, before_action, etc.)
- BUG-017: operator method definitions (def <=>, def [], def []=)
- BUG-018: while/until/for do — @extend<Identifier,"do"> with !loopBody precedence
- BUG-022: setter method definitions (def name=)
- BUG-024: match operators (=~, !~, ===)
- BUG-031: block pass (&block) in method calls
- BUG-034: expanded symbol tokenizer (:foo?, :foo!, :"quoted", operator symbols)
91 fileTests pass, lint clean. 87/89 comprehensive bug reproductions pass.
* fix: bare rescue in method body and lambda without params
- MethodBody now supports implicit rescue/ensure (no begin wrapper needed)
- Lambda ParamList is now optional, fixing `-> { expr }` syntax
- Fixes BUG-010 (bare rescue) and BUG-012d (scope with lambda)
- 94 tests passing
* feat: grammar fixes, folding, and comprehensive test suites
Fix Constant(args) as method call (e.g. URI(url)), self.method= setter
assignment, folding for def/class/module blocks, trailing dot method
chain continuation indent, and super keyword highlighting.
Add 6 test suites: grammar (105), integration (10), highlight (31),
indent (51), fold (16), completion (10) — 223 total tests. Update
README with expanded known limitations.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: comprehensive test coverage (575 passing) and indent fixes
- Add 247 indent tests covering all 32 sections of ruby-indent-cases.md
- Add 139 highlight tests covering all Part 1 spec sections (1.1-1.11)
- Add 39 grammar accuracy + performance tests (Parts 7 and 9)
- Expand fold tests to 25 cases covering Part 2 (2.1-2.11)
- Expand completion tests with Part 6 context cases
- Fix INDENT_AFTER to recognize `private def`, `protected def`, etc.
- Fix deindent scanner to track {}/do-end nesting separately
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent c1efd3b commit 3227543
16 files changed
Lines changed: 5248 additions & 100 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | | - | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
| 90 | + | |
| 91 | + | |
88 | 92 | | |
89 | | - | |
| 93 | + | |
90 | 94 | | |
91 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
92 | 113 | | |
93 | 114 | | |
94 | 115 | | |
| |||
230 | 251 | | |
231 | 252 | | |
232 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
233 | 261 | | |
234 | 262 | | |
235 | 263 | | |
| |||
0 commit comments