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

- old
+ new

@@ -7,11 +7,11 @@ ErrorActionNumber = -Float::INFINITY BaseMin = -Float::INFINITY # TODO: It might be better to pass `states` to Output directly? - attr_reader :states + attr_reader :states, :yylast, :yypact_ninf, :yytable_ninf, :yydefact, :yydefgoto def initialize(states) @states = states @yydefact = nil @yydefgoto = nil @@ -39,19 +39,15 @@ # State number of final (accepted) state def yyfinal @states.states.find do |state| state.items.find do |item| - item.rule.lhs.id.s_value == "$accept" && item.end_of_rule? + item.rule.lhs.accept_symbol? && item.end_of_rule? end end.id end - def yylast - @yylast - end - # Number of terms def yyntokens @states.terms.count end @@ -117,31 +113,15 @@ @states.symbols.sort_by(&:number).map do |sym| sym.display_name end end - def yypact_ninf - @yypact_ninf - end - - def yytable_ninf - @yytable_ninf - end - def yypact @base[0...yynstates] end - def yydefact - @yydefact - end - def yypgoto @base[yynstates..-1] - end - - def yydefgoto - @yydefgoto end def yytable @table end