expressir 0.2.8-x86-linux → 0.2.9-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +1 -7
  3. data/expressir.gemspec +2 -2
  4. data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
  5. data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
  6. data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
  7. data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
  8. data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
  9. data/lib/expressir/express_exp/formatter.rb +2 -6
  10. data/lib/expressir/express_exp/parser.rb +14 -1
  11. data/lib/expressir/express_exp/visitor.rb +79 -43
  12. data/lib/expressir/model.rb +1 -0
  13. data/lib/expressir/model/entity.rb +3 -0
  14. data/lib/expressir/model/informal_proposition.rb +11 -0
  15. data/lib/expressir/model/rule.rb +3 -0
  16. data/lib/expressir/model/schema.rb +2 -0
  17. data/lib/expressir/model/scope.rb +43 -9
  18. data/lib/expressir/model/type.rb +8 -0
  19. data/lib/expressir/version.rb +1 -1
  20. data/original/examples/syntax/remark.exp +63 -20
  21. data/original/examples/syntax/remark_formatted.exp +62 -19
  22. data/original/examples/syntax/source.exp +16 -0
  23. data/original/examples/syntax/syntax.exp +4 -1
  24. data/original/examples/syntax/syntax_formatted.exp +9 -0
  25. data/spec/expressir/express_exp/head_source_spec.rb +41 -0
  26. data/spec/expressir/express_exp/parse_multiple_spec.rb +32 -0
  27. data/spec/expressir/express_exp/parse_remark_spec.rb +115 -50
  28. data/spec/expressir/express_exp/parse_syntax_spec.rb +40 -0
  29. data/spec/expressir/express_exp/source_spec.rb +1 -1
  30. data/spec/expressir/model/find_spec.rb +19 -6
  31. metadata +8 -5
  32. data/spec/expressir/express_exp/find_spec.rb +0 -28
@@ -1,3 +1,3 @@
1
1
  module Expressir
2
- VERSION = "0.2.8".freeze
2
+ VERSION = "0.2.9".freeze
3
3
  end
@@ -11,18 +11,27 @@ several physical lines.
11
11
  SCHEMA remark_schema;
12
12
 
13
13
  CONSTANT remark_constant : STRING := 'xxx'; END_CONSTANT;
14
- TYPE remark_type = ENUMERATION OF (remark_enumeration_item); END_TYPE;
14
+ TYPE remark_type = ENUMERATION OF (remark_enumeration_item);
15
+ WHERE WR1 : TRUE;
16
+ --"WR1" type scope - type where
17
+ --"IP1" type scope - type informal proposition
18
+ --"wr:WR1" type scope - type where, with prefix
19
+ --"ip:IP1" type scope - type informal proposition, with prefix
20
+ END_TYPE;
15
21
  ENTITY remark_entity;
16
22
  remark_attribute : STRING;
17
23
  DERIVE remark_derived_attribute : STRING := 'xxx';
18
24
  INVERSE remark_inverse_attribute : remark_entity FOR remark_attribute;
19
25
  UNIQUE remark_unique : remark_attribute;
20
- WHERE remark_where : TRUE;
26
+ WHERE WR1 : TRUE;
21
27
  --"remark_attribute" entity scope - entity attribute
22
28
  --"remark_derived_attribute" entity scope - entity derived attribute
23
29
  --"remark_inverse_attribute" entity scope - entity inverse attribute
24
30
  --"remark_unique" entity scope - entity unique
25
- --"remark_where" entity scope - entity where
31
+ --"WR1" entity scope - entity where
32
+ --"IP1" entity scope - entity informal proposition
33
+ --"wr:WR1" entity scope - entity where, with prefix
34
+ --"ip:IP1" entity scope - entity informal proposition, with prefix
26
35
  END_ENTITY;
27
36
  SUBTYPE_CONSTRAINT remark_subtype_constraint FOR remark_entity; END_SUBTYPE_CONSTRAINT;
28
37
  FUNCTION remark_function(remark_parameter : STRING) : BOOLEAN;
@@ -40,7 +49,8 @@ FUNCTION remark_function(remark_parameter : STRING) : BOOLEAN;
40
49
  );
