rdl 1.1.1 → 2.0.0.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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +6 -0
  3. data/README.md +211 -32
  4. data/gemfiles/Gemfile.travis +1 -1
  5. data/lib/rdl.rb +85 -18
  6. data/lib/rdl/info.rb +74 -0
  7. data/lib/rdl/query.rb +8 -9
  8. data/lib/rdl/typecheck.rb +1057 -0
  9. data/lib/rdl/types/annotated_arg.rb +5 -5
  10. data/lib/rdl/types/{nil.rb → bot.rb} +9 -13
  11. data/lib/rdl/types/dependent_arg.rb +5 -5
  12. data/lib/rdl/types/dots_query.rb +2 -0
  13. data/lib/rdl/types/finitehash.rb +67 -24
  14. data/lib/rdl/types/generic.rb +13 -21
  15. data/lib/rdl/types/intersection.rb +9 -8
  16. data/lib/rdl/types/method.rb +30 -32
  17. data/lib/rdl/types/nominal.rb +22 -16
  18. data/lib/rdl/types/optional.rb +8 -22
  19. data/lib/rdl/types/parser.racc +8 -3
  20. data/lib/rdl/types/parser.tab.rb +131 -118
  21. data/lib/rdl/types/singleton.rb +15 -10
  22. data/lib/rdl/types/structural.rb +6 -6
  23. data/lib/rdl/types/top.rb +6 -6
  24. data/lib/rdl/types/tuple.rb +56 -24
  25. data/lib/rdl/types/type.rb +9 -0
  26. data/lib/rdl/types/type_inferencer.rb +1 -1
  27. data/lib/rdl/types/union.rb +52 -26
  28. data/lib/rdl/types/var.rb +7 -6
  29. data/lib/rdl/types/vararg.rb +5 -6
  30. data/lib/rdl/types/wild_query.rb +9 -2
  31. data/lib/rdl/util.rb +9 -7
  32. data/lib/rdl/wrap.rb +90 -72
  33. data/lib/rdl_types.rb +2 -2
  34. data/rdl.gemspec +6 -8
  35. data/test/test_alias.rb +4 -3
  36. data/test/test_contract.rb +5 -4
  37. data/test/test_dsl.rb +2 -1
  38. data/test/test_generic.rb +30 -26
  39. data/test/test_intersection.rb +3 -3
  40. data/test/test_le.rb +129 -61
  41. data/test/test_lib_types.rb +3 -2
  42. data/test/test_member.rb +33 -46
  43. data/test/test_parser.rb +113 -116
  44. data/test/test_query.rb +2 -1
  45. data/test/test_rdl.rb +64 -6
  46. data/test/test_rdl_type.rb +3 -2
  47. data/test/test_type_contract.rb +30 -12
  48. data/test/test_typecheck.rb +893 -0
  49. data/test/test_types.rb +50 -54
  50. data/test/test_wrap.rb +2 -1
  51. data/types/ruby-2.x/_aliases.rb +13 -2
  52. data/types/ruby-2.x/bigdecimal.rb +60 -85
  53. data/types/ruby-2.x/bignum.rb +80 -119
  54. data/types/ruby-2.x/complex.rb +33 -40
  55. data/types/ruby-2.x/fixnum.rb +81 -120
  56. data/types/ruby-2.x/float.rb +79 -116
  57. data/types/ruby-2.x/integer.rb +187 -22
  58. data/types/ruby-2.x/nil.rb +12 -0
  59. data/types/ruby-2.x/numeric.rb +38 -38
  60. data/types/ruby-2.x/object.rb +3 -3
  61. data/types/ruby-2.x/random.rb +2 -0
  62. data/types/ruby-2.x/range.rb +20 -19
  63. data/types/ruby-2.x/rational.rb +40 -40
  64. data/types/ruby-2.x/regexp.rb +4 -4
  65. data/types/ruby-2.x/string.rb +15 -17
  66. metadata +17 -16
  67. data/lib/rdl/types/.#lexer.rex +0 -1
@@ -1,5 +1,3 @@
1
- require_relative 'type'
2
-
3
1
  module RDL::Type
4
2
  class NominalType < Type
5
3
  attr_reader :name # string
@@ -12,7 +10,6 @@ module RDL::Type
12
10
 
13
11
  def self.new(name)
14
12
  name = name.to_s
