Skip to content

Commit

Permalink
Fix operator precedence of eq/neq and gt/lt
Browse files Browse the repository at this point in the history
  • Loading branch information
lep committed Apr 12, 2024
1 parent 22c3fbc commit dec9c9c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
%right EQUALS
%left AND
%left OR
%left LESS GREATER EQCOMP NEQ LEQ GEQ
%left EQCOMP NEQ
%left LESS GREATER LEQ GEQ
%left NOT
%left MINUS PLUS
%left TIMES DIV MOD
Expand Down
4 changes: 4 additions & 0 deletions tests/should-check/eq-gt-prec.j
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function test takes nothing returns boolean
return 5 > 4 == 5 < 7
endfunction

3 changes: 3 additions & 0 deletions tests/should-check/eq-neq-left-assoc.j
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function test takes nothing returns boolean
return 1 == 2 != false
endfunction

0 comments on commit dec9c9c

Please sign in to comment.