Remove pry and add a comment for check_grammar
This commit is contained in:
parent
b2d80874e6
commit
033d94dfe1
2 changed files with 3 additions and 1 deletions
|
@ -28,9 +28,10 @@ module Mm2ep
|
||||||
pp token
|
pp token
|
||||||
puts "RAW : #{line}"
|
puts "RAW : #{line}"
|
||||||
puts "EVAL: #{token.to_s}"
|
puts "EVAL: #{token.to_s}"
|
||||||
|
|
||||||
parser.check_grammar line, token
|
parser.check_grammar line, token
|
||||||
binding.pry
|
|
||||||
exit 1 unless token.errors.empty? || token.nil?
|
exit 1 unless token.errors.empty? || token.nil?
|
||||||
|
|
||||||
puts "RESULT: #{token.compute}"
|
puts "RESULT: #{token.compute}"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -176,6 +176,7 @@ module Mm2ep
|
||||||
class Parser < Rly::Yacc
|
class Parser < Rly::Yacc
|
||||||
attr_writer :names
|
attr_writer :names
|
||||||
|
|
||||||
|
# Check if grammar is valid
|
||||||
def check_grammar(line, tokens)
|
def check_grammar(line, tokens)
|
||||||
grammar = tokens.to_s.split(/=|AND|OR/)
|
grammar = tokens.to_s.split(/=|AND|OR/)
|
||||||
expr = line.split(/=|AND|OR/)
|
expr = line.split(/=|AND|OR/)
|
||||||
|
|
Loading…
Reference in a new issue