Class: Racc::Goto

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

Overview

Represents a transition on the grammar. “Real goto” means a transition by nonterminal, but this class treats also terminal’s. If one is a terminal transition, .ident returns nil.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ident, sym, from, to) ⇒ Goto

Returns a new instance of Goto.



772
773
774
775
776
777
# File 'lib/racc/state.rb', line 772

def initialize(ident, sym, from, to)
  @ident      = ident
  @symbol     = sym
  @from_state = from
  @to_state   = to
end

Instance Attribute Details

#from_stateObject (readonly)

Returns the value of attribute from_state.



781
782
783
# File 'lib/racc/state.rb', line 781

def from_state
  @from_state
end

#identObject (readonly)

Returns the value of attribute ident.



779
780
781
# File 'lib/racc/state.rb', line 779

def ident
  @ident
end

#symbolObject (readonly)

Returns the value of attribute symbol.



780
781
782
# File 'lib/racc/state.rb', line 780

def symbol
  @symbol
end

#to_stateObject (readonly)

Returns the value of attribute to_state.



782
783
784
# File 'lib/racc/state.rb', line 782

def to_state
  @to_state
end

Instance Method Details

#inspectObject



784
785
786
# File 'lib/racc/state.rb', line 784

def inspect
  "(#{@from_state.ident}-#{@symbol}->#{@to_state.ident})"
end