Fix AND evaluation
This commit is contained in:
parent
12b310b7c2
commit
e76e11535d
1 changed files with 8 additions and 7 deletions
|
@ -124,10 +124,10 @@ module Mm2ep
|
|||
|
||||
class Parser < Rly::Yacc
|
||||
|
||||
precedence :left, 'OR_OP'
|
||||
precedence :left, 'AND_OP'
|
||||
precedence :left, 'EQ_OP'
|
||||
precedence :left, 'L_PAR', 'R_PAR'
|
||||
precedence :left, :OR_OP
|
||||
precedence :left, :AND_OP
|
||||
precedence :left, :EQ_OP
|
||||
precedence :right, :L_PAR, :R_PAR
|
||||
precedence :right, :UMINUS
|
||||
|
||||
rule 'statement : expr' do |st, e|
|
||||
|
@ -153,13 +153,14 @@ module Mm2ep
|
|||
ex.value = NotOp.new(e.value)
|
||||
end
|
||||
|
||||
rule 'expr : expr OR_OP expr' do |ex, l, e, r|
|
||||
ex.value = OrOp.new(l.value, r.value)
|
||||
end
|
||||
|
||||
rule 'expr : expr AND_OP expr' do |ex, l, e, r|
|
||||
ex.value = AndOp.new(l.value, r.value)
|
||||
end
|
||||
|
||||
rule 'expr : expr OR_OP expr' do |ex, l, e, r|
|
||||
ex.value = OrOp.new(l.value, r.value)
|
||||
end
|
||||
rule 'expr : L_PAR expr R_PAR' do |ex, l, e, r|
|
||||
ex.value = e.value
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue