Generator builds a Lexer, not a Lexer::DFA

This commit is contained in:
josh committed 2021-08-19 13:11:12 -04:00
1 parent 51a31317a6
commit f295acb593
3 files changed
+10 -2

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ module Imbecile
unless rule_names["Start"]
raise Error.new("Start rule not found")
end
lexer_dfa = Lexer::DFA.new(@grammar.tokens)
lexer = Lexer.new(@grammar)
classname = @grammar.classname || File.basename(output_file).sub(%r{[^a-zA-Z0-9].*}, "").capitalize
erb = ERB.new(File.read(File.join(File.dirname(File.expand_path(__FILE__)), "../../assets/parser.d.erb")), nil, "<>")
result = erb.result(binding.clone)
+8
View File
@@ -1,5 +1,13 @@
module Imbecile
class Lexer
# @return [DFA]
# Lexer DFA.
attr_accessor :dfa
def initialize(grammar)
@dfa = DFA.new(grammar.tokens)
end
end
end