Finish grammar
This commit is contained in:
parent
0a16d6d322
commit
61c649d989
1 changed files with 15 additions and 0 deletions
|
@ -2,10 +2,25 @@ module Mm2ep
|
|||
module Depend
|
||||
class Parser < Rly::Yacc
|
||||
|
||||
precedence :left, 'OR_OP', 'EQ_OP'
|
||||
precedence :right, 'AND_OP', 'NOT_OP'
|
||||
|
||||
rule 'statement : expr' do |st, e|
|
||||
st.value = e.value
|
||||
end
|
||||
|
||||
rule 'expr : VAR' do |ex, l|
|
||||
ex.value = l.value
|
||||
end
|
||||
|
||||
rule 'expr : T_BOOL' do |ex, l|
|
||||
ex.value = l.value
|
||||
end
|
||||
|
||||
rule 'expr : F_BOOL' do |ex, l|
|
||||
ex.value = l.value
|
||||
end
|
||||
|
||||
rule 'expr : NOT_OP SPACE expr' do |ex, l, s, e|
|
||||
ex.value = "#{l.value} #{s.value} #{e.value}"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue