graphql 2.1.11 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2031 +1,731 @@
1
- #
2
- # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.6.2
4
- # from Racc grammar file "".
5
- #
6
-
7
- require 'racc/parser.rb'
8
-
1
+ # frozen_string_literal: true
9
2
 
3
+ require "strscan"
4
+ require "graphql/language/nodes"
10
5
 
11
6
  module GraphQL
12
7
  module Language
13
- class Parser < Racc::Parser
14
-
15
- module_eval(<<'...end parser.y/module_eval...', 'parser.y', 453)
16
-
17
- EMPTY_ARRAY = [].freeze
18
-
19
- def initialize(query_string, filename:, trace: Tracing::NullTrace)
20
- raise GraphQL::ParseError.new("No query string was present", nil, nil, query_string) if query_string.nil?
21
- @query_string = query_string
22
- @filename = filename
23
- @trace = trace
24
- @reused_next_token = [nil, nil]
25
- end
26
-
27
- def parse_document
28
- @document ||= begin
29
- # Break the string into tokens
30
- @trace.lex(query_string: @query_string) do
31
- @tokens ||= GraphQL::Language::Lexer.tokenize(@query_string)
32
- end
33
- # From the tokens, build an AST
34
- @trace.parse(query_string: @query_string) do
35
- if @tokens.empty?
36
- raise GraphQL::ParseError.new("Unexpected end of document", nil, nil, @query_string)
37
- else
38
- do_parse
8
+ class Parser
9
+ include GraphQL::Language::Nodes
10
+ include EmptyObjects
11
+
12
+ class << self
13
+ attr_accessor :cache
14
+
15
+ def parse(graphql_str, filename: nil, trace: Tracing::NullTrace)
16
+ self.new(graphql_str, filename: filename, trace: trace).parse
17
+ end
18
+
19
+ def parse_file(filename, trace: Tracing::NullTrace)
20
+ if cache
21
+ cache.fetch(filename) do
22
+ parse(File.read(filename), filename: filename, trace: trace)
23
+ end
24
+ else
25
+ parse(File.read(filename), filename: filename, trace: trace)
26
+ end
27
+ end
39
28
  end
40
- end
41
- end
42
- end
43
-
44
- class << self
45
- attr_accessor :cache
46
29
 
47
- def parse(query_string, filename: nil, trace: GraphQL::Tracing::NullTrace)
48
- new(query_string, filename: filename, trace: trace).parse_document
49
- end
50
-
51
- def parse_file(filename, trace: GraphQL::Tracing::NullTrace)
52
- if cache
53
- cache.fetch(filename) do
54
- parse(File.read(filename), filename: filename, trace: trace)
30
+ def initialize(graphql_str, filename: nil, trace: Tracing::NullTrace)
31
+ if graphql_str.nil?
32
+ raise GraphQL::ParseError.new("No query string was present", nil, nil, nil)
33
+ end
34
+ @lexer = Lexer.new(graphql_str, filename: filename)
35
+ @graphql_str = graphql_str
36
+ @filename = filename
37
+ @trace = trace
55
38
  end
56
- else
57
- parse(File.read(filename), filename: filename, trace: trace)
58
- end
59
- end
60
- end
61
-
62
- private
63
-
64
- def next_token
65
- lexer_token = @tokens.shift
66
- if lexer_token.nil?
67
- nil
68
- else
69
- @reused_next_token[0] = lexer_token[0]
70
- @reused_next_token[1] = lexer_token
71
- @reused_next_token
72
- end
73
- end
74
-
75
- def get_description(token)
76
- comments = []
77
-
78
- loop do
79
- prev_token = token
80
- token = token[4]
81
-
82
- break if token.nil?
83
- break if token[0] != :COMMENT
84
- break if prev_token[1] != token[1] + 1
85
39
 