41
50
  --"remark_parameter" function scope - function parameter
42
51
  --"remark_type" function scope - function type
43
- --"remark_enumeration_item" function scope - function enumeration item
52
+ --"remark_type.remark_enumeration_item" function scope - function enumeration item
53
+ --"remark_enumeration_item" function scope - function enumeration item, on the same level as the type
44
54
  --"remark_constant" function scope - function constant
45
55
  --"remark_variable" function scope - function variable
46
56
  END_FUNCTION;
@@ -59,7 +69,8 @@ PROCEDURE remark_procedure(remark_parameter : STRING);
59
69
  );
60
70
  --"remark_parameter" procedure scope - procedure parameter
61
71
  --"remark_type" procedure scope - procedure type
62
- --"remark_enumeration_item" procedure scope - procedure enumeration item
72
+ --"remark_type.remark_enumeration_item" procedure scope - procedure enumeration item
73
+ --"remark_enumeration_item" procedure scope - procedure enumeration item, on the same level as the type
63
74
  --"remark_constant" procedure scope - procedure constant
64
75
  --"remark_variable" procedure scope - procedure variable
65
76
  END_PROCEDURE;
@@ -76,71 +87,103 @@ RULE remark_rule FOR (remark_entity);
76
87
  remark_variable := QUERY(remark_query <* remark_variable | TRUE
77
88
  --"remark_query" rule query scope - rule query
78
89
  );
79
- WHERE remark_where : TRUE;
90
+ WHERE WR1 : TRUE;
80
91
  --"remark_type" rule scope - rule type
81
- --"remark_enumeration_item" rule scope - rule enumeration item
92
+ --"remark_type.remark_enumeration_item" rule scope - rule enumeration item
93
+ --"remark_enumeration_item" rule scope - rule enumeration item, on the same level as the type
82
94
  --"remark_constant" rule scope - rule constant
83
95
  --"remark_variable" rule scope - rule variable
84
- --"remark_where" rule scope - rule where
96
+ --"WR1" rule scope - rule where
97
+ --"IP1" rule scope - rule informal proposition
98
+ --"wr:WR1" rule scope - rule where, with prefix
99
+ --"ip:IP1" rule scope - rule informal proposition, with prefix
85
100
  END_RULE;
86
101
 
87
102
  --"remark_constant" schema scope - constant
88
103
  --"remark_type" schema scope - type
89
- --"remark_enumeration_item" schema scope - enumeration item
104
+ --"remark_type.WR1" schema scope - type where
105
+ --"remark_type.IP1" schema scope - type informal proposition
106
+ --"remark_type.wr:WR1" schema scope - type where, with prefix
107
+ --"remark_type.ip:IP1" schema scope - type informal proposition, with prefix
108
+ --"remark_type.remark_enumeration_item" schema scope - enumeration item
109
+ --"remark_enumeration_item" schema scope - enumeration item, on the same level as the type
90
110
  --"remark_entity" schema scope - entity
91
111
  --"remark_entity.remark_attribute" schema scope - entity attribute
92
112
  --"remark_entity.remark_derived_attribute" schema scope - entity derived attribute
93
113
  --"remark_entity.remark_inverse_attribute" schema scope - entity inverse attribute
94
114
  --"remark_entity.remark_unique" schema scope - entity unique
95
- --"remark_entity.remark_where" schema scope - entity where
115
+ --"remark_entity.WR1" schema scope - entity where
116
+ --"remark_entity.IP1" schema scope - entity informal proposition
117
+ --"remark_entity.wr:WR1" schema scope - entity where, with prefix
118
+ --"remark_entity.ip:IP1" schema scope - entity informal proposition, with prefix
96
119
  --"remark_subtype_constraint" schema scope - subtype constraint
97
120
  --"remark_function" schema scope - function
98
121
  --"remark_function.remark_parameter" schema scope - function parameter
99
122
  --"remark_function.remark_type" schema scope - function type
100
- --"remark_function.remark_enumeration_item" schema scope - function enumeration item
123
+ --"remark_function.remark_type.remark_enumeration_item" schema scope - function enumeration item
124
+ --"remark_function.remark_enumeration_item" schema scope - function enumeration item, on the same level as the type
101
125
  --"remark_function.remark_constant" schema scope - function constant
