Class: TPPlus::Nodes::TerminationNode
- Defined in:
- lib/tp_plus/nodes/termination_node.rb
Instance Method Summary collapse
- #eval(context) ⇒ Object
-
#initialize(value) ⇒ TerminationNode
constructor
A new instance of TerminationNode.
Methods inherited from BaseNode
Constructor Details
#initialize(value) ⇒ TerminationNode
Returns a new instance of TerminationNode.
4 5 6 |
# File 'lib/tp_plus/nodes/termination_node.rb', line 4 def initialize(value) @value = value end |
Instance Method Details
#eval(context) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tp_plus/nodes/termination_node.rb', line 8 def eval(context) case @value when DigitNode "CNT#{@value.eval(context)}" when VarNode if @value.constant? val = @value.eval(context) if val[0] == "(" # negative "FINE" else "CNT#{val}" end else "CNT #{@value.eval(context)}" end else raise "invalid term" end end |