graphql 2.0.27 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/install/templates/base_mutation.erb +2 -0
  3. data/lib/generators/graphql/install/templates/mutation_type.erb +2 -0
  4. data/lib/generators/graphql/install_generator.rb +3 -0
  5. data/lib/generators/graphql/templates/base_argument.erb +2 -0
  6. data/lib/generators/graphql/templates/base_connection.erb +2 -0
  7. data/lib/generators/graphql/templates/base_edge.erb +2 -0
  8. data/lib/generators/graphql/templates/base_enum.erb +2 -0
  9. data/lib/generators/graphql/templates/base_field.erb +2 -0
  10. data/lib/generators/graphql/templates/base_input_object.erb +2 -0
  11. data/lib/generators/graphql/templates/base_interface.erb +2 -0
  12. data/lib/generators/graphql/templates/base_object.erb +2 -0
  13. data/lib/generators/graphql/templates/base_resolver.erb +6 -0
  14. data/lib/generators/graphql/templates/base_scalar.erb +2 -0
  15. data/lib/generators/graphql/templates/base_union.erb +2 -0
  16. data/lib/generators/graphql/templates/graphql_controller.erb +2 -0
  17. data/lib/generators/graphql/templates/loader.erb +2 -0
  18. data/lib/generators/graphql/templates/mutation.erb +2 -0
  19. data/lib/generators/graphql/templates/node_type.erb +2 -0
  20. data/lib/generators/graphql/templates/query_type.erb +2 -0
  21. data/lib/generators/graphql/templates/schema.erb +2 -0
  22. data/lib/graphql/analysis/ast/analyzer.rb +7 -0
  23. data/lib/graphql/analysis/ast/field_usage.rb +32 -7
  24. data/lib/graphql/analysis/ast/query_complexity.rb +80 -128
  25. data/lib/graphql/analysis/ast/query_depth.rb +7 -2
  26. data/lib/graphql/analysis/ast/visitor.rb +2 -2
  27. data/lib/graphql/analysis/ast.rb +21 -11
  28. data/lib/graphql/backtrace/trace.rb +12 -15
  29. data/lib/graphql/coercion_error.rb +1 -9
  30. data/lib/graphql/dataloader/async_dataloader.rb +85 -0
  31. data/lib/graphql/dataloader/source.rb +11 -3
  32. data/lib/graphql/dataloader.rb +109 -142
  33. data/lib/graphql/duration_encoding_error.rb +16 -0
  34. data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +170 -0
  35. data/lib/graphql/execution/interpreter/runtime.rb +70 -248
  36. data/lib/graphql/execution/interpreter.rb +91 -157
  37. data/lib/graphql/execution/lookahead.rb +88 -21
  38. data/lib/graphql/introspection/dynamic_fields.rb +1 -1
  39. data/lib/graphql/introspection/entry_points.rb +11 -5
  40. data/lib/graphql/introspection/schema_type.rb +3 -1
  41. data/lib/graphql/language/block_string.rb +34 -18
  42. data/lib/graphql/language/definition_slice.rb +1 -1
  43. data/lib/graphql/language/document_from_schema_definition.rb +37 -37
  44. data/lib/graphql/language/lexer.rb +271 -177
  45. data/lib/graphql/language/nodes.rb +74 -56
  46. data/lib/graphql/language/parser.rb +697 -1986
  47. data/lib/graphql/language/printer.rb +299 -146
  48. data/lib/graphql/language/sanitized_printer.rb +20 -22
  49. data/lib/graphql/language/static_visitor.rb +167 -0
  50. data/lib/graphql/language/visitor.rb +20 -81
  51. data/lib/graphql/language.rb +1 -0
  52. data/lib/graphql/load_application_object_failed_error.rb +5 -1
  53. data/lib/graphql/pagination/array_connection.rb +3 -3
  54. data/lib/graphql/pagination/connection.rb +28 -1
  55. data/lib/graphql/pagination/mongoid_relation_connection.rb +1 -2
  56. data/lib/graphql/pagination/relation_connection.rb +3 -3
  57. data/lib/graphql/query/context/scoped_context.rb +101 -0
  58. data/lib/graphql/query/context.rb +36 -98
  59. data/lib/graphql/query/null_context.rb +4 -11
  60. data/lib/graphql/query/validation_pipeline.rb +2 -2
  61. data/lib/graphql/query/variables.rb +3 -3
  62. data/lib/graphql/query.rb +13 -22
  63. data/lib/graphql/railtie.rb +9 -6
  64. data/lib/graphql/rake_task.rb +3 -12
  65. data/lib/graphql/schema/argument.rb +6 -1
  66. data/lib/graphql/schema/build_from_definition.rb +0 -11
  67. data/lib/graphql/schema/directive/one_of.rb +12 -0
  68. data/lib/graphql/schema/directive/specified_by.rb +14 -0
  69. data/lib/graphql/schema/directive.rb +1 -1
  70. data/lib/graphql/schema/enum.rb +3 -3
  71. data/lib/graphql/schema/field/connection_extension.rb +1 -15
  72. data/lib/graphql/schema/field/scope_extension.rb +8 -1
  73. data/lib/graphql/schema/field.rb +8 -5
  74. data/lib/graphql/schema/has_single_input_argument.rb +156 -0
  75. data/lib/graphql/schema/input_object.rb +2 -2
  76. data/lib/graphql/schema/interface.rb +10 -10
  77. data/lib/graphql/schema/introspection_system.rb +2 -0
  78. data/lib/graphql/schema/loader.rb +0 -2
  79. data/lib/graphql/schema/member/base_dsl_methods.rb +2 -1
  80. data/lib/graphql/schema/member/has_arguments.rb +61 -38
  81. data/lib/graphql/schema/member/has_fields.rb +8 -5
  82. data/lib/graphql/schema/member/has_interfaces.rb +23 -9
  83. data/lib/graphql/schema/member/scoped.rb +19 -0
  84. data/lib/graphql/schema/member/validates_input.rb +3 -3
  85. data/lib/graphql/schema/object.rb +8 -0
  86. data/lib/graphql/schema/printer.rb +8 -7
  87. data/lib/graphql/schema/relay_classic_mutation.rb +6 -128
  88. data/lib/graphql/schema/resolver.rb +7 -3
  89. data/lib/graphql/schema/scalar.rb +3 -3
  90. data/lib/graphql/schema/subscription.rb +11 -4
  91. data/lib/graphql/schema/union.rb +1 -1
  92. data/lib/graphql/schema/warden.rb +96 -94
  93. data/lib/graphql/schema.rb +219 -72
  94. data/lib/graphql/static_validation/all_rules.rb +1 -1
  95. data/lib/graphql/static_validation/base_visitor.rb +1 -1
  96. data/lib/graphql/static_validation/literal_validator.rb +1 -1
  97. data/lib/graphql/static_validation/rules/fields_will_merge.rb +1 -1
  98. data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +1 -1
  99. data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +1 -1
  100. data/lib/graphql/static_validation/validation_context.rb +5 -5
  101. data/lib/graphql/static_validation/validator.rb +3 -0
  102. data/lib/graphql/static_validation.rb +0 -1
  103. data/lib/graphql/subscriptions/action_cable_subscriptions.rb +3 -2
  104. data/lib/graphql/subscriptions/event.rb +8 -2
  105. data/lib/graphql/subscriptions.rb +14 -12
  106. data/lib/graphql/testing/helpers.rb +125 -0
  107. data/lib/graphql/testing.rb +2 -0
  108. data/lib/graphql/tracing/appoptics_trace.rb +2 -2
  109. data/lib/graphql/tracing/appoptics_tracing.rb +2 -2
  110. data/lib/graphql/tracing/data_dog_trace.rb +21 -34
  111. data/lib/graphql/tracing/data_dog_tracing.rb +7 -21
  112. data/lib/graphql/tracing/legacy_hooks_trace.rb +74 -0
  113. data/lib/graphql/tracing/platform_tracing.rb +2 -0
  114. data/lib/graphql/tracing/{prometheus_tracing → prometheus_trace}/graphql_collector.rb +3 -1
  115. data/lib/graphql/tracing/sentry_trace.rb +94 -0
  116. data/lib/graphql/tracing/trace.rb +1 -0
  117. data/lib/graphql/tracing.rb +3 -1
  118. data/lib/graphql/types/iso_8601_duration.rb +77 -0
  119. data/lib/graphql/types/relay/connection_behaviors.rb +32 -2
  120. data/lib/graphql/types/relay/edge_behaviors.rb +7 -0
  121. data/lib/graphql/types.rb +1 -0
  122. data/lib/graphql/version.rb +1 -1
  123. data/lib/graphql.rb +3 -3
  124. data/readme.md +12 -2
  125. metadata +33 -25
  126. data/lib/graphql/deprecation.rb +0 -9
  127. data/lib/graphql/filter.rb +0 -59
  128. data/lib/graphql/language/parser.y +0 -560
  129. data/lib/graphql/static_validation/type_stack.rb +0 -216
  130. data/lib/graphql/subscriptions/instrumentation.rb +0 -28
