Merge branch 'master' of bitbucket.org:datatransition_/mm2ep_depend
This commit is contained in:
commit
f7cf3da18f
1 changed files with 10 additions and 9 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,21 +153,22 @@ module Mm2ep
|
|||
ex.value = BoolValue.new(l.value.to_s)
|
||||
end
|
||||
|
||||
rule 'expr : NOT_OP expr %prec UMINUS' do |ex, l, e|
|
||||
ex.value = NotOp.new(e.value)
|
||||
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
|
||||
|
||||
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|
|
||||
ex.value = EqOp.new(
|
||||
VarValue.new(v.value.to_s),
|
||||
|
|
Loading…
Reference in a new issue