expressir 0.2.19-arm64-darwin → 0.2.27-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +7 -6
  3. data/.github/workflows/release.yml +31 -3
  4. data/README.adoc +3 -3
  5. data/exe/format +2 -49
  6. data/exe/format-test +81 -0
  7. data/lib/expressir/express_exp/2.4/express_parser.bundle +0 -0
  8. data/lib/expressir/express_exp/2.5/express_parser.bundle +0 -0
  9. data/lib/expressir/express_exp/2.6/express_parser.bundle +0 -0
  10. data/lib/expressir/express_exp/2.7/express_parser.bundle +0 -0
  11. data/lib/expressir/express_exp/3.0/express_parser.bundle +0 -0
  12. data/lib/expressir/express_exp/cache.rb +48 -0
  13. data/lib/expressir/express_exp/formatter.rb +12 -2
  14. data/lib/expressir/express_exp/hyperlink_formatter.rb +10 -15
  15. data/lib/expressir/express_exp/model_visitor.rb +23 -0
  16. data/lib/expressir/express_exp/parser.rb +14 -3
  17. data/lib/expressir/express_exp/resolve_references_model_visitor.rb +29 -0
  18. data/lib/expressir/express_exp/visitor.rb +46 -19
  19. data/lib/expressir/model.rb +5 -1
  20. data/lib/expressir/model/attribute.rb +13 -6
  21. data/lib/expressir/model/cache.rb +13 -0
  22. data/lib/expressir/model/constant.rb +10 -3
  23. data/lib/expressir/model/entity.rb +16 -14
  24. data/lib/expressir/model/enumeration_item.rb +8 -1
  25. data/lib/expressir/model/expressions/aggregate_initializer.rb +2 -2
  26. data/lib/expressir/model/expressions/aggregate_item.rb +2 -2
  27. data/lib/expressir/model/expressions/attribute_reference.rb +2 -2
  28. data/lib/expressir/model/expressions/binary_expression.rb +3 -3
  29. data/lib/expressir/model/expressions/call.rb +3 -3
  30. data/lib/expressir/model/expressions/entity_constructor.rb +3 -3
  31. data/lib/expressir/model/expressions/group_reference.rb +2 -2
  32. data/lib/expressir/model/expressions/index_reference.rb +3 -3
  33. data/lib/expressir/model/expressions/interval.rb +5 -5
  34. data/lib/expressir/model/expressions/query_expression.rb +6 -4
  35. data/lib/expressir/model/expressions/simple_reference.rb +5 -1
  36. data/lib/expressir/model/expressions/unary_expression.rb +2 -2
  37. data/lib/expressir/model/function.rb +23 -21
  38. data/lib/expressir/model/identifier.rb +6 -3
  39. data/lib/expressir/model/interface.rb +4 -4
  40. data/lib/expressir/model/interface_item.rb +2 -2
  41. data/lib/expressir/model/interfaced_item.rb +10 -9
  42. data/lib/expressir/model/literals/binary.rb +1 -1
  43. data/lib/expressir/model/literals/integer.rb +1 -1
  44. data/lib/expressir/model/literals/logical.rb +1 -1
  45. data/lib/expressir/model/literals/real.rb +1 -1
  46. data/lib/expressir/model/literals/string.rb +2 -2
  47. data/lib/expressir/model/model_element.rb +38 -26
  48. data/lib/expressir/model/parameter.rb +10 -3
  49. data/lib/expressir/model/procedure.rb +22 -20
  50. data/lib/expressir/model/remark_item.rb +15 -0
  51. data/lib/expressir/model/repository.rb +2 -2
  52. data/lib/expressir/model/rule.rb +26 -24
  53. data/lib/expressir/model/schema.rb +24 -20
  54. data/lib/expressir/model/schema_version.rb +15 -0
  55. data/lib/expressir/model/schema_version_item.rb +15 -0
  56. data/lib/expressir/model/statements/alias.rb +7 -5
  57. data/lib/expressir/model/statements/assignment.rb +2 -2
  58. data/lib/expressir/model/statements/call.rb +3 -3
  59. data/lib/expressir/model/statements/case.rb +4 -4
  60. data/lib/expressir/model/statements/case_action.rb +3 -3
  61. data/lib/expressir/model/statements/compound.rb +2 -2
  62. data/lib/expressir/model/statements/if.rb +5 -5
  63. data/lib/expressir/model/statements/repeat.rb +11 -9
  64. data/lib/expressir/model/statements/return.rb +1 -1
  65. data/lib/expressir/model/subtype_constraint.rb +13 -6
  66. data/lib/expressir/model/type.rb +9 -7
  67. data/lib/expressir/model/types/aggregate.rb +9 -2
  68. data/lib/expressir/model/types/array.rb +5 -5
  69. data/lib/expressir/model/types/bag.rb +3 -3
  70. data/lib/expressir/model/types/binary.rb +2 -2
  71. data/lib/expressir/model/types/enumeration.rb +6 -6
  72. data/lib/expressir/model/types/generic.rb +8 -1
  73. data/lib/expressir/model/types/generic_entity.rb +8 -1
  74. data/lib/expressir/model/types/list.rb +4 -4
  75. data/lib/expressir/model/types/real.rb +1 -1
  76. data/lib/expressir/model/types/select.rb +7 -7
  77. data/lib/expressir/model/types/set.rb +3 -3
  78. data/lib/expressir/model/types/string.rb +2 -2
  79. data/lib/expressir/model/unique.rb +10 -3
  80. data/lib/expressir/model/variable.rb +10 -3
  81. data/lib/expressir/model/where.rb +9 -2
  82. data/lib/expressir/version.rb +1 -1
  83. data/original/examples/syntax/multiple.exp +1 -1
  84. data/original/examples/syntax/multiple.yaml +15 -1
  85. data/original/examples/syntax/multiple_formatted.exp +1 -1
  86. data/original/examples/syntax/multiple_hyperlink_formatted.exp +4 -4
  87. data/original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp +1 -1
  88. data/original/examples/syntax/remark.exp +12 -10
  89. data/original/examples/syntax/remark.yaml +23 -3
  90. data/original/examples/syntax/remark_formatted.exp +3 -1
  91. data/original/examples/syntax/single.exp +2 -1
  92. data/original/examples/syntax/single.yaml +9 -0
  93. data/original/examples/syntax/single_formatted.exp +5 -1
  94. data/original/examples/syntax/single_formatted.yaml +18 -1
  95. data/original/examples/syntax/syntax.exp +1 -1
  96. data/original/examples/syntax/syntax.yaml +99 -2
  97. data/original/examples/syntax/syntax_formatted.exp +1 -1
  98. data/original/examples/syntax/syntax_hyperlink_formatted.exp +902 -0
  99. data/original/examples/syntax/syntax_schema_head_formatted.exp +1 -1
  100. data/spec/expressir/express_exp/cache_spec.rb +64 -0
  101. data/spec/expressir/express_exp/formatter_spec.rb +16 -0
  102. data/spec/expressir/express_exp/parser_spec.rb +1 -1
  103. data/spec/expressir/model/model_element_spec.rb +73 -21
  104. metadata +12 -3
  105. data/lib/expressir/model/informal_proposition.rb +0 -18
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ class RemarkItem < ModelElement
4
+ model_attr_accessor :id
5
+ model_attr_accessor :remarks
6
+
7
+ def initialize(options = {})
8
+ @id = options[:id]
9
+ @remarks = options[:remarks] || []
10
+
11
+ super
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,10 +1,10 @@
1
1
  module Expressir
