expressir 0.2.9-x64-mingw32 → 0.2.10-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
  3. data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
  4. data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
  5. data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
  6. data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
  7. data/lib/expressir/express_exp/formatter.rb +71 -16
  8. data/lib/expressir/express_exp/visitor.rb +95 -41
  9. data/lib/expressir/model.rb +2 -0
  10. data/lib/expressir/model/attribute.rb +3 -1
  11. data/lib/expressir/model/constant.rb +3 -1
  12. data/lib/expressir/model/entity.rb +11 -21
  13. data/lib/expressir/model/enumeration_item.rb +3 -1
  14. data/lib/expressir/model/expressions/aggregate_initializer.rb +2 -2
  15. data/lib/expressir/model/expressions/aggregate_item.rb +1 -1
  16. data/lib/expressir/model/expressions/attribute_reference.rb +1 -1
  17. data/lib/expressir/model/expressions/binary_expression.rb +1 -1
  18. data/lib/expressir/model/expressions/call.rb +2 -2
  19. data/lib/expressir/model/expressions/entity_constructor.rb +2 -2
  20. data/lib/expressir/model/expressions/group_reference.rb +1 -1
  21. data/lib/expressir/model/expressions/index_reference.rb +1 -1
  22. data/lib/expressir/model/expressions/interval.rb +1 -1
  23. data/lib/expressir/model/expressions/query_expression.rb +3 -1
  24. data/lib/expressir/model/expressions/simple_reference.rb +1 -1
  25. data/lib/expressir/model/expressions/unary_expression.rb +1 -1
  26. data/lib/expressir/model/function.rb +32 -38
  27. data/lib/expressir/model/identifier.rb +1 -2
  28. data/lib/expressir/model/informal_proposition.rb +3 -1
  29. data/lib/expressir/model/interface.rb +2 -2
  30. data/lib/expressir/model/literals/binary.rb +1 -1
  31. data/lib/expressir/model/literals/integer.rb +1 -1
  32. data/lib/expressir/model/literals/logical.rb +1 -1
  33. data/lib/expressir/model/literals/real.rb +1 -1
  34. data/lib/expressir/model/literals/string.rb +1 -1
  35. data/lib/expressir/model/model_element.rb +67 -0
  36. data/lib/expressir/model/parameter.rb +3 -1
  37. data/lib/expressir/model/procedure.rb +33 -39
  38. data/lib/expressir/model/renamed_ref.rb +1 -1
  39. data/lib/expressir/model/repository.rb +3 -3
  40. data/lib/expressir/model/rule.rb +34 -40
  41. data/lib/expressir/model/schema.rb +35 -48
  42. data/lib/expressir/model/scope.rb +0 -3
  43. data/lib/expressir/model/statements/alias.rb +4 -2
  44. data/lib/expressir/model/statements/assignment.rb +1 -1
  45. data/lib/expressir/model/statements/call.rb +2 -2
  46. data/lib/expressir/model/statements/case.rb +2 -2
  47. data/lib/expressir/model/statements/case_action.rb +2 -2
  48. data/lib/expressir/model/statements/compound.rb +2 -2
  49. data/lib/expressir/model/statements/escape.rb +1 -1
  50. data/lib/expressir/model/statements/if.rb +3 -3
  51. data/lib/expressir/model/statements/null.rb +1 -1
  52. data/lib/expressir/model/statements/repeat.rb +4 -2
  53. data/lib/expressir/model/statements/return.rb +1 -1
  54. data/lib/expressir/model/statements/skip.rb +1 -1
  55. data/lib/expressir/model/subtype_constraint.rb +3 -1
  56. data/lib/expressir/model/type.rb +7 -5
  57. data/lib/expressir/model/types/aggregate.rb +3 -1
  58. data/lib/expressir/model/types/array.rb +1 -1
  59. data/lib/expressir/model/types/bag.rb +1 -1
  60. data/lib/expressir/model/types/binary.rb +1 -1
  61. data/lib/expressir/model/types/boolean.rb +1 -1
  62. data/lib/expressir/model/types/enumeration.rb +3 -3
  63. data/lib/expressir/model/types/generic.rb +3 -1
  64. data/lib/expressir/model/types/generic_entity.rb +3 -1
  65. data/lib/expressir/model/types/integer.rb +1 -1
  66. data/lib/expressir/model/types/list.rb +1 -1
  67. data/lib/expressir/model/types/logical.rb +1 -1
  68. data/lib/expressir/model/types/number.rb +1 -1
  69. data/lib/expressir/model/types/real.rb +1 -1
  70. data/lib/expressir/model/types/select.rb +3 -3
  71. data/lib/expressir/model/types/set.rb +1 -1
  72. data/lib/expressir/model/types/string.rb +1 -1
  73. data/lib/expressir/model/unique.rb +4 -2
  74. data/lib/expressir/model/variable.rb +3 -1
  75. data/lib/expressir/model/where.rb +3 -1
  76. data/lib/expressir/version.rb +1 -1
  77. data/original/examples/syntax/remark_formatted.exp +0 -5
  78. data/original/examples/syntax/simple.exp +3 -0
  79. data/original/examples/syntax/syntax.exp +189 -181
  80. data/original/examples/syntax/syntax_formatted.exp +346 -792
  81. data/spec/expressir/express_exp/head_source_spec.rb +1 -4
  82. data/spec/expressir/express_exp/parse_remark_spec.rb +3 -3
  83. data/spec/expressir/express_exp/parse_syntax_spec.rb +1583 -1578
  84. data/spec/expressir/express_exp/source_spec.rb +1 -4
  85. data/spec/expressir/model/model_element_spec.rb +59 -0
  86. data/spec/expressir/model/{find_spec.rb → scope_spec.rb} +1 -1
  87. metadata +6 -3
