Skip to content

Extract common rules from JSONiq and XQuery grammar lexer into CommonLexer file - #1801

Open
CaiJimmy wants to merge 7 commits into
jimmy/drop-catch-var-grammarfrom
jimmy/common-grammar
Open

Extract common rules from JSONiq and XQuery grammar lexer into CommonLexer file#1801
CaiJimmy wants to merge 7 commits into
jimmy/drop-catch-var-grammarfrom
jimmy/common-grammar

Conversation

@CaiJimmy

@CaiJimmy CaiJimmy commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Now that the JSONiq and XQuery grammar are so similar, I propose avoid repeating codes in grammar definitions,
and use import syntax from ANTLR4 to avoid code duplication.

This PR does it at lexer level, and the next PR will do it at parser level.

This does not affect Java translation level. Code reuse in TranslationVisitor and XQueryTranslationVisitor is more difficult and experimented in #1804, but did not work as I expected.

@CaiJimmy
CaiJimmy changed the base branch from master to jimmy/drop-catch-var-grammar August 20, 2026 13:14
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

QT3 Test Results - Parser: jsoniq

🎉 No regressions found for this build.

Summary of passed tests for jsoniq
Test Suite Passing Failing Errors Skipped Total
app 1984 39 127 7 2157
array 207 0 1 1 209
fn 10024 381 232 498 11135
map 220 0 0 0 220
math 149 0 0 0 149
misc 700 77 34 60 871
op 4192 63 70 41 4366
prod 10344 569 465 829 12207
ser 321 21 1 0 343
xs 147 6 0 11 164
Total 28288 1156 930 1447 31821

Full analysis report: see analysis-jsoniq in artifacts.

Download detailed test results

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

QT3 Test Results - Parser: xquery

🎉 No regressions found for this build.

Summary of passed tests for xquery
Test Suite Passing Failing Errors Skipped Total
app 2024 38 88 7 2157
array 207 0 1 1 209
fn 10078 343 216 498 11135
map 220 0 0 0 220
math 149 0 0 0 149
misc 719 64 28 60 871
op 4284 14 27 41 4366
prod 10571 442 365 829 12207
ser 343 0 0 0 343
xs 153 0 0 11 164
Total 28748 901 725 1447 31821

Full analysis report: see analysis-xquery in artifacts.

Download detailed test results

@CaiJimmy CaiJimmy changed the title Create shared ANTLR4 grammar files to avoid duplicated logic Create shared ANTLR4 lexer files to avoid duplicated logic Aug 20, 2026
@CaiJimmy
CaiJimmy force-pushed the jimmy/common-grammar branch from 753076c to 027716d Compare August 26, 2026 10:50
@CaiJimmy
CaiJimmy force-pushed the jimmy/common-grammar branch from 027716d to 622c69e Compare August 26, 2026 11:04
@CaiJimmy
CaiJimmy marked this pull request as ready for review August 26, 2026 11:14
@CaiJimmy CaiJimmy changed the title Create shared ANTLR4 lexer files to avoid duplicated logic Extract common rules from JSONiq and XQuery lever grammar into a CommonLexer file Aug 26, 2026
@CaiJimmy CaiJimmy changed the title Extract common rules from JSONiq and XQuery lever grammar into a CommonLexer file Extract common rules from JSONiq and XQuery lexer grammar into a CommonLexer file Aug 26, 2026
@CaiJimmy CaiJimmy changed the title Extract common rules from JSONiq and XQuery lexer grammar into a CommonLexer file Extract common rules from JSONiq and XQuery grammar lexer into a CommonLexer file Aug 26, 2026
@CaiJimmy CaiJimmy changed the title Extract common rules from JSONiq and XQuery grammar lexer into a CommonLexer file Extract common rules from JSONiq and XQuery grammar lexer into CommonLexer file Aug 26, 2026
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