2017-09-04 09:19:29 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
$:.insert(0, 'lib')
|
|
|
|
|
|
|
|
require 'thor'
|
2017-09-07 15:05:06 +00:00
|
|
|
require 'rly'
|
|
|
|
require 'pry'
|
2017-09-04 09:19:29 +00:00
|
|
|
require 'parser.rb'
|
|
|
|
require 'lexer.rb'
|
2017-09-11 10:08:27 +00:00
|
|
|
require 'lexer2.rb'
|
|
|
|
require 'parser2.rb'
|
2017-09-04 09:19:29 +00:00
|
|
|
|
|
|
|
module Mm2ep
|
|
|
|
module Depend
|
|
|
|
|
|
|
|
class ParseCli < Thor
|
|
|
|
desc 'parse INFILE', 'Parse INFILE into tokens'
|
|
|
|
def parse(infile)
|
|
|
|
File.open(infile).each_line do |line|
|
2017-09-11 12:33:29 +00:00
|
|
|
parser = Parser.new(Lexer.new)
|
|
|
|
puts line.inspect
|
|
|
|
token = parser.parse(line.chomp, true)
|
|
|
|
puts token
|
2017-09-11 10:08:27 +00:00
|
|
|
# binding.pry
|
2017-09-11 12:33:29 +00:00
|
|
|
# parser = Parser2.new
|
|
|
|
# lexer = TestLexer.new(parser.parse(line))
|
|
|
|
# puts lexer.testlexe
|
2017-09-04 09:19:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Mm2ep::Depend::ParseCli.start(ARGV)
|