Skip to content

dumpExp: parentheses by Modelica precedence (1.4.1) - #6

Merged
JKRT merged 1 commit into
masterfrom
annotations-and-cleanup
Oct 29, 2026
Merged

JKRT merged 1 commit into
masterfrom
annotations-and-cleanup

Conversation

@JKRT

@JKRT JKRT commented Oct 29, 2026

Copy link
Copy Markdown
Member

dumpExp wrote BINARY, LBINARY, RELATION, UNARY and LUNARY without parentheses: 2*(3 + 4) as 2*3 + 4, a + (-b) as a + -b (not Modelica). Operands are now parenthesised by precedence; unary minus binds tighter than * (-a*x, as omc prints it) and looser than ^. 14 tests added.

OMFrontend's printers use dumpExp from OpenModelica/OMFrontend.jl's branch annotations-and-cleanup (PR to follow); that PR does not depend on this one.

🤖 Generated with Claude Code

BINARY, LBINARY, RELATION, UNARY and LUNARY operands are parenthesised by precedence: 2*(3 + 4)
was printed 2*3 + 4, a + (-b) as a + -b. Unary minus binds tighter than * (-a*x, as omc) and
looser than ^.

Assisted-by: Claude Opus 5.5
@JKRT
JKRT merged commit d9295b0 into master Oct 29, 2026
5 checks passed
@JKRT
JKRT deleted the annotations-and-cleanup branch October 29, 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.

2 participants