Skip to content

Release 0.4.0: grammar fixes, auto-indent fix, updated docs#24

Merged
jeanpaulsio merged 4 commits into
mainfrom
release/0.4.0
Mar 27, 2026
Merged

Release 0.4.0: grammar fixes, auto-indent fix, updated docs#24
jeanpaulsio merged 4 commits into
mainfrom
release/0.4.0

Conversation

@jeanpaulsio

Copy link
Copy Markdown
Owner

Summary

  • 3 grammar fixes: ::TopLevel scope resolution, hash patterns in case/in, find patterns [*, 2, *]
  • Auto-indent on Enter fixed: rubyIndentService now uses cx.lineAt() instead of raw doc.lineAt()/doc.line(), respecting simulateBreak for real-time indent behavior
  • README updated: added new features to "What's supported", removed 4 stale limitations (symbol-key shorthand was already working, 3 bugs now fixed), added guard clause limitation
  • Demo rebuilt for GitHub Pages
  • Benchmarks re-run: Rails 94.2% → 94.3%, all others unchanged

Grammar changes

Bug Fix Approach
::TopLevel (BUG-015b) ✅ Fixed Added "::" (Constant | Identifier) variant to ScopeResolution, "::"? prefix to className
Hash patterns (BUG-026a) ✅ Fixed New HashPattern/HashPatternPair rules in InClause with ~hashOrPattern GLR
Guard clauses (BUG-026b) ⏭️ Skipped if/unless conflicts with IfStatement — unresolvable in LR parser
Find patterns (BUG-026c) ✅ Fixed New FindPattern rule requiring leading * to disambiguate from Array
Heredoc as arg (BUG-028a) ⏭️ Skipped Needs ContextTracker for non-contiguous token split
Heredoc chain (BUG-028b) ⏭️ Skipped Depends on BUG-028a

Test results

  • npm test: 105 passing
  • indent.test.mjs: 247 pass, 0 fail
  • highlight.test.mjs: 139 pass, 0 fail
  • fold.test.mjs: 25 pass, 0 fail
  • grammar.test.mjs: 39 pass, 0 fail
  • integration.test.mjs: 10 pass, 0 fail
  • bug-check.mjs: 114 pass, 3 fail (down from 6 — remaining 3 are the skipped bugs)

Test plan

  • npm run build && npm test — all 105 grammar tests pass
  • All 6 extended test suites pass with zero regressions
  • Demo page loads and Enter after def foo auto-indents correctly
  • ::TopLevel, {name: String => n}, [*, 2, *] parse without errors

🤖 Generated with Claude Code

Allow ScopeResolution to start with :: prefix for top-level constant
references like ::TopLevel and ::TopLevel::Foo. Also support :: prefix
in className for class/module definitions. Uses ~scopeOrClass GLR marker
to resolve ambiguity between className's :: repetition and ScopeResolution.
Add HashPattern and HashPatternPair rules reachable only from InClause
for Ruby 3.0+ pattern matching. Supports {name: String => n} binding
syntax and {name:} shorthand. Uses ~hashOrPattern GLR marker to resolve
ambiguity with regular Hash/HashPair rules.
Add FindPattern rule reachable from InClause for Ruby 3.0+ find patterns.
Requires leading * to unambiguously distinguish from regular Array.
Supports [*, value, *] and [*pre, value, *post] forms.
- Fix rubyIndentService to use cx.lineAt() instead of raw doc access,
  so auto-indent on Enter respects simulateBreak
- Update README: add new features to "What's supported", remove stale
  limitations (symbol-key shorthand, ::TopLevel, hash/find patterns),
  add guard clause limitation, update Rails benchmark 94.2% → 94.3%
- Rebuild demo for GitHub Pages
- Bump version to 0.4.0
@jeanpaulsio jeanpaulsio merged commit 36092ea into main Mar 27, 2026
1 check passed
@jeanpaulsio jeanpaulsio deleted the release/0.4.0 branch March 27, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant