Class: Rley::GFG::ShortcutEdge
- Defined in:
- lib/rley/gfg/shortcut_edge.rb
Overview
Abstract class. Represents an edge in a grammar flow graph Responsibilities:
- To know the successor vertex
Instance Attribute Summary collapse
-
#nonterminal ⇒ Object
readonly
The terminal symbol expected from the input stream.
Attributes inherited from Edge
Instance Method Summary collapse
-
#initialize(thePredecessor, theSuccessor) ⇒ ShortcutEdge
constructor
A new instance of ShortcutEdge.
- #to_s ⇒ Object
Methods inherited from Edge
Constructor Details
#initialize(thePredecessor, theSuccessor) ⇒ ShortcutEdge
Returns a new instance of ShortcutEdge.
14 15 16 17 18 |
# File 'lib/rley/gfg/shortcut_edge.rb', line 14 def initialize(thePredecessor, theSuccessor) super(nil, theSuccessor) @nonterminal = thePredecessor.next_symbol thePredecessor.shortcut = self end |
Instance Attribute Details
#nonterminal ⇒ Object (readonly)
The terminal symbol expected from the input stream
12 13 14 |
# File 'lib/rley/gfg/shortcut_edge.rb', line 12 def nonterminal @nonterminal end |
Instance Method Details
#to_s ⇒ Object
20 21 22 |
# File 'lib/rley/gfg/shortcut_edge.rb', line 20 def to_s " -#{nonterminal}-> #{successor.label}" end |