tp_plus 0.0.87 → 0.0.88
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +87 -87
- data/Rakefile +35 -35
- data/bin/tpp +92 -92
- data/lib/tp_plus/interpreter.rb +153 -152
- data/lib/tp_plus/namespace.rb +66 -66
- data/lib/tp_plus/nodes/abort_node.rb +9 -9
- data/lib/tp_plus/nodes/acc_node.rb +24 -19
- data/lib/tp_plus/nodes/address_node.rb +22 -22
- data/lib/tp_plus/nodes/argument_node.rb +20 -20
- data/lib/tp_plus/nodes/assignment_node.rb +52 -52
- data/lib/tp_plus/nodes/base_node.rb +9 -9
- data/lib/tp_plus/nodes/call_node.rb +34 -34
- data/lib/tp_plus/nodes/case_condition_node.rb +26 -26
- data/lib/tp_plus/nodes/case_node.rb +33 -33
- data/lib/tp_plus/nodes/comment_node.rb +18 -18
- data/lib/tp_plus/nodes/conditional_node.rb +60 -60
- data/lib/tp_plus/nodes/definition_node.rb +22 -22
- data/lib/tp_plus/nodes/digit_node.rb +22 -22
- data/lib/tp_plus/nodes/empty_stmt_node.rb +9 -9
- data/lib/tp_plus/nodes/eval_node.rb +13 -13
- data/lib/tp_plus/nodes/expression_node.rb +71 -68
- data/lib/tp_plus/nodes/for_node.rb +20 -20
- data/lib/tp_plus/nodes/header_node.rb +27 -27
- data/lib/tp_plus/nodes/indirect_node.rb +27 -27
- data/lib/tp_plus/nodes/inline_conditional_node.rb +36 -36
- data/lib/tp_plus/nodes/io_method_node.rb +55 -55
- data/lib/tp_plus/nodes/io_node.rb +31 -31
- data/lib/tp_plus/nodes/jpos_node.rb +13 -13
- data/lib/tp_plus/nodes/jump_node.rb +23 -23
- data/lib/tp_plus/nodes/label_definition_node.rb +21 -21
- data/lib/tp_plus/nodes/lpos_node.rb +13 -13
- data/lib/tp_plus/nodes/motion_node.rb +62 -62
- data/lib/tp_plus/nodes/namespace_node.rb +16 -16
- data/lib/tp_plus/nodes/namespaced_var_node.rb +38 -38
- data/lib/tp_plus/nodes/numreg_node.rb +26 -26
- data/lib/tp_plus/nodes/offset_node.rb +27 -27
- data/lib/tp_plus/nodes/operator_node.rb +78 -80
- data/lib/tp_plus/nodes/paren_expression_node.rb +17 -17
- data/lib/tp_plus/nodes/pause_node.rb +9 -9
- data/lib/tp_plus/nodes/position_data_node.rb +66 -66
- data/lib/tp_plus/nodes/position_node.rb +26 -26
- data/lib/tp_plus/nodes/posreg_node.rb +64 -64
- data/lib/tp_plus/nodes/raise_node.rb +13 -13
- data/lib/tp_plus/nodes/real_node.rb +27 -27
- data/lib/tp_plus/nodes/return_node.rb +9 -9
- data/lib/tp_plus/nodes/set_skip_node.rb +14 -14
- data/lib/tp_plus/nodes/skip_node.rb +22 -22
- data/lib/tp_plus/nodes/speed_node.rb +29 -29
- data/lib/tp_plus/nodes/string_node.rb +13 -13
- data/lib/tp_plus/nodes/string_register_node.rb +26 -26
- data/lib/tp_plus/nodes/termination_node.rb +29 -23
- data/lib/tp_plus/nodes/terminator_node.rb +16 -16
- data/lib/tp_plus/nodes/time_node.rb +24 -24
- data/lib/tp_plus/nodes/timer_method_node.rb +33 -33
- data/lib/tp_plus/nodes/timer_node.rb +16 -16
- data/lib/tp_plus/nodes/unary_expression_node.rb +40 -39
- data/lib/tp_plus/nodes/units_node.rb +20 -20
- data/lib/tp_plus/nodes/use_node.rb +21 -21
- data/lib/tp_plus/nodes/user_alarm_node.rb +16 -16
- data/lib/tp_plus/nodes/var_method_node.rb +23 -23
- data/lib/tp_plus/nodes/var_node.rb +39 -39
- data/lib/tp_plus/nodes/vision_register_node.rb +22 -22
- data/lib/tp_plus/nodes/wait_for_node.rb +57 -50
- data/lib/tp_plus/nodes/wait_until_node.rb +61 -61
- data/lib/tp_plus/nodes/while_node.rb +40 -40
- data/lib/tp_plus/parser.rb +1749 -1749
- data/lib/tp_plus/scanner.rb +295 -295
- data/lib/tp_plus/token.rb +101 -101
- data/lib/tp_plus/version.rb +3 -3
- data/lib/tp_plus.rb +72 -72
- data/test/test_helper.rb +5 -5
- data/test/tp_plus/test_interpreter.rb +1378 -1372
- data/test/tp_plus/test_parser.rb +502 -502
- data/test/tp_plus/test_scanner.rb +591 -591
- data/tp_plus.gemspec +31 -31
- metadata +4 -3
data/lib/tp_plus/interpreter.rb
CHANGED
@@ -1,152 +1,153 @@
|
|
1
|
-
require_relative 'parser'
|
2
|
-
|
3
|
-
module TPPlus
|
4
|
-
class Interpreter
|
5
|
-
attr_accessor :line_count, :nodes, :position_data, :header_data
|
6
|
-
attr_reader :labels, :variables, :constants, :namespaces, :source_line_count
|
7
|
-
def initialize
|
8
|
-
@line_count = 0
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
@labels[identifier.to_sym]
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
return "" if @position_data
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
s << %(\
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
end
|
1
|
+
require_relative 'parser'
|
2
|
+
|
3
|
+
module TPPlus
|
4
|
+
class Interpreter
|
5
|
+
attr_accessor :line_count, :nodes, :position_data, :header_data
|
6
|
+
attr_reader :labels, :variables, :constants, :namespaces, :source_line_count
|
7
|
+
def initialize
|
8
|
+
@line_count = 0
|
9
|
+
@source_line_count = 0
|
10
|
+
@nodes = []
|
11
|
+
@labels = {}
|
12
|
+
@namespaces = {}
|
13
|
+
@variables = {}
|
14
|
+
@constants = {}
|
15
|
+
@position_data = {}
|
16
|
+
@header_data = {}
|
17
|
+
@current_label = 99
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_environment(string)
|
21
|
+
scanner = TPPlus::Scanner.new
|
22
|
+
parser = TPPlus::Parser.new(scanner, self)
|
23
|
+
scanner.scan_setup(string)
|
24
|
+
parser.parse
|
25
|
+
eval
|
26
|
+
rescue RuntimeError => e
|
27
|
+
raise "Runtime error in environment on line #{@source_line_count}:\n#{e}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def next_label
|
31
|
+
@current_label += 1
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_namespace(name, block)
|
35
|
+
if @namespaces[name.to_sym].nil?
|
36
|
+
@namespaces[name.to_sym] = TPPlus::Namespace.new(name, block)
|
37
|
+
else
|
38
|
+
@namespaces[name.to_sym].reopen!(block)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def add_label(identifier)
|
43
|
+
raise "Label @#{identifier} already defined" if @labels[identifier.to_sym]
|
44
|
+
@labels[identifier.to_sym] = next_label
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_var(identifier, node)
|
48
|
+
raise "Variable #{identifier} already defined" if @variables[identifier.to_sym]
|
49
|
+
|
50
|
+
@variables[identifier.to_sym] = node
|
51
|
+
node.comment = identifier
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_constant(identifier, node)
|
55
|
+
raise "Constant #{identifier} already defined" if @constants[identifier.to_sym]
|
56
|
+
|
57
|
+
@constants[identifier.to_sym] = node
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_namespace(identifier)
|
61
|
+
if ns = @namespaces[identifier.to_sym]
|
62
|
+
return ns
|
63
|
+
end
|
64
|
+
|
65
|
+
false
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_var(identifier)
|
69
|
+
raise "Variable (#{identifier}) not defined" if @variables[identifier.to_sym].nil?
|
70
|
+
|
71
|
+
@variables[identifier.to_sym]
|
72
|
+
end
|
73
|
+
|
74
|
+
def get_constant(identifier)
|
75
|
+
raise "Constant (#{identifier}) not defined" if @constants[identifier.to_sym].nil?
|
76
|
+
|
77
|
+
@constants[identifier.to_sym]
|
78
|
+
end
|
79
|
+
|
80
|
+
def define_labels
|
81
|
+
@nodes.select {|n| n.is_a? Nodes::LabelDefinitionNode}.each do |n|
|
82
|
+
add_label(n.identifier)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def pos_section
|
87
|
+
return "" if @position_data.empty?
|
88
|
+
return "" if @position_data[:positions].empty?
|
89
|
+
|
90
|
+
@position_data[:positions].inject("") do |s,p|
|
91
|
+
s << %(P[#{p[:id]}:"#{p[:comment]}"]{\n)
|
92
|
+
|
93
|
+
p[:mask].each do |q|
|
94
|
+
s << pos_return(q)
|
95
|
+
end
|
96
|
+
|
97
|
+
s << %(\n};\n)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def pos_return(position_hash)
|
102
|
+
s = ""
|
103
|
+
if position_hash[:config].is_a?(Hash)
|
104
|
+
s << %( GP#{position_hash[:group]}:
|
105
|
+
UF : #{position_hash[:uframe]}, UT : #{position_hash[:utool]}, CONFIG : '#{position_hash[:config][:flip] ? 'F' : 'N'} #{position_hash[:config][:up] ? 'U' : 'D'} #{position_hash[:config][:top] ? 'T' : 'B'}, #{position_hash[:config][:turn_counts].join(', ')}',
|
106
|
+
X = #{position_hash[:components][:x]} mm, Y = #{position_hash[:components][:y]} mm, Z = #{position_hash[:components][:z]} mm,
|
107
|
+
W = #{position_hash[:components][:w]} deg, P = #{position_hash[:components][:p]} deg, R = #{position_hash[:components][:r]} deg)
|
108
|
+
else
|
109
|
+
s << %( GP#{position_hash[:group]}:
|
110
|
+
UF : #{position_hash[:uframe]}, UT : #{position_hash[:utool]})
|
111
|
+
if position_hash[:components].is_a?(Hash)
|
112
|
+
position_hash[:components].each_with_index do |key, joint|
|
113
|
+
s << %(, \n)
|
114
|
+
s << %(\tJ#{key} = #{joint[1]} deg)
|
115
|
+
end
|
116
|
+
s << %(\n)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
return s
|
121
|
+
end
|
122
|
+
|
123
|
+
def eval
|
124
|
+
s = ""
|
125
|
+
last_node = nil
|
126
|
+
|
127
|
+
define_labels
|
128
|
+
|
129
|
+
@source_line_count = 0
|
130
|
+
|
131
|
+
@nodes.each do |n|
|
132
|
+
@source_line_count += 1 unless n.is_a?(Nodes::TerminatorNode) && !last_node.is_a?(Nodes::TerminatorNode)
|
133
|
+
raise if n.is_a?(String)
|
134
|
+
|
135
|
+
res = n.eval(self)
|
136
|
+
|
137
|
+
# preserve whitespace
|
138
|
+
if n.is_a?(Nodes::TerminatorNode) && last_node.is_a?(Nodes::TerminatorNode)
|
139
|
+
s += " ;\n"
|
140
|
+
end
|
141
|
+
last_node = n
|
142
|
+
# end preserve whitespace
|
143
|
+
|
144
|
+
next if res.nil?
|
145
|
+
|
146
|
+
s += "#{res} ;\n"
|
147
|
+
end
|
148
|
+
s
|
149
|
+
rescue RuntimeError => e
|
150
|
+
raise "Runtime error on line #{@source_line_count}:\n#{e}"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
data/lib/tp_plus/namespace.rb
CHANGED
@@ -1,66 +1,66 @@
|
|
1
|
-
module TPPlus
|
2
|
-
class Namespace
|
3
|
-
def initialize(name, block)
|
4
|
-
@name = name
|
5
|
-
@block = block
|
6
|
-
@namespaces = {}
|
7
|
-
@variables = {}
|
8
|
-
@constants = {}
|
9
|
-
|
10
|
-
define!
|
11
|
-
end
|
12
|
-
|
13
|
-
def define!
|
14
|
-
@block.flatten.select {|n| [TPPlus::Nodes::DefinitionNode, TPPlus::Nodes::NamespaceNode].include? n.class }.each do |node|
|
15
|
-
node.eval(self)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def reopen!(block)
|
20
|
-
@block = block
|
21
|
-
define!
|
22
|
-
end
|
23
|
-
|
24
|
-
def add_constant(identifier, node)
|
25
|
-
raise "Constant (#{identifier}) already defined within namespace #{@name}" unless @constants[identifier.to_sym].nil?
|
26
|
-
|
27
|
-
@constants[identifier.to_sym] = node
|
28
|
-
end
|
29
|
-
|
30
|
-
def add_namespace(identifier, block)
|
31
|
-
if @namespaces[identifier.to_sym].nil?
|
32
|
-
@namespaces[identifier.to_sym] = TPPlus::Namespace.new("#{@name} #{identifier}", block)
|
33
|
-
else
|
34
|
-
@namespaces[identifier.to_sym].reopen!(block)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def add_var(identifier, node)
|
39
|
-
raise "Variable (#{identifier}) already defined within namespace #{@name}" unless @variables[identifier.to_sym].nil?
|
40
|
-
|
41
|
-
@variables[identifier.to_sym] = node
|
42
|
-
node.comment = "#{@name} #{identifier}"
|
43
|
-
end
|
44
|
-
|
45
|
-
def get_constant(identifier)
|
46
|
-
raise "Constant (#{identifier}) not defined within namespace #{@name}" if @constants[identifier.to_sym].nil?
|
47
|
-
|
48
|
-
@constants[identifier.to_sym]
|
49
|
-
end
|
50
|
-
|
51
|
-
def get_var(identifier)
|
52
|
-
return get_constant(identifier) if identifier.upcase == identifier
|
53
|
-
raise "Variable (#{identifier}) not defined within namespace #{@name}" if @variables[identifier.to_sym].nil?
|
54
|
-
|
55
|
-
@variables[identifier.to_sym]
|
56
|
-
end
|
57
|
-
|
58
|
-
def get_namespace(identifier)
|
59
|
-
if ns = @namespaces[identifier.to_sym]
|
60
|
-
return ns
|
61
|
-
end
|
62
|
-
|
63
|
-
false
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
1
|
+
module TPPlus
|
2
|
+
class Namespace
|
3
|
+
def initialize(name, block)
|
4
|
+
@name = name
|
5
|
+
@block = block
|
6
|
+
@namespaces = {}
|
7
|
+
@variables = {}
|
8
|
+
@constants = {}
|
9
|
+
|
10
|
+
define!
|
11
|
+
end
|
12
|
+
|
13
|
+
def define!
|
14
|
+
@block.flatten.select {|n| [TPPlus::Nodes::DefinitionNode, TPPlus::Nodes::NamespaceNode].include? n.class }.each do |node|
|
15
|
+
node.eval(self)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def reopen!(block)
|
20
|
+
@block = block
|
21
|
+
define!
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_constant(identifier, node)
|
25
|
+
raise "Constant (#{identifier}) already defined within namespace #{@name}" unless @constants[identifier.to_sym].nil?
|
26
|
+
|
27
|
+
@constants[identifier.to_sym] = node
|
28
|
+
end
|
29
|
+
|
30
|
+
def add_namespace(identifier, block)
|
31
|
+
if @namespaces[identifier.to_sym].nil?
|
32
|
+
@namespaces[identifier.to_sym] = TPPlus::Namespace.new("#{@name} #{identifier}", block)
|
33
|
+
else
|
34
|
+
@namespaces[identifier.to_sym].reopen!(block)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_var(identifier, node)
|
39
|
+
raise "Variable (#{identifier}) already defined within namespace #{@name}" unless @variables[identifier.to_sym].nil?
|
40
|
+
|
41
|
+
@variables[identifier.to_sym] = node
|
42
|
+
node.comment = "#{@name} #{identifier}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_constant(identifier)
|
46
|
+
raise "Constant (#{identifier}) not defined within namespace #{@name}" if @constants[identifier.to_sym].nil?
|
47
|
+
|
48
|
+
@constants[identifier.to_sym]
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_var(identifier)
|
52
|
+
return get_constant(identifier) if identifier.upcase == identifier
|
53
|
+
raise "Variable (#{identifier}) not defined within namespace #{@name}" if @variables[identifier.to_sym].nil?
|
54
|
+
|
55
|
+
@variables[identifier.to_sym]
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_namespace(identifier)
|
59
|
+
if ns = @namespaces[identifier.to_sym]
|
60
|
+
return ns
|
61
|
+
end
|
62
|
+
|
63
|
+
false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module TPPlus
|
2
|
-
module Nodes
|
3
|
-
class AbortNode < BaseNode
|
4
|
-
def eval(context)
|
5
|
-
"ABORT"
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module TPPlus
|
2
|
+
module Nodes
|
3
|
+
class AbortNode < BaseNode
|
4
|
+
def eval(context)
|
5
|
+
"ABORT"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,19 +1,24 @@
|
|
1
|
-
module TPPlus
|
2
|
-
module Nodes
|
3
|
-
class AccNode < BaseNode
|
4
|
-
def initialize(value)
|
5
|
-
@value = value
|
6
|
-
end
|
7
|
-
|
8
|
-
def eval(context)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
module TPPlus
|
2
|
+
module Nodes
|
3
|
+
class AccNode < BaseNode
|
4
|
+
def initialize(value)
|
5
|
+
@value = value
|
6
|
+
end
|
7
|
+
|
8
|
+
def eval(context)
|
9
|
+
case @value
|
10
|
+
when DigitNode
|
11
|
+
"ACC#{@value.eval(context)}"
|
12
|
+
when VarNode
|
13
|
+
if @value.constant?
|
14
|
+
"ACC#{@value.eval(context)}"
|
15
|
+
else
|
16
|
+
"ACC #{@value.eval(context)}"
|
17
|
+
end
|
18
|
+
else
|
19
|
+
raise "invalid acc"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
module TPPlus
|
2
|
-
module Nodes
|
3
|
-
class AddressNode < BaseNode
|
4
|
-
attr_reader :id
|
5
|
-
def initialize(id)
|
6
|
-
@id = id
|
7
|
-
end
|
8
|
-
|
9
|
-
def requires_mixed_logic?(context)
|
10
|
-
false
|
11
|
-
end
|
12
|
-
|
13
|
-
def node(context)
|
14
|
-
context.get_var(@id)
|
15
|
-
end
|
16
|
-
|
17
|
-
def eval(context,options={})
|
18
|
-
node(context).id.to_s
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
1
|
+
module TPPlus
|
2
|
+
module Nodes
|
3
|
+
class AddressNode < BaseNode
|
4
|
+
attr_reader :id
|
5
|
+
def initialize(id)
|
6
|
+
@id = id
|
7
|
+
end
|
8
|
+
|
9
|
+
def requires_mixed_logic?(context)
|
10
|
+
false
|
11
|
+
end
|
12
|
+
|
13
|
+
def node(context)
|
14
|
+
context.get_var(@id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def eval(context,options={})
|
18
|
+
node(context).id.to_s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
module TPPlus
|
2
|
-
module Nodes
|
3
|
-
class ArgumentNode < BaseNode
|
4
|
-
attr_accessor :comment
|
5
|
-
attr_reader :id
|
6
|
-
def initialize(id)
|
7
|
-
@id = id
|
8
|
-
@comment = comment
|
9
|
-
end
|
10
|
-
|
11
|
-
def requires_mixed_logic?(context)
|
12
|
-
true
|
13
|
-
end
|
14
|
-
|
15
|
-
def eval(context,options={})
|
16
|
-
"AR[#{@id}]"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
1
|
+
module TPPlus
|
2
|
+
module Nodes
|
3
|
+
class ArgumentNode < BaseNode
|
4
|
+
attr_accessor :comment
|
5
|
+
attr_reader :id
|
6
|
+
def initialize(id)
|
7
|
+
@id = id
|
8
|
+
@comment = comment
|
9
|
+
end
|
10
|
+
|
11
|
+
def requires_mixed_logic?(context)
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
def eval(context,options={})
|
16
|
+
"AR[#{@id}]"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|