expressir 0.2.7-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.cross_rubies +30 -0
- data/.github/workflows/rake.yml +45 -0
- data/.github/workflows/release.yml +84 -0
- data/.gitignore +17 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +508 -0
- data/Gemfile +4 -0
- data/README.adoc +147 -0
- data/Rakefile +11 -0
- data/bin/console +12 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/demo.rb +18 -0
- data/docs/development.md +90 -0
- data/exe/expressir +20 -0
- data/exe/generate-parser +48 -0
- data/expressir.gemspec +43 -0
- data/lib/expressir/cli/ui.rb +36 -0
- data/lib/expressir/cli.rb +27 -0
- data/lib/expressir/config.rb +23 -0
- data/lib/expressir/express/aggregate_dimension.rb +38 -0
- data/lib/expressir/express/attribute.rb +15 -0
- data/lib/expressir/express/comment.rb +7 -0
- data/lib/expressir/express/defined_type.rb +36 -0
- data/lib/expressir/express/derived.rb +65 -0
- data/lib/expressir/express/derived_aggregate.rb +43 -0
- data/lib/expressir/express/entity.rb +137 -0
- data/lib/expressir/express/explicit.rb +70 -0
- data/lib/expressir/express/explicit_aggregate.rb +46 -0
- data/lib/expressir/express/explicit_or_derived.rb +16 -0
- data/lib/expressir/express/global_rule.rb +44 -0
- data/lib/expressir/express/interface_specification.rb +51 -0
- data/lib/expressir/express/interfaced_item.rb +38 -0
- data/lib/expressir/express/inverse.rb +46 -0
- data/lib/expressir/express/inverse_aggregate.rb +37 -0
- data/lib/expressir/express/model_element.rb +7 -0
- data/lib/expressir/express/named_type.rb +19 -0
- data/lib/expressir/express/remark.rb +8 -0
- data/lib/expressir/express/repository.rb +306 -0
- data/lib/expressir/express/schema_definition.rb +96 -0
- data/lib/expressir/express/subtype_constraint.rb +14 -0
- data/lib/expressir/express/type.rb +26 -0
- data/lib/expressir/express/type_aggregate.rb +42 -0
- data/lib/expressir/express/type_enum.rb +29 -0
- data/lib/expressir/express/type_parser.rb +45 -0
- data/lib/expressir/express/type_select.rb +82 -0
- data/lib/expressir/express/unique_rule.rb +35 -0
- data/lib/expressir/express/where_rule.rb +32 -0
- data/lib/expressir/express.rb +11 -0
- data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
- data/lib/expressir/express_exp/formatter.rb +1450 -0
- data/lib/expressir/express_exp/parser.rb +41 -0
- data/lib/expressir/express_exp/visitor.rb +2464 -0
- data/lib/expressir/express_parser.rb +30 -0
- data/lib/expressir/model/attribute.rb +27 -0
- data/lib/expressir/model/constant.rb +17 -0
- data/lib/expressir/model/entity.rb +46 -0
- data/lib/expressir/model/enumeration_item.rb +11 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +13 -0
- data/lib/expressir/model/expressions/aggregate_item.rb +15 -0
- data/lib/expressir/model/expressions/attribute_reference.rb +15 -0
- data/lib/expressir/model/expressions/binary_expression.rb +40 -0
- data/lib/expressir/model/expressions/call.rb +15 -0
- data/lib/expressir/model/expressions/entity_constructor.rb +15 -0
- data/lib/expressir/model/expressions/group_reference.rb +15 -0
- data/lib/expressir/model/expressions/index_reference.rb +17 -0
- data/lib/expressir/model/expressions/interval.rb +21 -0
- data/lib/expressir/model/expressions/query_expression.rb +26 -0
- data/lib/expressir/model/expressions/simple_reference.rb +13 -0
- data/lib/expressir/model/expressions/unary_expression.rb +19 -0
- data/lib/expressir/model/function.rb +62 -0
- data/lib/expressir/model/identifier.rb +10 -0
- data/lib/expressir/model/interface.rb +18 -0
- data/lib/expressir/model/literals/binary.rb +13 -0
- data/lib/expressir/model/literals/integer.rb +13 -0
- data/lib/expressir/model/literals/logical.rb +17 -0
- data/lib/expressir/model/literals/real.rb +13 -0
- data/lib/expressir/model/literals/string.rb +15 -0
- data/lib/expressir/model/parameter.rb +17 -0
- data/lib/expressir/model/procedure.rb +60 -0
- data/lib/expressir/model/renamed_ref.rb +13 -0
- data/lib/expressir/model/repository.rb +19 -0
- data/lib/expressir/model/rule.rb +62 -0
- data/lib/expressir/model/schema.rb +67 -0
- data/lib/expressir/model/scope.rb +17 -0
- data/lib/expressir/model/statements/alias.rb +26 -0
- data/lib/expressir/model/statements/assignment.rb +15 -0
- data/lib/expressir/model/statements/call.rb +15 -0
- data/lib/expressir/model/statements/case.rb +17 -0
- data/lib/expressir/model/statements/case_action.rb +15 -0
- data/lib/expressir/model/statements/compound.rb +13 -0
- data/lib/expressir/model/statements/escape.rb +8 -0
- data/lib/expressir/model/statements/if.rb +17 -0
- data/lib/expressir/model/statements/null.rb +8 -0
- data/lib/expressir/model/statements/repeat.rb +34 -0
- data/lib/expressir/model/statements/return.rb +13 -0
- data/lib/expressir/model/statements/skip.rb +8 -0
- data/lib/expressir/model/subtype_constraint.rb +27 -0
- data/lib/expressir/model/type.rb +24 -0
- data/lib/expressir/model/types/aggregate.rb +17 -0
- data/lib/expressir/model/types/array.rb +21 -0
- data/lib/expressir/model/types/bag.rb +17 -0
- data/lib/expressir/model/types/binary.rb +15 -0
- data/lib/expressir/model/types/boolean.rb +8 -0
- data/lib/expressir/model/types/enumeration.rb +19 -0
- data/lib/expressir/model/types/generic.rb +13 -0
- data/lib/expressir/model/types/generic_entity.rb +13 -0
- data/lib/expressir/model/types/integer.rb +8 -0
- data/lib/expressir/model/types/list.rb +19 -0
- data/lib/expressir/model/types/logical.rb +8 -0
- data/lib/expressir/model/types/number.rb +8 -0
- data/lib/expressir/model/types/real.rb +13 -0
- data/lib/expressir/model/types/select.rb +21 -0
- data/lib/expressir/model/types/set.rb +17 -0
- data/lib/expressir/model/types/string.rb +15 -0
- data/lib/expressir/model/unique.rb +15 -0
- data/lib/expressir/model/variable.rb +17 -0
- data/lib/expressir/model/where.rb +15 -0
- data/lib/expressir/model.rb +65 -0
- data/lib/expressir/parser/owl_parser.rb +8 -0
- data/lib/expressir/parser.rb +6 -0
- data/lib/expressir/version.rb +3 -0
- data/lib/expressir.rb +21 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +9589 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +36619 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +13294 -0
- data/original/examples/employment/eclipse/.project +17 -0
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +33 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +77 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xml +93 -0
- data/original/examples/employment/eclipse/Models/Employment.uml +4 -0
- data/original/examples/employment/eclipse/Models/Employment.umldi +240 -0
- data/original/examples/employment/eclipse/readme.txt +7 -0
- data/original/examples/employment/employment_schema.exp +33 -0
- data/original/examples/employment/employment_schema.rb +232 -0
- data/original/examples/employment/employment_schema.xml +93 -0
- data/original/examples/employment/employment_schema___module.rb +46 -0
- data/original/examples/employment/employment_schema___p28attr.rb +126 -0
- data/original/examples/employment/employment_schema___p28inst.rb +26 -0
- data/original/examples/employment/example_employment_data.xml +1 -0
- data/original/examples/employment/example_employment_data_copy.xml +1 -0
- data/original/examples/employment/example_employment_reader.rb +30 -0
- data/original/examples/employment/example_employment_writer.rb +51 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +3710 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +35880 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +15357 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +9468 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +8404 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +43147 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +18341 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +11632 -0
- data/original/examples/syntax/remark.exp +146 -0
- data/original/examples/syntax/remark_formatted.exp +175 -0
- data/original/examples/syntax/syntax.exp +311 -0
- data/original/examples/syntax/syntax_formatted.exp +1191 -0
- data/original/exp2ruby.rb +525 -0
- data/original/expsm.rb +34 -0
- data/original/mapping_owl.rb +1018 -0
- data/original/mapping_sysml.rb +2281 -0
- data/original/mapping_uml2.rb +599 -0
- data/original/mapping_uml2_eclipse.rb +433 -0
- data/original/reeper.rb +134 -0
- data/rakelib/cross-ruby.rake +308 -0
- data/spec/acceptance/express_to_owl_spec.rb +18 -0
- data/spec/acceptance/version_spec.rb +12 -0
- data/spec/expressir/express/repository_spec.rb +25 -0
- data/spec/expressir/express_exp/ap233_spec.rb +22 -0
- data/spec/expressir/express_exp/format_remark_spec.rb +28 -0
- data/spec/expressir/express_exp/format_syntax_spec.rb +28 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +346 -0
- data/spec/expressir/express_exp/parse_syntax_spec.rb +3003 -0
- data/spec/expressir/model/find_spec.rb +110 -0
- data/spec/expressr_spec.rb +5 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/console_helper.rb +29 -0
- metadata +357 -0
@@ -0,0 +1,346 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
|
4
|
+
RSpec.describe Expressir::ExpressExp::Parser do
|
5
|
+
describe ".from_file" do
|
6
|
+
it "build an instance from a file" do
|
7
|
+
repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
|
8
|
+
|
9
|
+
schema = repo.schemas.first
|
10
|
+
|
11
|
+
schema.tap do |x|
|
12
|
+
expect(x).to be_instance_of(Expressir::Model::Schema)
|
13
|
+
expect(x.remarks).to be_instance_of(Array)
|
14
|
+
expect(x.remarks.count).to eq(5)
|
15
|
+
expect(x.remarks[0]).to eq("Any character within the EXPRESS character set may occur between the start and end of\nan embedded remark including the newline character; therefore, embedded remarks can span\nseveral physical lines.")
|
16
|
+
expect(x.remarks[1]).to eq("The tail remark is written at the end of a physical line.")
|
17
|
+
expect(x.remarks[2]).to eq("UTF8 test: Příliš žluťoučký kůň úpěl ďábelské ódy.")
|
18
|
+
expect(x.remarks[3]).to eq("universal scope - schema before")
|
19
|
+
expect(x.remarks[4]).to eq("universal scope - schema")
|
20
|
+
end
|
21
|
+
|
22
|
+
schema.constants.first.tap do |x|
|
23
|
+
expect(x).to be_instance_of(Expressir::Model::Constant)
|
24
|
+
expect(x.remarks).to be_instance_of(Array)
|
25
|
+
expect(x.remarks.count).to eq(2)
|
26
|
+
expect(x.remarks[0]).to eq("schema scope - constant")
|
27
|
+
expect(x.remarks[1]).to eq("universal scope - constant")
|
28
|
+
end
|
29
|
+
|
30
|
+
schema.types.first.tap do |x|
|
31
|
+
expect(x).to be_instance_of(Expressir::Model::Type)
|
32
|
+
expect(x.remarks).to be_instance_of(Array)
|
33
|
+
expect(x.remarks.count).to eq(2)
|
34
|
+
expect(x.remarks[0]).to eq("schema scope - type")
|
35
|
+
expect(x.remarks[1]).to eq("universal scope - type")
|
36
|
+
|
37
|
+
expect(x.type).to be_instance_of(Expressir::Model::Types::Enumeration)
|
38
|
+
x.type.items.first.tap do |x|
|
39
|
+
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
40
|
+
expect(x.remarks).to be_instance_of(Array)
|
41
|
+
expect(x.remarks.count).to eq(2)
|
42
|
+
expect(x.remarks[0]).to eq("schema scope - enumeration item")
|
43
|
+
expect(x.remarks[1]).to eq("universal scope - enumeration item")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
schema.entities.first.tap do |x|
|
48
|
+
expect(x).to be_instance_of(Expressir::Model::Entity)
|
49
|
+
expect(x.remarks).to be_instance_of(Array)
|
50
|
+
expect(x.remarks.count).to eq(2)
|
51
|
+
expect(x.remarks[0]).to eq("schema scope - entity")
|
52
|
+
expect(x.remarks[1]).to eq("universal scope - entity")
|
53
|
+
end
|
54
|
+
|
55
|
+
schema.entities.first.explicit_attributes.first.tap do |x|
|
56
|
+
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
57
|
+
expect(x.kind).to eq(Expressir::Model::Attribute::EXPLICIT)
|
58
|
+
expect(x.remarks).to be_instance_of(Array)
|
59
|
+
expect(x.remarks.count).to eq(3)
|
60
|
+
expect(x.remarks[0]).to eq("entity scope - entity attribute")
|
61
|
+
expect(x.remarks[1]).to eq("schema scope - entity attribute")
|
62
|
+
expect(x.remarks[2]).to eq("universal scope - entity attribute")
|
63
|
+
end
|
64
|
+
|
65
|
+
schema.entities.first.derived_attributes.first.tap do |x|
|
66
|
+
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
67
|
+
expect(x.kind).to eq(Expressir::Model::Attribute::DERIVED)
|
68
|
+
expect(x.remarks).to be_instance_of(Array)
|
69
|
+
expect(x.remarks.count).to eq(3)
|
70
|
+
expect(x.remarks[0]).to eq("entity scope - entity derived attribute")
|
71
|
+
expect(x.remarks[1]).to eq("schema scope - entity derived attribute")
|
72
|
+
expect(x.remarks[2]).to eq("universal scope - entity derived attribute")
|
73
|
+
end
|
74
|
+
|
75
|
+
schema.entities.first.inverse_attributes.first.tap do |x|
|
76
|
+
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
77
|
+
expect(x.kind).to eq(Expressir::Model::Attribute::INVERSE)
|
78
|
+
expect(x.remarks).to be_instance_of(Array)
|
79
|
+
expect(x.remarks.count).to eq(3)
|
80
|
+
expect(x.remarks[0]).to eq("entity scope - entity inverse attribute")
|
81
|
+
expect(x.remarks[1]).to eq("schema scope - entity inverse attribute")
|
82
|
+
expect(x.remarks[2]).to eq("universal scope - entity inverse attribute")
|
83
|
+
end
|
84
|
+
|
85
|
+
schema.entities.first.unique.first.tap do |x|
|
86
|
+
expect(x).to be_instance_of(Expressir::Model::Unique)
|
87
|
+
expect(x.remarks).to be_instance_of(Array)
|
88
|
+
expect(x.remarks.count).to eq(3)
|
89
|
+
expect(x.remarks[0]).to eq("entity scope - entity unique")
|
90
|
+
expect(x.remarks[1]).to eq("schema scope - entity unique")
|
91
|
+
expect(x.remarks[2]).to eq("universal scope - entity unique")
|
92
|
+
end
|
93
|
+
|
94
|
+
schema.entities.first.where.first.tap do |x|
|
95
|
+
expect(x).to be_instance_of(Expressir::Model::Where)
|
96
|
+
expect(x.remarks).to be_instance_of(Array)
|
97
|
+
expect(x.remarks.count).to eq(3)
|
98
|
+
expect(x.remarks[0]).to eq("entity scope - entity where")
|
99
|
+
expect(x.remarks[1]).to eq("schema scope - entity where")
|
100
|
+
expect(x.remarks[2]).to eq("universal scope - entity where")
|
101
|
+
end
|
102
|
+
|
103
|
+
schema.subtype_constraints.first.tap do |x|
|
104
|
+
expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
|
105
|
+
expect(x.remarks).to be_instance_of(Array)
|
106
|
+
expect(x.remarks.count).to eq(2)
|
107
|
+
expect(x.remarks[0]).to eq("schema scope - subtype constraint")
|
108
|
+
expect(x.remarks[1]).to eq("universal scope - subtype constraint")
|
109
|
+
end
|
110
|
+
|
111
|
+
schema.functions.first.tap do |x|
|
112
|
+
expect(x).to be_instance_of(Expressir::Model::Function)
|
113
|
+
expect(x.remarks).to be_instance_of(Array)
|
114
|
+
expect(x.remarks.count).to eq(2)
|
115
|
+
expect(x.remarks[0]).to eq("schema scope - function")
|
116
|
+
expect(x.remarks[1]).to eq("universal scope - function")
|
117
|
+
end
|
118
|
+
|
119
|
+
schema.functions.first.parameters.first.tap do |x|
|
120
|
+
expect(x).to be_instance_of(Expressir::Model::Parameter)
|
121
|
+
expect(x.remarks).to be_instance_of(Array)
|
122
|
+
expect(x.remarks.count).to eq(3)
|
123
|
+
expect(x.remarks[0]).to eq("function scope - function parameter")
|
124
|
+
expect(x.remarks[1]).to eq("schema scope - function parameter")
|
125
|
+
expect(x.remarks[2]).to eq("universal scope - function parameter")
|
126
|
+
end
|
127
|
+
|
128
|
+
schema.functions.first.types.first.tap do |x|
|
129
|
+
expect(x).to be_instance_of(Expressir::Model::Type)
|
130
|
+
expect(x.remarks).to be_instance_of(Array)
|
131
|
+
expect(x.remarks.count).to eq(3)
|
132
|
+
expect(x.remarks[0]).to eq("function scope - function type")
|
133
|
+
expect(x.remarks[1]).to eq("schema scope - function type")
|
134
|
+
expect(x.remarks[2]).to eq("universal scope - function type")
|
135
|
+
|
136
|
+
expect(x.type).to be_instance_of(Expressir::Model::Types::Enumeration)
|
137
|
+
x.type.items.first.tap do |x|
|
138
|
+
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
139
|
+
expect(x.remarks).to be_instance_of(Array)
|
140
|
+
expect(x.remarks.count).to eq(3)
|
141
|
+
expect(x.remarks[0]).to eq("function scope - function enumeration item")
|
142
|
+
expect(x.remarks[1]).to eq("schema scope - function enumeration item")
|
143
|
+
expect(x.remarks[2]).to eq("universal scope - function enumeration item")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
schema.functions.first.constants.first.tap do |x|
|
148
|
+
expect(x).to be_instance_of(Expressir::Model::Constant)
|
149
|
+
expect(x.remarks).to be_instance_of(Array)
|
150
|
+
expect(x.remarks.count).to eq(3)
|
151
|
+
expect(x.remarks[0]).to eq("function scope - function constant")
|
152
|
+
expect(x.remarks[1]).to eq("schema scope - function constant")
|
153
|
+
expect(x.remarks[2]).to eq("universal scope - function constant")
|
154
|
+
end
|
155
|
+
|
156
|
+
schema.functions.first.variables.first.tap do |x|
|
157
|
+
expect(x).to be_instance_of(Expressir::Model::Variable)
|
158
|
+
expect(x.remarks).to be_instance_of(Array)
|
159
|
+
expect(x.remarks.count).to eq(3)
|
160
|
+
expect(x.remarks[0]).to eq("function scope - function variable")
|
161
|
+
expect(x.remarks[1]).to eq("schema scope - function variable")
|
162
|
+
expect(x.remarks[2]).to eq("universal scope - function variable")
|
163
|
+
end
|
164
|
+
|
165
|
+
schema.functions.first.statements[0].tap do |x|
|
166
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
167
|
+
expect(x.remarks).to be_instance_of(Array)
|
168
|
+
expect(x.remarks.count).to eq(1)
|
169
|
+
expect(x.remarks[0]).to eq("function alias scope - function alias")
|
170
|
+
end
|
171
|
+
|
172
|
+
schema.functions.first.statements[1].tap do |x|
|
173
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
174
|
+
expect(x.remarks).to be_instance_of(Array)
|
175
|
+
expect(x.remarks.count).to eq(1)
|
176
|
+
expect(x.remarks[0]).to eq("function repeat scope - function repeat")
|
177
|
+
end
|
178
|
+
|
179
|
+
schema.functions.first.statements[2].tap do |x|
|
180
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
181
|
+
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
182
|
+
expect(x.expression.remarks).to be_instance_of(Array)
|
183
|
+
expect(x.expression.remarks.count).to eq(1)
|
184
|
+
expect(x.expression.remarks[0]).to eq("function query scope - function query")
|
185
|
+
end
|
186
|
+
|
187
|
+
schema.procedures.first.tap do |x|
|
188
|
+
expect(x).to be_instance_of(Expressir::Model::Procedure)
|
189
|
+
expect(x.remarks).to be_instance_of(Array)
|
190
|
+
expect(x.remarks.count).to eq(2)
|
191
|
+
expect(x.remarks[0]).to eq("schema scope - procedure")
|
192
|
+
expect(x.remarks[1]).to eq("universal scope - procedure")
|
193
|
+
end
|
194
|
+
|
195
|
+
schema.procedures.first.parameters.first.tap do |x|
|
196
|
+
expect(x).to be_instance_of(Expressir::Model::Parameter)
|
197
|
+
expect(x.remarks).to be_instance_of(Array)
|
198
|
+
expect(x.remarks.count).to eq(3)
|
199
|
+
expect(x.remarks[0]).to eq("procedure scope - procedure parameter")
|
200
|
+
expect(x.remarks[1]).to eq("schema scope - procedure parameter")
|
201
|
+
expect(x.remarks[2]).to eq("universal scope - procedure parameter")
|
202
|
+
end
|
203
|
+
|
204
|
+
schema.procedures.first.types.first.tap do |x|
|
205
|
+
expect(x).to be_instance_of(Expressir::Model::Type)
|
206
|
+
expect(x.remarks).to be_instance_of(Array)
|
207
|
+
expect(x.remarks.count).to eq(3)
|
208
|
+
expect(x.remarks[0]).to eq("procedure scope - procedure type")
|
209
|
+
expect(x.remarks[1]).to eq("schema scope - procedure type")
|
210
|
+
expect(x.remarks[2]).to eq("universal scope - procedure type")
|
211
|
+
|
212
|
+
expect(x.type).to be_instance_of(Expressir::Model::Types::Enumeration)
|
213
|
+
x.type.items.first.tap do |x|
|
214
|
+
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
215
|
+
expect(x.remarks).to be_instance_of(Array)
|
216
|
+
expect(x.remarks.count).to eq(3)
|
217
|
+
expect(x.remarks[0]).to eq("procedure scope - procedure enumeration item")
|
218
|
+
expect(x.remarks[1]).to eq("schema scope - procedure enumeration item")
|
219
|
+
expect(x.remarks[2]).to eq("universal scope - procedure enumeration item")
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
schema.procedures.first.constants.first.tap do |x|
|
224
|
+
expect(x).to be_instance_of(Expressir::Model::Constant)
|
225
|
+
expect(x.remarks).to be_instance_of(Array)
|
226
|
+
expect(x.remarks.count).to eq(3)
|
227
|
+
expect(x.remarks[0]).to eq("procedure scope - procedure constant")
|
228
|
+
expect(x.remarks[1]).to eq("schema scope - procedure constant")
|
229
|
+
expect(x.remarks[2]).to eq("universal scope - procedure constant")
|
230
|
+
end
|
231
|
+
|
232
|
+
schema.procedures.first.variables.first.tap do |x|
|
233
|
+
expect(x).to be_instance_of(Expressir::Model::Variable)
|
234
|
+
expect(x.remarks).to be_instance_of(Array)
|
235
|
+
expect(x.remarks.count).to eq(3)
|
236
|
+
expect(x.remarks[0]).to eq("procedure scope - procedure variable")
|
237
|
+
expect(x.remarks[1]).to eq("schema scope - procedure variable")
|
238
|
+
expect(x.remarks[2]).to eq("universal scope - procedure variable")
|
239
|
+
end
|
240
|
+
|
241
|
+
schema.procedures.first.statements[0].tap do |x|
|
242
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
243
|
+
expect(x.remarks).to be_instance_of(Array)
|
244
|
+
expect(x.remarks.count).to eq(1)
|
245
|
+
expect(x.remarks[0]).to eq("procedure alias scope - procedure alias")
|
246
|
+
end
|
247
|
+
|
248
|
+
schema.procedures.first.statements[1].tap do |x|
|
249
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
250
|
+
expect(x.remarks).to be_instance_of(Array)
|
251
|
+
expect(x.remarks.count).to eq(1)
|
252
|
+
expect(x.remarks[0]).to eq("procedure repeat scope - procedure repeat")
|
253
|
+
end
|
254
|
+
|
255
|
+
schema.procedures.first.statements[2].tap do |x|
|
256
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
257
|
+
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
258
|
+
expect(x.expression.remarks).to be_instance_of(Array)
|
259
|
+
expect(x.expression.remarks.count).to eq(1)
|
260
|
+
expect(x.expression.remarks[0]).to eq("procedure query scope - procedure query")
|
261
|
+
end
|
262
|
+
|
263
|
+
schema.rules.first.tap do |x|
|
264
|
+
expect(x).to be_instance_of(Expressir::Model::Rule)
|
265
|
+
expect(x.remarks).to be_instance_of(Array)
|
266
|
+
expect(x.remarks.count).to eq(2)
|
267
|
+
expect(x.remarks[0]).to eq("schema scope - rule")
|
268
|
+
expect(x.remarks[1]).to eq("universal scope - rule")
|
269
|
+
end
|
270
|
+
|
271
|
+
schema.rules.first.types.first.tap do |x|
|
272
|
+
expect(x).to be_instance_of(Expressir::Model::Type)
|
273
|
+
expect(x.remarks).to be_instance_of(Array)
|
274
|
+
expect(x.remarks.count).to eq(3)
|
275
|
+
expect(x.remarks[0]).to eq("rule scope - rule type")
|
276
|
+
expect(x.remarks[1]).to eq("schema scope - rule type")
|
277
|
+
expect(x.remarks[2]).to eq("universal scope - rule type")
|
278
|
+
|
279
|
+
expect(x.type).to be_instance_of(Expressir::Model::Types::Enumeration)
|
280
|
+
x.type.items.first.tap do |x|
|
281
|
+
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
282
|
+
expect(x.remarks).to be_instance_of(Array)
|
283
|
+
expect(x.remarks.count).to eq(3)
|
284
|
+
expect(x.remarks[0]).to eq("rule scope - rule enumeration item")
|
285
|
+
expect(x.remarks[1]).to eq("schema scope - rule enumeration item")
|
286
|
+
expect(x.remarks[2]).to eq("universal scope - rule enumeration item")
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
schema.rules.first.constants.first.tap do |x|
|
291
|
+
expect(x).to be_instance_of(Expressir::Model::Constant)
|
292
|
+
expect(x.remarks).to be_instance_of(Array)
|
293
|
+
expect(x.remarks.count).to eq(3)
|
294
|
+
expect(x.remarks[0]).to eq("rule scope - rule constant")
|
295
|
+
expect(x.remarks[1]).to eq("schema scope - rule constant")
|
296
|
+
expect(x.remarks[2]).to eq("universal scope - rule constant")
|
297
|
+
end
|
298
|
+
|
299
|
+
schema.rules.first.variables.first.tap do |x|
|
300
|
+
expect(x).to be_instance_of(Expressir::Model::Variable)
|
301
|
+
expect(x.remarks).to be_instance_of(Array)
|
302
|
+
expect(x.remarks.count).to eq(3)
|
303
|
+
expect(x.remarks[0]).to eq("rule scope - rule variable")
|
304
|
+
expect(x.remarks[1]).to eq("schema scope - rule variable")
|
305
|
+
expect(x.remarks[2]).to eq("universal scope - rule variable")
|
306
|
+
end
|
307
|
+
|
308
|
+
schema.rules.first.statements[0].tap do |x|
|
309
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
310
|
+
expect(x.remarks).to be_instance_of(Array)
|
311
|
+
expect(x.remarks.count).to eq(1)
|
312
|
+
expect(x.remarks[0]).to eq("rule alias scope - rule alias")
|
313
|
+
end
|
314
|
+
|
315
|
+
schema.rules.first.statements[1].tap do |x|
|
316
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
317
|
+
expect(x.remarks).to be_instance_of(Array)
|
318
|
+
expect(x.remarks.count).to eq(1)
|
319
|
+
expect(x.remarks[0]).to eq("rule repeat scope - rule repeat")
|
320
|
+
end
|
321
|
+
|
322
|
+
schema.rules.first.statements[2].tap do |x|
|
323
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
324
|
+
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
325
|
+
expect(x.expression.remarks).to be_instance_of(Array)
|
326
|
+
expect(x.expression.remarks.count).to eq(1)
|
327
|
+
expect(x.expression.remarks[0]).to eq("rule query scope - rule query")
|
328
|
+
end
|
329
|
+
|
330
|
+
schema.rules.first.where.first.tap do |x|
|
331
|
+
expect(x).to be_instance_of(Expressir::Model::Where)
|
332
|
+
expect(x.remarks).to be_instance_of(Array)
|
333
|
+
expect(x.remarks.count).to eq(3)
|
334
|
+
expect(x.remarks[0]).to eq("rule scope - rule where")
|
335
|
+
expect(x.remarks[1]).to eq("schema scope - rule where")
|
336
|
+
expect(x.remarks[2]).to eq("universal scope - rule where")
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
def sample_file
|
342
|
+
@sample_file ||= Expressir.root_path.join(
|
343
|
+
"original", "examples", "syntax", "remark.exp"
|
344
|
+
)
|
345
|
+
end
|
346
|
+
end
|