Class: Racc::Reduce

Inherits:
Object show all
Defined in:
lib/racc/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule) ⇒ Reduce

Returns a new instance of Reduce.


898
899
900
901
# File 'lib/racc/state.rb', line 898

def initialize(rule)
  @rule = rule
  @refn = 0
end

Instance Attribute Details

#refnObject (readonly)

Returns the value of attribute refn.


904
905
906
# File 'lib/racc/state.rb', line 904

def refn
  @refn
end

#ruleObject (readonly)

Returns the value of attribute rule.


903
904
905
# File 'lib/racc/state.rb', line 903

def rule
  @rule
end

Instance Method Details

#decrefObject


918
919
920
921
# File 'lib/racc/state.rb', line 918

def decref
  @refn -= 1
  raise 'racc: fatal: act.refn < 0' if @refn < 0
end

#increfObject


914
915
916
# File 'lib/racc/state.rb', line 914

def incref
  @refn += 1
end

#inspectObject


910
911
912
# File 'lib/racc/state.rb', line 910

def inspect
  "<reduce #{@rule.ident}>"
end

#ruleidObject


906
907
908
# File 'lib/racc/state.rb', line 906

def ruleid
  @rule.ident
end