fix(grammars): correct emacs regex and align keywords with lexer#5795
Merged
fix(grammars): correct emacs regex and align keywords with lexer#5795
Conversation
The emacs grammar had a malformed regex `[0-9]+*` (nested quantifier that emacs parses with the trailing `*` as literal asterisk), and both the emacs and nano grammars had stale keyword lists referencing items the lexer no longer treats as keywords (`alias`, `in`, `loop`) while missing several it does (`into`, `internal`, `func`, `import`, `enum`). The nano regex was also incorrectly grouped — `\<let|module|prql\>` parses as `\<let` OR `module` OR `prql\>` rather than anchoring all three. Authoritative keyword list verified against prqlc/prqlc-parser/src/lexer/mod.rs:197-206. 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
The nightly survey (2026-04-13) found three issues in the editor grammar files for emacs and nano:
Malformed regex in
grammars/emacs/prql-mode.el:43—[0-9]+*is a nested quantifier; emacs treats the*literally, so it matches "one or more digits followed by an asterisk" rather than "one or more digits". Fixed to[0-9]+.Stale keyword list in both grammars. The lexer keywords are now
let,into,case,prql,type,module,internal,func,import,enum(seeprqlc/prqlc-parser/src/lexer/mod.rs:197-206). The emacs file was missinginto,internal,func,import,enumand listedalias,in,loopwhich the lexer does not treat as keywords. The nano file was missinginto,case,type,internal,func,import,enum.Incorrect regex grouping in
grammars/nano/prql.nanorc:11—\<let|module|prql\>was parsed as\<letORmoduleORprql\>because alternation has lower precedence than the anchors. Now properly grouped:\<(let|...)\>.Test plan
🤖 Generated with Claude Code