expressir 0.2.15-x86-mingw32 → 0.2.21-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +5 -0
- data/.github/workflows/release.yml +16 -4
- data/README.adoc +3 -3
- data/exe/format +66 -12
- 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/cache.rb +48 -0
- data/lib/expressir/express_exp/formatter.rb +185 -135
- data/lib/expressir/express_exp/hyperlink_formatter.rb +1 -3
- data/lib/expressir/express_exp/parser.rb +33 -29
- data/lib/expressir/express_exp/schema_head_formatter.rb +2 -7
- data/lib/expressir/express_exp/visitor.rb +11 -30
- data/lib/expressir/model.rb +2 -0
- data/lib/expressir/model/cache.rb +13 -0
- data/lib/expressir/model/entity.rb +6 -6
- data/lib/expressir/model/expressions/query_expression.rb +3 -3
- data/lib/expressir/model/function.rb +15 -11
- data/lib/expressir/model/informal_proposition.rb +4 -1
- data/lib/expressir/model/interfaced_item.rb +4 -1
- data/lib/expressir/model/model_element.rb +43 -13
- data/lib/expressir/model/procedure.rb +15 -11
- data/lib/expressir/model/repository.rb +3 -3
- data/lib/expressir/model/rule.rb +16 -12
- data/lib/expressir/model/schema.rb +52 -48
- data/lib/expressir/model/statements/alias.rb +3 -3
- data/lib/expressir/model/statements/repeat.rb +3 -3
- data/lib/expressir/model/subtype_constraint.rb +1 -6
- data/lib/expressir/model/type.rb +9 -5
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/{hyperlink.exp → multiple.exp} +8 -8
- data/original/examples/syntax/multiple.yaml +184 -0
- data/original/examples/syntax/multiple_formatted.exp +71 -0
- data/original/examples/syntax/multiple_hyperlink_formatted.exp +71 -0
- data/original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp +13 -0
- data/original/examples/syntax/remark.exp +41 -41
- data/original/examples/syntax/remark.yaml +446 -0
- data/original/examples/syntax/remark_formatted.exp +62 -50
- data/original/examples/syntax/{simple.exp → single.exp} +1 -1
- data/original/examples/syntax/single.yaml +9 -0
- data/original/examples/syntax/single_formatted.exp +6 -0
- data/original/examples/syntax/single_formatted.yaml +19 -0
- data/original/examples/syntax/syntax.exp +29 -19
- data/original/examples/syntax/syntax.yaml +3439 -0
- data/original/examples/syntax/syntax_formatted.exp +271 -131
- data/original/examples/syntax/syntax_schema_head_formatted.exp +18 -0
- data/spec/expressir/express_exp/cache_spec.rb +64 -0
- data/spec/expressir/express_exp/formatter_spec.rb +111 -0
- data/spec/expressir/express_exp/parser_spec.rb +98 -0
- data/spec/expressir/model/{model_element/find_spec.rb → model_element_spec.rb} +96 -10
- metadata +20 -17
- data/original/examples/syntax/hyperlink_formatted.exp +0 -51
- data/original/examples/syntax/source.exp +0 -16
- data/spec/expressir/express_exp/formatter/remark_spec.rb +0 -28
- data/spec/expressir/express_exp/formatter/syntax_spec.rb +0 -28
- data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +0 -24
- data/spec/expressir/express_exp/parser/head_source_spec.rb +0 -38
- data/spec/expressir/express_exp/parser/multiple_spec.rb +0 -37
- data/spec/expressir/express_exp/parser/remark_spec.rb +0 -411
- data/spec/expressir/express_exp/parser/source_spec.rb +0 -29
- data/spec/expressir/express_exp/parser/syntax_spec.rb +0 -3086
- data/spec/expressir/express_exp/schema_head_formatter_spec.rb +0 -36
- data/spec/expressir/model/model_element/hash_spec.rb +0 -66
@@ -31,18 +31,22 @@ module Expressir
|
|
31
31
|
super
|
32
32
|
end
|
33
33
|
|
34
|
+
def enumeration_items
|
35
|
+
types.flat_map{|x| x.enumeration_items}
|
36
|
+
end
|
37
|
+
|
34
38
|
def children
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
[
|
40
|
+
*parameters,
|
41
|
+
*types,
|
42
|
+
*enumeration_items,
|
43
|
+
*entities,
|
44
|
+
*subtype_constraints,
|
45
|
+
*functions,
|
46
|
+
*procedures,
|
47
|
+
*constants,
|
48
|
+
*variables
|
49
|
+
]
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
data/lib/expressir/model/rule.rb
CHANGED
@@ -35,19 +35,23 @@ module Expressir
|
|
35
35
|
super
|
36
36
|
end
|
37
37
|
|
38
|
+
def enumeration_items
|
39
|
+
types.flat_map{|x| x.enumeration_items}
|
40
|
+
end
|
41
|
+
|
38
42
|
def children
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
[
|
44
|
+
*types,
|
45
|
+
*enumeration_items,
|
46
|
+
*entities,
|
47
|
+
*subtype_constraints,
|
48
|
+
*functions,
|
49
|
+
*procedures,
|
50
|
+
*constants,
|
51
|
+
*variables,
|
52
|
+
*where,
|
53
|
+
*informal_propositions
|
54
|
+
]
|
51
55
|
end
|
52
56
|
end
|
53
57
|
end
|
@@ -5,8 +5,6 @@ module Expressir
|
|
5
5
|
|
6
6
|
include Identifier
|
7
7
|
|
8
|
-
attr_accessor :head_source
|
9
|
-
|
10
8
|
attr_accessor :version
|
11
9
|
attr_accessor :interfaces
|
12
10
|
attr_accessor :constants
|
@@ -14,8 +12,8 @@ module Expressir
|
|
14
12
|
attr_accessor :entities
|
15
13
|
attr_accessor :subtype_constraints
|
16
14
|
attr_accessor :functions
|
17
|
-
attr_accessor :procedures
|
18
15
|
attr_accessor :rules
|
16
|
+
attr_accessor :procedures
|
19
17
|
|
20
18
|
def initialize(options = {})
|
21
19
|
@file = options[:file]
|
@@ -23,7 +21,6 @@ module Expressir
|
|
23
21
|
@id = options[:id]
|
24
22
|
@remarks = options.fetch(:remarks, [])
|
25
23
|
@source = options[:source]
|
26
|
-
@head_source = options[:head_source]
|
27
24
|
|
28
25
|
@version = options[:version]
|
29
26
|
@interfaces = options.fetch(:interfaces, [])
|
@@ -32,60 +29,67 @@ module Expressir
|
|
32
29
|
@entities = options.fetch(:entities, [])
|
33
30
|
@subtype_constraints = options.fetch(:subtype_constraints, [])
|
34
31
|
@functions = options.fetch(:functions, [])
|
35
|
-
@procedures = options.fetch(:procedures, [])
|
36
32
|
@rules = options.fetch(:rules, [])
|
33
|
+
@procedures = options.fetch(:procedures, [])
|
37
34
|
|
38
35
|
super
|
39
36
|
end
|
40
37
|
|
41
|
-
def
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
if interface.items.length > 0
|
50
|
-
interface.items.map do |item|
|
51
|
-
ref_id = item.ref.id.downcase
|
52
|
-
id = item.id || ref_id
|
53
|
-
base_item = schema_children.find{|x| x.id and x.id.downcase == ref_id}
|
54
|
-
|
55
|
-
interfaced_item = InterfacedItem.new({
|
56
|
-
id: id
|
57
|
-
})
|
58
|
-
interfaced_item.base_item = base_item # skip overriding parent
|
59
|
-
interfaced_item.parent = self
|
60
|
-
interfaced_item
|
61
|
-
end
|
62
|
-
else
|
63
|
-
schema_children.map do |item|
|
64
|
-
id = item.id
|
65
|
-
base_item = item
|
38
|
+
def create_interfaced_item(id, base_item)
|
39
|
+
interfaced_item = InterfacedItem.new({
|
40
|
+
id: id
|
41
|
+
})
|
42
|
+
interfaced_item.base_item = base_item # skip overriding parent
|
43
|
+
interfaced_item.parent = self
|
44
|
+
interfaced_item
|
45
|
+
end
|
66
46
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
47
|
+
def interfaced_items
|
48
|
+
interfaces.flat_map do |interface|
|
49
|
+
schema = parent.children_by_id[interface.schema.id.downcase]
|
50
|
+
if schema
|
51
|
+
schema_safe_children = schema.safe_children
|
52
|
+
schema_safe_children_by_id = schema_safe_children.select{|x| x.id}.map{|x| [x.id.downcase, x]}.to_h
|
53
|
+
if interface.items.length > 0
|
54
|
+
interface.items.map do |interface_item|
|
55
|
+
base_item = schema_safe_children_by_id[interface_item.ref.id.downcase]
|
56
|
+
if base_item
|
57
|
+
id = interface_item.id || base_item.id
|
58
|
+
create_interfaced_item(id, base_item)
|
73
59
|
end
|
74
60
|
end
|
75
61
|
else
|
76
|
-
|
62
|
+
schema_safe_children.map do |base_item|
|
63
|
+
id = base_item.id
|
64
|
+
create_interfaced_item(id, base_item)
|
65
|
+
end
|
77
66
|
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
67
|
+
end
|
68
|
+
end.select{|x| x}
|
69
|
+
end
|
70
|
+
|
71
|
+
def enumeration_items
|
72
|
+
types.flat_map{|x| x.enumeration_items}
|
73
|
+
end
|
74
|
+
|
75
|
+
def safe_children
|
76
|
+
[
|
77
|
+
*constants,
|
78
|
+
*types,
|
79
|
+
*enumeration_items,
|
80
|
+
*entities,
|
81
|
+
*subtype_constraints,
|
82
|
+
*functions,
|
83
|
+
*rules,
|
84
|
+
*procedures
|
85
|
+
]
|
86
|
+
end
|
87
|
+
|
88
|
+
def children
|
89
|
+
[
|
90
|
+
*interfaced_items,
|
91
|
+
*safe_children
|
92
|
+
]
|
89
93
|
end
|
90
94
|
end
|
91
95
|
end
|
@@ -15,16 +15,11 @@ module Expressir
|
|
15
15
|
|
16
16
|
@applies_to = options[:applies_to]
|
17
17
|
@abstract = options[:abstract]
|
18
|
-
@total_over = options
|
18
|
+
@total_over = options.fetch(:total_over, [])
|
19
19
|
@supertype_expression = options[:supertype_expression]
|
20
20
|
|
21
21
|
super
|
22
22
|
end
|
23
|
-
|
24
|
-
def children
|
25
|
-
items = []
|
26
|
-
items
|
27
|
-
end
|
28
23
|
end
|
29
24
|
end
|
30
25
|
end
|
data/lib/expressir/model/type.rb
CHANGED
@@ -19,12 +19,16 @@ module Expressir
|
|
19
19
|
super
|
20
20
|
end
|
21
21
|
|
22
|
+
def enumeration_items
|
23
|
+
type.is_a?(Types::Enumeration) ? type.items : []
|
24
|
+
end
|
25
|
+
|
22
26
|
def children
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
[
|
28
|
+
*enumeration_items,
|
29
|
+
*where,
|
30
|
+
*informal_propositions
|
31
|
+
]
|
28
32
|
end
|
29
33
|
end
|
30
34
|
end
|
data/lib/expressir/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
SCHEMA
|
2
|
-
REFERENCE FROM
|
3
|
-
REFERENCE FROM
|
4
|
-
REFERENCE FROM
|
1
|
+
SCHEMA multiple_schema1;
|
2
|
+
REFERENCE FROM multiple_schema2;
|
3
|
+
REFERENCE FROM multiple_schema3 (attribute_entity3);
|
4
|
+
REFERENCE FROM multiple_schema4 (attribute_entity AS attribute_entity4);
|
5
5
|
ENTITY test; END_ENTITY;
|
6
6
|
ENTITY empty_entity; END_ENTITY;
|
7
7
|
ENTITY attribute_entity; test : BOOLEAN; END_ENTITY;
|
@@ -12,12 +12,12 @@ ENTITY subtype_attribute_entity3 SUBTYPE OF (attribute_entity3); SELF\attribute_
|
|
12
12
|
ENTITY subtype_attribute_entity4 SUBTYPE OF (attribute_entity4); SELF\attribute_entity4.test : BOOLEAN; END_ENTITY;
|
13
13
|
ENTITY subtype_missing_entity SUBTYPE OF (missing_entity); END_ENTITY;
|
14
14
|
END_SCHEMA;
|
15
|
-
SCHEMA
|
15
|
+
SCHEMA multiple_schema2;
|
16
16
|
ENTITY attribute_entity2; test : BOOLEAN; END_ENTITY;
|
17
17
|
END_SCHEMA;
|
18
|
-
SCHEMA
|
18
|
+
SCHEMA multiple_schema3;
|
19
19
|
ENTITY attribute_entity3; test : BOOLEAN; END_ENTITY;
|
20
20
|
END_SCHEMA;
|
21
|
-
SCHEMA
|
21
|
+
SCHEMA multiple_schema4;
|
22
22
|
ENTITY attribute_entity; test : BOOLEAN; END_ENTITY;
|
23
|
-
END_SCHEMA;
|
23
|
+
END_SCHEMA;
|
@@ -0,0 +1,184 @@
|
|
1
|
+
---
|
2
|
+
_class: Expressir::Model::Repository
|
3
|
+
schemas:
|
4
|
+
- _class: Expressir::Model::Schema
|
5
|
+
file: original/examples/syntax/multiple.exp
|
6
|
+
id: multiple_schema1
|
7
|
+
interfaces:
|
8
|
+
- _class: Expressir::Model::Interface
|
9
|
+
kind: :REFERENCE
|
10
|
+
schema:
|
11
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
12
|
+
id: multiple_schema2
|
13
|
+
- _class: Expressir::Model::Interface
|
14
|
+
kind: :REFERENCE
|
15
|
+
schema:
|
16
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
17
|
+
id: multiple_schema3
|
18
|
+
items:
|
19
|
+
- _class: Expressir::Model::InterfaceItem
|
20
|
+
ref:
|
21
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
22
|
+
id: attribute_entity3
|
23
|
+
- _class: Expressir::Model::Interface
|
24
|
+
kind: :REFERENCE
|
25
|
+
schema:
|
26
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
27
|
+
id: multiple_schema4
|
28
|
+
items:
|
29
|
+
- _class: Expressir::Model::InterfaceItem
|
30
|
+
ref:
|
31
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
32
|
+
id: attribute_entity
|
33
|
+
id: attribute_entity4
|
34
|
+
entities:
|
35
|
+
- _class: Expressir::Model::Entity
|
36
|
+
id: test
|
37
|
+
- _class: Expressir::Model::Entity
|
38
|
+
id: empty_entity
|
39
|
+
- _class: Expressir::Model::Entity
|
40
|
+
id: attribute_entity
|
41
|
+
attributes:
|
42
|
+
- _class: Expressir::Model::Attribute
|
43
|
+
id: test
|
44
|
+
kind: :EXPLICIT
|
45
|
+
type:
|
46
|
+
_class: Expressir::Model::Types::Boolean
|
47
|
+
- _class: Expressir::Model::Entity
|
48
|
+
id: subtype_empty_entity
|
49
|
+
subtype_of:
|
50
|
+
- _class: Expressir::Model::Expressions::SimpleReference
|
51
|
+
id: empty_entity
|
52
|
+
- _class: Expressir::Model::Entity
|
53
|
+
id: subtype_attribute_entity
|
54
|
+
subtype_of:
|
55
|
+
- _class: Expressir::Model::Expressions::SimpleReference
|
56
|
+
id: attribute_entity
|
57
|
+
attributes:
|
58
|
+
- _class: Expressir::Model::Attribute
|
59
|
+
kind: :EXPLICIT
|
60
|
+
supertype_attribute:
|
61
|
+
_class: Expressir::Model::Expressions::AttributeReference
|
62
|
+
ref:
|
63
|
+
_class: Expressir::Model::Expressions::GroupReference
|
64
|
+
ref:
|
65
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
66
|
+
id: SELF
|
67
|
+
entity:
|
68
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
69
|
+
id: attribute_entity
|
70
|
+
attribute:
|
71
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
72
|
+
id: test
|
73
|
+
type:
|
74
|
+
_class: Expressir::Model::Types::Boolean
|
75
|
+
- _class: Expressir::Model::Entity
|
76
|
+
id: subtype_attribute_entity2
|
77
|
+
subtype_of:
|
78
|
+
- _class: Expressir::Model::Expressions::SimpleReference
|
79
|
+
id: attribute_entity2
|
80
|
+
attributes:
|
81
|
+
- _class: Expressir::Model::Attribute
|
82
|
+
kind: :EXPLICIT
|
83
|
+
supertype_attribute:
|
84
|
+
_class: Expressir::Model::Expressions::AttributeReference
|
85
|
+
ref:
|
86
|
+
_class: Expressir::Model::Expressions::GroupReference
|
87
|
+
ref:
|
88
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
89
|
+
id: SELF
|
90
|
+
entity:
|
91
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
92
|
+
id: attribute_entity2
|
93
|
+
attribute:
|
94
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
95
|
+
id: test
|
96
|
+
type:
|
97
|
+
_class: Expressir::Model::Types::Boolean
|
98
|
+
- _class: Expressir::Model::Entity
|
99
|
+
id: subtype_attribute_entity3
|
100
|
+
subtype_of:
|
101
|
+
- _class: Expressir::Model::Expressions::SimpleReference
|
102
|
+
id: attribute_entity3
|
103
|
+
attributes:
|
104
|
+
- _class: Expressir::Model::Attribute
|
105
|
+
kind: :EXPLICIT
|
106
|
+
supertype_attribute:
|
107
|
+
_class: Expressir::Model::Expressions::AttributeReference
|
108
|
+
ref:
|
109
|
+
_class: Expressir::Model::Expressions::GroupReference
|
110
|
+
ref:
|
111
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
112
|
+
id: SELF
|
113
|
+
entity:
|
114
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
115
|
+
id: attribute_entity3
|
116
|
+
attribute:
|
117
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
118
|
+
id: test
|
119
|
+
type:
|
120
|
+
_class: Expressir::Model::Types::Boolean
|
121
|
+
- _class: Expressir::Model::Entity
|
122
|
+
id: subtype_attribute_entity4
|
123
|
+
subtype_of:
|
124
|
+
- _class: Expressir::Model::Expressions::SimpleReference
|
125
|
+
id: attribute_entity4
|
126
|
+
attributes:
|
127
|
+
- _class: Expressir::Model::Attribute
|
128
|
+
kind: :EXPLICIT
|
129
|
+
supertype_attribute:
|
130
|
+
_class: Expressir::Model::Expressions::AttributeReference
|
131
|
+
ref:
|
132
|
+
_class: Expressir::Model::Expressions::GroupReference
|
133
|
+
ref:
|
134
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
135
|
+
id: SELF
|
136
|
+
entity:
|
137
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
138
|
+
id: attribute_entity4
|
139
|
+
attribute:
|
140
|
+
_class: Expressir::Model::Expressions::SimpleReference
|
141
|
+
id: test
|
142
|
+
type:
|
143
|
+
_class: Expressir::Model::Types::Boolean
|
144
|
+
- _class: Expressir::Model::Entity
|
145
|
+
id: subtype_missing_entity
|
146
|
+
subtype_of:
|
147
|
+
- _class: Expressir::Model::Expressions::SimpleReference
|
148
|
+
id: missing_entity
|
149
|
+
- _class: Expressir::Model::Schema
|
150
|
+
file: original/examples/syntax/multiple.exp
|
151
|
+
id: multiple_schema2
|
152
|
+
entities:
|
153
|
+
- _class: Expressir::Model::Entity
|
154
|
+
id: attribute_entity2
|
155
|
+
attributes:
|
156
|
+
- _class: Expressir::Model::Attribute
|
157
|
+
id: test
|
158
|
+
kind: :EXPLICIT
|
159
|
+
type:
|
160
|
+
_class: Expressir::Model::Types::Boolean
|
161
|
+
- _class: Expressir::Model::Schema
|
162
|
+
file: original/examples/syntax/multiple.exp
|
163
|
+
id: multiple_schema3
|
164
|
+
entities:
|
165
|
+
- _class: Expressir::Model::Entity
|
166
|
+
id: attribute_entity3
|
167
|
+
attributes:
|
168
|
+
- _class: Expressir::Model::Attribute
|
169
|
+
id: test
|
170
|
+
kind: :EXPLICIT
|
171
|
+
type:
|
172
|
+
_class: Expressir::Model::Types::Boolean
|
173
|
+
- _class: Expressir::Model::Schema
|
174
|
+
file: original/examples/syntax/multiple.exp
|
175
|
+
id: multiple_schema4
|
176
|
+
entities:
|
177
|
+
- _class: Expressir::Model::Entity
|
178
|
+
id: attribute_entity
|
179
|
+
attributes:
|
180
|
+
- _class: Expressir::Model::Attribute
|
181
|
+
id: test
|
182
|
+
kind: :EXPLICIT
|
183
|
+
type:
|
184
|
+
_class: Expressir::Model::Types::Boolean
|