102
126
  --"remark_function.remark_variable" schema scope - function variable
103
127
  --"remark_procedure" schema scope - procedure
104
128
  --"remark_procedure.remark_parameter" schema scope - procedure parameter
105
129
  --"remark_procedure.remark_type" schema scope - procedure type
106
- --"remark_procedure.remark_enumeration_item" schema scope - procedure enumeration item
130
+ --"remark_procedure.remark_type.remark_enumeration_item" schema scope - procedure enumeration item
131
+ --"remark_procedure.remark_enumeration_item" schema scope - procedure enumeration item, on the same level as the type
107
132
  --"remark_procedure.remark_constant" schema scope - procedure constant
108
133
  --"remark_procedure.remark_variable" schema scope - procedure variable
109
134
  --"remark_rule" schema scope - rule
110
135
  --"remark_rule.remark_type" schema scope - rule type
111
- --"remark_rule.remark_enumeration_item" schema scope - rule enumeration item
136
+ --"remark_rule.remark_type.remark_enumeration_item" schema scope - rule enumeration item
137
+ --"remark_rule.remark_enumeration_item" schema scope - rule enumeration item, on the same level as the type
112
138
  --"remark_rule.remark_constant" schema scope - rule constant
113
139
  --"remark_rule.remark_variable" schema scope - rule variable
114
- --"remark_rule.remark_where" schema scope - rule where
140
+ --"remark_rule.WR1" schema scope - rule where
141
+ --"remark_rule.IP1" schema scope - rule informal proposition
142
+ --"remark_rule.wr:WR1" schema scope - rule where, with prefix
143
+ --"remark_rule.ip:IP1" schema scope - rule informal proposition, with prefix
115
144
 
116
145
  END_SCHEMA;
117
146
 
118
147
  --"remark_schema" universal scope - schema
119
148
  --"remark_schema.remark_constant" universal scope - constant
120
149
  --"remark_schema.remark_type" universal scope - type
121
- --"remark_schema.remark_enumeration_item" universal scope - enumeration item
150
+ --"remark_schema.remark_type.WR1" universal scope - type where
151
+ --"remark_schema.remark_type.IP1" universal scope - type informal proposition
152
+ --"remark_schema.remark_type.wr:WR1" universal scope - type where, with prefix
153
+ --"remark_schema.remark_type.ip:IP1" universal scope - type informal proposition, with prefix
154
+ --"remark_schema.remark_type.remark_enumeration_item" universal scope - enumeration item
155
+ --"remark_schema.remark_enumeration_item" universal scope - enumeration item, on the same level as the type
122
156
  --"remark_schema.remark_entity" universal scope - entity
123
157
  --"remark_schema.remark_entity.remark_attribute" universal scope - entity attribute
124
158
  --"remark_schema.remark_entity.remark_derived_attribute" universal scope - entity derived attribute
125
159
  --"remark_schema.remark_entity.remark_inverse_attribute" universal scope - entity inverse attribute
126
160
  --"remark_schema.remark_entity.remark_unique" universal scope - entity unique
127
- --"remark_schema.remark_entity.remark_where" universal scope - entity where
161
+ --"remark_schema.remark_entity.WR1" universal scope - entity where
162
+ --"remark_schema.remark_entity.IP1" universal scope - entity informal proposition
163
+ --"remark_schema.remark_entity.wr:WR1" universal scope - entity where, with prefix
164
+ --"remark_schema.remark_entity.ip:IP1" universal scope - entity informal proposition, with prefix
128
165
  --"remark_schema.remark_subtype_constraint" universal scope - subtype constraint
129
166
  --"remark_schema.remark_function" universal scope - function
130
167
  --"remark_schema.remark_function.remark_parameter" universal scope - function parameter
131
168
  --"remark_schema.remark_function.remark_type" universal scope - function type
