lib/lrama/grammar.rb in lrama-0.6.0 vs lib/lrama/grammar.rb in lrama-0.6.1

- old
+ new

@@ -1,18 +1,16 @@ require "lrama/grammar/auxiliary" +require "lrama/grammar/binding" require "lrama/grammar/code" require "lrama/grammar/counter" require "lrama/grammar/error_token" require "lrama/grammar/percent_code" require "lrama/grammar/precedence" require "lrama/grammar/printer" require "lrama/grammar/reference" require "lrama/grammar/rule" require "lrama/grammar/rule_builder" -require "lrama/grammar/parameterizing_rule_builder" -require "lrama/grammar/parameterizing_rule_resolver" -require "lrama/grammar/parameterizing_rule_rhs_builder" require "lrama/grammar/parameterizing_rule" require "lrama/grammar/symbol" require "lrama/grammar/type" require "lrama/grammar/union" require "lrama/lexer" @@ -38,11 +36,11 @@ @symbols = [] @types = [] @rule_builders = [] @rules = [] @sym_to_rules = {} - @parameterizing_resolver = ParameterizingRuleResolver.new + @parameterizing_rule_resolver = ParameterizingRule::Resolver.new @empty_symbol = nil @eof_symbol = nil @error_symbol = nil @undef_symbol = nil @accept_symbol = nil @@ -50,11 +48,11 @@ append_special_symbols end def add_percent_code(id:, code:) - @percent_codes << PercentCode.new(id, code) + @percent_codes << PercentCode.new(id.s_value, code.s_value) end def add_printer(ident_or_tags:, token_code:, lineno:) @printers << Printer.new(ident_or_tags: ident_or_tags, token_code: token_code, lineno: lineno) end @@ -132,12 +130,12 @@ def add_rule_builder(builder) @rule_builders << builder end - def add_parameterizing_rule_builder(builder) - @parameterizing_resolver.add_parameterizing_rule_builder(builder) + def add_parameterizing_rule(rule) + @parameterizing_rule_resolver.add_parameterizing_rule(rule) end def prologue_first_lineno=(prologue_first_lineno) @aux.prologue_first_lineno = prologue_first_lineno end @@ -169,11 +167,11 @@ compute_first_set end # TODO: More validation methods # - # * Validaiton for no_declared_type_reference + # * Validation for no_declared_type_reference def validate! validate_symbol_number_uniqueness! validate_symbol_alias_name_uniqueness! validate_rule_lhs_is_nterm! end @@ -317,10 +315,10 @@ end end def setup_rules @rule_builders.each do |builder| - builder.setup_rules(@parameterizing_resolver) + builder.setup_rules(@parameterizing_rule_resolver) end end def find_nterm_by_id!(id) nterms.find do |nterm|