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.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/README.md +211 -32
- data/gemfiles/Gemfile.travis +1 -1
- data/lib/rdl.rb +85 -18
- data/lib/rdl/info.rb +74 -0
- data/lib/rdl/query.rb +8 -9
- data/lib/rdl/typecheck.rb +1057 -0
- data/lib/rdl/types/annotated_arg.rb +5 -5
- data/lib/rdl/types/{nil.rb → bot.rb} +9 -13
- data/lib/rdl/types/dependent_arg.rb +5 -5
- data/lib/rdl/types/dots_query.rb +2 -0
- data/lib/rdl/types/finitehash.rb +67 -24
- data/lib/rdl/types/generic.rb +13 -21
- data/lib/rdl/types/intersection.rb +9 -8
- data/lib/rdl/types/method.rb +30 -32
- data/lib/rdl/types/nominal.rb +22 -16
- data/lib/rdl/types/optional.rb +8 -22
- data/lib/rdl/types/parser.racc +8 -3
- data/lib/rdl/types/parser.tab.rb +131 -118
- data/lib/rdl/types/singleton.rb +15 -10
- data/lib/rdl/types/structural.rb +6 -6
- data/lib/rdl/types/top.rb +6 -6
- data/lib/rdl/types/tuple.rb +56 -24
- data/lib/rdl/types/type.rb +9 -0
- data/lib/rdl/types/type_inferencer.rb +1 -1
- data/lib/rdl/types/union.rb +52 -26
- data/lib/rdl/types/var.rb +7 -6
- data/lib/rdl/types/vararg.rb +5 -6
- data/lib/rdl/types/wild_query.rb +9 -2
- data/lib/rdl/util.rb +9 -7
- data/lib/rdl/wrap.rb +90 -72
- data/lib/rdl_types.rb +2 -2
- data/rdl.gemspec +6 -8
- data/test/test_alias.rb +4 -3
- data/test/test_contract.rb +5 -4
- data/test/test_dsl.rb +2 -1
- data/test/test_generic.rb +30 -26
- data/test/test_intersection.rb +3 -3
- data/test/test_le.rb +129 -61
- data/test/test_lib_types.rb +3 -2
- data/test/test_member.rb +33 -46
- data/test/test_parser.rb +113 -116
- data/test/test_query.rb +2 -1
- data/test/test_rdl.rb +64 -6
- data/test/test_rdl_type.rb +3 -2
- data/test/test_type_contract.rb +30 -12
- data/test/test_typecheck.rb +893 -0
- data/test/test_types.rb +50 -54
- data/test/test_wrap.rb +2 -1
- data/types/ruby-2.x/_aliases.rb +13 -2
- data/types/ruby-2.x/bigdecimal.rb +60 -85
- data/types/ruby-2.x/bignum.rb +80 -119
- data/types/ruby-2.x/complex.rb +33 -40
- data/types/ruby-2.x/fixnum.rb +81 -120
- data/types/ruby-2.x/float.rb +79 -116
- data/types/ruby-2.x/integer.rb +187 -22
- data/types/ruby-2.x/nil.rb +12 -0
- data/types/ruby-2.x/numeric.rb +38 -38
- data/types/ruby-2.x/object.rb +3 -3
- data/types/ruby-2.x/random.rb +2 -0
- data/types/ruby-2.x/range.rb +20 -19
- data/types/ruby-2.x/rational.rb +40 -40
- data/types/ruby-2.x/regexp.rb +4 -4
- data/types/ruby-2.x/string.rb +15 -17
- metadata +17 -16
- data/lib/rdl/types/.#lexer.rex +0 -1
data/lib/rdl/types/nominal.rb
CHANGED
@@ -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
|
-
|
56
|
-
|
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
|
-
|
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
|
-
|
63
|
-
|
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
|
data/lib/rdl/types/optional.rb
CHANGED
@@ -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 "
|
23
|
-
raise "Can't have optional
|
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))
|
data/lib/rdl/types/parser.racc
CHANGED
@@ -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 =
|
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 ----
|
data/lib/rdl/types/parser.tab.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.4.
|
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',
|
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,
|
27
|
-
5, 6, 11,
|
28
|
-
20,
|
29
|
-
|
30
|
-
20,
|
31
|
-
|
32
|
-
19,
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
19,
|
37
|
-
|
38
|
-
|
39
|
-
19,
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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,
|
55
|
-
0, 0, 7,
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
nil,
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
5,
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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,
|
83
|
-
nil,
|
84
|
-
|
85
|
-
4,
|
86
|
-
|
87
|
-
|
88
|
-
nil,
|
89
|
-
|
90
|
-
nil,
|
91
|
-
nil,
|
92
|
-
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
|
-
-
|
96
|
-
-31, -
|
97
|
-
-
|
98
|
-
-46, -
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-44, -
|
102
|
-
-
|
103
|
-
-23, -
|
104
|
-
-34, -
|
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,
|
109
|
-
|
110
|
-
nil, nil, nil, nil, nil,
|
111
|
-
|
112
|
-
nil, nil, nil, nil, nil, nil, nil, nil, 33,
|
113
|
-
nil,
|
114
|
-
|
115
|
-
nil, nil,
|
116
|
-
nil, nil, nil, nil, nil, nil,
|
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,
|
120
|
-
|
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,
|
123
|
-
nil, nil, nil, nil, nil, nil, nil, nil, 5,
|
124
|
-
nil, 5, nil, nil, 10, nil, 10,
|
125
|
-
|
126
|
-
nil, nil, 2, nil, nil, nil, 5, nil, 2,
|
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,
|
131
|
-
1, nil, 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
|
-
|
191
|
-
|
190
|
+
2, 49, :_reduce_52,
|
191
|
+
3, 49, :_reduce_53,
|
192
192
|
1, 49, :_reduce_54,
|
193
|
-
|
194
|
-
|
193
|
+
1, 49, :_reduce_55,
|
194
|
+
3, 49, :_reduce_56,
|
195
|
+
1, 49, :_reduce_57 ]
|
195
196
|
|
196
|
-
racc_reduce_n =
|
197
|
+
racc_reduce_n = 58
|
197
198
|
|
198
|
-
racc_shift_n =
|
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 =
|
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',
|
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',
|
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',
|
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',
|
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',
|
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',
|
690
|
+
module_eval(<<'.,.,', 'parser.racc', 137)
|
686
691
|
def _reduce_52(val, _values, result)
|
687
|
-
result = RDL::Type::
|
692
|
+
result = RDL::Type::TupleType.new
|
688
693
|
|
689
694
|
result
|
690
695
|
end
|
691
696
|
.,.,
|
692
697
|
|
693
|
-
module_eval(<<'.,.,', 'parser.racc',
|
698
|
+
module_eval(<<'.,.,', 'parser.racc', 140)
|
694
699
|
def _reduce_53(val, _values, result)
|
695
|
-
|
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',
|
706
|
+
module_eval(<<'.,.,', 'parser.racc', 142)
|
701
707
|
def _reduce_54(val, _values, result)
|
702
|
-
result = RDL::Type::SingletonType.new(val[0].
|
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',
|
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',
|
716
|
-
def
|
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
|