Simplify read
This commit is contained in:
parent
9a025cb812
commit
ac6a82c446
1 changed files with 12 additions and 13 deletions
|
@ -14,19 +14,18 @@ module Mm2ep
|
||||||
class ParseCli < Thor
|
class ParseCli < Thor
|
||||||
desc 'parse INFILE', 'Parse INFILE into tokens'
|
desc 'parse INFILE', 'Parse INFILE into tokens'
|
||||||
def parse(infile)
|
def parse(infile)
|
||||||
File.open(infile).each_line do |line|
|
line = File.read(infile).gsub(/\n/,'')
|
||||||
parser = Parser.new(Lexer.new)
|
parser = Parser.new(Lexer.new)
|
||||||
puts line.inspect
|
puts line.inspect
|
||||||
token = parser.parse(line.chomp, true)
|
token = parser.parse(line.chomp, true)
|
||||||
pp token
|
pp token
|
||||||
puts token.to_s
|
puts token.to_s
|
||||||
# puts false && true
|
# puts false && true
|
||||||
# puts false || false
|
# puts false || false
|
||||||
# binding.pry
|
# binding.pry
|
||||||
# parser = Parser2.new
|
# parser = Parser2.new
|
||||||
# lexer = TestLexer.new(parser.parse(line))
|
# lexer = TestLexer.new(parser.parse(line))
|
||||||
# puts lexer.testlexe
|
# puts lexer.testlexe
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue