expressir 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +1 -7
- data/expressir.gemspec +2 -2
- data/lib/expressir/express_exp/formatter.rb +2 -6
- data/lib/expressir/express_exp/parser.rb +14 -1
- data/lib/expressir/express_exp/visitor.rb +79 -43
- data/lib/expressir/model.rb +1 -0
- data/lib/expressir/model/entity.rb +3 -0
- data/lib/expressir/model/informal_proposition.rb +11 -0
- data/lib/expressir/model/rule.rb +3 -0
- data/lib/expressir/model/schema.rb +2 -0
- data/lib/expressir/model/scope.rb +43 -9
- data/lib/expressir/model/type.rb +8 -0
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/remark.exp +63 -20
- data/original/examples/syntax/remark_formatted.exp +62 -19
- data/original/examples/syntax/source.exp +16 -0
- data/original/examples/syntax/syntax.exp +4 -1
- data/original/examples/syntax/syntax_formatted.exp +9 -0
- data/spec/expressir/express_exp/head_source_spec.rb +41 -0
- data/spec/expressir/express_exp/parse_multiple_spec.rb +32 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +115 -50
- data/spec/expressir/express_exp/parse_syntax_spec.rb +40 -0
- data/spec/expressir/express_exp/source_spec.rb +1 -1
- data/spec/expressir/model/find_spec.rb +19 -6
- metadata +10 -7
- data/spec/expressir/express_exp/find_spec.rb +0 -28
@@ -18,7 +18,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
18
18
|
expect(x.remarks[3]).to eq("universal scope - schema before")
|
19
19
|
expect(x.remarks[4]).to eq("universal scope - schema")
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
schema.constants.first.tap do |x|
|
23
23
|
expect(x).to be_instance_of(Expressir::Model::Constant)
|
24
24
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -26,7 +26,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
26
26
|
expect(x.remarks[0]).to eq("schema scope - constant")
|
27
27
|
expect(x.remarks[1]).to eq("universal scope - constant")
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
schema.types.first.tap do |x|
|
31
31
|
expect(x).to be_instance_of(Expressir::Model::Type)
|
32
32
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -38,12 +38,38 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
38
38
|
x.type.items.first.tap do |x|
|
39
39
|
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
40
40
|
expect(x.remarks).to be_instance_of(Array)
|
41
|
-
expect(x.remarks.count).to eq(
|
41
|
+
expect(x.remarks.count).to eq(4)
|
42
42
|
expect(x.remarks[0]).to eq("schema scope - enumeration item")
|
43
|
-
expect(x.remarks[1]).to eq("
|
43
|
+
expect(x.remarks[1]).to eq("schema scope - enumeration item, on the same level as the type")
|
44
|
+
expect(x.remarks[2]).to eq("universal scope - enumeration item")
|
45
|
+
expect(x.remarks[3]).to eq("universal scope - enumeration item, on the same level as the type")
|
44
46
|
end
|
45
47
|
end
|
46
|
-
|
48
|
+
|
49
|
+
schema.types.first.where.first.tap do |x|
|
50
|
+
expect(x).to be_instance_of(Expressir::Model::Where)
|
51
|
+
expect(x.remarks).to be_instance_of(Array)
|
52
|
+
expect(x.remarks.count).to eq(6)
|
53
|
+
expect(x.remarks[0]).to eq("type scope - type where")
|
54
|
+
expect(x.remarks[1]).to eq("type scope - type where, with prefix")
|
55
|
+
expect(x.remarks[2]).to eq("schema scope - type where")
|
56
|
+
expect(x.remarks[3]).to eq("schema scope - type where, with prefix")
|
57
|
+
expect(x.remarks[4]).to eq("universal scope - type where")
|
58
|
+
expect(x.remarks[5]).to eq("universal scope - type where, with prefix")
|
59
|
+
end
|
60
|
+
|
61
|
+
schema.types.first.informal_propositions.first.tap do |x|
|
62
|
+
expect(x).to be_instance_of(Expressir::Model::InformalProposition)
|
63
|
+
expect(x.remarks).to be_instance_of(Array)
|
64
|
+
expect(x.remarks.count).to eq(6)
|
65
|
+
expect(x.remarks[0]).to eq("type scope - type informal proposition")
|
66
|
+
expect(x.remarks[1]).to eq("type scope - type informal proposition, with prefix")
|
67
|
+
expect(x.remarks[2]).to eq("schema scope - type informal proposition")
|
68
|
+
expect(x.remarks[3]).to eq("schema scope - type informal proposition, with prefix")
|
69
|
+
expect(x.remarks[4]).to eq("universal scope - type informal proposition")
|
70
|
+
expect(x.remarks[5]).to eq("universal scope - type informal proposition, with prefix")
|
71
|
+
end
|
72
|
+
|
47
73
|
schema.entities.first.tap do |x|
|
48
74
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
49
75
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -51,7 +77,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
51
77
|
expect(x.remarks[0]).to eq("schema scope - entity")
|
52
78
|
expect(x.remarks[1]).to eq("universal scope - entity")
|
53
79
|
end
|
54
|
-
|
80
|
+
|
55
81
|
schema.entities.first.explicit_attributes.first.tap do |x|
|
56
82
|
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
57
83
|
expect(x.kind).to eq(Expressir::Model::Attribute::EXPLICIT)
|
@@ -61,7 +87,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
61
87
|
expect(x.remarks[1]).to eq("schema scope - entity attribute")
|
62
88
|
expect(x.remarks[2]).to eq("universal scope - entity attribute")
|
63
89
|
end
|
64
|
-
|
90
|
+
|
65
91
|
schema.entities.first.derived_attributes.first.tap do |x|
|
66
92
|
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
67
93
|
expect(x.kind).to eq(Expressir::Model::Attribute::DERIVED)
|
@@ -71,7 +97,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
71
97
|
expect(x.remarks[1]).to eq("schema scope - entity derived attribute")
|
72
98
|
expect(x.remarks[2]).to eq("universal scope - entity derived attribute")
|
73
99
|
end
|
74
|
-
|
100
|
+
|
75
101
|
schema.entities.first.inverse_attributes.first.tap do |x|
|
76
102
|
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
77
103
|
expect(x.kind).to eq(Expressir::Model::Attribute::INVERSE)
|
@@ -81,7 +107,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
81
107
|
expect(x.remarks[1]).to eq("schema scope - entity inverse attribute")
|
82
108
|
expect(x.remarks[2]).to eq("universal scope - entity inverse attribute")
|
83
109
|
end
|
84
|
-
|
110
|
+
|
85
111
|
schema.entities.first.unique.first.tap do |x|
|
86
112
|
expect(x).to be_instance_of(Expressir::Model::Unique)
|
87
113
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -90,16 +116,31 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
90
116
|
expect(x.remarks[1]).to eq("schema scope - entity unique")
|
91
117
|
expect(x.remarks[2]).to eq("universal scope - entity unique")
|
92
118
|
end
|
93
|
-
|
119
|
+
|
94
120
|
schema.entities.first.where.first.tap do |x|
|
95
121
|
expect(x).to be_instance_of(Expressir::Model::Where)
|
96
122
|
expect(x.remarks).to be_instance_of(Array)
|
97
|
-
expect(x.remarks.count).to eq(
|
123
|
+
expect(x.remarks.count).to eq(6)
|
98
124
|
expect(x.remarks[0]).to eq("entity scope - entity where")
|
99
|
-
expect(x.remarks[1]).to eq("
|
100
|
-
expect(x.remarks[2]).to eq("
|
125
|
+
expect(x.remarks[1]).to eq("entity scope - entity where, with prefix")
|
126
|
+
expect(x.remarks[2]).to eq("schema scope - entity where")
|
127
|
+
expect(x.remarks[3]).to eq("schema scope - entity where, with prefix")
|
128
|
+
expect(x.remarks[4]).to eq("universal scope - entity where")
|
129
|
+
expect(x.remarks[5]).to eq("universal scope - entity where, with prefix")
|
130
|
+
end
|
131
|
+
|
132
|
+
schema.entities.first.informal_propositions.first.tap do |x|
|
133
|
+
expect(x).to be_instance_of(Expressir::Model::InformalProposition)
|
134
|
+
expect(x.remarks).to be_instance_of(Array)
|
135
|
+
expect(x.remarks.count).to eq(6)
|
136
|
+
expect(x.remarks[0]).to eq("entity scope - entity informal proposition")
|
137
|
+
expect(x.remarks[1]).to eq("entity scope - entity informal proposition, with prefix")
|
138
|
+
expect(x.remarks[2]).to eq("schema scope - entity informal proposition")
|
139
|
+
expect(x.remarks[3]).to eq("schema scope - entity informal proposition, with prefix")
|
140
|
+
expect(x.remarks[4]).to eq("universal scope - entity informal proposition")
|
141
|
+
expect(x.remarks[5]).to eq("universal scope - entity informal proposition, with prefix")
|
101
142
|
end
|
102
|
-
|
143
|
+
|
103
144
|
schema.subtype_constraints.first.tap do |x|
|
104
145
|
expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
|
105
146
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -107,7 +148,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
107
148
|
expect(x.remarks[0]).to eq("schema scope - subtype constraint")
|
108
149
|
expect(x.remarks[1]).to eq("universal scope - subtype constraint")
|
109
150
|
end
|
110
|
-
|
151
|
+
|
111
152
|
schema.functions.first.tap do |x|
|
112
153
|
expect(x).to be_instance_of(Expressir::Model::Function)
|
113
154
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -115,7 +156,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
115
156
|
expect(x.remarks[0]).to eq("schema scope - function")
|
116
157
|
expect(x.remarks[1]).to eq("universal scope - function")
|
117
158
|
end
|
118
|
-
|
159
|
+
|
119
160
|
schema.functions.first.parameters.first.tap do |x|
|
120
161
|
expect(x).to be_instance_of(Expressir::Model::Parameter)
|
121
162
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -124,7 +165,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
124
165
|
expect(x.remarks[1]).to eq("schema scope - function parameter")
|
125
166
|
expect(x.remarks[2]).to eq("universal scope - function parameter")
|
126
167
|
end
|
127
|
-
|
168
|
+
|
128
169
|
schema.functions.first.types.first.tap do |x|
|
129
170
|
expect(x).to be_instance_of(Expressir::Model::Type)
|
130
171
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -137,13 +178,16 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
137
178
|
x.type.items.first.tap do |x|
|
138
179
|
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
139
180
|
expect(x.remarks).to be_instance_of(Array)
|
140
|
-
expect(x.remarks.count).to eq(
|
181
|
+
expect(x.remarks.count).to eq(6)
|
141
182
|
expect(x.remarks[0]).to eq("function scope - function enumeration item")
|
142
|
-
expect(x.remarks[1]).to eq("
|
143
|
-
expect(x.remarks[2]).to eq("
|
183
|
+
expect(x.remarks[1]).to eq("function scope - function enumeration item, on the same level as the type")
|
184
|
+
expect(x.remarks[2]).to eq("schema scope - function enumeration item")
|
185
|
+
expect(x.remarks[3]).to eq("schema scope - function enumeration item, on the same level as the type")
|
186
|
+
expect(x.remarks[4]).to eq("universal scope - function enumeration item")
|
187
|
+
expect(x.remarks[5]).to eq("universal scope - function enumeration item, on the same level as the type")
|
144
188
|
end
|
145
189
|
end
|
146
|
-
|
190
|
+
|
147
191
|
schema.functions.first.constants.first.tap do |x|
|
148
192
|
expect(x).to be_instance_of(Expressir::Model::Constant)
|
149
193
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -152,7 +196,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
152
196
|
expect(x.remarks[1]).to eq("schema scope - function constant")
|
153
197
|
expect(x.remarks[2]).to eq("universal scope - function constant")
|
154
198
|
end
|
155
|
-
|
199
|
+
|
156
200
|
schema.functions.first.variables.first.tap do |x|
|
157
201
|
expect(x).to be_instance_of(Expressir::Model::Variable)
|
158
202
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -161,21 +205,21 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
161
205
|
expect(x.remarks[1]).to eq("schema scope - function variable")
|
162
206
|
expect(x.remarks[2]).to eq("universal scope - function variable")
|
163
207
|
end
|
164
|
-
|
208
|
+
|
165
209
|
schema.functions.first.statements[0].tap do |x|
|
166
210
|
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
167
211
|
expect(x.remarks).to be_instance_of(Array)
|
168
212
|
expect(x.remarks.count).to eq(1)
|
169
213
|
expect(x.remarks[0]).to eq("function alias scope - function alias")
|
170
214
|
end
|
171
|
-
|
215
|
+
|
172
216
|
schema.functions.first.statements[1].tap do |x|
|
173
217
|
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
174
218
|
expect(x.remarks).to be_instance_of(Array)
|
175
219
|
expect(x.remarks.count).to eq(1)
|
176
220
|
expect(x.remarks[0]).to eq("function repeat scope - function repeat")
|
177
221
|
end
|
178
|
-
|
222
|
+
|
179
223
|
schema.functions.first.statements[2].tap do |x|
|
180
224
|
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
181
225
|
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
@@ -183,7 +227,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
183
227
|
expect(x.expression.remarks.count).to eq(1)
|
184
228
|
expect(x.expression.remarks[0]).to eq("function query scope - function query")
|
185
229
|
end
|
186
|
-
|
230
|
+
|
187
231
|
schema.procedures.first.tap do |x|
|
188
232
|
expect(x).to be_instance_of(Expressir::Model::Procedure)
|
189
233
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -191,7 +235,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
191
235
|
expect(x.remarks[0]).to eq("schema scope - procedure")
|
192
236
|
expect(x.remarks[1]).to eq("universal scope - procedure")
|
193
237
|
end
|
194
|
-
|
238
|
+
|
195
239
|
schema.procedures.first.parameters.first.tap do |x|
|
196
240
|
expect(x).to be_instance_of(Expressir::Model::Parameter)
|
197
241
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -200,7 +244,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
200
244
|
expect(x.remarks[1]).to eq("schema scope - procedure parameter")
|
201
245
|
expect(x.remarks[2]).to eq("universal scope - procedure parameter")
|
202
246
|
end
|
203
|
-
|
247
|
+
|
204
248
|
schema.procedures.first.types.first.tap do |x|
|
205
249
|
expect(x).to be_instance_of(Expressir::Model::Type)
|
206
250
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -213,13 +257,16 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
213
257
|
x.type.items.first.tap do |x|
|
214
258
|
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
215
259
|
expect(x.remarks).to be_instance_of(Array)
|
216
|
-
expect(x.remarks.count).to eq(
|
260
|
+
expect(x.remarks.count).to eq(6)
|
217
261
|
expect(x.remarks[0]).to eq("procedure scope - procedure enumeration item")
|
218
|
-
expect(x.remarks[1]).to eq("
|
219
|
-
expect(x.remarks[2]).to eq("
|
262
|
+
expect(x.remarks[1]).to eq("procedure scope - procedure enumeration item, on the same level as the type")
|
263
|
+
expect(x.remarks[2]).to eq("schema scope - procedure enumeration item")
|
264
|
+
expect(x.remarks[3]).to eq("schema scope - procedure enumeration item, on the same level as the type")
|
265
|
+
expect(x.remarks[4]).to eq("universal scope - procedure enumeration item")
|
266
|
+
expect(x.remarks[5]).to eq("universal scope - procedure enumeration item, on the same level as the type")
|
220
267
|
end
|
221
268
|
end
|
222
|
-
|
269
|
+
|
223
270
|
schema.procedures.first.constants.first.tap do |x|
|
224
271
|
expect(x).to be_instance_of(Expressir::Model::Constant)
|
225
272
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -228,7 +275,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
228
275
|
expect(x.remarks[1]).to eq("schema scope - procedure constant")
|
229
276
|
expect(x.remarks[2]).to eq("universal scope - procedure constant")
|
230
277
|
end
|
231
|
-
|
278
|
+
|
232
279
|
schema.procedures.first.variables.first.tap do |x|
|
233
280
|
expect(x).to be_instance_of(Expressir::Model::Variable)
|
234
281
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -237,21 +284,21 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
237
284
|
expect(x.remarks[1]).to eq("schema scope - procedure variable")
|
238
285
|
expect(x.remarks[2]).to eq("universal scope - procedure variable")
|
239
286
|
end
|
240
|
-
|
287
|
+
|
241
288
|
schema.procedures.first.statements[0].tap do |x|
|
242
289
|
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
243
290
|
expect(x.remarks).to be_instance_of(Array)
|
244
291
|
expect(x.remarks.count).to eq(1)
|
245
292
|
expect(x.remarks[0]).to eq("procedure alias scope - procedure alias")
|
246
293
|
end
|
247
|
-
|
294
|
+
|
248
295
|
schema.procedures.first.statements[1].tap do |x|
|
249
296
|
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
250
297
|
expect(x.remarks).to be_instance_of(Array)
|
251
298
|
expect(x.remarks.count).to eq(1)
|
252
299
|
expect(x.remarks[0]).to eq("procedure repeat scope - procedure repeat")
|
253
300
|
end
|
254
|
-
|
301
|
+
|
255
302
|
schema.procedures.first.statements[2].tap do |x|
|
256
303
|
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
257
304
|
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
@@ -259,7 +306,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
259
306
|
expect(x.expression.remarks.count).to eq(1)
|
260
307
|
expect(x.expression.remarks[0]).to eq("procedure query scope - procedure query")
|
261
308
|
end
|
262
|
-
|
309
|
+
|
263
310
|
schema.rules.first.tap do |x|
|
264
311
|
expect(x).to be_instance_of(Expressir::Model::Rule)
|
265
312
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -267,7 +314,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
267
314
|
expect(x.remarks[0]).to eq("schema scope - rule")
|
268
315
|
expect(x.remarks[1]).to eq("universal scope - rule")
|
269
316
|
end
|
270
|
-
|
317
|
+
|
271
318
|
schema.rules.first.types.first.tap do |x|
|
272
319
|
expect(x).to be_instance_of(Expressir::Model::Type)
|
273
320
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -280,13 +327,16 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
280
327
|
x.type.items.first.tap do |x|
|
281
328
|
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
282
329
|
expect(x.remarks).to be_instance_of(Array)
|
283
|
-
expect(x.remarks.count).to eq(
|
330
|
+
expect(x.remarks.count).to eq(6)
|
284
331
|
expect(x.remarks[0]).to eq("rule scope - rule enumeration item")
|
285
|
-
expect(x.remarks[1]).to eq("
|
286
|
-
expect(x.remarks[2]).to eq("
|
332
|
+
expect(x.remarks[1]).to eq("rule scope - rule enumeration item, on the same level as the type")
|
333
|
+
expect(x.remarks[2]).to eq("schema scope - rule enumeration item")
|
334
|
+
expect(x.remarks[3]).to eq("schema scope - rule enumeration item, on the same level as the type")
|
335
|
+
expect(x.remarks[4]).to eq("universal scope - rule enumeration item")
|
336
|
+
expect(x.remarks[5]).to eq("universal scope - rule enumeration item, on the same level as the type")
|
287
337
|
end
|
288
338
|
end
|
289
|
-
|
339
|
+
|
290
340
|
schema.rules.first.constants.first.tap do |x|
|
291
341
|
expect(x).to be_instance_of(Expressir::Model::Constant)
|
292
342
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -295,7 +345,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
295
345
|
expect(x.remarks[1]).to eq("schema scope - rule constant")
|
296
346
|
expect(x.remarks[2]).to eq("universal scope - rule constant")
|
297
347
|
end
|
298
|
-
|
348
|
+
|
299
349
|
schema.rules.first.variables.first.tap do |x|
|
300
350
|
expect(x).to be_instance_of(Expressir::Model::Variable)
|
301
351
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -304,21 +354,21 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
304
354
|
expect(x.remarks[1]).to eq("schema scope - rule variable")
|
305
355
|
expect(x.remarks[2]).to eq("universal scope - rule variable")
|
306
356
|
end
|
307
|
-
|
357
|
+
|
308
358
|
schema.rules.first.statements[0].tap do |x|
|
309
359
|
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
310
360
|
expect(x.remarks).to be_instance_of(Array)
|
311
361
|
expect(x.remarks.count).to eq(1)
|
312
362
|
expect(x.remarks[0]).to eq("rule alias scope - rule alias")
|
313
363
|
end
|
314
|
-
|
364
|
+
|
315
365
|
schema.rules.first.statements[1].tap do |x|
|
316
366
|
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
317
367
|
expect(x.remarks).to be_instance_of(Array)
|
318
368
|
expect(x.remarks.count).to eq(1)
|
319
369
|
expect(x.remarks[0]).to eq("rule repeat scope - rule repeat")
|
320
370
|
end
|
321
|
-
|
371
|
+
|
322
372
|
schema.rules.first.statements[2].tap do |x|
|
323
373
|
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
324
374
|
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
@@ -326,14 +376,29 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
326
376
|
expect(x.expression.remarks.count).to eq(1)
|
327
377
|
expect(x.expression.remarks[0]).to eq("rule query scope - rule query")
|
328
378
|
end
|
329
|
-
|
379
|
+
|
330
380
|
schema.rules.first.where.first.tap do |x|
|
331
381
|
expect(x).to be_instance_of(Expressir::Model::Where)
|
332
382
|
expect(x.remarks).to be_instance_of(Array)
|
333
|
-
expect(x.remarks.count).to eq(
|
383
|
+
expect(x.remarks.count).to eq(6)
|
334
384
|
expect(x.remarks[0]).to eq("rule scope - rule where")
|
335
|
-
expect(x.remarks[1]).to eq("
|
336
|
-
expect(x.remarks[2]).to eq("
|
385
|
+
expect(x.remarks[1]).to eq("rule scope - rule where, with prefix")
|
386
|
+
expect(x.remarks[2]).to eq("schema scope - rule where")
|
387
|
+
expect(x.remarks[3]).to eq("schema scope - rule where, with prefix")
|
388
|
+
expect(x.remarks[4]).to eq("universal scope - rule where")
|
389
|
+
expect(x.remarks[5]).to eq("universal scope - rule where, with prefix")
|
390
|
+
end
|
391
|
+
|
392
|
+
schema.rules.first.informal_propositions.first.tap do |x|
|
393
|
+
expect(x).to be_instance_of(Expressir::Model::InformalProposition)
|
394
|
+
expect(x.remarks).to be_instance_of(Array)
|
395
|
+
expect(x.remarks.count).to eq(6)
|
396
|
+
expect(x.remarks[0]).to eq("rule scope - rule informal proposition")
|
397
|
+
expect(x.remarks[1]).to eq("rule scope - rule informal proposition, with prefix")
|
398
|
+
expect(x.remarks[2]).to eq("schema scope - rule informal proposition")
|
399
|
+
expect(x.remarks[3]).to eq("schema scope - rule informal proposition, with prefix")
|
400
|
+
expect(x.remarks[4]).to eq("universal scope - rule informal proposition")
|
401
|
+
expect(x.remarks[5]).to eq("universal scope - rule informal proposition, with prefix")
|
337
402
|
end
|
338
403
|
end
|
339
404
|
end
|
@@ -42,6 +42,19 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
use_interfaces[2].tap do |x|
|
45
|
+
expect(x).to be_instance_of(Expressir::Model::Interface)
|
46
|
+
expect(x.kind).to eq(Expressir::Model::Interface::USE)
|
47
|
+
expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
48
|
+
expect(x.schema.id).to eq("contract_schema")
|
49
|
+
expect(x.items).to be_instance_of(Array)
|
50
|
+
expect(x.items.count).to eq(2)
|
51
|
+
expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
52
|
+
expect(x.items[0].id).to eq("contract")
|
53
|
+
expect(x.items[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
54
|
+
expect(x.items[1].id).to eq("contract2")
|
55
|
+
end
|
56
|
+
|
57
|
+
use_interfaces[3].tap do |x|
|
45
58
|
expect(x).to be_instance_of(Expressir::Model::Interface)
|
46
59
|
expect(x.kind).to eq(Expressir::Model::Interface::USE)
|
47
60
|
expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
@@ -73,6 +86,19 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
73
86
|
end
|
74
87
|
|
75
88
|
reference_interfaces[2].tap do |x|
|
89
|
+
expect(x).to be_instance_of(Expressir::Model::Interface)
|
90
|
+
expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
|
91
|
+
expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
92
|
+
expect(x.schema.id).to eq("contract_schema")
|
93
|
+
expect(x.items).to be_instance_of(Array)
|
94
|
+
expect(x.items.count).to eq(2)
|
95
|
+
expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
96
|
+
expect(x.items[0].id).to eq("contract")
|
97
|
+
expect(x.items[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
98
|
+
expect(x.items[1].id).to eq("contract2")
|
99
|
+
end
|
100
|
+
|
101
|
+
reference_interfaces[3].tap do |x|
|
76
102
|
expect(x).to be_instance_of(Expressir::Model::Interface)
|
77
103
|
expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
|
78
104
|
expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
@@ -1438,6 +1464,20 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
1438
1464
|
expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
|
1439
1465
|
end
|
1440
1466
|
|
1467
|
+
rules.find{|x| x.id == "where_label_rule"}.tap do |x|
|
1468
|
+
expect(x).to be_instance_of(Expressir::Model::Rule)
|
1469
|
+
expect(x.applies_to).to be_instance_of(Array)
|
1470
|
+
expect(x.applies_to.count).to eq(1)
|
1471
|
+
expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1472
|
+
expect(x.applies_to[0].id).to eq("empty_entity")
|
1473
|
+
expect(x.where).to be_instance_of(Array)
|
1474
|
+
expect(x.where.count).to eq(1)
|
1475
|
+
expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
|
1476
|
+
expect(x.where[0].id).to eq("WR1")
|
1477
|
+
expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
|
1478
|
+
expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
|
1479
|
+
end
|
1480
|
+
|
1441
1481
|
# simple types
|
1442
1482
|
types.find{|x| x.id == "binary_type"}.type.tap do |x|
|
1443
1483
|
expect(x).to be_instance_of(Expressir::Model::Types::Binary)
|