86
- comments.unshift(token[3].sub(/^#\s*/, ""))
87
- end
88
-
89
- return nil if comments.empty?
90
-
91
- comments.join("\n")
92
- end
93
-
94
- def on_error(parser_token_id, lexer_token, vstack)
95
- if lexer_token == "$" || lexer_token == nil
96
- raise GraphQL::ParseError.new("Unexpected end of document", nil, nil, @query_string, filename: @filename)
97
- else
98
- parser_token_name = token_to_str(parser_token_id)
99
- if parser_token_name.nil?
100
- raise GraphQL::ParseError.new("Parse Error on unknown token: {token_id: #{parser_token_id}, lexer_token: #{lexer_token}} from #{@query_string}", nil, nil, @query_string, filename: @filename)
101
- else
102
- line = lexer_token[1]
103
- col = lexer_token[2]
104
- if lexer_token[0] == :BAD_UNICODE_ESCAPE
105
- raise GraphQL::ParseError.new("Parse error on bad Unicode escape sequence: #{lexer_token[3].inspect} (#{parser_token_name}) at [#{line}, #{col}]", line, col, @query_string, filename: @filename)
106
- else
107
- raise GraphQL::ParseError.new("Parse error on #{lexer_token[3].inspect} (#{parser_token_name}) at [#{line}, #{col}]", line, col, @query_string, filename: @filename)
40
+ def parse
41
+ @document ||= begin
42
+ @trace.parse(query_string: @graphql_str) do
43
+ document
44
+ end
45
+ rescue SystemStackError
46
+ raise GraphQL::ParseError.new("This query is too large to execute.", nil, nil, @query_str, filename: @filename)
47
+ end
108
48
  end
109
- end
110
- end
111
- end
112
-
113
- def make_node(node_name, assigns)
114
- assigns.each do |key, value|
115
- if key != :position_source && value.is_a?(Array) && value[0].is_a?(Symbol)
116
- assigns[key] = value[3]
117
- end
118
- end
119
-
120
- assigns[:filename] = @filename
121
-
122
- GraphQL::Language::Nodes.const_get(node_name).new(assigns)
123
- end
124
- ...end parser.y/module_eval...
125
- ##### State transition tables begin ###
126
-
127
- racc_action_table = [
128
- -2, 38, 11, -102, 12, 13, 14, 11, 182, 12,
129
- 13, 14, 283, -102, -102, 73, 19, -173, 271, 277,
130
- 278, 19, 281, 75, 76, 77, 15, 78, 79, 80,
131
- 81, 15, 89, 35, 91, 73, 28, 35, 35, 100,
132
- -157, 28, 12, 13, 14, 73, 73, 35, 35, 35,
133
- 35, 73, 35, 43, 44, 45, 46, 47, 48, 49,
134
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 62,
135
- 12, 13, 14, 282, 96, 185, 104, 95, 12, 13,
136
- 14, 43, 44, 45, 46, 47, 48, 49, 50, 51,
137
- 52, 53, 54, 55, 56, 57, 58, 92, 12, 13,
138
- 14, 68, 73, 35, 177, 12, 13, 14, 119, 43,
139
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
140
- 54, 55, 56, 57, 58, 229, 12, 13, 14, 68,
141
- 232, 12, 13, 14, 163, 123, -102, 43, 44, 45,
142
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
143
- 56, 57, 58, 12, 13, 14, 73, 68, 12, 13,
144
- 14, 73, 123, 73, 43, 44, 45, 46, 47, 48,
145
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
146
- 73, 134, 96, 225, 68, 12, 13, 14, 141, 73,
147
- 223, 145, 145, 224, 73, 73, 206, 44, 45, 46,
148
- 47, 48, 49, 50, 51, 52, 203, 204, 205, 213,
149
- 214, 222, 210, 211, 212, 225, 73, 12, 13, 14,
150
- 73, 145, 223, 145, 73, 224, 261, 73, 206, 44,
151
- 45, 46, 47, 48, 49, 50, 51, 52, 203, 204,
152
- 205, 213, 214, 222, 210, 211, 212, 225, 73, 12,
153
- 13, 14, 134, 134, 223, 96, 171, 224, 287, 172,
154
- 206, 44, 45, 46, 47, 48, 49, 50, 51, 52,
155
- 203, 204, 205, 213, 214, 222, 210, 211, 212, 303,
156
- 73, 12, 13, 14, 73, 179, 73, 73, 73, 224,
157
- -157, 191, 206, 44, 45, 46, 47, 48, 49, 50,
158
- 51, 52, 203, 204, 205, 213, 214, 222, 210, 211,
159
- 212, 225, 192, 12, 13, 14, 193, 73, 223, 73,
160
- 196, 224, 197, 198, 206, 44, 45, 46, 47, 48,
161
- 49, 50, 51, 52, 203, 204, 205, 213, 214, 222,
162
- 210, 211, 212, 225, 199, 12, 13, 14, 201, 73,
163
- 223, 227, 134, 224, 134, 73, 206, 44, 45, 46,
164
- 47, 48, 49, 50, 51, 52, 203, 204, 205, 213,
165
- 214, 222, 210, 211, 212, 303, 182, 12, 13, 14,
166
- 239, 73, 182, 35, 35, 224, 182, 182, 206, 44,
167
- 45, 46, 47, 48, 49, 50, 51, 52, 203, 204,
168
- 205, 213, 214, 222, 210, 211, 212, 12, 13, 14,
169
- 82, 83, 35, 84, 85, 86, 87, 88, 98, 44,
170
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
171
- 55, 56, 57, 58, 35, 35, 257, 73, 264, 12,
172
- 13, 14, 134, 239, 274, 274, 284, 286, 292, 199,
173
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
174
- 53, 54, 55, 56, 57, 58, 289, 12, 13, 14,
175
- 73, 299, 304, 307, 308, 310, 286, 73, 43, 44,
176
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
177
- 55, 56, 57, 58, 293, 12, 13, 14, 73, nil,
178
- nil, nil, nil, nil, nil, nil, 43, 44, 45, 46,
179
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
180
- 57, 58, 311, 12, 13, 14, nil, nil, nil, nil,
181
- nil, nil, nil, nil, 43, 44, 45, 46, 47, 48,
182
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
183
- 12, 13, 14, nil, nil, nil, nil, nil, nil, nil,
184
- nil, 43, 44, 45, 46, 47, 48, 49, 50, 51,
185
- 52, 53, 54, 55, 56, 57, 58, 12, 13, 14,
186
- nil, nil, nil, nil, nil, nil, nil, nil, nil, 44,
187
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
188
- 55, 56, 57, 58, 12, 13, 14, nil, nil, nil,
189
- nil, nil, nil, nil, nil, 43, 44, 45, 46, 47,
190
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
191
- 58, 12, 13, 14, nil, nil, nil, nil, nil, nil,
192
- nil, nil, 43, 44, 45, 46, 47, 48, 49, 50,
193
- 51, 52, 53, 54, 55, 56, 57, 58, 12, 13,
194
- 14, nil, nil, nil, nil, nil, nil, nil, nil, 43,
195
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
196
- 54, 55, 56, 57, 58, 12, 13, 14, nil, nil,
197
- nil, nil, nil, nil, nil, nil, 43, 44, 45, 46,
198
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
199
- 57, 58, 12, 13, 14, nil, nil, nil, nil, nil,
200
- nil, nil, nil, 43, 44, 45, 46, 47, 48, 49,
201
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 12,
202
- 13, 14, nil, nil, nil, nil, nil, nil, nil, nil,
203
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
204
- 53, 54, 55, 56, 57, 58, 12, 13, 14, nil,
205
- nil, nil, nil, nil, nil, nil, nil, 43, 44, 45,
206
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
207
- 56, 57, 58, 12, 13, 14, nil, nil, nil, nil,
208
- nil, nil, nil, nil, 43, 44, 45, 46, 47, 48,
209
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
210
- 12, 13, 14, nil, nil, nil, nil, nil, nil, nil,
211
- nil, 43, 44, 45, 46, 47, 48, 49, 50, 51,
212
- 52, 53, 54, 55, 56, 57, 58, 12, 13, 14,
213
- nil, nil, nil, nil, nil, nil, nil, nil, 43, 44,
214
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
215
- 55, 56, 57, 58, 12, 13, 14, nil, nil, nil,
216
- nil, nil, nil, nil, nil, 43, 44, 45, 46, 47,
217
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
218
- 58, 12, 13, 14, nil, nil, nil, nil, nil, nil,
219
- nil, nil, 43, 44, 45, 46, 47, 48, 49, 50,
220
- 51, 52, 53, 54, 55, 56, 57, 58, 12, 13,
221
- 14, nil, nil, nil, nil, nil, nil, nil, nil, 43,
222
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
223
- 54, 55, 56, 57, 58, 12, 13, 14, nil, nil,
224
- nil, nil, nil, nil, nil, nil, 43, 44, 45, 46,
225
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
226
- 57, 58, 12, 13, 14, nil, nil, nil, nil, nil,
227
- nil, nil, nil, 43, 44, 45, 46, 47, 48, 49,
228
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 12,
229
- 13, 14, nil, nil, nil, nil, nil, 132, nil, nil,
230
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
231
- 53, 54, 55, 56, 57, 58, 12, 13, 14, nil,
232
- nil, nil, nil, nil, 132, nil, nil, 43, 44, 45,
233
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
234
- 56, 57, 58, 12, 13, 14, nil, nil, nil, nil,
235
- nil, nil, nil, nil, 43, 44, 45, 46, 47, 48,
236
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
237
- 12, 13, 14, nil, nil, nil, nil, nil, nil, nil,
238
- nil, 43, 44, 45, 46, 47, 48, 49, 50, 51,
239
- 52, 53, 54, 55, 56, 57, 58, 12, 13, 14,
240
- nil, 169, nil, nil, nil, nil, nil, nil, 43, 44,
241
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
242
- 55, 56, 57, 58, 12, 13, 14, nil, nil, nil,
243
- nil, nil, 132, nil, nil, 43, 44, 45, 46, 47,
244
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
245
- 58, 12, 13, 14, nil, nil, nil, nil, nil, nil,
246
- nil, nil, 43, 44, 45, 46, 47, 48, 49, 50,
247
- 51, 52, 53, 54, 55, 56, 57, 58, 12, 13,
248
- 14, nil, nil, nil, nil, nil, nil, nil, nil, 43,
249
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
250
- 54, 55, 56, 57, 58, 12, 13, 14, nil, nil,
251
- nil, nil, nil, nil, nil, nil, 43, 44, 45, 46,
252
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
253
- 57, 58, 12, 13, 14, nil, nil, nil, nil, nil,
254
- nil, nil, nil, 43, 44, 45, 46, 47, 48, 49,
255
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 12,
256
- 13, 14, nil, nil, nil, nil, nil, nil, nil, nil,
257
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
258
- 53, 54, 55, 56, 57, 58, 12, 13, 14, nil,
259
- nil, nil, nil, nil, 132, nil, nil, 43, 44, 45,
260
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
261
- 56, 57, 58, 12, 13, 14, nil, nil, nil, nil,
262
- nil, nil, nil, nil, 43, 44, 45, 46, 47, 48,
263
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
264
- 12, 13, 14, nil, nil, nil, nil, nil, nil, nil,
265
- nil, 43, 44, 45, 46, 47, 48, 49, 50, 51,
266
- 52, 53, 54, 55, 56, 57, 58, 12, 13, 14,
267
- nil, nil, nil, nil, nil, nil, nil, nil, 43, 44,
268
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
269
- 55, 56, 57, 58, 12, 13, 14, nil, nil, nil,
270
- nil, nil, nil, nil, nil, 43, 44, 45, 46, 47,
271
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
272
- 58, 12, 13, 14, nil, nil, nil, nil, nil, nil,
273
- nil, nil, 43, 44, 45, 46, 47, 48, 49, 50,
274
- 51, 52, 53, 54, 55, 56, 57, 58, 12, 13,
275
- 14, nil, nil, nil, nil, nil, nil, nil, nil, 43,
276
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
277
- 54, 55, 56, 57, 58, 12, 13, 14, nil, nil,
278
- nil, nil, nil, 132, nil, nil, 43, 44, 45, 46,
279
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
280
- 57, 58, 12, 13, 14, nil, nil, nil, nil, nil,
281
- 132, nil, nil, 43, 44, 45, 46, 47, 48, 49,
282
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 12,
283
- 13, 14, nil, nil, nil, nil, nil, nil, nil, nil,
284
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
285
- 53, 54, 55, 56, 57, 58, 12, 13, 14, nil,
286
- nil, nil, nil, nil, nil, nil, nil, 206, 44, 45,
287
- 46, 47, 48, 49, 50, 51, 52, 203, 204, 205,
288
- -163, nil, nil, nil, -163, nil, nil, nil, nil, nil,
289
- -163, nil, -163, -163, -163, -163 ]
290
-
291
- racc_action_check = [
292
- 3, 1, 3, 105, 3, 3, 3, 0, 143, 0,
293
- 0, 0, 255, 150, 152, 19, 3, 182, 234, 246,
294
- 247, 0, 253, 28, 28, 28, 3, 28, 28, 28,
295
- 28, 0, 38, 3, 40, 105, 3, 255, 0, 69,
296
- 143, 0, 145, 145, 145, 150, 152, 182, 234, 246,
297
- 247, 71, 253, 145, 145, 145, 145, 145, 145, 145,
298
- 145, 145, 145, 145, 145, 145, 145, 145, 145, 11,
299
- 11, 11, 11, 254, 67, 145, 74, 67, 104, 104,
300
- 104, 11, 11, 11, 11, 11, 11, 11, 11, 11,
301
- 11, 11, 11, 11, 11, 11, 11, 61, 61, 61,
302
- 61, 11, 75, 254, 138, 138, 138, 138, 88, 61,
303
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
304
- 61, 61, 61, 61, 61, 175, 175, 175, 175, 61,
305
- 180, 180, 180, 180, 121, 121, 148, 175, 175, 175,
306
- 175, 175, 175, 175, 175, 175, 175, 175, 175, 175,
307
- 175, 175, 175, 134, 134, 134, 148, 175, 141, 141,
308
- 141, 90, 91, 94, 134, 134, 134, 134, 134, 134,
309
- 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
310
- 97, 99, 102, 171, 134, 171, 171, 171, 106, 107,
311
- 171, 108, 109, 171, 110, 111, 171, 171, 171, 171,
312
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
313
- 171, 171, 171, 171, 171, 224, 112, 224, 224, 224,
314
- 113, 114, 224, 115, 116, 224, 224, 117, 224, 224,
315
- 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
316
- 224, 224, 224, 224, 224, 224, 224, 262, 118, 262,
317
- 262, 262, 120, 124, 262, 125, 128, 262, 262, 130,
318
- 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
319
- 262, 262, 262, 262, 262, 262, 262, 262, 262, 286,
320
- 133, 286, 286, 286, 136, 140, 142, 144, 146, 286,
321
- 147, 149, 286, 286, 286, 286, 286, 286, 286, 286,
322
- 286, 286, 286, 286, 286, 286, 286, 286, 286, 286,
323
- 286, 292, 151, 292, 292, 292, 153, 155, 292, 157,
324
- 158, 292, 159, 160, 292, 292, 292, 292, 292, 292,
325
- 292, 292, 292, 292, 292, 292, 292, 292, 292, 292,
326
- 292, 292, 292, 304, 161, 304, 304, 304, 165, 168,
327
- 304, 173, 174, 304, 176, 183, 304, 304, 304, 304,
328
- 304, 304, 304, 304, 304, 304, 304, 304, 304, 304,
329
- 304, 304, 304, 304, 304, 307, 184, 307, 307, 307,
330
- 186, 189, 190, 192, 193, 307, 194, 195, 307, 307,
331
- 307, 307, 307, 307, 307, 307, 307, 307, 307, 307,
332
- 307, 307, 307, 307, 307, 307, 307, 68, 68, 68,
333
- 37, 37, 197, 37, 37, 37, 37, 37, 68, 68,
334
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
335
- 68, 68, 68, 68, 198, 199, 200, 68, 225, 225,
336
- 225, 225, 202, 237, 242, 252, 256, 258, 267, 270,
337
- 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
338
- 225, 225, 225, 225, 225, 225, 265, 265, 265, 265,
339
- 275, 280, 291, 295, 296, 300, 309, 313, 265, 265,
340
- 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
341
- 265, 265, 265, 265, 268, 268, 268, 268, 314, nil,
342
- nil, nil, nil, nil, nil, nil, 268, 268, 268, 268,
343
- 268, 268, 268, 268, 268, 268, 268, 268, 268, 268,
344
- 268, 268, 303, 303, 303, 303, nil, nil, nil, nil,
345
- nil, nil, nil, nil, 303, 303, 303, 303, 303, 303,
346
- 303, 303, 303, 303, 303, 303, 303, 303, 303, 303,
347
- 10, 10, 10, nil, nil, nil, nil, nil, nil, nil,
348
- nil, 10, 10, 10, 10, 10, 10, 10, 10, 10,
349
- 10, 10, 10, 10, 10, 10, 10, 15, 15, 15,
350
- nil, nil, nil, nil, nil, nil, nil, nil, nil, 15,
351
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
352
- 15, 15, 15, 15, 73, 73, 73, nil, nil, nil,
353
- nil, nil, nil, nil, nil, 73, 73, 73, 73, 73,
354
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
355
- 73, 76, 76, 76, nil, nil, nil, nil, nil, nil,
356
- nil, nil, 76, 76, 76, 76, 76, 76, 76, 76,
357
- 76, 76, 76, 76, 76, 76, 76, 76, 77, 77,
358
- 77, nil, nil, nil, nil, nil, nil, nil, nil, 77,
359
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
360
- 77, 77, 77, 77, 77, 78, 78, 78, nil, nil,
361
- nil, nil, nil, nil, nil, nil, 78, 78, 78, 78,
362
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
363
- 78, 78, 79, 79, 79, nil, nil, nil, nil, nil,
364
- nil, nil, nil, 79, 79, 79, 79, 79, 79, 79,
365
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 80,
366
- 80, 80, nil, nil, nil, nil, nil, nil, nil, nil,
367
- 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
368
- 80, 80, 80, 80, 80, 80, 81, 81, 81, nil,
369
- nil, nil, nil, nil, nil, nil, nil, 81, 81, 81,
370
- 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
371
- 81, 81, 81, 82, 82, 82, nil, nil, nil, nil,
372
- nil, nil, nil, nil, 82, 82, 82, 82, 82, 82,
373
- 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
374
- 83, 83, 83, nil, nil, nil, nil, nil, nil, nil,
375
- nil, 83, 83, 83, 83, 83, 83, 83, 83, 83,
376
- 83, 83, 83, 83, 83, 83, 83, 84, 84, 84,
377
- nil, nil, nil, nil, nil, nil, nil, nil, 84, 84,
378
- 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
379
- 84, 84, 84, 84, 85, 85, 85, nil, nil, nil,
380
- nil, nil, nil, nil, nil, 85, 85, 85, 85, 85,
381
- 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
382
- 85, 86, 86, 86, nil, nil, nil, nil, nil, nil,
383
- nil, nil, 86, 86, 86, 86, 86, 86, 86, 86,
384
- 86, 86, 86, 86, 86, 86, 86, 86, 87, 87,
385
- 87, nil, nil, nil, nil, nil, nil, nil, nil, 87,
386
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
387
- 87, 87, 87, 87, 87, 95, 95, 95, nil, nil,
388
- nil, nil, nil, nil, nil, nil, 95, 95, 95, 95,
389
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
390
- 95, 95, 96, 96, 96, nil, nil, nil, nil, nil,
391
- nil, nil, nil, 96, 96, 96, 96, 96, 96, 96,
392
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 98,
393
- 98, 98, nil, nil, nil, nil, nil, 98, nil, nil,
394
- 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
395
- 98, 98, 98, 98, 98, 98, 100, 100, 100, nil,
396
- nil, nil, nil, nil, 100, nil, nil, 100, 100, 100,
397
- 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
398
- 100, 100, 100, 119, 119, 119, nil, nil, nil, nil,
399
- nil, nil, nil, nil, 119, 119, 119, 119, 119, 119,
400
- 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
401
- 123, 123, 123, nil, nil, nil, nil, nil, nil, nil,
402
- nil, 123, 123, 123, 123, 123, 123, 123, 123, 123,
403
- 123, 123, 123, 123, 123, 123, 123, 126, 126, 126,
404
- nil, 126, nil, nil, nil, nil, nil, nil, 126, 126,
405
- 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
406
- 126, 126, 126, 126, 132, 132, 132, nil, nil, nil,
407
- nil, nil, 132, nil, nil, 132, 132, 132, 132, 132,
408
- 132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
409
- 132, 179, 179, 179, nil, nil, nil, nil, nil, nil,
410
- nil, nil, 179, 179, 179, 179, 179, 179, 179, 179,
411
- 179, 179, 179, 179, 179, 179, 179, 179, 185, 185,
412
- 185, nil, nil, nil, nil, nil, nil, nil, nil, 185,
413
- 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
414
- 185, 185, 185, 185, 185, 187, 187, 187, nil, nil,
415
- nil, nil, nil, nil, nil, nil, 187, 187, 187, 187,
416
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
417
- 187, 187, 191, 191, 191, nil, nil, nil, nil, nil,
418
- nil, nil, nil, 191, 191, 191, 191, 191, 191, 191,
419
- 191, 191, 191, 191, 191, 191, 191, 191, 191, 196,
420
- 196, 196, nil, nil, nil, nil, nil, nil, nil, nil,
421
- 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
422
- 196, 196, 196, 196, 196, 196, 201, 201, 201, nil,
423
- nil, nil, nil, nil, 201, nil, nil, 201, 201, 201,
424
- 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
425
- 201, 201, 201, 223, 223, 223, nil, nil, nil, nil,
426
- nil, nil, nil, nil, 223, 223, 223, 223, 223, 223,
427
- 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
428
- 233, 233, 233, nil, nil, nil, nil, nil, nil, nil,
429
- nil, 233, 233, 233, 233, 233, 233, 233, 233, 233,
430
- 233, 233, 233, 233, 233, 233, 233, 239, 239, 239,
431
- nil, nil, nil, nil, nil, nil, nil, nil, 239, 239,
432
- 239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
433
- 239, 239, 239, 239, 248, 248, 248, nil, nil, nil,
434
- nil, nil, nil, nil, nil, 248, 248, 248, 248, 248,
435
- 248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
436
- 248, 274, 274, 274, nil, nil, nil, nil, nil, nil,
437
- nil, nil, 274, 274, 274, 274, 274, 274, 274, 274,
438
- 274, 274, 274, 274, 274, 274, 274, 274, 284, 284,
439
- 284, nil, nil, nil, nil, nil, nil, nil, nil, 284,
440
- 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
441
- 284, 284, 284, 284, 284, 299, 299, 299, nil, nil,
442
- nil, nil, nil, 299, nil, nil, 299, 299, 299, 299,
443
- 299, 299, 299, 299, 299, 299, 299, 299, 299, 299,
444
- 299, 299, 308, 308, 308, nil, nil, nil, nil, nil,
445
- 308, nil, nil, 308, 308, 308, 308, 308, 308, 308,
446
- 308, 308, 308, 308, 308, 308, 308, 308, 308, 310,
447
- 310, 310, nil, nil, nil, nil, nil, nil, nil, nil,
448
- 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
449
- 310, 310, 310, 310, 310, 310, 244, 244, 244, nil,
450
- nil, nil, nil, nil, nil, nil, nil, 244, 244, 244,
451
- 244, 244, 244, 244, 244, 244, 244, 244, 244, 244,
452
- 188, nil, nil, nil, 188, nil, nil, nil, nil, nil,
453
- 188, nil, 188, 188, 188, 188 ]
454
-
455
- racc_action_pointer = [
456
- 5, 1, nil, 0, nil, nil, nil, nil, nil, nil,
457
- 546, 66, nil, nil, nil, 573, nil, nil, nil, -19,
458
- nil, nil, nil, nil, nil, nil, nil, nil, 7, nil,
459
- nil, nil, nil, nil, nil, nil, nil, 393, 32, nil,
460
- 27, nil, nil, nil, nil, nil, nil, nil, nil, nil,
461
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
462
- nil, 94, nil, nil, nil, nil, nil, 67, 403, 24,
463
- nil, 17, nil, 600, 74, 68, 627, 654, 681, 708,
464
- 735, 762, 789, 816, 843, 870, 897, 924, 74, nil,
465
- 127, 153, nil, nil, 129, 951, 978, 146, 1005, 179,
466
- 1032, nil, 175, nil, 74, 1, 186, 155, 172, 173,
467
- 160, 161, 182, 186, 202, 204, 190, 193, 214, 1059,
468
- 250, 126, nil, 1086, 251, 248, 1113, nil, 246, nil,
469
- 248, nil, 1140, 246, 149, nil, 250, nil, 101, nil,
470
- 275, 154, 252, 6, 253, 38, 254, 256, 122, 277,
471
- 11, 310, 12, 314, nil, 283, nil, 285, 306, 320,
472
- 321, 337, nil, nil, nil, 338, nil, nil, 315, nil,
473
- nil, 181, nil, 338, 350, 122, 352, nil, nil, 1167,
474
- 127, nil, 14, 321, 374, 1194, 343, 1221, 1585, 347,
475
- 380, 1248, 350, 351, 384, 385, 1275, 379, 401, 402,
476
- 409, 1302, 440, nil, nil, nil, nil, nil, nil, nil,
477
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
478
- nil, nil, nil, 1329, 213, 435, nil, nil, nil, nil,
479
- nil, nil, nil, 1356, 15, nil, nil, 406, nil, 1383,
480
- nil, nil, 406, nil, 1572, nil, 16, 17, 1410, nil,
481
- nil, nil, 407, 19, 70, 4, 431, nil, 433, nil,
482
- nil, nil, 245, nil, nil, 463, nil, 438, 491, nil,
483
- 442, nil, nil, nil, 1437, 436, nil, nil, nil, nil,
484
- 461, nil, nil, nil, 1464, nil, 277, nil, nil, nil,
485
- nil, 462, 309, nil, nil, 463, 464, nil, nil, 1491,
486
- 437, nil, nil, 519, 341, nil, nil, 373, 1518, 462,
487
- 1545, nil, nil, 443, 464, nil, nil, nil ]
488
-
489
- racc_action_default = [
490
- -152, -187, -1, -152, -3, -5, -6, -7, -8, -9,
491
- -16, -187, -13, -14, -15, -110, -112, -113, -114, -101,
492
- -121, -122, -123, -124, -125, -126, -127, -128, -187, -131,
493
- -132, -133, -134, -135, -136, -151, -153, -187, -187, -4,
494
- -18, -17, -39, -40, -41, -42, -43, -44, -45, -46,
495
- -47, -48, -49, -50, -51, -52, -53, -54, -55, -56,
496
- -57, -187, -12, -32, -34, -35, -36, -67, -101, -187,
497
- -111, -102, -103, -187, -116, -101, -187, -187, -187, -187,
498
- -187, -187, -187, -187, -187, -187, -187, -187, -187, 318,
499
- -101, -187, -11, -33, -101, -187, -187, -101, -187, -187,
500
- -187, -104, -67, -115, -187, -130, -187, -187, -156, -156,
501
- -101, -101, -101, -101, -156, -156, -101, -101, -101, -187,
502
- -187, -187, -20, -187, -30, -67, -187, -69, -187, -106,
503
- -23, -25, -187, -101, -187, -108, -101, -105, -187, -118,
504
- -187, -187, -137, -141, -101, -187, -101, -144, -146, -187,
505
- -148, -187, -150, -187, -154, -101, -157, -101, -187, -187,
506
- -187, -168, -10, -19, -21, -187, -31, -37, -101, -68,
507
- -70, -187, -24, -187, -187, -187, -187, -117, -119, -187,
508
- -187, -138, -152, -102, -171, -187, -159, -160, -161, -102,
509
- -171, -187, -152, -152, -171, -171, -187, -152, -152, -152,
510
- -183, -187, -30, -58, -59, -60, -61, -62, -63, -71,
511
- -72, -73, -74, -75, -76, -77, -78, -79, -80, -81,
512
- -82, -83, -84, -187, -187, -187, -100, -26, -107, -29,
513
- -109, -120, -129, -187, -152, -174, -139, -158, -161, -187,
514
- -164, -142, -145, -177, -187, -65, -152, -152, -187, -166,
515
- -155, -176, -179, -152, -152, -152, -187, -184, -27, -38,
516
- -85, -86, -187, -88, -90, -187, -92, -187, -187, -97,
517
- -168, -172, -175, -162, -187, -101, -66, -147, -149, -167,
518
- -187, -180, -181, -169, -187, -22, -187, -87, -89, -91,
519
- -93, -187, -187, -96, -98, -187, -187, -178, -64, -187,
520
- -182, -185, -28, -187, -187, -81, -94, -187, -187, -27,
521
- -187, -95, -99, -101, -101, -186, -170, -165 ]
522
-
523
- racc_goto_table = [
524
- 10, 105, 61, 10, 37, 93, 181, 37, 41, 67,
525
- 133, 209, 136, 200, 208, 70, 266, 74, 167, 178,
526
- 186, 122, 135, 247, 302, 138, 246, 242, 254, 255,
527
- 305, 253, 252, 142, 279, 127, 148, 150, 152, 235,
528
- 1, 279, 279, 162, 173, 312, 2, 236, 276, 285,
529
- 3, 164, 40, 241, 94, 276, 290, 250, 251, 67,
530
- 237, 178, 180, 90, 263, 170, 99, 208, 97, 121,
531
- 183, 102, 189, 106, 107, 108, 109, 110, 111, 112,
532
- 113, 114, 115, 116, 117, 118, 101, 208, 120, 137,
533
- 275, 272, 124, 125, 128, 129, 259, 228, 4, 230,
534
- 314, 39, 288, 126, 140, 208, 143, 147, 149, 151,
535
- 153, 154, 168, 258, 158, 159, 160, 161, 262, 93,
536
- 101, 165, 296, 265, 128, 175, 294, 69, 103, 208,
537
- 187, 174, 67, 234, 176, 208, 256, 300, 140, 144,
538
- 146, 140, 184, 188, 190, 155, 157, 208, nil, nil,
539
- 208, nil, nil, 194, nil, 195, nil, 101, nil, nil,
540
- nil, nil, nil, 101, nil, 101, 202, 101, nil, nil,
541
- nil, 207, nil, 67, nil, nil, nil, 231, nil, nil,
542
- 140, nil, nil, 238, nil, 240, 233, nil, nil, 243,
543
- nil, nil, nil, nil, 243, nil, 244, nil, 101, nil,
544
- nil, 244, nil, nil, 101, nil, nil, nil, nil, nil,
545
- nil, 309, nil, nil, nil, nil, nil, nil, nil, nil,
546
- 313, 260, nil, 267, 207, nil, nil, nil, nil, nil,
547
- nil, 270, nil, nil, nil, nil, nil, 273, 233, nil,
548
- nil, nil, nil, nil, 207, nil, 280, nil, nil, nil,
549
- 244, nil, nil, nil, nil, nil, nil, 244, nil, nil,
550
- nil, nil, 207, 291, nil, nil, 295, nil, nil, nil,
551
- nil, nil, 297, 298, nil, nil, nil, nil, nil, nil,
552
- nil, nil, 301, nil, nil, nil, 207, nil, nil, nil,
553
- nil, nil, 207, nil, nil, nil, nil, nil, nil, nil,
554
- nil, 295, nil, nil, 207, nil, nil, 207, 315, nil,
555
- nil, 316, 317 ]
556
-
557
- racc_goto_check = [
558
- 10, 49, 15, 10, 33, 24, 73, 33, 16, 16,
559
- 19, 37, 19, 81, 30, 29, 46, 13, 23, 57,
560
- 78, 18, 14, 76, 22, 56, 34, 75, 76, 76,
561
- 22, 34, 75, 49, 80, 36, 49, 49, 49, 82,
562
- 1, 80, 80, 14, 19, 22, 2, 73, 32, 20,
563
- 3, 18, 11, 73, 28, 32, 46, 73, 73, 16,
564
- 78, 57, 56, 12, 37, 36, 13, 30, 29, 17,
565
- 49, 16, 49, 13, 16, 16, 16, 16, 16, 16,
566
- 16, 16, 16, 16, 16, 16, 50, 30, 13, 28,
567
- 31, 82, 13, 16, 16, 13, 23, 14, 4, 14,
568
- 20, 4, 37, 35, 10, 30, 72, 72, 13, 13,
569
- 13, 13, 28, 19, 13, 13, 13, 16, 44, 24,
570
- 50, 16, 81, 45, 16, 15, 48, 51, 55, 30,
571
- 79, 13, 16, 83, 13, 30, 84, 85, 10, 74,
572
- 74, 10, 13, 16, 13, 74, 74, 30, nil, nil,
573
- 30, nil, nil, 13, nil, 13, nil, 50, nil, nil,
574
- nil, nil, nil, 50, nil, 50, 13, 50, nil, nil,
575
- nil, 10, nil, 16, nil, nil, nil, 16, nil, nil,
576
- 10, nil, nil, 16, nil, 16, 33, nil, nil, 16,
577
- nil, nil, nil, nil, 16, nil, 33, nil, 50, nil,
578
- nil, 33, nil, nil, 50, nil, nil, nil, nil, nil,
579
- nil, 19, nil, nil, nil, nil, nil, nil, nil, nil,
580
- 19, 16, nil, 16, 10, nil, nil, nil, nil, nil,
581
- nil, 16, nil, nil, nil, nil, nil, 16, 33, nil,
582
- nil, nil, nil, nil, 10, nil, 16, nil, nil, nil,
583
- 33, nil, nil, nil, nil, nil, nil, 33, nil, nil,
584
- nil, nil, 10, 16, nil, nil, 16, nil, nil, nil,
585
- nil, nil, 16, 13, nil, nil, nil, nil, nil, nil,
586
- nil, nil, 16, nil, nil, nil, 10, nil, nil, nil,
587
- nil, nil, 10, nil, nil, nil, nil, nil, nil, nil,
588
- nil, 16, nil, nil, 10, nil, nil, 10, 16, nil,
589
- nil, 13, 13 ]
590
-
591
- racc_goto_pointer = [
592
- nil, 40, 46, 50, 98, nil, nil, nil, nil, nil,
593
- 0, 42, 23, -2, -77, -9, -2, -22, -70, -88,
594
- -209, nil, -262, -106, -56, nil, nil, nil, -13, 0,
595
- -157, -154, -198, 4, -166, 7, -61, -160, nil, nil,
596
- nil, nil, nil, nil, -106, -102, -209, nil, -142, -74,
597
- 15, 112, nil, nil, nil, 54, -79, -119, nil, nil,
598
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
599
- nil, nil, -2, -137, 31, -164, -170, nil, -125, -15,
600
- -213, -148, -143, -49, -64, -147 ]
601
-
602
- racc_goto_default = [
603
- nil, nil, nil, nil, nil, 5, 6, 7, 8, 9,
604
- 59, nil, nil, nil, 166, nil, 131, nil, nil, nil,
605
- nil, 130, 219, nil, 63, 64, 65, 66, nil, 42,
606
- 60, 226, 245, 248, nil, nil, nil, 306, 215, 216,
607
- 217, 218, 220, 221, nil, nil, nil, 268, 269, 71,
608
- 72, nil, 16, 17, 18, nil, nil, 139, 20, 21,
609
- 22, 23, 24, 25, 26, 27, 29, 30, 31, 32,
610
- 33, 34, 156, nil, nil, nil, nil, 36, nil, nil,
611
- 249, nil, nil, nil, nil, nil ]
612
-
613
- racc_reduce_table = [
614
- 0, 0, :racc_error,
615
- 1, 40, :_reduce_none,
616
- 1, 41, :_reduce_2,
617
- 1, 42, :_reduce_3,
618
- 2, 42, :_reduce_4,
619
- 1, 43, :_reduce_none,
620
- 1, 43, :_reduce_none,
621
- 1, 43, :_reduce_none,
622
- 1, 44, :_reduce_none,
623
- 1, 44, :_reduce_none,
624
- 5, 47, :_reduce_10,
625
- 3, 47, :_reduce_11,
626
- 2, 47, :_reduce_12,
627
- 1, 49, :_reduce_none,
628
- 1, 49, :_reduce_none,
629
- 1, 49, :_reduce_none,
630
- 0, 50, :_reduce_16,
631
- 1, 50, :_reduce_none,
632
- 0, 51, :_reduce_18,
633
- 3, 51, :_reduce_19,
634
- 1, 56, :_reduce_20,
635
- 2, 56, :_reduce_21,
636
- 5, 57, :_reduce_22,
637
- 1, 58, :_reduce_23,
638
- 2, 58, :_reduce_24,
639
- 1, 60, :_reduce_25,
640
- 3, 60, :_reduce_26,
641
- 0, 59, :_reduce_27,
642
- 2, 59, :_reduce_28,
643
- 3, 53, :_reduce_29,
644
- 0, 62, :_reduce_30,
645
- 1, 62, :_reduce_31,
646
- 1, 54, :_reduce_32,
647
- 2, 54, :_reduce_33,
648
- 1, 63, :_reduce_none,
649
- 1, 63, :_reduce_none,
650
- 1, 63, :_reduce_none,
651
- 4, 64, :_reduce_37,
652
- 6, 64, :_reduce_38,
653
- 1, 55, :_reduce_none,
654
- 1, 55, :_reduce_none,
655
- 1, 69, :_reduce_none,
656
- 1, 69, :_reduce_none,
657
- 1, 69, :_reduce_none,
658
- 1, 69, :_reduce_none,
659
- 1, 69, :_reduce_none,
660
- 1, 69, :_reduce_none,
661
- 1, 69, :_reduce_none,
662
- 1, 69, :_reduce_none,
663
- 1, 69, :_reduce_none,
664
- 1, 68, :_reduce_none,
665
- 1, 68, :_reduce_none,
666
- 1, 68, :_reduce_none,
667
- 1, 68, :_reduce_none,
668
- 1, 68, :_reduce_none,
669
- 1, 68, :_reduce_none,
670
- 1, 68, :_reduce_none,
671
- 1, 68, :_reduce_none,
672
- 1, 70, :_reduce_none,
673
- 1, 70, :_reduce_none,
674
- 1, 70, :_reduce_none,
675
- 1, 70, :_reduce_none,
676
- 1, 70, :_reduce_none,
677
- 1, 70, :_reduce_none,
678
- 3, 71, :_reduce_64,
679
- 1, 73, :_reduce_65,
680
- 2, 73, :_reduce_66,
681
- 0, 67, :_reduce_67,
682
- 3, 67, :_reduce_68,
683
- 1, 74, :_reduce_69,
684
- 2, 74, :_reduce_70,
685
- 3, 75, :_reduce_71,
686
- 1, 61, :_reduce_72,
687
- 1, 61, :_reduce_73,
688
- 1, 61, :_reduce_74,
689
- 1, 61, :_reduce_75,
690
- 1, 61, :_reduce_76,
691
- 1, 61, :_reduce_none,
692
- 1, 61, :_reduce_none,
693
- 1, 61, :_reduce_none,
694
- 1, 61, :_reduce_none,
695
- 1, 76, :_reduce_none,
696
- 1, 76, :_reduce_none,
697
- 1, 76, :_reduce_none,
698
- 1, 77, :_reduce_84,
699
- 2, 81, :_reduce_85,
700
- 2, 79, :_reduce_86,
701
- 3, 79, :_reduce_87,
702
- 1, 83, :_reduce_88,
703
- 2, 83, :_reduce_89,
704
- 2, 82, :_reduce_90,
705
- 3, 82, :_reduce_91,
706
- 1, 84, :_reduce_92,
707
- 2, 84, :_reduce_93,
708
- 3, 85, :_reduce_94,
709
- 2, 80, :_reduce_95,
710
- 3, 80, :_reduce_96,
711
- 1, 86, :_reduce_97,
712
- 2, 86, :_reduce_98,
713
- 3, 87, :_reduce_99,
714
- 1, 78, :_reduce_100,
715
- 0, 52, :_reduce_101,
716
- 1, 52, :_reduce_none,
717
- 1, 88, :_reduce_103,
718
- 2, 88, :_reduce_104,
719
- 3, 89, :_reduce_105,
720
- 3, 65, :_reduce_106,
721
- 5, 66, :_reduce_107,
722
- 3, 66, :_reduce_108,
723
- 6, 48, :_reduce_109,
724
- 0, 90, :_reduce_110,
725
- 1, 90, :_reduce_none,
726
- 1, 45, :_reduce_none,
727
- 1, 45, :_reduce_none,
728
- 1, 45, :_reduce_none,
729
- 3, 91, :_reduce_115,
730
- 0, 94, :_reduce_116,
731
- 3, 94, :_reduce_117,
732
- 1, 95, :_reduce_none,
733
- 2, 95, :_reduce_119,
734
- 3, 96, :_reduce_120,
735
- 1, 92, :_reduce_none,
736
- 1, 92, :_reduce_none,
737
- 1, 92, :_reduce_none,
738
- 1, 92, :_reduce_none,
739
- 1, 92, :_reduce_none,
740
- 1, 92, :_reduce_none,
741
- 1, 46, :_reduce_none,
742
- 1, 46, :_reduce_none,
743
- 6, 103, :_reduce_129,
744
- 3, 103, :_reduce_130,
745
- 1, 104, :_reduce_none,
746
- 1, 104, :_reduce_none,
747
- 1, 104, :_reduce_none,
748
- 1, 104, :_reduce_none,
749
- 1, 104, :_reduce_none,
750
- 1, 104, :_reduce_none,
751
- 4, 105, :_reduce_137,
752
- 5, 106, :_reduce_138,
753
- 6, 106, :_reduce_139,
754
- 5, 106, :_reduce_140,
755
- 4, 106, :_reduce_141,
756
- 6, 107, :_reduce_142,
757
- 5, 107, :_reduce_143,
758
- 4, 107, :_reduce_144,
759
- 6, 108, :_reduce_145,
760
- 4, 108, :_reduce_146,
761
- 7, 109, :_reduce_147,
762
- 4, 109, :_reduce_148,
763
- 7, 110, :_reduce_149,
764
- 4, 110, :_reduce_150,
765
- 1, 116, :_reduce_none,
766
- 0, 72, :_reduce_none,
767
- 1, 72, :_reduce_none,
768
- 4, 97, :_reduce_154,
769
- 6, 98, :_reduce_155,
770
- 0, 113, :_reduce_156,
771
- 1, 113, :_reduce_none,
772
- 3, 111, :_reduce_158,
773
- 2, 111, :_reduce_159,
774
- 2, 111, :_reduce_160,
775
- 1, 117, :_reduce_161,
776
- 3, 117, :_reduce_162,
777
- 1, 118, :_reduce_163,
778
- 2, 118, :_reduce_164,
779
- 6, 119, :_reduce_165,
780
- 1, 115, :_reduce_166,
781
- 2, 115, :_reduce_167,
782
- 0, 120, :_reduce_168,
783
- 3, 120, :_reduce_169,
784
- 6, 121, :_reduce_170,
785
- 0, 112, :_reduce_171,
786
- 3, 112, :_reduce_172,
787
- 0, 122, :_reduce_173,
788
- 1, 122, :_reduce_174,
789
- 2, 122, :_reduce_175,
790
- 6, 99, :_reduce_176,
791
- 1, 114, :_reduce_177,
792
- 3, 114, :_reduce_178,
793
- 6, 100, :_reduce_179,
794
- 7, 101, :_reduce_180,
795
- 7, 102, :_reduce_181,
796
- 8, 93, :_reduce_182,
797
- 0, 123, :_reduce_none,
798
- 1, 123, :_reduce_none,
799
- 1, 124, :_reduce_185,
800
- 3, 124, :_reduce_186 ]
801
-
802
- racc_reduce_n = 187
803
-
804
- racc_shift_n = 318
805
-
806
- racc_token_table = {
807
- false => 0,
808
- :error => 1,
809
- :LCURLY => 2,
810
- :RCURLY => 3,
811
- :QUERY => 4,
812
- :MUTATION => 5,
813
- :SUBSCRIPTION => 6,
814
- :LPAREN => 7,
815
- :RPAREN => 8,
816
- :VAR_SIGN => 9,
817
- :COLON => 10,
818
- :BANG => 11,
819
- :LBRACKET => 12,
820
- :RBRACKET => 13,
821
- :EQUALS => 14,
822
- :ON => 15,
823
- :SCHEMA => 16,
824
- :SCALAR => 17,
825
- :TYPE => 18,
826
- :IMPLEMENTS => 19,
827
- :INTERFACE => 20,
828
- :UNION => 21,
829
- :ENUM => 22,
830
- :INPUT => 23,
831
- :DIRECTIVE => 24,
832
- :IDENTIFIER => 25,
833
- :FRAGMENT => 26,
834
- :REPEATABLE => 27,
835
- :TRUE => 28,
836
- :FALSE => 29,
837
- :NULL => 30,
838
- :FLOAT => 31,
839
- :INT => 32,
840
- :STRING => 33,
841
- :DIR_SIGN => 34,
842
- :ELLIPSIS => 35,
843
- :EXTEND => 36,
844
- :AMP => 37,
845
- :PIPE => 38 }
846
-
847
- racc_nt_base = 39
848
-
849
- racc_use_result_var = true
850
-
851
- Racc_arg = [
852
- racc_action_table,
853
- racc_action_check,
854
- racc_action_default,
855
- racc_action_pointer,
856
- racc_goto_table,
857
- racc_goto_check,
858
- racc_goto_default,
859
- racc_goto_pointer,
860
- racc_nt_base,
861
- racc_reduce_table,
862
- racc_token_table,
863
- racc_shift_n,
864
- racc_reduce_n,
865
- racc_use_result_var ]
866
-
867
- Racc_token_to_s_table = [
868
- "$end",
869
- "error",
870
- "LCURLY",
871
- "RCURLY",
872
- "QUERY",
873
- "MUTATION",
874
- "SUBSCRIPTION",
875
- "LPAREN",
876
- "RPAREN",
877
- "VAR_SIGN",
878
- "COLON",
879
- "BANG",
880
- "LBRACKET",
881
- "RBRACKET",
882
- "EQUALS",
883
- "ON",
884
- "SCHEMA",
885
- "SCALAR",
886
- "TYPE",
887
- "IMPLEMENTS",
888
- "INTERFACE",
889
- "UNION",
890
- "ENUM",
891
- "INPUT",
892
- "DIRECTIVE",
893
- "IDENTIFIER",
894
- "FRAGMENT",
895
- "REPEATABLE",
896
- "TRUE",
897
- "FALSE",
898
- "NULL",
899
- "FLOAT",
900
- "INT",
901
- "STRING",
902
- "DIR_SIGN",
903
- "ELLIPSIS",
904
- "EXTEND",
905
- "AMP",
906
- "PIPE",
907
- "$start",
908
- "target",
909
- "document",
910
- "definitions_list",
911
- "definition",
912
- "executable_definition",
913
- "type_system_definition",
914
- "type_system_extension",
915
- "operation_definition",
916
- "fragment_definition",
917
- "operation_type",
918
- "operation_name_opt",
919
- "variable_definitions_opt",
920
- "directives_list_opt",
921
- "selection_set",
922
- "selection_list",
923
- "name",
924
- "variable_definitions_list",
925
- "variable_definition",
926
- "type",
927
- "default_value_opt",
928
- "nullable_type",
929
- "literal_value",
930
- "selection_set_opt",
931
- "selection",
932
- "field",
933
- "fragment_spread",
934
- "inline_fragment",
935
- "arguments_opt",
936
- "name_without_on",
937
- "schema_keyword",
938
- "enum_name",
939
- "enum_value_definition",
940
- "description_opt",
941
- "enum_value_definitions",
942
- "arguments_list",
943
- "argument",
944
- "input_value",
945
- "null_value",
946
- "enum_value",
947
- "list_value",
948
- "object_literal_value",
949
- "variable",
950
- "object_value",
951
- "list_value_list",
952
- "object_value_list",
953
- "object_value_field",
954
- "object_literal_value_list",
955
- "object_literal_value_field",
956
- "directives_list",
957
- "directive",
958
- "fragment_name_opt",
959
- "schema_definition",
960
- "type_definition",
961
- "directive_definition",
962
- "operation_type_definition_list_opt",
963
- "operation_type_definition_list",
964
- "operation_type_definition",
965
- "scalar_type_definition",
966
- "object_type_definition",
967
- "interface_type_definition",
968
- "union_type_definition",
969
- "enum_type_definition",
970
- "input_object_type_definition",
971
- "schema_extension",
972
- "type_extension",
973
- "scalar_type_extension",
974
- "object_type_extension",
975
- "interface_type_extension",
976
- "union_type_extension",
977
- "enum_type_extension",
978
- "input_object_type_extension",
979
- "implements",
980
- "field_definition_list_opt",
981
- "implements_opt",
982
- "union_members",
983
- "input_value_definition_list",
984
- "description",
985
- "interfaces_list",
986
- "legacy_interfaces_list",
987
- "input_value_definition",
988
- "arguments_definitions_opt",
989
- "field_definition",
990
- "field_definition_list",
991
- "directive_repeatable_opt",
992
- "directive_locations" ]
993
-
994
- Racc_debug_parser = false
995
-
996
- ##### State transition tables end #####
997
-
998
- # reduce 0 omitted
999
-
1000
- # reduce 1 omitted
1001
-
1002
- module_eval(<<'.,.,', 'parser.y', 4)
1003
- def _reduce_2(val, _values, result)
1004
- result = make_node(:Document, definitions: val[0])
1005
- result
1006
- end
1007
- .,.,
1008
-
1009
- module_eval(<<'.,.,', 'parser.y', 7)
1010
- def _reduce_3(val, _values, result)
1011
- result = [val[0]]
1012
- result
1013
- end
1014
- .,.,
1015
-
1016
- module_eval(<<'.,.,', 'parser.y', 8)
1017
- def _reduce_4(val, _values, result)
1018
- val[0] << val[1]
1019
- result
1020
- end
1021
- .,.,
1022
-
1023
- # reduce 5 omitted
1024
-
1025
- # reduce 6 omitted
1026
-
1027
- # reduce 7 omitted
1028
-
1029
- # reduce 8 omitted
1030
-
1031
- # reduce 9 omitted
1032
-
1033
- module_eval(<<'.,.,', 'parser.y', 21)
1034
- def _reduce_10(val, _values, result)
1035
- result = make_node(
1036
- :OperationDefinition, {
1037
- operation_type: val[0],
1038
- name: val[1],
1039
- variables: val[2],
1040
- directives: val[3],
1041
- selections: val[4],
1042
- position_source: val[0],
1043
- }
1044
- )
1045
-
1046
- result
1047
- end
1048
- .,.,
1049
-
1050
- module_eval(<<'.,.,', 'parser.y', 33)
1051
- def _reduce_11(val, _values, result)
1052
- result = make_node(
1053
- :OperationDefinition, {
1054
- operation_type: "query",
1055
- selections: val[1],
1056
- position_source: val[0],
1057
- }
1058
- )
1059
-
1060
- result
1061
- end
1062
- .,.,
1063
-
1064
- module_eval(<<'.,.,', 'parser.y', 42)
1065
- def _reduce_12(val, _values, result)
1066
- result = make_node(
1067
- :OperationDefinition, {
1068
- operation_type: "query",
1069
- selections: [],
1070
- position_source: val[0],
1071
- }
1072
- )
1073
-
1074
- result
1075
- end
1076
- .,.,
1077
-
1078
- # reduce 13 omitted
1079
-
1080
- # reduce 14 omitted
1081
-
1082
- # reduce 15 omitted
1083
-
1084
- module_eval(<<'.,.,', 'parser.y', 57)
1085
- def _reduce_16(val, _values, result)
1086
- result = nil
1087
- result
1088
- end
1089
- .,.,
1090
-
1091
- # reduce 17 omitted
1092
-
1093
- module_eval(<<'.,.,', 'parser.y', 61)
1094
- def _reduce_18(val, _values, result)
1095
- result = EMPTY_ARRAY
1096
- result
1097
- end
1098
- .,.,
1099
-
1100
- module_eval(<<'.,.,', 'parser.y', 62)
1101
- def _reduce_19(val, _values, result)
1102
- result = val[1]
1103
- result
1104
- end
1105
- .,.,
1106
-
1107
- module_eval(<<'.,.,', 'parser.y', 65)
1108
- def _reduce_20(val, _values, result)
1109
- result = [val[0]]
1110
- result
1111
- end
1112
- .,.,
1113
-
1114
- module_eval(<<'.,.,', 'parser.y', 66)
1115
- def _reduce_21(val, _values, result)
1116
- val[0] << val[1]
1117
- result
1118
- end
1119
- .,.,
1120
49
 
1121
- module_eval(<<'.,.,', 'parser.y', 70)
1122
- def _reduce_22(val, _values, result)
1123
- result = make_node(:VariableDefinition, {
1124
- name: val[1],
1125
- type: val[3],
1126
- default_value: val[4],
1127
- position_source: val[0],
1128
- })
1129
50
 
1130
- result
1131
- end
1132
- .,.,
1133
-
1134
- module_eval(<<'.,.,', 'parser.y', 79)
1135
- def _reduce_23(val, _values, result)
1136
- result = val[0]
1137
- result
1138
- end
1139
- .,.,
1140
-
1141
- module_eval(<<'.,.,', 'parser.y', 80)
1142
- def _reduce_24(val, _values, result)
1143
- result = make_node(:NonNullType, of_type: val[0])
1144
- result
1145
- end
1146
- .,.,
1147
-
1148
- module_eval(<<'.,.,', 'parser.y', 83)
1149
- def _reduce_25(val, _values, result)
1150
- result = make_node(:TypeName, name: val[0])
1151
- result
1152
- end
1153
- .,.,
1154
-
1155
- module_eval(<<'.,.,', 'parser.y', 84)
1156
- def _reduce_26(val, _values, result)
1157
- result = make_node(:ListType, of_type: val[1])
1158
- result
1159
- end
1160
- .,.,
1161
-
1162
- module_eval(<<'.,.,', 'parser.y', 87)
1163
- def _reduce_27(val, _values, result)
1164
- result = nil
1165
- result
1166
- end
1167
- .,.,
1168
-
1169
- module_eval(<<'.,.,', 'parser.y', 88)
1170
- def _reduce_28(val, _values, result)
1171
- result = val[1]
1172
- result
1173
- end
1174
- .,.,
1175
-
1176
- module_eval(<<'.,.,', 'parser.y', 91)
1177
- def _reduce_29(val, _values, result)
1178
- result = val[1]
1179
- result
1180
- end
1181
- .,.,
1182
-
1183
- module_eval(<<'.,.,', 'parser.y', 94)
1184
- def _reduce_30(val, _values, result)
1185
- result = EMPTY_ARRAY
1186
- result
1187
- end
1188
- .,.,
1189
-
1190
- module_eval(<<'.,.,', 'parser.y', 95)
1191
- def _reduce_31(val, _values, result)
1192
- result = val[0]
1193
- result
1194
- end
1195
- .,.,
1196
-
1197
- module_eval(<<'.,.,', 'parser.y', 98)
1198
- def _reduce_32(val, _values, result)
1199
- result = [result]
1200
- result
1201
- end
1202
- .,.,
1203
-
1204
- module_eval(<<'.,.,', 'parser.y', 99)
1205
- def _reduce_33(val, _values, result)
1206
- val[0] << val[1]
1207
- result
1208
- end
1209
- .,.,
1210
-
1211
- # reduce 34 omitted
51
+ private
1212
52
 
1213
- # reduce 35 omitted
53
+ attr_reader :token_name
1214
54
 
1215
- # reduce 36 omitted
55
+ def advance_token
56
+ @token_name = @lexer.advance
57
+ end
1216
58
 
1217
- module_eval(<<'.,.,', 'parser.y', 108)
1218
- def _reduce_37(val, _values, result)
1219
- result = make_node(
1220
- :Field, {
1221
- name: val[0],
1222
- arguments: val[1],
1223
- directives: val[2],
1224
- selections: val[3],
1225
- position_source: val[0],
1226
- }
1227
- )
59
+ def pos
60
+ @lexer.pos
61
+ end
1228
62
 
1229
- result
1230
- end
1231
- .,.,
63
+ def document
64
+ any_tokens = advance_token
65
+ if !any_tokens
66
+ # Only ignored characters is not a valid document
67
+ raise GraphQL::ParseError.new("Unexpected end of document", nil, nil, @graphql_str)
68
+ end
69
+ defns = []
70
+ while !@lexer.eos?
71
+ defns << definition
72
+ end
73
+ Document.new(pos: 0, definitions: defns, filename: @filename, source_string: @graphql_str)
74
+ end
1232
75
 
1233
- module_eval(<<'.,.,', 'parser.y', 119)
1234
- def _reduce_38(val, _values, result)
1235
- result = make_node(
1236
- :Field, {
1237
- alias: val[0],
1238
- name: val[2],
1239
- arguments: val[3],
1240
- directives: val[4],
1241
- selections: val[5],
1242
- position_source: val[0],
1243
- }
76
+ def definition
77
+ case token_name
78
+ when :FRAGMENT
79
+ loc = pos
80
+ expect_token :FRAGMENT
81
+ f_name = if !at?(:ON)
82
+ parse_name
83
+ end
84
+ expect_token :ON
85
+ f_type = parse_type_name
86
+ directives = parse_directives
87
+ selections = selection_set
88
+ Nodes::FragmentDefinition.new(
89
+ pos: loc,
90
+ name: f_name,
91
+ type: f_type,
92
+ directives: directives,
93
+ selections: selections,
94
+ filename: @filename,
95
+ source_string: @graphql_str
96
+ )
97
+ when :QUERY, :MUTATION, :SUBSCRIPTION, :LCURLY
98
+ op_loc = pos
99
+ op_type = case token_name
100
+ when :LCURLY
101
+ "query"
102
+ else
103
+ parse_operation_type
104
+ end
105
+
106
+ op_name = at?(:IDENTIFIER) ? parse_name : nil
107
+
108
+ variable_definitions = if at?(:LPAREN)
109
+ expect_token(:LPAREN)
110
+ defs = []
111
+ while !at?(:RPAREN)
112
+ loc = pos
113
+ expect_token(:VAR_SIGN)
114
+ var_name = parse_name
115
+ expect_token(:COLON)
116
+ var_type = self.type
117
+ default_value = if at?(:EQUALS)
118
+ advance_token
119
+ value
120
+ end
121
+
122
+ defs << Nodes::VariableDefinition.new(pos: loc, name: var_name, type: var_type, default_value: default_value, filename: @filename, source_string: @graphql_str)
123
+ end
124
+ expect_token(:RPAREN)
125
+ defs
126
+ else
127
+ EmptyObjects::EMPTY_ARRAY
128
+ end
129
+
130
+ directives = parse_directives
131
+
132
+ OperationDefinition.new(
133
+ pos: op_loc,
134
+ operation_type: op_type,
135
+ name: op_name,
136
+ variables: variable_definitions,
137
+ directives: directives,
138
+ selections: selection_set,
139
+ filename: @filename,
140
+ source_string: @graphql_str
141
+ )
142
+ when :EXTEND
143
+ loc = pos
144
+ advance_token
145
+ case token_name
146
+ when :SCALAR
147
+ advance_token
148
+ name = parse_name
149
+ directives = parse_directives
150
+ ScalarTypeExtension.new(pos: loc, name: name, directives: directives, filename: @filename, source_string: @graphql_str)
151
+ when :TYPE
152
+ advance_token
153
+ name = parse_name
154
+ implements_interfaces = parse_implements
155
+ directives = parse_directives
156
+ field_defns = at?(:LCURLY) ? parse_field_definitions : EMPTY_ARRAY
157
+
158
+ ObjectTypeExtension.new(pos: loc, name: name, interfaces: implements_interfaces, directives: directives, fields: field_defns, filename: @filename, source_string: @graphql_str)
159
+ when :INTERFACE
160
+ advance_token
161
+ name = parse_name
162
+ directives = parse_directives
163
+ interfaces = parse_implements
164
+ fields_definition = at?(:LCURLY) ? parse_field_definitions : EMPTY_ARRAY
165
+ InterfaceTypeExtension.new(pos: loc, name: name, directives: directives, fields: fields_definition, interfaces: interfaces, filename: @filename, source_string: @graphql_str)
166
+ when :UNION
167
+ advance_token
168
+ name = parse_name
169
+ directives = parse_directives
170
+ union_member_types = parse_union_members
171
+ UnionTypeExtension.new(pos: loc, name: name, directives: directives, types: union_member_types, filename: @filename, source_string: @graphql_str)
172
+ when :ENUM
173
+ advance_token
174
+ name = parse_name
175
+ directives = parse_directives
176
+ enum_values_definition = parse_enum_value_definitions
177
+ Nodes::EnumTypeExtension.new(pos: loc, name: name, directives: directives, values: enum_values_definition, filename: @filename, source_string: @graphql_str)
178
+ when :INPUT
179
+ advance_token
180
+ name = parse_name
181
+ directives = parse_directives
182
+ input_fields_definition = parse_input_object_field_definitions
183
+ InputObjectTypeExtension.new(pos: loc, name: name, directives: directives, fields: input_fields_definition, filename: @filename, source_string: @graphql_str)
184
+ when :SCHEMA
185
+ advance_token
186
+ directives = parse_directives
187
+ query = mutation = subscription = nil
188
+ if at?(:LCURLY)
189
+ advance_token
190
+ while !at?(:RCURLY)
191
+ if at?(:QUERY)
192
+ advance_token
193
+ expect_token(:COLON)
194
+ query = parse_name
195
+ elsif at?(:MUTATION)
196
+ advance_token
197
+ expect_token(:COLON)
198
+ mutation = parse_name
199
+ elsif at?(:SUBSCRIPTION)
200
+ advance_token
201
+ expect_token(:COLON)
202
+ subscription = parse_name
203
+ else
204
+ expect_one_of([:QUERY, :MUTATION, :SUBSCRIPTION])
205
+ end
206
+ end
207
+ expect_token :RCURLY
208
+ end
209
+ SchemaExtension.new(
210
+ subscription: subscription,
211
+ mutation: mutation,
212
+ query: query,
213
+ directives: directives,
214
+ pos: loc,
215
+ filename: @filename,
216
+ source_string: @graphql_str,
1244
217
  )
218
+ else
219
+ expect_one_of([:SCHEMA, :SCALAR, :TYPE, :ENUM, :INPUT, :UNION, :INTERFACE])
220
+ end
221
+ else
222
+ loc = pos
223
+ desc = at?(:STRING) ? string_value : nil
224
+ defn_loc = pos
225
+ case token_name
226
+ when :SCHEMA
227
+ advance_token
228
+ directives = parse_directives
229
+ query = mutation = subscription = nil
230
+ expect_token :LCURLY
231
+ while !at?(:RCURLY)
232
+ if at?(:QUERY)
233
+ advance_token
234
+ expect_token(:COLON)
235
+ query = parse_name
236
+ elsif at?(:MUTATION)
237
+ advance_token
238
+ expect_token(:COLON)
239
+ mutation = parse_name
240
+ elsif at?(:SUBSCRIPTION)
241
+ advance_token
242
+ expect_token(:COLON)
243
+ subscription = parse_name
244
+ else
245
+ expect_one_of([:QUERY, :MUTATION, :SUBSCRIPTION])
246
+ end
247
+ end
248
+ expect_token :RCURLY
249
+ SchemaDefinition.new(pos: loc, definition_pos: defn_loc, query: query, mutation: mutation, subscription: subscription, directives: directives, filename: @filename, source_string: @graphql_str)
250
+ when :DIRECTIVE
251
+ advance_token
252
+ expect_token :DIR_SIGN
253
+ name = parse_name
254
+ arguments_definition = parse_argument_definitions
255
+ repeatable = if at?(:REPEATABLE)
256
+ advance_token
257
+ true
258
+ else
259
+ false
260
+ end
261
+ expect_token :ON
262
+ directive_locations = [DirectiveLocation.new(pos: pos, name: parse_name, filename: @filename, source_string: @graphql_str)]
263
+ while at?(:PIPE)
264
+ advance_token
265
+ directive_locations << DirectiveLocation.new(pos: pos, name: parse_name, filename: @filename, source_string: @graphql_str)
266
+ end
267
+ DirectiveDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, arguments: arguments_definition, locations: directive_locations, repeatable: repeatable, filename: @filename, source_string: @graphql_str)
268
+ when :TYPE
269
+ advance_token
270
+ name = parse_name
271
+ implements_interfaces = parse_implements
272
+ directives = parse_directives
273
+ field_defns = at?(:LCURLY) ? parse_field_definitions : EMPTY_ARRAY
274
+
275
+ ObjectTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, interfaces: implements_interfaces, directives: directives, fields: field_defns, filename: @filename, source_string: @graphql_str)
276
+ when :INTERFACE
277
+ advance_token
278
+ name = parse_name
279
+ directives = parse_directives
280
+ interfaces = parse_implements
281
+ fields_definition = parse_field_definitions
282
+ InterfaceTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, directives: directives, fields: fields_definition, interfaces: interfaces, filename: @filename, source_string: @graphql_str)
283
+ when :UNION
284
+ advance_token
285
+ name = parse_name
286
+ directives = parse_directives
287
+ union_member_types = parse_union_members
288
+ UnionTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, directives: directives, types: union_member_types, filename: @filename, source_string: @graphql_str)
289
+ when :SCALAR
290
+ advance_token
291
+ name = parse_name
292
+ directives = parse_directives
293
+ ScalarTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, directives: directives, filename: @filename, source_string: @graphql_str)
294
+ when :ENUM
295
+ advance_token
296
+ name = parse_name
297
+ directives = parse_directives
298
+ enum_values_definition = parse_enum_value_definitions
299
+ Nodes::EnumTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, directives: directives, values: enum_values_definition, filename: @filename, source_string: @graphql_str)
300
+ when :INPUT
301
+ advance_token
302
+ name = parse_name
303
+ directives = parse_directives
304
+ input_fields_definition = parse_input_object_field_definitions
305
+ InputObjectTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, directives: directives, fields: input_fields_definition, filename: @filename, source_string: @graphql_str)
306
+ else
307
+ expect_one_of([:SCHEMA, :SCALAR, :TYPE, :ENUM, :INPUT, :UNION, :INTERFACE])
308
+ end
309
+ end
310
+ end
1245
311
 
