expressir 0.2.8-x86-mingw32 → 0.2.13-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +1 -7
  3. data/exe/format +20 -0
  4. data/expressir.gemspec +3 -2
  5. data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
  6. data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
  7. data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
  8. data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
  9. data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
  10. data/lib/expressir/express_exp/formatter.rb +147 -110
  11. data/lib/expressir/express_exp/hyperlink_formatter.rb +25 -0
  12. data/lib/expressir/express_exp/parser.rb +14 -1
  13. data/lib/expressir/express_exp/schema_head_formatter.rb +14 -0
  14. data/lib/expressir/express_exp/visitor.rb +197 -111
  15. data/lib/expressir/model.rb +3 -1
  16. data/lib/expressir/model/attribute.rb +5 -1
  17. data/lib/expressir/model/constant.rb +5 -1
  18. data/lib/expressir/model/entity.rb +14 -20
  19. data/lib/expressir/model/enumeration_item.rb +5 -1
  20. data/lib/expressir/model/expressions/aggregate_initializer.rb +4 -2
  21. data/lib/expressir/model/expressions/aggregate_item.rb +3 -1
  22. data/lib/expressir/model/expressions/attribute_reference.rb +3 -1
  23. data/lib/expressir/model/expressions/binary_expression.rb +3 -1
  24. data/lib/expressir/model/expressions/call.rb +4 -2
  25. data/lib/expressir/model/expressions/entity_constructor.rb +4 -2
  26. data/lib/expressir/model/expressions/group_reference.rb +3 -1
  27. data/lib/expressir/model/expressions/index_reference.rb +3 -1
  28. data/lib/expressir/model/expressions/interval.rb +3 -1
  29. data/lib/expressir/model/expressions/query_expression.rb +5 -2
  30. data/lib/expressir/model/expressions/simple_reference.rb +3 -1
  31. data/lib/expressir/model/expressions/unary_expression.rb +3 -1
  32. data/lib/expressir/model/function.rb +28 -39
  33. data/lib/expressir/model/identifier.rb +1 -3
  34. data/lib/expressir/model/informal_proposition.rb +15 -0
  35. data/lib/expressir/model/interface.rb +4 -2
  36. data/lib/expressir/model/literals/binary.rb +3 -1
  37. data/lib/expressir/model/literals/integer.rb +3 -1
  38. data/lib/expressir/model/literals/logical.rb +3 -1
  39. data/lib/expressir/model/literals/real.rb +3 -1
  40. data/lib/expressir/model/literals/string.rb +3 -1
  41. data/lib/expressir/model/model_element.rb +140 -0
  42. data/lib/expressir/model/parameter.rb +5 -1
  43. data/lib/expressir/model/procedure.rb +29 -40
  44. data/lib/expressir/model/renamed_ref.rb +3 -1
  45. data/lib/expressir/model/repository.rb +5 -5
  46. data/lib/expressir/model/rule.rb +33 -41
  47. data/lib/expressir/model/schema.rb +44 -46
  48. data/lib/expressir/model/statements/alias.rb +6 -3
  49. data/lib/expressir/model/statements/assignment.rb +3 -1
  50. data/lib/expressir/model/statements/call.rb +4 -2
  51. data/lib/expressir/model/statements/case.rb +4 -2
  52. data/lib/expressir/model/statements/case_action.rb +4 -2
  53. data/lib/expressir/model/statements/compound.rb +4 -2
  54. data/lib/expressir/model/statements/escape.rb +1 -1
  55. data/lib/expressir/model/statements/if.rb +5 -3
  56. data/lib/expressir/model/statements/null.rb +1 -1
  57. data/lib/expressir/model/statements/repeat.rb +6 -3
  58. data/lib/expressir/model/statements/return.rb +3 -1
  59. data/lib/expressir/model/statements/skip.rb +1 -1
  60. data/lib/expressir/model/subtype_constraint.rb +5 -2
  61. data/lib/expressir/model/type.rb +11 -4
  62. data/lib/expressir/model/types/aggregate.rb +5 -1
  63. data/lib/expressir/model/types/array.rb +3 -1
  64. data/lib/expressir/model/types/bag.rb +3 -1
  65. data/lib/expressir/model/types/binary.rb +3 -1
  66. data/lib/expressir/model/types/boolean.rb +1 -1
  67. data/lib/expressir/model/types/enumeration.rb +5 -3
  68. data/lib/expressir/model/types/generic.rb +5 -1
  69. data/lib/expressir/model/types/generic_entity.rb +5 -1
  70. data/lib/expressir/model/types/integer.rb +1 -1
  71. data/lib/expressir/model/types/list.rb +3 -1
  72. data/lib/expressir/model/types/logical.rb +1 -1
  73. data/lib/expressir/model/types/number.rb +1 -1
  74. data/lib/expressir/model/types/real.rb +3 -1
  75. data/lib/expressir/model/types/select.rb +5 -3
  76. data/lib/expressir/model/types/set.rb +3 -1
  77. data/lib/expressir/model/types/string.rb +3 -1
  78. data/lib/expressir/model/unique.rb +6 -2
  79. data/lib/expressir/model/variable.rb +5 -1
  80. data/lib/expressir/model/where.rb +5 -1
  81. data/lib/expressir/version.rb +1 -1
  82. data/original/examples/syntax/hyperlink.exp +8 -0
  83. data/original/examples/syntax/hyperlink_formatted.exp +19 -0
  84. data/original/examples/syntax/remark.exp +63 -20
  85. data/original/examples/syntax/remark_formatted.exp +62 -24
  86. data/original/examples/syntax/simple.exp +3 -0
  87. data/original/examples/syntax/source.exp +16 -0
  88. data/original/examples/syntax/syntax.exp +201 -190
  89. data/original/examples/syntax/syntax_formatted.exp +370 -799
  90. data/spec/expressir/express_exp/{format_remark_spec.rb → formatter/remark_spec.rb} +2 -2
  91. data/spec/expressir/express_exp/{format_syntax_spec.rb → formatter/syntax_spec.rb} +2 -2
  92. data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +24 -0
  93. data/spec/expressir/express_exp/parser/head_source_spec.rb +38 -0
  94. data/spec/expressir/express_exp/parser/multiple_spec.rb +32 -0
  95. data/spec/expressir/express_exp/{parse_remark_spec.rb → parser/remark_spec.rb} +120 -55
  96. data/spec/expressir/express_exp/{source_spec.rb → parser/source_spec.rb} +3 -6
  97. data/spec/expressir/express_exp/parser/syntax_spec.rb +3080 -0
  98. data/spec/expressir/express_exp/schema_head_formatter_spec.rb +36 -0
  99. data/spec/expressir/model/{find_spec.rb → model_element/find_spec.rb} +26 -8
  100. data/spec/expressir/model/model_element/hash_spec.rb +66 -0
  101. metadata +38 -13
  102. data/lib/expressir/model/scope.rb +0 -32
  103. data/spec/expressir/express_exp/ap233_spec.rb +0 -22
  104. data/spec/expressir/express_exp/find_spec.rb +0 -28
  105. data/spec/expressir/express_exp/parse_syntax_spec.rb +0 -3003
@@ -1,4 +1,5 @@
1
- require 'expressir/model/scope'
1
+ require 'expressir/model/model_element'
2
+
2
3
  require 'expressir/model/identifier'
3
4
 
4
5
  require 'expressir/model/attribute'
@@ -6,6 +7,7 @@ require 'expressir/model/constant'
6
7
  require 'expressir/model/entity'
7
8
  require 'expressir/model/enumeration_item'
8
9
  require 'expressir/model/function'
10
+ require 'expressir/model/informal_proposition'
9
11
  require 'expressir/model/interface'
10
12
  require 'expressir/model/parameter'
11
13
  require 'expressir/model/procedure'
@@ -1,6 +1,6 @@
1
1
  module Expressir
2
2
  module Model
3
- class Attribute
3
+ class Attribute < ModelElement
4
4
  include Identifier
5
5
 
6
6
  EXPLICIT = :EXPLICIT
@@ -15,12 +15,16 @@ module Expressir
15
15
 
16
16
  def initialize(options = {})
17
17
  @id = options[:id]
18
+ @remarks = options.fetch(:remarks, [])
19
+ @source = options[:source]
18
20
 
19
21
  @kind = options[:kind]
20
22
  @supertype_attribute = options[:supertype_attribute]
21
23
  @optional = options[:optional]
22
24
  @type = options[:type]
23
25
  @expression = options[:expression]
26
+
27
+ super
24
28
  end
25
29
  end
26
30
  end
@@ -1,6 +1,6 @@
1
1
  module Expressir
2
2
  module Model
3
- class Constant
3
+ class Constant < ModelElement
4
4
  include Identifier
5
5
 
6
6
  attr_accessor :type
@@ -8,9 +8,13 @@ module Expressir
8
8
 
9
9
  def initialize(options = {})
10
10
  @id = options[:id]
11
+ @remarks = options.fetch(:remarks, [])
12
+ @source = options[:source]
11
13
 
12
14
  @type = options[:type]
13
15
  @expression = options[:expression]
16
+
17
+ super
14
18
  end
15
19
  end
16
20
  end
@@ -1,7 +1,6 @@
1
1
  module Expressir
2
2
  module Model
3
- class Entity
4
- include Scope
3
+ class Entity < ModelElement
5
4
  include Identifier
6
5
 
7
6
  attr_accessor :abstract
@@ -10,35 +9,30 @@ module Expressir
10
9
  attr_accessor :attributes
11
10
  attr_accessor :unique
12
11
  attr_accessor :where
12
+ attr_accessor :informal_propositions
13
13
 
14
14
  def initialize(options = {})
15
15
  @id = options[:id]
16
+ @remarks = options.fetch(:remarks, [])
17
+ @source = options[:source]
16
18
 
17
19
  @abstract = options[:abstract]
18
20
  @supertype_expression = options[:supertype_expression]
19
- @subtype_of = options[:subtype_of]
20
- @attributes = options[:attributes]
21
- @unique = options[:unique]
22
- @where = options[:where]
23
- end
24
-
25
- def explicit_attributes
26
- @attributes.select{|x| x.kind == Expressir::Model::Attribute::EXPLICIT}
27
- end
28
-
29
- def derived_attributes
30
- @attributes.select{|x| x.kind == Expressir::Model::Attribute::DERIVED}
31
- end
21
+ @subtype_of = options.fetch(:subtype_of, [])
22
+ @attributes = options.fetch(:attributes, [])
23
+ @unique = options.fetch(:unique, [])
24
+ @where = options.fetch(:where, [])
25
+ @informal_propositions = options.fetch(:informal_propositions, [])
32
26
 
33
- def inverse_attributes
34
- @attributes.select{|x| x.kind == Expressir::Model::Attribute::INVERSE}
27
+ super
35
28
  end
36
29
 
37
30
  def children
38
31
  items = []
39
- items.push(*@attributes) if @attributes
40
- items.push(*@unique) if @unique
41
- items.push(*@where) if @where
32
+ items.push(*@attributes)
33
+ items.push(*@unique)
34
+ items.push(*@where)
35
+ items.push(*@informal_propositions)
42
36
  items
43
37
  end
44
38
  end
@@ -1,10 +1,14 @@
1
1
  module Expressir
2
2
  module Model
3
- class EnumerationItem
3
+ class EnumerationItem < ModelElement
4
4
  include Identifier
5
5
 
6
6
  def initialize(options = {})
