Finish grammar

This commit is contained in:
Roguelearg 2017-09-11 10:13:30 +02:00
parent 0a16d6d322
commit 61c649d989

View file

@ -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