123456789_123456789_123456789_123456789_123456789_

Class: Racc::Item

Relationships & Source Files
Inherits: Object
Defined in: lib/racc/state.rb

Overview

LALR item. A set of rule and its lookahead tokens.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(rule, la) ⇒ Item

[ GitHub ]

  
# File 'lib/racc/state.rb', line 785

def initialize(rule, la)
  @rule = rule
  @la  = la
end

Instance Attribute Details

#la (readonly)

[ GitHub ]

  
# File 'lib/racc/state.rb', line 791

attr_reader :la

#rule (readonly)

[ GitHub ]

  
# File 'lib/racc/state.rb', line 790

attr_reader :rule

Instance Method Details

#each_la(tbl)

[ GitHub ]

  
# File 'lib/racc/state.rb', line 793

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