2
2
  module Model
3
3
  class Repository < ModelElement
4
- attr_accessor :schemas
4
+ model_attr_accessor :schemas
5
5
 
6
6
  def initialize(options = {})
7
- @schemas = options.fetch(:schemas, [])
7
+ @schemas = options[:schemas] || []
8
8
 
9
9
  super
10
10
  end
@@ -3,34 +3,35 @@ module Expressir
3
3
  class Rule < ModelElement
4
4
  include Identifier
5
5
 
6
- attr_accessor :applies_to
7
- attr_accessor :types
8
- attr_accessor :entities
9
- attr_accessor :subtype_constraints
10
- attr_accessor :functions
11
- attr_accessor :procedures
12
- attr_accessor :constants
13
- attr_accessor :variables
14
- attr_accessor :statements
15
- attr_accessor :where
16
- attr_accessor :informal_propositions
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
- @remarks = options.fetch(:remarks, [])
20
+ @remarks = options[:remarks] || []
21
+ @remark_items = options[:remark_items] || []
21
22
  @source = options[:source]
22
23
 
23
- @applies_to = options.fetch(:applies_to, [])
24
- @types = options.fetch(:types, [])
25
- @entities = options.fetch(:entities, [])
26
- @subtype_constraints = options.fetch(:subtype_constraints, [])
27
- @functions = options.fetch(:functions, [])
28
- @procedures = options.fetch(:procedures, [])
29
- @constants = options.fetch(:constants, [])
30
- @variables = options.fetch(:variables, [])
31
- @statements = options.fetch(:statements, [])
32
- @where = options.fetch(:where, [])
33
- @informal_propositions = options.fetch(:informal_propositions, [])
24
+ @applies_to = options[:applies_to] || []
25
+ @types = options[:types] || []
26
+ @entities = options[:entities] || []
27
+ @subtype_constraints = options[:subtype_constraints] || []
28
+ @functions = options[:functions] || []
29
+ @procedures = options[:procedures] || []
30
+ @constants = options[:constants] || []
31
+ @variables = options[:variables] || []
32
+ @statements = options[:statements] || []
33
+ @where = options[:where] || []
34
+ @informal_propositions = options[:informal_propositions] || []
34
35
 
