expressir 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/demo.rb +16 -0
- data/expressir.gemspec +1 -0
- data/generate-parser.sh +29 -0
- data/lib/expressir/express_exp/generated/ExpressBaseVisitor.rb +779 -0
- data/lib/expressir/express_exp/generated/ExpressLexer.rb +841 -0
- data/lib/expressir/express_exp/generated/ExpressParser.rb +12136 -0
- data/lib/expressir/express_exp/generated/ExpressVisitor.rb +394 -0
- data/lib/expressir/express_exp/parser.rb +25 -0
- data/lib/expressir/express_exp/visitor.rb +2103 -0
- data/lib/expressir/model/constant.rb +15 -0
- data/lib/expressir/model/derived.rb +15 -0
- data/lib/expressir/model/entity.rb +29 -0
- data/lib/expressir/model/explicit.rb +15 -0
- data/lib/expressir/model/expressions/aggregate_element.rb +15 -0
- data/lib/expressir/model/expressions/attribute_qualifier.rb +13 -0
- data/lib/expressir/model/expressions/entity_constructor.rb +15 -0
- data/lib/expressir/model/expressions/expression.rb +15 -0
- data/lib/expressir/model/expressions/function_call.rb +15 -0
- data/lib/expressir/model/expressions/group_qualifier.rb +13 -0
- data/lib/expressir/model/expressions/index_qualifier.rb +15 -0
- data/lib/expressir/model/expressions/interval.rb +21 -0
- data/lib/expressir/model/expressions/qualified_ref.rb +15 -0
- data/lib/expressir/model/expressions/query.rb +17 -0
- data/lib/expressir/model/expressions/unknown.rb +8 -0
- data/lib/expressir/model/function.rb +23 -0
- data/lib/expressir/model/inverse.rb +15 -0
- data/lib/expressir/model/local.rb +15 -0
- data/lib/expressir/model/operators/addition.rb +8 -0
- data/lib/expressir/model/operators/and.rb +8 -0
- data/lib/expressir/model/operators/andor.rb +8 -0
- data/lib/expressir/model/operators/combine.rb +8 -0
- data/lib/expressir/model/operators/equal.rb +8 -0
- data/lib/expressir/model/operators/exponentiation.rb +8 -0
- data/lib/expressir/model/operators/greater_than.rb +8 -0
- data/lib/expressir/model/operators/greater_than_or_equal.rb +8 -0
- data/lib/expressir/model/operators/in.rb +8 -0
- data/lib/expressir/model/operators/instance_equal.rb +8 -0
- data/lib/expressir/model/operators/instance_not_equal.rb +8 -0
- data/lib/expressir/model/operators/integer_division.rb +8 -0
- data/lib/expressir/model/operators/less_than.rb +8 -0
- data/lib/expressir/model/operators/less_than_or_equal.rb +8 -0
- data/lib/expressir/model/operators/like.rb +8 -0
- data/lib/expressir/model/operators/modulo.rb +8 -0
- data/lib/expressir/model/operators/multiplication.rb +8 -0
- data/lib/expressir/model/operators/not.rb +8 -0
- data/lib/expressir/model/operators/not_equal.rb +8 -0
- data/lib/expressir/model/operators/oneof.rb +8 -0
- data/lib/expressir/model/operators/or.rb +8 -0
- data/lib/expressir/model/operators/real_division.rb +8 -0
- data/lib/expressir/model/operators/subtraction.rb +8 -0
- data/lib/expressir/model/operators/unary_minus.rb +8 -0
- data/lib/expressir/model/operators/unary_plus.rb +8 -0
- data/lib/expressir/model/operators/xor.rb +8 -0
- data/lib/expressir/model/parameter.rb +15 -0
- data/lib/expressir/model/procedure.rb +21 -0
- data/lib/expressir/model/ref.rb +11 -0
- data/lib/expressir/model/reference.rb +13 -0
- data/lib/expressir/model/renamed_ref.rb +13 -0
- data/lib/expressir/model/repository.rb +11 -0
- data/lib/expressir/model/rule.rb +23 -0
- data/lib/expressir/model/schema.rb +41 -0
- data/lib/expressir/model/statements/alias.rb +17 -0
- data/lib/expressir/model/statements/assignment.rb +15 -0
- data/lib/expressir/model/statements/case.rb +17 -0
- data/lib/expressir/model/statements/case_action.rb +15 -0
- data/lib/expressir/model/statements/compound.rb +13 -0
- data/lib/expressir/model/statements/escape.rb +8 -0
- data/lib/expressir/model/statements/if.rb +17 -0
- data/lib/expressir/model/statements/null.rb +8 -0
- data/lib/expressir/model/statements/procedure_call.rb +15 -0
- data/lib/expressir/model/statements/repeat.rb +25 -0
- data/lib/expressir/model/statements/return.rb +13 -0
- data/lib/expressir/model/statements/skip.rb +8 -0
- data/lib/expressir/model/subtype_constraint.rb +19 -0
- data/lib/expressir/model/type.rb +15 -0
- data/lib/expressir/model/types/aggregate.rb +15 -0
- data/lib/expressir/model/types/array.rb +21 -0
- data/lib/expressir/model/types/bag.rb +17 -0
- data/lib/expressir/model/types/binary.rb +15 -0
- data/lib/expressir/model/types/boolean.rb +8 -0
- data/lib/expressir/model/types/enumeration.rb +19 -0
- data/lib/expressir/model/types/generic.rb +13 -0
- data/lib/expressir/model/types/generic_entity.rb +13 -0
- data/lib/expressir/model/types/integer.rb +8 -0
- data/lib/expressir/model/types/list.rb +19 -0
- data/lib/expressir/model/types/logical.rb +8 -0
- data/lib/expressir/model/types/number.rb +8 -0
- data/lib/expressir/model/types/real.rb +13 -0
- data/lib/expressir/model/types/select.rb +21 -0
- data/lib/expressir/model/types/set.rb +17 -0
- data/lib/expressir/model/types/string.rb +15 -0
- data/lib/expressir/model/unique.rb +13 -0
- data/lib/expressir/model/use.rb +13 -0
- data/lib/expressir/model/where.rb +13 -0
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/syntax.exp +295 -0
- data/spec/expressir/express_exp/ap233_spec.rb +22 -0
- data/spec/expressir/express_exp/syntax_spec.rb +2640 -0
- metadata +115 -5
@@ -0,0 +1,21 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Procedure
|
4
|
+
attr_accessor :id
|
5
|
+
attr_accessor :parameters
|
6
|
+
attr_accessor :declarations
|
7
|
+
attr_accessor :constants
|
8
|
+
attr_accessor :locals
|
9
|
+
attr_accessor :statements
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@id = options[:id]
|
13
|
+
@parameters = options[:parameters]
|
14
|
+
@declarations = options[:declarations]
|
15
|
+
@constants = options[:constants]
|
16
|
+
@locals = options[:locals]
|
17
|
+
@statements = options[:statements]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Rule
|
4
|
+
attr_accessor :id
|
5
|
+
attr_accessor :applies_to
|
6
|
+
attr_accessor :declarations
|
7
|
+
attr_accessor :constants
|
8
|
+
attr_accessor :locals
|
9
|
+
attr_accessor :where
|
10
|
+
attr_accessor :statements
|
11
|
+
|
12
|
+
def initialize(options = {})
|
13
|
+
@id = options[:id]
|
14
|
+
@applies_to = options[:applies_to]
|
15
|
+
@declarations = options[:declarations]
|
16
|
+
@constants = options[:constants]
|
17
|
+
@locals = options[:locals]
|
18
|
+
@where = options[:where]
|
19
|
+
@statements = options[:statements]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Schema
|
4
|
+
attr_accessor :id
|
5
|
+
attr_accessor :version
|
6
|
+
attr_accessor :interfaces
|
7
|
+
attr_accessor :constants
|
8
|
+
attr_accessor :declarations
|
9
|
+
attr_accessor :rules
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@id = options[:id]
|
13
|
+
@version = options[:version]
|
14
|
+
@interfaces = options[:interfaces]
|
15
|
+
@constants = options[:constants]
|
16
|
+
@declarations = options[:declarations]
|
17
|
+
@rules = options[:rules]
|
18
|
+
end
|
19
|
+
|
20
|
+
def types
|
21
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Type}
|
22
|
+
end
|
23
|
+
|
24
|
+
def entities
|
25
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Entity}
|
26
|
+
end
|
27
|
+
|
28
|
+
def subtype_constraints
|
29
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::SubtypeConstraint}
|
30
|
+
end
|
31
|
+
|
32
|
+
def functions
|
33
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Function}
|
34
|
+
end
|
35
|
+
|
36
|
+
def procedures
|
37
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Procedure}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Statements
|
4
|
+
class Alias
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :expression
|
7
|
+
attr_accessor :statements
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
@id = options[:id]
|
11
|
+
@expression = options[:expression]
|
12
|
+
@statements = options[:statements]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Statements
|
4
|
+
class Case
|
5
|
+
attr_accessor :selector
|
6
|
+
attr_accessor :actions
|
7
|
+
attr_accessor :otherwise_statement
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
@selector = options[:selector]
|
11
|
+
@actions = options[:actions]
|
12
|
+
@otherwise_statement = options[:otherwise_statement]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Statements
|
4
|
+
class CaseAction
|
5
|
+
attr_accessor :label
|
6
|
+
attr_accessor :statement
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@label = options[:label]
|
10
|
+
@statement = options[:statement]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Statements
|
4
|
+
class If
|
5
|
+
attr_accessor :condition
|
6
|
+
attr_accessor :statements
|
7
|
+
attr_accessor :else_statements
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
@condition = options[:condition]
|
11
|
+
@statements = options[:statements]
|
12
|
+
@else_statements = options[:else_statements]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Statements
|
4
|
+
class ProcedureCall
|
5
|
+
attr_accessor :procedure
|
6
|
+
attr_accessor :parameters
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@procedure = options[:procedure]
|
10
|
+
@parameters = options[:parameters]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Statements
|
4
|
+
class Repeat
|
5
|
+
attr_accessor :variable
|
6
|
+
attr_accessor :bound1
|
7
|
+
attr_accessor :bound2
|
8
|
+
attr_accessor :increment
|
9
|
+
attr_accessor :while_expression
|
10
|
+
attr_accessor :until_expression
|
11
|
+
attr_accessor :statements
|
12
|
+
|
13
|
+
def initialize(options = {})
|
14
|
+
@variable = options[:variable]
|
15
|
+
@bound1 = options[:bound1]
|
16
|
+
@bound2 = options[:bound2]
|
17
|
+
@increment = options[:increment]
|
18
|
+
@while_expression = options[:while_expression]
|
19
|
+
@until_expression = options[:until_expression]
|
20
|
+
@statements = options[:statements]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|