Class: XfOOrth::NosSpec
- Inherits:
-
AbstractWordSpec
- Object
- AbstractWordSpec
- XfOOrth::NosSpec
- 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
Instance Method Summary collapse
-
#build_builds_string(_name, symbol) ⇒ Object
Generate the Ruby code for this dyadic operator.
-
#get_stub_action(name, symbol) ⇒ Object
Get the default action if none is specified.
Methods inherited from AbstractWordSpec
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.
89 90 91 |
# File 'lib/fOOrth/compiler/word_specs.rb', line 89 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.
94 95 96 97 98 99 100 101 102 |
# File 'lib/fOOrth/compiler/word_specs.rb', line 94 def get_stub_action(name, symbol) lambda do |vm| #NOS methods can leave an extra bit of mess on the stack which must #be cleaned up at this time or it will cause further problems. vm.data_stack.pop error "F20: A #{self.foorth_name} does not understand #{name} (#{symbol.inspect})." end end |