expressir 0.2.11-arm64-darwin → 0.2.16-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/format +27 -0
- data/expressir.gemspec +1 -0
- data/lib/expressir/express_exp/2.4/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/formatter.rb +90 -100
- data/lib/expressir/express_exp/hyperlink_formatter.rb +27 -0
- data/lib/expressir/express_exp/parser.rb +7 -1
- data/lib/expressir/express_exp/schema_head_formatter.rb +12 -0
- data/lib/expressir/express_exp/visitor.rb +67 -99
- data/lib/expressir/model.rb +2 -2
- data/lib/expressir/model/attribute.rb +2 -0
- data/lib/expressir/model/constant.rb +2 -0
- data/lib/expressir/model/entity.rb +3 -2
- data/lib/expressir/model/enumeration_item.rb +2 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +2 -0
- data/lib/expressir/model/expressions/aggregate_item.rb +2 -0
- data/lib/expressir/model/expressions/attribute_reference.rb +2 -0
- data/lib/expressir/model/expressions/binary_expression.rb +2 -0
- data/lib/expressir/model/expressions/call.rb +2 -0
- data/lib/expressir/model/expressions/entity_constructor.rb +2 -0
- data/lib/expressir/model/expressions/group_reference.rb +2 -0
- data/lib/expressir/model/expressions/index_reference.rb +2 -0
- data/lib/expressir/model/expressions/interval.rb +2 -0
- data/lib/expressir/model/expressions/query_expression.rb +2 -1
- data/lib/expressir/model/expressions/simple_reference.rb +2 -0
- data/lib/expressir/model/expressions/unary_expression.rb +2 -0
- data/lib/expressir/model/function.rb +3 -8
- data/lib/expressir/model/identifier.rb +0 -1
- data/lib/expressir/model/informal_proposition.rb +2 -0
- data/lib/expressir/model/interface.rb +2 -0
- data/lib/expressir/model/{renamed_ref.rb → interface_item.rb} +4 -2
- data/lib/expressir/model/interfaced_item.rb +23 -0
- data/lib/expressir/model/literals/binary.rb +2 -0
- data/lib/expressir/model/literals/integer.rb +2 -0
- data/lib/expressir/model/literals/logical.rb +2 -0
- data/lib/expressir/model/literals/real.rb +2 -0
- data/lib/expressir/model/literals/string.rb +2 -0
- data/lib/expressir/model/model_element.rb +71 -4
- data/lib/expressir/model/parameter.rb +2 -0
- data/lib/expressir/model/procedure.rb +3 -8
- data/lib/expressir/model/repository.rb +2 -2
- data/lib/expressir/model/rule.rb +4 -9
- data/lib/expressir/model/schema.rb +45 -12
- data/lib/expressir/model/statements/alias.rb +2 -1
- data/lib/expressir/model/statements/assignment.rb +2 -0
- data/lib/expressir/model/statements/call.rb +2 -0
- data/lib/expressir/model/statements/case.rb +2 -0
- data/lib/expressir/model/statements/case_action.rb +2 -0
- data/lib/expressir/model/statements/compound.rb +2 -0
- data/lib/expressir/model/statements/if.rb +2 -0
- data/lib/expressir/model/statements/repeat.rb +2 -1
- data/lib/expressir/model/statements/return.rb +2 -0
- data/lib/expressir/model/subtype_constraint.rb +2 -1
- data/lib/expressir/model/type.rb +3 -6
- data/lib/expressir/model/types/aggregate.rb +2 -0
- data/lib/expressir/model/types/array.rb +2 -0
- data/lib/expressir/model/types/bag.rb +2 -0
- data/lib/expressir/model/types/binary.rb +2 -0
- data/lib/expressir/model/types/enumeration.rb +2 -0
- data/lib/expressir/model/types/generic.rb +2 -0
- data/lib/expressir/model/types/generic_entity.rb +2 -0
- data/lib/expressir/model/types/list.rb +2 -0
- data/lib/expressir/model/types/real.rb +2 -0
- data/lib/expressir/model/types/select.rb +2 -0
- data/lib/expressir/model/types/set.rb +2 -0
- data/lib/expressir/model/types/string.rb +2 -0
- data/lib/expressir/model/unique.rb +2 -0
- data/lib/expressir/model/variable.rb +2 -0
- data/lib/expressir/model/where.rb +2 -0
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/hyperlink.exp +23 -0
- data/original/examples/syntax/hyperlink_formatted.exp +51 -0
- data/original/examples/syntax/syntax.exp +18 -18
- data/original/examples/syntax/syntax_formatted.exp +32 -24
- data/spec/expressir/express_exp/{format_remark_spec.rb → formatter/remark_spec.rb} +2 -2
- data/spec/expressir/express_exp/{format_syntax_spec.rb → formatter/syntax_spec.rb} +2 -2
- data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +28 -0
- data/spec/expressir/express_exp/{parse_multiple_spec.rb → parser/multiple_spec.rb} +6 -1
- data/spec/expressir/express_exp/{parse_remark_spec.rb → parser/remark_spec.rb} +2 -2
- data/spec/expressir/express_exp/{source_spec.rb → parser/source_spec.rb} +1 -1
- data/spec/expressir/express_exp/{parse_syntax_spec.rb → parser/syntax_spec.rb} +98 -60
- data/spec/expressir/express_exp/schema_head_formatter_spec.rb +40 -0
- data/spec/expressir/model/{scope_spec.rb → model_element/find_spec.rb} +7 -2
- data/spec/expressir/model/{model_element_spec.rb → model_element/hash_spec.rb} +7 -18
- metadata +33 -14
- data/lib/expressir/model/scope.rb +0 -71
- data/spec/expressir/express_exp/ap233_spec.rb +0 -22
- data/spec/expressir/express_exp/head_source_spec.rb +0 -38
@@ -61,21 +61,25 @@ ENTITY attribute_multiple_shorthand_entity;
|
|
61
61
|
test : BOOLEAN;
|
62
62
|
test2 : BOOLEAN;
|
63
63
|
END_ENTITY;
|
64
|
-
ENTITY attribute_redeclared_entity
|
64
|
+
ENTITY attribute_redeclared_entity
|
65
|
+
SUBTYPE OF (attribute_entity);
|
65
66
|
SELF\attribute_entity.test : BOOLEAN;
|
66
67
|
END_ENTITY;
|
67
|
-
ENTITY attribute_redeclared_renamed_entity
|
68
|
+
ENTITY attribute_redeclared_renamed_entity
|
69
|
+
SUBTYPE OF (attribute_entity);
|
68
70
|
SELF\attribute_entity.test RENAMED test2 : BOOLEAN;
|
69
71
|
END_ENTITY;
|
70
72
|
ENTITY derived_attribute_entity;
|
71
73
|
DERIVE
|
72
74
|
test : BOOLEAN := TRUE;
|
73
75
|
END_ENTITY;
|
74
|
-
ENTITY derived_attribute_redeclared_entity
|
76
|
+
ENTITY derived_attribute_redeclared_entity
|
77
|
+
SUBTYPE OF (attribute_entity);
|
75
78
|
DERIVE
|
76
79
|
SELF\attribute_entity.test : BOOLEAN := TRUE;
|
77
80
|
END_ENTITY;
|
78
|
-
ENTITY derived_attribute_redeclared_renamed_entity
|
81
|
+
ENTITY derived_attribute_redeclared_renamed_entity
|
82
|
+
SUBTYPE OF (attribute_entity);
|
79
83
|
DERIVE
|
80
84
|
SELF\attribute_entity.test RENAMED test2 : BOOLEAN := TRUE;
|
81
85
|
END_ENTITY;
|
@@ -103,11 +107,13 @@ ENTITY inverse_attribute_bag_bound_entity;
|
|
103
107
|
INVERSE
|
104
108
|
test : BAG [1:9] OF attribute_entity FOR test;
|
105
109
|
END_ENTITY;
|
106
|
-
ENTITY inverse_attribute_redeclared_entity
|
110
|
+
ENTITY inverse_attribute_redeclared_entity
|
111
|
+
SUBTYPE OF (attribute_entity);
|
107
112
|
INVERSE
|
108
113
|
SELF\attribute_entity.test : attribute_entity FOR test;
|
109
114
|
END_ENTITY;
|
110
|
-
ENTITY inverse_attribute_redeclared_renamed_entity
|
115
|
+
ENTITY inverse_attribute_redeclared_renamed_entity
|
116
|
+
SUBTYPE OF (attribute_entity);
|
111
117
|
INVERSE
|
112
118
|
SELF\attribute_entity.test RENAMED test2 : attribute_entity FOR test;
|
113
119
|
END_ENTITY;
|
@@ -121,11 +127,13 @@ ENTITY unique_label_entity;
|
|
121
127
|
UNIQUE
|
122
128
|
UR1 : test;
|
123
129
|
END_ENTITY;
|
124
|
-
ENTITY
|
130
|
+
ENTITY unique_redeclared_entity
|
131
|
+
SUBTYPE OF (attribute_entity);
|
125
132
|
UNIQUE
|
126
133
|
SELF\attribute_entity.test;
|
127
134
|
END_ENTITY;
|
128
|
-
ENTITY
|
135
|
+
ENTITY unique_label_redeclared_entity
|
136
|
+
SUBTYPE OF (attribute_entity);
|
129
137
|
UNIQUE
|
130
138
|
UR1 : SELF\attribute_entity.test;
|
131
139
|
END_ENTITY;
|
@@ -331,13 +339,8 @@ PROCEDURE statements;
|
|
331
339
|
;
|
332
340
|
END_ALIAS;
|
333
341
|
END_PROCEDURE;
|
334
|
-
PROCEDURE alias_attribute_reference_statement;
|
335
|
-
ALIAS test FOR test.test;
|
336
|
-
;
|
337
|
-
END_ALIAS;
|
338
|
-
END_PROCEDURE;
|
339
342
|
PROCEDURE alias_group_reference_statement;
|
340
|
-
ALIAS test FOR test\
|
343
|
+
ALIAS test FOR test\test2;
|
341
344
|
;
|
342
345
|
END_ALIAS;
|
343
346
|
END_PROCEDURE;
|
@@ -351,14 +354,16 @@ PROCEDURE statements;
|
|
351
354
|
;
|
352
355
|
END_ALIAS;
|
353
356
|
END_PROCEDURE;
|
357
|
+
PROCEDURE alias_attribute_reference_statement;
|
358
|
+
ALIAS test FOR test.test2;
|
359
|
+
;
|
360
|
+
END_ALIAS;
|
361
|
+
END_PROCEDURE;
|
354
362
|
PROCEDURE assignment_simple_reference_statement;
|
355
363
|
test := TRUE;
|
356
364
|
END_PROCEDURE;
|
357
|
-
PROCEDURE assignment_attribute_reference_statement;
|
358
|
-
test.test := TRUE;
|
359
|
-
END_PROCEDURE;
|
360
365
|
PROCEDURE assignment_group_reference_statement;
|
361
|
-
test\
|
366
|
+
test\test2 := TRUE;
|
362
367
|
END_PROCEDURE;
|
363
368
|
PROCEDURE assignment_index_reference_statement;
|
364
369
|
test[1] := TRUE;
|
@@ -366,6 +371,9 @@ PROCEDURE statements;
|
|
366
371
|
PROCEDURE assignment_index2_reference_statement;
|
367
372
|
test[1:9] := TRUE;
|
368
373
|
END_PROCEDURE;
|
374
|
+
PROCEDURE assignment_attribute_reference_statement;
|
375
|
+
test.test2 := TRUE;
|
376
|
+
END_PROCEDURE;
|
369
377
|
PROCEDURE case_statement;
|
370
378
|
CASE test OF
|
371
379
|
TRUE :
|
@@ -651,7 +659,7 @@ PROCEDURE expressions;
|
|
651
659
|
and_or_expression : BOOLEAN := TRUE AND FALSE OR TRUE;
|
652
660
|
parenthesis_or_and_expression : BOOLEAN := (TRUE OR FALSE) AND TRUE;
|
653
661
|
and_parenthesis_or_expression : BOOLEAN := TRUE AND (FALSE OR TRUE);
|
654
|
-
combine_expression : BOOLEAN := test ||
|
662
|
+
combine_expression : BOOLEAN := test || test2;
|
655
663
|
in_expression : BOOLEAN := TRUE IN [TRUE];
|
656
664
|
like_expression : BOOLEAN := 'xxx' LIKE 'xxx';
|
657
665
|
aggregate_initializer_expression : BOOLEAN := [4];
|
@@ -659,11 +667,11 @@ PROCEDURE expressions;
|
|
659
667
|
complex_aggregate_initializer_expression : BOOLEAN := [4 + 2];
|
660
668
|
complex_repeated_aggregate_initializer_expression : BOOLEAN := [4 + 2:4 + 2];
|
661
669
|
call_expression : BOOLEAN := parameter_function(TRUE);
|
662
|
-
simple_reference_expression : BOOLEAN :=
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
670
|
+
simple_reference_expression : BOOLEAN := test;
|
671
|
+
group_reference_expression : BOOLEAN := test\test2;
|
672
|
+
index_reference_expression : BOOLEAN := test[1];
|
673
|
+
index2_reference_expression : BOOLEAN := test[1:9];
|
674
|
+
attribute_reference_expression : BOOLEAN := test.test2;
|
667
675
|
lt_lt_interval_expression : BOOLEAN := {1 < 5 < 9};
|
668
676
|
lte_lt_interval_expression : BOOLEAN := {1 <= 5 < 9};
|
669
677
|
lt_lte_interval_expression : BOOLEAN := {1 < 5 <= 9};
|
@@ -4,8 +4,8 @@ require "expressir/express_exp/formatter"
|
|
4
4
|
|
5
5
|
RSpec.describe Expressir::ExpressExp::Formatter do
|
6
6
|
describe ".format" do
|
7
|
-
it "formats
|
8
|
-
repo = Expressir::ExpressExp::Parser.
|
7
|
+
it "formats remark" do
|
8
|
+
repo = Expressir::ExpressExp::Parser.from_file(input_file)
|
9
9
|
|
10
10
|
result = Expressir::ExpressExp::Formatter.format(repo)
|
11
11
|
expected_result = File.read(output_file)
|
@@ -4,8 +4,8 @@ require "expressir/express_exp/formatter"
|
|
4
4
|
|
5
5
|
RSpec.describe Expressir::ExpressExp::Formatter do
|
6
6
|
describe ".format" do
|
7
|
-
it "formats
|
8
|
-
repo = Expressir::ExpressExp::Parser.
|
7
|
+
it "formats syntax" do
|
8
|
+
repo = Expressir::ExpressExp::Parser.from_file(input_file)
|
9
9
|
|
10
10
|
result = Expressir::ExpressExp::Formatter.format(repo)
|
11
11
|
expected_result = File.read(output_file)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
require "expressir/express_exp/formatter"
|
4
|
+
require "expressir/express_exp/hyperlink_formatter"
|
5
|
+
|
6
|
+
RSpec.describe Expressir::ExpressExp::HyperlinkFormatter do
|
7
|
+
describe ".format" do
|
8
|
+
it "formats hyperlink" do
|
9
|
+
repo = Expressir::ExpressExp::Parser.from_file(input_file)
|
10
|
+
|
11
|
+
class CustomFormatter < Expressir::ExpressExp::Formatter
|
12
|
+
include Expressir::ExpressExp::HyperlinkFormatter
|
13
|
+
end
|
14
|
+
result = CustomFormatter.format(repo)
|
15
|
+
expected_result = File.read(output_file)
|
16
|
+
|
17
|
+
expect(result).to eq(expected_result)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def input_file
|
22
|
+
@input_file ||= Expressir.root_path.join("original", "examples", "syntax", "hyperlink.exp")
|
23
|
+
end
|
24
|
+
|
25
|
+
def output_file
|
26
|
+
@output_file ||= Expressir.root_path.join("original", "examples", "syntax", "hyperlink_formatted.exp")
|
27
|
+
end
|
28
|
+
end
|
@@ -3,15 +3,20 @@ require "expressir/express_exp/parser"
|
|
3
3
|
|
4
4
|
RSpec.describe Expressir::ExpressExp::Parser do
|
5
5
|
describe ".from_files" do
|
6
|
-
it "
|
6
|
+
it "parses multiple files" do
|
7
7
|
repo = Expressir::ExpressExp::Parser.from_files(sample_files)
|
8
8
|
|
9
9
|
schemas = repo.schemas
|
10
10
|
expect(schemas.count).to eq(5)
|
11
|
+
expect(schemas[0].file).to eq(sample_files[0])
|
11
12
|
expect(schemas[0].id).to eq("syntax_schema")
|
13
|
+
expect(schemas[1].file).to eq(sample_files[1])
|
12
14
|
expect(schemas[1].id).to eq("remark_schema")
|
15
|
+
expect(schemas[2].file).to eq(sample_files[2])
|
13
16
|
expect(schemas[2].id).to eq("entity_schema")
|
17
|
+
expect(schemas[3].file).to eq(sample_files[2])
|
14
18
|
expect(schemas[3].id).to eq("version_entity_schema")
|
19
|
+
expect(schemas[4].file).to eq(sample_files[2])
|
15
20
|
expect(schemas[4].id).to eq("version_interface_entity_schema")
|
16
21
|
end
|
17
22
|
end
|
@@ -3,8 +3,8 @@ require "expressir/express_exp/parser"
|
|
3
3
|
|
4
4
|
RSpec.describe Expressir::ExpressExp::Parser do
|
5
5
|
describe ".from_file" do
|
6
|
-
it "
|
7
|
-
repo = Expressir::ExpressExp::Parser.
|
6
|
+
it "parses remark" do
|
7
|
+
repo = Expressir::ExpressExp::Parser.from_file(sample_file)
|
8
8
|
|
9
9
|
schema = repo.schemas.first
|
10
10
|
|
@@ -5,7 +5,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
5
5
|
describe ".source" do
|
6
6
|
it "contains original source" do
|
7
7
|
input = File.read(sample_file)
|
8
|
-
repo = Expressir::ExpressExp::Parser.
|
8
|
+
repo = Expressir::ExpressExp::Parser.from_file(sample_file)
|
9
9
|
|
10
10
|
schema = repo.schemas.first
|
11
11
|
start_index = input.index("SCHEMA")
|
@@ -3,8 +3,8 @@ require "expressir/express_exp/parser"
|
|
3
3
|
|
4
4
|
RSpec.describe Expressir::ExpressExp::Parser do
|
5
5
|
describe ".from_file" do
|
6
|
-
it "
|
7
|
-
repo = Expressir::ExpressExp::Parser.
|
6
|
+
it "parses syntax" do
|
7
|
+
repo = Expressir::ExpressExp::Parser.from_file(sample_file)
|
8
8
|
|
9
9
|
schemas = repo.schemas
|
10
10
|
|
@@ -36,8 +36,9 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
36
36
|
expect(x.schema.id).to eq("contract_schema")
|
37
37
|
expect(x.items).to be_instance_of(Array)
|
38
38
|
expect(x.items.count).to eq(1)
|
39
|
-
expect(x.items[0]).to be_instance_of(Expressir::Model::
|
40
|
-
expect(x.items[0].
|
39
|
+
expect(x.items[0]).to be_instance_of(Expressir::Model::InterfaceItem)
|
40
|
+
expect(x.items[0].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
41
|
+
expect(x.items[0].ref.id).to eq("contract")
|
41
42
|
end
|
42
43
|
|
43
44
|
interfaces[2].tap do |x|
|
@@ -47,10 +48,12 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
47
48
|
expect(x.schema.id).to eq("contract_schema")
|
48
49
|
expect(x.items).to be_instance_of(Array)
|
49
50
|
expect(x.items.count).to eq(2)
|
50
|
-
expect(x.items[0]).to be_instance_of(Expressir::Model::
|
51
|
-
expect(x.items[0].
|
52
|
-
expect(x.items[
|
53
|
-
expect(x.items[1]
|
51
|
+
expect(x.items[0]).to be_instance_of(Expressir::Model::InterfaceItem)
|
52
|
+
expect(x.items[0].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
53
|
+
expect(x.items[0].ref.id).to eq("contract")
|
54
|
+
expect(x.items[1]).to be_instance_of(Expressir::Model::InterfaceItem)
|
55
|
+
expect(x.items[1].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
56
|
+
expect(x.items[1].ref.id).to eq("contract2")
|
54
57
|
end
|
55
58
|
|
56
59
|
interfaces[3].tap do |x|
|
@@ -60,10 +63,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
60
63
|
expect(x.schema.id).to eq("contract_schema")
|
61
64
|
expect(x.items).to be_instance_of(Array)
|
62
65
|
expect(x.items.count).to eq(1)
|
63
|
-
expect(x.items[0]).to be_instance_of(Expressir::Model::
|
66
|
+
expect(x.items[0]).to be_instance_of(Expressir::Model::InterfaceItem)
|
67
|
+
expect(x.items[0].id).to eq("contract2")
|
64
68
|
expect(x.items[0].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
65
69
|
expect(x.items[0].ref.id).to eq("contract")
|
66
|
-
expect(x.items[0].id).to eq("contract2")
|
67
70
|
end
|
68
71
|
|
69
72
|
interfaces[4].tap do |x|
|
@@ -80,8 +83,9 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
80
83
|
expect(x.schema.id).to eq("contract_schema")
|
81
84
|
expect(x.items).to be_instance_of(Array)
|
82
85
|
expect(x.items.count).to eq(1)
|
83
|
-
expect(x.items[0]).to be_instance_of(Expressir::Model::
|
84
|
-
expect(x.items[0].
|
86
|
+
expect(x.items[0]).to be_instance_of(Expressir::Model::InterfaceItem)
|
87
|
+
expect(x.items[0].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
88
|
+
expect(x.items[0].ref.id).to eq("contract")
|
85
89
|
end
|
86
90
|
|
87
91
|
interfaces[6].tap do |x|
|
@@ -91,10 +95,12 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
91
95
|
expect(x.schema.id).to eq("contract_schema")
|
92
96
|
expect(x.items).to be_instance_of(Array)
|
93
97
|
expect(x.items.count).to eq(2)
|
94
|
-
expect(x.items[0]).to be_instance_of(Expressir::Model::
|
95
|
-
expect(x.items[0].
|
96
|
-
expect(x.items[
|
97
|
-
expect(x.items[1]
|
98
|
+
expect(x.items[0]).to be_instance_of(Expressir::Model::InterfaceItem)
|
99
|
+
expect(x.items[0].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
100
|
+
expect(x.items[0].ref.id).to eq("contract")
|
101
|
+
expect(x.items[1]).to be_instance_of(Expressir::Model::InterfaceItem)
|
102
|
+
expect(x.items[1].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
103
|
+
expect(x.items[1].ref.id).to eq("contract2")
|
98
104
|
end
|
99
105
|
|
100
106
|
interfaces[7].tap do |x|
|
@@ -104,10 +110,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
104
110
|
expect(x.schema.id).to eq("contract_schema")
|
105
111
|
expect(x.items).to be_instance_of(Array)
|
106
112
|
expect(x.items.count).to eq(1)
|
107
|
-
expect(x.items[0]).to be_instance_of(Expressir::Model::
|
113
|
+
expect(x.items[0]).to be_instance_of(Expressir::Model::InterfaceItem)
|
114
|
+
expect(x.items[0].id).to eq("contract2")
|
108
115
|
expect(x.items[0].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
109
116
|
expect(x.items[0].ref.id).to eq("contract")
|
110
|
-
expect(x.items[0].id).to eq("contract2")
|
111
117
|
end
|
112
118
|
|
113
119
|
# constants
|
@@ -242,6 +248,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
242
248
|
|
243
249
|
entities.find{|x| x.id == "attribute_redeclared_entity"}.tap do |x|
|
244
250
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
251
|
+
expect(x.subtype_of).to be_instance_of(Array)
|
252
|
+
expect(x.subtype_of.count).to eq(1)
|
253
|
+
expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
254
|
+
expect(x.subtype_of[0].id).to eq("attribute_entity")
|
245
255
|
expect(x.attributes).to be_instance_of(Array)
|
246
256
|
expect(x.attributes.count).to eq(1)
|
247
257
|
expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
|
@@ -259,6 +269,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
259
269
|
|
260
270
|
entities.find{|x| x.id == "attribute_redeclared_renamed_entity"}.tap do |x|
|
261
271
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
272
|
+
expect(x.subtype_of).to be_instance_of(Array)
|
273
|
+
expect(x.subtype_of.count).to eq(1)
|
274
|
+
expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
275
|
+
expect(x.subtype_of[0].id).to eq("attribute_entity")
|
262
276
|
expect(x.attributes).to be_instance_of(Array)
|
263
277
|
expect(x.attributes.count).to eq(1)
|
264
278
|
expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
|
@@ -289,6 +303,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
289
303
|
|
290
304
|
entities.find{|x| x.id == "derived_attribute_redeclared_entity"}.tap do |x|
|
291
305
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
306
|
+
expect(x.subtype_of).to be_instance_of(Array)
|
307
|
+
expect(x.subtype_of.count).to eq(1)
|
308
|
+
expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
309
|
+
expect(x.subtype_of[0].id).to eq("attribute_entity")
|
292
310
|
expect(x.attributes).to be_instance_of(Array)
|
293
311
|
expect(x.attributes.count).to eq(1)
|
294
312
|
expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
|
@@ -308,6 +326,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
308
326
|
|
309
327
|
entities.find{|x| x.id == "derived_attribute_redeclared_renamed_entity"}.tap do |x|
|
310
328
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
329
|
+
expect(x.subtype_of).to be_instance_of(Array)
|
330
|
+
expect(x.subtype_of.count).to eq(1)
|
331
|
+
expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
332
|
+
expect(x.subtype_of[0].id).to eq("attribute_entity")
|
311
333
|
expect(x.attributes).to be_instance_of(Array)
|
312
334
|
expect(x.attributes.count).to eq(1)
|
313
335
|
expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
|
@@ -421,6 +443,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
421
443
|
|
422
444
|
entities.find{|x| x.id == "inverse_attribute_redeclared_entity"}.tap do |x|
|
423
445
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
446
|
+
expect(x.subtype_of).to be_instance_of(Array)
|
447
|
+
expect(x.subtype_of.count).to eq(1)
|
448
|
+
expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
449
|
+
expect(x.subtype_of[0].id).to eq("attribute_entity")
|
424
450
|
expect(x.attributes).to be_instance_of(Array)
|
425
451
|
expect(x.attributes.count).to eq(1)
|
426
452
|
expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
|
@@ -441,6 +467,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
441
467
|
|
442
468
|
entities.find{|x| x.id == "inverse_attribute_redeclared_renamed_entity"}.tap do |x|
|
443
469
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
470
|
+
expect(x.subtype_of).to be_instance_of(Array)
|
471
|
+
expect(x.subtype_of.count).to eq(1)
|
472
|
+
expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
473
|
+
expect(x.subtype_of[0].id).to eq("attribute_entity")
|
444
474
|
expect(x.attributes).to be_instance_of(Array)
|
445
475
|
expect(x.attributes.count).to eq(1)
|
446
476
|
expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
|
@@ -495,8 +525,12 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
495
525
|
expect(x.unique[0].attributes[0].id).to eq("test")
|
496
526
|
end
|
497
527
|
|
498
|
-
entities.find{|x| x.id == "
|
528
|
+
entities.find{|x| x.id == "unique_redeclared_entity"}.tap do |x|
|
499
529
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
530
|
+
expect(x.subtype_of).to be_instance_of(Array)
|
531
|
+
expect(x.subtype_of.count).to eq(1)
|
532
|
+
expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
533
|
+
expect(x.subtype_of[0].id).to eq("attribute_entity")
|
500
534
|
expect(x.unique).to be_instance_of(Array)
|
501
535
|
expect(x.unique.count).to eq(1)
|
502
536
|
expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
|
@@ -524,8 +558,12 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
524
558
|
expect(x.unique[0].attributes[0].id).to eq("test")
|
525
559
|
end
|
526
560
|
|
527
|
-
entities.find{|x| x.id == "
|
561
|
+
entities.find{|x| x.id == "unique_label_redeclared_entity"}.tap do |x|
|
528
562
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
563
|
+
expect(x.subtype_of).to be_instance_of(Array)
|
564
|
+
expect(x.subtype_of.count).to eq(1)
|
565
|
+
expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
566
|
+
expect(x.subtype_of[0].id).to eq("attribute_entity")
|
529
567
|
expect(x.unique).to be_instance_of(Array)
|
530
568
|
expect(x.unique.count).to eq(1)
|
531
569
|
expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
|
@@ -1489,19 +1527,6 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
1489
1527
|
expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
|
1490
1528
|
end
|
1491
1529
|
|
1492
|
-
x.procedures.find{|x| x.id == "alias_attribute_reference_statement"}.statements[0].tap do |x|
|
1493
|
-
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
1494
|
-
expect(x.id).to eq("test")
|
1495
|
-
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
|
1496
|
-
expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1497
|
-
expect(x.expression.ref.id).to eq("test")
|
1498
|
-
expect(x.expression.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1499
|
-
expect(x.expression.attribute.id).to eq("test")
|
1500
|
-
expect(x.statements).to be_instance_of(Array)
|
1501
|
-
expect(x.statements.count).to eq(1)
|
1502
|
-
expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
|
1503
|
-
end
|
1504
|
-
|
1505
1530
|
x.procedures.find{|x| x.id == "alias_group_reference_statement"}.statements[0].tap do |x|
|
1506
1531
|
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
1507
1532
|
expect(x.id).to eq("test")
|
@@ -1509,7 +1534,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
1509
1534
|
expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1510
1535
|
expect(x.expression.ref.id).to eq("test")
|
1511
1536
|
expect(x.expression.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1512
|
-
expect(x.expression.entity.id).to eq("
|
1537
|
+
expect(x.expression.entity.id).to eq("test2")
|
1513
1538
|
expect(x.statements).to be_instance_of(Array)
|
1514
1539
|
expect(x.statements.count).to eq(1)
|
1515
1540
|
expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
|
@@ -1543,6 +1568,19 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
1543
1568
|
expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
|
1544
1569
|
end
|
1545
1570
|
|
1571
|
+
x.procedures.find{|x| x.id == "alias_attribute_reference_statement"}.statements[0].tap do |x|
|
1572
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
1573
|
+
expect(x.id).to eq("test")
|
1574
|
+
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
|
1575
|
+
expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1576
|
+
expect(x.expression.ref.id).to eq("test")
|
1577
|
+
expect(x.expression.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1578
|
+
expect(x.expression.attribute.id).to eq("test2")
|
1579
|
+
expect(x.statements).to be_instance_of(Array)
|
1580
|
+
expect(x.statements.count).to eq(1)
|
1581
|
+
expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
|
1582
|
+
end
|
1583
|
+
|
1546
1584
|
x.procedures.find{|x| x.id == "assignment_simple_reference_statement"}.statements[0].tap do |x|
|
1547
1585
|
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
1548
1586
|
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
@@ -1551,24 +1589,13 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
1551
1589
|
expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
|
1552
1590
|
end
|
1553
1591
|
|
1554
|
-
x.procedures.find{|x| x.id == "assignment_attribute_reference_statement"}.statements[0].tap do |x|
|
1555
|
-
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
1556
|
-
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
|
1557
|
-
expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1558
|
-
expect(x.ref.ref.id).to eq("test")
|
1559
|
-
expect(x.ref.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1560
|
-
expect(x.ref.attribute.id).to eq("test")
|
1561
|
-
expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
|
1562
|
-
expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
|
1563
|
-
end
|
1564
|
-
|
1565
1592
|
x.procedures.find{|x| x.id == "assignment_group_reference_statement"}.statements[0].tap do |x|
|
1566
1593
|
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
1567
1594
|
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
|
1568
1595
|
expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1569
1596
|
expect(x.ref.ref.id).to eq("test")
|
1570
1597
|
expect(x.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1571
|
-
expect(x.ref.entity.id).to eq("
|
1598
|
+
expect(x.ref.entity.id).to eq("test2")
|
1572
1599
|
expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
|
1573
1600
|
expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
|
1574
1601
|
end
|
@@ -1597,6 +1624,17 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
1597
1624
|
expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
|
1598
1625
|
end
|
1599
1626
|
|
1627
|
+
x.procedures.find{|x| x.id == "assignment_attribute_reference_statement"}.statements[0].tap do |x|
|
1628
|
+
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
1629
|
+
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
|
1630
|
+
expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1631
|
+
expect(x.ref.ref.id).to eq("test")
|
1632
|
+
expect(x.ref.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
1633
|
+
expect(x.ref.attribute.id).to eq("test2")
|
1634
|
+
expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
|
1635
|
+
expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
|
1636
|
+
end
|
1637
|
+
|
1600
1638
|
x.procedures.find{|x| x.id == "case_statement"}.statements[0].tap do |x|
|
1601
1639
|
expect(x).to be_instance_of(Expressir::Model::Statements::Case)
|
1602
1640
|
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
@@ -2911,29 +2949,21 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
2911
2949
|
# reference expressions
|
2912
2950
|
x.variables.find{|x| x.id == "simple_reference_expression"}.expression.tap do |x|
|
2913
2951
|
expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2914
|
-
expect(x.id).to eq("
|
2915
|
-
end
|
2916
|
-
|
2917
|
-
x.variables.find{|x| x.id == "attribute_reference_expression"}.expression.tap do |x|
|
2918
|
-
expect(x).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
|
2919
|
-
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2920
|
-
expect(x.ref.id).to eq("simple_string_expression")
|
2921
|
-
expect(x.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2922
|
-
expect(x.attribute.id).to eq("test")
|
2952
|
+
expect(x.id).to eq("test")
|
2923
2953
|
end
|
2924
2954
|
|
2925
2955
|
x.variables.find{|x| x.id == "group_reference_expression"}.expression.tap do |x|
|
2926
2956
|
expect(x).to be_instance_of(Expressir::Model::Expressions::GroupReference)
|
2927
2957
|
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2928
|
-
expect(x.ref.id).to eq("
|
2958
|
+
expect(x.ref.id).to eq("test")
|
2929
2959
|
expect(x.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2930
|
-
expect(x.entity.id).to eq("
|
2960
|
+
expect(x.entity.id).to eq("test2")
|
2931
2961
|
end
|
2932
2962
|
|
2933
2963
|
x.variables.find{|x| x.id == "index_reference_expression"}.expression.tap do |x|
|
2934
2964
|
expect(x).to be_instance_of(Expressir::Model::Expressions::IndexReference)
|
2935
2965
|
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2936
|
-
expect(x.ref.id).to eq("
|
2966
|
+
expect(x.ref.id).to eq("test")
|
2937
2967
|
expect(x.index1).to be_instance_of(Expressir::Model::Literals::Integer)
|
2938
2968
|
expect(x.index1.value).to eq("1")
|
2939
2969
|
end
|
@@ -2941,13 +2971,21 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
2941
2971
|
x.variables.find{|x| x.id == "index2_reference_expression"}.expression.tap do |x|
|
2942
2972
|
expect(x).to be_instance_of(Expressir::Model::Expressions::IndexReference)
|
2943
2973
|
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2944
|
-
expect(x.ref.id).to eq("
|
2974
|
+
expect(x.ref.id).to eq("test")
|
2945
2975
|
expect(x.index1).to be_instance_of(Expressir::Model::Literals::Integer)
|
2946
2976
|
expect(x.index1.value).to eq("1")
|
2947
2977
|
expect(x.index2).to be_instance_of(Expressir::Model::Literals::Integer)
|
2948
2978
|
expect(x.index2.value).to eq("9")
|
2949
2979
|
end
|
2950
2980
|
|
2981
|
+
x.variables.find{|x| x.id == "attribute_reference_expression"}.expression.tap do |x|
|
2982
|
+
expect(x).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
|
2983
|
+
expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2984
|
+
expect(x.ref.id).to eq("test")
|
2985
|
+
expect(x.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
2986
|
+
expect(x.attribute.id).to eq("test2")
|
2987
|
+
end
|
2988
|
+
|
2951
2989
|
# interval expressions
|
2952
2990
|
x.variables.find{|x| x.id == "lt_lt_interval_expression"}.expression.tap do |x|
|
2953
2991
|
expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
|
@@ -3003,7 +3041,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
3003
3041
|
expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
3004
3042
|
expect(x.operand1.id).to eq("test")
|
3005
3043
|
expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
|
3006
|
-
expect(x.operand2.id).to eq("
|
3044
|
+
expect(x.operand2.id).to eq("test2")
|
3007
3045
|
end
|
3008
3046
|
|
3009
3047
|
x.variables.find{|x| x.id == "in_expression"}.expression.tap do |x|
|