Sha256: 6de43040395152fb0ec23c9f22278aff09e1ea7db3254063b8af6f4abff130ee

Contents?: true

Size: 389 Bytes

Versions: 1

Compression:

Stored size: 389 Bytes

Contents

module Whitespace::ISA
  class Ujmp < Instruction
    attr_reader :name

    def initialize(vm, name)
      unless Whitespace::Util.is_label?(name)
        raise ArgumentError, "must be a label: #{name}"
      end
      super(vm)
      @name = name
    end

    def execute
      index = Whitespace::Util.find_label(vm.instructions, name)
      vm.pc.change_to index + 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whitespace-ruby-1.0.0 lib/whitespace/instructions/flow_control/ujmp.rb