15
- return NilType.new if name == "NilClass"
16
13
  t = @@cache[name]
17
14
  return t if t
18
15
  t = self.__new__ name
@@ -23,15 +20,16 @@ module RDL::Type
23
20
  @name = name
24
21
  end
25
22
 
26
- def eql?(other)
27
- self == other
28
- end
29
-
30
23
  def ==(other)
24
+ return false if other.nil?
25
+ other = other.canonical
31
26
  return (other.instance_of? self.class) && (other.name == @name)
32
27
  end
33
28
 
29
+ alias eql? ==
30
+
34
31
  def match(other)
32
+ other = other.canonical
35
33
  other = other.type if other.instance_of? AnnotatedArgType
36
34
  return true if other.instance_of? WildQuery
37
35
  return self == other
@@ -51,25 +49,28 @@ module RDL::Type
51
49
  end
52
50
 
53
51
  def <=(other)
52
+ other = other.canonical
54
53
  k = klass
55
- return true if other.instance_of? TopType
56
- return k.ancestors.member?(other.klass) if other.instance_of? NominalType
54
+ if other.instance_of? TopType
55
+ return true
56
+ elsif other.instance_of? NominalType
57
+ return k.ancestors.member?(other.klass)
57
58
  # return self <= other.base if other.instance_of? GenericType # raw subtyping not allowed
58
- if other.instance_of? StructuralType
59
+ elsif other.instance_of? StructuralType
59
60
  # similar logic in GenericType
60
61
  other.methods.each_pair { |m, t|
61
62
  return false unless k.method_defined? m
62
- if RDL::Wrap.has_contracts?(k, m, :type)
63
- types = RDL::Wrap.get_contracts(k, m, :type)
63
+ types = $__rdl_info.get(k, m, :type)
64
+ if types
64
65
  return false unless types.all? { |t_self| t_self <= t }
65
66
  end
66
67
  }
67
68
  return true
69
+ elsif other.instance_of? UnionType
70
+ return other.types.any? { |ot| self <= ot }
71
+ else
72
+ return false
68
73
  end
69
- if other.instance_of? UnionType
70
- other.types.each {|ot| return true if self <= ot}
71
- end
72
- return false
73
74
  end
74
75
 
75
76
  def member?(obj, *args)
@@ -82,5 +83,10 @@ module RDL::Type
82
83
  def instantiate(inst)
83
84
  return self
84
85
  end
86
+
87
+ @@cache.merge!({"NilClass" => SingletonType.new(nil),
88
+ "TrueClass" => SingletonType.new(true),
89
+ "FalseClass" => SingletonType.new(false),
90
+ })
85
91
  end
86
92
  end
@@ -1,26 +1,11 @@
1
- require_relative 'type'
2
-
3
1
  module RDL::Type
4
2
  class OptionalType < Type
5
3
  attr_reader :type
6
4
 
7
- @@cache = {}
8
-
9
- class << self
10
- alias :__new__ :new
11
- end
12
-
13
- def self.new(type)
14
- t = @@cache[type]
15
- return t if t
16
- raise RuntimeError, "Attempt to create optional type with non-type" unless type.is_a? Type
17
- t = OptionalType.__new__ type
18
- return (@@cache[type] = t) # assignment evaluates to t
19
- end
20
-
21
5
  def initialize(type)
22
- raise "Can't have optional optional type" if type.class == OptionalType
23
- raise "Can't have optional vararg type" if type.class == VarargType
6
+ raise RuntimeError, "Attempt to create optional type with non-type" unless type.is_a? Type
7
+ raise "Can't have optional optional type" if type.is_a? OptionalType
8
+ raise "Can't have optional vararg type" if type.is_a? VarargType
24
9
  @type = type
25
10
  super()
26
11
  end
@@ -33,15 +18,16 @@ module RDL::Type
33
18
  end
34
19
  end
35
20
 
36
- def eql?(other)
37
- self == other
38
- end
39
-
40
21
  def ==(other) # :nodoc:
22
+ return false if other.nil?
23
+ other = other.canonical
41
24
  return (other.instance_of? OptionalType) && (other.type == @type)
42
25
  end
43
26
 
27
+ alias eql? ==
28
+
44
29
  def match(other)
30
+ other = other.canonical
45
31
  other = other.type if other.instance_of? AnnotatedArgType
46
32
  return true if other.instance_of? WildQuery
