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.



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

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

Instance Attribute Details

#refnObject (readonly)

Returns the value of attribute refn.



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

def refn
  @refn
end

#ruleObject (readonly)

Returns the value of attribute rule.



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

def rule
  @rule
end

Instance Method Details

#decrefObject



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

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

#increfObject



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

def incref
  @refn += 1
end

#inspectObject



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

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

#ruleidObject



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

def ruleid
  @rule.ident
end