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

Methods inherited from Edge

#inspect

Constructor Details

#initialize(thePredecessor, theSuccessor, aTerminal) ⇒ ScanEdge

Returns a new instance of ScanEdge.



15
16
17
18
# File 'lib/rley/gfg/scan_edge.rb', line 15

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

Instance Attribute Details

#terminalObject (readonly)

The terminal symbol expected from the input stream



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

def terminal
  @terminal
end

Instance Method Details

#to_sObject



20
21
22
# File 'lib/rley/gfg/scan_edge.rb', line 20

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