Skip to content

Leave the expected tokens out of the recorded syntax errors - #3

Merged
adrpo merged 1 commit into
OpenModelica:mainfrom
adrpo:test-errors-without-token-lists
Nov 30, 2026
Merged

adrpo merged 1 commit into
OpenModelica:mainfrom
adrpo:test-errors-without-token-lists

Conversation

@adrpo

@adrpo adrpo commented Nov 30, 2026

Copy link
Copy Markdown
Member

Fixes #2

The Diagram generator workflow of OpenModelica/CRML fails on main since OpenModelica/CRML#96 was merged (https://github.com/OpenModelica/CRML/actions/runs/46449999049/job/141957603896). The diagrams did not change; the recorded syntax errors did, because an ANTLR message lists the expected tokens in the order of their token numbers and the units grammar numbers the keywords differently.

Changes:

  • test/run.mjs records only the position and the first part of a syntax error (mismatched input 'start'), without the expecting {...} list.
  • The expected .drawio files are regenerated. Only the error comments at the end change.
  • dist/crml-diagram.min.js is rebuilt with the grammar of CRML main, which the CI of this repository checks.
  • The README says what is recorded.

Testing:

  • npm run build and npm test pass with the grammar of CRML main (bb6d606).
  • With the grammar before Add units/user defined types CRML#96 (12fc645) node test/run.mjs --update writes the same expected files, so the tests no longer depend on the token numbering.

After this is merged the diagram-generator submodule of OpenModelica/CRML has to be moved to the new commit to get its workflow green.


generated by Claude Code

…lica#2)

The expected .drawio files of the tests end with the syntax errors of the
test file. An ANTLR message lists the expected tokens in the order of their
token numbers, which change whenever the grammar of the CRML compiler gets a
new keyword, so the units grammar of OpenModelica/CRML#96 made two tests fail
although the diagrams are the same.

- test/run.mjs records only the position and the first part of the message
- the expected files are regenerated; they are the same with the grammar
  before and after OpenModelica/CRML#96
- dist/crml-diagram.min.js is rebuilt with the current grammar

Fixes OpenModelica#2

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@adrpo adrpo self-assigned this Nov 30, 2026
@adrpo
adrpo merged commit 727d5d1 into OpenModelica:main Nov 30, 2026
2 checks passed
adrpo added a commit to OpenModelica/CRML that referenced this pull request Nov 30, 2026
* Move the diagram generator to 727d5d1 (OpenModelica/CRML-diagram#2)

The tests of the diagram generator recorded the lists of expected tokens of
the syntax errors, whose order changed with the units grammar of #96, so the
"Diagram generator" workflow fails on main. OpenModelica/CRML-diagram#3 leaves
the lists out of the expected files and rebuilds dist/crml-diagram.min.js.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* Split the source lines without \R, for the web build (#108)

getLineInfo split the source text with the regular expression \R, which the
regular expressions of TeaVM do not have, so the web build threw a
PatternSyntaxException on the Units_test models that translate with the jar.
\r?\n is also how ANTLR counts the lines of token.getLine().

Fixes #108

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
@adrpo
adrpo deleted the test-errors-without-token-lists branch November 30, 2026 15:54
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.

The tests fail whenever the CRML grammar gets a new keyword

1 participant