132
- --"remark_schema.remark_function.remark_enumeration_item" universal scope - function enumeration item
169
+ --"remark_schema.remark_function.remark_type.remark_enumeration_item" universal scope - function enumeration item
170
+ --"remark_schema.remark_function.remark_enumeration_item" universal scope - function enumeration item, on the same level as the type
133
171
  --"remark_schema.remark_function.remark_constant" universal scope - function constant
134
172
  --"remark_schema.remark_function.remark_variable" universal scope - function variable
135
173
  --"remark_schema.remark_procedure" universal scope - procedure
136
174
  --"remark_schema.remark_procedure.remark_parameter" universal scope - procedure parameter
137
175
  --"remark_schema.remark_procedure.remark_type" universal scope - procedure type
138
- --"remark_schema.remark_procedure.remark_enumeration_item" universal scope - procedure enumeration item
176
+ --"remark_schema.remark_procedure.remark_type.remark_enumeration_item" universal scope - procedure enumeration item
177
+ --"remark_schema.remark_procedure.remark_enumeration_item" universal scope - procedure enumeration item, on the same level as the type
139
178
  --"remark_schema.remark_procedure.remark_constant" universal scope - procedure constant
140
179
  --"remark_schema.remark_procedure.remark_variable" universal scope - procedure variable
141
180
  --"remark_schema.remark_rule" universal scope - rule
142
181
  --"remark_schema.remark_rule.remark_type" universal scope - rule type
143
- --"remark_schema.remark_rule.remark_enumeration_item" universal scope - rule enumeration item
182
+ --"remark_schema.remark_rule.remark_type.remark_enumeration_item" universal scope - rule enumeration item
183
+ --"remark_schema.remark_rule.remark_enumeration_item" universal scope - rule enumeration item, on the same level as the type
144
184
  --"remark_schema.remark_rule.remark_constant" universal scope - rule constant
145
185
  --"remark_schema.remark_rule.remark_variable" universal scope - rule variable
146
- --"remark_schema.remark_rule.remark_where" universal scope - rule where
186
+ --"remark_schema.remark_rule.WR1" universal scope - rule where
187
+ --"remark_schema.remark_rule.IP1" universal scope - rule informal proposition
188
+ --"remark_schema.remark_rule.wr:WR1" universal scope - rule where, with prefix
189
+ --"remark_schema.remark_rule.ip:IP1" universal scope - rule informal proposition, with prefix
@@ -3,6 +3,8 @@ CONSTANT
3
3
  remark_constant : STRING := 'xxx';
4
4
  END_CONSTANT;
5
5
  TYPE remark_type = ENUMERATION OF (remark_enumeration_item);
6
+ WHERE
7
+ WR1 : TRUE;
6
8
  END_TYPE;
7
9
 
8
10
  ENTITY remark_entity;
@@ -14,7 +16,7 @@ ENTITY remark_entity;
14
16
  UNIQUE
15
17
  remark_unique : remark_attribute;
16
18
  WHERE
17
- remark_where : TRUE;
19
+ WR1 : TRUE;
18
20
  END_ENTITY;
19
21
 
20
22
  SUBTYPE_CONSTRAINT remark_subtype_constraint FOR remark_entity;
@@ -85,7 +87,7 @@ RULE remark_rule FOR (remark_entity);
85
87
  --"remark_query" rule query scope - rule query
86
88
  );
87
89
  WHERE
88
- remark_where : TRUE;
90
+ WR1 : TRUE;
89
91
  END_RULE;
90
92
  END_SCHEMA;