@@ -1,2031 +1,742 @@
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
+ defns = []
66
+ if any_tokens
67
+ defns << definition
68
+ else
69
+ # Only ignored characters is not a valid document
70
+ raise GraphQL::ParseError.new("Unexpected end of document", nil, nil, @graphql_str)
71
+ end
72
+ while !@lexer.eos?
73
+ defns << definition
74
+ end
75
+ Document.new(pos: 0, definitions: defns, filename: @filename, source_string: @graphql_str)
76
+ end
1232
77
 
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
- }
78
+ def definition
79
+ case token_name
80
+ when :FRAGMENT
81
+ loc = pos
82
+ expect_token :FRAGMENT
83
+ f_name = if !at?(:ON)
84
+ parse_name
85
+ end
86
+ expect_token :ON
87
+ f_type = parse_type_name
88
+ directives = parse_directives
89
+ selections = selection_set
90
+ Nodes::FragmentDefinition.new(
91
+ pos: loc,
92
+ name: f_name,
93
+ type: f_type,
94
+ directives: directives,
95
+ selections: selections,
96
+ filename: @filename,
97
+ source_string: @graphql_str
98
+ )
99
+ when :QUERY, :MUTATION, :SUBSCRIPTION, :LCURLY
100
+ op_loc = pos
101
+ op_type = case token_name
102
+ when :LCURLY
103
+ "query"
104
+ else
105
+ parse_operation_type
106
+ end
107
+
108
+ op_name = at?(:IDENTIFIER) ? parse_name : nil
109
+
110
+ variable_definitions = if at?(:LPAREN)
111
+ expect_token(:LPAREN)
112
+ defs = []
113
+ while !at?(:RPAREN)
114
+ loc = pos
115
+ expect_token(:VAR_SIGN)
116
+ var_name = parse_name
117
+ expect_token(:COLON)
118
+ var_type = self.type
119
+ default_value = if at?(:EQUALS)
120
+ advance_token
121
+ value
122
+ end
123
+
124
+ defs << Nodes::VariableDefinition.new(pos: loc, name: var_name, type: var_type, default_value: default_value, filename: @filename, source_string: @graphql_str)
125
+ end
126
+ expect_token(:RPAREN)
127
+ defs
128
+ else
129
+ EmptyObjects::EMPTY_ARRAY
130
+ end
131
+
132
+ directives = parse_directives
133
+
134
+ OperationDefinition.new(
135
+ pos: op_loc,
136
+ operation_type: op_type,
137
+ name: op_name,
138
+ variables: variable_definitions,
139
+ directives: directives,
140
+ selections: selection_set,
141
+ filename: @filename,
142
+ source_string: @graphql_str
143
+ )
144
+ when :EXTEND
145
+ loc = pos
146
+ advance_token
147
+ case token_name
148
+ when :SCALAR
149
+ advance_token
150
+ name = parse_name
151
+ directives = parse_directives
152
+ ScalarTypeExtension.new(pos: loc, name: name, directives: directives, filename: @filename, source_string: @graphql_str)
153
+ when :TYPE
154
+ advance_token
155
+ name = parse_name
156
+ implements_interfaces = parse_implements
157
+ directives = parse_directives
158
+ field_defns = at?(:LCURLY) ? parse_field_definitions : EMPTY_ARRAY
159
+
160
+ ObjectTypeExtension.new(pos: loc, name: name, interfaces: implements_interfaces, directives: directives, fields: field_defns, filename: @filename, source_string: @graphql_str)
161
+ when :INTERFACE
162
+ advance_token
163
+ name = parse_name
164
+ directives = parse_directives
165
+ interfaces = parse_implements
166
+ fields_definition = at?(:LCURLY) ? parse_field_definitions : EMPTY_ARRAY
167
+ InterfaceTypeExtension.new(pos: loc, name: name, directives: directives, fields: fields_definition, interfaces: interfaces, filename: @filename, source_string: @graphql_str)
168
+ when :UNION
169
+ advance_token
170
+ name = parse_name
171
+ directives = parse_directives
172
+ union_member_types = parse_union_members
173
+ UnionTypeExtension.new(pos: loc, name: name, directives: directives, types: union_member_types, filename: @filename, source_string: @graphql_str)
174
+ when :ENUM
175
+ advance_token
176
+ name = parse_name
177
+ directives = parse_directives
178
+ enum_values_definition = parse_enum_value_definitions
179
+ Nodes::EnumTypeExtension.new(pos: loc, name: name, directives: directives, values: enum_values_definition, filename: @filename, source_string: @graphql_str)
180
+ when :INPUT
181
+ advance_token
182
+ name = parse_name
183
+ directives = parse_directives
184
+ input_fields_definition = parse_input_object_field_definitions
185
+ InputObjectTypeExtension.new(pos: loc, name: name, directives: directives, fields: input_fields_definition, filename: @filename, source_string: @graphql_str)
186
+ when :SCHEMA
187
+ advance_token
188
+ directives = parse_directives
189
+ query = mutation = subscription = nil
190
+ if at?(:LCURLY)
191
+ advance_token
192
+ while !at?(:RCURLY)
193
+ if at?(:QUERY)
194
+ advance_token
195
+ expect_token(:COLON)
196
+ query = parse_name
197
+ elsif at?(:MUTATION)
198
+ advance_token
199
+ expect_token(:COLON)
200
+ mutation = parse_name
201
+ elsif at?(:SUBSCRIPTION)
202
+ advance_token
203
+ expect_token(:COLON)
204
+ subscription = parse_name
205
+ else
206
+ expect_one_of([:QUERY, :MUTATION, :SUBSCRIPTION])
207
+ end
208
+ end
209
+ expect_token :RCURLY
210
+ end
211
+ SchemaExtension.new(
212
+ subscription: subscription,
213
+ mutation: mutation,
214
+ query: query,
215
+ directives: directives,
216
+ pos: loc,
217
+ filename: @filename,
218
+ source_string: @graphql_str,
1244
219
  )