35
36
  super
36
37
  end
@@ -50,7 +51,8 @@ module Expressir
50
51
  *constants,
51
52
  *variables,
52
53
  *where,
53
- *informal_propositions
54
+ *informal_propositions,
55
+ *remark_items
54
56
  ]
55
57
  end
56
58
  end
@@ -1,36 +1,37 @@
1
1
  module Expressir
2
2
  module Model
3
3
  class Schema < ModelElement
4
- attr_accessor :file
4
+ model_attr_accessor :file
5
5
 
6
6
  include Identifier
7
7
 
8
- attr_accessor :version
9
- attr_accessor :interfaces
10
- attr_accessor :constants
11
- attr_accessor :types
12
- attr_accessor :entities
13
- attr_accessor :subtype_constraints
14
- attr_accessor :functions
15
- attr_accessor :rules
16
- attr_accessor :procedures
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
- @remarks = options.fetch(:remarks, [])
22
+ @remarks = options[:remarks] || []
23
+ @remark_items = options[:remark_items] || []
23
24
  @source = options[:source]
24
25
 
25
26
  @version = options[:version]
26
- @interfaces = options.fetch(:interfaces, [])
27
- @constants = options.fetch(:constants, [])
28
- @types = options.fetch(:types, [])
29
- @entities = options.fetch(:entities, [])
30
- @subtype_constraints = options.fetch(:subtype_constraints, [])
31
- @functions = options.fetch(:functions, [])
32
- @rules = options.fetch(:rules, [])
33
- @procedures = options.fetch(:procedures, [])
27
+ @interfaces = options[:interfaces] || []
28
+ @constants = options[:constants] || []
29
+ @types = options[:types] || []
30
+ @entities = options[:entities] || []
31
+ @subtype_constraints = options[:subtype_constraints] || []
32
+ @functions = options[:functions] || []
33
+ @rules = options[:rules] || []
34
+ @procedures = options[:procedures] || []
34
35
 
35
36
  super
36
37
  end
@@ -45,6 +46,8 @@ module Expressir
45
46
  end
46
47
 
47
48
  def interfaced_items
49
+ return [] unless parent
50
+
48
51
  interfaces.flat_map do |interface|
49
52
  schema = parent.children_by_id[interface.schema.id.downcase]
50
53
  if schema
@@ -81,7 +84,8 @@ module Expressir
81
84
  *subtype_constraints,
82
85
  *functions,
