Merge branch 'master' of bitbucket.org:datatransition_/mm2ep_depend

This commit is contained in:
Roguelearg 2017-09-12 17:59:33 +02:00
commit f7cf3da18f

View file

@ -124,10 +124,10 @@ module Mm2ep
class Parser < Rly::Yacc class Parser < Rly::Yacc
precedence :left, 'OR_OP' precedence :left, :OR_OP
precedence :left, 'AND_OP' precedence :left, :AND_OP
precedence :left, 'EQ_OP' precedence :left, :EQ_OP
precedence :left, 'L_PAR', 'R_PAR' precedence :right, :L_PAR, :R_PAR
precedence :right, :UMINUS precedence :right, :UMINUS
rule 'statement : expr' do |st, e| rule 'statement : expr' do |st, e|
@ -153,21 +153,22 @@ module Mm2ep
ex.value = BoolValue.new(l.value.to_s) ex.value = BoolValue.new(l.value.to_s)
end end
rule 'expr : NOT_OP expr %prec UMINUS' do |ex, l, e| rule 'expr : expr OR_OP expr' do |ex, l, e, r|
ex.value = NotOp.new(e.value) ex.value = OrOp.new(l.value, r.value)
end end
rule 'expr : expr AND_OP expr' do |ex, l, e, r| rule 'expr : expr AND_OP expr' do |ex, l, e, r|
ex.value = AndOp.new(l.value, r.value) ex.value = AndOp.new(l.value, r.value)
end 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| rule 'expr : L_PAR expr R_PAR' do |ex, l, e, r|
ex.value = e.value ex.value = e.value
end end
rule 'expr : NOT_OP expr %prec UMINUS' do |ex, l, e|
ex.value = NotOp.new(e.value)
end
rule 'expr : VAR EQ_OP bool_expr' do |ex, v, eq, n| rule 'expr : VAR EQ_OP bool_expr' do |ex, v, eq, n|
ex.value = EqOp.new( ex.value = EqOp.new(
VarValue.new(v.value.to_s), VarValue.new(v.value.to_s),