Class: Lrama::State::Reduce

Inherits:
Object
  • Object
show all
Defined in:
lib/lrama/states.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item) ⇒ Reduce

Returns a new instance of Reduce.



11
12
13
14
15
# File 'lib/lrama/states.rb', line 11

def initialize(item)
  @item = item
  @look_ahead = nil
  @not_selected_symbols = []
end

Instance Attribute Details

#default_reductionObject

Returns the value of attribute default_reduction.



9
10
11
# File 'lib/lrama/states.rb', line 9

def default_reduction
  @default_reduction
end

#itemObject (readonly)



8
9
10
# File 'lib/lrama/states.rb', line 8

def item
  @item
end

#look_aheadObject



8
9
10
# File 'lib/lrama/states.rb', line 8

def look_ahead
  @look_ahead
end

#not_selected_symbolsObject (readonly)



8
9
10
# File 'lib/lrama/states.rb', line 8

def not_selected_symbols
  @not_selected_symbols
end

Instance Method Details

#add_not_selected_symbol(sym) ⇒ Object



25
26
27
# File 'lib/lrama/states.rb', line 25

def add_not_selected_symbol(sym)
  @not_selected_symbols << sym
end

#ruleObject



17
18
19
# File 'lib/lrama/states.rb', line 17

def rule
  @item.rule
end

#selected_look_aheadObject



29
30
31
32
33
34
35
# File 'lib/lrama/states.rb', line 29

def selected_look_ahead
  if @look_ahead
    @look_ahead - @not_selected_symbols
  else
    []
  end
end