diff --git a/lib/parser.rb b/lib/parser.rb index 8fe7189..d1bafdd 100755 --- a/lib/parser.rb +++ b/lib/parser.rb @@ -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