expressir 0.2.9-x86-linux → 0.2.14-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/exe/format +20 -0
  3. data/expressir.gemspec +1 -0
  4. data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
  5. data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
  6. data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
  7. data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
  8. data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
  9. data/lib/expressir/express_exp/formatter.rb +146 -105
  10. data/lib/expressir/express_exp/hyperlink_formatter.rb +25 -0
  11. data/lib/expressir/express_exp/parser.rb +2 -0
  12. data/lib/expressir/express_exp/schema_head_formatter.rb +14 -0
  13. data/lib/expressir/express_exp/visitor.rb +132 -82
  14. data/lib/expressir/model.rb +2 -1
  15. data/lib/expressir/model/attribute.rb +5 -1
  16. data/lib/expressir/model/constant.rb +5 -1
  17. data/lib/expressir/model/entity.rb +13 -22
  18. data/lib/expressir/model/enumeration_item.rb +5 -1
  19. data/lib/expressir/model/expressions/aggregate_initializer.rb +4 -2
  20. data/lib/expressir/model/expressions/aggregate_item.rb +3 -1
  21. data/lib/expressir/model/expressions/attribute_reference.rb +3 -1
  22. data/lib/expressir/model/expressions/binary_expression.rb +3 -1
  23. data/lib/expressir/model/expressions/call.rb +4 -2
  24. data/lib/expressir/model/expressions/entity_constructor.rb +4 -2
  25. data/lib/expressir/model/expressions/group_reference.rb +3 -1
  26. data/lib/expressir/model/expressions/index_reference.rb +3 -1
  27. data/lib/expressir/model/expressions/interval.rb +3 -1
  28. data/lib/expressir/model/expressions/query_expression.rb +5 -2
  29. data/lib/expressir/model/expressions/simple_reference.rb +3 -1
  30. data/lib/expressir/model/expressions/unary_expression.rb +3 -1
  31. data/lib/expressir/model/function.rb +28 -39
  32. data/lib/expressir/model/identifier.rb +1 -3
  33. data/lib/expressir/model/informal_proposition.rb +5 -1
  34. data/lib/expressir/model/interface.rb +4 -2
  35. data/lib/expressir/model/literals/binary.rb +3 -1
  36. data/lib/expressir/model/literals/integer.rb +3 -1
  37. data/lib/expressir/model/literals/logical.rb +3 -1
  38. data/lib/expressir/model/literals/real.rb +3 -1
  39. data/lib/expressir/model/literals/string.rb +3 -1
  40. data/lib/expressir/model/model_element.rb +140 -0
  41. data/lib/expressir/model/parameter.rb +5 -1
  42. data/lib/expressir/model/procedure.rb +29 -40
  43. data/lib/expressir/model/renamed_ref.rb +3 -1
  44. data/lib/expressir/model/repository.rb +5 -5
  45. data/lib/expressir/model/rule.rb +32 -43
  46. data/lib/expressir/model/schema.rb +48 -48
  47. data/lib/expressir/model/statements/alias.rb +6 -3
  48. data/lib/expressir/model/statements/assignment.rb +3 -1
  49. data/lib/expressir/model/statements/call.rb +4 -2
  50. data/lib/expressir/model/statements/case.rb +4 -2
  51. data/lib/expressir/model/statements/case_action.rb +4 -2
  52. data/lib/expressir/model/statements/compound.rb +4 -2
  53. data/lib/expressir/model/statements/escape.rb +1 -1
  54. data/lib/expressir/model/statements/if.rb +5 -3
  55. data/lib/expressir/model/statements/null.rb +1 -1
  56. data/lib/expressir/model/statements/repeat.rb +6 -3
  57. data/lib/expressir/model/statements/return.rb +3 -1
  58. data/lib/expressir/model/statements/skip.rb +1 -1
  59. data/lib/expressir/model/subtype_constraint.rb +5 -2
  60. data/lib/expressir/model/type.rb +10 -11
  61. data/lib/expressir/model/types/aggregate.rb +5 -1
  62. data/lib/expressir/model/types/array.rb +3 -1
  63. data/lib/expressir/model/types/bag.rb +3 -1
  64. data/lib/expressir/model/types/binary.rb +3 -1
  65. data/lib/expressir/model/types/boolean.rb +1 -1
  66. data/lib/expressir/model/types/enumeration.rb +5 -3
  67. data/lib/expressir/model/types/generic.rb +5 -1
  68. data/lib/expressir/model/types/generic_entity.rb +5 -1
  69. data/lib/expressir/model/types/integer.rb +1 -1
  70. data/lib/expressir/model/types/list.rb +3 -1
  71. data/lib/expressir/model/types/logical.rb +1 -1
  72. data/lib/expressir/model/types/number.rb +1 -1
  73. data/lib/expressir/model/types/real.rb +3 -1
  74. data/lib/expressir/model/types/select.rb +5 -3
  75. data/lib/expressir/model/types/set.rb +3 -1
  76. data/lib/expressir/model/types/string.rb +3 -1
  77. data/lib/expressir/model/unique.rb +6 -2
  78. data/lib/expressir/model/variable.rb +5 -1
  79. data/lib/expressir/model/where.rb +5 -1
  80. data/lib/expressir/version.rb +1 -1
  81. data/original/examples/syntax/hyperlink.exp +8 -0
  82. data/original/examples/syntax/hyperlink_formatted.exp +19 -0
  83. data/original/examples/syntax/remark_formatted.exp +0 -5
  84. data/original/examples/syntax/simple.exp +3 -0
  85. data/original/examples/syntax/syntax.exp +197 -189
  86. data/original/examples/syntax/syntax_formatted.exp +362 -800
  87. data/spec/expressir/express_exp/{format_remark_spec.rb → formatter/remark_spec.rb} +2 -2
  88. data/spec/expressir/express_exp/{format_syntax_spec.rb → formatter/syntax_spec.rb} +2 -2
  89. data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +24 -0
  90. data/spec/expressir/express_exp/{head_source_spec.rb → parser/head_source_spec.rb} +2 -5
  91. data/spec/expressir/express_exp/{parse_multiple_spec.rb → parser/multiple_spec.rb} +6 -1
  92. data/spec/expressir/express_exp/{parse_remark_spec.rb → parser/remark_spec.rb} +5 -5
  93. data/spec/expressir/express_exp/{source_spec.rb → parser/source_spec.rb} +2 -5
  94. data/spec/expressir/express_exp/{parse_syntax_spec.rb → parser/syntax_spec.rb} +1619 -1582
  95. data/spec/expressir/express_exp/schema_head_formatter_spec.rb +36 -0
  96. data/spec/expressir/model/{find_spec.rb → model_element/find_spec.rb} +7 -2
  97. data/spec/expressir/model/model_element/hash_spec.rb +66 -0
  98. metadata +34 -12
  99. data/lib/expressir/model/scope.rb +0 -66
  100. data/spec/expressir/express_exp/ap233_spec.rb +0 -22
