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

Wrong priority of mathematical operations #49

Open
st-vi opened this issue Oct 23, 2024 · 0 comments
Open

Wrong priority of mathematical operations #49

st-vi opened this issue Oct 23, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@st-vi
Copy link
Collaborator

st-vi commented Oct 23, 2024

The priority of the operations +, -, , / in feature attribute constraints is wrong. The expression ab + cd therefore gets interpreted as (a (b + c)) * d, which is wrong. Currently the grammar looks like this:
expression:
FLOAT # FloatLiteralExpression
| INTEGER # IntegerLiteralExpression
| STRING # StringLiteralExpression
| aggregateFunction # AggregateFunctionExpression
| reference # LiteralExpression
| OPEN_PAREN expression CLOSE_PAREN # BracketExpression
| expression ADD expression # AddExpression
| expression SUB expression # SubExpression
| expression MUL expression # MulExpression
| expression DIV expression # DivExpression
;

Changing it to the following solves the problem:
expression:
FLOAT # FloatLiteralExpression
| INTEGER # IntegerLiteralExpression
| STRING # StringLiteralExpression
| aggregateFunction # AggregateFunctionExpression
| reference # LiteralExpression
| OPEN_PAREN expression CLOSE_PAREN # BracketExpression
| expression DIV expression # DivExpression
| expression MUL expression # MulExpression
| expression ADD expression # AddExpression
| expression SUB expression # SubExpression
;

@st-vi st-vi added the bug Something isn't working label Oct 23, 2024
@SundermannC SundermannC self-assigned this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants