Class: Racc::Item
Overview
LALR item. A set of rule and its lookahead tokens.
Instance Attribute Summary collapse
-
#la ⇒ Object
readonly
Returns the value of attribute la.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
- #each_la(tbl) ⇒ Object
-
#initialize(rule, la) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(rule, la) ⇒ Item
Returns a new instance of Item.
787 788 789 790 |
# File 'lib/racc/state.rb', line 787 def initialize(rule, la) @rule = rule @la = la end |
Instance Attribute Details
#la ⇒ Object (readonly)
Returns the value of attribute la.
793 794 795 |
# File 'lib/racc/state.rb', line 793 def la @la end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
792 793 794 |
# File 'lib/racc/state.rb', line 792 def rule @rule end |
Instance Method Details
#each_la(tbl) ⇒ Object
795 796 797 798 799 800 801 802 803 804 |
# File 'lib/racc/state.rb', line 795 def each_la(tbl) la = @la 0.upto(la.size - 1) do |i| (0..7).each do |ii| if la[idx = i * 8 + ii] == 1 yield tbl[idx] end end end end |