220
+ else
221
+ expect_one_of([:SCHEMA, :SCALAR, :TYPE, :ENUM, :INPUT, :UNION, :INTERFACE])
222
+ end
223
+ else
224
+ loc = pos
225
+ desc = at?(:STRING) ? string_value : nil
226
+ defn_loc = pos
227
+ case token_name
228
+ when :SCHEMA
229
+ advance_token
230
+ directives = parse_directives
231
+ query = mutation = subscription = nil
232
+ expect_token :LCURLY
233
+ while !at?(:RCURLY)
234
+ if at?(:QUERY)
235
+ advance_token
236
+ expect_token(:COLON)
237
+ query = parse_name
238
+ elsif at?(:MUTATION)
239
+ advance_token
240
+ expect_token(:COLON)
241
+ mutation = parse_name
242
+ elsif at?(:SUBSCRIPTION)
243
+ advance_token
244
+ expect_token(:COLON)
245
+ subscription = parse_name
246
+ else
247
+ expect_one_of([:QUERY, :MUTATION, :SUBSCRIPTION])
248
+ end
249
+ end
250
+ expect_token :RCURLY
251
+ SchemaDefinition.new(pos: loc, definition_pos: defn_loc, query: query, mutation: mutation, subscription: subscription, directives: directives, filename: @filename, source_string: @graphql_str)
252
+ when :DIRECTIVE
253
+ advance_token
254
+ expect_token :DIR_SIGN
255
+ name = parse_name
256
+ arguments_definition = parse_argument_definitions
257
+ repeatable = if at?(:REPEATABLE)
258
+ advance_token
259
+ true
260
+ else
261
+ false
262
+ end
263
+ expect_token :ON
264
+ directive_locations = [DirectiveLocation.new(pos: pos, name: parse_name, filename: @filename, source_string: @graphql_str)]
265
+ while at?(:PIPE)
266
+ advance_token
267
+ directive_locations << DirectiveLocation.new(pos: pos, name: parse_name, filename: @filename, source_string: @graphql_str)
268
+ end
269
+ 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)
270
+ when :TYPE
271
+ advance_token
272
+ name = parse_name
273
+ implements_interfaces = parse_implements
274
+ directives = parse_directives
275
+ field_defns = at?(:LCURLY) ? parse_field_definitions : EMPTY_ARRAY
276
+
277
+ 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)
278
+ when :INTERFACE
279
+ advance_token
280
+ name = parse_name
281
+ interfaces = parse_implements
282
+ directives = parse_directives
283
+ fields_definition = parse_field_definitions
284
+ 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)
285
+ when :UNION
286
+ advance_token
287
+ name = parse_name
288
+ directives = parse_directives
289
+ union_member_types = parse_union_members
290
+ UnionTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, directives: directives, types: union_member_types, filename: @filename, source_string: @graphql_str)
291
+ when :SCALAR
292
+ advance_token
293
+ name = parse_name
294
+ directives = parse_directives
295
+ ScalarTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, directives: directives, filename: @filename, source_string: @graphql_str)
296
+ when :ENUM
297
+ advance_token
298
+ name = parse_name
299
+ directives = parse_directives
300
+ enum_values_definition = parse_enum_value_definitions
301
+ 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)
302
+ when :INPUT
303
+ advance_token
304
+ name = parse_name
305
+ directives = parse_directives
306
+ input_fields_definition = parse_input_object_field_definitions
307
+ InputObjectTypeDefinition.new(pos: loc, definition_pos: defn_loc, description: desc, name: name, directives: directives, fields: input_fields_definition, filename: @filename, source_string: @graphql_str)
308
+ else
309
+ expect_one_of([:SCHEMA, :SCALAR, :TYPE, :ENUM, :INPUT, :UNION, :INTERFACE])
310
+ end
311
+ end
312
+ end
1245
313
 
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
- .,.,
314
+ def parse_input_object_field_definitions
315
+ if at?(:LCURLY)
316
+ expect_token :LCURLY
317
+ list = []
318
+ while !at?(:RCURLY)
319
+ list << parse_input_value_definition
320
+ end
321
+ expect_token :RCURLY
322
+ list
323
+ else
324
+ EMPTY_ARRAY
325
+ end
326
+ end
1895
327
 