47
33
  return (other.instance_of? OptionalType) && (@type.match(other.type))
@@ -105,7 +105,11 @@ rule
105
105
  SYMBOL { result = RDL::Type::SingletonType.new(val[0].to_sym) }
106
106
  | ID {
107
107
  if val[0] == 'nil' then
108
- result = RDL::Type::NilType.new
108
+ result = $__rdl_nil_type
109
+ elsif val[0] == 'true' then
110
+ result = $__rdl_true_type
111
+ elsif val[0] == 'false'
112
+ result = $__rdl_false_type
109
113
  elsif val[0] =~ /^[a-z_]+\w*\'?/ then
110
114
  result = RDL::Type::VarType.new(val[0].to_sym)
111
115
  else
@@ -130,6 +134,9 @@ rule
130
134
  | LBRACKET method_sig_list RBRACKET {
131
135
  result = RDL::Type::StructuralType.new(Hash[*val[1]])
132
136
  }
137
+ | LBRACKET RBRACKET {
138
+ result = RDL::Type::TupleType.new
139
+ }
133
140
  | LBRACE hash_expr_comma_list RBRACE {
134
141
  result = RDL::Type::FiniteHashType.new(Hash[*val[1]])
135
142
  }
@@ -144,8 +151,6 @@ rule
144
151
 
145
152
  ---- header ----
146
153
 
147
- require_relative 'lexer.rex'
148
-
149
154
  module RDL::Type
150
155
 
151
156
  ---- inner ----
@@ -1,19 +1,17 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.9
3
+ # This file is automatically generated by Racc 1.4.14
4
4
  # from Racc grammer file "".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
8
8
 
9
9
 
10
- require_relative 'lexer.rex'
11
-
12
10
  module RDL::Type
13
11
 
14
12
  class Parser < Racc::Parser
15
13
 
16
- module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 152)
14
+ module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 157)
17
15
 
18
16
  def initialize()
19
17
  @yydebug = true
@@ -23,112 +21,114 @@ end
23
21
  ##### State transition tables begin ###
24
22
 
25
23
  racc_action_table = [
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 ]
24
+ 20, 70, 18, 19, 73, 21, 28, 30, 13, 15,
25
+ 5, 6, 11, 74, 16, 57, 17, 37, 31, 32,
26
+ 20, 76, 18, 19, 7, 21, 28, 30, 13, 15,
27
+ 79, 37, 11, 38, 16, 84, 17, 87, 31, 32,
28
+ 20, 7, 18, 19, 92, 21, 7, 14, 13, 15,
29
+ 95, 96, 11, 98, 16, 100, 17, 20, 82, 18,
30
+ 19, 102, 21, 70, 47, 13, 15, 103, 8, 11,
31
+ 7, 16, 34, 17, 51, 20, 36, 18, 19, 37,
32
+ 21, 52, 14, 13, 15, 53, 54, 11, 55, 16,
33
+ 20, 17, 18, 19, 56, 21, 60, 14, 13, 15,
34
+ 20, 57, 18, 19, 16, 21, 17, 14, 13, 15,
35
+ 63, 64, 11, 65, 16, 20, 17, 18, 19, 66,
36
+ 21, 67, 14, 13, 15, 68, 69, 11, 71, 16,
37
+ 20, 17, 18, 19, 72, 21, nil, 14, 13, 15,
38
+ 20, nil, 18, 19, 16, 21, 17, 14, 13, 15,
39
+ nil, nil, 11, nil, 16, 20, 17, 18, 19, nil,
40
+ 21, nil, 14, 13, 15, nil, nil, 11, nil, 16,
41
+ 20, 17, 18, 19, nil, 21, nil, 14, 13, 15,
42
+ nil, nil, 11, nil, 16, 20, 17, 18, 19, nil,
43
+ 21, nil, 14, 13, 15, nil, nil, 11, nil, 16,
44
+ 20, 17, 18, 19, nil, 21, nil, 14, 13, 15,
45
+ 20, nil, 18, 19, 16, 21, 17, 14, 13, 15,
46
+ nil, nil, 11, nil, 16, 20, 17, 18, 19, nil,
47
+ 21, nil, 14, 13, 15, 20, nil, 18, 19, 16,
48
+ 21, 17, 14, 13, 15, 42, nil, 40, 41, 16,
49
+ nil, 17, 38, nil, nil, 43, 42, 7, 40, 41,
50
+ nil, nil, nil, 38, nil, nil, 43 ]
52
51
 
