Error if Start rule not found
This commit is contained in:
parent
70118dd019
commit
f77218801f
@ -22,6 +22,9 @@ module Imbecile
|
||||
rule_names[rule.name] ||= []
|
||||
rule_names[rule.name] << rule
|
||||
end
|
||||
unless rule_names["Start"]
|
||||
raise Error.new("Start rule not found")
|
||||
end
|
||||
lexer_dfa = LexerDFA.new(@grammar.tokens)
|
||||
classname = @grammar.classname || 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, "<>")
|
||||
|
@ -3,6 +3,8 @@ module Imbecile
|
||||
|
||||
class Rule
|
||||
|
||||
attr_reader :components
|
||||
|
||||
def initialize(name, rule, code)
|
||||
@name = name
|
||||
rule_components = rule.split(/\s+/)
|
||||
|
Loading…
x
Reference in New Issue
Block a user