83
86
  *rules,
84
- *procedures
87
+ *procedures,
88
+ *remark_items
85
89
  ]
86
90
  end
87
91
 
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ class SchemaVersion < ModelElement
4
+ model_attr_accessor :value
5
+ model_attr_accessor :items
6
+
7
+ def initialize(options = {})
8
+ @value = options[:value]
9
+ @items = options[:items] || []
10
+
11
+ super
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ class SchemaVersionItem < ModelElement
4
+ model_attr_accessor :name
5
+ model_attr_accessor :value
6
+
7
+ def initialize(options = {})
8
+ @name = options[:name]
9
+ @value = options[:value]
10
+
11
+ super
12
+ end
13
+ end
14
+ end
15
+ end
@@ -4,23 +4,25 @@ module Expressir
4
4
  class Alias < ModelElement
5
5
  include Identifier
6
6
 
7
- attr_accessor :expression
8
- attr_accessor :statements
7
+ model_attr_accessor :expression
8
+ model_attr_accessor :statements
9
9
 
10
10
  def initialize(options = {})
11
11
  @id = options[:id]
12
- @remarks = options.fetch(:remarks, [])
12
+ @remarks = options[:remarks] || []
13
+ @remark_items = options[:remark_items] || []
13
14
  @source = options[:source]
14
15
 
15
16
  @expression = options[:expression]
16
- @statements = options.fetch(:statements, [])
17
+ @statements = options[:statements] || []
17
18
 
18
19
  super
19
20
  end
20
21
 
21
22
  def children
22
23
  [
23
- self
24
+ self,
25
+ *remark_items
24
26
  ]
25
27
  end
26
28
  end
@@ -2,8 +2,8 @@ module Expressir
2
2
  module Model
3
3
  module Statements
4
4
  class Assignment < ModelElement
5
- attr_accessor :ref
6
- attr_accessor :expression
5
+ model_attr_accessor :ref
6
+ model_attr_accessor :expression
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
@@ -2,12 +2,12 @@ module Expressir
2
2
  module Model
3
3
  module Statements
4
4
  class Call < ModelElement
5
- attr_accessor :ref
6
- attr_accessor :parameters
5
+ model_attr_accessor :ref
6
+ model_attr_accessor :parameters
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
10
- @parameters = options.fetch(:parameters, [])
10
+ @parameters = options[:parameters] || []
11
11
 
12
12
  super
13
13
  end
@@ -2,13 +2,13 @@ module Expressir
2
2
  module Model
3
3
  module Statements
4
4
  class Case < ModelElement
5
- attr_accessor :expression
6
- attr_accessor :actions
7
- attr_accessor :otherwise_statement
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]
11
- @actions = options.fetch(:actions, [])
11
+ @actions = options[:actions] || []
12
12
  @otherwise_statement = options[:otherwise_statement]
13
13
 
14
14
  super
@@ -2,11 +2,11 @@ module Expressir
2
2
  module Model
3
3
  module Statements
4
4
  class CaseAction < ModelElement
5
- attr_accessor :labels
6
- attr_accessor :statement
5
+ model_attr_accessor :labels
6
+ model_attr_accessor :statement
7
7
 
8
8
  def initialize(options = {})
9
- @labels = options.fetch(:labels, [])
9
+ @labels = options[:labels] || []
10
10
  @statement = options[:statement]
11
11
 
12
12
  super
@@ -2,10 +2,10 @@ module Expressir
2
2
  module Model
3
3
  module Statements
4
4
  class Compound < ModelElement
5
- attr_accessor :statements
5
+ model_attr_accessor :statements
6
6
 
7
7
  def initialize(options = {})
8
- @statements = options.fetch(:statements, [])
8
+ @statements = options[:statements] || []
9
9
 
10
10
  super
11
11
  end
@@ -2,14 +2,14 @@ module Expressir
2
2
  module Model
3
3
  module Statements
4
4
  class If < ModelElement
5
- attr_accessor :expression
6
- attr_accessor :statements
7
- attr_accessor :else_statements
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]
11
- @statements = options.fetch(:statements, [])
12
- @else_statements = options.fetch(:else_statements, [])
11
+ @statements = options[:statements] || []
12
+ @else_statements = options[:else_statements] || []
13
13
 