53
52
  racc_action_check = [
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 ]
53
+ 7, 47, 7, 7, 50, 7, 7, 7, 7, 7,
54
+ 0, 0, 7, 52, 7, 30, 7, 47, 7, 7,
55
+ 54, 53, 54, 54, 0, 54, 54, 54, 54, 54,
56
+ 55, 30, 54, 56, 54, 62, 54, 65, 54, 54,
57
+ 57, 70, 57, 57, 75, 57, 76, 57, 57, 57,
58
+ 87, 90, 57, 93, 57, 96, 57, 17, 57, 17,
59
+ 17, 97, 17, 100, 17, 17, 17, 102, 1, 17,
60
+ 6, 17, 8, 17, 17, 32, 12, 32, 32, 14,
61
+ 32, 20, 32, 32, 32, 23, 26, 32, 27, 32,
62
+ 66, 32, 66, 66, 29, 66, 35, 66, 66, 66,
63
+ 11, 38, 11, 11, 66, 11, 66, 11, 11, 11,
64
+ 40, 41, 11, 42, 11, 71, 11, 71, 71, 43,
65
+ 71, 44, 71, 71, 71, 45, 46, 71, 48, 71,
66
+ 36, 71, 36, 36, 49, 36, nil, 36, 36, 36,
67
+ 82, nil, 82, 82, 36, 82, 36, 82, 82, 82,
68
+ nil, nil, 82, nil, 82, 37, 82, 37, 37, nil,
69
+ 37, nil, 37, 37, 37, nil, nil, 37, nil, 37,
70
+ 92, 37, 92, 92, nil, 92, nil, 92, 92, 92,
71
+ nil, nil, 92, nil, 92, 5, 92, 5, 5, nil,
72
+ 5, nil, 5, 5, 5, nil, nil, 5, nil, 5,
73
+ 95, 5, 95, 95, nil, 95, nil, 95, 95, 95,
74
+ 31, nil, 31, 31, 95, 31, 95, 31, 31, 31,
75
+ nil, nil, 31, nil, 31, 63, 31, 63, 63, nil,
76
+ 63, nil, 63, 63, 63, 64, nil, 64, 64, 63,
77
+ 64, 63, 64, 64, 64, 16, nil, 16, 16, 64,
78
+ nil, 64, 16, nil, nil, 16, 67, 16, 67, 67,
79
+ nil, nil, nil, 67, nil, nil, 67 ]
80
80
 
81
81
  racc_action_pointer = [
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 ]
82
+ 5, 68, nil, nil, nil, 178, 51, -7, 72, nil,
83
+ nil, 93, 72, nil, 52, nil, 238, 50, nil, nil,
84
+ 67, nil, nil, 65, nil, nil, 84, 74, nil, 92,
85
+ 4, 203, 68, nil, nil, 76, 123, 148, 90, nil,
86
+ 102, 103, 99, 111, 119, 103, 104, -10, 126, 110,
87
+ -20, nil, -9, 0, 13, 12, 19, 33, nil, nil,
88
+ nil, nil, 7, 218, 228, 15, 83, 249, nil, nil,
89
+ 22, 108, nil, nil, nil, 41, 27, nil, nil, nil,
90
+ nil, nil, 133, nil, nil, nil, nil, 42, nil, nil,
91
+ 49, nil, 163, 31, nil, 193, 41, 47, nil, nil,
92
+ 52, nil, 49, nil ]
93
93
 
94
94
  racc_action_default = [
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 ]
95
+ -58, -58, -1, -2, -3, -58, -58, -11, -58, -4,
96
+ -31, -58, -43, -45, -46, -47, -35, -58, -54, -55,
97
+ -58, -57, -5, -58, -12, -13, -14, -17, -20, -21,
98
+ -46, -58, -58, -26, 104, -58, -58, -58, -58, -36,
99
+ -58, -58, -58, -58, -41, -58, -58, -46, -33, -58,
100
+ -58, -52, -58, -29, -58, -19, -58, -58, -24, -25,
101
+ -32, -44, -58, -58, -58, -58, -58, -35, -49, -53,
102
+ -58, -58, -50, -51, -56, -58, -58, -15, -16, -18,
103
+ -22, -23, -58, -28, -48, -37, -38, -58, -40, -42,
104
+ -9, -34, -58, -58, -27, -58, -58, -6, -30, -39,
105
+ -58, -10, -7, -8 ]
106
106
 