7
7
  @id = options[:id]
8
+ @remarks = options.fetch(:remarks, [])
9
+ @source = options[:source]
10
+
11
+ super
8
12
  end
9
13
  end
10
14
  end
@@ -1,11 +1,13 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class AggregateInitializer
4
+ class AggregateInitializer < ModelElement
5
5
  attr_accessor :items
6
6
 
7
7
  def initialize(options = {})
8
- @items = options[:items]
8
+ @items = options.fetch(:items, [])
9
+
10
+ super
9
11
  end
10
12
  end
11
13
  end
@@ -1,13 +1,15 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class AggregateItem
4
+ class AggregateItem < ModelElement
5
5
  attr_accessor :expression
6
6
  attr_accessor :repetition
7
7
 
8
8
  def initialize(options = {})
9
9
  @expression = options[:expression]
10
10
  @repetition = options[:repetition]
11
+
12
+ super
11
13
  end
12
14
  end
13
15
  end
@@ -1,13 +1,15 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class AttributeReference
4
+ class AttributeReference < ModelElement
5
5
  attr_accessor :ref
6
6
  attr_accessor :attribute
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
10
10
  @attribute = options[:attribute]
11
+
12
+ super
11
13
  end
12
14
  end
13
15
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class BinaryExpression
4
+ class BinaryExpression < ModelElement
5
5
  ADDITION = :ADDITION
6
6
  AND = :AND
7
7
  ANDOR = :ANDOR
@@ -33,6 +33,8 @@ module Expressir
33
33
  @operator = options[:operator]
34
34
  @operand1 = options[:operand1]
35
35
  @operand2 = options[:operand2]
36
+
37
+ super
36
38
  end
37
39
  end
38
40
  end
@@ -1,13 +1,15 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class Call
4
+ class Call < ModelElement
5
5
  attr_accessor :ref
6
6
  attr_accessor :parameters
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
10
- @parameters = options[:parameters]
10
+ @parameters = options.fetch(:parameters, [])
11
+
12
+ super
11
13
  end
12
14
  end
13
15
  end
@@ -1,13 +1,15 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class EntityConstructor
4
+ class EntityConstructor < ModelElement
5
5
  attr_accessor :entity
6
6
  attr_accessor :parameters
7
7
 
8
8
  def initialize(options = {})
9
9
  @entity = options[:entity]
10
- @parameters = options[:parameters]
10
+ @parameters = options.fetch(:parameters, [])
11
+
12
+ super
11
13
  end
12
14
  end
13
15
  end
@@ -1,13 +1,15 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class GroupReference
4
+ class GroupReference < ModelElement
5
5
  attr_accessor :ref
6
6
  attr_accessor :entity
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
10
10
  @entity = options[:entity]
11
+
12
+ super
11
13
  end
12
14
  end
13
15
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class IndexReference
4
+ class IndexReference < ModelElement
5
5
  attr_accessor :ref
6
6
  attr_accessor :index1
7
7
  attr_accessor :index2
@@ -10,6 +10,8 @@ module Expressir
10
10
  @ref = options[:ref]
11
11
  @index1 = options[:index1]
12
12
  @index2 = options[:index2]
13
+
14
+ super
13
15
  end
14
16
  end
15
17
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class Interval
4
+ class Interval < ModelElement
5
5
  attr_accessor :low
6
6
  attr_accessor :operator1
7
7
  attr_accessor :item
@@ -14,6 +14,8 @@ module Expressir
14
14
  @item = options[:item]
15
15
  @operator2 = options[:operator2]
16
16
  @high = options[:high]
17
+
18
+ super
17
19
  end
18
20
  end
19
21
  end
@@ -1,8 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class QueryExpression
5
- include Scope
4
+ class QueryExpression < ModelElement
6
5
  include Identifier
7
6
 
8
7
  attr_accessor :aggregate_source
@@ -10,9 +9,13 @@ module Expressir
10
9
 