1896
- module_eval(<<'.,.,', 'parser.y', 393)
1897
- def _reduce_168(val, _values, result)
1898
- result = EMPTY_ARRAY
1899
- result
1900
- end
1901
- .,.,
328
+ def parse_enum_value_definitions
329
+ if at?(:LCURLY)
330
+ expect_token :LCURLY
331
+ list = []
332
+ while !at?(:RCURLY)
333
+ v_loc = pos
334
+ description = if at?(:STRING); string_value; end
335
+ defn_loc = pos
336
+ enum_value = parse_enum_name
337
+ v_directives = parse_directives
338
+ list << EnumValueDefinition.new(pos: v_loc, definition_pos: defn_loc, description: description, name: enum_value, directives: v_directives, filename: @filename, source_string: @graphql_str)
339
+ end
340
+ expect_token :RCURLY
341
+ list
342
+ else
343
+ EMPTY_ARRAY
344
+ end
345
+ end
1902
346
 
1903
- module_eval(<<'.,.,', 'parser.y', 394)
1904
- def _reduce_169(val, _values, result)
1905
- result = val[1]
1906
- result
1907
- end
1908
- .,.,
347
+ def parse_union_members
348
+ if at?(:EQUALS)
349
+ expect_token :EQUALS
350
+ list = [parse_type_name]
351
+ while at?(:PIPE)
352
+ advance_token
353
+ list << parse_type_name
354
+ end
355
+ list
356
+ else
357
+ EMPTY_ARRAY
358
+ end
359
+ end
1909
360
 
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])
361
+ def parse_implements
362
+ if at?(:IMPLEMENTS)
363
+ advance_token
364
+ list = []
365
+ while true
366
+ advance_token if at?(:AMP)
367
+ break unless at?(:IDENTIFIER)
368
+ list << parse_type_name
369
+ end
370
+ list
371
+ else
372
+ EMPTY_ARRAY
373
+ end
374
+ end
1913
375
 