91
93
  (*"remark_schema"
@@ -101,8 +103,22 @@ several physical lines.
101
103
  --"remark_schema.remark_constant" universal scope - constant
102
104
  --"remark_schema.remark_type" schema scope - type
103
105
  --"remark_schema.remark_type" universal scope - type
104
- --"remark_schema.remark_enumeration_item" schema scope - enumeration item
105
- --"remark_schema.remark_enumeration_item" universal scope - enumeration item
106
+ --"remark_schema.remark_type.remark_enumeration_item" schema scope - enumeration item
107
+ --"remark_schema.remark_type.remark_enumeration_item" schema scope - enumeration item, on the same level as the type
108
+ --"remark_schema.remark_type.remark_enumeration_item" universal scope - enumeration item
109
+ --"remark_schema.remark_type.remark_enumeration_item" universal scope - enumeration item, on the same level as the type
110
+ --"remark_schema.remark_type.WR1" type scope - type where
111
+ --"remark_schema.remark_type.WR1" type scope - type where, with prefix
112
+ --"remark_schema.remark_type.WR1" schema scope - type where
113
+ --"remark_schema.remark_type.WR1" schema scope - type where, with prefix
114
+ --"remark_schema.remark_type.WR1" universal scope - type where
115
+ --"remark_schema.remark_type.WR1" universal scope - type where, with prefix
116
+ --"remark_schema.remark_type.IP1" type scope - type informal proposition
117
+ --"remark_schema.remark_type.IP1" type scope - type informal proposition, with prefix
118
+ --"remark_schema.remark_type.IP1" schema scope - type informal proposition
119
+ --"remark_schema.remark_type.IP1" schema scope - type informal proposition, with prefix
120
+ --"remark_schema.remark_type.IP1" universal scope - type informal proposition
121
+ --"remark_schema.remark_type.IP1" universal scope - type informal proposition, with prefix
106
122
  --"remark_schema.remark_entity" schema scope - entity
107
123
  --"remark_schema.remark_entity" universal scope - entity
108
124
  --"remark_schema.remark_entity.remark_attribute" entity scope - entity attribute
@@ -117,9 +133,18 @@ several physical lines.
117
133
  --"remark_schema.remark_entity.remark_unique" entity scope - entity unique
118
134
  --"remark_schema.remark_entity.remark_unique" schema scope - entity unique
119
135
  --"remark_schema.remark_entity.remark_unique" universal scope - entity unique
120
- --"remark_schema.remark_entity.remark_where" entity scope - entity where
121
- --"remark_schema.remark_entity.remark_where" schema scope - entity where
122
- --"remark_schema.remark_entity.remark_where" universal scope - entity where
136
+ --"remark_schema.remark_entity.WR1" entity scope - entity where
137
+ --"remark_schema.remark_entity.WR1" entity scope - entity where, with prefix
138
+ --"remark_schema.remark_entity.WR1" schema scope - entity where
139
+ --"remark_schema.remark_entity.WR1" schema scope - entity where, with prefix
140
+ --"remark_schema.remark_entity.WR1" universal scope - entity where
141
+ --"remark_schema.remark_entity.WR1" universal scope - entity where, with prefix
142
+ --"remark_schema.remark_entity.IP1" entity scope - entity informal proposition
143
+ --"remark_schema.remark_entity.IP1" entity scope - entity informal proposition, with prefix
144
+ --"remark_schema.remark_entity.IP1" schema scope - entity informal proposition
145
+ --"remark_schema.remark_entity.IP1" schema scope - entity informal proposition, with prefix
146
+ --"remark_schema.remark_entity.IP1" universal scope - entity informal proposition
147
+ --"remark_schema.remark_entity.IP1" universal scope - entity informal proposition, with prefix
123
148
  --"remark_schema.remark_subtype_constraint" schema scope - subtype constraint
124
149
  --"remark_schema.remark_subtype_constraint" universal scope - subtype constraint
125
150
  --"remark_schema.remark_function" schema scope - function
@@ -130,9 +155,12 @@ several physical lines.
130
155
  --"remark_schema.remark_function.remark_type" function scope - function type
131
156
  --"remark_schema.remark_function.remark_type" schema scope - function type
132
157
  --"remark_schema.remark_function.remark_type" universal scope - function type
133
- --"remark_schema.remark_function.remark_enumeration_item" function scope - function enumeration item
134
- --"remark_schema.remark_function.remark_enumeration_item" schema scope - function enumeration item
135
- --"remark_schema.remark_function.remark_enumeration_item" universal scope - function enumeration item
158
+ --"remark_schema.remark_function.remark_type.remark_enumeration_item" function scope - function enumeration item
159
+ --"remark_schema.remark_function.remark_type.remark_enumeration_item" function scope - function enumeration item, on the same level as the type
160
+ --"remark_schema.remark_function.remark_type.remark_enumeration_item" schema scope - function enumeration item
161
+ --"remark_schema.remark_function.remark_type.remark_enumeration_item" schema scope - function enumeration item, on the same level as the type
162
+ --"remark_schema.remark_function.remark_type.remark_enumeration_item" universal scope - function enumeration item
163
+ --"remark_schema.remark_function.remark_type.remark_enumeration_item" universal scope - function enumeration item, on the same level as the type
136
164
  --"remark_schema.remark_function.remark_constant" function scope - function constant
137
165
  --"remark_schema.remark_function.remark_constant" schema scope - function constant
138
166
  --"remark_schema.remark_function.remark_constant" universal scope - function constant
@@ -147,9 +175,12 @@ several physical lines.
147
175
  --"remark_schema.remark_procedure.remark_type" procedure scope - procedure type
148
176
  --"remark_schema.remark_procedure.remark_type" schema scope - procedure type
149
177
  --"remark_schema.remark_procedure.remark_type" universal scope - procedure type
150
- --"remark_schema.remark_procedure.remark_enumeration_item" procedure scope - procedure enumeration item
151
- --"remark_schema.remark_procedure.remark_enumeration_item" schema scope - procedure enumeration item
152
- --"remark_schema.remark_procedure.remark_enumeration_item" universal scope - procedure enumeration item
178
+ --"remark_schema.remark_procedure.remark_type.remark_enumeration_item" procedure scope - procedure enumeration item
179
+ --"remark_schema.remark_procedure.remark_type.remark_enumeration_item" procedure scope - procedure enumeration item, on the same level as the type
180
+ --"remark_schema.remark_procedure.remark_type.remark_enumeration_item" schema scope - procedure enumeration item
181
+ --"remark_schema.remark_procedure.remark_type.remark_enumeration_item" schema scope - procedure enumeration item, on the same level as the type
182
+ --"remark_schema.remark_procedure.remark_type.remark_enumeration_item" universal scope - procedure enumeration item
183
+ --"remark_schema.remark_procedure.remark_type.remark_enumeration_item" universal scope - procedure enumeration item, on the same level as the type
153
184
  --"remark_schema.remark_procedure.remark_constant" procedure scope - procedure constant
154
185
  --"remark_schema.remark_procedure.remark_constant" schema scope - procedure constant
155
186
  --"remark_schema.remark_procedure.remark_constant" universal scope - procedure constant
@@ -161,15 +192,27 @@ several physical lines.
161
192
  --"remark_schema.remark_rule.remark_type" rule scope - rule type
162
193
  --"remark_schema.remark_rule.remark_type" schema scope - rule type
163
194
  --"remark_schema.remark_rule.remark_type" universal scope - rule type
164
- --"remark_schema.remark_rule.remark_enumeration_item" rule scope - rule enumeration item
165
- --"remark_schema.remark_rule.remark_enumeration_item" schema scope - rule enumeration item
166
- --"remark_schema.remark_rule.remark_enumeration_item" universal scope - rule enumeration item
195
+ --"remark_schema.remark_rule.remark_type.remark_enumeration_item" rule scope - rule enumeration item
196
+ --"remark_schema.remark_rule.remark_type.remark_enumeration_item" rule scope - rule enumeration item, on the same level as the type
197
+ --"remark_schema.remark_rule.remark_type.remark_enumeration_item" schema scope - rule enumeration item
198
+ --"remark_schema.remark_rule.remark_type.remark_enumeration_item" schema scope - rule enumeration item, on the same level as the type
199
+ --"remark_schema.remark_rule.remark_type.remark_enumeration_item" universal scope - rule enumeration item
200
+ --"remark_schema.remark_rule.remark_type.remark_enumeration_item" universal scope - rule enumeration item, on the same level as the type
167
201
  --"remark_schema.remark_rule.remark_constant" rule scope - rule constant
168
202
  --"remark_schema.remark_rule.remark_constant" schema scope - rule constant
169
203
  --"remark_schema.remark_rule.remark_constant" universal scope - rule constant
170
204
  --"remark_schema.remark_rule.remark_variable" rule scope - rule variable
171
205
  --"remark_schema.remark_rule.remark_variable" schema scope - rule variable
172
206
  --"remark_schema.remark_rule.remark_variable" universal scope - rule variable
173
- --"remark_schema.remark_rule.remark_where" rule scope - rule where
174
- --"remark_schema.remark_rule.remark_where" schema scope - rule where
175
- --"remark_schema.remark_rule.remark_where" universal scope - rule where
207
+ --"remark_schema.remark_rule.WR1" rule scope - rule where
208
+ --"remark_schema.remark_rule.WR1" rule scope - rule where, with prefix
209
+ --"remark_schema.remark_rule.WR1" schema scope - rule where
210
+ --"remark_schema.remark_rule.WR1" schema scope - rule where, with prefix
211
+ --"remark_schema.remark_rule.WR1" universal scope - rule where
212
+ --"remark_schema.remark_rule.WR1" universal scope - rule where, with prefix
213
+ --"remark_schema.remark_rule.IP1" rule scope - rule informal proposition
214
+ --"remark_schema.remark_rule.IP1" rule scope - rule informal proposition, with prefix
215
+ --"remark_schema.remark_rule.IP1" schema scope - rule informal proposition
216
+ --"remark_schema.remark_rule.IP1" schema scope - rule informal proposition, with prefix
217
+ --"remark_schema.remark_rule.IP1" universal scope - rule informal proposition
218
+ --"remark_schema.remark_rule.IP1" universal scope - rule informal proposition, with prefix
@@ -0,0 +1,16 @@
1
+ SCHEMA entity_schema;
2
+ -- body
3
+ ENTITY empty_entity; END_ENTITY;
4
+ END_SCHEMA;
5
+
6
+ SCHEMA version_entity_schema 'version';
7
+ -- body
8
+ ENTITY empty_entity; END_ENTITY;
9
+ END_SCHEMA;
10
+
11
+ SCHEMA version_interface_entity_schema 'version';
12
+ USE FROM contract_schema;
13
+ REFERENCE FROM contract_schema;
14
+ -- body
15
+ ENTITY empty_entity; END_ENTITY;
16
+ END_SCHEMA;
@@ -4,9 +4,11 @@ SCHEMA syntax_schema 'version';
4
4
  -- interfaces
5
5
  USE FROM contract_schema;
6
6
  USE FROM contract_schema (contract);
7
+ USE FROM contract_schema (contract, contract2);
7
8
  USE FROM contract_schema (contract AS contract2);
8
9
  REFERENCE FROM contract_schema;
9
10
  REFERENCE FROM contract_schema (contract);
11
+ REFERENCE FROM contract_schema (contract, contract2);
10
12
  REFERENCE FROM contract_schema (contract AS contract2);
11
13
 
12
14
  -- constants
@@ -15,7 +17,7 @@ CONSTANT empty_constant : BOOLEAN := TRUE; END_CONSTANT;
15
17
  -- types
16
18
  TYPE empty_type = BOOLEAN; END_TYPE;
17
19
  TYPE where_type = BOOLEAN; WHERE TRUE; END_TYPE;
18
- TYPE where_label_type = BOOLEAN; WHERE WR1 : TRUE; END_TYPE;
20
+ TYPE where_label_type = BOOLEAN; WHERE WR1 : TRUE; END_TYPE;
19
21
 
20
22
  -- entities
21
23
  ENTITY empty_entity; END_ENTITY;
@@ -115,6 +117,7 @@ RULE variable_expression_rule FOR (empty_entity); LOCAL test : BOOLEAN := TRUE;
115
117
  RULE multiple_variable_expression_rule FOR (empty_entity); LOCAL test : BOOLEAN := TRUE; test2 : BOOLEAN := TRUE; END_LOCAL; WHERE TRUE; END_RULE;
116
118
  RULE multiple_shorthand_variable_expression_rule FOR (empty_entity); LOCAL test, test2 : BOOLEAN := TRUE; END_LOCAL; WHERE TRUE; END_RULE;
117
119
  RULE statement_rule FOR (empty_entity); ; WHERE TRUE; END_RULE;
120
+ RULE where_label_rule FOR (empty_entity); WHERE WR1 : TRUE; END_RULE;
118
121
 
119
122
  -- simple types
120
123
  TYPE binary_type = BINARY; END_TYPE;
@@ -2,11 +2,15 @@ SCHEMA syntax_schema 'version';
2
2
  USE FROM contract_schema;
3
3
  USE FROM contract_schema
4
4
  (contract);
5
+ USE FROM contract_schema
6
+ (contract, contract2);
5
7
  USE FROM contract_schema
6
8
  (contract AS contract2);
7
9
  REFERENCE FROM contract_schema;
8
10
  REFERENCE FROM contract_schema
9
11
  (contract);
12
+ REFERENCE FROM contract_schema
13
+ (contract, contract2);
10
14
  REFERENCE FROM contract_schema
11
15
  (contract AS contract2);
12
16
  CONSTANT
@@ -489,6 +493,11 @@ RULE statement_rule FOR (empty_entity);
489
493
  TRUE;
490
494
  END_RULE;
491
495
 
496
+ RULE where_label_rule FOR (empty_entity);
497
+ WHERE
498
+ WR1 : TRUE;
499
+ END_RULE;
500
+
492
501
  TYPE binary_type = BINARY;
493
502
  END_TYPE;
494
503
 
@@ -0,0 +1,41 @@
1
+ require "spec_helper"
2
+ require "expressir/express_exp/parser"
3
+
4
+ RSpec.describe Expressir::Model::Scope do
5
+ describe ".head_source" do
6
+ it "contains original head source" do
7
+ input = File.read(sample_file)
8
+ repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
9
+
10
+ expected_result = input
11
+ expect(repo.source).to eq(expected_result)
12
+
13
+ repo.schemas[0].tap do |x|
14
+ start_index = x.source.index("SCHEMA")
15
+ stop_index = x.source.index(";") + ";".length - 1
16
+ expected_result = x.source[start_index..stop_index]
17
+ expect(x.head_source).to eq(expected_result)
18
+ end
19
+
20
+ repo.schemas[1].tap do |x|
21
+ start_index = x.source.index("SCHEMA")
22
+ stop_index = x.source.index(";") + ";".length - 1
23
+ expected_result = x.source[start_index..stop_index]
24
+ expect(x.head_source).to eq(expected_result)
25
+ end
26
+
27
+ repo.schemas[2].tap do |x|
28
+ start_index = x.source.index("SCHEMA")
29
+ stop_index = x.source.index("REFERENCE FROM contract_schema;") + "REFERENCE FROM contract_schema;".length - 1
30
+ expected_result = x.source[start_index..stop_index]
31
+ expect(x.head_source).to eq(expected_result)
32
+ end
33
+ end
34
+ end
35
+
36
+ def sample_file
37
+ @sample_file ||= Expressir.root_path.join(
38
+ "original", "examples", "syntax", "source.exp"
39
+ )
40
+ end
41
+ end
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+ require "expressir/express_exp/parser"
3
+
4
+ RSpec.describe Expressir::ExpressExp::Parser do
5
+ describe ".from_files" do
6
+ it "build an instance from multiple files file" do
7
+ repo = Expressir::ExpressExp::Parser.from_files(sample_files)
8
+
9
+ schemas = repo.schemas
10
+ expect(schemas.count).to eq(5)
11
+ expect(schemas[0].id).to eq("syntax_schema")
12
+ expect(schemas[1].id).to eq("remark_schema")
13
+ expect(schemas[2].id).to eq("entity_schema")
14
+ expect(schemas[3].id).to eq("version_entity_schema")
15
+ expect(schemas[4].id).to eq("version_interface_entity_schema")
16
+ end
17
+ end
18
+
19
+ def sample_files
20
+ @sample_files ||= [
21
+ Expressir.root_path.join(
22
+ "original", "examples", "syntax", "syntax.exp"
23
+ ),
24
+ Expressir.root_path.join(
25
+ "original", "examples", "syntax", "remark.exp"
26
+ ),
27
+ Expressir.root_path.join(
28
+ "original", "examples", "syntax", "source.exp"
29
+ )
30
+ ]
31
+ end
32
+ end