Class: TPPlus::Nodes::SkipNode

Inherits:
Object
  • Object
show all
Defined in:
lib/tp_plus/nodes/skip_node.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, lpos_pr) ⇒ SkipNode

Returns a new instance of SkipNode.



4
5
6
7
# File 'lib/tp_plus/nodes/skip_node.rb', line 4

def initialize(target, lpos_pr)
  @target = target
  @lpos_pr = lpos_pr
end

Instance Method Details

#eval(context) ⇒ Object



15
16
17
18
19
# File 'lib/tp_plus/nodes/skip_node.rb', line 15

def eval(context)
  raise "Label (#{@target}) not found" if context.labels[@target.to_sym].nil?

  "Skip,LBL[#{context.labels[@target.to_sym]}]#{lpos_pr(context)}"
end

#lpos_pr(context) ⇒ Object



9
10
11
12
13
# File 'lib/tp_plus/nodes/skip_node.rb', line 9

def lpos_pr(context)
  return "" if @lpos_pr.nil?

  ",#{@lpos_pr.eval(context)}=LPOS"
end