graphql 2.0.13 → 2.3.10

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