Class: Lrama::State::Reduce

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item) ⇒ Reduce



8
9
10
11
12
# File 'lib/lrama/state/reduce.rb', line 8

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

Instance Attribute Details

#default_reductionObject

Returns the value of attribute default_reduction.



6
7
8
# File 'lib/lrama/state/reduce.rb', line 6

def default_reduction
  @default_reduction
end

#itemObject (readonly)



5
6
7
# File 'lib/lrama/state/reduce.rb', line 5

def item
  @item
end

#look_aheadObject



5
6
7
# File 'lib/lrama/state/reduce.rb', line 5

def look_ahead
  @look_ahead
end

#not_selected_symbolsObject (readonly)



5
6
7
# File 'lib/lrama/state/reduce.rb', line 5

def not_selected_symbols
  @not_selected_symbols
end

Instance Method Details

#add_not_selected_symbol(sym) ⇒ Object



22
23
24
# File 'lib/lrama/state/reduce.rb', line 22

def add_not_selected_symbol(sym)
  @not_selected_symbols << sym
end

#ruleObject



14
15
16
# File 'lib/lrama/state/reduce.rb', line 14

def rule
  @item.rule
end

#selected_look_aheadObject



26
27
28
29
30
31
32
# File 'lib/lrama/state/reduce.rb', line 26

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