1914
- result
1915
- end
1916
- .,.,
376
+ def parse_field_definitions
377
+ expect_token :LCURLY
378
+ list = []
379
+ while !at?(:RCURLY)
380
+ loc = pos
381
+ description = if at?(:STRING); string_value; end
382
+ defn_loc = pos
383
+ name = parse_name
384
+ arguments_definition = parse_argument_definitions
385
+ expect_token :COLON
386
+ type = self.type
387
+ directives = parse_directives
388
+
389
+ 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)
390
+ end
391
+ expect_token :RCURLY
392
+ list
393
+ end
1917
394
 
1918
- module_eval(<<'.,.,', 'parser.y', 402)
1919
- def _reduce_171(val, _values, result)
1920
- result = EMPTY_ARRAY
1921
- result
1922
- end
1923
- .,.,
395
+ def parse_argument_definitions
396
+ if at?(:LPAREN)
397
+ advance_token
398
+ list = []
399
+ while !at?(:RPAREN)
400
+ list << parse_input_value_definition
401
+ end
402
+ expect_token :RPAREN
403
+ list
404
+ else
405
+ EMPTY_ARRAY
406
+ end
407
+ end
1924
408
 
1925
- module_eval(<<'.,.,', 'parser.y', 403)
1926
- def _reduce_172(val, _values, result)
1927
- result = val[1]
1928
- result
1929
- end
1930
- .,.,
409
+ def parse_input_value_definition
410
+ loc = pos
411
+ description = if at?(:STRING); string_value; end
412
+ defn_loc = pos
413
+ name = parse_name
414
+ expect_token :COLON
415
+ type = self.type
416
+ default_value = if at?(:EQUALS)
417
+ advance_token
418
+ value
419
+ else
420
+ nil
421
+ end
422
+ directives = parse_directives
423
+ 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)
424
+ end
1931
425
 
