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.



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

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

Instance Attribute Details

#refnObject (readonly)

Returns the value of attribute refn.



908
909
910
# File 'lib/racc/state.rb', line 908

def refn
  @refn
end

#ruleObject (readonly)

Returns the value of attribute rule.



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

def rule
  @rule
end

Instance Method Details

#decrefObject



922
923
924
925
# File 'lib/racc/state.rb', line 922

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

#increfObject



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

def incref
  @refn += 1
end

#inspectObject



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

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

#ruleidObject



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

def ruleid
  @rule.ident
end