Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect parentheses that discard extra values in the AST #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fstirlitz
Copy link
Owner

@fstirlitz fstirlitz commented Apr 27, 2021

The parentheses are represented as a UnaryExpression with the empty string as the operator. This choice minimises compatibility breaks: users only need to add precedence information and/or identity evaluation for a new operator. Serialising code that assumes all unary operators have the same precedence bested only by the power operator, and otherwise treats them as black boxes, should keep working correctly, even in the presence of the latter.

Parentheses on the LHS of assignment are not represented unless nested.

This fixes #79.

@fstirlitz fstirlitz force-pushed the master branch 3 times, most recently from 24840d1 to 5015784 Compare May 31, 2021 18:19
The parentheses are represented as a UnaryExpression with the empty string
as the operator. This choice minimises compatibility breaks: users only need
to add precedence information and/or identity evaluation for a new operator.
Serialising code that assumes all unary operators have the same precedence
bested only by the power operator, and otherwise treats them as black boxes,
should keep working correctly, even in the presence of the latter.

Parentheses on the LHS of assignment are not represented unless nested.
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.

Reflect parentheses that discard extra values in the AST
1 participant