expressir 0.2.9-x64-mingw32 → 0.2.14-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/format +20 -0
- data/expressir.gemspec +1 -0
- data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
- data/lib/expressir/express_exp/formatter.rb +146 -105
- data/lib/expressir/express_exp/hyperlink_formatter.rb +25 -0
- data/lib/expressir/express_exp/parser.rb +2 -0
- data/lib/expressir/express_exp/schema_head_formatter.rb +14 -0
- data/lib/expressir/express_exp/visitor.rb +132 -82
- data/lib/expressir/model.rb +2 -1
- data/lib/expressir/model/attribute.rb +5 -1
- data/lib/expressir/model/constant.rb +5 -1
- data/lib/expressir/model/entity.rb +13 -22
- data/lib/expressir/model/enumeration_item.rb +5 -1
- data/lib/expressir/model/expressions/aggregate_initializer.rb +4 -2
- data/lib/expressir/model/expressions/aggregate_item.rb +3 -1
- data/lib/expressir/model/expressions/attribute_reference.rb +3 -1
- data/lib/expressir/model/expressions/binary_expression.rb +3 -1
- data/lib/expressir/model/expressions/call.rb +4 -2
- data/lib/expressir/model/expressions/entity_constructor.rb +4 -2
- data/lib/expressir/model/expressions/group_reference.rb +3 -1
- data/lib/expressir/model/expressions/index_reference.rb +3 -1
- data/lib/expressir/model/expressions/interval.rb +3 -1
- data/lib/expressir/model/expressions/query_expression.rb +5 -2
- data/lib/expressir/model/expressions/simple_reference.rb +3 -1
- data/lib/expressir/model/expressions/unary_expression.rb +3 -1
- data/lib/expressir/model/function.rb +28 -39
- data/lib/expressir/model/identifier.rb +1 -3
- data/lib/expressir/model/informal_proposition.rb +5 -1
- data/lib/expressir/model/interface.rb +4 -2
- data/lib/expressir/model/literals/binary.rb +3 -1
- data/lib/expressir/model/literals/integer.rb +3 -1
- data/lib/expressir/model/literals/logical.rb +3 -1
- data/lib/expressir/model/literals/real.rb +3 -1
- data/lib/expressir/model/literals/string.rb +3 -1
- data/lib/expressir/model/model_element.rb +140 -0
- data/lib/expressir/model/parameter.rb +5 -1
- data/lib/expressir/model/procedure.rb +29 -40
- data/lib/expressir/model/renamed_ref.rb +3 -1
- data/lib/expressir/model/repository.rb +5 -5
- data/lib/expressir/model/rule.rb +32 -43
- data/lib/expressir/model/schema.rb +48 -48
- data/lib/expressir/model/statements/alias.rb +6 -3
- data/lib/expressir/model/statements/assignment.rb +3 -1
- data/lib/expressir/model/statements/call.rb +4 -2
- data/lib/expressir/model/statements/case.rb +4 -2
- data/lib/expressir/model/statements/case_action.rb +4 -2
- data/lib/expressir/model/statements/compound.rb +4 -2
- data/lib/expressir/model/statements/escape.rb +1 -1
- data/lib/expressir/model/statements/if.rb +5 -3
- data/lib/expressir/model/statements/null.rb +1 -1
- data/lib/expressir/model/statements/repeat.rb +6 -3
- data/lib/expressir/model/statements/return.rb +3 -1
- data/lib/expressir/model/statements/skip.rb +1 -1
- data/lib/expressir/model/subtype_constraint.rb +5 -2
- data/lib/expressir/model/type.rb +10 -11
- data/lib/expressir/model/types/aggregate.rb +5 -1
- data/lib/expressir/model/types/array.rb +3 -1
- data/lib/expressir/model/types/bag.rb +3 -1
- data/lib/expressir/model/types/binary.rb +3 -1
- data/lib/expressir/model/types/boolean.rb +1 -1
- data/lib/expressir/model/types/enumeration.rb +5 -3
- data/lib/expressir/model/types/generic.rb +5 -1
- data/lib/expressir/model/types/generic_entity.rb +5 -1
- data/lib/expressir/model/types/integer.rb +1 -1
- data/lib/expressir/model/types/list.rb +3 -1
- data/lib/expressir/model/types/logical.rb +1 -1
- data/lib/expressir/model/types/number.rb +1 -1
- data/lib/expressir/model/types/real.rb +3 -1
- data/lib/expressir/model/types/select.rb +5 -3
- data/lib/expressir/model/types/set.rb +3 -1
- data/lib/expressir/model/types/string.rb +3 -1
- data/lib/expressir/model/unique.rb +6 -2
- data/lib/expressir/model/variable.rb +5 -1
- data/lib/expressir/model/where.rb +5 -1
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/hyperlink.exp +8 -0
- data/original/examples/syntax/hyperlink_formatted.exp +19 -0
- data/original/examples/syntax/remark_formatted.exp +0 -5
- data/original/examples/syntax/simple.exp +3 -0
- data/original/examples/syntax/syntax.exp +197 -189
- data/original/examples/syntax/syntax_formatted.exp +362 -800
- data/spec/expressir/express_exp/{format_remark_spec.rb → formatter/remark_spec.rb} +2 -2
- data/spec/expressir/express_exp/{format_syntax_spec.rb → formatter/syntax_spec.rb} +2 -2
- data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +24 -0
- data/spec/expressir/express_exp/{head_source_spec.rb → parser/head_source_spec.rb} +2 -5
- data/spec/expressir/express_exp/{parse_multiple_spec.rb → parser/multiple_spec.rb} +6 -1
- data/spec/expressir/express_exp/{parse_remark_spec.rb → parser/remark_spec.rb} +5 -5
- data/spec/expressir/express_exp/{source_spec.rb → parser/source_spec.rb} +2 -5
- data/spec/expressir/express_exp/{parse_syntax_spec.rb → parser/syntax_spec.rb} +1619 -1582
- data/spec/expressir/express_exp/schema_head_formatter_spec.rb +36 -0
- data/spec/expressir/model/{find_spec.rb → model_element/find_spec.rb} +7 -2
- data/spec/expressir/model/model_element/hash_spec.rb +66 -0
- metadata +34 -12
- data/lib/expressir/model/scope.rb +0 -66
- data/spec/expressir/express_exp/ap233_spec.rb +0 -22
data/lib/expressir/model.rb
CHANGED
@@ -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
|
21
|
-
@attributes = options
|
22
|
-
@unique = options
|
23
|
-
@where = options
|
24
|
-
@informal_propositions = options
|
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
|
-
|
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)
|
42
|
-
items.push(*@unique)
|
43
|
-
items.push(*@where)
|
44
|
-
items.push(*@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
|
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
|
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
|
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,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 :
|
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
|
22
|
+
@parameters = options.fetch(:parameters, [])
|
18
23
|
@return_type = options[:return_type]
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@
|
27
|
-
|
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)
|
48
|
-
items.push(*@
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|