@@ -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'
@@ -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
@@ -14,34 +13,26 @@ module Expressir
14
13
 
15
14
  def initialize(options = {})
16
15
  @id = options[:id]
16
+ @remarks = options.fetch(:remarks, [])
17
+ @source = options[:source]
17
18
 
18
19
  @abstract = options[:abstract]
19
20
  @supertype_expression = options[:supertype_expression]
20
- @subtype_of = options[:subtype_of]
21
- @attributes = options[:attributes]
22
- @unique = options[:unique]
23
- @where = options[:where]
24
- @informal_propositions = options[:informal_propositions]
25
- end
26
-
27
- def explicit_attributes
28
- @attributes.select{|x| x.kind == Expressir::Model::Attribute::EXPLICIT}
29
- end
30
-
31
- def derived_attributes
32
- @attributes.select{|x| x.kind == Expressir::Model::Attribute::DERIVED}
33
- 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, [])
34
26
 
35
- def inverse_attributes
36
- @attributes.select{|x| x.kind == Expressir::Model::Attribute::INVERSE}
27
+ super
37
28
  end
38
29
 
39
30
  def children
40
31
  items = []
41
- items.push(*@attributes) if @attributes
42
- items.push(*@unique) if @unique
43
- items.push(*@where) if @where
44
- items.push(*@informal_propositions) if @informal_propositions
32
+ items.push(*@attributes)
33
+ items.push(*@unique)
34
+ items.push(*@where)
35
+ items.push(*@informal_propositions)
45
36
  items
46
37
  end
47
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
@@ -1,11 +1,9 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Identifier
4
- attr_accessor :source
5
-
6
4
  attr_accessor :id
7
- attr_accessor :parent
8
5
  attr_accessor :remarks
6
+ attr_accessor :source
9
7
  end
10
8
  end
11
9
  end