1932
- module_eval(<<'.,.,', 'parser.y', 406)
1933
- def _reduce_173(val, _values, result)
1934
- result = EMPTY_ARRAY
1935
- result
1936
- end
1937
- .,.,
426
+ def type
427
+ type = case token_name
428
+ when :IDENTIFIER
429
+ parse_type_name
430
+ when :LBRACKET
431
+ list_type
432
+ end
433
+
434
+ if at?(:BANG)
435
+ type = Nodes::NonNullType.new(pos: pos, of_type: type)
436
+ expect_token(:BANG)
437
+ end
438
+ type
439
+ end
1938
440
 
1939
- module_eval(<<'.,.,', 'parser.y', 407)
1940
- def _reduce_174(val, _values, result)
1941
- result = [val[0]]
1942
- result
1943
- end
1944
- .,.,
441
+ def list_type
442
+ loc = pos
443
+ expect_token(:LBRACKET)
444
+ type = Nodes::ListType.new(pos: loc, of_type: self.type)
445
+ expect_token(:RBRACKET)
446
+ type
447
+ end
1945
448
 
1946
- module_eval(<<'.,.,', 'parser.y', 408)
1947
- def _reduce_175(val, _values, result)
1948
- val[0] << val[1]
1949
- result
1950
- end
1951
- .,.,
449
+ def parse_operation_type
450
+ val = if at?(:QUERY)
451
+ "query"
452
+ elsif at?(:MUTATION)
453
+ "mutation"
454
+ elsif at?(:SUBSCRIPTION)
455
+ "subscription"
456
+ else
457
+ expect_one_of([:QUERY, :MUTATION, :SUBSCRIPTION])
458
+ end
459
+ advance_token
460
+ val
461
+ end
1952
462
 
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])
463
+ def selection_set
464
+ expect_token(:LCURLY)
465
+ selections = []
466
+ while @token_name != :RCURLY
467
+ selections << if at?(:ELLIPSIS)
468
+ loc = pos
469
+ advance_token
470
+ case token_name
471
+ when :ON, :DIR_SIGN, :LCURLY
472
+ if_type = if at?(:ON)
473
+ advance_token
474
+ parse_type_name
475
+ else
476
+ nil
477
+ end
478
+
479
+ directives = parse_directives
480
+
481
+ Nodes::InlineFragment.new(pos: loc, type: if_type, directives: directives, selections: selection_set, filename: @filename, source_string: @graphql_str)
482
+ else
483
+ name = parse_name_without_on
484
+ directives = parse_directives
485
+
486
+ # Can this ever happen?
487
+ # expect_token(:IDENTIFIER) if at?(:ON)
488
+
489
+ FragmentSpread.new(pos: loc, name: name, directives: directives, filename: @filename, source_string: @graphql_str)
490
+ end
491
+ else
492
+ loc = pos
493
+ name = parse_name
494
+
495
+ field_alias = nil
496
+
497
+ if at?(:COLON)
498
+ advance_token
499
+ field_alias = name
500
+ name = parse_name
501
+ end
502
+
503
+ arguments = at?(:LPAREN) ? parse_arguments : nil
504
+ directives = at?(:DIR_SIGN) ? parse_directives : nil
505
+ selection_set = at?(:LCURLY) ? self.selection_set : nil
506
+
507
+ Nodes::Field.new(pos: loc, field_alias: field_alias, name: name, arguments: arguments, directives: directives, selections: selection_set, filename: @filename, source_string: @graphql_str)
508
+ end
509
+ end
510
+ expect_token(:RCURLY)
511
+ selections
512
+ end
1956
513
 
