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

Fixed operator precedence #47

Merged
merged 1 commit into from
Apr 22, 2014
Merged

Fixed operator precedence #47

merged 1 commit into from
Apr 22, 2014

Conversation

bkiers
Copy link
Contributor

@bkiers bkiers commented Apr 15, 2014

Placed all operators inside the expr rule to get the expected operator precedence.

Changed:

expr
 : ...
 | expr binop expr
 | ...
 ;

binop
 : '+' | '-' | AND | OR | ...
 ;

to

expr
 : ...
 | expr ('+' | '-') expr
 | expr AND expr
 | expr OR expr
 | ...
 ;

Placed all operators inside the `expr` rule to get the expected operator precedence.

Changed:

    expr
     : ...
     | expr binop expr
     | ...
     ;

    binop
     : '+' | '-' | AND | OR | ...
     ;

to

    expr
     : ...
     | expr ('+' | '-') expr
     | expr AND expr
     | expr OR expr
     | ...
     ;
parrt added a commit that referenced this pull request Apr 22, 2014
Fixed operator precedence
@parrt parrt merged commit 4989220 into antlr:master Apr 22, 2014
@bkiers bkiers deleted the patch-1 branch April 24, 2014 05:59
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.

None yet

2 participants