14
14
  super
15
15
  end
@@ -4,16 +4,17 @@ module Expressir
4
4
  class Repeat < ModelElement
5
5
  include Identifier
6
6
 
7
- attr_accessor :bound1
8
- attr_accessor :bound2
9
- attr_accessor :increment
10
- attr_accessor :while_expression
11
- attr_accessor :until_expression
12
- attr_accessor :statements
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
- @remarks = options.fetch(:remarks, [])
16
+ @remarks = options[:remarks] || []
17
+ @remark_items = options[:remark_items] || []
17
18
  @source = options[:source]
18
19
 
19
20
  @bound1 = options[:bound1]
@@ -21,14 +22,15 @@ module Expressir
21
22
  @increment = options[:increment]
22
23
  @while_expression = options[:while_expression]
23
24
  @until_expression = options[:until_expression]
24
- @statements = options.fetch(:statements, [])
25
+ @statements = options[:statements] || []
25
26
 
26
27
  super
27
28
  end
28
29
 
29
30
  def children
30
31
  [
31
- self
32
+ self,
33
+ *remark_items
32
34
  ]
33
35
  end
34
36
  end
@@ -2,7 +2,7 @@ module Expressir
2
2
  module Model
3
3
  module Statements
4
4
  class Return < ModelElement
5
- attr_accessor :expression
5
+ model_attr_accessor :expression
6
6
 
7
7
  def initialize(options = {})
8
8
  @expression = options[:expression]
@@ -3,23 +3,30 @@ module Expressir
3
3
  class SubtypeConstraint < ModelElement
4
4
  include Identifier
5
5
 
6
- attr_accessor :applies_to
7
- attr_accessor :abstract
8
- attr_accessor :total_over
9
- attr_accessor :supertype_expression
6
+ model_attr_accessor :applies_to
7
+ model_attr_accessor :abstract
8
+ model_attr_accessor :total_over
9
+ model_attr_accessor :supertype_expression
10
10
 
11
11
  def initialize(options = {})
12
12
  @id = options[:id]
13
- @remarks = options.fetch(:remarks, [])
13
+ @remarks = options[:remarks] || []
14
+ @remark_items = options[:remark_items] || []
14
15
  @source = options[:source]
15
16
 
16
17
  @applies_to = options[:applies_to]
17
18
  @abstract = options[:abstract]
18
- @total_over = options.fetch(:total_over, [])
19
+ @total_over = options[:total_over] || []
19
20
  @supertype_expression = options[:supertype_expression]
20
21
 
21
22
  super
22
23
  end
24
+
25
+ def children
26
+ [
27
+ *remark_items
28
+ ]
29
+ end
23
30
  end
24
31
  end
25
32
  end
@@ -3,18 +3,19 @@ module Expressir
3
3
  class Type < ModelElement
4
4
  include Identifier
5
5
 
6
- attr_accessor :type
7
- attr_accessor :where
8
- attr_accessor :informal_propositions
6
+ model_attr_accessor :type
7
+ model_attr_accessor :where
8
+ model_attr_accessor :informal_propositions
9
9
 
10
10
  def initialize(options = {})
11
11
  @id = options[:id]
12
- @remarks = options.fetch(:remarks, [])
12
+ @remarks = options[:remarks] || []
13
+ @remark_items = options[:remark_items] || []
13
14
  @source = options[:source]
14
15
 
15
16
  @type = options[:type]
16
- @where = options.fetch(:where, [])
17
- @informal_propositions = options.fetch(:informal_propositions, [])
17
+ @where = options[:where] || []
18
+ @informal_propositions = options[:informal_propositions] || []
18
19
 
19
20
  super
20
21
  end
@@ -27,7 +28,8 @@ module Expressir
27
28
  [
28
29
  *enumeration_items,
29
30
  *where,
30
- *informal_propositions
31
+ *informal_propositions,
32
+ *remark_items
31
33
  ]
32
34
  end
33
35
  end