Grammar takes in input string instead of file name

This commit is contained in:
josh committed 2021-06-06 10:09:53 -04:00
1 parent e4370cac62
commit 03b2e87186
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -7,10 +7,10 @@ module Imbecile
# @return [String, nil] Class name.
attr_reader :classname
def initialize(input_file)
def initialize(input)
@tokens = {}
@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_number = line_index + 1
if line =~ /^\s*#/