Java grammar: volatile/strictfp, empty enum bodies, comma-separated for-updates - #163
Merged
Merged
Conversation
…or-updates Three one-rule java.pg gaps bundled into one PR to pay the token-renumbering golden churn once (as #139 suggests). Conflict delta is ZERO: happy reports 13 shift/reduce, 0 reduce/reduce before and after; each rule carries its conflict argument and the inventory header records the batch. - Modifier gains 'volatile' (JLS 8.3.1.4) and 'strictfp' (JLS 8.1.1.3): reserved words, and like every modifier they only extend a ModifierList (closes #139) - EnumDeclaration's constant list becomes optional (JLS 8.9): 'enum E { }' and the declarations-only 'enum F { ; void m() { } }' now parse; the bare-comma body '{ , }' stays a tolerated parse error (closes #140) - The classic for's update slot becomes ForUpdateList, an optional comma-separated expression list (JLS 14.14.1); return and the condition slot keep plain OptExpression, and the init slot deliberately stays single (Type-vs-Expression region) (closes #141) Probes test-volatile-strictfp/test-empty-enum/test-for-update-list wired into make test-all-java (41/41 pass). Lexical token goldens unchanged (the lexical corpus has no volatile/strictfp). Commons-lang corpus: 9 files come off the parse blacklists (main 27->22, 232->237 passing; tests 18->14, 249->253), all suites 0 failures. The two affected holdouts moved to their next already-filed gap: StrBuilder to char[]::new (#142), FastDateParserTest to a multi-param lambda under a cast (#145). Co-Authored-By: Claude Fable 5 <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.
The #139+#140+#141 bundle from umbrella #21 — three one-rule java.pg changes
in one PR so the token-renumbering golden churn is reviewed once.
Changes
Modifiergains'volatile'and'strictfp'(JLS 8.3.1.4, 8.1.1.3).Reserved words, so promoting them from
idcosts nothing; like everymodifier they only ever extend a
ModifierList(same argument asdefaultin PR Add support for Phase 4g Java language features #132). Closes Java grammar: 'volatile' and 'strictfp' modifiers #139.EnumDeclaration's constant list becomes optional (JLS 8.9):enum E { }and the declarations-onlyenum F { ; void m() { } }parse.The empty-list reduce fires only on
;/}, disjoint from constantstarters. Documented tolerance gap: the bare-comma body
{ , }stays aparse error (the trailing comma lives inside
EnumConstantList).Closes Java grammar: empty enum bodies (enum E { }) #140.
for's update slot becomesForUpdateList?, an optionalcomma-separated expression list (JLS 14.14.1).
returnand the conditionslot keep plain
OptExpression; the init slot deliberately stays a singleexpression (Type-vs-Expression region). The
,continuation is a freshshift — only
)follows a complete update expression today. Closes Java grammar: comma-separated for-update lists (i++, pos++) #141.Verification (PR #132 protocol)
(and 2 unused terminals) before and after; inventory header updated.
test/golden/java/*churned; diff is the two newModifierconstructors, the
ForUpdateListrule + antiquote support, and pureTk__/Ctr__renumbering. Both cabal suites pass (incl. dual-front-endAST equality).
test-volatile-strictfp/test-empty-enum/test-for-update-listwired into
make test-all-java— 41/41 pass.make test-java-qqgreen(the
ForStatementshape change has no QQ fallout).make test-lex-java6/6 without accept —the lexical corpus contains no volatile/strictfp).
(232→237 passing), tests 18→14 (249→253);
make test-parse-commons-lang-alland
make test-lex-commons-lang-allat 0 failures. The two affectedholdouts fail on their next already-filed gap and stay listed:
StrBuilder.java→char[]::new(Java grammar: array class literals (String[].class) and array-constructor method references (TimeUnit[]::new) #142),FastDateParserTest.java→multi-param lambda under a cast (Java grammar: lambda directly under a cast ((Predicate<T>) t -> ...) #145).
Ticks the first three boxes in #21.
🤖 Generated with Claude Code