Class: XfOOrth::NosSpec

Inherits:
AbstractWordSpec show all
Defined in:
lib/fOOrth/compiler/word_specs.rb

Overview

A class used to specify the compile of dyadic operators.

Instance Attribute Summary

Attributes inherited from AbstractWordSpec

#builds, #does, #tags

Instance Method Summary collapse

Methods inherited from AbstractWordSpec

#get_info, #has_tag?, #initialize

Constructor Details

This class inherits a constructor from XfOOrth::AbstractWordSpec

Instance Method Details

#build_builds_string(_name, symbol) ⇒ Object

Generate the Ruby code for this dyadic operator.
Parameters:

  • _name - The string that maps to the symbol. Unused

  • symbol - The symbol that the name maps to.



92
93
94
# File 'lib/fOOrth/compiler/word_specs.rb', line 92

def build_builds_string(_name, symbol)
  @builds = "vm.swap_pop.#{symbol}(vm); "
end

#get_stub_action(name, symbol) ⇒ Object

Get the default action if none is specified.



97
98
99
100
101
102
103
104
105
# File 'lib/fOOrth/compiler/word_specs.rb', line 97

def get_stub_action(name, symbol)
  lambda do |vm|
    #NOS methods leave an extra item on the stack which must
    #be removed at this time.
    vm.data_stack.pop

    f20_error(self, name, symbol)
  end
end