expressir 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/demo.rb +16 -0
  4. data/expressir.gemspec +1 -0
  5. data/generate-parser.sh +29 -0
  6. data/lib/expressir/express_exp/generated/ExpressBaseVisitor.rb +779 -0
  7. data/lib/expressir/express_exp/generated/ExpressLexer.rb +841 -0
  8. data/lib/expressir/express_exp/generated/ExpressParser.rb +12136 -0
  9. data/lib/expressir/express_exp/generated/ExpressVisitor.rb +394 -0
  10. data/lib/expressir/express_exp/parser.rb +25 -0
  11. data/lib/expressir/express_exp/visitor.rb +2103 -0
  12. data/lib/expressir/model/constant.rb +15 -0
  13. data/lib/expressir/model/derived.rb +15 -0
  14. data/lib/expressir/model/entity.rb +29 -0
  15. data/lib/expressir/model/explicit.rb +15 -0
  16. data/lib/expressir/model/expressions/aggregate_element.rb +15 -0
  17. data/lib/expressir/model/expressions/attribute_qualifier.rb +13 -0
  18. data/lib/expressir/model/expressions/entity_constructor.rb +15 -0
  19. data/lib/expressir/model/expressions/expression.rb +15 -0
  20. data/lib/expressir/model/expressions/function_call.rb +15 -0
  21. data/lib/expressir/model/expressions/group_qualifier.rb +13 -0
  22. data/lib/expressir/model/expressions/index_qualifier.rb +15 -0
  23. data/lib/expressir/model/expressions/interval.rb +21 -0
  24. data/lib/expressir/model/expressions/qualified_ref.rb +15 -0
  25. data/lib/expressir/model/expressions/query.rb +17 -0
  26. data/lib/expressir/model/expressions/unknown.rb +8 -0
  27. data/lib/expressir/model/function.rb +23 -0
  28. data/lib/expressir/model/inverse.rb +15 -0
  29. data/lib/expressir/model/local.rb +15 -0
  30. data/lib/expressir/model/operators/addition.rb +8 -0
  31. data/lib/expressir/model/operators/and.rb +8 -0
  32. data/lib/expressir/model/operators/andor.rb +8 -0
  33. data/lib/expressir/model/operators/combine.rb +8 -0
  34. data/lib/expressir/model/operators/equal.rb +8 -0
  35. data/lib/expressir/model/operators/exponentiation.rb +8 -0
  36. data/lib/expressir/model/operators/greater_than.rb +8 -0
  37. data/lib/expressir/model/operators/greater_than_or_equal.rb +8 -0
  38. data/lib/expressir/model/operators/in.rb +8 -0
  39. data/lib/expressir/model/operators/instance_equal.rb +8 -0
  40. data/lib/expressir/model/operators/instance_not_equal.rb +8 -0
  41. data/lib/expressir/model/operators/integer_division.rb +8 -0
  42. data/lib/expressir/model/operators/less_than.rb +8 -0
  43. data/lib/expressir/model/operators/less_than_or_equal.rb +8 -0
  44. data/lib/expressir/model/operators/like.rb +8 -0
  45. data/lib/expressir/model/operators/modulo.rb +8 -0
  46. data/lib/expressir/model/operators/multiplication.rb +8 -0
  47. data/lib/expressir/model/operators/not.rb +8 -0
  48. data/lib/expressir/model/operators/not_equal.rb +8 -0
  49. data/lib/expressir/model/operators/oneof.rb +8 -0
  50. data/lib/expressir/model/operators/or.rb +8 -0
  51. data/lib/expressir/model/operators/real_division.rb +8 -0
  52. data/lib/expressir/model/operators/subtraction.rb +8 -0
  53. data/lib/expressir/model/operators/unary_minus.rb +8 -0
  54. data/lib/expressir/model/operators/unary_plus.rb +8 -0
  55. data/lib/expressir/model/operators/xor.rb +8 -0
  56. data/lib/expressir/model/parameter.rb +15 -0
  57. data/lib/expressir/model/procedure.rb +21 -0
  58. data/lib/expressir/model/ref.rb +11 -0
  59. data/lib/expressir/model/reference.rb +13 -0
  60. data/lib/expressir/model/renamed_ref.rb +13 -0
  61. data/lib/expressir/model/repository.rb +11 -0
  62. data/lib/expressir/model/rule.rb +23 -0
  63. data/lib/expressir/model/schema.rb +41 -0
  64. data/lib/expressir/model/statements/alias.rb +17 -0
  65. data/lib/expressir/model/statements/assignment.rb +15 -0
  66. data/lib/expressir/model/statements/case.rb +17 -0
  67. data/lib/expressir/model/statements/case_action.rb +15 -0
  68. data/lib/expressir/model/statements/compound.rb +13 -0
  69. data/lib/expressir/model/statements/escape.rb +8 -0
  70. data/lib/expressir/model/statements/if.rb +17 -0
  71. data/lib/expressir/model/statements/null.rb +8 -0
  72. data/lib/expressir/model/statements/procedure_call.rb +15 -0
  73. data/lib/expressir/model/statements/repeat.rb +25 -0
  74. data/lib/expressir/model/statements/return.rb +13 -0
  75. data/lib/expressir/model/statements/skip.rb +8 -0
  76. data/lib/expressir/model/subtype_constraint.rb +19 -0
  77. data/lib/expressir/model/type.rb +15 -0
  78. data/lib/expressir/model/types/aggregate.rb +15 -0
  79. data/lib/expressir/model/types/array.rb +21 -0
  80. data/lib/expressir/model/types/bag.rb +17 -0
  81. data/lib/expressir/model/types/binary.rb +15 -0
  82. data/lib/expressir/model/types/boolean.rb +8 -0
  83. data/lib/expressir/model/types/enumeration.rb +19 -0
  84. data/lib/expressir/model/types/generic.rb +13 -0
  85. data/lib/expressir/model/types/generic_entity.rb +13 -0
  86. data/lib/expressir/model/types/integer.rb +8 -0
  87. data/lib/expressir/model/types/list.rb +19 -0
  88. data/lib/expressir/model/types/logical.rb +8 -0
  89. data/lib/expressir/model/types/number.rb +8 -0
  90. data/lib/expressir/model/types/real.rb +13 -0
  91. data/lib/expressir/model/types/select.rb +21 -0
  92. data/lib/expressir/model/types/set.rb +17 -0
  93. data/lib/expressir/model/types/string.rb +15 -0
  94. data/lib/expressir/model/unique.rb +13 -0
  95. data/lib/expressir/model/use.rb +13 -0
  96. data/lib/expressir/model/where.rb +13 -0
  97. data/lib/expressir/version.rb +1 -1
  98. data/original/examples/syntax/syntax.exp +295 -0
  99. data/spec/expressir/express_exp/ap233_spec.rb +22 -0
  100. data/spec/expressir/express_exp/syntax_spec.rb +2640 -0
  101. metadata +115 -5
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class LessThanOrEqual
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Like
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Modulo
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Multiplication
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Not
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class NotEqual
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Oneof
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Or
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class RealDivision
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Subtraction
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class UnaryMinus
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class UnaryPlus
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Xor
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ class Parameter
4
+ attr_accessor :id
5
+ attr_accessor :type
6
+ attr_accessor :var
7
+
8
+ def initialize(options = {})
9
+ @id = options[:id]
10
+ @type = options[:type]
11
+ @var = options[:var]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -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,11 @@
1
+ module Expressir
2
+ module Model
3
+ class Ref
4
+ attr_accessor :id
5
+
6
+ def initialize(options = {})
7
+ @id = options[:id]
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ module Expressir
2
+ module Model
3
+ class Reference
4
+ attr_accessor :schema
5
+ attr_accessor :items
6
+
7
+ def initialize(options = {})
8
+ @schema = options[:schema]
9
+ @items = options[:items]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Expressir
2
+ module Model
3
+ class RenamedRef
4
+ attr_accessor :ref
5
+ attr_accessor :id
6
+
7
+ def initialize(options = {})
8
+ @ref = options[:ref]
9
+ @id = options[:id]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module Expressir
2
+ module Model
3
+ class Repository
4
+ attr_accessor :schemas
5
+
6
+ def initialize(options = {})
7
+ @schemas = options[:schemas]
8
+ end
9
+ end
10
+ end
11
+ 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,15 @@
1
+ module Expressir
2
+ module Model
3
+ module Statements
4
+ class Assignment
5
+ attr_accessor :ref
6
+ attr_accessor :expression
7
+
8
+ def initialize(options = {})
9
+ @ref = options[:ref]
10
+ @expression = options[:expression]
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 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,13 @@
1
+ module Expressir
2
+ module Model
3
+ module Statements
4
+ class Compound
5
+ attr_accessor :statements
6
+
7
+ def initialize(options = {})
8
+ @statements = options[:statements]
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Statements
4
+ class Escape
5
+ end
6
+ end
7
+ end
8
+ 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,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Statements
4
+ class Null
5
+ end
6
+ end
7
+ end
8
+ 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