1957
- result
1958
- end
1959
- .,.,
514
+ def parse_name
515
+ case token_name
516
+ when :IDENTIFIER
517
+ expect_token_value(:IDENTIFIER)
518
+ when :SCHEMA
519
+ advance_token
520
+ "schema"
521
+ when :SCALAR
522
+ advance_token
523
+ "scalar"
524
+ when :IMPLEMENTS
525
+ advance_token
526
+ "implements"
527
+ when :INTERFACE
528
+ advance_token
529
+ "interface"
530
+ when :UNION
531
+ advance_token
532
+ "union"
533
+ when :ENUM
534
+ advance_token
535
+ "enum"
536
+ when :INPUT
537
+ advance_token
538
+ "input"
539
+ when :DIRECTIVE
540
+ advance_token
541
+ "directive"
542
+ when :TYPE
543
+ advance_token
544
+ "type"
545
+ when :QUERY
546
+ advance_token
547
+ "query"
548
+ when :MUTATION
549
+ advance_token
550
+ "mutation"
551
+ when :SUBSCRIPTION
552
+ advance_token
553
+ "subscription"
554
+ when :TRUE
555
+ advance_token
556
+ "true"
557
+ when :FALSE
558
+ advance_token
559
+ "false"
560
+ when :FRAGMENT
561
+ advance_token
562
+ "fragment"
563
+ when :REPEATABLE
564
+ advance_token
565
+ "repeatable"
566
+ when :NULL
567
+ advance_token
568
+ "null"
569
+ when :ON
570
+ advance_token
571
+ "on"
572
+ when :DIRECTIVE
573
+ advance_token
574
+ "directive"
575
+ when :EXTEND
576
+ advance_token
577
+ "extend"
578
+ else
579
+ expect_token(:NAME)
580
+ end
581
+ end
1960
582
 
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
- .,.,
583
+ def parse_name_without_on
584
+ if at?(:ON)
585
+ expect_token(:IDENTIFIER)
586
+ else
587
+ parse_name
588
+ end
589
+ end
1967
590
 
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
- .,.,
591
+ # Any identifier, but not true, false, or null
592
+ def parse_enum_name
593
+ if at?(:TRUE) || at?(:FALSE) || at?(:NULL)
594
+ expect_token(:IDENTIFIER)
595
+ else
596
+ parse_name
597
+ end
598
+ end
1974
599
 
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])
600
+ def parse_type_name
601
+ TypeName.new(pos: pos, name: parse_name, filename: @filename, source_string: @graphql_str)
602
+ end
1978
603
 
1979
- result
1980
- end
1981
- .,.,
604
+ def parse_directives
605
+ if at?(:DIR_SIGN)
606
+ dirs = []
607
+ while at?(:DIR_SIGN)
608
+ loc = pos
609
+ advance_token
610
+ name = parse_name
611
+ arguments = parse_arguments
612
+
613
+ dirs << Nodes::Directive.new(pos: loc, name: name, arguments: arguments, filename: @filename, source_string: @graphql_str)
614
+ end
615
+ dirs
616
+ else
617
+ EMPTY_ARRAY
618
+ end
619
+ end
1982
620
 
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])
621
+ def parse_arguments
622
+ if at?(:LPAREN)
623
+ advance_token
624
+ args = []
625
+ while !at?(:RPAREN)
626
+ loc = pos
627
+ name = parse_name
628
+ expect_token(:COLON)
629
+ args << Nodes::Argument.new(pos: loc, name: name, value: value, filename: @filename, source_string: @graphql_str)
630
+ end
631
+ if args.empty?
632
+ expect_token(:ARGUMENT_NAME) # At least one argument is required
633
+ end
634
+ expect_token(:RPAREN)
635
+ args
636
+ else
637
+ EMPTY_ARRAY
638
+ end
639
+ end
1986
640
 