107
107
  racc_goto_table = [
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 ]
108
+ 9, 50, 33, 2, 61, 49, 35, 46, 25, 22,
109
+ 39, 81, 4, 24, 3, 23, 75, 1, nil, 45,
110
+ nil, nil, nil, nil, nil, 62, 58, 59, nil, nil,
111
+ nil, 85, 86, nil, 88, nil, nil, nil, nil, nil,
112
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 33,
113
+ nil, nil, 83, nil, nil, 78, nil, 80, 89, 91,
114
+ 77, 39, nil, 99, nil, nil, nil, nil, nil, nil,
115
+ nil, nil, nil, 90, nil, nil, nil, 94, nil, 93,
116
+ 101, nil, nil, nil, nil, nil, nil, 97 ]
117
117
 
118
118
  racc_goto_check = [
119
- 5, 8, 5, 2, 15, 16, 5, 13, 10, 2,
120
- 18, 14, 6, 9, 7, 4, 3, 1, nil, 2,
119
+ 5, 8, 5, 2, 15, 16, 5, 18, 10, 2,
120
+ 13, 14, 4, 9, 3, 6, 7, 1, nil, 2,
121
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 ]
122
+ nil, 15, 15, nil, 15, nil, nil, nil, nil, nil,
123
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 5,
124
+ nil, nil, 5, nil, nil, 10, nil, 10, 18, 16,
125
+ 9, 13, nil, 15, nil, nil, nil, nil, nil, nil,
126
+ nil, nil, nil, 2, nil, nil, nil, 5, nil, 2,
127
+ 8, nil, nil, nil, nil, nil, nil, 5 ]
128
128
 
129
129
  racc_goto_pointer = [
130
- nil, 17, 3, 16, 15, -5, 5, -38, -16, 6,
131
- 1, nil, nil, -9, -45, -32, -12, nil, -6, nil ]
130
+ nil, 17, 3, 14, 12, -5, 8, -37, -16, 6,
131
+ 1, nil, nil, -6, -46, -32, -12, nil, -9, nil ]
132
132
 
133
133
  racc_goto_default = [
134
134
  nil, nil, nil, nil, nil, 48, nil, nil, nil, nil,
@@ -187,15 +187,16 @@ racc_reduce_table = [
187
187
  3, 49, :_reduce_49,
188
188
  3, 49, :_reduce_50,
189
189
  3, 49, :_reduce_51,
190
- 3, 49, :_reduce_52,
191
- 1, 49, :_reduce_53,
190
+ 2, 49, :_reduce_52,
191
+ 3, 49, :_reduce_53,
192
192
  1, 49, :_reduce_54,
193
- 3, 49, :_reduce_55,
194
- 1, 49, :_reduce_56 ]
193
+ 1, 49, :_reduce_55,
194
+ 3, 49, :_reduce_56,
195
+ 1, 49, :_reduce_57 ]
195
196
 
196
- racc_reduce_n = 57
197
+ racc_reduce_n = 58
197
198
 
198
- racc_shift_n = 103
199
+ racc_shift_n = 104
199
200
 
