Class: CodeAtomQInstruction
- Inherits:
-
Instruction
- Object
- Instruction
- CodeAtomQInstruction
- Defined in:
- lib/instructions/code/code_atom_q.rb
Overview
pops the top item of the :code
stack; pushes a ValuePoint onto the :bool
stack that is false
only if the :code
item was a CodeBlockPoint, (that is, a multi-line Nudge program)
needs: 1 :code
pushes: 1 :bool
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
Methods inherited from Instruction
all_instructions, #go, inherited, #initialize, #needs, #pushes, to_nudgecode
Constructor Details
This class inherits a constructor from Instruction
Instance Method Details
#cleanup ⇒ Object
22 23 24 |
# File 'lib/instructions/code/code_atom_q.rb', line 22 def cleanup pushes :bool, @result end |
#derive ⇒ Object
18 19 20 21 |
# File 'lib/instructions/code/code_atom_q.rb', line 18 def derive atomQ = @arg1.parses? && @arg1.points == 1 @result = ValuePoint.new("bool", atomQ) end |
#preconditions? ⇒ Boolean
11 12 13 |
# File 'lib/instructions/code/code_atom_q.rb', line 11 def preconditions? needs :code, 1 end |
#setup ⇒ Object
14 15 16 17 |
# File 'lib/instructions/code/code_atom_q.rb', line 14 def setup arg_blueprint = @context.pop_value(:code) @arg1 = NudgeProgram.new(arg_blueprint) end |