rdl 1.1.0 → 1.1.1.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGES.md +25 -0
  4. data/README.md +104 -64
  5. data/extras/type_tests/%.rb +171 -0
  6. data/extras/type_tests/&.rb +159 -0
  7. data/extras/type_tests/**.rb +222 -0
  8. data/extras/type_tests/*.rb +177 -0
  9. data/extras/type_tests/+.rb +170 -0
  10. data/extras/type_tests/-.rb +171 -0
  11. data/extras/type_tests/1scomp.rb +157 -0
  12. data/extras/type_tests/<.rb +170 -0
  13. data/extras/type_tests/<<.rb +159 -0
  14. data/extras/type_tests/>>.rb +159 -0
  15. data/extras/type_tests/[].rb +163 -0
  16. data/extras/type_tests/^.rb +159 -0
  17. data/extras/type_tests/abs.rb +155 -0
  18. data/extras/type_tests/abs2.rb +164 -0
  19. data/extras/type_tests/angle.rb +157 -0
  20. data/extras/type_tests/arg.rb +157 -0
  21. data/extras/type_tests/bit_length.rb +157 -0
  22. data/extras/type_tests/ceil.rb +157 -0
  23. data/extras/type_tests/ceilRational.rb +160 -0
  24. data/extras/type_tests/conj.rb +158 -0
  25. data/extras/type_tests/defwhere.rb +86 -0
  26. data/extras/type_tests/denominator.rb +157 -0
  27. data/extras/type_tests/div.rb +172 -0
  28. data/extras/type_tests/divslash.rb +179 -0
  29. data/extras/type_tests/even?.rb +157 -0
  30. data/extras/type_tests/fdiv.rb +244 -0
  31. data/extras/type_tests/finite?.rb +157 -0
  32. data/extras/type_tests/floor.rb +157 -0
  33. data/extras/type_tests/floorRational.rb +161 -0
  34. data/extras/type_tests/hash.rb +157 -0
  35. data/extras/type_tests/imag.rb +158 -0
  36. data/extras/type_tests/infinite?.rb +157 -0
  37. data/extras/type_tests/modulo.rb +171 -0
  38. data/extras/type_tests/nan?.rb +157 -0
  39. data/extras/type_tests/neg.rb +155 -0
  40. data/extras/type_tests/next.rb +157 -0
  41. data/extras/type_tests/next_float.rb +157 -0
  42. data/extras/type_tests/numerator.rb +157 -0
  43. data/extras/type_tests/phase.rb +157 -0
  44. data/extras/type_tests/prev_float.rb +157 -0
  45. data/extras/type_tests/quo.rb +179 -0
  46. data/extras/type_tests/rationalize.rb +157 -0
  47. data/extras/type_tests/rationalizeArg.rb +198 -0
  48. data/extras/type_tests/real.rb +157 -0
  49. data/extras/type_tests/real?.rb +157 -0
  50. data/extras/type_tests/round.rb +157 -0
  51. data/extras/type_tests/roundArg.rb +169 -0
  52. data/extras/type_tests/size.rb +157 -0
  53. data/extras/type_tests/to_c.rb +157 -0
  54. data/extras/type_tests/to_f.rb +155 -0
  55. data/extras/type_tests/to_i.rb +157 -0
  56. data/extras/type_tests/to_r.rb +157 -0
  57. data/extras/type_tests/to_s.rb +157 -0
  58. data/extras/type_tests/truncate.rb +157 -0
  59. data/extras/type_tests/truncateArg.rb +166 -0
  60. data/extras/type_tests/type tests +1 -0
  61. data/extras/type_tests/zero?.rb +155 -0
  62. data/extras/type_tests/|.rb +159 -0
  63. data/lib/rdl/contracts/and.rb +1 -1
  64. data/lib/rdl/contracts/flat.rb +2 -2
  65. data/lib/rdl/contracts/proc.rb +2 -1
  66. data/lib/rdl/types/.#lexer.rex +1 -0
  67. data/lib/rdl/types/dependent_arg.rb +47 -0
  68. data/lib/rdl/types/finitehash.rb +5 -5
  69. data/lib/rdl/types/generic.rb +3 -3
  70. data/lib/rdl/types/lexer.rex +5 -2
  71. data/lib/rdl/types/lexer.rex.rb +3 -0
  72. data/lib/rdl/types/method.rb +144 -15
  73. data/lib/rdl/types/nominal.rb +1 -1
  74. data/lib/rdl/types/parser.racc +6 -1
  75. data/lib/rdl/types/parser.tab.rb +272 -245
  76. data/lib/rdl/types/tuple.rb +1 -1
  77. data/lib/rdl/types/type_inferencer.rb +7 -7
  78. data/lib/rdl/wrap.rb +16 -11
  79. data/rdl.gemspec +3 -3
  80. data/test/test_dsl.rb +4 -5
  81. data/test/test_le.rb +5 -5
  82. data/test/test_lib_types.rb +34 -34
  83. data/test/test_member.rb +3 -3
  84. data/test/test_type_contract.rb +63 -1
  85. data/test/test_types.rb +2 -0
  86. data/types/ruby-2.x/_aliases.rb +2 -2
  87. data/types/ruby-2.x/bigdecimal.rb +246 -12
  88. data/types/ruby-2.x/bignum.rb +253 -0
  89. data/types/ruby-2.x/complex.rb +111 -22
  90. data/types/ruby-2.x/fixnum.rb +238 -31
  91. data/types/ruby-2.x/float.rb +217 -35
  92. data/types/ruby-2.x/integer.rb +17 -16
  93. data/types/ruby-2.x/numeric.rb +31 -21
  94. data/types/ruby-2.x/rational.rb +196 -18
  95. metadata +67 -4
@@ -7,6 +7,8 @@ macro
7
7
  SPECIAL_ID %\w+
8
8
  FIXNUM -?(\d)+
9
9
  FLOAT -?\d\.\d+
10
+ PREDICATE \{\{(?:(?!}}).)+\}\}
11
+
10
12
 
11
13
  rule
12
14
  \s # skip
@@ -15,6 +17,7 @@ rule
15
17
  => { [:RASSOC, text] }
16
18
  \( { [:LPAREN, text] }
17
19
  \) { [:RPAREN, text] }
20
+ {PREDICATE} { [:PREDICATE, text] }
18
21
  \{ { [:LBRACE, text] }
19
22
  \} { [:RBRACE, text] }
20
23
  \[ { [:LBRACKET, text] }
@@ -24,8 +27,8 @@ rule
24
27
  , { [:COMMA, text] }
25
28
  \? { [:QUERY, text] }
26
29
  \* { [:STAR, text] }
27
- \#T { [:HASH_TYPE, text] }
28
- \#Q { [:HASH_QUERY, text] }
30
+ \#T { [:HASH_TYPE, text] }
31
+ \#Q { [:HASH_QUERY, text] }
29
32
  \$\{ { [:CONST_BEGIN, text] }
30
33
  \.\.\. { [:DOTS, text] }
31
34
  \. { [:DOT, text] }
@@ -76,6 +76,9 @@ class Parser < Racc::Parser
76
76
  when (text = @ss.scan(/\)/))
77
77
  action { [:RPAREN, text] }
78
78
 
79
+ when (text = @ss.scan(/\{\{(?:(?!}}).)+\}\}/))
80
+ action { [:PREDICATE, text] }
81
+
79
82
  when (text = @ss.scan(/\{/))
80
83
  action { [:LBRACE, text] }
81
84
 
@@ -57,14 +57,23 @@ module RDL::Type
57
57
  end
58
58
 
59
59
  # TODO: Check blk
60
- def pre_cond?(inst, *args, &blk)
60
+ def pre_cond?(blk, slf, inst, bind, *args)
61
61
  states = [[0, 0]] # [position in @arg, position in args]
62
+ preds = []
62
63
  until states.empty?
63
64
  formal, actual = states.pop
64
- return true if formal == @args.size && actual == args.size # Matched all actuals, no formals left over
65
+ if formal == @args.size && actual == args.size then # Matched all actuals, no formals left over
66
+ check_arg_preds(bind, preds) if preds.size>0
67
+ @args.each_with_index {|a,i| args[i] = block_wrap(slf,inst,a,bind,&args[i]) if a.is_a?(RDL::Type::MethodType) }
68
+ blk = block_wrap(slf,inst,@block,bind,&blk) if @block
69
+ return [true, args, blk, bind]
70
+ end
65
71
  next if formal >= @args.size # Too many actuals to match
66
72
  t = @args[formal]
67
- t = t.type if t.instance_of? AnnotatedArgType
73
+ if t.instance_of? AnnotatedArgType then
74
+ bind.local_variable_set(t.name.to_sym,args[actual])
75
+ t = t.type
76
+ end
68
77
  case t
69
78
  when OptionalType
70
79
  t = t.type.instantiate(inst)
@@ -87,7 +96,22 @@ module RDL::Type
87
96
  else
88
97
  states << [formal+1, actual] # skip
89
98
  end
99
+ when DependentArgType
100
+ bind.local_variable_set(t.name.to_sym,args[actual])
101
+ preds.push(t)
102
+ t = t.type.instantiate(inst)
103
+ the_actual = nil
104
+ if actual == args.size
105
+ next unless t.instance_of? FiniteHashType
106
+ if t.member?({}, vars_wild: true) # try matching against the empty hash
107
+ states << [formal+1, actual]
108
+ end
109
+ elsif t.member?(args[actual], vars_wild: true)
110
+ states << [formal+1, actual+1] # match
111
+ # no else case; if there is no match, this is a dead end
112
+ end
90
113
  else
114
+ t = RDL::Type::NominalType.new 'Proc' if t.instance_of? MethodType
91
115
  t = t.instantiate(inst)
92
116
  the_actual = nil
93
117
  if actual == args.size
@@ -101,43 +125,104 @@ module RDL::Type
101
125
  end
102
126
  end
103
127
  end
104
- return false
128
+ return [false, args, blk, bind]
105
129
  end
106
130
 
107
- def post_cond?(inst, ret, *args)
131
+ def check_arg_preds(bind, preds)
132
+ preds.each_with_index { |p,i|
133
+ if !eval(p.predicate, bind) then
134
+ raise TypeError, <<RUBY
135
+ Argument does not match type predicate.
136
+ Expected arg type:
137
+ #{p}
138
+ Actual argument value:
139
+ #{bind.local_variable_get(p.name)}
140
+ RUBY
141
+ end
142
+ }
143
+ return true
144
+ end
145
+
146
+ def check_ret_pred(bind, pred)
147
+ if !eval(pred.predicate, bind) then
148
+ raise TypeError, <<RUBY
149
+ Return value does not match type predicate.
150
+ Expected return type:
151
+ #{pred}
152
+ Actual return value:
153
+ #{bind.local_variable_get(pred.name)}
154
+ RUBY
155
+ end
156
+ return true
157
+ end
158
+
159
+ def post_cond?(slf, inst, ret, bind, *args)
160
+ new_ret = ret
161
+ if @ret.is_a?(RDL::Type::MethodType) then
162
+ if !ret.is_a?(Proc) then
163
+ return [false,ret]
164
+ else
165
+ new_ret = block_wrap(slf,inst,@ret,bind,&ret)
166
+ return [true, new_ret]
167
+ end
168
+ end
108
169
  method_name = method_name ? method_name + ": " : ""
109
- return @ret.instantiate(inst).member?(ret, vars_wild: true)
170
+ if @ret.is_a?(DependentArgType) then
171
+ bind.local_variable_set(@ret.name.to_sym, ret)
172
+ check_ret_pred(bind,@ret)
173
+ end
174
+ return [@ret.instantiate(inst).member?(ret, vars_wild: true), new_ret]
110
175
  end
111
176
 
112
177
  def to_contract(inst: nil)
113
178
  c = @@contract_cache[self]
114
179
  return c if c
115
-
116
180
  # slf.ret, slf.args are the formals
117
181
  # ret, args are the actuals
118
182
  slf = self # Bind self so it's captured in a closure, since contracts are executed
119
183
  # with self bound to the receiver method's self
184
+ bind = binding
120
185
  prec = RDL::Contract::FlatContract.new { |*args, &blk|
121
- raise TypeError, "Arguments #{args} do not match argument types #{slf}" unless slf.pre_cond?(inst, *args, &blk)
186
+ raise TypeError, "Arguments #{args} do not match argument types #{slf}" unless slf.pre_cond?(blk, slf, inst, bind, *args)[0]
122
187
  true
123
188
  }
124
189
  postc = RDL::Contract::FlatContract.new { |ret, *args|
125
- raise TypeError, "Return #{ret} does not match return type #{slf}" unless slf.post_cond?(inst, ret, *args)
190
+ raise TypeError, "Return #{ret} does not match return type #{slf}" unless slf.post_cond?(slf, inst, ret, bind, *args)[0]
126
191
  true
127
192
  }
128
193
  c = RDL::Contract::ProcContract.new(pre_cond: prec, post_cond: postc)
129
194
  return (@@contract_cache[self] = c) # assignment evaluates to c
130
195
  end
131
196
 
197
+ def to_higher_contract(sf, &blk)
198
+ #method for testing higher order contracts
199
+ #to_contract method only works for flat contracts
200
+ slf = self
201
+ inst = nil
202
+ bind = binding
203
+ Proc.new {|*args, &other_blk|
204
+ res,args,other_blk,bind = slf.pre_cond?(other_blk, slf, inst, bind, *args)
205
+ raise TypeError, "Arguments #{args} do not match argument types #{slf}" unless res
206
+ tmp = other_blk ? sf.instance_exec(*args, other_blk, &blk) : sf.instance_exec(*args, &blk)
207
+ res_post, ret = slf.post_cond?(slf, inst, tmp, bind, *args)
208
+ raise TypeError, "Return #{ret} does not match return type #{slf}" unless res_post
209
+ ret
210
+ }
211
+ end
212
+
213
+
132
214
  # [+types+] is an array of method types. Checks that [+args+] and
133
215
  # [+blk+] match at least one arm of the intersection type;
134
216
  # otherwise raises exception. Returns array of method types that
135
217
  # matched [+args+] and [+blk+]
136
- def self.check_arg_types(method_name, types, inst, *args, &blk)
218
+ def self.check_arg_types(method_name, slf, bind, types, inst, *args, &blk)
137
219
  $__rdl_contract_switch.off {
138
220
  matches = [] # types that matched args
139
- types.each_with_index { |t, i| matches << i if t.pre_cond?(inst, *args, &blk) }
140
- return matches if matches.size > 0
221
+ types.each_with_index { |t, i|
222
+ res,args,blk,bind =t.pre_cond?(blk,slf,inst,bind,*args)
223
+ matches << i if res
224
+ }
225
+ return [matches, args, blk, bind] if matches.size > 0
141
226
  method_name = method_name ? method_name + ": " : ""
142
227
  raise TypeError, <<RUBY
143
228
  #{method_name}Argument type error.
@@ -151,9 +236,11 @@ RUBY
151
236
  }
152
237
  end
153
238
 
154
- def self.check_ret_types(method_name, types, inst, matches, ret, *args, &blk)
239
+ def self.check_ret_types(slf, method_name, types, inst, matches, ret, bind, *args, &blk)
155
240
  $__rdl_contract_switch.off {
156
- matches.each { |i| return true if types[i].post_cond?(inst, ret, *args) }
241
+ matches.each { |i| res,new_ret = types[i].post_cond?(slf, inst, ret, bind, *args)
242
+ return new_ret if res
243
+ }
157
244
  method_name = method_name ? method_name + ": " : ""
158
245
  raise TypeError, <<RUBY
159
246
  #{method_name}Return type error. *'s indicate argument lists that matched.
@@ -252,5 +339,47 @@ RUBY
252
339
  h = h * 31 + @block.hash if @block
253
340
  return h
254
341
  end
255
- end
342
+
343
+ def self.check_block_arg_types(slf, types, inst, bind, *args)
344
+ $__rdl_contract_switch.off {
345
+ res,args,blk,bind = types.pre_cond?(nil, slf, inst, bind, *args)
346
+ return [true, args,blk,bind] if res
347
+ raise TypeError, <<RUBY
348
+ Proc argument type error.
349
+ Proc type:
350
+ #{ [types].map { |t| " " + t.to_s }.join("\n") }
351
+ Actual argument type#{args.size > 1 ? "s" : ""}:
352
+ (#{args.map { |arg| RDL::Util.rdl_type_or_class(arg) }.join(', ')})
353
+ Actual argument values (one per line):
354
+ #{ args.map { |arg| " " + arg.inspect }.join("\n") }
355
+ RUBY
356
+ }
357
+ end
358
+
359
+ def self.check_block_ret_types(slf, types, inst, ret, bind, *args)
360
+ $__rdl_contract_switch.off {
361
+ res,new_ret = types.post_cond?(slf, inst, ret, bind, *args)
362
+ return new_ret if res
363
+ raise TypeError, <<RUBY
364
+ Proc return type error.
365
+ Proc type:
366
+ #{[types].each_with_index.map { |t,i| " " + t.to_s }.join("\n") }
367
+ Actual Proc return type:
368
+ #{ RDL::Util.rdl_type_or_class(ret)}
369
+ Actual Proc return value:
370
+ #{ ret.inspect }
371
+ RUBY
372
+ }
373
+ end
374
+
375
+ def block_wrap(slf, inst, types, bind, &blk)
376
+ Proc.new {|*v, &other_blk|
377
+ _, v, other_blk, bind = RDL::Type::MethodType.check_block_arg_types(slf, types, inst, bind, *v)
378
+ tmp = other_blk ? slf.instance_exec(*v, other_blk, &blk) : slf.instance_exec(*v, &blk)
379
+ tmp = RDL::Type::MethodType.check_block_ret_types(slf, types, inst, tmp, bind, *v)
380
+ tmp
381
+ }
382
+ end
383
+
384
+ end
256
385
  end
@@ -46,7 +46,7 @@ module RDL::Type
46
46
  end
47
47
 
48
48
  def klass
49
- @klass = RDL::Util.to_class(name) unless @klass
49
+ @klass = RDL::Util.to_class(name) unless defined? @klass
50
50
  return @klass
51
51
  end
52
52
 
@@ -8,7 +8,7 @@ class Parser
8
8
  start entry
9
9
 
10
10
  token HASH_TYPE HASH_QUERY CONST_BEGIN RASSOC
11
- token OR FIXNUM FLOAT COLON RARROW DOT DOTS ID SYMBOL SPECIAL_ID STRING
11
+ token OR FIXNUM FLOAT COLON RARROW DOT DOTS ID SYMBOL SPECIAL_ID STRING PREDICATE
12
12
  token LPAREN RPAREN LBRACE RBRACE LBRACKET RBRACKET
13
13
  token COMMA QUERY STAR LESS GREATER
14
14
  token EOF
@@ -33,6 +33,9 @@ rule
33
33
  | LPAREN arg_list RPAREN block RARROW type_expr ID {
34
34
  result = RDL::Type::MethodType.new val[1], val[3], RDL::Type::AnnotatedArgType.new(val[6], val[5])
35
35
  }
36
+ | LPAREN arg_list RPAREN block RARROW type_expr ID PREDICATE {
37
+ result = RDL::Type::MethodType.new val[1], val[3], RDL::Type::DependentArgType.new(val[6], val[5], val[7])
38
+ }
36
39
 
37
40
  method_sig_list:
38
41
  ID COLON method_type { result = [val[0].to_sym, val[2]] }
@@ -52,6 +55,7 @@ rule
52
55
  }
53
56
  arg:
54
57
  base_arg { result = val[0] }
58
+ | base_arg ID PREDICATE {result = RDL::Type::DependentArgType.new(val[1], val[0], val[2])}
55
59
  | base_arg ID { result = RDL::Type::AnnotatedArgType.new(val[1], val[0]) }
56
60
  | DOTS { result = RDL::Type::DotsQuery.new }
57
61
  named_arg_list:
@@ -119,6 +123,7 @@ rule
119
123
  n = RDL::Type::NominalType.new(val[0])
120
124
  result = RDL::Type::GenericType.new(n, *val[2])
121
125
  }
126
+ | LBRACE method_type RBRACE { result = val[1] }
122
127
  | LBRACKET type_expr_comma_list RBRACKET {
123
128
  result = RDL::Type::TupleType.new(*val[1])
124
129
  }
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.14
3
+ # This file is automatically generated by Racc 1.4.9
4
4
  # from Racc grammer file "".
5
5
  #
6
6
 
@@ -13,7 +13,7 @@ module RDL::Type
13
13
 
14
14
  class Parser < Racc::Parser
15
15
 
16
- module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 147)
16
+ module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 152)
17
17
 
18
18
  def initialize()
19
19
  @yydebug = true
@@ -23,176 +23,179 @@ end
23
23
  ##### State transition tables begin ###
24
24
 
25
25
  racc_action_table = [
26
- 20, 55, 18, 19, 71, 21, 28, 30, 13, 15,
27
- 73, 11, 42, 17, 61, 16, 37, 31, 32, 20,
28
- 80, 18, 19, 7, 21, 28, 30, 13, 15, 37,
29
- 11, 85, 17, 88, 16, 7, 31, 32, 20, 91,
30
- 18, 19, 92, 21, 94, 14, 13, 15, 95, 11,
31
- 98, 17, 61, 16, 20, 78, 18, 19, 8, 21,
32
- 7, 14, 13, 15, 34, 11, 36, 17, 20, 16,
33
- 18, 19, 37, 21, 50, 14, 13, 15, 51, 5,
34
- 6, 17, 20, 16, 18, 19, 52, 21, 53, 14,
35
- 13, 15, 7, 54, 58, 17, 20, 16, 18, 19,
36
- 62, 21, 63, 14, 13, 15, 64, 55, 65, 17,
37
- 20, 16, 18, 19, 66, 21, 67, 14, 13, 15,
38
- 68, 11, 69, 17, 20, 16, 18, 19, 70, 21,
39
- nil, 14, 13, 15, nil, 11, nil, 17, 20, 16,
40
- 18, 19, nil, 21, nil, 38, 13, 15, nil, 11,
41
- nil, 17, 20, 16, 18, 19, nil, 21, nil, 14,
42
- 13, 15, nil, 11, nil, 17, 20, 16, 18, 19,
43
- nil, 21, nil, 14, 13, 15, nil, nil, nil, 17,
44
- 20, 16, 18, 19, nil, 21, nil, 14, 13, 15,
45
- nil, 11, nil, 17, 20, 16, 18, 19, nil, 21,
46
- nil, 14, 13, 15, nil, 11, nil, 17, 20, 16,
47
- 18, 19, nil, 21, nil, 14, 13, 15, nil, 11,
48
- nil, 17, 20, 16, 18, 19, nil, 21, nil, 14,
49
- 13, 15, nil, nil, nil, 17, 20, 16, 18, 19,
50
- nil, 21, nil, 14, 13, 15, nil, 11, nil, 17,
51
- 46, 16, 44, 45, nil, nil, 46, 42, 44, 45,
52
- 47, nil, nil, 42, nil, nil, 47 ]
26
+ 20, 69, 18, 19, 56, 21, 28, 30, 13, 15,
27
+ 5, 6, 11, 62, 16, 56, 17, 37, 31, 32,
28
+ 20, 63, 18, 19, 7, 21, 28, 30, 13, 15,
29
+ 64, 37, 11, 65, 16, 66, 17, 67, 31, 32,
30
+ 20, 68, 18, 19, 59, 21, 70, 14, 13, 15,
31
+ 71, 72, 11, 73, 16, 75, 17, 20, 81, 18,
32
+ 19, 55, 21, 78, 14, 13, 15, 20, 38, 18,
33
+ 19, 16, 21, 17, 14, 13, 15, 54, 83, 11,
34
+ 53, 16, 20, 17, 18, 19, 52, 21, 86, 14,
35
+ 13, 15, 51, 37, 11, 7, 16, 20, 17, 18,
36
+ 19, 36, 21, 91, 14, 13, 15, 7, 34, 11,
37
+ 94, 16, 20, 17, 18, 19, 95, 21, 7, 14,
38
+ 13, 15, 97, 8, 11, 99, 16, 20, 17, 18,
39
+ 19, 101, 21, 69, 14, 13, 15, 102, nil, 11,
40
+ nil, 16, 20, 17, 18, 19, nil, 21, nil, 14,
41
+ 13, 15, nil, nil, 11, nil, 16, 20, 17, 18,
42
+ 19, nil, 21, nil, 14, 13, 15, 20, nil, 18,
43
+ 19, 16, 21, 17, 14, 13, 15, 20, nil, 18,
44
+ 19, 16, 21, 17, 14, 13, 15, 20, nil, 18,
45
+ 19, 16, 21, 17, 14, 13, 15, nil, nil, 11,
46
+ nil, 16, 20, 17, 18, 19, nil, 21, nil, 14,
47
+ 13, 15, 20, nil, 18, 19, 16, 21, 17, 14,
48
+ 13, 15, nil, nil, 11, nil, 16, 20, 17, 18,
49
+ 19, nil, 21, nil, 47, 13, 15, nil, nil, 11,
50
+ nil, 16, 42, 17, 40, 41, nil, nil, 42, 38,
51
+ 40, 41, 43, nil, 7, 38, nil, nil, 43 ]
53
52
 
54
53
  racc_action_check = [
55
- 7, 30, 7, 7, 50, 7, 7, 7, 7, 7,
56
- 51, 7, 54, 7, 38, 7, 30, 7, 7, 52,
57
- 60, 52, 52, 61, 52, 52, 52, 52, 52, 38,
58
- 52, 67, 52, 72, 52, 73, 52, 52, 55, 81,
59
- 55, 55, 85, 55, 89, 55, 55, 55, 91, 55,
60
- 93, 55, 95, 55, 62, 55, 62, 62, 1, 62,
61
- 6, 62, 62, 62, 8, 62, 12, 62, 65, 62,
62
- 65, 65, 14, 65, 20, 65, 65, 65, 23, 0,
63
- 0, 65, 66, 65, 66, 66, 26, 66, 27, 66,
64
- 66, 66, 0, 29, 35, 66, 68, 66, 68, 68,
65
- 39, 68, 40, 68, 68, 68, 41, 42, 44, 68,
66
- 31, 68, 31, 31, 45, 31, 46, 31, 31, 31,
67
- 47, 31, 48, 31, 5, 31, 5, 5, 49, 5,
68
- nil, 5, 5, 5, nil, 5, nil, 5, 16, 5,
69
- 16, 16, nil, 16, nil, 16, 16, 16, nil, 16,
70
- nil, 16, 37, 16, 37, 37, nil, 37, nil, 37,
71
- 37, 37, nil, 37, nil, 37, 92, 37, 92, 92,
72
- nil, 92, nil, 92, 92, 92, nil, nil, nil, 92,
73
- 32, 92, 32, 32, nil, 32, nil, 32, 32, 32,
74
- nil, 32, nil, 32, 78, 32, 78, 78, nil, 78,
75
- nil, 78, 78, 78, nil, 78, nil, 78, 11, 78,
76
- 11, 11, nil, 11, nil, 11, 11, 11, nil, 11,
77
- nil, 11, 36, 11, 36, 36, nil, 36, nil, 36,
78
- 36, 36, nil, nil, nil, 36, 88, 36, 88, 88,
79
- nil, 88, nil, 88, 88, 88, nil, 88, nil, 88,
80
- 69, 88, 69, 69, nil, nil, 17, 69, 17, 17,
81
- 69, nil, nil, 17, nil, nil, 17 ]
54
+ 7, 47, 7, 7, 38, 7, 7, 7, 7, 7,
55
+ 0, 0, 7, 40, 7, 30, 7, 47, 7, 7,
56
+ 53, 41, 53, 53, 0, 53, 53, 53, 53, 53,
57
+ 42, 30, 53, 43, 53, 44, 53, 45, 53, 53,
58
+ 56, 46, 56, 56, 35, 56, 48, 56, 56, 56,
59
+ 49, 50, 56, 51, 56, 52, 56, 36, 56, 36,
60
+ 36, 29, 36, 54, 36, 36, 36, 81, 55, 81,
61
+ 81, 36, 81, 36, 81, 81, 81, 27, 61, 81,
62
+ 26, 81, 11, 81, 11, 11, 23, 11, 64, 11,
63
+ 11, 11, 20, 14, 11, 69, 11, 70, 11, 70,
64
+ 70, 12, 70, 74, 70, 70, 70, 75, 8, 70,
65
+ 86, 70, 37, 70, 37, 37, 89, 37, 6, 37,
66
+ 37, 37, 92, 1, 37, 95, 37, 91, 37, 91,
67
+ 91, 96, 91, 99, 91, 91, 91, 101, nil, 91,
68
+ nil, 91, 32, 91, 32, 32, nil, 32, nil, 32,
69
+ 32, 32, nil, nil, 32, nil, 32, 65, 32, 65,
70
+ 65, nil, 65, nil, 65, 65, 65, 63, nil, 63,
71
+ 63, 65, 63, 65, 63, 63, 63, 62, nil, 62,
72
+ 62, 63, 62, 63, 62, 62, 62, 5, nil, 5,
73
+ 5, 62, 5, 62, 5, 5, 5, nil, nil, 5,
74
+ nil, 5, 94, 5, 94, 94, nil, 94, nil, 94,
75
+ 94, 94, 31, nil, 31, 31, 94, 31, 94, 31,
76
+ 31, 31, nil, nil, 31, nil, 31, 17, 31, 17,
77
+ 17, nil, 17, nil, 17, 17, 17, nil, nil, 17,
78
+ nil, 17, 16, 17, 16, 16, nil, nil, 66, 16,
79
+ 66, 66, 16, nil, 16, 66, nil, nil, 66 ]
82
80
 
83
81
  racc_action_pointer = [
84
- 74, 58, nil, nil, nil, 117, 42, -7, 64, nil,
85
- nil, 201, 62, nil, 46, nil, 131, 249, nil, nil,
86
- 60, nil, nil, 59, nil, nil, 84, 74, nil, 91,
87
- -10, 103, 173, nil, nil, 75, 215, 145, 3, 98,
88
- 79, 83, 96, nil, 100, 106, 102, 112, 120, 107,
89
- -17, -10, 12, nil, -2, 31, nil, nil, nil, nil,
90
- -7, 5, 47, nil, nil, 61, 75, 10, 89, 243,
91
- nil, nil, 30, 17, nil, nil, nil, nil, 187, nil,
92
- nil, 37, nil, nil, nil, 34, nil, nil, 229, 23,
93
- nil, 34, 159, 36, nil, 41, nil, nil, nil ]
82
+ 5, 123, nil, nil, nil, 180, 99, -7, 108, nil,
83
+ nil, 75, 97, nil, 66, nil, 235, 220, nil, nil,
84
+ 78, nil, nil, 66, nil, nil, 78, 63, nil, 59,
85
+ 4, 205, 135, nil, nil, 24, 50, 105, -7, nil,
86
+ 5, 13, 16, 25, 33, 15, 19, -10, 44, 26,
87
+ 27, 31, 34, 13, 45, 54, 33, nil, nil, nil,
88
+ nil, 50, 170, 160, 66, 150, 241, nil, nil, 76,
89
+ 90, nil, nil, nil, 100, 88, nil, nil, nil, nil,
90
+ nil, 60, nil, nil, nil, nil, 102, nil, nil, 114,
91
+ nil, 120, 100, nil, 195, 111, 117, nil, nil, 122,
92
+ nil, 119, nil ]
94
93
 
95
94
  racc_action_default = [
96
- -54, -54, -1, -2, -3, -54, -54, -10, -54, -4,
97
- -29, -54, -41, -43, -44, -45, -54, -33, -50, -51,
98
- -54, -53, -5, -54, -11, -12, -13, -16, -18, -19,
99
- -44, -54, -54, -24, 99, -54, -54, -54, -44, -31,
100
- -54, -54, -54, -34, -54, -54, -54, -54, -39, -54,
101
- -54, -27, -54, -17, -54, -54, -22, -23, -30, -42,
102
- -54, -54, -54, -47, -48, -54, -54, -54, -54, -33,
103
- -49, -52, -54, -54, -14, -15, -20, -21, -54, -26,
104
- -46, -8, -32, -35, -36, -54, -38, -40, -54, -54,
105
- -25, -54, -54, -6, -28, -54, -9, -37, -7 ]
95
+ -57, -57, -1, -2, -3, -57, -57, -11, -57, -4,
96
+ -31, -57, -43, -45, -46, -47, -35, -57, -53, -54,
97
+ -57, -56, -5, -57, -12, -13, -14, -17, -20, -21,
98
+ -46, -57, -57, -26, 103, -57, -57, -57, -57, -36,
99
+ -57, -57, -57, -57, -41, -57, -57, -46, -33, -57,
100
+ -57, -57, -29, -57, -19, -57, -57, -24, -25, -32,
101
+ -44, -57, -57, -57, -57, -57, -35, -49, -52, -57,
102
+ -57, -50, -51, -55, -57, -57, -15, -16, -18, -22,
103
+ -23, -57, -28, -48, -37, -38, -57, -40, -42, -9,
104
+ -34, -57, -57, -27, -57, -57, -6, -30, -39, -57,
105
+ -10, -7, -8 ]
106
106
 
107
107
  racc_goto_table = [
108
- 9, 41, 33, 59, 2, 49, 35, 25, 43, 40,
109
- 22, 24, 77, 3, 72, 23, 4, 1, nil, nil,
110
- nil, nil, nil, nil, nil, nil, 56, 57, nil, nil,
111
- 60, nil, 83, 84, nil, 86, nil, nil, nil, nil,
112
- nil, nil, nil, nil, nil, nil, nil, 33, nil, nil,
113
- 79, nil, 75, nil, 76, 82, 74, 87, nil, 97,
114
- 43, nil, nil, nil, nil, 81, nil, nil, nil, nil,
115
- nil, nil, nil, 90, nil, nil, 96, 89, nil, nil,
116
- nil, nil, nil, 93 ]
108
+ 9, 50, 33, 2, 60, 49, 35, 39, 25, 22,
109
+ 46, 80, 23, 24, 74, 4, 3, 1, nil, 45,
110
+ nil, nil, nil, nil, nil, 61, 57, 58, nil, nil,
111
+ 84, 85, nil, 87, nil, nil, nil, nil, nil, nil,
112
+ nil, nil, nil, nil, nil, nil, nil, nil, 33, nil,
113
+ nil, 82, nil, nil, 77, nil, 79, 39, 90, 76,
114
+ 88, nil, 98, nil, nil, nil, nil, nil, nil, nil,
115
+ nil, nil, 89, nil, nil, nil, 93, nil, 92, 100,
116
+ nil, nil, nil, nil, nil, nil, 96 ]
117
117
 
118
118
  racc_goto_check = [
119
- 5, 8, 5, 15, 2, 18, 5, 10, 13, 16,
120
- 2, 9, 14, 3, 7, 6, 4, 1, nil, nil,
121
- nil, nil, nil, nil, nil, nil, 5, 5, nil, nil,
122
- 16, nil, 15, 15, nil, 15, nil, nil, nil, nil,
123
- nil, nil, nil, nil, nil, nil, nil, 5, nil, nil,
124
- 5, nil, 10, nil, 10, 16, 9, 18, nil, 15,
125
- 13, nil, nil, nil, nil, 2, nil, nil, nil, nil,
126
- nil, nil, nil, 5, nil, nil, 8, 2, nil, nil,
127
- nil, nil, nil, 5 ]
119
+ 5, 8, 5, 2, 15, 16, 5, 13, 10, 2,
120
+ 18, 14, 6, 9, 7, 4, 3, 1, nil, 2,
121
+ nil, nil, nil, nil, nil, 16, 5, 5, nil, nil,
122
+ 15, 15, nil, 15, nil, nil, nil, nil, nil, nil,
123
+ nil, nil, nil, nil, nil, nil, nil, nil, 5, nil,
124
+ nil, 5, nil, nil, 10, nil, 10, 13, 16, 9,
125
+ 18, nil, 15, nil, nil, nil, nil, nil, nil, nil,
126
+ nil, nil, 2, nil, nil, nil, 5, nil, 2, 8,
127
+ nil, nil, nil, nil, nil, nil, 5 ]
128
128
 
129
129
  racc_goto_pointer = [
130
- nil, 17, 4, 13, 16, -5, 8, -37, -15, 4,
131
- 0, nil, nil, -9, -43, -33, -7, nil, -12, nil ]
130
+ nil, 17, 3, 16, 15, -5, 5, -38, -16, 6,
131
+ 1, nil, nil, -9, -45, -32, -12, nil, -6, nil ]
132
132
 
133
133
  racc_goto_default = [
134
- nil, nil, nil, nil, nil, 39, nil, nil, nil, nil,
135
- nil, 26, 27, 29, nil, 10, nil, 48, nil, 12 ]
134
+ nil, nil, nil, nil, nil, 48, nil, nil, nil, nil,
135
+ nil, 26, 27, 29, nil, 10, nil, 44, nil, 12 ]
136
136
 
137
137
  racc_reduce_table = [
138
138
  0, 0, :racc_error,
139
- 1, 30, :_reduce_1,
140
- 1, 30, :_reduce_2,
141
- 1, 30, :_reduce_3,
142
- 2, 32, :_reduce_4,
143
- 2, 33, :_reduce_5,
144
- 6, 31, :_reduce_6,
145
- 7, 31, :_reduce_7,
146
- 3, 37, :_reduce_8,
147
- 5, 37, :_reduce_9,
148
- 0, 35, :_reduce_10,
149
- 1, 35, :_reduce_11,
150
- 1, 35, :_reduce_12,
151
- 1, 38, :_reduce_13,
152
- 3, 38, :_reduce_14,
153
- 3, 38, :_reduce_15,
154
- 1, 40, :_reduce_16,
155
- 2, 40, :_reduce_17,
156
- 1, 40, :_reduce_18,
157
- 1, 39, :_reduce_19,
158
- 3, 39, :_reduce_20,
159
- 3, 42, :_reduce_21,
160
- 2, 41, :_reduce_22,
161
- 2, 41, :_reduce_23,
162
- 1, 41, :_reduce_24,
163
- 2, 43, :_reduce_25,
164
- 1, 43, :_reduce_26,
165
- 0, 36, :_reduce_27,
166
- 3, 36, :_reduce_28,
167
- 1, 34, :_reduce_29,
168
- 3, 34, :_reduce_30,
169
- 1, 45, :_reduce_31,
170
- 3, 45, :_reduce_32,
171
- 0, 46, :_reduce_none,
172
- 1, 46, :_reduce_34,
173
- 3, 46, :_reduce_35,
174
- 3, 46, :_reduce_36,
175
- 5, 46, :_reduce_37,
176
- 3, 46, :_reduce_38,
177
- 1, 47, :_reduce_39,
139
+ 1, 31, :_reduce_1,
140
+ 1, 31, :_reduce_2,
141
+ 1, 31, :_reduce_3,
142
+ 2, 33, :_reduce_4,
143
+ 2, 34, :_reduce_5,
144
+ 6, 32, :_reduce_6,
145
+ 7, 32, :_reduce_7,
146
+ 8, 32, :_reduce_8,
147
+ 3, 38, :_reduce_9,
148
+ 5, 38, :_reduce_10,
149
+ 0, 36, :_reduce_11,
150
+ 1, 36, :_reduce_12,
151
+ 1, 36, :_reduce_13,
152
+ 1, 39, :_reduce_14,
153
+ 3, 39, :_reduce_15,
154
+ 3, 39, :_reduce_16,
155
+ 1, 41, :_reduce_17,
156
+ 3, 41, :_reduce_18,
157
+ 2, 41, :_reduce_19,
158
+ 1, 41, :_reduce_20,
159
+ 1, 40, :_reduce_21,
160
+ 3, 40, :_reduce_22,
161
+ 3, 43, :_reduce_23,
162
+ 2, 42, :_reduce_24,
163
+ 2, 42, :_reduce_25,
164
+ 1, 42, :_reduce_26,
165
+ 2, 44, :_reduce_27,
166
+ 1, 44, :_reduce_28,
167
+ 0, 37, :_reduce_29,
168
+ 3, 37, :_reduce_30,
169
+ 1, 35, :_reduce_31,
170
+ 3, 35, :_reduce_32,
171
+ 1, 46, :_reduce_33,
172
+ 3, 46, :_reduce_34,
173
+ 0, 47, :_reduce_none,
174
+ 1, 47, :_reduce_36,
175
+ 3, 47, :_reduce_37,
176
+ 3, 47, :_reduce_38,
177
+ 5, 47, :_reduce_39,
178
178
  3, 47, :_reduce_40,
179
- 1, 44, :_reduce_41,
180
- 3, 44, :_reduce_42,
181
- 1, 48, :_reduce_43,
182
- 1, 48, :_reduce_44,
183
- 1, 48, :_reduce_45,
184
- 4, 48, :_reduce_46,
185
- 3, 48, :_reduce_47,
186
- 3, 48, :_reduce_48,
187
- 3, 48, :_reduce_49,
188
- 1, 48, :_reduce_50,
189
- 1, 48, :_reduce_51,
190
- 3, 48, :_reduce_52,
191
- 1, 48, :_reduce_53 ]
192
-
193
- racc_reduce_n = 54
194
-
195
- racc_shift_n = 99
179
+ 1, 48, :_reduce_41,
180
+ 3, 48, :_reduce_42,
181
+ 1, 45, :_reduce_43,
182
+ 3, 45, :_reduce_44,
183
+ 1, 49, :_reduce_45,
184
+ 1, 49, :_reduce_46,
185
+ 1, 49, :_reduce_47,
186
+ 4, 49, :_reduce_48,
187
+ 3, 49, :_reduce_49,
188
+ 3, 49, :_reduce_50,
189
+ 3, 49, :_reduce_51,
190
+ 3, 49, :_reduce_52,
191
+ 1, 49, :_reduce_53,
192
+ 1, 49, :_reduce_54,
193
+ 3, 49, :_reduce_55,
194
+ 1, 49, :_reduce_56 ]
195
+
196
+ racc_reduce_n = 57
197
+
198
+ racc_shift_n = 103
196
199
 
197
200
  racc_token_table = {
198
201
  false => 0,
@@ -213,19 +216,20 @@ racc_token_table = {
213
216
  :SYMBOL => 15,
214
217
  :SPECIAL_ID => 16,
215
218
  :STRING => 17,
216
- :LPAREN => 18,
217
- :RPAREN => 19,
218
- :LBRACE => 20,
219
- :RBRACE => 21,
220
- :LBRACKET => 22,
221
- :RBRACKET => 23,
222
- :QUERY => 24,
223
- :STAR => 25,
224
- :LESS => 26,
225
- :GREATER => 27,
226
- :EOF => 28 }
227
-
228
- racc_nt_base = 29
219
+ :PREDICATE => 18,
220
+ :LPAREN => 19,
221
+ :RPAREN => 20,
222
+ :LBRACE => 21,
223
+ :RBRACE => 22,
224
+ :LBRACKET => 23,
225
+ :RBRACKET => 24,
226
+ :QUERY => 25,
227
+ :STAR => 26,
228
+ :LESS => 27,
229
+ :GREATER => 28,
230
+ :EOF => 29 }
231
+
232
+ racc_nt_base = 30
229
233
 
230
234
  racc_use_result_var = true
231
235
 
@@ -264,6 +268,7 @@ Racc_token_to_s_table = [
264
268
  "SYMBOL",
265
269
  "SPECIAL_ID",
266
270
  "STRING",
271
+ "PREDICATE",
267
272
  "LPAREN",
268
273
  "RPAREN",
269
274
  "LBRACE",
@@ -353,136 +358,137 @@ module_eval(<<'.,.,', 'parser.racc', 33)
353
358
  end
354
359
  .,.,
355
360
 
356
- module_eval(<<'.,.,', 'parser.racc', 37)
361
+ module_eval(<<'.,.,', 'parser.racc', 36)
357
362
  def _reduce_8(val, _values, result)
358
- result = [val[0].to_sym, val[2]]
363
+ result = RDL::Type::MethodType.new val[1], val[3], RDL::Type::DependentArgType.new(val[6], val[5], val[7])
364
+
359
365
  result
360
366
  end
361
367
  .,.,
362
368
 
363
- module_eval(<<'.,.,', 'parser.racc', 38)
369
+ module_eval(<<'.,.,', 'parser.racc', 40)
364
370
  def _reduce_9(val, _values, result)
365
- result = [val[0].to_sym, val[2]] + val[4]
371
+ result = [val[0].to_sym, val[2]]
366
372
  result
367
373
  end
368
374
  .,.,
369
375
 
370
376
  module_eval(<<'.,.,', 'parser.racc', 41)
371
377
  def _reduce_10(val, _values, result)
372
- result = []
378
+ result = [val[0].to_sym, val[2]] + val[4]
373
379
  result
374
380
  end
375
381
  .,.,
376
382
 
377
- module_eval(<<'.,.,', 'parser.racc', 42)
383
+ module_eval(<<'.,.,', 'parser.racc', 44)
378
384
  def _reduce_11(val, _values, result)
379
- result = val[0]
385
+ result = []
380
386
  result
381
387
  end
382
388
  .,.,
383
389
 
384
- module_eval(<<'.,.,', 'parser.racc', 44)
390
+ module_eval(<<'.,.,', 'parser.racc', 45)
385
391
  def _reduce_12(val, _values, result)
386
- result = [RDL::Type::FiniteHashType.new(Hash[*val[0]])]
387
-
392
+ result = val[0]
388
393
  result
389
394
  end
390
395
  .,.,
391
396
 
392
397
  module_eval(<<'.,.,', 'parser.racc', 47)
393
398
  def _reduce_13(val, _values, result)
394
- result = [val[0]]
399
+ result = [RDL::Type::FiniteHashType.new(Hash[*val[0]])]
400
+
395
401
  result
396
402
  end
397
403
  .,.,
398
404
 
399
- module_eval(<<'.,.,', 'parser.racc', 48)
405
+ module_eval(<<'.,.,', 'parser.racc', 50)
400
406
  def _reduce_14(val, _values, result)
401
- result = val[2].unshift val[0]
407
+ result = [val[0]]
402
408
  result
403
409
  end
404
410
  .,.,
405
411
 
406
- module_eval(<<'.,.,', 'parser.racc', 49)
412
+ module_eval(<<'.,.,', 'parser.racc', 51)
407
413
  def _reduce_15(val, _values, result)
408
- # named arg list must come last
409
- result = [val[0], RDL::Type::FiniteHashType.new(Hash[*val[2]])]
410
-
414
+ result = val[2].unshift val[0]
411
415
  result
412
416
  end
413
417
  .,.,
414
418
 
415
- module_eval(<<'.,.,', 'parser.racc', 53)
419
+ module_eval(<<'.,.,', 'parser.racc', 52)
416
420
  def _reduce_16(val, _values, result)
417
- result = val[0]
421
+ # named arg list must come last
422
+ result = [val[0], RDL::Type::FiniteHashType.new(Hash[*val[2]])]
423
+
418
424
  result
419
425
  end
420
426
  .,.,
421
427
 
422
- module_eval(<<'.,.,', 'parser.racc', 54)
428
+ module_eval(<<'.,.,', 'parser.racc', 56)
423
429
  def _reduce_17(val, _values, result)
424
- result = RDL::Type::AnnotatedArgType.new(val[1], val[0])
430
+ result = val[0]
425
431
  result
426
432
  end
427
433
  .,.,
428
434
 
429
- module_eval(<<'.,.,', 'parser.racc', 55)
435
+ module_eval(<<'.,.,', 'parser.racc', 57)
430
436
  def _reduce_18(val, _values, result)
431
- result = RDL::Type::DotsQuery.new
437
+ result = RDL::Type::DependentArgType.new(val[1], val[0], val[2])
432
438
  result
433
439
  end
434
440
  .,.,
435
441
 
436
- module_eval(<<'.,.,', 'parser.racc', 57)
442
+ module_eval(<<'.,.,', 'parser.racc', 58)
437
443
  def _reduce_19(val, _values, result)
438
- result = val[0]
444
+ result = RDL::Type::AnnotatedArgType.new(val[1], val[0])
439
445
  result
440
446
  end
441
447
  .,.,
442
448
 
443
- module_eval(<<'.,.,', 'parser.racc', 58)
449
+ module_eval(<<'.,.,', 'parser.racc', 59)
444
450
  def _reduce_20(val, _values, result)
445
- result = val[0] + val[2]
451
+ result = RDL::Type::DotsQuery.new
446
452
  result
447
453
  end
448
454
  .,.,
449
455
 
450
- module_eval(<<'.,.,', 'parser.racc', 60)
456
+ module_eval(<<'.,.,', 'parser.racc', 61)
451
457
  def _reduce_21(val, _values, result)
452
- result = [val[0].to_sym, val[2]]
458
+ result = val[0]
453
459
  result
454
460
  end
455
461
  .,.,
456
462
 
457
- module_eval(<<'.,.,', 'parser.racc', 63)
463
+ module_eval(<<'.,.,', 'parser.racc', 62)
458
464
  def _reduce_22(val, _values, result)
459
- result = RDL::Type::OptionalType.new val[1]
465
+ result = val[0] + val[2]
460
466
  result
461
467
  end
462
468
  .,.,
463
469
 
464
470
  module_eval(<<'.,.,', 'parser.racc', 64)
465
471
  def _reduce_23(val, _values, result)
466
- result = RDL::Type::VarargType.new val[1]
472
+ result = [val[0].to_sym, val[2]]
467
473
  result
468
474
  end
469
475
  .,.,
470
476
 
471
- module_eval(<<'.,.,', 'parser.racc', 65)
477
+ module_eval(<<'.,.,', 'parser.racc', 67)
472
478
  def _reduce_24(val, _values, result)
473
- result = val[0]
479
+ result = RDL::Type::OptionalType.new val[1]
474
480
  result
475
481
  end
476
482
  .,.,
477
483
 
478
- module_eval(<<'.,.,', 'parser.racc', 67)
484
+ module_eval(<<'.,.,', 'parser.racc', 68)
479
485
  def _reduce_25(val, _values, result)
480
- result = RDL::Type::OptionalType.new val[1]
486
+ result = RDL::Type::VarargType.new val[1]
481
487
  result
482
488
  end
483
489
  .,.,
484
490
 
485
- module_eval(<<'.,.,', 'parser.racc', 68)
491
+ module_eval(<<'.,.,', 'parser.racc', 69)
486
492
  def _reduce_26(val, _values, result)
487
493
  result = val[0]
488
494
  result
@@ -491,21 +497,21 @@ module_eval(<<'.,.,', 'parser.racc', 68)
491
497
 
492
498
  module_eval(<<'.,.,', 'parser.racc', 71)
493
499
  def _reduce_27(val, _values, result)
494
- result = nil
500
+ result = RDL::Type::OptionalType.new val[1]
495
501
  result
496
502
  end
497
503
  .,.,
498
504
 
499
505
  module_eval(<<'.,.,', 'parser.racc', 72)
500
506
  def _reduce_28(val, _values, result)
501
- result = val[1]
507
+ result = val[0]
502
508
  result
503
509
  end
504
510
  .,.,
505
511
 
506
512
  module_eval(<<'.,.,', 'parser.racc', 75)
507
513
  def _reduce_29(val, _values, result)
508
- result = val[0]
514
+ result = nil
509
515
  result
510
516
  end
511
517
  .,.,
@@ -519,66 +525,66 @@ module_eval(<<'.,.,', 'parser.racc', 76)
519
525
 
520
526
  module_eval(<<'.,.,', 'parser.racc', 79)
521
527
  def _reduce_31(val, _values, result)
522
- result = [val[0]]
528
+ result = val[0]
523
529
  result
524
530
  end
525
531
  .,.,
526
532
 
527
533
  module_eval(<<'.,.,', 'parser.racc', 80)
528
534
  def _reduce_32(val, _values, result)
529
- result = [val[0]] + val[2]
535
+ result = val[1]
530
536
  result
531
537
  end
532
538
  .,.,
533
539
 
534
- # reduce 33 omitted
535
-
536
540
  module_eval(<<'.,.,', 'parser.racc', 83)
537
- def _reduce_34(val, _values, result)
538
- result = val[0]
541
+ def _reduce_33(val, _values, result)
542
+ result = [val[0]]
539
543
  result
540
544
  end
541
545
  .,.,
542
546
 
543
547
  module_eval(<<'.,.,', 'parser.racc', 84)
544
- def _reduce_35(val, _values, result)
545
- result = [val[0].to_i, val[2]]
548
+ def _reduce_34(val, _values, result)
549
+ result = [val[0]] + val[2]
546
550
  result
547
551
  end
548
552
  .,.,
549
553
 
550
- module_eval(<<'.,.,', 'parser.racc', 85)
554
+ # reduce 35 omitted
555
+
556
+ module_eval(<<'.,.,', 'parser.racc', 87)
551
557
  def _reduce_36(val, _values, result)
552
- result = [val[0].to_f, val[2]]
558
+ result = val[0]
553
559
  result
554
560
  end
555
561
  .,.,
556
562
 
557
- module_eval(<<'.,.,', 'parser.racc', 87)
563
+ module_eval(<<'.,.,', 'parser.racc', 88)
558
564
  def _reduce_37(val, _values, result)
559
- result = [Kernel.const_get(val[0]), val[2]]
560
-
565
+ result = [val[0].to_i, val[2]]
561
566
  result
562
567
  end
563
568
  .,.,
564
569
 
565
570
  module_eval(<<'.,.,', 'parser.racc', 89)
566
571
  def _reduce_38(val, _values, result)
567
- result = [val[0], val[2]]
572
+ result = [val[0].to_f, val[2]]
568
573
  result
569
574
  end
570
575
  .,.,
571
576
 
572
- module_eval(<<'.,.,', 'parser.racc', 92)
577
+ module_eval(<<'.,.,', 'parser.racc', 91)
573
578
  def _reduce_39(val, _values, result)
574
- result = val[0]
579
+ result = [Kernel.const_get(val[0]), val[2]]
580
+
575
581
  result
576
582
  end
577
583
  .,.,
578
584
 
579
585
  module_eval(<<'.,.,', 'parser.racc', 93)
580
586
  def _reduce_40(val, _values, result)
581
- result = val[0] + val[2]
587
+ result = [val[0], val[2]]
582
588
  result
583
589
  end
584
590
  .,.,
@@ -592,20 +598,34 @@ module_eval(<<'.,.,', 'parser.racc', 96)
592
598
 
593
599
  module_eval(<<'.,.,', 'parser.racc', 97)
594
600
  def _reduce_42(val, _values, result)
595
- result = RDL::Type::UnionType.new val[0], val[2]
601
+ result = val[0] + val[2]
596
602
  result
597
603
  end
598
604
  .,.,
599
605
 
600
606
  module_eval(<<'.,.,', 'parser.racc', 100)
601
607
  def _reduce_43(val, _values, result)
602
- result = RDL::Type::SingletonType.new(val[0].to_sym)
608
+ result = val[0]
603
609
  result
604
610
  end
605
611
  .,.,
606
612
 
607
- module_eval(<<'.,.,', 'parser.racc', 102)
613
+ module_eval(<<'.,.,', 'parser.racc', 101)
608
614
  def _reduce_44(val, _values, result)
615
+ result = RDL::Type::UnionType.new val[0], val[2]
616
+ result
617
+ end
618
+ .,.,
619
+
620
+ module_eval(<<'.,.,', 'parser.racc', 104)
621
+ def _reduce_45(val, _values, result)
622
+ result = RDL::Type::SingletonType.new(val[0].to_sym)
623
+ result
624
+ end
625
+ .,.,
626
+
627
+ module_eval(<<'.,.,', 'parser.racc', 106)
628
+ def _reduce_46(val, _values, result)
609
629
  if val[0] == 'nil' then
610
630
  result = RDL::Type::NilType.new
611
631
  elsif val[0] =~ /^[a-z_]+\w*\'?/ then
@@ -618,8 +638,8 @@ module_eval(<<'.,.,', 'parser.racc', 102)
618
638
  end
619
639
  .,.,
620
640
 
621
- module_eval(<<'.,.,', 'parser.racc', 111)
622
- def _reduce_45(val, _values, result)
641
+ module_eval(<<'.,.,', 'parser.racc', 115)
642
+ def _reduce_47(val, _values, result)
623
643
  if $__rdl_special_types.has_key? val[0] then
624
644
  result = $__rdl_special_types[val[0]]
625
645
  else
@@ -630,8 +650,8 @@ module_eval(<<'.,.,', 'parser.racc', 111)
630
650
  end
631
651
  .,.,
632
652
 
633
- module_eval(<<'.,.,', 'parser.racc', 118)
634
- def _reduce_46(val, _values, result)
653
+ module_eval(<<'.,.,', 'parser.racc', 122)
654
+ def _reduce_48(val, _values, result)
635
655
  n = RDL::Type::NominalType.new(val[0])
636
656
  result = RDL::Type::GenericType.new(n, *val[2])
637
657
 
@@ -639,54 +659,61 @@ module_eval(<<'.,.,', 'parser.racc', 118)
639
659
  end
640
660
  .,.,
641
661
 
642
- module_eval(<<'.,.,', 'parser.racc', 122)
643
- def _reduce_47(val, _values, result)
662
+ module_eval(<<'.,.,', 'parser.racc', 125)
663
+ def _reduce_49(val, _values, result)
664
+ result = val[1]
665
+ result
666
+ end
667
+ .,.,
668
+
669
+ module_eval(<<'.,.,', 'parser.racc', 127)
670
+ def _reduce_50(val, _values, result)
644
671
  result = RDL::Type::TupleType.new(*val[1])
645
672
 
646
673
  result
647
674
  end
648
675
  .,.,
649
676
 
650
- module_eval(<<'.,.,', 'parser.racc', 125)
651
- def _reduce_48(val, _values, result)
677
+ module_eval(<<'.,.,', 'parser.racc', 130)
678
+ def _reduce_51(val, _values, result)
652
679
  result = RDL::Type::StructuralType.new(Hash[*val[1]])
653
680
 
654
681
  result
655
682
  end
656
683
  .,.,
657
684
 
658
- module_eval(<<'.,.,', 'parser.racc', 128)
659
- def _reduce_49(val, _values, result)
685
+ module_eval(<<'.,.,', 'parser.racc', 133)
686
+ def _reduce_52(val, _values, result)
660
687
  result = RDL::Type::FiniteHashType.new(Hash[*val[1]])
661
688
 
662
689
  result
663
690
  end
664
691
  .,.,
665
692
 
666
- module_eval(<<'.,.,', 'parser.racc', 130)
667
- def _reduce_50(val, _values, result)
693
+ module_eval(<<'.,.,', 'parser.racc', 135)
694
+ def _reduce_53(val, _values, result)
668
695
  result = RDL::Type::SingletonType.new(val[0].to_i)
669
696
  result
670
697
  end
671
698
  .,.,
672
699
 
673
- module_eval(<<'.,.,', 'parser.racc', 131)
674
- def _reduce_51(val, _values, result)
700
+ module_eval(<<'.,.,', 'parser.racc', 136)
701
+ def _reduce_54(val, _values, result)
675
702
  result = RDL::Type::SingletonType.new(val[0].to_f)
676
703
  result
677
704
  end
678
705
  .,.,
679
706
 
680
- module_eval(<<'.,.,', 'parser.racc', 133)
681
- def _reduce_52(val, _values, result)
707
+ module_eval(<<'.,.,', 'parser.racc', 138)
708
+ def _reduce_55(val, _values, result)
682
709
  result = RDL::Type::SingletonType.new(Kernel.const_get(val[1]))
683
710
 
684
711
  result
685
712
  end
686
713
  .,.,
687
714
 
688
- module_eval(<<'.,.,', 'parser.racc', 137)
689
- def _reduce_53(val, _values, result)
715
+ module_eval(<<'.,.,', 'parser.racc', 142)
716
+ def _reduce_56(val, _values, result)
690
717
  result = RDL::Type::WildQuery.new
691
718
  result
692
719
  end