@@ -1,3 +1,5 @@
1
+ require 'expressir/model/model_element'
2
+
1
3
  require 'expressir/model/scope'
2
4
  require 'expressir/model/identifier'
3
5
 
@@ -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,6 +15,8 @@ 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]
@@ -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,6 +8,8 @@ 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]
@@ -1,6 +1,6 @@
1
1
  module Expressir
2
2
  module Model
3
- class Entity
3
+ class Entity < ModelElement
4
4
  include Scope
5
5
  include Identifier
6
6
 
@@ -14,34 +14,24 @@ module Expressir
14
14
 
15
15
  def initialize(options = {})
16
16
  @id = options[:id]
17
+ @remarks = options.fetch(:remarks, [])
18
+ @source = options[:source]
17
19
 
18
20
  @abstract = options[:abstract]
19
21
  @supertype_expression = options[:supertype_expression]
20
22
  @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
34
-
35
- def inverse_attributes
36
- @attributes.select{|x| x.kind == Expressir::Model::Attribute::INVERSE}
23
+ @attributes = options.fetch(:attributes, [])
24
+ @unique = options.fetch(:unique, [])
25
+ @where = options.fetch(:where, [])
26
+ @informal_propositions = options.fetch(:informal_propositions, [])
37
27
  end
38
28
 
39
29
  def children
40
30
  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
31
+ items.push(*@attributes)
32
+ items.push(*@unique)
33
+ items.push(*@where)
34
+ items.push(*@informal_propositions)
45
35
  items
46
36
  end
47
37
  end
@@ -1,10 +1,12 @@
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]
8
10
  end
9
11
  end
10
12
  end
@@ -1,11 +1,11 @@
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
9
  end
10
10
  end
11
11
  end
@@ -1,7 +1,7 @@
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
 
@@ -1,7 +1,7 @@
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
 
@@ -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
@@ -1,13 +1,13 @@
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
11
  end
12
12
  end
13
13
  end
@@ -1,13 +1,13 @@
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
11
  end
12
12
  end
13
13
  end
@@ -1,7 +1,7 @@
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
 
@@ -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
@@ -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
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Expressions
4
- class QueryExpression
4
+ class QueryExpression < ModelElement
5
5
  include Scope
6
6
  include Identifier
7
7
 
@@ -10,6 +10,8 @@ module Expressir
10
10
 
11
11
  def initialize(options = {})
12
12
  @id = options[:id]
