class RegularExpression::Bytecode::Compiled
Attributes
insns[R]
labels[R]
Public Class Methods
new(insns, labels)
click to toggle source
# File lib/regular_expression/bytecode.rb, line 164 def initialize(insns, labels) @insns = insns @labels = labels end
Public Instance Methods
dump()
click to toggle source
# File lib/regular_expression/bytecode.rb, line 169 def dump output = StringIO.new # Labels store name -> address, but if we want to print the label name # at its address, we need to store the address to the name as well. reverse_labels = {} labels.each do |label, n| reverse_labels[n] = label end insns.each_with_index do |insn, n| label = reverse_labels[n] output.puts("#{label}:") if label output.puts(" #{insn}") end output.string end