lib/lrama/grammar.rb in lrama-0.6.10 vs lib/lrama/grammar.rb in lrama-0.6.11
- old
+ new
@@ -28,11 +28,11 @@
attr_reader :percent_codes, :eof_symbol, :error_symbol, :undef_symbol, :accept_symbol, :aux, :parameterizing_rule_resolver
attr_accessor :union, :expect, :printers, :error_tokens, :lex_param, :parse_param, :initial_action,
:after_shift, :before_reduce, :after_reduce, :after_shift_error_token, :after_pop_stack,
:symbols_resolver, :types, :rules, :rule_builders, :sym_to_rules, :no_stdlib, :locations
- def_delegators "@symbols_resolver", :symbols, :nterms, :terms, :add_nterm, :add_term,
+ def_delegators "@symbols_resolver", :symbols, :nterms, :terms, :add_nterm, :add_term, :find_term_by_s_value,
:find_symbol_by_number!, :find_symbol_by_id!, :token_to_symbol,
:find_symbol_by_s_value!, :fill_symbol_number, :fill_nterm_type,
:fill_printer, :fill_destructor, :fill_error_token, :sort_by_number!
def initialize(rule_counter)
@@ -380,10 +380,10 @@
@sym_to_rules[key] << rule
end
end
def validate_rule_lhs_is_nterm!
- errors = []
+ errors = [] #: Array[String]
rules.each do |rule|
next if rule.lhs.nterm?
errors << "[BUG] LHS of #{rule.display_name} (line: #{rule.lineno}) is term. It should be nterm."