1246
- result
1247
- end
1248
- .,.,
1249
-
1250
- # reduce 39 omitted
1251
-
1252
- # reduce 40 omitted
1253
-
1254
- # reduce 41 omitted
1255
-
1256
- # reduce 42 omitted
1257
-
1258
- # reduce 43 omitted
1259
-
1260
- # reduce 44 omitted
1261
-
1262
- # reduce 45 omitted
1263
-
1264
- # reduce 46 omitted
1265
-
1266
- # reduce 47 omitted
1267
-
1268
- # reduce 48 omitted
1269
-
1270
- # reduce 49 omitted
1271
-
1272
- # reduce 50 omitted
1273
-
1274
- # reduce 51 omitted
1275
-
1276
- # reduce 52 omitted
1277
-
1278
- # reduce 53 omitted
1279
-
1280
- # reduce 54 omitted
1281
-
1282
- # reduce 55 omitted
1283
-
1284
- # reduce 56 omitted
1285
-
1286
- # reduce 57 omitted
1287
-
1288
- # reduce 58 omitted
1289
-
1290
- # reduce 59 omitted
1291
-
1292
- # reduce 60 omitted
1293
-
1294
- # reduce 61 omitted
1295
-
1296
- # reduce 62 omitted
1297
-
1298
- # reduce 63 omitted
1299
-
1300
- module_eval(<<'.,.,', 'parser.y', 165)
1301
- def _reduce_64(val, _values, result)
1302
- result = make_node(:EnumValueDefinition, name: val[1], directives: val[2], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
1303
- result
1304
- end
1305
- .,.,
1306
-
1307
- module_eval(<<'.,.,', 'parser.y', 168)
1308
- def _reduce_65(val, _values, result)
1309
- result = [val[0]]
1310
- result
1311
- end
1312
- .,.,
1313
-
1314
- module_eval(<<'.,.,', 'parser.y', 169)
1315
- def _reduce_66(val, _values, result)
1316
- result = val[0] << val[1]
1317
- result
1318
- end
1319
- .,.,
1320
-
1321
- module_eval(<<'.,.,', 'parser.y', 172)
1322
- def _reduce_67(val, _values, result)
1323
- result = EMPTY_ARRAY
1324
- result
1325
- end
1326
- .,.,
1327
-
1328
- module_eval(<<'.,.,', 'parser.y', 173)
1329
- def _reduce_68(val, _values, result)
1330
- result = val[1]
1331
- result
1332
- end
1333
- .,.,
1334
-
1335
- module_eval(<<'.,.,', 'parser.y', 176)
1336
- def _reduce_69(val, _values, result)
1337
- result = [val[0]]
1338
- result
1339
- end
1340
- .,.,
1341
-
1342
- module_eval(<<'.,.,', 'parser.y', 177)
1343
- def _reduce_70(val, _values, result)
1344
- val[0] << val[1]
1345
- result
1346
- end
1347
- .,.,
1348
-
1349
- module_eval(<<'.,.,', 'parser.y', 180)
1350
- def _reduce_71(val, _values, result)
1351
- result = make_node(:Argument, name: val[0], value: val[2], position_source: val[0])
1352
- result
1353
- end
1354
- .,.,
1355
-
1356
- module_eval(<<'.,.,', 'parser.y', 183)
1357
- def _reduce_72(val, _values, result)
1358
- result = val[0][3].to_f
1359
- result
1360
- end
1361
- .,.,
1362
-
1363
- module_eval(<<'.,.,', 'parser.y', 184)
1364
- def _reduce_73(val, _values, result)
1365
- result = val[0][3].to_i
1366
- result
1367
- end
1368
- .,.,
1369
-
1370
- module_eval(<<'.,.,', 'parser.y', 185)
1371
- def _reduce_74(val, _values, result)
1372
- result = val[0][3]
1373
- result
1374
- end
1375
- .,.,
1376
-
1377
- module_eval(<<'.,.,', 'parser.y', 186)
1378
- def _reduce_75(val, _values, result)
1379
- result = true
1380
- result
1381
- end
1382
- .,.,
1383
-
1384
- module_eval(<<'.,.,', 'parser.y', 187)
1385
- def _reduce_76(val, _values, result)
1386
- result = false
1387
- result
1388
- end
1389
- .,.,
1390
-
1391
- # reduce 77 omitted
1392
-
1393
- # reduce 78 omitted
1394
-
1395
- # reduce 79 omitted
1396
-
1397
- # reduce 80 omitted
1398
-
1399
- # reduce 81 omitted
1400
-
1401
- # reduce 82 omitted
1402
-
1403
- # reduce 83 omitted
1404
-
1405
- module_eval(<<'.,.,', 'parser.y', 198)
1406
- def _reduce_84(val, _values, result)
1407
- result = make_node(:NullValue, name: val[0], position_source: val[0])
1408
- result
1409
- end
1410
- .,.,
1411
-
1412
- module_eval(<<'.,.,', 'parser.y', 199)
1413
- def _reduce_85(val, _values, result)
1414
- result = make_node(:VariableIdentifier, name: val[1], position_source: val[0])
1415
- result
1416
- end
1417
- .,.,
1418
-
1419
- module_eval(<<'.,.,', 'parser.y', 202)
1420
- def _reduce_86(val, _values, result)
1421
- result = EMPTY_ARRAY
1422
- result
1423
- end
1424
- .,.,
1425
-
1426
- module_eval(<<'.,.,', 'parser.y', 203)
1427
- def _reduce_87(val, _values, result)
1428
- result = val[1]
1429
- result
1430
- end
1431
- .,.,
1432
-
1433
- module_eval(<<'.,.,', 'parser.y', 206)
1434
- def _reduce_88(val, _values, result)
1435
- result = [val[0]]
1436
- result
1437
- end
1438
- .,.,
1439
-
1440
- module_eval(<<'.,.,', 'parser.y', 207)
1441
- def _reduce_89(val, _values, result)
1442
- val[0] << val[1]
1443
- result
1444
- end
1445
- .,.,
1446
-
1447
- module_eval(<<'.,.,', 'parser.y', 210)
1448
- def _reduce_90(val, _values, result)
1449
- result = make_node(:InputObject, arguments: [], position_source: val[0])
1450
- result
1451
- end
1452
- .,.,
1453
-
1454
- module_eval(<<'.,.,', 'parser.y', 211)
1455
- def _reduce_91(val, _values, result)
1456
- result = make_node(:InputObject, arguments: val[1], position_source: val[0])
1457
- result
1458
- end
1459
- .,.,
1460
-
1461
- module_eval(<<'.,.,', 'parser.y', 214)
1462
- def _reduce_92(val, _values, result)
1463
- result = [val[0]]
1464
- result
1465
- end
1466
- .,.,
1467
-
1468
- module_eval(<<'.,.,', 'parser.y', 215)
1469
- def _reduce_93(val, _values, result)
1470
- val[0] << val[1]
1471
- result
1472
- end
1473
- .,.,
1474
-
1475
- module_eval(<<'.,.,', 'parser.y', 218)
1476
- def _reduce_94(val, _values, result)
1477
- result = make_node(:Argument, name: val[0], value: val[2], position_source: val[0])
1478
- result
1479
- end
1480
- .,.,
1481
-
1482
- module_eval(<<'.,.,', 'parser.y', 222)
1483
- def _reduce_95(val, _values, result)
1484
- result = make_node(:InputObject, arguments: [], position_source: val[0])
1485
- result
1486
- end
1487
- .,.,
1488
-
1489
- module_eval(<<'.,.,', 'parser.y', 223)
1490
- def _reduce_96(val, _values, result)
1491
- result = make_node(:InputObject, arguments: val[1], position_source: val[0])
1492
- result
1493
- end
1494
- .,.,
1495
-
1496
- module_eval(<<'.,.,', 'parser.y', 226)
1497
- def _reduce_97(val, _values, result)
1498
- result = [val[0]]
1499
- result
1500
- end
1501
- .,.,
1502
-
1503
- module_eval(<<'.,.,', 'parser.y', 227)
1504
- def _reduce_98(val, _values, result)
1505
- val[0] << val[1]
1506
- result
1507
- end
1508
- .,.,
1509
-
1510
- module_eval(<<'.,.,', 'parser.y', 230)
1511
- def _reduce_99(val, _values, result)
1512
- result = make_node(:Argument, name: val[0], value: val[2], position_source: val[0])
1513
- result
1514
- end
1515
- .,.,
1516
-
1517
- module_eval(<<'.,.,', 'parser.y', 232)
1518
- def _reduce_100(val, _values, result)
1519
- result = make_node(:Enum, name: val[0], position_source: val[0])
1520
- result
1521
- end
1522
- .,.,
1523
-
1524
- module_eval(<<'.,.,', 'parser.y', 235)
1525
- def _reduce_101(val, _values, result)
1526
- result = EMPTY_ARRAY
1527
- result
1528
- end
1529
- .,.,
1530
-
1531
- # reduce 102 omitted
1532
-
1533
- module_eval(<<'.,.,', 'parser.y', 239)
1534
- def _reduce_103(val, _values, result)
1535
- result = [val[0]]
1536
- result
1537
- end
1538
- .,.,
1539
-
1540
- module_eval(<<'.,.,', 'parser.y', 240)
1541
- def _reduce_104(val, _values, result)
1542
- val[0] << val[1]
1543
- result
1544
- end
1545
- .,.,
1546
-
1547
- module_eval(<<'.,.,', 'parser.y', 242)
1548
- def _reduce_105(val, _values, result)
1549
- result = make_node(:Directive, name: val[1], arguments: val[2], position_source: val[0])
1550
- result
1551
- end
1552
- .,.,
1553
-
1554
- module_eval(<<'.,.,', 'parser.y', 245)
1555
- def _reduce_106(val, _values, result)
1556
- result = make_node(:FragmentSpread, name: val[1], directives: val[2], position_source: val[0])
1557
- result
1558
- end
1559
- .,.,
1560
-
1561
- module_eval(<<'.,.,', 'parser.y', 249)
1562
- def _reduce_107(val, _values, result)
1563
- result = make_node(:InlineFragment, {
1564
- type: val[2],
1565
- directives: val[3],
1566
- selections: val[4],
1567
- position_source: val[0]
1568
- })
1569
-
1570
- result
1571
- end
1572
- .,.,
1573
-
1574
- module_eval(<<'.,.,', 'parser.y', 257)
1575
- def _reduce_108(val, _values, result)
1576
- result = make_node(:InlineFragment, {
1577
- type: nil,
1578
- directives: val[1],
1579
- selections: val[2],
1580
- position_source: val[0]
1581
- })
1582
-
1583
- result
1584
- end
1585
- .,.,
1586
-
1587
- module_eval(<<'.,.,', 'parser.y', 267)
1588
- def _reduce_109(val, _values, result)
1589
- result = make_node(:FragmentDefinition, {
1590
- name: val[1],
1591
- type: val[3],
1592
- directives: val[4],
1593
- selections: val[5],
1594
- position_source: val[0],
1595
- }
1596
- )
1597
-
1598
- result
1599
- end
1600
- .,.,
1601
-
1602
- module_eval(<<'.,.,', 'parser.y', 278)
1603
- def _reduce_110(val, _values, result)
1604
- result = nil
1605
- result
1606
- end
1607
- .,.,
1608
-
1609
- # reduce 111 omitted
1610
-
1611
- # reduce 112 omitted
1612
-
1613
- # reduce 113 omitted
1614
-
1615
- # reduce 114 omitted
1616
-
1617
- module_eval(<<'.,.,', 'parser.y', 287)
1618
- def _reduce_115(val, _values, result)
1619
- result = make_node(:SchemaDefinition, position_source: val[0], definition_line: val[0][1], directives: val[1], **val[2])
1620
- result
1621
- end
1622
- .,.,
1623
-
1624
- module_eval(<<'.,.,', 'parser.y', 290)
1625
- def _reduce_116(val, _values, result)
1626
- result = {}
1627
- result
1628
- end
1629
- .,.,
1630
-
1631
- module_eval(<<'.,.,', 'parser.y', 291)
1632
- def _reduce_117(val, _values, result)
1633
- result = val[1]
1634
- result
1635
- end
1636
- .,.,
1637
-
1638
- # reduce 118 omitted
1639
-
1640
- module_eval(<<'.,.,', 'parser.y', 295)
1641
- def _reduce_119(val, _values, result)
1642
- result = val[0].merge(val[1])
1643
- result
1644
- end
1645
- .,.,
1646
-
1647
- module_eval(<<'.,.,', 'parser.y', 298)
1648
- def _reduce_120(val, _values, result)
1649
- result = { val[0][3].to_sym => val[2] }
1650
- result
1651
- end
1652
- .,.,
1653
-
1654
- # reduce 121 omitted
1655
-
1656
- # reduce 122 omitted
1657
-
1658
- # reduce 123 omitted
1659
-
1660
- # reduce 124 omitted
1661
-
1662
- # reduce 125 omitted
1663
-
1664
- # reduce 126 omitted
1665
-
1666
- # reduce 127 omitted
1667
-
1668
- # reduce 128 omitted
1669
-
1670
- module_eval(<<'.,.,', 'parser.y', 313)
1671
- def _reduce_129(val, _values, result)
1672
- result = make_node(:SchemaExtension, position_source: val[0], directives: val[2], **val[4])
1673
- result
1674
- end
1675
- .,.,
1676
-
1677
- module_eval(<<'.,.,', 'parser.y', 314)
1678
- def _reduce_130(val, _values, result)
1679
- result = make_node(:SchemaExtension, position_source: val[0], directives: val[2])
1680
- result
1681
- end
1682
- .,.,
1683
-
1684
- # reduce 131 omitted
1685
-
1686
- # reduce 132 omitted
1687
-
1688
- # reduce 133 omitted
1689
-
1690
- # reduce 134 omitted
1691
-
1692
- # reduce 135 omitted
1693
-
1694
- # reduce 136 omitted
1695
-
1696
- module_eval(<<'.,.,', 'parser.y', 324)
1697
- def _reduce_137(val, _values, result)
1698
- result = make_node(:ScalarTypeExtension, name: val[2], directives: val[3], position_source: val[0])
1699
- result
1700
- end
1701
- .,.,
1702
-
1703
- module_eval(<<'.,.,', 'parser.y', 328)
1704
- def _reduce_138(val, _values, result)
1705
- result = make_node(:ObjectTypeExtension, name: val[2], interfaces: val[3], directives: [], fields: val[4], position_source: val[0])
1706
- result
1707
- end
1708
- .,.,
1709
-
1710
- module_eval(<<'.,.,', 'parser.y', 329)
1711
- def _reduce_139(val, _values, result)
1712
- result = make_node(:ObjectTypeExtension, name: val[2], interfaces: val[3], directives: val[4], fields: val[5], position_source: val[0])
1713
- result
1714
- end
1715
- .,.,
1716
-
1717
- module_eval(<<'.,.,', 'parser.y', 330)
1718
- def _reduce_140(val, _values, result)
1719
- result = make_node(:ObjectTypeExtension, name: val[2], interfaces: val[3], directives: val[4], fields: [], position_source: val[0])
1720
- result
1721
- end
1722
- .,.,
1723
-
1724
- module_eval(<<'.,.,', 'parser.y', 331)
1725
- def _reduce_141(val, _values, result)
1726
- result = make_node(:ObjectTypeExtension, name: val[2], interfaces: val[3], directives: [], fields: [], position_source: val[0])
1727
- result
1728
- end
1729
- .,.,
1730
-
1731
- module_eval(<<'.,.,', 'parser.y', 334)
1732
- def _reduce_142(val, _values, result)
1733
- result = make_node(:InterfaceTypeExtension, name: val[2], interfaces: val[3], directives: val[4], fields: val[5], position_source: val[0])
1734
- result
1735
- end
1736
- .,.,
1737
-
1738
- module_eval(<<'.,.,', 'parser.y', 335)
1739
- def _reduce_143(val, _values, result)
1740
- result = make_node(:InterfaceTypeExtension, name: val[2], interfaces: val[3], directives: val[4], fields: [], position_source: val[0])
1741
- result
1742
- end
1743
- .,.,
1744
-
1745
- module_eval(<<'.,.,', 'parser.y', 336)
1746
- def _reduce_144(val, _values, result)
1747
- result = make_node(:InterfaceTypeExtension, name: val[2], interfaces: val[3], directives: [], fields: [], position_source: val[0])
1748
- result
1749
- end
1750
- .,.,
1751
-
1752
- module_eval(<<'.,.,', 'parser.y', 339)
1753
- def _reduce_145(val, _values, result)
1754
- result = make_node(:UnionTypeExtension, name: val[2], directives: val[3], types: val[5], position_source: val[0])
1755
- result
1756
- end
1757
- .,.,
1758
-
1759
- module_eval(<<'.,.,', 'parser.y', 340)
1760
- def _reduce_146(val, _values, result)
1761
- result = make_node(:UnionTypeExtension, name: val[2], directives: val[3], types: [], position_source: val[0])
1762
- result
1763
- end
1764
- .,.,
1765
-
1766
- module_eval(<<'.,.,', 'parser.y', 343)
1767
- def _reduce_147(val, _values, result)
1768
- result = make_node(:EnumTypeExtension, name: val[2], directives: val[3], values: val[5], position_source: val[0])
1769
- result
1770
- end
1771
- .,.,
1772
-
1773
- module_eval(<<'.,.,', 'parser.y', 344)
1774
- def _reduce_148(val, _values, result)
1775
- result = make_node(:EnumTypeExtension, name: val[2], directives: val[3], values: [], position_source: val[0])
1776
- result
1777
- end
1778
- .,.,
1779
-
1780
- module_eval(<<'.,.,', 'parser.y', 347)
1781
- def _reduce_149(val, _values, result)
1782
- result = make_node(:InputObjectTypeExtension, name: val[2], directives: val[3], fields: val[5], position_source: val[0])
1783
- result
1784
- end
1785
- .,.,
1786
-
1787
- module_eval(<<'.,.,', 'parser.y', 348)
1788
- def _reduce_150(val, _values, result)
1789
- result = make_node(:InputObjectTypeExtension, name: val[2], directives: val[3], fields: [], position_source: val[0])
1790
- result
1791
- end
1792
- .,.,
1793
-
1794
- # reduce 151 omitted
1795
-
1796
- # reduce 152 omitted
1797
-
1798
- # reduce 153 omitted
1799
-
1800
- module_eval(<<'.,.,', 'parser.y', 358)
1801
- def _reduce_154(val, _values, result)
1802
- result = make_node(:ScalarTypeDefinition, name: val[2], directives: val[3], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
1803
-
1804
- result
1805
- end
1806
- .,.,
1807
-
1808
- module_eval(<<'.,.,', 'parser.y', 363)
1809
- def _reduce_155(val, _values, result)
1810
- result = make_node(:ObjectTypeDefinition, name: val[2], interfaces: val[3], directives: val[4], fields: val[5], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
1811
-
1812
- result
1813
- end
1814
- .,.,
1815
-
1816
- module_eval(<<'.,.,', 'parser.y', 367)
1817
- def _reduce_156(val, _values, result)
1818
- result = EMPTY_ARRAY
1819
- result
1820
- end
1821
- .,.,
1822
-
1823
- # reduce 157 omitted
1824
-
1825
- module_eval(<<'.,.,', 'parser.y', 371)
1826
- def _reduce_158(val, _values, result)
1827
- result = val[2]
1828
- result
1829
- end
1830
- .,.,
1831
-
1832
- module_eval(<<'.,.,', 'parser.y', 372)
1833
- def _reduce_159(val, _values, result)
1834
- result = val[1]
1835
- result
1836
- end
1837
- .,.,
1838
-
1839
- module_eval(<<'.,.,', 'parser.y', 373)
1840
- def _reduce_160(val, _values, result)
1841
- result = val[1]
1842
- result
1843
- end
1844
- .,.,
1845
-
1846
- module_eval(<<'.,.,', 'parser.y', 376)
1847
- def _reduce_161(val, _values, result)
1848
- result = [make_node(:TypeName, name: val[0], position_source: val[0])]
1849
- result
1850
- end
1851
- .,.,
1852
-
1853
- module_eval(<<'.,.,', 'parser.y', 377)
1854
- def _reduce_162(val, _values, result)
1855
- val[0] << make_node(:TypeName, name: val[2], position_source: val[2])
1856
- result
1857
- end
1858
- .,.,
1859
-
1860
- module_eval(<<'.,.,', 'parser.y', 380)
1861
- def _reduce_163(val, _values, result)
1862
- result = [make_node(:TypeName, name: val[0], position_source: val[0])]
1863
- result
1864
- end
1865
- .,.,
1866
-
1867
- module_eval(<<'.,.,', 'parser.y', 381)
1868
- def _reduce_164(val, _values, result)
1869
- val[0] << make_node(:TypeName, name: val[1], position_source: val[1])
1870
- result
1871
- end
1872
- .,.,
1873
-
1874
- module_eval(<<'.,.,', 'parser.y', 385)
1875
- def _reduce_165(val, _values, result)
1876
- result = make_node(:InputValueDefinition, name: val[1], type: val[3], default_value: val[4], directives: val[5], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
1877
-
1878
- result
1879
- end
1880
- .,.,
1881
-
1882
- module_eval(<<'.,.,', 'parser.y', 389)
1883
- def _reduce_166(val, _values, result)
1884
- result = [val[0]]
1885
- result
1886
- end
1887
- .,.,
1888
-
1889
- module_eval(<<'.,.,', 'parser.y', 390)
1890
- def _reduce_167(val, _values, result)
1891
- val[0] << val[1]
1892
- result
1893
- end
1894
- .,.,
312
+ def parse_input_object_field_definitions
313
+ if at?(:LCURLY)
314
+ expect_token :LCURLY
315
+ list = []
316
+ while !at?(:RCURLY)
317
+ list << parse_input_value_definition
318
+ end
319
+ expect_token :RCURLY
320
+ list
321
+ else
322
+ EMPTY_ARRAY
323
+ end
324
+ end
1895
325
 
1896
- module_eval(<<'.,.,', 'parser.y', 393)
1897
- def _reduce_168(val, _values, result)
1898
- result = EMPTY_ARRAY
1899
- result
1900
- end
1901
- .,.,
326
+ def parse_enum_value_definitions
327
+ if at?(:LCURLY)
328
+ expect_token :LCURLY
329
+ list = []
330
+ while !at?(:RCURLY)
331
+ v_loc = pos
332
+ description = if at?(:STRING); string_value; end
333
+ defn_loc = pos
334
+ enum_value = expect_token_value(:IDENTIFIER)
335
+ v_directives = parse_directives
336
+ list << EnumValueDefinition.new(pos: v_loc, definition_pos: defn_loc, description: description, name: enum_value, directives: v_directives, filename: @filename, source_string: @graphql_str)
337
+ end
338
+ expect_token :RCURLY
339
+ list
340
+ else
341
+ EMPTY_ARRAY
342
+ end
343
+ end
1902
344
 
1903
- module_eval(<<'.,.,', 'parser.y', 394)
1904
- def _reduce_169(val, _values, result)
1905
- result = val[1]
1906
- result
1907
- end
1908
- .,.,
345
+ def parse_union_members
346
+ if at?(:EQUALS)
347
+ expect_token :EQUALS
348
+ list = [parse_type_name]
349
+ while at?(:PIPE)
350
+ advance_token
351
+ list << parse_type_name
352
+ end
353
+ list
354
+ else
355
+ EMPTY_ARRAY
356
+ end
357
+ end
1909
358
 
1910
- module_eval(<<'.,.,', 'parser.y', 398)
1911
- def _reduce_170(val, _values, result)
1912
- result = make_node(:FieldDefinition, name: val[1], arguments: val[2], type: val[4], directives: val[5], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
359
+ def parse_implements
360
+ if at?(:IMPLEMENTS)
361
+ advance_token
362
+ list = []
363
+ while true
364
+ advance_token if at?(:AMP)
365
+ break unless at?(:IDENTIFIER)
366
+ list << parse_type_name
367
+ end
368
+ list
369
+ else
370
+ EMPTY_ARRAY
371
+ end
372
+ end
1913
373
 
1914
- result
1915
- end
1916
- .,.,
374
+ def parse_field_definitions
375
+ expect_token :LCURLY
376
+ list = []
377
+ while !at?(:RCURLY)
378
+ loc = pos
379
+ description = if at?(:STRING); string_value; end
380
+ defn_loc = pos
381
+ name = parse_name
382
+ arguments_definition = parse_argument_definitions
383
+ expect_token :COLON
384
+ type = self.type
385
+ directives = parse_directives
386
+
387
+ list << FieldDefinition.new(pos: loc, definition_pos: defn_loc, description: description, name: name, arguments: arguments_definition, type: type, directives: directives, filename: @filename, source_string: @graphql_str)
388
+ end
389
+ expect_token :RCURLY
390
+ list
391
+ end
1917
392
 
1918
- module_eval(<<'.,.,', 'parser.y', 402)
1919
- def _reduce_171(val, _values, result)
1920
- result = EMPTY_ARRAY
1921
- result
1922
- end
1923
- .,.,
393
+ def parse_argument_definitions
394
+ if at?(:LPAREN)
395
+ advance_token
396
+ list = []
397
+ while !at?(:RPAREN)
398
+ list << parse_input_value_definition
399
+ end
400
+ expect_token :RPAREN
401
+ list
402
+ else
403
+ EMPTY_ARRAY
404
+ end
405
+ end
1924
406
 
1925
- module_eval(<<'.,.,', 'parser.y', 403)
1926
- def _reduce_172(val, _values, result)
1927
- result = val[1]
1928
- result
1929
- end
1930
- .,.,
407
+ def parse_input_value_definition
408
+ loc = pos
409
+ description = if at?(:STRING); string_value; end
410
+ defn_loc = pos
411
+ name = parse_name
412
+ expect_token :COLON
413
+ type = self.type
414
+ default_value = if at?(:EQUALS)
415
+ advance_token
416
+ value
417
+ else
418
+ nil
419
+ end
420
+ directives = parse_directives
421
+ InputValueDefinition.new(pos: loc, definition_pos: defn_loc, description: description, name: name, type: type, default_value: default_value, directives: directives, filename: @filename, source_string: @graphql_str)
422
+ end
1931
423
 
1932
- module_eval(<<'.,.,', 'parser.y', 406)
1933
- def _reduce_173(val, _values, result)
1934
- result = EMPTY_ARRAY
1935
- result
1936
- end
1937
- .,.,
424
+ def type
425
+ type = case token_name
426
+ when :IDENTIFIER
427
+ parse_type_name
428
+ when :LBRACKET
429
+ list_type
430
+ end
431
+
432
+ if at?(:BANG)
433
+ type = Nodes::NonNullType.new(pos: pos, of_type: type)
434
+ expect_token(:BANG)
435
+ end
436
+ type
437
+ end
1938
438
 
1939
- module_eval(<<'.,.,', 'parser.y', 407)
1940
- def _reduce_174(val, _values, result)
1941
- result = [val[0]]
1942
- result
1943
- end
1944
- .,.,
439
+ def list_type
440
+ loc = pos
441
+ expect_token(:LBRACKET)
442
+ type = Nodes::ListType.new(pos: loc, of_type: self.type)
443
+ expect_token(:RBRACKET)
444
+ type
445
+ end
1945
446
 
1946
- module_eval(<<'.,.,', 'parser.y', 408)
1947
- def _reduce_175(val, _values, result)
1948
- val[0] << val[1]
1949
- result
1950
- end
1951
- .,.,
447
+ def parse_operation_type
448
+ val = if at?(:QUERY)
449
+ "query"
450
+ elsif at?(:MUTATION)
451
+ "mutation"
452
+ elsif at?(:SUBSCRIPTION)
453
+ "subscription"
454
+ else
455
+ expect_one_of([:QUERY, :MUTATION, :SUBSCRIPTION])
456
+ end
457
+ advance_token
458
+ val
459
+ end
1952
460
 
1953
- module_eval(<<'.,.,', 'parser.y', 412)
1954
- def _reduce_176(val, _values, result)
1955
- result = make_node(:InterfaceTypeDefinition, name: val[2], interfaces: val[3], directives: val[4], fields: val[5], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
461
+ def selection_set
462
+ expect_token(:LCURLY)
463
+ selections = []
464
+ while @token_name != :RCURLY
465
+ selections << if at?(:ELLIPSIS)
466
+ loc = pos
467
+ advance_token
468
+ case token_name
469
+ when :ON, :DIR_SIGN, :LCURLY
470
+ if_type = if at?(:ON)
471
+ advance_token
472
+ parse_type_name
473
+ else
474
+ nil
475
+ end
476
+
477
+ directives = parse_directives
478
+
479
+ Nodes::InlineFragment.new(pos: loc, type: if_type, directives: directives, selections: selection_set, filename: @filename, source_string: @graphql_str)
480
+ else
481
+ name = parse_name_without_on
482
+ directives = parse_directives
483
+
484
+ # Can this ever happen?
485
+ # expect_token(:IDENTIFIER) if at?(:ON)
486
+
487
+ FragmentSpread.new(pos: loc, name: name, directives: directives, filename: @filename, source_string: @graphql_str)
488
+ end
489
+ else
490
+ loc = pos
491
+ name = parse_name
492
+
493
+ field_alias = nil
494
+
495
+ if at?(:COLON)
496
+ advance_token
497
+ field_alias = name
498
+ name = parse_name
499
+ end
500
+
501
+ arguments = at?(:LPAREN) ? parse_arguments : nil
502
+ directives = at?(:DIR_SIGN) ? parse_directives : nil
503
+ selection_set = at?(:LCURLY) ? self.selection_set : nil
504
+
505
+ Nodes::Field.new(pos: loc, field_alias: field_alias, name: name, arguments: arguments, directives: directives, selections: selection_set, filename: @filename, source_string: @graphql_str)
506
+ end
507
+ end
508
+ expect_token(:RCURLY)
509
+ selections
510
+ end
1956
511
 
1957
- result
1958
- end
1959
- .,.,
512
+ def parse_name
513
+ case token_name
514
+ when :IDENTIFIER
515
+ expect_token_value(:IDENTIFIER)
516
+ when :SCHEMA
517
+ advance_token
518
+ "schema"
519
+ when :SCALAR
520
+ advance_token
521
+ "scalar"
522
+ when :IMPLEMENTS
523
+ advance_token
524
+ "implements"
525
+ when :INTERFACE
526
+ advance_token
527
+ "interface"
528
+ when :UNION
529
+ advance_token
530
+ "union"
531
+ when :ENUM
532
+ advance_token
533
+ "enum"
534
+ when :INPUT
535
+ advance_token
536
+ "input"
537
+ when :DIRECTIVE
538
+ advance_token
539
+ "directive"
540
+ when :TYPE
541
+ advance_token
542
+ "type"
543
+ when :QUERY
544
+ advance_token
545
+ "query"
546
+ when :MUTATION
547
+ advance_token
548
+ "mutation"
549
+ when :SUBSCRIPTION
550
+ advance_token
551
+ "subscription"
552
+ when :TRUE
553
+ advance_token
554
+ "true"
555
+ when :FALSE
556
+ advance_token
557
+ "false"
558
+ when :FRAGMENT
559
+ advance_token
560
+ "fragment"
561
+ when :REPEATABLE
562
+ advance_token
563
+ "repeatable"
564
+ when :NULL
565
+ advance_token
566
+ "null"
567
+ else
568
+ expect_token(:NAME)
569
+ end
570
+ end
1960
571
 
1961
- module_eval(<<'.,.,', 'parser.y', 416)
1962
- def _reduce_177(val, _values, result)
1963
- result = [make_node(:TypeName, name: val[0], position_source: val[0])]
1964
- result
1965
- end
1966
- .,.,
572
+ def parse_name_without_on
573
+ if at?(:ON)
574
+ expect_token(:IDENTIFIER)
575
+ else
576
+ parse_name
577
+ end
578
+ end
1967
579
 
1968
- module_eval(<<'.,.,', 'parser.y', 417)
1969
- def _reduce_178(val, _values, result)
1970
- val[0] << make_node(:TypeName, name: val[2], position_source: val[2])
1971
- result
1972
- end
1973
- .,.,
580
+ # Any identifier, but not true, false, or null
581
+ def parse_enum_name
582
+ if at?(:TRUE) || at?(:FALSE) || at?(:NULL)
583
+ expect_token(:IDENTIFIER)
584
+ else
585
+ parse_name
586
+ end
587
+ end
1974
588
 
1975
- module_eval(<<'.,.,', 'parser.y', 421)
1976
- def _reduce_179(val, _values, result)
1977
- result = make_node(:UnionTypeDefinition, name: val[2], directives: val[3], types: val[5], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
589
+ def parse_type_name
590
+ TypeName.new(pos: pos, name: parse_name, filename: @filename, source_string: @graphql_str)
591
+ end
1978
592
 
1979
- result
1980
- end
1981
- .,.,
593
+ def parse_directives
594
+ if at?(:DIR_SIGN)
595
+ dirs = []
596
+ while at?(:DIR_SIGN)
597
+ loc = pos
598
+ advance_token
599
+ name = parse_name
600
+ arguments = parse_arguments
601
+
602
+ dirs << Nodes::Directive.new(pos: loc, name: name, arguments: arguments, filename: @filename, source_string: @graphql_str)
603
+ end
604
+ dirs
605
+ else
606
+ EMPTY_ARRAY
607
+ end
608
+ end
1982
609
 
1983
- module_eval(<<'.,.,', 'parser.y', 426)
1984
- def _reduce_180(val, _values, result)
1985
- result = make_node(:EnumTypeDefinition, name: val[2], directives: val[3], values: val[5], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
610
+ def parse_arguments
611
+ if at?(:LPAREN)
612
+ advance_token
613
+ args = []
614
+ while !at?(:RPAREN)
615
+ loc = pos
616
+ name = parse_name
617
+ expect_token(:COLON)
618
+ args << Nodes::Argument.new(pos: loc, name: name, value: value, filename: @filename, source_string: @graphql_str)
619
+ end
620
+ if args.empty?
621
+ expect_token(:ARGUMENT_NAME) # At least one argument is required
622
+ end
623
+ expect_token(:RPAREN)
624
+ args
625
+ else
626
+ EMPTY_ARRAY
627
+ end
628
+ end
1986
629
 
1987
- result
1988
- end
1989
- .,.,
630
+ def string_value
631
+ token_value = @lexer.string_value
632
+ expect_token :STRING
633
+ token_value
634
+ end
1990
635
 
1991
- module_eval(<<'.,.,', 'parser.y', 431)
1992
- def _reduce_181(val, _values, result)
1993
- result = make_node(:InputObjectTypeDefinition, name: val[2], directives: val[3], fields: val[5], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
636
+ def value
637
+ case token_name
638
+ when :INT
639
+ expect_token_value(:INT).to_i
640
+ when :FLOAT
641
+ expect_token_value(:FLOAT).to_f
642
+ when :STRING
643
+ string_value
644
+ when :TRUE
645
+ advance_token
646
+ true
647
+ when :FALSE
648
+ advance_token
649
+ false
650
+ when :NULL
651
+ advance_token
652
+ NullValue.new(pos: pos, name: "null", filename: @filename, source_string: @graphql_str)
653
+ when :IDENTIFIER
654
+ Nodes::Enum.new(pos: pos, name: expect_token_value(:IDENTIFIER), filename: @filename, source_string: @graphql_str)
655
+ when :LBRACKET
656
+ advance_token
657
+ list = []
658
+ while !at?(:RBRACKET)
659
+ list << value
660
+ end
661
+ expect_token(:RBRACKET)
662
+ list
663
+ when :LCURLY
664
+ start = pos
665
+ advance_token
666
+ args = []
667
+ while !at?(:RCURLY)
668
+ loc = pos
669
+ n = parse_name
670
+ expect_token(:COLON)
671
+ args << Argument.new(pos: loc, name: n, value: value, filename: @filename, source_string: @graphql_str)
672
+ end
673
+ expect_token(:RCURLY)
674
+ InputObject.new(pos: start, arguments: args, filename: @filename, source_string: @graphql_str)
675
+ when :VAR_SIGN
676
+ loc = pos
677
+ advance_token
678
+ VariableIdentifier.new(pos: loc, name: parse_name, filename: @filename, source_string: @graphql_str)
679
+ else
680
+ expect_token(:VALUE)
681
+ end
682
+ end
1994
683
 
1995
- result
1996
- end
1997
- .,.,
684
+ def at?(expected_token_name)
685
+ @token_name == expected_token_name
686
+ end
1998
687
 
1999
- module_eval(<<'.,.,', 'parser.y', 436)
2000
- def _reduce_182(val, _values, result)
2001
- result = make_node(:DirectiveDefinition, name: val[3], arguments: val[4], locations: val[7], repeatable: !!val[5], description: val[0] || get_description(val[1]), definition_line: val[1][1], position_source: val[0] || val[1])
688
+ def expect_token(expected_token_name)
689
+ unless @token_name == expected_token_name
690
+ raise_parse_error("Expected #{expected_token_name}, actual: #{token_name || "(none)"} (#{debug_token_value.inspect})")
691
+ end
692
+ advance_token
693
+ end
2002
694
 
2003
- result
2004
- end
2005
- .,.,
695
+ def expect_one_of(token_names)
696
+ raise_parse_error("Expected one of #{token_names.join(", ")}, actual: #{token_name || "NOTHING"} (#{debug_token_value.inspect})")
697
+ end
2006
698
 
2007
- # reduce 183 omitted
699
+ def raise_parse_error(message)
700
+ message += " at [#{@lexer.line_number}, #{@lexer.column_number}]"
701
+ raise GraphQL::ParseError.new(
702
+ message,
703
+ @lexer.line_number,
704
+ @lexer.column_number,
705
+ @graphql_str,
706
+ filename: @filename,
707
+ )
2008
708
 
2009
- # reduce 184 omitted
709
+ end
2010
710
 
2011
- module_eval(<<'.,.,', 'parser.y', 444)
2012
- def _reduce_185(val, _values, result)
2013
- result = [make_node(:DirectiveLocation, name: val[0][3], position_source: val[0])]
2014
- result
2015
- end
2016
- .,.,
711
+ # Only use when we care about the expected token's value
712
+ def expect_token_value(tok)
713
+ token_value = @lexer.token_value
714
+ expect_token(tok)
715
+ token_value
716
+ end
2017
717
 
2018
- module_eval(<<'.,.,', 'parser.y', 445)
2019
- def _reduce_186(val, _values, result)
2020
- val[0] << make_node(:DirectiveLocation, name: val[2][3], position_source: val[2])
2021
- result
718
+ # token_value works for when the scanner matched something
719
+ # which is usually fine and it's good for it to be fast at that.
720
+ def debug_token_value
721
+ if token_name && Lexer::Punctuation.const_defined?(token_name)
722
+ Lexer::Punctuation.const_get(token_name)
723
+ elsif token_name == :ELLIPSIS
724
+ "..."
725
+ else
726
+ @lexer.token_value
727
+ end
728
+ end
729
+ end
2022
730
  end
2023
- .,.,
2024
-
2025
- def _reduce_none(val, _values, result)
2026
- val[0]
2027
731
  end
2028
-
2029
- end # class Parser
2030
- end # module Language
2031
- end # module GraphQL