Grammar takes in input string instead of file name
This commit is contained in:
1 parent
e4370cac62
commit
03b2e87186
2 files changed
+3
-3
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ module Imbecile
|
|||||||
|
|
||||||
def run(input_file, output_file)
|
def run(input_file, output_file)
|
||||||
begin
|
begin
|
||||||
grammar = Grammar.new(input_file)
|
grammar = Grammar.new(File.read(input_file))
|
||||||
rescue Error => e
|
rescue Error => e
|
||||||
$stderr.puts e.message
|
$stderr.puts e.message
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ module Imbecile
|
|||||||
# @return [String, nil] Class name.
|
# @return [String, nil] Class name.
|
||||||
attr_reader :classname
|
attr_reader :classname
|
||||||
|
|
||||||
def initialize(input_file)
|
def initialize(input)
|
||||||
@tokens = {}
|
@tokens = {}
|
||||||
@rules = {}
|
@rules = {}
|
||||||
File.read(input_file).each_line.each_with_index do |line, line_index|
|
input.each_line.each_with_index do |line, line_index|
|
||||||
line = line.chomp
|
line = line.chomp
|
||||||
line_number = line_index + 1
|
line_number = line_index + 1
|
||||||
if line =~ /^\s*#/
|
if line =~ /^\s*#/
|
||||||
|
|||||||
Reference in new issue
Block a user