13
+ @remarks = options.fetch(:remarks, [])
14
+ @source = options[:source]
13
15
 
14
16
  @aggregate_source = options[:aggregate_source]
15
17
  @expression = options[:expression]
@@ -1,7 +1,7 @@
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 = {})
@@ -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
@@ -1,60 +1,54 @@
1
1
  module Expressir
2
2
  module Model
3
- class Function
3
+ class Function < ModelElement
4
4
  include Scope
5
5
  include Identifier
6
6
 
7
7
  attr_accessor :parameters
8
8
  attr_accessor :return_type
9
- attr_accessor :declarations
9
+ attr_accessor :types
10
+ attr_accessor :entities
11
+ attr_accessor :subtype_constraints
12
+ attr_accessor :functions
13
+ attr_accessor :procedures
10
14
  attr_accessor :constants
11
15
  attr_accessor :variables
12
16
  attr_accessor :statements
13
17
 
14
18
  def initialize(options = {})
15
19
  @id = options[:id]
20
+ @remarks = options.fetch(:remarks, [])
21
+ @source = options[:source]
16
22
 
17
- @parameters = options[:parameters]
23
+ @parameters = options.fetch(:parameters, [])
18
24
  @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}
25
+ @types = options.fetch(:types, [])
26
+ @entities = options.fetch(:entities, [])
27
+ @subtype_constraints = options.fetch(:subtype_constraints, [])
28
+ @functions = options.fetch(:functions, [])
29
+ @procedures = options.fetch(:procedures, [])
30
+ @constants = options.fetch(:constants, [])
31
+ @variables = options.fetch(:variables, [])
32
+ @statements = options.fetch(:statements, [])
43
33
  end
44
34
 
45
35
  def children
46
36
  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
37
+ items.push(*@parameters)
38
+ items.push(*@types)
39
+ items.push(*@types.flat_map do |x|
40
+ if x.type.instance_of? Expressir::Model::Types::Enumeration
41
+ x.type.items
42
+ else
43
+ []
44
+ end
45
+ end)
46
+ items.push(*@entities)
47
+ items.push(*@subtype_constraints)
48
+ items.push(*@functions)
49
+ items.push(*@procedures)
50
+ items.push(*@constants)
51
+ items.push(*@variables)
58
52
  items
59
53
  end
60
54
  end
@@ -1,11 +1,10 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Identifier
4
- attr_accessor :source
5
-
6
4
  attr_accessor :id
7
5
  attr_accessor :parent
8
6
  attr_accessor :remarks
7
+ attr_accessor :source
9
8
  end
10
9
  end
11
10
  end
@@ -1,10 +1,12 @@
1
1
  module Expressir
2
2
  module Model
3
- class InformalProposition
3
+ class InformalProposition < 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]
8
10
  end
9
11
  end
10
12
  end
@@ -1,6 +1,6 @@
1
1
  module Expressir
2
2
  module Model
3
- class Interface
3
+ class Interface < ModelElement
4
4
  USE = :USE
5
5
  REFERENCE = :REFERENCE
6
6
 
@@ -11,7 +11,7 @@ module Expressir
11
11
  def initialize(options = {})
12
12
  @kind = options[:kind]
13
13
  @schema = options[:schema]
14
- @items = options[:items]
14
+ @items = options.fetch(:items, [])
15
15
  end
16
16
  end
17
17
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Literals
4
- class Binary
4
+ class Binary < ModelElement
5
5
  attr_accessor :value
6
6
 
7
7
  def initialize(options = {})
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Literals
4
- class Integer
4
+ class Integer < ModelElement
5
5
  attr_accessor :value
6
6
 
7
7
  def initialize(options = {})
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Literals
4
- class Logical
4
+ class Logical < ModelElement
5
5
  TRUE = :TRUE
6
6
  FALSE = :FALSE
7
7
  UNKNOWN = :UNKNOWN
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Literals
4
- class Real
4
+ class Real < ModelElement
5
5
  attr_accessor :value
6
6
 
7
7
  def initialize(options = {})
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Literals
4
- class String
4
+ class String < ModelElement
5
5
  attr_accessor :value
6
6
  attr_accessor :encoded
7
7