200
201
  racc_token_table = {
201
202
  false => 0,
@@ -627,7 +628,11 @@ module_eval(<<'.,.,', 'parser.racc', 104)
627
628
  module_eval(<<'.,.,', 'parser.racc', 106)
628
629
  def _reduce_46(val, _values, result)
629
630
  if val[0] == 'nil' then
630
- result = RDL::Type::NilType.new
631
+ result = $__rdl_nil_type
632
+ elsif val[0] == 'true' then
633
+ result = $__rdl_true_type
634
+ elsif val[0] == 'false'
635
+ result = $__rdl_false_type
631
636
  elsif val[0] =~ /^[a-z_]+\w*\'?/ then
632
637
  result = RDL::Type::VarType.new(val[0].to_sym)
633
638
  else
@@ -638,7 +643,7 @@ module_eval(<<'.,.,', 'parser.racc', 106)
638
643
  end
639
644
  .,.,
640
645
 
641
- module_eval(<<'.,.,', 'parser.racc', 115)
646
+ module_eval(<<'.,.,', 'parser.racc', 119)
642
647
  def _reduce_47(val, _values, result)
643
648
  if $__rdl_special_types.has_key? val[0] then
644
649
  result = $__rdl_special_types[val[0]]
@@ -650,7 +655,7 @@ module_eval(<<'.,.,', 'parser.racc', 115)
650
655
  end
651
656
  .,.,
652
657
 
653
- module_eval(<<'.,.,', 'parser.racc', 122)
658
+ module_eval(<<'.,.,', 'parser.racc', 126)
654
659
  def _reduce_48(val, _values, result)
655
660
  n = RDL::Type::NominalType.new(val[0])
656
661
  result = RDL::Type::GenericType.new(n, *val[2])
@@ -659,14 +664,14 @@ module_eval(<<'.,.,', 'parser.racc', 122)
659
664
  end
660
665
  .,.,
661
666
 
662
- module_eval(<<'.,.,', 'parser.racc', 125)
667
+ module_eval(<<'.,.,', 'parser.racc', 129)
663
668
  def _reduce_49(val, _values, result)
664
669
  result = val[1]
665
670
  result
666
671
  end
667
672
  .,.,
668
673
 
669
- module_eval(<<'.,.,', 'parser.racc', 127)
674
+ module_eval(<<'.,.,', 'parser.racc', 131)
670
675
  def _reduce_50(val, _values, result)
671
676
  result = RDL::Type::TupleType.new(*val[1])
672
677
 
@@ -674,7 +679,7 @@ module_eval(<<'.,.,', 'parser.racc', 127)
674
679
  end
675
680
  .,.,
676
681
 
677
- module_eval(<<'.,.,', 'parser.racc', 130)
682
+ module_eval(<<'.,.,', 'parser.racc', 134)
678
683
  def _reduce_51(val, _values, result)
679
684
  result = RDL::Type::StructuralType.new(Hash[*val[1]])
680
685
 
@@ -682,38 +687,46 @@ module_eval(<<'.,.,', 'parser.racc', 130)
682
687
  end
683
688
  .,.,
684
689
 
685
- module_eval(<<'.,.,', 'parser.racc', 133)
690
+ module_eval(<<'.,.,', 'parser.racc', 137)
686
691
  def _reduce_52(val, _values, result)
687
- result = RDL::Type::FiniteHashType.new(Hash[*val[1]])
692
+ result = RDL::Type::TupleType.new
688
693
 
689
694
  result
690
695
  end
691
696
  .,.,
692
697
 
693
- module_eval(<<'.,.,', 'parser.racc', 135)
698
+ module_eval(<<'.,.,', 'parser.racc', 140)
694
699
  def _reduce_53(val, _values, result)
695
- result = RDL::Type::SingletonType.new(val[0].to_i)
700
+ result = RDL::Type::FiniteHashType.new(Hash[*val[1]])
701
+
696
702
  result
697
703
  end
698
704
  .,.,
699
705
 
700
- module_eval(<<'.,.,', 'parser.racc', 136)
706
+ module_eval(<<'.,.,', 'parser.racc', 142)
701
707
  def _reduce_54(val, _values, result)
702
- result = RDL::Type::SingletonType.new(val[0].to_f)
708
+ result = RDL::Type::SingletonType.new(val[0].to_i)
703
709
  result
704
710
  end
705
711
  .,.,
706
712
 
707
- module_eval(<<'.,.,', 'parser.racc', 138)
713
+ module_eval(<<'.,.,', 'parser.racc', 143)
708
714
  def _reduce_55(val, _values, result)
715
+ result = RDL::Type::SingletonType.new(val[0].to_f)
716
+ result
717
+ end
718
+ .,.,
719
+
720
+ module_eval(<<'.,.,', 'parser.racc', 145)
721
+ def _reduce_56(val, _values, result)
709
722
  result = RDL::Type::SingletonType.new(Kernel.const_get(val[1]))
710
723
 
711
724
  result
712
725
  end
713
726
  .,.,
714
727
 
715
- module_eval(<<'.,.,', 'parser.racc', 142)
716
- def _reduce_56(val, _values, result)
728
+ module_eval(<<'.,.,', 'parser.racc', 149)
729
+ def _reduce_57(val, _values, result)
717
730
  result = RDL::Type::WildQuery.new
718
731
  result
719
732
  end