1987
- result
1988
- end
1989
- .,.,
641
+ def string_value
642
+ token_value = @lexer.string_value
643
+ expect_token :STRING
644
+ token_value
645
+ end
1990
646
 
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])
647
+ def value
648
+ case token_name
649
+ when :INT
650
+ expect_token_value(:INT).to_i
651
+ when :FLOAT
652
+ expect_token_value(:FLOAT).to_f
653
+ when :STRING
654
+ string_value
655
+ when :TRUE
656
+ advance_token
657
+ true
658
+ when :FALSE
659
+ advance_token
660
+ false
661
+ when :NULL
662
+ advance_token
663
+ NullValue.new(pos: pos, name: "null", filename: @filename, source_string: @graphql_str)
664
+ when :IDENTIFIER
665
+ Nodes::Enum.new(pos: pos, name: expect_token_value(:IDENTIFIER), filename: @filename, source_string: @graphql_str)
666
+ when :LBRACKET
667
+ advance_token
668
+ list = []
669
+ while !at?(:RBRACKET)
670
+ list << value
671
+ end
672
+ expect_token(:RBRACKET)
673
+ list
674
+ when :LCURLY
675
+ start = pos
676
+ advance_token
677
+ args = []
678
+ while !at?(:RCURLY)
679
+ loc = pos
680
+ n = parse_name
681
+ expect_token(:COLON)
682
+ args << Argument.new(pos: loc, name: n, value: value, filename: @filename, source_string: @graphql_str)
683
+ end
684
+ expect_token(:RCURLY)
685
+ InputObject.new(pos: start, arguments: args, filename: @filename, source_string: @graphql_str)
686
+ when :VAR_SIGN
687
+ loc = pos
688
+ advance_token
689
+ VariableIdentifier.new(pos: loc, name: parse_name, filename: @filename, source_string: @graphql_str)
690
+ else
691
+ expect_token(:VALUE)
692
+ end
693
+ end
1994
694
 
1995
- result
1996
- end
1997
- .,.,
695
+ def at?(expected_token_name)
696
+ @token_name == expected_token_name
697
+ end
1998
698
 
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])
699
+ def expect_token(expected_token_name)
700
+ unless @token_name == expected_token_name
701
+ raise_parse_error("Expected #{expected_token_name}, actual: #{token_name || "(none)"} (#{debug_token_value.inspect})")
702
+ end
703
+ advance_token
704
+ end
2002
705
 
2003
- result
2004
- end
2005
- .,.,
706
+ def expect_one_of(token_names)
707
+ raise_parse_error("Expected one of #{token_names.join(", ")}, actual: #{token_name || "NOTHING"} (#{debug_token_value.inspect})")
708
+ end
2006
709
 
2007
- # reduce 183 omitted
710
+ def raise_parse_error(message)
711
+ message += " at [#{@lexer.line_number}, #{@lexer.column_number}]"
712
+ raise GraphQL::ParseError.new(
713
+ message,
714
+ @lexer.line_number,
715
+ @lexer.column_number,
716
+ @graphql_str,
717
+ filename: @filename,
718
+ )
2008
719
 
2009
- # reduce 184 omitted
720
+ end
2010
721
 
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
- .,.,
722
+ # Only use when we care about the expected token's value
723
+ def expect_token_value(tok)
724
+ token_value = @lexer.token_value
725
+ expect_token(tok)
726
+ token_value
727
+ end
2017
728
 
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
729
+ # token_value works for when the scanner matched something
730
+ # which is usually fine and it's good for it to be fast at that.
731
+ def debug_token_value
732
+ if token_name && Lexer::Punctuation.const_defined?(token_name)
733
+ Lexer::Punctuation.const_get(token_name)
734
+ elsif token_name == :ELLIPSIS
735
+ "..."
736
+ else
737
+ @lexer.token_value
738
+ end
739
+ end
740
+ end
2022
741
  end
2023
- .,.,
2024
-
2025
- def _reduce_none(val, _values, result)
2026
- val[0]
2027
742
  end
2028
-
2029
- end # class Parser
2030
- end # module Language
2031
- end # module GraphQL