-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Update MySqlParser.g4 #3393
base: master
Are you sure you want to change the base?
Update MySqlParser.g4 #3393
Conversation
The origin mathExpression has bugs when we preprocess complex expressons. for example: if we calculate a expression "100 + 100/2", the result is (100+100)/2. so the mathOperator should have priority. firstly, we should calculate Mul/Div/Mod; finally, we should calculate Add/Sub;
| left=expressionAtom mathPriorOperator right=expressionAtom #mathPriorExpressionAtom | ||
| left=expressionAtom mathAfterOperator right=expressionAtom #mathAfterExpressionAtom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to rename them to mathMultDivOperator
and mathAddSubOperator
.
| left=expressionAtom mathPriorOperator right=expressionAtom #mathPriorExpressionAtom | |
| left=expressionAtom mathAfterOperator right=expressionAtom #mathAfterExpressionAtom | |
| left=expressionAtom mathPriorOperator right=expressionAtom #mathPriorExpressionAtom | |
| left=expressionAtom mathAfterOperator right=expressionAtom #mathAfterExpressionAtom |
A test for the expression
|
No, my suggestions still remain unfixed. |
The origin mathExpression has bugs when we preprocess complex expressons. for example:
if we calculate a expression "100 + 100/2", the result is (100+100)/2. so the mathOperator should have priority.
firstly, we should calculate Mul/Div/Mod;
finally, we should calculate Add/Sub;