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.



895
896
897
898
# File 'lib/racc/state.rb', line 895

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

Instance Attribute Details

#refnObject (readonly)

Returns the value of attribute refn.



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

def refn
  @refn
end

#ruleObject (readonly)

Returns the value of attribute rule.



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

def rule
  @rule
end

Instance Method Details

#decrefObject



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

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

#increfObject



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

def incref
  @refn += 1
end

#inspectObject



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

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

#ruleidObject



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

def ruleid
  @rule.ident
end