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,15 @@
1
+ module Expressir
2
+ module Model
3
+ class Constant
4
+ attr_accessor :id
5
+ attr_accessor :type
6
+ attr_accessor :expression
7
+
8
+ def initialize(options = {})
9
+ @id = options[:id]
10
+ @type = options[:type]
11
+ @expression = options[:expression]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ class Derived
4
+ attr_accessor :id
5
+ attr_accessor :type
6
+ attr_accessor :expression
7
+
8
+ def initialize(options = {})
9
+ @id = options[:id]
10
+ @type = options[:type]
11
+ @expression = options[:expression]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,29 @@
1
+ module Expressir
2
+ module Model
3
+ class Entity
4
+ attr_accessor :id
5
+ attr_accessor :abstract
6
+ attr_accessor :abstract_supertype
7
+ attr_accessor :supertypes
8
+ attr_accessor :subtype_expression
9
+ attr_accessor :explicit
10
+ attr_accessor :derived
11
+ attr_accessor :inverse
12
+ attr_accessor :unique
13
+ attr_accessor :where
14
+
15
+ def initialize(options = {})
16
+ @id = options[:id]
17
+ @abstract = options[:abstract]
18
+ @abstract_supertype = options[:abstract_supertype]
19
+ @supertypes = options[:supertypes]
20
+ @subtype_expression = options[:subtype_expression]
21
+ @explicit = options[:explicit]
22
+ @derived = options[:derived]
23
+ @inverse = options[:inverse]
24
+ @unique = options[:unique]
25
+ @where = options[:where]
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ class Explicit
4
+ attr_accessor :id
5
+ attr_accessor :optional
6
+ attr_accessor :type
7
+
8
+ def initialize(options = {})
9
+ @id = options[:id]
10
+ @optional = options[:optional]
11
+ @type = options[:type]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class AggregateElement
5
+ attr_accessor :expression
6
+ attr_accessor :repetition
7
+
8
+ def initialize(options = {})
9
+ @expression = options[:expression]
10
+ @repetition = options[:repetition]
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class AttributeQualifier
5
+ attr_accessor :attribute
6
+
7
+ def initialize(options = {})
8
+ @attribute = options[:attribute]
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class EntityConstructor
5
+ attr_accessor :entity
6
+ attr_accessor :parameters
7
+
8
+ def initialize(options = {})
9
+ @entity = options[:entity]
10
+ @parameters = options[:parameters]
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class Expression
5
+ attr_accessor :operator
6
+ attr_accessor :operands
7
+
8
+ def initialize(options = {})
9
+ @operator = options[:operator]
10
+ @operands = options[:operands]
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class FunctionCall
5
+ attr_accessor :function
6
+ attr_accessor :parameters
7
+
8
+ def initialize(options = {})
9
+ @function = options[:function]
10
+ @parameters = options[:parameters]
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class GroupQualifier
5
+ attr_accessor :entity
6
+
7
+ def initialize(options = {})
8
+ @entity = options[:entity]
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class IndexQualifier
5
+ attr_accessor :index1
6
+ attr_accessor :index2
7
+
8
+ def initialize(options = {})
9
+ @index1 = options[:index1]
10
+ @index2 = options[:index2]
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class Interval
5
+ attr_accessor :low
6
+ attr_accessor :operator1
7
+ attr_accessor :item
8
+ attr_accessor :operator2
9
+ attr_accessor :high
10
+
11
+ def initialize(options = {})
12
+ @low = options[:low]
13
+ @operator1 = options[:operator1]
14
+ @item = options[:item]
15
+ @operator2 = options[:operator2]
16
+ @high = options[:high]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class QualifiedRef
5
+ attr_accessor :ref
6
+ attr_accessor :qualifiers
7
+
8
+ def initialize(options = {})
9
+ @ref = options[:ref]
10
+ @qualifiers = options[:qualifiers]
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class Query
5
+ attr_accessor :id
6
+ attr_accessor :source
7
+ attr_accessor :expression
8
+
9
+ def initialize(options = {})
10
+ @id = options[:id]
11
+ @source = options[:source]
12
+ @expression = options[:expression]
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Expressions
4
+ class Unknown
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ module Expressir
2
+ module Model
3
+ class Function
4
+ attr_accessor :id
5
+ attr_accessor :parameters
6
+ attr_accessor :return_type
7
+ attr_accessor :declarations
8
+ attr_accessor :constants
9
+ attr_accessor :locals
10
+ attr_accessor :statements
11
+
12
+ def initialize(options = {})
13
+ @id = options[:id]
14
+ @parameters = options[:parameters]
15
+ @return_type = options[:return_type]
16
+ @declarations = options[:declarations]
17
+ @constants = options[:constants]
18
+ @locals = options[:locals]
19
+ @statements = options[:statements]
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ class Inverse
4
+ attr_accessor :id
5
+ attr_accessor :type
6
+ attr_accessor :attribute
7
+
8
+ def initialize(options = {})
9
+ @id = options[:id]
10
+ @type = options[:type]
11
+ @attribute = options[:attribute]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Expressir
2
+ module Model
3
+ class Local
4
+ attr_accessor :id
5
+ attr_accessor :type
6
+ attr_accessor :expression
7
+
8
+ def initialize(options = {})
9
+ @id = options[:id]
10
+ @type = options[:type]
11
+ @expression = options[:expression]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Addition
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class And
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Andor
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Combine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Equal
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class Exponentiation
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class GreaterThan
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class GreaterThanOrEqual
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class In
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class InstanceEqual
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class InstanceNotEqual
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class IntegerDivision
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Expressir
2
+ module Model
3
+ module Operators
4
+ class LessThan
5
+ end
6
+ end
7
+ end
8
+ end