rdl 2.0.0.rc2 → 2.0.0.rc3
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 +7 -1
- data/README.md +94 -20
- data/lib/rdl.rb +4 -1
- data/lib/rdl/config.rb +90 -3
- data/lib/rdl/info.rb +16 -0
- data/lib/rdl/typecheck.rb +207 -79
- data/lib/rdl/types/bot.rb +1 -1
- data/lib/rdl/types/dependent_arg.rb +17 -8
- data/lib/rdl/types/{finitehash.rb → finite_hash.rb} +3 -29
- data/lib/rdl/types/generic.rb +1 -37
- data/lib/rdl/types/intersection.rb +1 -0
- data/lib/rdl/types/lexer.rex +2 -1
- data/lib/rdl/types/lexer.rex.rb +4 -1
- data/lib/rdl/types/method.rb +2 -12
- data/lib/rdl/types/nominal.rb +1 -22
- data/lib/rdl/types/non_null.rb +50 -0
- data/lib/rdl/types/parser.racc +3 -1
- data/lib/rdl/types/parser.tab.rb +222 -190
- data/lib/rdl/types/singleton.rb +1 -6
- data/lib/rdl/types/structural.rb +1 -10
- data/lib/rdl/types/top.rb +1 -2
- data/lib/rdl/types/tuple.rb +3 -19
- data/lib/rdl/types/type.rb +223 -0
- data/lib/rdl/types/union.rb +12 -2
- data/lib/rdl/types/var.rb +4 -1
- data/lib/rdl/types/wild_query.rb +1 -0
- data/lib/rdl/wrap.rb +199 -169
- data/lib/rdl_disable.rb +41 -0
- data/lib/rdl_types.rb +1 -4
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/_aliases.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/abbrev.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/array.rb +56 -56
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/base64.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/basic_object.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/benchmark.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/bigdecimal.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/bigmath.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/bignum.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/class.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/complex.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/coverage.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/csv.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/date.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/dir.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/encoding.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/enumerable.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/enumerator.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/exception.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/file.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/fileutils.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/fixnum.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/float.rb +26 -26
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/gem.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/hash.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/integer.rb +8 -8
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/io.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/kernel.rb +12 -11
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/marshal.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/matchdata.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/math.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/module.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/nil.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/numeric.rb +0 -0
- data/lib/types/core-ruby-2.x/object.rb +75 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/pathname.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/process.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/random.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/range.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/rational.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/regexp.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/set.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/string.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/strscan.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/symbol.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/time.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/uri.rb +0 -0
- data/{types/ruby-2.x → lib/types/core-ruby-2.x}/yaml.rb +0 -0
- data/lib/types/core.rb +4 -0
- data/rdl.gemspec +2 -2
- data/test/test_le.rb +77 -35
- data/test/test_parser.rb +75 -59
- data/test/test_rdl.rb +18 -0
- data/test/test_typecheck.rb +73 -4
- metadata +54 -57
- data/lib/rails_types.rb +0 -1
- data/types/rails-4.2.1/fixnum.rb +0 -3
- data/types/rails-4.2.1/string.rb +0 -3
- data/types/rails-tmp/action_dispatch.rb +0 -406
- data/types/rails-tmp/active_record.rb +0 -406
- data/types/rails-tmp/devise_contracts.rb +0 -216
- data/types/ruby-2.x/object.rb +0 -73
data/lib/rdl/types/bot.rb
CHANGED
@@ -6,15 +6,12 @@ module RDL::Type
|
|
6
6
|
attr_reader :type
|
7
7
|
attr_reader :predicate
|
8
8
|
|
9
|
-
# Note: Named argument types aren't hashconsed.
|
10
|
-
|
11
9
|
def initialize(name, type, predicate)
|
12
10
|
@name = name
|
13
11
|
@type = type
|
14
|
-
|
15
|
-
@predicate = $1
|
12
|
+
@predicate = predicate
|
16
13
|
raise RuntimeError, "Attempt to create annotated type with non-type" unless type.is_a? Type
|
17
|
-
raise RuntimeError, "Attempt to create doubly annotated type" if (type.is_a? AnnotatedArgType)||(type.is_a? DependentArgType)
|
14
|
+
raise RuntimeError, "Attempt to create doubly annotated type" if (type.is_a? AnnotatedArgType) || (type.is_a? DependentArgType)
|
18
15
|
super()
|
19
16
|
end
|
20
17
|
|
@@ -30,18 +27,30 @@ module RDL::Type
|
|
30
27
|
|
31
28
|
alias eql? ==
|
32
29
|
|
33
|
-
#
|
30
|
+
# match on the base type, ignoring refinement
|
31
|
+
def match(other)
|
32
|
+
return @type.match(other)
|
33
|
+
end
|
34
34
|
|
35
35
|
def hash # :nodoc:
|
36
36
|
return (57 + @name.hash) * @type.hash
|
37
37
|
end
|
38
38
|
|
39
|
+
# ignore refinement in comparison for now
|
40
|
+
def <=(other)
|
41
|
+
return @type <= other
|
42
|
+
end
|
43
|
+
|
44
|
+
def leq_inst(other, inst=nil, ileft=true)
|
45
|
+
return @type.leq_inst(other, inst, ileft)
|
46
|
+
end
|
47
|
+
|
39
48
|
def member?(obj, *args)
|
40
|
-
@type.member?(obj, *args)
|
49
|
+
return @type.member?(obj, *args)
|
41
50
|
end
|
42
51
|
|
43
52
|
def instantiate(inst)
|
44
|
-
return DependentArgType.new(@name, @type.instantiate(inst)
|
53
|
+
return DependentArgType.new(@name, @type.instantiate(inst), @predicate)
|
45
54
|
end
|
46
55
|
end
|
47
56
|
end
|
@@ -7,8 +7,8 @@ module RDL::Type
|
|
7
7
|
class FiniteHashType < Type
|
8
8
|
attr_reader :elts
|
9
9
|
attr_reader :the_hash # either nil or hash type if self has been promoted to hash
|
10
|
-
|
11
|
-
|
10
|
+
attr_accessor :ubounds # upper bounds this tuple has been compared with using <=
|
11
|
+
attr_accessor :lbounds # lower bounds...
|
12
12
|
|
13
13
|
# [+elts+] is a map from keys to types
|
14
14
|
def initialize(elts)
|
@@ -65,33 +65,7 @@ module RDL::Type
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def <=(other)
|
68
|
-
return
|
69
|
-
other = other.canonical
|
70
|
-
return true if other.instance_of? TopType
|
71
|
-
other = other.the_hash if other.instance_of?(FiniteHashType) && other.the_hash
|
72
|
-
if other.instance_of? FiniteHashType
|
73
|
-
# Like Tuples, FiniteHashes are immutable, so covariant subtyping allowed
|
74
|
-
# But note, no width subtyping allowed, to match #member?
|
75
|
-
rest = other.elts.clone # shallow copy
|
76
|
-
@elts.each_pair { |k, tleft|
|
77
|
-
return false unless rest.has_key? k
|
78
|
-
tright = rest[k]
|
79
|
-
tleft = tleft.type if tleft.instance_of? OptionalType
|
80
|
-
tright = tright.type if tright.instance_of? OptionalType
|
81
|
-
return false unless tleft <= tright
|
82
|
-
rest.delete k
|
83
|
-
}
|
84
|
-
rest.each_pair { |k, tright|
|
85
|
-
return false unless tright.instance_of? OptionalType
|
86
|
-
}
|
87
|
-
ubounds << other
|
88
|
-
other.lbounds << self
|
89
|
-
return true
|
90
|
-
elsif (other.instance_of? GenericType) && (other.base == $__rdl_hash_type)
|
91
|
-
r = promote!
|
92
|
-
return (self <= other) && r
|
93
|
-
end
|
94
|
-
return false
|
68
|
+
return Type.leq(self, other)
|
95
69
|
end
|
96
70
|
|
97
71
|
def member?(obj, *args)
|
data/lib/rdl/types/generic.rb
CHANGED
@@ -35,43 +35,7 @@ module RDL::Type
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def <=(other)
|
38
|
-
|
39
|
-
formals, variance, _ = $__rdl_type_params[base.name]
|
40
|
-
# do check here to avoid hiding errors if generic type written
|
41
|
-
# with wrong number of parameters but never checked against
|
42
|
-
# instantiated instances
|
43
|
-
raise TypeError, "No type parameters defined for #{base.name}" unless formals
|
44
|
-
return true if other.instance_of? TopType
|
45
|
-
# return (@base <= other) if other.instance_of?(NominalType) # raw subtyping not allowed
|
46
|
-
if other.instance_of? GenericType
|
47
|
-
return false unless @base == other.base
|
48
|
-
return variance.zip(params, other.params).all? { |v, self_t, other_t|
|
49
|
-
case v
|
50
|
-
when :+
|
51
|
-
self_t <= other_t
|
52
|
-
when :-
|
53
|
-
other_t <= self_t
|
54
|
-
when :~
|
55
|
-
self_t == other_t
|
56
|
-
else
|
57
|
-
raise RuntimeError, "Unexpected variance #{v}" # shouldn't happen
|
58
|
-
end
|
59
|
-
}
|
60
|
-
end
|
61
|
-
if other.instance_of? StructuralType
|
62
|
-
# similar logic in NominalType
|
63
|
-
inst = Hash[*formals.zip(params).flatten]
|
64
|
-
k = base.klass
|
65
|
-
other.methods.each_pair { |m, t|
|
66
|
-
return false unless k.method_defined? m
|
67
|
-
types = $__rdl_info.get(k, m, :type)
|
68
|
-
if types
|
69
|
-
return false unless types.all? { |t_self| t_self.instantiate(inst) <= t }
|
70
|
-
end
|
71
|
-
}
|
72
|
-
return true
|
73
|
-
end
|
74
|
-
return false
|
38
|
+
return Type.leq(self, other)
|
75
39
|
end
|
76
40
|
|
77
41
|
def member?(obj, *args)
|
data/lib/rdl/types/lexer.rex
CHANGED
@@ -17,7 +17,7 @@ rule
|
|
17
17
|
=> { [:RASSOC, text] }
|
18
18
|
\( { [:LPAREN, text] }
|
19
19
|
\) { [:RPAREN, text] }
|
20
|
-
{PREDICATE} { [:PREDICATE, text] }
|
20
|
+
{PREDICATE} { [:PREDICATE, text[2..-3]] }
|
21
21
|
\{ { [:LBRACE, text] }
|
22
22
|
\} { [:RBRACE, text] }
|
23
23
|
\[ { [:LBRACKET, text] }
|
@@ -26,6 +26,7 @@ rule
|
|
26
26
|
> { [:GREATER, text] }
|
27
27
|
, { [:COMMA, text] }
|
28
28
|
\? { [:QUERY, text] }
|
29
|
+
\! { [:BANG, text] }
|
29
30
|
\* { [:STAR, text] }
|
30
31
|
\#T { [:HASH_TYPE, text] }
|
31
32
|
\#Q { [:HASH_QUERY, text] }
|
data/lib/rdl/types/lexer.rex.rb
CHANGED
@@ -77,7 +77,7 @@ class Parser < Racc::Parser
|
|
77
77
|
action { [:RPAREN, text] }
|
78
78
|
|
79
79
|
when (text = @ss.scan(/\{\{(?:(?!}}).)+\}\}/))
|
80
|
-
action { [:PREDICATE, text] }
|
80
|
+
action { [:PREDICATE, text[2..-3]] }
|
81
81
|
|
82
82
|
when (text = @ss.scan(/\{/))
|
83
83
|
action { [:LBRACE, text] }
|
@@ -103,6 +103,9 @@ class Parser < Racc::Parser
|
|
103
103
|
when (text = @ss.scan(/\?/))
|
104
104
|
action { [:QUERY, text] }
|
105
105
|
|
106
|
+
when (text = @ss.scan(/\!/))
|
107
|
+
action { [:BANG, text] }
|
108
|
+
|
106
109
|
when (text = @ss.scan(/\*/))
|
107
110
|
action { [:STAR, text] }
|
108
111
|
|
data/lib/rdl/types/method.rb
CHANGED
@@ -129,7 +129,7 @@ module RDL::Type
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def check_arg_preds(bind, preds)
|
132
|
-
preds.each_with_index { |p,i|
|
132
|
+
preds.each_with_index { |p, i|
|
133
133
|
if !eval(p.predicate, bind) then
|
134
134
|
raise TypeError, <<RUBY
|
135
135
|
Argument does not match type predicate.
|
@@ -265,17 +265,7 @@ RUBY
|
|
265
265
|
end
|
266
266
|
|
267
267
|
def <=(other)
|
268
|
-
return
|
269
|
-
return false unless other.args.size == @args.size
|
270
|
-
return false unless @args.zip(other.args).all? { |left, right| right <= left } # contravariance
|
271
|
-
return false unless @ret <= other.ret # covariance
|
272
|
-
if @block && other.block
|
273
|
-
return (other.block <= @block) # contravariance
|
274
|
-
elsif @block.nil? && other.block.nil?
|
275
|
-
return true
|
276
|
-
else
|
277
|
-
return false # one has a block and the other doesn't
|
278
|
-
end
|
268
|
+
return Type.leq(self, other)
|
279
269
|
end
|
280
270
|
|
281
271
|
def instantiate(inst)
|
data/lib/rdl/types/nominal.rb
CHANGED
@@ -49,28 +49,7 @@ module RDL::Type
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def <=(other)
|
52
|
-
|
53
|
-
k = klass
|
54
|
-
if other.instance_of? TopType
|
55
|
-
return true
|
56
|
-
elsif other.instance_of? NominalType
|
57
|
-
return k.ancestors.member?(other.klass)
|
58
|
-
# return self <= other.base if other.instance_of? GenericType # raw subtyping not allowed
|
59
|
-
elsif other.instance_of? StructuralType
|
60
|
-
# similar logic in GenericType
|
61
|
-
other.methods.each_pair { |m, t|
|
62
|
-
return false unless k.method_defined? m
|
63
|
-
types = $__rdl_info.get(k, m, :type)
|
64
|
-
if types
|
65
|
-
return false unless types.all? { |t_self| t_self <= t }
|
66
|
-
end
|
67
|
-
}
|
68
|
-
return true
|
69
|
-
elsif other.instance_of? UnionType
|
70
|
-
return other.types.any? { |ot| self <= ot }
|
71
|
-
else
|
72
|
-
return false
|
73
|
-
end
|
52
|
+
return Type.leq(self, other)
|
74
53
|
end
|
75
54
|
|
76
55
|
def member?(obj, *args)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require_relative 'type'
|
2
|
+
|
3
|
+
module RDL::Type
|
4
|
+
class NonNullType < Type
|
5
|
+
attr_reader :type
|
6
|
+
|
7
|
+
def initialize(type)
|
8
|
+
@type = type
|
9
|
+
raise RuntimeError, "Singleton types are always non-null" if type.is_a? SingletonType
|
10
|
+
raise RuntimeError, "Attempt to create doubly non-null type" if type.is_a? NonNullType
|
11
|
+
super()
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
return "!#{@type.to_s}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def ==(other) # :nodoc:
|
19
|
+
return false if other.nil?
|
20
|
+
other = other.canonical
|
21
|
+
return (other.instance_of? NonNullType) && (other.type == @type)
|
22
|
+
end
|
23
|
+
|
24
|
+
alias eql? ==
|
25
|
+
|
26
|
+
def match(other)
|
27
|
+
other = other.canonical
|
28
|
+
other = other.type if other.instance_of? AnnotatedArgType
|
29
|
+
return true if other.instance_of? WildQuery
|
30
|
+
return (other.instance_of? NonNullType) && (@type.match(other.type))
|
31
|
+
end
|
32
|
+
|
33
|
+
def hash # :nodoc:
|
34
|
+
return 157 + @type.hash
|
35
|
+
end
|
36
|
+
|
37
|
+
def <=(other)
|
38
|
+
return Type.leq(self, other)
|
39
|
+
end
|
40
|
+
|
41
|
+
def member?(obj, *args)
|
42
|
+
return false if obj.nil?
|
43
|
+
@type.member?(obj, *args)
|
44
|
+
end
|
45
|
+
|
46
|
+
def instantiate(inst)
|
47
|
+
return NonNullType.new(@type.instantiate(inst))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/rdl/types/parser.racc
CHANGED
@@ -10,7 +10,7 @@ class Parser
|
|
10
10
|
token HASH_TYPE HASH_QUERY CONST_BEGIN RASSOC
|
11
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
|
-
token COMMA QUERY STAR LESS GREATER
|
13
|
+
token COMMA QUERY BANG STAR LESS GREATER
|
14
14
|
token EOF
|
15
15
|
|
16
16
|
rule
|
@@ -100,6 +100,8 @@ rule
|
|
100
100
|
union_type:
|
101
101
|
single_type { result = val[0] }
|
102
102
|
| single_type OR union_type { result = RDL::Type::UnionType.new val[0], val[2] }
|
103
|
+
| BANG single_type { result = RDL::Type::NonNullType.new val[1] }
|
104
|
+
| BANG single_type OR union_type { result = RDL::Type::UnionType.new(RDL::Type::NonNullType.new(val[1]), val[3]) }
|
103
105
|
|
104
106
|
single_type:
|
105
107
|
SYMBOL { result = RDL::Type::SingletonType.new(val[0].to_sym) }
|
data/lib/rdl/types/parser.tab.rb
CHANGED
@@ -11,7 +11,7 @@ module RDL::Type
|
|
11
11
|
|
12
12
|
class Parser < Racc::Parser
|
13
13
|
|
14
|
-
module_eval(<<'...end parser.racc/module_eval...', 'parser.racc',
|
14
|
+
module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 159)
|
15
15
|
|
16
16
|
def initialize()
|
17
17
|
@yydebug = true
|
@@ -21,182 +21,198 @@ end
|
|
21
21
|
##### State transition tables begin ###
|
22
22
|
|
23
23
|
racc_action_table = [
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
20,
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
20,
|
42
|
-
nil,
|
43
|
-
|
44
|
-
20,
|
45
|
-
|
46
|
-
nil, nil, 11, nil,
|
47
|
-
|
48
|
-
21,
|
49
|
-
|
50
|
-
|
24
|
+
21, 77, 19, 20, 79, 22, 29, 31, 14, 16,
|
25
|
+
82, 40, 11, 88, 17, 59, 18, 73, 32, 13,
|
26
|
+
33, 21, 91, 19, 20, 7, 22, 29, 31, 14,
|
27
|
+
16, 96, 39, 11, 39, 17, 7, 18, 99, 32,
|
28
|
+
13, 33, 21, 100, 19, 20, 102, 22, 104, 15,
|
29
|
+
14, 16, 106, 5, 6, 73, 17, 21, 18, 19,
|
30
|
+
20, 13, 22, 107, 15, 14, 16, 7, 8, 7,
|
31
|
+
35, 17, 21, 18, 19, 20, 13, 22, 37, 15,
|
32
|
+
14, 16, 39, 54, 55, 56, 17, 21, 18, 19,
|
33
|
+
20, 13, 22, 57, 15, 14, 16, 58, 62, 11,
|
34
|
+
64, 17, 21, 18, 19, 20, 13, 22, 59, 15,
|
35
|
+
14, 16, 66, 67, 68, 69, 17, 21, 18, 19,
|
36
|
+
20, 13, 22, 70, 15, 14, 16, 71, 72, 11,
|
37
|
+
74, 17, 21, 18, 19, 20, 13, 22, 75, 15,
|
38
|
+
14, 16, 76, nil, 11, nil, 17, nil, 18, nil,
|
39
|
+
85, 13, 21, nil, 19, 20, nil, 22, nil, 15,
|
40
|
+
14, 16, nil, nil, 11, nil, 17, 21, 18, 19,
|
41
|
+
20, 13, 22, nil, 15, 14, 16, nil, nil, nil,
|
42
|
+
nil, 17, 21, 18, 19, 20, 13, 22, nil, 15,
|
43
|
+
14, 16, nil, nil, 11, nil, 17, 21, 18, 19,
|
44
|
+
20, 13, 22, nil, 15, 14, 16, nil, nil, 11,
|
45
|
+
nil, 17, 21, 18, 19, 20, 13, 22, nil, 15,
|
46
|
+
14, 16, nil, nil, 11, nil, 17, 21, 18, 19,
|
47
|
+
20, 13, 22, nil, 15, 14, 16, nil, nil, nil,
|
48
|
+
nil, 17, 21, 18, 19, 20, 13, 22, nil, 15,
|
49
|
+
14, 16, nil, nil, 11, nil, 17, 21, 18, 19,
|
50
|
+
20, 13, 22, nil, 15, 14, 16, nil, nil, 11,
|
51
|
+
nil, 17, 21, 18, 19, 20, 13, 22, nil, 49,
|
52
|
+
14, 16, nil, nil, 11, nil, 17, nil, 18, 53,
|
53
|
+
21, 13, 19, 20, nil, 22, nil, 15, 14, 16,
|
54
|
+
44, nil, 42, 43, 17, nil, 18, 40, nil, nil,
|
55
|
+
45, 44, 7, 42, 43, nil, nil, nil, 40, nil,
|
56
|
+
nil, 45 ]
|
51
57
|
|
52
58
|
racc_action_check = [
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
nil,
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
nil, nil,
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
59
|
+
56, 54, 56, 56, 55, 56, 56, 56, 56, 56,
|
60
|
+
57, 58, 56, 65, 56, 31, 56, 49, 56, 56,
|
61
|
+
56, 7, 68, 7, 7, 73, 7, 7, 7, 7,
|
62
|
+
7, 78, 31, 7, 49, 7, 79, 7, 91, 7,
|
63
|
+
7, 7, 64, 94, 64, 64, 97, 64, 100, 64,
|
64
|
+
64, 64, 101, 0, 0, 104, 64, 66, 64, 66,
|
65
|
+
66, 64, 66, 106, 66, 66, 66, 0, 1, 6,
|
66
|
+
8, 66, 67, 66, 67, 67, 66, 67, 12, 67,
|
67
|
+
67, 67, 15, 21, 24, 27, 67, 32, 67, 32,
|
68
|
+
32, 67, 32, 28, 32, 32, 32, 30, 36, 32,
|
69
|
+
38, 32, 69, 32, 69, 69, 32, 69, 40, 69,
|
70
|
+
69, 69, 42, 43, 44, 45, 69, 5, 69, 5,
|
71
|
+
5, 69, 5, 46, 5, 5, 5, 47, 48, 5,
|
72
|
+
50, 5, 59, 5, 59, 59, 5, 59, 51, 59,
|
73
|
+
59, 59, 52, nil, 59, nil, 59, nil, 59, nil,
|
74
|
+
59, 59, 85, nil, 85, 85, nil, 85, nil, 85,
|
75
|
+
85, 85, nil, nil, 85, nil, 85, 37, 85, 37,
|
76
|
+
37, 85, 37, nil, 37, 37, 37, nil, nil, nil,
|
77
|
+
nil, 37, 11, 37, 11, 11, 37, 11, nil, 11,
|
78
|
+
11, 11, nil, nil, 11, nil, 11, 96, 11, 96,
|
79
|
+
96, 11, 96, nil, 96, 96, 96, nil, nil, 96,
|
80
|
+
nil, 96, 39, 96, 39, 39, 96, 39, nil, 39,
|
81
|
+
39, 39, nil, nil, 39, nil, 39, 99, 39, 99,
|
82
|
+
99, 39, 99, nil, 99, 99, 99, nil, nil, nil,
|
83
|
+
nil, 99, 33, 99, 33, 33, 99, 33, nil, 33,
|
84
|
+
33, 33, nil, nil, 33, nil, 33, 74, 33, 74,
|
85
|
+
74, 33, 74, nil, 74, 74, 74, nil, nil, 74,
|
86
|
+
nil, 74, 18, 74, 18, 18, 74, 18, nil, 18,
|
87
|
+
18, 18, nil, nil, 18, nil, 18, nil, 18, 18,
|
88
|
+
13, 18, 13, 13, nil, 13, nil, 13, 13, 13,
|
89
|
+
17, nil, 17, 17, 13, nil, 13, 17, nil, nil,
|
90
|
+
17, 70, 17, 70, 70, nil, nil, nil, 70, nil,
|
91
|
+
nil, 70 ]
|
80
92
|
|
81
93
|
racc_action_pointer = [
|
82
|
-
|
83
|
-
nil,
|
84
|
-
|
85
|
-
4,
|
86
|
-
|
87
|
-
|
88
|
-
nil, nil,
|
89
|
-
|
90
|
-
nil, nil,
|
91
|
-
|
92
|
-
|
94
|
+
48, 68, nil, nil, nil, 110, 50, 14, 70, nil,
|
95
|
+
nil, 175, 74, 283, nil, 54, nil, 293, 265, nil,
|
96
|
+
nil, 69, nil, nil, 64, nil, nil, 83, 79, nil,
|
97
|
+
95, 4, 80, 235, nil, nil, 78, 160, 96, 205,
|
98
|
+
97, nil, 104, 105, 100, 107, 121, 105, 106, 6,
|
99
|
+
128, 114, 118, nil, -21, -17, -7, -8, -3, 125,
|
100
|
+
nil, nil, nil, nil, 35, -16, 50, 65, 0, 95,
|
101
|
+
304, nil, nil, 6, 250, nil, nil, nil, 28, 17,
|
102
|
+
nil, nil, nil, nil, nil, 145, nil, nil, nil, nil,
|
103
|
+
nil, 30, nil, nil, 41, nil, 190, 24, nil, 220,
|
104
|
+
34, 38, nil, nil, 44, nil, 45, nil ]
|
93
105
|
|
94
106
|
racc_action_default = [
|
95
|
-
-
|
96
|
-
-31, -
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
104
|
-
|
105
|
-
-
|
107
|
+
-60, -60, -1, -2, -3, -60, -60, -11, -60, -4,
|
108
|
+
-31, -60, -43, -60, -47, -48, -49, -35, -60, -56,
|
109
|
+
-57, -60, -59, -5, -60, -12, -13, -14, -17, -20,
|
110
|
+
-21, -48, -60, -60, -26, 108, -60, -60, -45, -60,
|
111
|
+
-60, -36, -60, -60, -60, -60, -41, -60, -60, -48,
|
112
|
+
-33, -60, -60, -54, -60, -29, -60, -19, -60, -60,
|
113
|
+
-24, -25, -32, -44, -60, -60, -60, -60, -60, -60,
|
114
|
+
-35, -51, -55, -60, -60, -52, -53, -58, -60, -60,
|
115
|
+
-15, -16, -18, -22, -23, -60, -28, -46, -50, -37,
|
116
|
+
-38, -60, -40, -42, -9, -34, -60, -60, -27, -60,
|
117
|
+
-60, -6, -30, -39, -60, -10, -7, -8 ]
|
106
118
|
|
107
119
|
racc_goto_table = [
|
108
|
-
9,
|
109
|
-
|
110
|
-
nil, nil, nil, nil, nil,
|
111
|
-
nil,
|
112
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
113
|
-
nil, nil,
|
114
|
-
|
115
|
-
nil, nil, nil,
|
116
|
-
|
120
|
+
9, 52, 34, 2, 63, 51, 36, 41, 26, 23,
|
121
|
+
48, 38, 3, 25, 4, 24, 78, 84, 1, nil,
|
122
|
+
47, nil, nil, nil, nil, nil, 65, 60, 61, nil,
|
123
|
+
nil, 87, nil, 89, 90, nil, 92, nil, nil, nil,
|
124
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
125
|
+
nil, 34, nil, nil, 86, nil, nil, 81, nil, 83,
|
126
|
+
41, 95, 80, 93, nil, nil, 103, nil, nil, nil,
|
127
|
+
nil, nil, nil, nil, nil, nil, 94, nil, nil, nil,
|
128
|
+
98, nil, 97, 105, nil, nil, nil, nil, nil, nil,
|
129
|
+
nil, 101 ]
|
117
130
|
|
118
131
|
racc_goto_check = [
|
119
|
-
5, 8, 5, 2, 15, 16, 5,
|
120
|
-
|
121
|
-
nil, nil, nil, nil, nil, 16, 5, 5, nil,
|
122
|
-
nil, 15,
|
123
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
124
|
-
nil, nil, 5, nil, nil, 10, nil, 10,
|
125
|
-
|
126
|
-
nil, nil, nil,
|
127
|
-
8, nil, nil, nil, nil, nil, nil,
|
132
|
+
5, 8, 5, 2, 15, 16, 5, 13, 10, 2,
|
133
|
+
18, 19, 3, 9, 4, 6, 7, 14, 1, nil,
|
134
|
+
2, nil, nil, nil, nil, nil, 16, 5, 5, nil,
|
135
|
+
nil, 15, nil, 15, 15, nil, 15, nil, nil, nil,
|
136
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
137
|
+
nil, 5, nil, nil, 5, nil, nil, 10, nil, 10,
|
138
|
+
13, 16, 9, 18, nil, nil, 15, nil, nil, nil,
|
139
|
+
nil, nil, nil, nil, nil, nil, 2, nil, nil, nil,
|
140
|
+
5, nil, 2, 8, nil, nil, nil, nil, nil, nil,
|
141
|
+
nil, 5 ]
|
128
142
|
|
129
143
|
racc_goto_pointer = [
|
130
|
-
nil,
|
131
|
-
1, nil, nil,
|
144
|
+
nil, 18, 3, 12, 14, -5, 8, -39, -17, 6,
|
145
|
+
1, nil, nil, -10, -42, -33, -13, nil, -7, -2 ]
|
132
146
|
|
133
147
|
racc_goto_default = [
|
134
|
-
nil, nil, nil, nil, nil,
|
135
|
-
nil,
|
148
|
+
nil, nil, nil, nil, nil, 50, nil, nil, nil, nil,
|
149
|
+
nil, 27, 28, 30, nil, 10, nil, 46, nil, 12 ]
|
136
150
|
|
137
151
|
racc_reduce_table = [
|
138
152
|
0, 0, :racc_error,
|
139
|
-
1,
|
140
|
-
1,
|
141
|
-
1,
|
142
|
-
2,
|
143
|
-
2,
|
144
|
-
6,
|
145
|
-
7,
|
146
|
-
8,
|
147
|
-
3,
|
148
|
-
5,
|
149
|
-
0,
|
150
|
-
1,
|
151
|
-
1,
|
152
|
-
1,
|
153
|
-
3,
|
154
|
-
3,
|
155
|
-
1,
|
156
|
-
3,
|
157
|
-
2,
|
158
|
-
1,
|
159
|
-
1,
|
160
|
-
3,
|
161
|
-
3,
|
162
|
-
2,
|
163
|
-
2,
|
164
|
-
1,
|
165
|
-
2,
|
166
|
-
1,
|
167
|
-
0,
|
168
|
-
3,
|
169
|
-
1,
|
170
|
-
3,
|
171
|
-
1,
|
172
|
-
3,
|
173
|
-
0,
|
174
|
-
1,
|
175
|
-
3,
|
176
|
-
3,
|
177
|
-
5,
|
178
|
-
3,
|
179
|
-
1,
|
180
|
-
3,
|
181
|
-
1,
|
182
|
-
3,
|
183
|
-
|
184
|
-
|
185
|
-
1,
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
3,
|
190
|
-
|
191
|
-
3,
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
1,
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
153
|
+
1, 32, :_reduce_1,
|
154
|
+
1, 32, :_reduce_2,
|
155
|
+
1, 32, :_reduce_3,
|
156
|
+
2, 34, :_reduce_4,
|
157
|
+
2, 35, :_reduce_5,
|
158
|
+
6, 33, :_reduce_6,
|
159
|
+
7, 33, :_reduce_7,
|
160
|
+
8, 33, :_reduce_8,
|
161
|
+
3, 39, :_reduce_9,
|
162
|
+
5, 39, :_reduce_10,
|
163
|
+
0, 37, :_reduce_11,
|
164
|
+
1, 37, :_reduce_12,
|
165
|
+
1, 37, :_reduce_13,
|
166
|
+
1, 40, :_reduce_14,
|
167
|
+
3, 40, :_reduce_15,
|
168
|
+
3, 40, :_reduce_16,
|
169
|
+
1, 42, :_reduce_17,
|
170
|
+
3, 42, :_reduce_18,
|
171
|
+
2, 42, :_reduce_19,
|
172
|
+
1, 42, :_reduce_20,
|
173
|
+
1, 41, :_reduce_21,
|
174
|
+
3, 41, :_reduce_22,
|
175
|
+
3, 44, :_reduce_23,
|
176
|
+
2, 43, :_reduce_24,
|
177
|
+
2, 43, :_reduce_25,
|
178
|
+
1, 43, :_reduce_26,
|
179
|
+
2, 45, :_reduce_27,
|
180
|
+
1, 45, :_reduce_28,
|
181
|
+
0, 38, :_reduce_29,
|
182
|
+
3, 38, :_reduce_30,
|
183
|
+
1, 36, :_reduce_31,
|
184
|
+
3, 36, :_reduce_32,
|
185
|
+
1, 47, :_reduce_33,
|
186
|
+
3, 47, :_reduce_34,
|
187
|
+
0, 48, :_reduce_none,
|
188
|
+
1, 48, :_reduce_36,
|
189
|
+
3, 48, :_reduce_37,
|
190
|
+
3, 48, :_reduce_38,
|
191
|
+
5, 48, :_reduce_39,
|
192
|
+
3, 48, :_reduce_40,
|
193
|
+
1, 49, :_reduce_41,
|
194
|
+
3, 49, :_reduce_42,
|
195
|
+
1, 46, :_reduce_43,
|
196
|
+
3, 46, :_reduce_44,
|
197
|
+
2, 46, :_reduce_45,
|
198
|
+
4, 46, :_reduce_46,
|
199
|
+
1, 50, :_reduce_47,
|
200
|
+
1, 50, :_reduce_48,
|
201
|
+
1, 50, :_reduce_49,
|
202
|
+
4, 50, :_reduce_50,
|
203
|
+
3, 50, :_reduce_51,
|
204
|
+
3, 50, :_reduce_52,
|
205
|
+
3, 50, :_reduce_53,
|
206
|
+
2, 50, :_reduce_54,
|
207
|
+
3, 50, :_reduce_55,
|
208
|
+
1, 50, :_reduce_56,
|
209
|
+
1, 50, :_reduce_57,
|
210
|
+
3, 50, :_reduce_58,
|
211
|
+
1, 50, :_reduce_59 ]
|
212
|
+
|
213
|
+
racc_reduce_n = 60
|
214
|
+
|
215
|
+
racc_shift_n = 108
|
200
216
|
|
201
217
|
racc_token_table = {
|
202
218
|
false => 0,
|
@@ -225,12 +241,13 @@ racc_token_table = {
|
|
225
241
|
:LBRACKET => 23,
|
226
242
|
:RBRACKET => 24,
|
227
243
|
:QUERY => 25,
|
228
|
-
:
|
229
|
-
:
|
230
|
-
:
|
231
|
-
:
|
244
|
+
:BANG => 26,
|
245
|
+
:STAR => 27,
|
246
|
+
:LESS => 28,
|
247
|
+
:GREATER => 29,
|
248
|
+
:EOF => 30 }
|
232
249
|
|
233
|
-
racc_nt_base =
|
250
|
+
racc_nt_base = 31
|
234
251
|
|
235
252
|
racc_use_result_var = true
|
236
253
|
|
@@ -277,6 +294,7 @@ Racc_token_to_s_table = [
|
|
277
294
|
"LBRACKET",
|
278
295
|
"RBRACKET",
|
279
296
|
"QUERY",
|
297
|
+
"BANG",
|
280
298
|
"STAR",
|
281
299
|
"LESS",
|
282
300
|
"GREATER",
|
@@ -618,15 +636,29 @@ module_eval(<<'.,.,', 'parser.racc', 101)
|
|
618
636
|
end
|
619
637
|
.,.,
|
620
638
|
|
621
|
-
module_eval(<<'.,.,', 'parser.racc',
|
639
|
+
module_eval(<<'.,.,', 'parser.racc', 102)
|
622
640
|
def _reduce_45(val, _values, result)
|
623
|
-
result = RDL::Type::
|
641
|
+
result = RDL::Type::NonNullType.new val[1]
|
624
642
|
result
|
625
643
|
end
|
626
644
|
.,.,
|
627
645
|
|
628
|
-
module_eval(<<'.,.,', 'parser.racc',
|
646
|
+
module_eval(<<'.,.,', 'parser.racc', 103)
|
629
647
|
def _reduce_46(val, _values, result)
|
648
|
+
result = RDL::Type::UnionType.new(RDL::Type::NonNullType.new(val[1]), val[3])
|
649
|
+
result
|
650
|
+
end
|
651
|
+
.,.,
|
652
|
+
|
653
|
+
module_eval(<<'.,.,', 'parser.racc', 106)
|
654
|
+
def _reduce_47(val, _values, result)
|
655
|
+
result = RDL::Type::SingletonType.new(val[0].to_sym)
|
656
|
+
result
|
657
|
+
end
|
658
|
+
.,.,
|
659
|
+
|
660
|
+
module_eval(<<'.,.,', 'parser.racc', 108)
|
661
|
+
def _reduce_48(val, _values, result)
|
630
662
|
if val[0] == 'nil' then
|
631
663
|
result = $__rdl_nil_type
|
632
664
|
elsif val[0] == 'true' then
|
@@ -643,8 +675,8 @@ module_eval(<<'.,.,', 'parser.racc', 106)
|
|
643
675
|
end
|
644
676
|
.,.,
|
645
677
|
|
646
|
-
module_eval(<<'.,.,', 'parser.racc',
|
647
|
-
def
|
678
|
+
module_eval(<<'.,.,', 'parser.racc', 121)
|
679
|
+
def _reduce_49(val, _values, result)
|
648
680
|
if $__rdl_special_types.has_key? val[0] then
|
649
681
|
result = $__rdl_special_types[val[0]]
|
650
682
|
else
|
@@ -655,8 +687,8 @@ module_eval(<<'.,.,', 'parser.racc', 119)
|
|
655
687
|
end
|
656
688
|
.,.,
|
657
689
|
|
658
|
-
module_eval(<<'.,.,', 'parser.racc',
|
659
|
-
def
|
690
|
+
module_eval(<<'.,.,', 'parser.racc', 128)
|
691
|
+
def _reduce_50(val, _values, result)
|
660
692
|
n = RDL::Type::NominalType.new(val[0])
|
661
693
|
result = RDL::Type::GenericType.new(n, *val[2])
|
662
694
|
|
@@ -664,69 +696,69 @@ module_eval(<<'.,.,', 'parser.racc', 126)
|
|
664
696
|
end
|
665
697
|
.,.,
|
666
698
|
|
667
|
-
module_eval(<<'.,.,', 'parser.racc',
|
668
|
-
def
|
699
|
+
module_eval(<<'.,.,', 'parser.racc', 131)
|
700
|
+
def _reduce_51(val, _values, result)
|
669
701
|
result = val[1]
|
670
702
|
result
|
671
703
|
end
|
672
704
|
.,.,
|
673
705
|
|
674
|
-
module_eval(<<'.,.,', 'parser.racc',
|
675
|
-
def
|
706
|
+
module_eval(<<'.,.,', 'parser.racc', 133)
|
707
|
+
def _reduce_52(val, _values, result)
|
676
708
|
result = RDL::Type::TupleType.new(*val[1])
|
677
709
|
|
678
710
|
result
|
679
711
|
end
|
680
712
|
.,.,
|
681
713
|
|
682
|
-
module_eval(<<'.,.,', 'parser.racc',
|
683
|
-
def
|
714
|
+
module_eval(<<'.,.,', 'parser.racc', 136)
|
715
|
+
def _reduce_53(val, _values, result)
|
684
716
|
result = RDL::Type::StructuralType.new(Hash[*val[1]])
|
685
717
|
|
686
718
|
result
|
687
719
|
end
|
688
720
|
.,.,
|
689
721
|
|
690
|
-
module_eval(<<'.,.,', 'parser.racc',
|
691
|
-
def
|
722
|
+
module_eval(<<'.,.,', 'parser.racc', 139)
|
723
|
+
def _reduce_54(val, _values, result)
|
692
724
|
result = RDL::Type::TupleType.new
|
693
725
|
|
694
726
|
result
|
695
727
|
end
|
696
728
|
.,.,
|
697
729
|
|
698
|
-
module_eval(<<'.,.,', 'parser.racc',
|
699
|
-
def
|
730
|
+
module_eval(<<'.,.,', 'parser.racc', 142)
|
731
|
+
def _reduce_55(val, _values, result)
|
700
732
|
result = RDL::Type::FiniteHashType.new(Hash[*val[1]])
|
701
733
|
|
702
734
|
result
|
703
735
|
end
|
704
736
|
.,.,
|
705
737
|
|
706
|
-
module_eval(<<'.,.,', 'parser.racc',
|
707
|
-
def
|
738
|
+
module_eval(<<'.,.,', 'parser.racc', 144)
|
739
|
+
def _reduce_56(val, _values, result)
|
708
740
|
result = RDL::Type::SingletonType.new(val[0].to_i)
|
709
741
|
result
|
710
742
|
end
|
711
743
|
.,.,
|
712
744
|
|
713
|
-
module_eval(<<'.,.,', 'parser.racc',
|
714
|
-
def
|
745
|
+
module_eval(<<'.,.,', 'parser.racc', 145)
|
746
|
+
def _reduce_57(val, _values, result)
|
715
747
|
result = RDL::Type::SingletonType.new(val[0].to_f)
|
716
748
|
result
|
717
749
|
end
|
718
750
|
.,.,
|
719
751
|
|
720
|
-
module_eval(<<'.,.,', 'parser.racc',
|
721
|
-
def
|
752
|
+
module_eval(<<'.,.,', 'parser.racc', 147)
|
753
|
+
def _reduce_58(val, _values, result)
|
722
754
|
result = RDL::Type::SingletonType.new(Kernel.const_get(val[1]))
|
723
755
|
|
724
756
|
result
|
725
757
|
end
|
726
758
|
.,.,
|
727
759
|
|
728
|
-
module_eval(<<'.,.,', 'parser.racc',
|
729
|
-
def
|
760
|
+
module_eval(<<'.,.,', 'parser.racc', 151)
|
761
|
+
def _reduce_59(val, _values, result)
|
730
762
|
result = RDL::Type::WildQuery.new
|
731
763
|
result
|
732
764
|
end
|