Class: RegularExpression::CFG::ExtendedBasicBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/regular_expression/cfg.rb

Overview

An Extended Basic Block is a linear sequence of instructions with one entry point and zero or more exit points.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, insns, exits) ⇒ ExtendedBasicBlock

Returns a new instance of ExtendedBasicBlock.



101
102
103
104
105
# File 'lib/regular_expression/cfg.rb', line 101

def initialize(name, insns, exits)
  @name = name
  @insns = insns
  @exits = exits
end

Instance Attribute Details

#exitsObject (readonly)

Returns the value of attribute exits.



99
100
101
# File 'lib/regular_expression/cfg.rb', line 99

def exits
  @exits
end

#insnsObject (readonly)

Returns the value of attribute insns.



99
100
101
# File 'lib/regular_expression/cfg.rb', line 99

def insns
  @insns
end

#nameObject (readonly)

Returns the value of attribute name.



99
100
101
# File 'lib/regular_expression/cfg.rb', line 99

def name
  @name
end

Instance Method Details

#dump(exit_map, io: $stdout) ⇒ Object



107
108
109
110
111
# File 'lib/regular_expression/cfg.rb', line 107

def dump(exit_map, io: $stdout)
  io.puts("#{name}:")
  insns.each { |insn| io.puts("  #{insn}") }
  exits.each { |exit| io.puts("    #{exit} -> #{exit_map[exit].name}") }
end