Class: Rley::GFG::ScanEdge

Inherits:
Edge
  • Object
show all
Defined in:
lib/rley/gfg/scan_edge.rb

Overview

Specialization of an edge in a grammar flow graph that is taken as a consequence of a scan rule. Responsibilities:

  • To know the successor vertex

Instance Attribute Summary collapse

Attributes inherited from Edge

#successor

Instance Method Summary collapse

Constructor Details

#initialize(thePredecessor, theSuccessor, aTerminal) ⇒ ScanEdge

Returns a new instance of ScanEdge.



13
14
15
16
# File 'lib/rley/gfg/scan_edge.rb', line 13

def initialize(thePredecessor, theSuccessor, aTerminal)
  super(thePredecessor, theSuccessor)
  @terminal = aTerminal
end

Instance Attribute Details

#terminalObject (readonly)

The terminal symbol expected from the input stream



11
12
13
# File 'lib/rley/gfg/scan_edge.rb', line 11

def terminal
  @terminal
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/rley/gfg/scan_edge.rb', line 18

def to_s()
  " -#{terminal}-> #{successor.label}"
end