pione 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +12 -1
- data/example/AbstractRule/AbstractRule.pione +40 -0
- data/example/Fib/Fib.pione +12 -5
- data/example/LucasNumber/LucasNumber.pione +1 -1
- data/example/MakePair/MakePair.pione +21 -6
- data/example/OddSelector/OddSelector.pione +17 -0
- data/example/OddSelector/data/1.i +0 -0
- data/example/OddSelector/data/10.i +0 -0
- data/example/OddSelector/data/2.i +0 -0
- data/example/OddSelector/data/3.i +0 -0
- data/example/OddSelector/data/4.i +0 -0
- data/example/OddSelector/data/5.i +0 -0
- data/example/OddSelector/data/6.i +0 -0
- data/example/OddSelector/data/7.i +0 -0
- data/example/OddSelector/data/8.i +0 -0
- data/example/OddSelector/data/9.i +0 -0
- data/example/SequentialParameter/SequentialParameter.pione +4 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +31 -43
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +1 -1
- data/example/Touch/Touch.pione +3 -0
- data/lib/pione/command/pione-syntax-checker.rb +4 -4
- data/lib/pione/model/assignment.rb +6 -1
- data/lib/pione/model/basic-model.rb +92 -278
- data/lib/pione/model/binary-operator.rb +5 -1
- data/lib/pione/model/block.rb +17 -0
- data/lib/pione/model/boolean.rb +54 -22
- data/lib/pione/model/constraints.rb +34 -0
- data/lib/pione/model/data-expr.rb +184 -297
- data/lib/pione/model/feature-expr.rb +13 -4
- data/lib/pione/model/float.rb +24 -41
- data/lib/pione/model/integer.rb +75 -41
- data/lib/pione/model/keyed-sequence.rb +143 -0
- data/lib/pione/model/list.rb +12 -8
- data/lib/pione/model/message.rb +8 -4
- data/lib/pione/model/ordinal-sequence.rb +75 -0
- data/lib/pione/model/package.rb +6 -2
- data/lib/pione/model/parameters.rb +61 -9
- data/lib/pione/model/pione-method.rb +146 -0
- data/lib/pione/model/rule-expr.rb +44 -38
- data/lib/pione/model/rule-io.rb +11 -3
- data/lib/pione/model/rule.rb +105 -155
- data/lib/pione/model/sequence.rb +273 -0
- data/lib/pione/model/string.rb +75 -29
- data/lib/pione/model/ticket-expr.rb +17 -29
- data/lib/pione/model/type.rb +242 -0
- data/lib/pione/model/variable-table.rb +52 -53
- data/lib/pione/model/variable.rb +8 -4
- data/lib/pione/model.rb +34 -0
- data/lib/pione/parser/block-parser.rb +44 -20
- data/lib/pione/parser/common-parser.rb +2 -1
- data/lib/pione/parser/document-parser.rb +6 -1
- data/lib/pione/parser/expr-parser.rb +57 -11
- data/lib/pione/parser/flow-element-parser.rb +2 -2
- data/lib/pione/parser/rule-definition-parser.rb +23 -1
- data/lib/pione/patch/rinda-patch.rb +1 -5
- data/lib/pione/rule-handler/action-handler.rb +5 -5
- data/lib/pione/rule-handler/basic-handler.rb +30 -7
- data/lib/pione/rule-handler/empty-handler.rb +14 -0
- data/lib/pione/rule-handler/flow-handler.rb +132 -115
- data/lib/pione/rule-handler/root-handler.rb +6 -2
- data/lib/pione/rule-handler/update-criteria.rb +152 -0
- data/lib/pione/rule-handler.rb +14 -0
- data/lib/pione/system/identifier.rb +9 -9
- data/lib/pione/transformer/block-transformer.rb +4 -0
- data/lib/pione/transformer/expr-transformer.rb +1 -1
- data/lib/pione/transformer/flow-element-transformer.rb +4 -2
- data/lib/pione/transformer/literal-transformer.rb +14 -3
- data/lib/pione/transformer/rule-definition-transformer.rb +17 -5
- data/lib/pione/tuple-space/data-finder.rb +15 -52
- data/lib/pione/version.rb +1 -1
- data/lib/pione.rb +12 -38
- data/test/agent/spec_task-worker.rb +13 -12
- data/test/model/spec_assignment.rb +2 -2
- data/test/model/spec_binary-operator.rb +10 -10
- data/test/model/spec_block.rb +8 -8
- data/test/model/spec_boolean.rb +1 -72
- data/test/model/spec_boolean.yml +134 -0
- data/test/model/spec_data-expr.rb +50 -237
- data/test/model/spec_data-expr.yml +16 -45
- data/test/model/spec_data-expr_match.yml +45 -0
- data/test/model/spec_feature-expr.rb +2 -43
- data/test/model/spec_feature-expr.yml +0 -28
- data/test/model/spec_feature-expr_decide.yml +28 -0
- data/test/model/spec_float.rb +1 -119
- data/test/model/spec_float.yml +17 -0
- data/test/model/spec_integer.rb +1 -119
- data/test/model/spec_integer.yml +57 -0
- data/test/model/spec_keyed-sequence.rb +5 -0
- data/test/model/spec_keyed-sequence.yml +22 -0
- data/test/model/spec_message.rb +7 -7
- data/test/model/spec_parameters.rb +50 -63
- data/test/model/spec_pione-method.rb +56 -0
- data/test/model/spec_rule-expr.rb +18 -8
- data/test/model/spec_rule.rb +12 -12
- data/test/model/spec_sequence.rb +5 -0
- data/test/model/spec_sequence.yml +60 -0
- data/test/model/spec_string.rb +3 -70
- data/test/model/spec_string.yml +83 -0
- data/test/model/spec_ticket-expr.rb +4 -54
- data/test/model/spec_ticket-expr.yml +11 -0
- data/test/model/spec_variable-table.rb +41 -42
- data/test/model/spec_variable.rb +20 -22
- data/test/parser/spec_block-parser.yml +9 -0
- data/test/parser/spec_expr-parser.yml +0 -17
- data/test/parser/spec_flow-element-parser.yml +1 -1
- data/test/parser/spec_rule-definition-parser.yml +0 -4
- data/test/rule-handler/spec_update-criteria.pione +39 -0
- data/test/rule-handler/spec_update-criteria.rb +53 -0
- data/test/rule-handler/spec_update-criteria.yml +158 -0
- data/test/test-util.rb +25 -0
- data/test/transformer/spec_block-transformer.rb +7 -0
- data/test/transformer/spec_expr-transformer.rb +64 -19
- data/test/transformer/spec_flow-element-transformer.rb +11 -11
- data/test/transformer/spec_literal-transformer.rb +29 -29
- data/test/transformer/spec_rule-definition-transformer.rb +39 -21
- metadata +57 -11
- data/lib/pione/model/undefined-value.rb +0 -24
- data/lib/pione/tuple-space/update-criteria.rb +0 -97
- data/test/model/spec_list.rb +0 -26
- data/test/model/spec_rule-io.rb +0 -32
- data/test/spec_update-criteria.rb +0 -83
data/lib/pione/model.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# load all models
|
2
|
+
require 'pione/model/type'
|
3
|
+
require 'pione/model/pione-method'
|
4
|
+
require 'pione/model/basic-model'
|
5
|
+
require 'pione/model/sequence'
|
6
|
+
require 'pione/model/ordinal-sequence'
|
7
|
+
require 'pione/model/keyed-sequence'
|
8
|
+
require 'pione/model/boolean'
|
9
|
+
require 'pione/model/integer'
|
10
|
+
require 'pione/model/float'
|
11
|
+
require 'pione/model/string'
|
12
|
+
require 'pione/model/feature-expr'
|
13
|
+
require 'pione/model/variable'
|
14
|
+
require 'pione/model/variable-table'
|
15
|
+
require 'pione/model/data-expr'
|
16
|
+
require 'pione/model/parameters'
|
17
|
+
require 'pione/model/package'
|
18
|
+
require 'pione/model/ticket-expr'
|
19
|
+
require 'pione/model/rule-expr'
|
20
|
+
require 'pione/model/binary-operator'
|
21
|
+
require 'pione/model/message'
|
22
|
+
require 'pione/model/call-rule'
|
23
|
+
require 'pione/model/assignment'
|
24
|
+
require 'pione/model/block'
|
25
|
+
require 'pione/model/constraints'
|
26
|
+
require 'pione/model/rule'
|
27
|
+
|
28
|
+
module Pione
|
29
|
+
# Model is a name space for all PIONE models.
|
30
|
+
module Model
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Pione
|
2
2
|
module Parser
|
3
|
-
# BlockParser is a set of
|
3
|
+
# BlockParser is a set of parsers for rule block.
|
4
4
|
module BlockParser
|
5
5
|
include Parslet
|
6
6
|
include SyntaxError
|
@@ -9,17 +9,23 @@ module Pione
|
|
9
9
|
include ExprParser
|
10
10
|
include FlowElementParser
|
11
11
|
|
12
|
-
# @!
|
13
|
-
# +block+ matches
|
14
|
-
#
|
12
|
+
# @!method block
|
13
|
+
# +block+ parser matches all blocks of PIONE.
|
14
|
+
#
|
15
|
+
# @return [Parslet::Atoms::Entity]
|
16
|
+
# +block+ parser
|
15
17
|
rule(:block) {
|
16
18
|
flow_block |
|
17
|
-
action_block
|
19
|
+
action_block |
|
20
|
+
empty_block |
|
21
|
+
syntax_error("block not found", [:block])
|
18
22
|
}
|
19
23
|
|
20
|
-
# @!
|
21
|
-
# +flow_block+ matches flow block.
|
22
|
-
#
|
24
|
+
# @!method flow_block
|
25
|
+
# +flow_block+ parser matches flow block.
|
26
|
+
#
|
27
|
+
# @return [Parslet::Atoms::Entity]
|
28
|
+
# +flow_block+ parser
|
23
29
|
# @example
|
24
30
|
# Flow
|
25
31
|
# rule A
|
@@ -36,9 +42,11 @@ module Pione
|
|
36
42
|
).as(:flow_block)
|
37
43
|
}
|
38
44
|
|
39
|
-
# @!
|
40
|
-
# +action_block+ matches action block.
|
41
|
-
#
|
45
|
+
# @!method action_block
|
46
|
+
# +action_block+ parser matches action block.
|
47
|
+
#
|
48
|
+
# @return [Parslet::Atoms::Entity]
|
49
|
+
# +action_block+ parser
|
42
50
|
# @example
|
43
51
|
# Action
|
44
52
|
# echo "abc" > out.txt
|
@@ -52,27 +60,43 @@ module Pione
|
|
52
60
|
).as(:action_block)
|
53
61
|
}
|
54
62
|
|
55
|
-
# @!
|
56
|
-
# +
|
57
|
-
# @return [Parslet::Atoms::Entity]
|
63
|
+
# @!method empty_block
|
64
|
+
# +empty_block+ parser matches empty block.
|
65
|
+
# @return [Parslet::Atoms::Entity]
|
66
|
+
# +empty_block+ parser
|
67
|
+
# @example
|
68
|
+
# End
|
69
|
+
rule(:empty_block) {
|
70
|
+
block_end_line.as(:empty_block)
|
71
|
+
}
|
72
|
+
|
73
|
+
# @!method flow_block_begin_line
|
74
|
+
# +flow_block_begin_line+ parser matches flow block heading.
|
75
|
+
#
|
76
|
+
# @return [Parslet::Atoms::Entity]
|
77
|
+
# +flow_block_begin_line+ parser
|
58
78
|
# @example
|
59
79
|
# Flow
|
60
80
|
rule(:flow_block_begin_line) {
|
61
81
|
space? >> keyword_Flow >> str('-').repeat >> line_end
|
62
82
|
}
|
63
83
|
|
64
|
-
# @!
|
65
|
-
# +flow_block_begin_line+ matches action block heading.
|
66
|
-
#
|
84
|
+
# @!method action_block_begin_line
|
85
|
+
# +flow_block_begin_line+ parser matches action block heading.
|
86
|
+
#
|
87
|
+
# @return [Parslet::Atoms::Entity]
|
88
|
+
# +action_block_begin_line+ parser
|
67
89
|
# @example
|
68
90
|
# Action
|
69
91
|
rule(:action_block_begin_line) {
|
70
92
|
space? >> keyword_Action.as(:key) >> str('-').repeat >> line_end
|
71
93
|
}
|
72
94
|
|
73
|
-
# @!
|
74
|
-
# +block_end_line+ matches block end keyword.
|
75
|
-
#
|
95
|
+
# @!method block_end_line
|
96
|
+
# +block_end_line+ parser matches block end keyword.
|
97
|
+
#
|
98
|
+
# @return [Parslet::Atoms::Entity]
|
99
|
+
# +block_end_line+ parser
|
76
100
|
# @example
|
77
101
|
# End
|
78
102
|
rule(:block_end_line) {
|
@@ -56,7 +56,8 @@ module Pione
|
|
56
56
|
param_block |
|
57
57
|
param_line |
|
58
58
|
assignment_line |
|
59
|
-
|
59
|
+
expr_line |
|
60
|
+
annotation_line
|
60
61
|
}
|
61
62
|
|
62
63
|
#
|
@@ -130,6 +131,10 @@ module Pione
|
|
130
131
|
line_end
|
131
132
|
).as(:require)
|
132
133
|
}
|
134
|
+
|
135
|
+
rule(:expr_line) {
|
136
|
+
space? >> expr >> line_end
|
137
|
+
}
|
133
138
|
end
|
134
139
|
end
|
135
140
|
end
|
@@ -140,7 +140,44 @@ module Pione
|
|
140
140
|
# @return [Parslet::Atoms::Entity] +expr_operator+ atom
|
141
141
|
# @example
|
142
142
|
# :=, ==, !=, >=, >, <=, <, &&, ||, +, -, *, /, %, or, and
|
143
|
-
rule(:expr_operator) {
|
143
|
+
# rule(:expr_operator) {
|
144
|
+
# equals >> equals >> greater_than |
|
145
|
+
# equals >> equals |
|
146
|
+
# exclamation >> equals |
|
147
|
+
# less_than >> equals |
|
148
|
+
# less_than |
|
149
|
+
# greater_than >> greater_than >> greater_than |
|
150
|
+
# greater_than >> equals |
|
151
|
+
# greater_than |
|
152
|
+
# ampersand >> ampersand |
|
153
|
+
# vbar >> vbar |
|
154
|
+
# plus |
|
155
|
+
# minus |
|
156
|
+
# asterisk |
|
157
|
+
# slash |
|
158
|
+
# percent |
|
159
|
+
# keyword_or |
|
160
|
+
# keyword_and |
|
161
|
+
# atmark |
|
162
|
+
# vbar
|
163
|
+
# }
|
164
|
+
|
165
|
+
rule(:expr_operator_1) {
|
166
|
+
plus |
|
167
|
+
minus |
|
168
|
+
asterisk |
|
169
|
+
slash |
|
170
|
+
percent |
|
171
|
+
atmark |
|
172
|
+
(vbar >> vbar).absent? >> vbar |
|
173
|
+
keyword_or |
|
174
|
+
keyword_and |
|
175
|
+
(colon >> colon | colon >> equals).absent? >> colon
|
176
|
+
}
|
177
|
+
|
178
|
+
rule(:expr_operator_2) {
|
179
|
+
equals >> equals >> equals |
|
180
|
+
exclamation >> equals >> equals |
|
144
181
|
equals >> equals >> greater_than |
|
145
182
|
equals >> equals |
|
146
183
|
exclamation >> equals |
|
@@ -150,14 +187,7 @@ module Pione
|
|
150
187
|
greater_than >> equals |
|
151
188
|
greater_than |
|
152
189
|
ampersand >> ampersand |
|
153
|
-
vbar >> vbar
|
154
|
-
plus |
|
155
|
-
minus |
|
156
|
-
asterisk |
|
157
|
-
slash |
|
158
|
-
percent |
|
159
|
-
keyword_or |
|
160
|
-
keyword_and
|
190
|
+
vbar >> vbar
|
161
191
|
}
|
162
192
|
|
163
193
|
# @!attribute [r] expr_operator_application
|
@@ -166,11 +196,27 @@ module Pione
|
|
166
196
|
# @example
|
167
197
|
# X + X
|
168
198
|
rule(:expr_operator_application) {
|
199
|
+
expr_operator_application_2 |
|
200
|
+
expr_operator_application_1
|
201
|
+
}
|
202
|
+
|
203
|
+
rule(:expr_operator_application_1) {
|
169
204
|
( expr_element.as(:left) >>
|
170
205
|
pad? >>
|
171
|
-
|
206
|
+
expr_operator_1.as(:operator) >>
|
207
|
+
pad? >>
|
208
|
+
((expr_operator_application_1 | expr_element).as(:right) |
|
209
|
+
syntax_error("the right hand of operator application should be expr", [:expr]))
|
210
|
+
).as(:expr_operator_application)
|
211
|
+
}
|
212
|
+
|
213
|
+
rule(:expr_operator_application_2) {
|
214
|
+
((expr_operator_application_1 | expr_element).as(:left) >>
|
215
|
+
pad? >>
|
216
|
+
expr_operator_2.as(:operator) >>
|
172
217
|
pad? >>
|
173
|
-
expr.as(:right)
|
218
|
+
( expr.as(:right) |
|
219
|
+
syntax_error("the right hand of operator application should be expr", [:expr]))
|
174
220
|
).as(:expr_operator_application)
|
175
221
|
}
|
176
222
|
|
@@ -64,7 +64,7 @@ module Pione
|
|
64
64
|
( if_block_begin >>
|
65
65
|
flow_element.repeat.as(:if_true_elements) >>
|
66
66
|
else_block.maybe.as(:if_else_block) >>
|
67
|
-
conditional_block_end
|
67
|
+
(conditional_block_end | syntax_error("keyword 'end' not found", [:end]))
|
68
68
|
).as(:if_block)
|
69
69
|
}
|
70
70
|
|
@@ -77,7 +77,7 @@ module Pione
|
|
77
77
|
space? >>
|
78
78
|
keyword_if >>
|
79
79
|
space? >>
|
80
|
-
expr.as(:condition) >>
|
80
|
+
(expr.as(:condition) | syntax_error("condition not found", [:expr])) >>
|
81
81
|
line_end
|
82
82
|
}
|
83
83
|
|
@@ -64,7 +64,9 @@ module Pione
|
|
64
64
|
input_line |
|
65
65
|
output_line |
|
66
66
|
param_line |
|
67
|
-
feature_line
|
67
|
+
feature_line |
|
68
|
+
constraint_line |
|
69
|
+
annotation_line
|
68
70
|
}
|
69
71
|
|
70
72
|
#
|
@@ -130,6 +132,26 @@ module Pione
|
|
130
132
|
line_end
|
131
133
|
).as(:feature_line)
|
132
134
|
}
|
135
|
+
|
136
|
+
rule(:constraint_line) {
|
137
|
+
( space? >>
|
138
|
+
keyword_constraint >>
|
139
|
+
space? >>
|
140
|
+
( expr.as(:expr) |
|
141
|
+
syntax_error("it should be expr", :expr)
|
142
|
+
) >>
|
143
|
+
line_end
|
144
|
+
).as(:constraint_line)
|
145
|
+
}
|
146
|
+
|
147
|
+
rule(:annotation_line) {
|
148
|
+
( space? >>
|
149
|
+
atmark >>
|
150
|
+
space? >>
|
151
|
+
( expr.as(:expr) | syntax_error("it should be expr", :expr)) >>
|
152
|
+
line_end
|
153
|
+
).as(:annotation_line)
|
154
|
+
}
|
133
155
|
end
|
134
156
|
end
|
135
157
|
end
|
@@ -235,11 +235,7 @@ module Rinda
|
|
235
235
|
# @return [void]
|
236
236
|
def add(tuple)
|
237
237
|
prepare_table(domain(tuple))
|
238
|
-
|
239
|
-
@bin[domain(tuple)][name(tuple)] = tuple
|
240
|
-
else
|
241
|
-
raise RedundantTupleError.new(tuple.value)
|
242
|
-
end
|
238
|
+
@bin[domain(tuple)][name(tuple)] = tuple
|
243
239
|
end
|
244
240
|
|
245
241
|
def delete(tuple)
|
@@ -60,8 +60,8 @@ module Pione
|
|
60
60
|
def make_working_directory
|
61
61
|
# build directory path
|
62
62
|
dirname = ID.domain_id(
|
63
|
-
@rule.
|
64
|
-
@rule.
|
63
|
+
@rule.rule_expr.package.name,
|
64
|
+
@rule.rule_expr.name,
|
65
65
|
@inputs,
|
66
66
|
@original_params
|
67
67
|
)
|
@@ -137,13 +137,13 @@ module Pione
|
|
137
137
|
list = Dir.entries(@working_directory)
|
138
138
|
@rule.outputs.each_with_index do |output, i|
|
139
139
|
output = output.eval(@variable_table)
|
140
|
-
case output.
|
140
|
+
case output.distribution
|
141
141
|
when :all
|
142
|
-
@outputs[i] = list.select{|name| output.match(name)}.map do |name|
|
142
|
+
@outputs[i] = list.select{|name| output.first.match(name)}.map do |name|
|
143
143
|
make_output_tuple_with_time(name)
|
144
144
|
end
|
145
145
|
when :each
|
146
|
-
if name = list.find {|name| output.match(name)}
|
146
|
+
if name = list.find {|name| output.first.match(name)}
|
147
147
|
@outputs[i] = make_output_tuple_with_time(name)
|
148
148
|
end
|
149
149
|
end
|
@@ -76,7 +76,7 @@ module Pione
|
|
76
76
|
|
77
77
|
# build rule process record
|
78
78
|
@rule_process_record = Log::RuleProcessRecord.new.tap do |record|
|
79
|
-
record.name = "&%s:%s" % [@rule.
|
79
|
+
record.name = "&%s:%s" % [@rule.rule_expr.package.name, @rule.rule_expr.name]
|
80
80
|
record.rule_type = @rule.rule_type
|
81
81
|
record.caller = caller.split("_").first.tap do |dname|
|
82
82
|
if dname.include?("-")
|
@@ -91,7 +91,7 @@ module Pione
|
|
91
91
|
# build task process record
|
92
92
|
@task_process_record = Log::TaskProcessRecord.new.tap do |record|
|
93
93
|
record.name = handler_digest
|
94
|
-
record.rule_name = "&%s:%s" % [@rule.
|
94
|
+
record.rule_name = "&%s:%s" % [@rule.rule_expr.package.name, @rule.rule_expr.name]
|
95
95
|
record.rule_type = @rule.rule_type
|
96
96
|
record.inputs = @inputs.flatten.map{|input| input.name}.join(",")
|
97
97
|
record.parameters = @params.textize
|
@@ -107,7 +107,7 @@ module Pione
|
|
107
107
|
# @return [void]
|
108
108
|
def setenv(env)
|
109
109
|
env.each do |key, value|
|
110
|
-
@variable_table.set(Variable.new("ENV_" + key), PioneString.new(value))
|
110
|
+
# @variable_table.set(Variable.new("ENV_" + key), PioneString.new(value))
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
@@ -205,8 +205,8 @@ module Pione
|
|
205
205
|
# Return the domain.
|
206
206
|
def get_handling_domain(opts)
|
207
207
|
opts[:domain] || ID.domain_id(
|
208
|
-
@rule.
|
209
|
-
@rule.
|
208
|
+
@rule.rule_expr.package.name,
|
209
|
+
@rule.rule_expr.name,
|
210
210
|
@inputs,
|
211
211
|
@original_params
|
212
212
|
)
|
@@ -251,7 +251,8 @@ module Pione
|
|
251
251
|
# data name
|
252
252
|
# @return [Tuple::DataTuple]
|
253
253
|
# data tuple
|
254
|
-
def make_output_tuple(
|
254
|
+
def make_output_tuple(expr)
|
255
|
+
name = expr.first.name
|
255
256
|
location = make_output_location(name)
|
256
257
|
Tuple[:data].new(name: name, domain: @domain, location: location, time: nil)
|
257
258
|
end
|
@@ -263,7 +264,7 @@ module Pione
|
|
263
264
|
def setup_variable_table
|
264
265
|
@variable_table.make_input_auto_variables(@rule.inputs, @inputs)
|
265
266
|
outputs = @rule.outputs.map {|expr| expr.eval(@variable_table) }
|
266
|
-
output_tuples = outputs.map {|expr| make_output_tuple(expr
|
267
|
+
output_tuples = outputs.map {|expr| make_output_tuple(expr) }
|
267
268
|
@variable_table.make_output_auto_variables(outputs, output_tuples)
|
268
269
|
end
|
269
270
|
|
@@ -285,6 +286,28 @@ module Pione
|
|
285
286
|
]
|
286
287
|
end
|
287
288
|
|
289
|
+
# Find outputs from the domain.
|
290
|
+
#
|
291
|
+
# @return [void]
|
292
|
+
def find_outputs
|
293
|
+
tuples = read_all(Tuple[:data].new(domain: @domain))
|
294
|
+
@rule.outputs.each_with_index do |output, i|
|
295
|
+
output = output.eval(@variable_table)
|
296
|
+
case output.distribution
|
297
|
+
when :all
|
298
|
+
@outputs[i] = tuples.find_all {|data| output.match(data.name)}
|
299
|
+
when :each
|
300
|
+
# FIXME
|
301
|
+
@outputs[i] = tuples.find {|data| output.match(data.name)}
|
302
|
+
end
|
303
|
+
# touch operation
|
304
|
+
if output.touch? and @outputs[i].nil?
|
305
|
+
location = @domain_location + output.name
|
306
|
+
location.create("") unless location.exist?
|
307
|
+
@outputs[i] = Tuple[:data].new(name: output.name, domain: @domain, location: location)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
288
311
|
end
|
289
312
|
end
|
290
313
|
end
|