gisele 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +73 -44
- data/Gemfile.lock +1 -0
- data/examples/meeting-scheduler/MeetingScheduling.gis +23 -23
- data/examples/rectal-cancer-pathway/RectalCancerPathway.gis +64 -0
- data/gisele.noespec +1 -1
- data/lib/gisele/command.rb +6 -4
- data/lib/gisele/language/ast/case_st.rb +14 -0
- data/lib/gisele/language/ast/else_clause.rb +14 -0
- data/lib/gisele/language/ast/node.rb +3 -1
- data/lib/gisele/language/ast/{unit.rb → unit_def.rb} +2 -2
- data/lib/gisele/language/dot.yml +1 -1
- data/lib/gisele/language/elsif_flattener.rb +35 -0
- data/lib/gisele/language/if_to_case.rb +63 -0
- data/lib/gisele/language/rewriter/helper.rb +41 -0
- data/lib/gisele/language/rewriter/scoping.rb +34 -0
- data/lib/gisele/language/rewriter/work_on_nodes.rb +30 -0
- data/lib/gisele/language/rewriter.rb +60 -0
- data/lib/gisele/language/sugar_removal.rb +2 -64
- data/lib/gisele/language/syntax/case_st.rb +19 -0
- data/lib/gisele/language/syntax/grammar.citrus +61 -28
- data/lib/gisele/language/syntax/node.rb +3 -3
- data/lib/gisele/language/syntax/task_def.rb +5 -4
- data/lib/gisele/language/syntax/{unit.rb → unit_def.rb} +3 -3
- data/lib/gisele/language/syntax/when_clause.rb +16 -0
- data/lib/gisele/language/to_graph.rb +43 -16
- data/lib/gisele/language.rb +25 -1
- data/lib/gisele/version.rb +1 -1
- data/spec/command/main/gisele_ast_ruby.stdout +29 -35
- data/spec/command/main/gisele_graph.stdout +24 -14
- data/spec/command/main/gisele_help.stdout +1 -1
- data/spec/command/main/gisele_no_sugar.cmd +1 -1
- data/spec/command/main/gisele_no_sugar.stdout +119 -25
- data/spec/command/main/gisele_version.stdout +1 -1
- data/spec/fixtures/tasks/complete.gis +24 -2
- data/spec/fixtures/tasks/simple.ast +29 -35
- data/spec/fixtures/tasks/simple.gis +7 -2
- data/spec/spec_helper.rb +10 -0
- data/spec/unit/language/ast/test_node.rb +10 -11
- data/spec/unit/language/rewriter/test_helper.rb +87 -0
- data/spec/unit/language/rewriter/test_scoping.rb +46 -0
- data/spec/unit/language/rewriter/test_work_on_nodes.rb +45 -0
- data/spec/unit/language/syntax/grammar/test_bool_expr.rb +34 -0
- data/spec/unit/language/syntax/grammar/test_boolean_literal.rb +17 -0
- data/spec/unit/language/syntax/grammar/test_case_st.rb +60 -0
- data/spec/unit/language/syntax/grammar/test_event.rb +18 -0
- data/spec/unit/language/syntax/grammar/test_event_name.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_event_set.rb +27 -0
- data/spec/unit/language/syntax/grammar/test_fluent_def.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_if_st.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_par_st.rb +11 -0
- data/spec/unit/language/syntax/grammar/test_process_statement.rb +19 -0
- data/spec/unit/language/syntax/grammar/test_seq_st.rb +11 -0
- data/spec/unit/language/syntax/grammar/test_spaces.rb +19 -0
- data/spec/unit/language/syntax/grammar/test_spacing.rb +18 -0
- data/spec/unit/language/syntax/grammar/test_task_def.rb +35 -0
- data/spec/unit/language/syntax/grammar/test_task_name.rb +19 -0
- data/spec/unit/language/syntax/grammar/test_task_start_or_end.rb +17 -0
- data/spec/unit/language/syntax/grammar/test_trackvar_def.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_unit_def.rb +29 -0
- data/spec/unit/language/syntax/grammar/test_variable_name.rb +30 -0
- data/spec/unit/language/syntax/grammar/test_when_clause.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_while_st.rb +11 -0
- data/spec/unit/language/syntax/to_ast/test_bool_expr.rb +28 -0
- data/spec/unit/language/syntax/to_ast/test_case_st.rb +47 -0
- data/spec/unit/language/syntax/to_ast/test_else_clause.rb +13 -0
- data/spec/unit/language/syntax/to_ast/test_elsif_clause.rb +15 -0
- data/spec/unit/language/syntax/to_ast/test_event_set.rb +24 -0
- data/spec/unit/language/syntax/to_ast/test_fluent_def.rb +26 -0
- data/spec/unit/language/syntax/to_ast/test_if_st.rb +39 -0
- data/spec/unit/language/syntax/to_ast/test_par_st.rb +12 -0
- data/spec/unit/language/syntax/to_ast/test_seq_st.rb +12 -0
- data/spec/unit/language/syntax/to_ast/test_task_call_st.rb +10 -0
- data/spec/unit/language/syntax/to_ast/test_task_def.rb +44 -0
- data/spec/unit/language/syntax/to_ast/test_trackvar_def.rb +26 -0
- data/spec/unit/language/syntax/to_ast/test_unit_def.rb +28 -0
- data/spec/unit/language/syntax/to_ast/test_var_ref.rb +12 -0
- data/spec/unit/language/syntax/to_ast/test_when_clause.rb +15 -0
- data/spec/unit/language/syntax/to_ast/test_while_st.rb +24 -0
- data/spec/unit/language/test_ast.rb +4 -4
- data/spec/unit/language/test_elsif_flattener.rb +90 -0
- data/spec/unit/language/test_if_to_case.rb +107 -0
- data/spec/unit/language/{test_transformer.rb → test_rewriter.rb} +24 -11
- data/spec/unit/language/test_syntax.rb +1 -1
- data/spec/unit/language/test_to_graph.rb +9 -2
- metadata +120 -34
- data/lib/gisele/language/syntax/task_refinement.rb +0 -15
- data/lib/gisele/language/syntax/task_signature.rb +0 -15
- data/lib/gisele/language/transformer.rb +0 -38
- data/spec/unit/language/sugar_removal/test_if_to_guarded_commands.rb +0 -110
- data/spec/unit/language/syntax/test_grammar.rb +0 -317
- data/spec/unit/language/syntax/test_to_ast.rb +0 -257
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gisele
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70110318039380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70110318039380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &70110318038460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70110318038460
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70110318036100 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.8.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70110318036100
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: wlang
|
49
|
-
requirement: &
|
49
|
+
requirement: &70110318051380 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.10.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70110318051380
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: citrus
|
60
|
-
requirement: &
|
60
|
+
requirement: &70110318050820 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '2.4'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70110318050820
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: epath
|
71
|
-
requirement: &
|
71
|
+
requirement: &70110318050260 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.0.1
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70110318050260
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: quickl
|
82
|
-
requirement: &
|
82
|
+
requirement: &70110318049560 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.4.3
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70110318049560
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: awesome_print
|
93
|
-
requirement: &
|
93
|
+
requirement: &70110318048900 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '1.0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70110318048900
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: yargi
|
104
|
-
requirement: &
|
104
|
+
requirement: &70110318048220 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: 0.2.0
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70110318048220
|
113
113
|
description: ! 'This is a fresh-new implementation of the process analysis techniques
|
114
114
|
|
115
115
|
developed in the Gisele and PIPAS research projects at UCLouvain'
|
@@ -130,23 +130,32 @@ files:
|
|
130
130
|
- Gemfile.lock
|
131
131
|
- bin/gisele
|
132
132
|
- examples/meeting-scheduler/MeetingScheduling.gis
|
133
|
+
- examples/rectal-cancer-pathway/RectalCancerPathway.gis
|
133
134
|
- lib/gisele/command.rb
|
134
135
|
- lib/gisele/errors.rb
|
135
136
|
- lib/gisele/language/ast/bool_and.rb
|
136
137
|
- lib/gisele/language/ast/bool_expr.rb
|
137
138
|
- lib/gisele/language/ast/bool_not.rb
|
138
139
|
- lib/gisele/language/ast/bool_or.rb
|
140
|
+
- lib/gisele/language/ast/case_st.rb
|
141
|
+
- lib/gisele/language/ast/else_clause.rb
|
139
142
|
- lib/gisele/language/ast/elsif_clause.rb
|
140
143
|
- lib/gisele/language/ast/helpers.rb
|
141
144
|
- lib/gisele/language/ast/if_st.rb
|
142
145
|
- lib/gisele/language/ast/node.rb
|
143
146
|
- lib/gisele/language/ast/task_call_st.rb
|
144
|
-
- lib/gisele/language/ast/
|
147
|
+
- lib/gisele/language/ast/unit_def.rb
|
145
148
|
- lib/gisele/language/ast/var_ref.rb
|
146
149
|
- lib/gisele/language/ast/when_clause.rb
|
147
150
|
- lib/gisele/language/ast/while_st.rb
|
148
151
|
- lib/gisele/language/ast.rb
|
149
152
|
- lib/gisele/language/dot.yml
|
153
|
+
- lib/gisele/language/elsif_flattener.rb
|
154
|
+
- lib/gisele/language/if_to_case.rb
|
155
|
+
- lib/gisele/language/rewriter/helper.rb
|
156
|
+
- lib/gisele/language/rewriter/scoping.rb
|
157
|
+
- lib/gisele/language/rewriter/work_on_nodes.rb
|
158
|
+
- lib/gisele/language/rewriter.rb
|
150
159
|
- lib/gisele/language/sugar_removal.rb
|
151
160
|
- lib/gisele/language/syntax/bool_and.rb
|
152
161
|
- lib/gisele/language/syntax/bool_expr.rb
|
@@ -154,6 +163,7 @@ files:
|
|
154
163
|
- lib/gisele/language/syntax/bool_not.rb
|
155
164
|
- lib/gisele/language/syntax/bool_or.rb
|
156
165
|
- lib/gisele/language/syntax/bool_paren.rb
|
166
|
+
- lib/gisele/language/syntax/case_st.rb
|
157
167
|
- lib/gisele/language/syntax/else_clause.rb
|
158
168
|
- lib/gisele/language/syntax/elsif_clause.rb
|
159
169
|
- lib/gisele/language/syntax/event_set.rb
|
@@ -167,15 +177,13 @@ files:
|
|
167
177
|
- lib/gisele/language/syntax/st_list.rb
|
168
178
|
- lib/gisele/language/syntax/task_call_st.rb
|
169
179
|
- lib/gisele/language/syntax/task_def.rb
|
170
|
-
- lib/gisele/language/syntax/task_refinement.rb
|
171
|
-
- lib/gisele/language/syntax/task_signature.rb
|
172
180
|
- lib/gisele/language/syntax/trackvar_def.rb
|
173
|
-
- lib/gisele/language/syntax/
|
181
|
+
- lib/gisele/language/syntax/unit_def.rb
|
174
182
|
- lib/gisele/language/syntax/var_ref.rb
|
183
|
+
- lib/gisele/language/syntax/when_clause.rb
|
175
184
|
- lib/gisele/language/syntax/while_st.rb
|
176
185
|
- lib/gisele/language/syntax.rb
|
177
186
|
- lib/gisele/language/to_graph.rb
|
178
|
-
- lib/gisele/language/transformer.rb
|
179
187
|
- lib/gisele/language.rb
|
180
188
|
- lib/gisele/loader.rb
|
181
189
|
- lib/gisele/version.rb
|
@@ -201,13 +209,52 @@ files:
|
|
201
209
|
- spec/spec_helper.rb
|
202
210
|
- spec/test_examples.rb
|
203
211
|
- spec/unit/language/ast/test_node.rb
|
204
|
-
- spec/unit/language/
|
205
|
-
- spec/unit/language/
|
206
|
-
- spec/unit/language/
|
212
|
+
- spec/unit/language/rewriter/test_helper.rb
|
213
|
+
- spec/unit/language/rewriter/test_scoping.rb
|
214
|
+
- spec/unit/language/rewriter/test_work_on_nodes.rb
|
215
|
+
- spec/unit/language/syntax/grammar/test_bool_expr.rb
|
216
|
+
- spec/unit/language/syntax/grammar/test_boolean_literal.rb
|
217
|
+
- spec/unit/language/syntax/grammar/test_case_st.rb
|
218
|
+
- spec/unit/language/syntax/grammar/test_event.rb
|
219
|
+
- spec/unit/language/syntax/grammar/test_event_name.rb
|
220
|
+
- spec/unit/language/syntax/grammar/test_event_set.rb
|
221
|
+
- spec/unit/language/syntax/grammar/test_fluent_def.rb
|
222
|
+
- spec/unit/language/syntax/grammar/test_if_st.rb
|
223
|
+
- spec/unit/language/syntax/grammar/test_par_st.rb
|
224
|
+
- spec/unit/language/syntax/grammar/test_process_statement.rb
|
225
|
+
- spec/unit/language/syntax/grammar/test_seq_st.rb
|
226
|
+
- spec/unit/language/syntax/grammar/test_spaces.rb
|
227
|
+
- spec/unit/language/syntax/grammar/test_spacing.rb
|
228
|
+
- spec/unit/language/syntax/grammar/test_task_def.rb
|
229
|
+
- spec/unit/language/syntax/grammar/test_task_name.rb
|
230
|
+
- spec/unit/language/syntax/grammar/test_task_start_or_end.rb
|
231
|
+
- spec/unit/language/syntax/grammar/test_trackvar_def.rb
|
232
|
+
- spec/unit/language/syntax/grammar/test_unit_def.rb
|
233
|
+
- spec/unit/language/syntax/grammar/test_variable_name.rb
|
234
|
+
- spec/unit/language/syntax/grammar/test_when_clause.rb
|
235
|
+
- spec/unit/language/syntax/grammar/test_while_st.rb
|
236
|
+
- spec/unit/language/syntax/to_ast/test_bool_expr.rb
|
237
|
+
- spec/unit/language/syntax/to_ast/test_case_st.rb
|
238
|
+
- spec/unit/language/syntax/to_ast/test_else_clause.rb
|
239
|
+
- spec/unit/language/syntax/to_ast/test_elsif_clause.rb
|
240
|
+
- spec/unit/language/syntax/to_ast/test_event_set.rb
|
241
|
+
- spec/unit/language/syntax/to_ast/test_fluent_def.rb
|
242
|
+
- spec/unit/language/syntax/to_ast/test_if_st.rb
|
243
|
+
- spec/unit/language/syntax/to_ast/test_par_st.rb
|
244
|
+
- spec/unit/language/syntax/to_ast/test_seq_st.rb
|
245
|
+
- spec/unit/language/syntax/to_ast/test_task_call_st.rb
|
246
|
+
- spec/unit/language/syntax/to_ast/test_task_def.rb
|
247
|
+
- spec/unit/language/syntax/to_ast/test_trackvar_def.rb
|
248
|
+
- spec/unit/language/syntax/to_ast/test_unit_def.rb
|
249
|
+
- spec/unit/language/syntax/to_ast/test_var_ref.rb
|
250
|
+
- spec/unit/language/syntax/to_ast/test_when_clause.rb
|
251
|
+
- spec/unit/language/syntax/to_ast/test_while_st.rb
|
207
252
|
- spec/unit/language/test_ast.rb
|
253
|
+
- spec/unit/language/test_elsif_flattener.rb
|
254
|
+
- spec/unit/language/test_if_to_case.rb
|
255
|
+
- spec/unit/language/test_rewriter.rb
|
208
256
|
- spec/unit/language/test_syntax.rb
|
209
257
|
- spec/unit/language/test_to_graph.rb
|
210
|
-
- spec/unit/language/test_transformer.rb
|
211
258
|
- spec/unit/test_gisele.rb
|
212
259
|
- spec/unit/test_language.rb
|
213
260
|
- tasks/debug_mail.rake
|
@@ -230,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
277
|
version: '0'
|
231
278
|
segments:
|
232
279
|
- 0
|
233
|
-
hash: -
|
280
|
+
hash: -1270039991720770825
|
234
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
282
|
none: false
|
236
283
|
requirements:
|
@@ -261,12 +308,51 @@ test_files:
|
|
261
308
|
- spec/spec_helper.rb
|
262
309
|
- spec/test_examples.rb
|
263
310
|
- spec/unit/language/ast/test_node.rb
|
264
|
-
- spec/unit/language/
|
265
|
-
- spec/unit/language/
|
266
|
-
- spec/unit/language/
|
311
|
+
- spec/unit/language/rewriter/test_helper.rb
|
312
|
+
- spec/unit/language/rewriter/test_scoping.rb
|
313
|
+
- spec/unit/language/rewriter/test_work_on_nodes.rb
|
314
|
+
- spec/unit/language/syntax/grammar/test_bool_expr.rb
|
315
|
+
- spec/unit/language/syntax/grammar/test_boolean_literal.rb
|
316
|
+
- spec/unit/language/syntax/grammar/test_case_st.rb
|
317
|
+
- spec/unit/language/syntax/grammar/test_event.rb
|
318
|
+
- spec/unit/language/syntax/grammar/test_event_name.rb
|
319
|
+
- spec/unit/language/syntax/grammar/test_event_set.rb
|
320
|
+
- spec/unit/language/syntax/grammar/test_fluent_def.rb
|
321
|
+
- spec/unit/language/syntax/grammar/test_if_st.rb
|
322
|
+
- spec/unit/language/syntax/grammar/test_par_st.rb
|
323
|
+
- spec/unit/language/syntax/grammar/test_process_statement.rb
|
324
|
+
- spec/unit/language/syntax/grammar/test_seq_st.rb
|
325
|
+
- spec/unit/language/syntax/grammar/test_spaces.rb
|
326
|
+
- spec/unit/language/syntax/grammar/test_spacing.rb
|
327
|
+
- spec/unit/language/syntax/grammar/test_task_def.rb
|
328
|
+
- spec/unit/language/syntax/grammar/test_task_name.rb
|
329
|
+
- spec/unit/language/syntax/grammar/test_task_start_or_end.rb
|
330
|
+
- spec/unit/language/syntax/grammar/test_trackvar_def.rb
|
331
|
+
- spec/unit/language/syntax/grammar/test_unit_def.rb
|
332
|
+
- spec/unit/language/syntax/grammar/test_variable_name.rb
|
333
|
+
- spec/unit/language/syntax/grammar/test_when_clause.rb
|
334
|
+
- spec/unit/language/syntax/grammar/test_while_st.rb
|
335
|
+
- spec/unit/language/syntax/to_ast/test_bool_expr.rb
|
336
|
+
- spec/unit/language/syntax/to_ast/test_case_st.rb
|
337
|
+
- spec/unit/language/syntax/to_ast/test_else_clause.rb
|
338
|
+
- spec/unit/language/syntax/to_ast/test_elsif_clause.rb
|
339
|
+
- spec/unit/language/syntax/to_ast/test_event_set.rb
|
340
|
+
- spec/unit/language/syntax/to_ast/test_fluent_def.rb
|
341
|
+
- spec/unit/language/syntax/to_ast/test_if_st.rb
|
342
|
+
- spec/unit/language/syntax/to_ast/test_par_st.rb
|
343
|
+
- spec/unit/language/syntax/to_ast/test_seq_st.rb
|
344
|
+
- spec/unit/language/syntax/to_ast/test_task_call_st.rb
|
345
|
+
- spec/unit/language/syntax/to_ast/test_task_def.rb
|
346
|
+
- spec/unit/language/syntax/to_ast/test_trackvar_def.rb
|
347
|
+
- spec/unit/language/syntax/to_ast/test_unit_def.rb
|
348
|
+
- spec/unit/language/syntax/to_ast/test_var_ref.rb
|
349
|
+
- spec/unit/language/syntax/to_ast/test_when_clause.rb
|
350
|
+
- spec/unit/language/syntax/to_ast/test_while_st.rb
|
267
351
|
- spec/unit/language/test_ast.rb
|
352
|
+
- spec/unit/language/test_elsif_flattener.rb
|
353
|
+
- spec/unit/language/test_if_to_case.rb
|
354
|
+
- spec/unit/language/test_rewriter.rb
|
268
355
|
- spec/unit/language/test_syntax.rb
|
269
356
|
- spec/unit/language/test_to_graph.rb
|
270
|
-
- spec/unit/language/test_transformer.rb
|
271
357
|
- spec/unit/test_gisele.rb
|
272
358
|
- spec/unit/test_language.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Gisele
|
2
|
-
module Language
|
3
|
-
module Syntax
|
4
|
-
module TaskRefinement
|
5
|
-
include Node
|
6
|
-
|
7
|
-
def _to_ast
|
8
|
-
main = captures[:process_statement].first.to_ast
|
9
|
-
[:task_refinement, main]
|
10
|
-
end
|
11
|
-
|
12
|
-
end # module TaskRefinement
|
13
|
-
end # module Syntax
|
14
|
-
end # module Language
|
15
|
-
end # module Gisele
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Gisele
|
2
|
-
module Language
|
3
|
-
module Syntax
|
4
|
-
module TaskSignature
|
5
|
-
include Node
|
6
|
-
|
7
|
-
def _to_ast
|
8
|
-
list = captures[:task_signature_element].map{|x| x.to_ast}
|
9
|
-
[:task_signature] + list
|
10
|
-
end
|
11
|
-
|
12
|
-
end # module TaskSignature
|
13
|
-
end # module Syntax
|
14
|
-
end # module Language
|
15
|
-
end # module Gisele
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Gisele
|
2
|
-
module Language
|
3
|
-
class Transformer
|
4
|
-
include AST::Helpers
|
5
|
-
|
6
|
-
def call(node)
|
7
|
-
node = pre_call(node)
|
8
|
-
meth = :"on_#{node.rule_name}"
|
9
|
-
meth = :"on_missing" unless respond_to?(meth)
|
10
|
-
post_call send(meth, node)
|
11
|
-
end
|
12
|
-
|
13
|
-
def on_missing(node)
|
14
|
-
raise UnexpectedNodeError, "Unexpected node: #{node.rule_name}"
|
15
|
-
end
|
16
|
-
|
17
|
-
protected
|
18
|
-
|
19
|
-
def pre_call(node)
|
20
|
-
unless looks_a_node?(node)
|
21
|
-
raise ArgumentError, "AST node expected, got #{node.inspect}", caller
|
22
|
-
end
|
23
|
-
node(node)
|
24
|
-
end
|
25
|
-
|
26
|
-
def post_call(transformed)
|
27
|
-
looks_a_node?(transformed) ? node(transformed) : transformed
|
28
|
-
end
|
29
|
-
|
30
|
-
def copy_and_applyall(node)
|
31
|
-
node.copy do |memo,child|
|
32
|
-
memo << (child.is_a?(AST::Node) ? call(child) : child)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end # class Transformer
|
37
|
-
end # module Language
|
38
|
-
end # module Gisele
|
@@ -1,110 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe SugarRemoval do
|
4
|
-
describe "if_st to case_st" do
|
5
|
-
include AST::Helpers
|
6
|
-
|
7
|
-
def ast(source)
|
8
|
-
Syntax.ast(source.strip, :root => :if_st)
|
9
|
-
end
|
10
|
-
|
11
|
-
def rewrite(ast)
|
12
|
-
SugarRemoval.new.call(ast)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'rewrites single if correctly' do
|
16
|
-
source = ast("if goodCond Task1 end")
|
17
|
-
expected = \
|
18
|
-
[:case_st,
|
19
|
-
[:when_clause,
|
20
|
-
[:bool_expr, [:var_ref, "goodCond"]],
|
21
|
-
[:task_call_st, "Task1"] ]]
|
22
|
-
rewrite(source).should eq(expected)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'negates the else clause' do
|
26
|
-
source = ast("if goodCond Task1 else Task2 end")
|
27
|
-
expected = \
|
28
|
-
[:case_st,
|
29
|
-
[:when_clause,
|
30
|
-
[:bool_expr, [:var_ref, "goodCond"]],
|
31
|
-
[:task_call_st, "Task1"] ],
|
32
|
-
[:when_clause,
|
33
|
-
[:bool_expr, [:bool_not, [:var_ref, "goodCond"]]],
|
34
|
-
[:task_call_st, "Task2"] ]
|
35
|
-
]
|
36
|
-
rewrite(source).should eq(expected)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'handles elsif clauses correctly' do
|
40
|
-
source = ast(<<-IF)
|
41
|
-
if c1 Task1
|
42
|
-
elsif c2 Task2
|
43
|
-
elsif c3 Task3
|
44
|
-
else Task4
|
45
|
-
end
|
46
|
-
IF
|
47
|
-
expected = \
|
48
|
-
[:case_st,
|
49
|
-
[:when_clause,
|
50
|
-
[:bool_expr, [:var_ref, "c1"]],
|
51
|
-
[:task_call_st, "Task1"] ],
|
52
|
-
[:when_clause,
|
53
|
-
[:bool_expr, [:bool_and,
|
54
|
-
[:var_ref, "c2"],
|
55
|
-
[:bool_not, [:var_ref, "c1"]] ]],
|
56
|
-
[:task_call_st, "Task2"] ],
|
57
|
-
[:when_clause,
|
58
|
-
[:bool_expr, [:bool_and,
|
59
|
-
[:var_ref, "c3"],
|
60
|
-
[:bool_and,
|
61
|
-
[:bool_not, [:var_ref, "c2"]],
|
62
|
-
[:bool_not, [:var_ref, "c1"]] ]]],
|
63
|
-
[:task_call_st, "Task3"] ],
|
64
|
-
[:when_clause,
|
65
|
-
[:bool_expr, [:bool_and,
|
66
|
-
[:bool_not, [:var_ref, "c3"]],
|
67
|
-
[:bool_and,
|
68
|
-
[:bool_not, [:var_ref, "c2"]],
|
69
|
-
[:bool_not, [:var_ref, "c1"]]]]],
|
70
|
-
[:task_call_st, "Task4"] ],
|
71
|
-
]
|
72
|
-
rewrite(source).should eq(expected)
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'avoids double negations' do
|
76
|
-
source = ast("if not(goodCond) Task1 else Task2 end")
|
77
|
-
expected = \
|
78
|
-
[:case_st,
|
79
|
-
[:when_clause,
|
80
|
-
[:bool_expr, [:bool_not, [:var_ref, "goodCond"]]],
|
81
|
-
[:task_call_st, "Task1"] ],
|
82
|
-
[:when_clause,
|
83
|
-
[:bool_expr, [:var_ref, "goodCond"]],
|
84
|
-
[:task_call_st, "Task2"] ] ]
|
85
|
-
rewrite(source).should eq(expected)
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'recurse on other nodes' do
|
89
|
-
if_st = ast("if goodCond Task1 end")
|
90
|
-
rw_st = rewrite(if_st)
|
91
|
-
rewrite([:unit, if_st]).should eq([:unit, rw_st])
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'keeps traceability markers on a single if' do
|
95
|
-
if_st = ast("if goodCond Task1 end")
|
96
|
-
rw_st = rewrite(if_st)
|
97
|
-
rw_st.markers.should eq(if_st.markers)
|
98
|
-
rw_st.last.markers.should eq(if_st.markers)
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'keeps traceability markers when a else if present' do
|
102
|
-
if_st = ast("if goodCond Task1 else Task2 end")
|
103
|
-
rw_st = rewrite(if_st)
|
104
|
-
rw_st.markers.should eq(if_st.markers)
|
105
|
-
rw_st.last.markers.should eq(if_st.last.markers)
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|