expressir 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +46 -0
- data/.github/workflows/release.yml +74 -0
- data/.gitignore +1 -2
- data/.gitmodules +3 -0
- data/Gemfile +2 -0
- data/Rakefile +20 -0
- data/exe/generate-parser +48 -0
- data/expressir.gemspec +5 -2
- data/ext/express-parser/antlrgen/Express.interp +532 -0
- data/ext/express-parser/antlrgen/Express.tokens +190 -0
- data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +7 -0
- data/ext/express-parser/antlrgen/ExpressBaseListener.h +623 -0
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +7 -0
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +816 -0
- data/ext/express-parser/antlrgen/ExpressLexer.cpp +1169 -0
- data/ext/express-parser/antlrgen/ExpressLexer.h +85 -0
- data/ext/express-parser/antlrgen/ExpressLexer.interp +534 -0
- data/ext/express-parser/antlrgen/ExpressLexer.tokens +190 -0
- data/ext/express-parser/antlrgen/ExpressListener.cpp +7 -0
- data/ext/express-parser/antlrgen/ExpressListener.h +616 -0
- data/ext/express-parser/antlrgen/ExpressParser.cpp +17284 -0
- data/ext/express-parser/antlrgen/ExpressParser.h +3696 -0
- data/ext/express-parser/antlrgen/ExpressVisitor.cpp +7 -0
- data/ext/express-parser/antlrgen/ExpressVisitor.h +422 -0
- data/ext/express-parser/express_parser.cpp +17931 -0
- data/ext/express-parser/extconf.rb +34 -0
- data/lib/expressir/express_exp/formatter.rb +50 -44
- data/lib/expressir/express_exp/parser.rb +12 -6
- data/lib/expressir/express_exp/visitor.rb +1377 -1068
- data/lib/expressir/model.rb +3 -0
- data/lib/expressir/model/attribute.rb +4 -5
- data/lib/expressir/model/constant.rb +3 -4
- data/lib/expressir/model/entity.rb +4 -4
- data/lib/expressir/model/enumeration_item.rb +1 -4
- data/lib/expressir/model/expressions/query_expression.rb +4 -4
- data/lib/expressir/model/function.rb +4 -4
- data/lib/expressir/model/identifier.rb +9 -0
- data/lib/expressir/model/parameter.rb +4 -5
- data/lib/expressir/model/procedure.rb +4 -4
- data/lib/expressir/model/repository.rb +2 -0
- data/lib/expressir/model/rule.rb +4 -4
- data/lib/expressir/model/schema.rb +3 -3
- data/lib/expressir/model/scope.rb +17 -0
- data/lib/expressir/model/statements/alias.rb +4 -4
- data/lib/expressir/model/statements/repeat.rb +4 -4
- data/lib/expressir/model/subtype_constraint.rb +9 -4
- data/lib/expressir/model/type.rb +4 -4
- data/lib/expressir/model/types/aggregate.rb +4 -5
- data/lib/expressir/model/types/generic.rb +2 -5
- data/lib/expressir/model/types/generic_entity.rb +2 -5
- data/lib/expressir/model/unique.rb +3 -4
- data/lib/expressir/model/variable.rb +3 -4
- data/lib/expressir/model/where.rb +3 -4
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/remark_formatted.exp +73 -71
- data/original/examples/syntax/syntax_formatted.exp +109 -98
- data/spec/expressir/express_exp/ap233_spec.rb +1 -1
- data/spec/expressir/express_exp/parse_syntax_spec.rb +30 -30
- data/spec/expressir/model/find_spec.rb +110 -0
- metadata +61 -15
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -56
- data/.github/workflows/windows.yml +0 -40
- data/generate-parser.sh +0 -29
- data/lib/expressir/express_exp/generated/ExpressBaseVisitor.rb +0 -779
- data/lib/expressir/express_exp/generated/ExpressLexer.rb +0 -844
- data/lib/expressir/express_exp/generated/ExpressParser.rb +0 -12162
- data/lib/expressir/express_exp/generated/ExpressVisitor.rb +0 -394
data/lib/expressir/model.rb
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Attribute
|
4
|
+
include Identifier
|
5
|
+
|
4
6
|
EXPLICIT = :EXPLICIT
|
5
7
|
DERIVED = :DERIVED
|
6
8
|
INVERSE = :INVERSE
|
7
9
|
|
8
10
|
attr_accessor :kind
|
9
11
|
attr_accessor :supertype_attribute
|
10
|
-
attr_accessor :id
|
11
12
|
attr_accessor :optional
|
12
13
|
attr_accessor :type
|
13
14
|
attr_accessor :expression
|
14
15
|
|
15
|
-
attr_accessor :parent
|
16
|
-
attr_accessor :remarks
|
17
|
-
|
18
16
|
def initialize(options = {})
|
17
|
+
@id = options[:id]
|
18
|
+
|
19
19
|
@kind = options[:kind]
|
20
20
|
@supertype_attribute = options[:supertype_attribute]
|
21
|
-
@id = options[:id]
|
22
21
|
@optional = options[:optional]
|
23
22
|
@type = options[:type]
|
24
23
|
@expression = options[:expression]
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Constant
|
4
|
-
|
4
|
+
include Identifier
|
5
|
+
|
5
6
|
attr_accessor :type
|
6
7
|
attr_accessor :expression
|
7
8
|
|
8
|
-
attr_accessor :parent
|
9
|
-
attr_accessor :remarks
|
10
|
-
|
11
9
|
def initialize(options = {})
|
12
10
|
@id = options[:id]
|
11
|
+
|
13
12
|
@type = options[:type]
|
14
13
|
@expression = options[:expression]
|
15
14
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Entity
|
4
|
-
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
5
7
|
attr_accessor :abstract
|
6
8
|
attr_accessor :supertype_expression
|
7
9
|
attr_accessor :subtype_of
|
@@ -9,11 +11,9 @@ module Expressir
|
|
9
11
|
attr_accessor :unique
|
10
12
|
attr_accessor :where
|
11
13
|
|
12
|
-
attr_accessor :parent
|
13
|
-
attr_accessor :remarks
|
14
|
-
|
15
14
|
def initialize(options = {})
|
16
15
|
@id = options[:id]
|
16
|
+
|
17
17
|
@abstract = options[:abstract]
|
18
18
|
@supertype_expression = options[:supertype_expression]
|
19
19
|
@subtype_of = options[:subtype_of]
|
@@ -2,15 +2,15 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Expressions
|
4
4
|
class QueryExpression
|
5
|
-
|
5
|
+
include Scope
|
6
|
+
include Identifier
|
7
|
+
|
6
8
|
attr_accessor :source
|
7
9
|
attr_accessor :expression
|
8
10
|
|
9
|
-
attr_accessor :parent
|
10
|
-
attr_accessor :remarks
|
11
|
-
|
12
11
|
def initialize(options = {})
|
13
12
|
@id = options[:id]
|
13
|
+
|
14
14
|
@source = options[:source]
|
15
15
|
@expression = options[:expression]
|
16
16
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Function
|
4
|
-
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
5
7
|
attr_accessor :parameters
|
6
8
|
attr_accessor :return_type
|
7
9
|
attr_accessor :declarations
|
@@ -9,11 +11,9 @@ module Expressir
|
|
9
11
|
attr_accessor :variables
|
10
12
|
attr_accessor :statements
|
11
13
|
|
12
|
-
attr_accessor :parent
|
13
|
-
attr_accessor :remarks
|
14
|
-
|
15
14
|
def initialize(options = {})
|
16
15
|
@id = options[:id]
|
16
|
+
|
17
17
|
@parameters = options[:parameters]
|
18
18
|
@return_type = options[:return_type]
|
19
19
|
@declarations = options[:declarations]
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Parameter
|
4
|
+
include Identifier
|
5
|
+
|
4
6
|
attr_accessor :var
|
5
|
-
attr_accessor :id
|
6
7
|
attr_accessor :type
|
7
8
|
|
8
|
-
attr_accessor :parent
|
9
|
-
attr_accessor :remarks
|
10
|
-
|
11
9
|
def initialize(options = {})
|
12
|
-
@var = options[:var]
|
13
10
|
@id = options[:id]
|
11
|
+
|
12
|
+
@var = options[:var]
|
14
13
|
@type = options[:type]
|
15
14
|
end
|
16
15
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Procedure
|
4
|
-
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
5
7
|
attr_accessor :parameters
|
6
8
|
attr_accessor :declarations
|
7
9
|
attr_accessor :constants
|
8
10
|
attr_accessor :variables
|
9
11
|
attr_accessor :statements
|
10
12
|
|
11
|
-
attr_accessor :parent
|
12
|
-
attr_accessor :remarks
|
13
|
-
|
14
13
|
def initialize(options = {})
|
15
14
|
@id = options[:id]
|
15
|
+
|
16
16
|
@parameters = options[:parameters]
|
17
17
|
@declarations = options[:declarations]
|
18
18
|
@constants = options[:constants]
|
data/lib/expressir/model/rule.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Rule
|
4
|
-
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
5
7
|
attr_accessor :applies_to
|
6
8
|
attr_accessor :declarations
|
7
9
|
attr_accessor :constants
|
@@ -9,11 +11,9 @@ module Expressir
|
|
9
11
|
attr_accessor :statements
|
10
12
|
attr_accessor :where
|
11
13
|
|
12
|
-
attr_accessor :parent
|
13
|
-
attr_accessor :remarks
|
14
|
-
|
15
14
|
def initialize(options = {})
|
16
15
|
@id = options[:id]
|
16
|
+
|
17
17
|
@applies_to = options[:applies_to]
|
18
18
|
@declarations = options[:declarations]
|
19
19
|
@constants = options[:constants]
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Schema
|
4
|
-
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
5
7
|
attr_accessor :version
|
6
8
|
attr_accessor :interfaces
|
7
9
|
attr_accessor :constants
|
8
10
|
attr_accessor :declarations
|
9
11
|
|
10
|
-
attr_accessor :remarks
|
11
|
-
|
12
12
|
def initialize(options = {})
|
13
13
|
@id = options[:id]
|
14
14
|
@version = options[:version]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Scope
|
4
|
+
def find(path)
|
5
|
+
path.downcase.split(".").reduce(self) do |acc, curr|
|
6
|
+
if acc and acc.class.method_defined? :children
|
7
|
+
acc.children.find{|x| x.id.downcase == curr}
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def children
|
13
|
+
raise 'Not implemented'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -2,15 +2,15 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Statements
|
4
4
|
class Alias
|
5
|
-
|
5
|
+
include Scope
|
6
|
+
include Identifier
|
7
|
+
|
6
8
|
attr_accessor :expression
|
7
9
|
attr_accessor :statements
|
8
10
|
|
9
|
-
attr_accessor :parent
|
10
|
-
attr_accessor :remarks
|
11
|
-
|
12
11
|
def initialize(options = {})
|
13
12
|
@id = options[:id]
|
13
|
+
|
14
14
|
@expression = options[:expression]
|
15
15
|
@statements = options[:statements]
|
16
16
|
end
|
@@ -2,7 +2,9 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Statements
|
4
4
|
class Repeat
|
5
|
-
|
5
|
+
include Scope
|
6
|
+
include Identifier
|
7
|
+
|
6
8
|
attr_accessor :bound1
|
7
9
|
attr_accessor :bound2
|
8
10
|
attr_accessor :increment
|
@@ -10,11 +12,9 @@ module Expressir
|
|
10
12
|
attr_accessor :until_expression
|
11
13
|
attr_accessor :statements
|
12
14
|
|
13
|
-
attr_accessor :parent
|
14
|
-
attr_accessor :remarks
|
15
|
-
|
16
15
|
def initialize(options = {})
|
17
16
|
@id = options[:id]
|
17
|
+
|
18
18
|
@bound1 = options[:bound1]
|
19
19
|
@bound2 = options[:bound2]
|
20
20
|
@increment = options[:increment]
|
@@ -1,22 +1,27 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class SubtypeConstraint
|
4
|
-
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
5
7
|
attr_accessor :applies_to
|
6
8
|
attr_accessor :abstract
|
7
9
|
attr_accessor :total_over
|
8
10
|
attr_accessor :supertype_expression
|
9
11
|
|
10
|
-
attr_accessor :parent
|
11
|
-
attr_accessor :remarks
|
12
|
-
|
13
12
|
def initialize(options = {})
|
14
13
|
@id = options[:id]
|
14
|
+
|
15
15
|
@applies_to = options[:applies_to]
|
16
16
|
@abstract = options[:abstract]
|
17
17
|
@total_over = options[:total_over]
|
18
18
|
@supertype_expression = options[:supertype_expression]
|
19
19
|
end
|
20
|
+
|
21
|
+
def children
|
22
|
+
items = []
|
23
|
+
items
|
24
|
+
end
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
data/lib/expressir/model/type.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Type
|
4
|
-
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
5
7
|
attr_accessor :type
|
6
8
|
attr_accessor :where
|
7
9
|
|
8
|
-
attr_accessor :parent
|
9
|
-
attr_accessor :remarks
|
10
|
-
|
11
10
|
def initialize(options = {})
|
12
11
|
@id = options[:id]
|
12
|
+
|
13
13
|
@type = options[:type]
|
14
14
|
@where = options[:where]
|
15
15
|
end
|
@@ -2,14 +2,13 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Types
|
4
4
|
class Aggregate
|
5
|
-
|
6
|
-
attr_accessor :base_type
|
5
|
+
include Identifier
|
7
6
|
|
8
|
-
attr_accessor :
|
9
|
-
attr_accessor :remarks
|
7
|
+
attr_accessor :base_type
|
10
8
|
|
11
9
|
def initialize(options = {})
|
12
|
-
@
|
10
|
+
@id = options[:id]
|
11
|
+
|
13
12
|
@base_type = options[:base_type]
|
14
13
|
end
|
15
14
|
end
|
@@ -2,13 +2,10 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Types
|
4
4
|
class Generic
|
5
|
-
|
6
|
-
|
7
|
-
attr_accessor :parent
|
8
|
-
attr_accessor :remarks
|
5
|
+
include Identifier
|
9
6
|
|
10
7
|
def initialize(options = {})
|
11
|
-
@
|
8
|
+
@id = options[:id]
|
12
9
|
end
|
13
10
|
end
|
14
11
|
end
|
@@ -2,13 +2,10 @@ module Expressir
|
|
2
2
|
module Model
|
3
3
|
module Types
|
4
4
|
class GenericEntity
|
5
|
-
|
6
|
-
|
7
|
-
attr_accessor :parent
|
8
|
-
attr_accessor :remarks
|
5
|
+
include Identifier
|
9
6
|
|
10
7
|
def initialize(options = {})
|
11
|
-
@
|
8
|
+
@id = options[:id]
|
12
9
|
end
|
13
10
|
end
|
14
11
|
end
|
@@ -1,14 +1,13 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Unique
|
4
|
-
|
5
|
-
attr_accessor :attributes
|
4
|
+
include Identifier
|
6
5
|
|
7
|
-
attr_accessor :
|
8
|
-
attr_accessor :remarks
|
6
|
+
attr_accessor :attributes
|
9
7
|
|
10
8
|
def initialize(options = {})
|
11
9
|
@id = options[:id]
|
10
|
+
|
12
11
|
@attributes = options[:attributes]
|
13
12
|
end
|
14
13
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module Expressir
|
2
2
|
module Model
|
3
3
|
class Variable
|
4
|
-
|
4
|
+
include Identifier
|
5
|
+
|
5
6
|
attr_accessor :type
|
6
7
|
attr_accessor :expression
|
7
8
|
|
8
|
-
attr_accessor :parent
|
9
|
-
attr_accessor :remarks
|
10
|
-
|
11
9
|
def initialize(options = {})
|
12
10
|
@id = options[:id]
|
11
|
+
|
13
12
|
@type = options[:type]
|
14
13
|
@expression = options[:expression]
|
15
14
|
end
|