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.
792 793 794 795 |
# File 'lib/racc/state.rb', line 792 def initialize(rule, la) @rule = rule @la = la end |
Instance Attribute Details
#la ⇒ Object (readonly)
Returns the value of attribute la.
798 799 800 |
# File 'lib/racc/state.rb', line 798 def la @la end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
797 798 799 |
# File 'lib/racc/state.rb', line 797 def rule @rule end |
Instance Method Details
#each_la(tbl) ⇒ Object
800 801 802 803 804 805 806 807 808 809 |
# File 'lib/racc/state.rb', line 800 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 |