expressir 0.2.16-arm64-darwin → 0.2.24-arm64-darwin
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 +31 -3
- data/README.adoc +3 -3
- data/exe/format +66 -12
- 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/cache.rb +48 -0
- data/lib/expressir/express_exp/formatter.rb +185 -135
- data/lib/expressir/express_exp/parser.rb +33 -29
- data/lib/expressir/express_exp/schema_head_formatter.rb +1 -4
- data/lib/expressir/express_exp/visitor.rb +29 -23
- data/lib/expressir/model.rb +3 -1
- data/lib/expressir/model/attribute.rb +12 -5
- data/lib/expressir/model/cache.rb +13 -0
- data/lib/expressir/model/constant.rb +9 -2
- data/lib/expressir/model/entity.rb +15 -13
- data/lib/expressir/model/enumeration_item.rb +7 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +1 -1
- data/lib/expressir/model/expressions/aggregate_item.rb +2 -2
- data/lib/expressir/model/expressions/attribute_reference.rb +2 -2
- data/lib/expressir/model/expressions/binary_expression.rb +3 -3
- data/lib/expressir/model/expressions/call.rb +2 -2
- data/lib/expressir/model/expressions/entity_constructor.rb +2 -2
- data/lib/expressir/model/expressions/group_reference.rb +2 -2
- data/lib/expressir/model/expressions/index_reference.rb +3 -3
- data/lib/expressir/model/expressions/interval.rb +5 -5
- data/lib/expressir/model/expressions/query_expression.rb +7 -5
- data/lib/expressir/model/expressions/simple_reference.rb +1 -1
- data/lib/expressir/model/expressions/unary_expression.rb +2 -2
- data/lib/expressir/model/function.rb +27 -21
- data/lib/expressir/model/identifier.rb +6 -3
- data/lib/expressir/model/interface.rb +3 -3
- data/lib/expressir/model/interface_item.rb +2 -2
- data/lib/expressir/model/interfaced_item.rb +11 -3
- data/lib/expressir/model/literals/binary.rb +1 -1
- data/lib/expressir/model/literals/integer.rb +1 -1
- data/lib/expressir/model/literals/logical.rb +1 -1
- data/lib/expressir/model/literals/real.rb +1 -1
- data/lib/expressir/model/literals/string.rb +2 -2
- data/lib/expressir/model/model_element.rb +54 -19
- data/lib/expressir/model/parameter.rb +9 -2
- data/lib/expressir/model/procedure.rb +26 -20
- data/lib/expressir/model/{informal_proposition.rb → remark_item.rb} +3 -3
- data/lib/expressir/model/repository.rb +4 -4
- data/lib/expressir/model/rule.rb +29 -23
- data/lib/expressir/model/schema.rb +63 -54
- data/lib/expressir/model/statements/alias.rb +7 -5
- data/lib/expressir/model/statements/assignment.rb +2 -2
- data/lib/expressir/model/statements/call.rb +2 -2
- data/lib/expressir/model/statements/case.rb +3 -3
- data/lib/expressir/model/statements/case_action.rb +2 -2
- data/lib/expressir/model/statements/compound.rb +1 -1
- data/lib/expressir/model/statements/if.rb +3 -3
- data/lib/expressir/model/statements/repeat.rb +11 -9
- data/lib/expressir/model/statements/return.rb +1 -1
- data/lib/expressir/model/subtype_constraint.rb +9 -7
- data/lib/expressir/model/type.rb +14 -8
- data/lib/expressir/model/types/aggregate.rb +8 -1
- data/lib/expressir/model/types/array.rb +5 -5
- data/lib/expressir/model/types/bag.rb +3 -3
- data/lib/expressir/model/types/binary.rb +2 -2
- data/lib/expressir/model/types/enumeration.rb +4 -4
- data/lib/expressir/model/types/generic.rb +7 -0
- data/lib/expressir/model/types/generic_entity.rb +7 -0
- data/lib/expressir/model/types/list.rb +4 -4
- data/lib/expressir/model/types/real.rb +1 -1
- data/lib/expressir/model/types/select.rb +5 -5
- data/lib/expressir/model/types/set.rb +3 -3
- data/lib/expressir/model/types/string.rb +2 -2
- data/lib/expressir/model/unique.rb +8 -1
- data/lib/expressir/model/variable.rb +9 -2
- data/lib/expressir/model/where.rb +8 -1
- 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 +52 -50
- data/original/examples/syntax/remark.yaml +452 -0
- data/original/examples/syntax/remark_formatted.exp +64 -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 +21 -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 -28
- 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 -40
- data/spec/expressir/model/model_element/hash_spec.rb +0 -66
@@ -3,19 +3,20 @@ module Expressir
|
|
3
3
|
class Procedure < ModelElement
|
4
4
|
include Identifier
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
model_attr_accessor :parameters
|
7
|
+
model_attr_accessor :types
|
8
|
+
model_attr_accessor :entities
|
9
|
+
model_attr_accessor :subtype_constraints
|
10
|
+
model_attr_accessor :functions
|
11
|
+
model_attr_accessor :procedures
|
12
|
+
model_attr_accessor :constants
|
13
|
+
model_attr_accessor :variables
|
14
|
+
model_attr_accessor :statements
|
15
15
|
|
16
16
|
def initialize(options = {})
|
17
17
|
@id = options[:id]
|
18
18
|
@remarks = options.fetch(:remarks, [])
|
19
|
+
@remark_items = options.fetch(:remark_items, [])
|
19
20
|
@source = options[:source]
|
20
21
|
|
21
22
|
@parameters = options.fetch(:parameters, [])
|
@@ -31,18 +32,23 @@ module Expressir
|
|
31
32
|
super
|
32
33
|
end
|
33
34
|
|
35
|
+
def enumeration_items
|
36
|
+
types.flat_map{|x| x.enumeration_items}
|
37
|
+
end
|
38
|
+
|
34
39
|
def children
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
[
|
41
|
+
*parameters,
|
42
|
+
*types,
|
43
|
+
*enumeration_items,
|
44
|
+
*entities,
|
45
|
+
*subtype_constraints,
|
46
|
+
*functions,
|
47
|
+
*procedures,
|
48
|
+
*constants,
|
49
|
+
*variables,
|
50
|
+
*remark_items
|
51
|
+
]
|
46
52
|
end
|
47
53
|
end
|
48
54
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
|
-
class
|
4
|
-
|
3
|
+
class RemarkItem < ModelElement
|
4
|
+
model_attr_accessor :id
|
5
|
+
model_attr_accessor :remarks
|
5
6
|
|
6
7
|
def initialize(options = {})
|
7
8
|
@id = options[:id]
|
8
9
|
@remarks = options.fetch(:remarks, [])
|
9
|
-
@source = options[:source]
|
10
10
|
|
11
11
|
super
|
12
12
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Repository < ModelElement
|
4
|
-
|
4
|
+
model_attr_accessor :schemas
|
5
5
|
|
6
6
|
def initialize(options = {})
|
7
7
|
@schemas = options.fetch(:schemas, [])
|
@@ -10,9 +10,9 @@ module Expressir
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def children
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
[
|
14
|
+
*schemas
|
15
|
+
]
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/expressir/model/rule.rb
CHANGED
@@ -3,21 +3,22 @@ module Expressir
|
|
3
3
|
class Rule < ModelElement
|
4
4
|
include Identifier
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
model_attr_accessor :applies_to
|
7
|
+
model_attr_accessor :types
|
8
|
+
model_attr_accessor :entities
|
9
|
+
model_attr_accessor :subtype_constraints
|
10
|
+
model_attr_accessor :functions
|
11
|
+
model_attr_accessor :procedures
|
12
|
+
model_attr_accessor :constants
|
13
|
+
model_attr_accessor :variables
|
14
|
+
model_attr_accessor :statements
|
15
|
+
model_attr_accessor :where
|
16
|
+
model_attr_accessor :informal_propositions
|
17
17
|
|
18
18
|
def initialize(options = {})
|
19
19
|
@id = options[:id]
|
20
20
|
@remarks = options.fetch(:remarks, [])
|
21
|
+
@remark_items = options.fetch(:remark_items, [])
|
21
22
|
@source = options[:source]
|
22
23
|
|
23
24
|
@applies_to = options.fetch(:applies_to, [])
|
@@ -35,19 +36,24 @@ module Expressir
|
|
35
36
|
super
|
36
37
|
end
|
37
38
|
|
39
|
+
def enumeration_items
|
40
|
+
types.flat_map{|x| x.enumeration_items}
|
41
|
+
end
|
42
|
+
|
38
43
|
def children
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
[
|
45
|
+
*types,
|
46
|
+
*enumeration_items,
|
47
|
+
*entities,
|
48
|
+
*subtype_constraints,
|
49
|
+
*functions,
|
50
|
+
*procedures,
|
51
|
+
*constants,
|
52
|
+
*variables,
|
53
|
+
*where,
|
54
|
+
*informal_propositions,
|
55
|
+
*remark_items
|
56
|
+
]
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
@@ -1,25 +1,26 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Schema < ModelElement
|
4
|
-
|
4
|
+
model_attr_accessor :file
|
5
5
|
|
6
6
|
include Identifier
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
model_attr_accessor :version
|
9
|
+
model_attr_accessor :interfaces
|
10
|
+
model_attr_accessor :constants
|
11
|
+
model_attr_accessor :types
|
12
|
+
model_attr_accessor :entities
|
13
|
+
model_attr_accessor :subtype_constraints
|
14
|
+
model_attr_accessor :functions
|
15
|
+
model_attr_accessor :rules
|
16
|
+
model_attr_accessor :procedures
|
17
17
|
|
18
18
|
def initialize(options = {})
|
19
19
|
@file = options[:file]
|
20
20
|
|
21
21
|
@id = options[:id]
|
22
22
|
@remarks = options.fetch(:remarks, [])
|
23
|
+
@remark_items = options.fetch(:remark_items, [])
|
23
24
|
@source = options[:source]
|
24
25
|
|
25
26
|
@version = options[:version]
|
@@ -29,60 +30,68 @@ module Expressir
|
|
29
30
|
@entities = options.fetch(:entities, [])
|
30
31
|
@subtype_constraints = options.fetch(:subtype_constraints, [])
|
31
32
|
@functions = options.fetch(:functions, [])
|
32
|
-
@procedures = options.fetch(:procedures, [])
|
33
33
|
@rules = options.fetch(:rules, [])
|
34
|
+
@procedures = options.fetch(:procedures, [])
|
34
35
|
|
35
36
|
super
|
36
37
|
end
|
37
38
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
if interface.items.length > 0
|
47
|
-
interface.items.map do |item|
|
48
|
-
ref_id = item.ref.id.downcase
|
49
|
-
id = item.id || ref_id
|
50
|
-
base_item = schema_children.find{|x| x.id and x.id.downcase == ref_id}
|
51
|
-
|
52
|
-
interfaced_item = InterfacedItem.new({
|
53
|
-
id: id
|
54
|
-
})
|
55
|
-
interfaced_item.base_item = base_item # skip overriding parent
|
56
|
-
interfaced_item.parent = self
|
57
|
-
interfaced_item
|
58
|
-
end
|
59
|
-
else
|
60
|
-
schema_children.map do |item|
|
61
|
-
id = item.id
|
62
|
-
base_item = item
|
39
|
+
def create_interfaced_item(id, base_item)
|
40
|
+
interfaced_item = InterfacedItem.new({
|
41
|
+
id: id
|
42
|
+
})
|
43
|
+
interfaced_item.base_item = base_item # skip overriding parent
|
44
|
+
interfaced_item.parent = self
|
45
|
+
interfaced_item
|
46
|
+
end
|
63
47
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
48
|
+
def interfaced_items
|
49
|
+
interfaces.flat_map do |interface|
|
50
|
+
schema = parent.children_by_id[interface.schema.id.downcase]
|
51
|
+
if schema
|
52
|
+
schema_safe_children = schema.safe_children
|
53
|
+
schema_safe_children_by_id = schema_safe_children.select{|x| x.id}.map{|x| [x.id.downcase, x]}.to_h
|
54
|
+
if interface.items.length > 0
|
55
|
+
interface.items.map do |interface_item|
|
56
|
+
base_item = schema_safe_children_by_id[interface_item.ref.id.downcase]
|
57
|
+
if base_item
|
58
|
+
id = interface_item.id || base_item.id
|
59
|
+
create_interfaced_item(id, base_item)
|
70
60
|
end
|
71
61
|
end
|
72
62
|
else
|
73
|
-
|
63
|
+
schema_safe_children.map do |base_item|
|
64
|
+
id = base_item.id
|
65
|
+
create_interfaced_item(id, base_item)
|
66
|
+
end
|
74
67
|
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
68
|
+
end
|
69
|
+
end.select{|x| x}
|
70
|
+
end
|
71
|
+
|
72
|
+
def enumeration_items
|
73
|
+
types.flat_map{|x| x.enumeration_items}
|
74
|
+
end
|
75
|
+
|
76
|
+
def safe_children
|
77
|
+
[
|
78
|
+
*constants,
|
79
|
+
*types,
|
80
|
+
*enumeration_items,
|
81
|
+
*entities,
|
82
|
+
*subtype_constraints,
|
83
|
+
*functions,
|
84
|
+
*rules,
|
85
|
+
*procedures,
|
86
|
+
*remark_items
|
87
|
+
]
|
88
|
+
end
|
89
|
+
|
90
|
+
def children
|
91
|
+
[
|
92
|
+
*interfaced_items,
|
93
|
+
*safe_children
|
94
|
+
]
|
86
95
|
end
|
87
96
|
end
|
88
97
|
end
|
@@ -4,12 +4,13 @@ module Expressir
|
|
4
4
|
class Alias < ModelElement
|
5
5
|
include Identifier
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
model_attr_accessor :expression
|
8
|
+
model_attr_accessor :statements
|
9
9
|
|
10
10
|
def initialize(options = {})
|
11
11
|
@id = options[:id]
|
12
12
|
@remarks = options.fetch(:remarks, [])
|
13
|
+
@remark_items = options.fetch(:remark_items, [])
|
13
14
|
@source = options[:source]
|
14
15
|
|
15
16
|
@expression = options[:expression]
|
@@ -19,9 +20,10 @@ module Expressir
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def children
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
[
|
24
|
+
self,
|
25
|
+
*remark_items
|
26
|
+
]
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
@@ -2,9 +2,9 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Statements
|
4
4
|
class Case < ModelElement
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
model_attr_accessor :expression
|
6
|
+
model_attr_accessor :actions
|
7
|
+
model_attr_accessor :otherwise_statement
|
8
8
|
|
9
9
|
def initialize(options = {})
|
10
10
|
@expression = options[:expression]
|
@@ -2,8 +2,8 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Statements
|
4
4
|
class CaseAction < ModelElement
|
5
|
-
|
6
|
-
|
5
|
+
model_attr_accessor :labels
|
6
|
+
model_attr_accessor :statement
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
9
|
@labels = options.fetch(:labels, [])
|
@@ -2,9 +2,9 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Statements
|
4
4
|
class If < ModelElement
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
model_attr_accessor :expression
|
6
|
+
model_attr_accessor :statements
|
7
|
+
model_attr_accessor :else_statements
|
8
8
|
|
9
9
|
def initialize(options = {})
|
10
10
|
@expression = options[:expression]
|
@@ -4,16 +4,17 @@ module Expressir
|
|
4
4
|
class Repeat < ModelElement
|
5
5
|
include Identifier
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
model_attr_accessor :bound1
|
8
|
+
model_attr_accessor :bound2
|
9
|
+
model_attr_accessor :increment
|
10
|
+
model_attr_accessor :while_expression
|
11
|
+
model_attr_accessor :until_expression
|
12
|
+
model_attr_accessor :statements
|
13
13
|
|
14
14
|
def initialize(options = {})
|
15
15
|
@id = options[:id]
|
16
16
|
@remarks = options.fetch(:remarks, [])
|
17
|
+
@remark_items = options.fetch(:remark_items, [])
|
17
18
|
@source = options[:source]
|
18
19
|
|
19
20
|
@bound1 = options[:bound1]
|
@@ -27,9 +28,10 @@ module Expressir
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def children
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
[
|
32
|
+
self,
|
33
|
+
*remark_items
|
34
|
+
]
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|