Fix 35 grammar bugs and add comprehensive test coverage (575 tests)#22
Merged
Conversation
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.
- 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
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>
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
self.x = val),Constant(args)method calls, and moreprivate def/protected defnow recognized as block openers; mixeddo/end+{}nesting tracked correctlyTest coverage breakdown
Grammar fixes
rescueinside method body withoutbegin-> { body })self.email = value)URI(url),Integer("42"))superhighlighted as keywordTest plan
npm run build && npm test— 105 Lezer fileTests passnode test/indent.test.mjs— 247 pass, 0 failnode test/highlight.test.mjs— 139 pass, 0 failnode test/grammar.test.mjs— 39 pass, 0 failnode test/fold.test.mjs— 25 pass, 0 failnode test/completion.test.mjs— 10 pass, 0 failnode test/integration.test.mjs— 10 pass, 0 fail🤖 Generated with Claude Code