11
10
  def initialize(options = {})
12
11
  @id = options[:id]
12
+ @remarks = options.fetch(:remarks, [])
13
+ @source = options[:source]
13
14
 
14
15
  @aggregate_source = options[:aggregate_source]
15
16
  @expression = options[:expression]
17
+
18
+ super
16
19
  end
17
20
 
18
21
  def children
@@ -1,11 +1,13 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class SimpleReference
4
+ class SimpleReference < ModelElement
5
5
  attr_accessor :id
6
6
 
7
7
  def initialize(options = {})
8
8
  @id = options[:id]
9
+
10
+ super
9
11
  end
10
12
  end
11
13
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class UnaryExpression
4
+ class UnaryExpression < ModelElement
5
5
  MINUS = :MINUS
6
6
  NOT = :NOT
7
7
  PLUS = :PLUS
@@ -12,6 +12,8 @@ module Expressir
12
12
  def initialize(options = {})
13
13
  @operator = options[:operator]
14
14
  @operand = options[:operand]
15
+
16
+ super
15
17
  end
16
18
  end
17
19
  end
@@ -1,60 +1,49 @@
1
1
  module Expressir
2
2
  module Model
3
- class Function
4
- include Scope
3
+ class Function < ModelElement
5
4
  include Identifier
6
5
 
7
6
  attr_accessor :parameters
8
7
  attr_accessor :return_type
9
- attr_accessor :declarations
8
+ attr_accessor :types
9
+ attr_accessor :entities
10
+ attr_accessor :subtype_constraints
11
+ attr_accessor :functions
12
+ attr_accessor :procedures
10
13
  attr_accessor :constants
11
14
  attr_accessor :variables
12
15
  attr_accessor :statements
13
16
 
14
17
  def initialize(options = {})
15
18
  @id = options[:id]
19
+ @remarks = options.fetch(:remarks, [])
20
+ @source = options[:source]
16
21
 
17
- @parameters = options[:parameters]
22
+ @parameters = options.fetch(:parameters, [])
18
23
  @return_type = options[:return_type]
19
- @declarations = options[:declarations]
20
- @constants = options[:constants]
21
- @variables = options[:variables]
22
- @statements = options[:statements]
23
- end
24
-
25
- def types
26
- @declarations.select{|x| x.instance_of? Expressir::Model::Type}
27
- end
28
-
29
- def entities
30
- @declarations.select{|x| x.instance_of? Expressir::Model::Entity}
31
- end
32
-
33
- def subtype_constraints
34
- @declarations.select{|x| x.instance_of? Expressir::Model::SubtypeConstraint}
35
- end
36
-
37
- def functions
38
- @declarations.select{|x| x.instance_of? Expressir::Model::Function}
39
- end
40
-
41
- def procedures
42
- @declarations.select{|x| x.instance_of? Expressir::Model::Procedure}
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
+
33
+ super
43
34
  end
44
35
 
45
36
  def children
46
37
  items = []
47
- items.push(*@parameters) if @parameters
48
- items.push(*@declarations.flat_map do |x|
49
- [
50
- x,
51
- *if x.instance_of? Expressir::Model::Type and x.type.instance_of? Expressir::Model::Types::Enumeration
52
- x.type.items
53
- end
54
- ]
55
- end) if @declarations
56
- items.push(*@constants) if @constants
57
- items.push(*@variables) if @variables
38
+ items.push(*@parameters)
39
+ items.push(*@types)
40
+ items.push(*@types.flat_map{|x| x.type.is_a?(Expressir::Model::Types::Enumeration) ? x.type.items : []})
41
+ items.push(*@entities)
42
+ items.push(*@subtype_constraints)
43
+ items.push(*@functions)
44
+ items.push(*@procedures)
45
+ items.push(*@constants)
46
+ items.push(*@variables)
58
47
  items
59
48
  end
60
49
  end