graphql 2.0.30 → 2.3.6

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