graphql 1.12.12 → 2.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/graphql/core.rb +3 -8
- data/lib/generators/graphql/enum_generator.rb +4 -10
- data/lib/generators/graphql/field_extractor.rb +31 -0
- data/lib/generators/graphql/input_generator.rb +50 -0
- data/lib/generators/graphql/install/mutation_root_generator.rb +34 -0
- data/lib/generators/graphql/{templates → install/templates}/base_mutation.erb +2 -0
- data/lib/generators/graphql/{templates → install/templates}/mutation_type.erb +2 -0
- data/lib/generators/graphql/install_generator.rb +60 -4
- data/lib/generators/graphql/interface_generator.rb +7 -7
- data/lib/generators/graphql/mutation_create_generator.rb +22 -0
- data/lib/generators/graphql/mutation_delete_generator.rb +22 -0
- data/lib/generators/graphql/mutation_generator.rb +5 -30
- data/lib/generators/graphql/mutation_update_generator.rb +22 -0
- data/lib/generators/graphql/object_generator.rb +10 -38
- data/lib/generators/graphql/orm_mutations_base.rb +40 -0
- data/lib/generators/graphql/relay.rb +23 -12
- data/lib/generators/graphql/scalar_generator.rb +4 -2
- data/lib/generators/graphql/templates/base_argument.erb +2 -0
- data/lib/generators/graphql/templates/base_connection.erb +2 -0
- data/lib/generators/graphql/templates/base_edge.erb +2 -0
- data/lib/generators/graphql/templates/base_enum.erb +2 -0
- data/lib/generators/graphql/templates/base_field.erb +2 -0
- data/lib/generators/graphql/templates/base_input_object.erb +2 -0
- data/lib/generators/graphql/templates/base_interface.erb +2 -0
- data/lib/generators/graphql/templates/base_object.erb +2 -0
- data/lib/generators/graphql/templates/base_resolver.erb +8 -0
- data/lib/generators/graphql/templates/base_scalar.erb +2 -0
- data/lib/generators/graphql/templates/base_union.erb +2 -0
- data/lib/generators/graphql/templates/enum.erb +5 -1
- data/lib/generators/graphql/templates/graphql_controller.erb +2 -0
- data/lib/generators/graphql/templates/input.erb +9 -0
- data/lib/generators/graphql/templates/interface.erb +4 -2
- data/lib/generators/graphql/templates/loader.erb +2 -0
- data/lib/generators/graphql/templates/mutation.erb +3 -1
- data/lib/generators/graphql/templates/mutation_create.erb +20 -0
- data/lib/generators/graphql/templates/mutation_delete.erb +20 -0
- data/lib/generators/graphql/templates/mutation_update.erb +21 -0
- data/lib/generators/graphql/templates/node_type.erb +2 -0
- data/lib/generators/graphql/templates/object.erb +4 -2
- data/lib/generators/graphql/templates/query_type.erb +2 -0
- data/lib/generators/graphql/templates/scalar.erb +3 -1
- data/lib/generators/graphql/templates/schema.erb +22 -2
- data/lib/generators/graphql/templates/union.erb +4 -2
- data/lib/generators/graphql/type_generator.rb +46 -10
- data/lib/generators/graphql/union_generator.rb +5 -5
- data/lib/graphql/analysis/analyzer.rb +89 -0
- data/lib/graphql/analysis/field_usage.rb +65 -28
- data/lib/graphql/analysis/max_query_complexity.rb +11 -17
- data/lib/graphql/analysis/max_query_depth.rb +13 -19
- data/lib/graphql/analysis/query_complexity.rb +156 -61
- data/lib/graphql/analysis/query_depth.rb +38 -23
- data/lib/graphql/analysis/visitor.rb +283 -0
- data/lib/graphql/analysis.rb +90 -6
- data/lib/graphql/autoload.rb +38 -0
- data/lib/graphql/backtrace/inspect_result.rb +0 -12
- data/lib/graphql/backtrace/table.rb +4 -22
- data/lib/graphql/backtrace/trace.rb +93 -0
- data/lib/graphql/backtrace/tracer.rb +8 -6
- data/lib/graphql/backtrace.rb +3 -8
- data/lib/graphql/coercion_error.rb +1 -9
- data/lib/graphql/current.rb +52 -0
- data/lib/graphql/dataloader/async_dataloader.rb +89 -0
- data/lib/graphql/dataloader/null_dataloader.rb +4 -2
- data/lib/graphql/dataloader/request.rb +5 -0
- data/lib/graphql/dataloader/source.rb +125 -33
- data/lib/graphql/dataloader.rb +193 -143
- data/lib/graphql/date_encoding_error.rb +16 -0
- data/lib/graphql/dig.rb +1 -1
- data/lib/graphql/duration_encoding_error.rb +16 -0
- data/lib/graphql/execution/errors.rb +12 -81
- data/lib/graphql/execution/interpreter/argument_value.rb +5 -1
- data/lib/graphql/execution/interpreter/arguments.rb +2 -2
- data/lib/graphql/execution/interpreter/arguments_cache.rb +33 -36
- data/lib/graphql/execution/interpreter/resolve.rb +38 -4
- data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +175 -0
- data/lib/graphql/execution/interpreter/runtime.rb +447 -403
- data/lib/graphql/execution/interpreter.rb +126 -80
- data/lib/graphql/execution/lazy.rb +11 -21
- data/lib/graphql/execution/lookahead.rb +133 -55
- data/lib/graphql/execution/multiplex.rb +4 -172
- data/lib/graphql/execution.rb +11 -4
- data/lib/graphql/integer_encoding_error.rb +18 -2
- data/lib/graphql/introspection/directive_location_enum.rb +2 -2
- data/lib/graphql/introspection/directive_type.rb +6 -4
- data/lib/graphql/introspection/dynamic_fields.rb +3 -8
- data/lib/graphql/introspection/entry_points.rb +11 -18
- data/lib/graphql/introspection/enum_value_type.rb +2 -2
- data/lib/graphql/introspection/field_type.rb +4 -4
- data/lib/graphql/introspection/input_value_type.rb +10 -4
- data/lib/graphql/introspection/schema_type.rb +17 -15
- data/lib/graphql/introspection/type_type.rb +29 -16
- data/lib/graphql/introspection.rb +6 -2
- data/lib/graphql/invalid_null_error.rb +1 -1
- data/lib/graphql/language/block_string.rb +37 -25
- data/lib/graphql/language/cache.rb +13 -0
- data/lib/graphql/language/comment.rb +18 -0
- data/lib/graphql/language/definition_slice.rb +1 -1
- data/lib/graphql/language/document_from_schema_definition.rb +122 -81
- data/lib/graphql/language/lexer.rb +364 -1467
- data/lib/graphql/language/nodes.rb +197 -106
- data/lib/graphql/language/parser.rb +799 -1920
- data/lib/graphql/language/printer.rb +372 -160
- data/lib/graphql/language/sanitized_printer.rb +25 -27
- data/lib/graphql/language/static_visitor.rb +167 -0
- data/lib/graphql/language/visitor.rb +188 -141
- data/lib/graphql/language.rb +62 -1
- data/lib/graphql/load_application_object_failed_error.rb +5 -1
- data/lib/graphql/name_validator.rb +0 -4
- data/lib/graphql/pagination/active_record_relation_connection.rb +37 -8
- data/lib/graphql/pagination/array_connection.rb +8 -6
- data/lib/graphql/pagination/connection.rb +61 -7
- data/lib/graphql/pagination/connections.rb +22 -23
- data/lib/graphql/pagination/mongoid_relation_connection.rb +1 -2
- data/lib/graphql/pagination/relation_connection.rb +60 -28
- data/lib/graphql/query/context/scoped_context.rb +101 -0
- data/lib/graphql/query/context.rb +146 -222
- data/lib/graphql/query/input_validation_result.rb +10 -1
- data/lib/graphql/query/null_context.rb +15 -32
- data/lib/graphql/query/validation_pipeline.rb +15 -39
- data/lib/graphql/query/variable_validation_error.rb +3 -3
- data/lib/graphql/query/variables.rb +35 -17
- data/lib/graphql/query.rb +149 -82
- data/lib/graphql/railtie.rb +15 -109
- data/lib/graphql/rake_task/validate.rb +1 -1
- data/lib/graphql/rake_task.rb +30 -11
- data/lib/graphql/relay/range_add.rb +9 -16
- data/lib/graphql/relay.rb +0 -15
- data/lib/graphql/rubocop/graphql/base_cop.rb +36 -0
- data/lib/graphql/rubocop/graphql/default_null_true.rb +43 -0
- data/lib/graphql/rubocop/graphql/default_required_true.rb +43 -0
- data/lib/graphql/rubocop/graphql/field_type_in_block.rb +144 -0
- data/lib/graphql/rubocop/graphql/root_types_in_block.rb +38 -0
- data/lib/graphql/rubocop.rb +6 -0
- data/lib/graphql/schema/addition.rb +98 -54
- data/lib/graphql/schema/always_visible.rb +14 -0
- data/lib/graphql/schema/argument.rb +179 -82
- data/lib/graphql/schema/base_64_encoder.rb +3 -5
- data/lib/graphql/schema/build_from_definition.rb +77 -39
- data/lib/graphql/schema/directive/feature.rb +1 -1
- data/lib/graphql/schema/directive/flagged.rb +4 -4
- data/lib/graphql/schema/directive/include.rb +1 -1
- data/lib/graphql/schema/directive/one_of.rb +24 -0
- data/lib/graphql/schema/directive/skip.rb +1 -1
- data/lib/graphql/schema/directive/specified_by.rb +14 -0
- data/lib/graphql/schema/directive/transform.rb +2 -2
- data/lib/graphql/schema/directive.rb +36 -22
- data/lib/graphql/schema/enum.rb +158 -63
- data/lib/graphql/schema/enum_value.rb +12 -21
- data/lib/graphql/schema/field/connection_extension.rb +7 -17
- data/lib/graphql/schema/field/scope_extension.rb +8 -1
- data/lib/graphql/schema/field.rb +521 -359
- data/lib/graphql/schema/field_extension.rb +86 -2
- data/lib/graphql/schema/find_inherited_value.rb +3 -7
- data/lib/graphql/schema/finder.rb +5 -5
- data/lib/graphql/schema/has_single_input_argument.rb +160 -0
- data/lib/graphql/schema/input_object.rb +148 -99
- data/lib/graphql/schema/interface.rb +41 -64
- data/lib/graphql/schema/introspection_system.rb +12 -26
- data/lib/graphql/schema/late_bound_type.rb +12 -2
- data/lib/graphql/schema/list.rb +18 -7
- data/lib/graphql/schema/loader.rb +6 -5
- data/lib/graphql/schema/member/base_dsl_methods.rb +32 -18
- data/lib/graphql/schema/member/build_type.rb +16 -13
- data/lib/graphql/schema/member/has_arguments.rb +270 -86
- data/lib/graphql/schema/member/has_ast_node.rb +12 -0
- data/lib/graphql/schema/member/has_deprecation_reason.rb +3 -4
- data/lib/graphql/schema/member/has_directives.rb +81 -61
- data/lib/graphql/schema/member/has_fields.rb +169 -31
- data/lib/graphql/schema/member/has_interfaces.rb +143 -0
- data/lib/graphql/schema/member/has_unresolved_type_error.rb +5 -1
- data/lib/graphql/schema/member/has_validators.rb +32 -6
- data/lib/graphql/schema/member/relay_shortcuts.rb +47 -2
- data/lib/graphql/schema/member/scoped.rb +19 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +16 -0
- data/lib/graphql/schema/member/validates_input.rb +6 -6
- data/lib/graphql/schema/member.rb +1 -6
- data/lib/graphql/schema/mutation.rb +7 -9
- data/lib/graphql/schema/non_null.rb +7 -7
- data/lib/graphql/schema/object.rb +38 -119
- data/lib/graphql/schema/printer.rb +24 -25
- data/lib/graphql/schema/relay_classic_mutation.rb +13 -91
- data/lib/graphql/schema/resolver/has_payload_type.rb +46 -11
- data/lib/graphql/schema/resolver.rb +118 -115
- data/lib/graphql/schema/scalar.rb +20 -21
- data/lib/graphql/schema/subscription.rb +95 -21
- data/lib/graphql/schema/timeout.rb +25 -29
- data/lib/graphql/schema/type_expression.rb +2 -2
- data/lib/graphql/schema/type_membership.rb +21 -4
- data/lib/graphql/schema/union.rb +16 -16
- data/lib/graphql/schema/unique_within_type.rb +1 -1
- data/lib/graphql/schema/validator/all_validator.rb +62 -0
- data/lib/graphql/schema/validator/allow_blank_validator.rb +29 -0
- data/lib/graphql/schema/validator/allow_null_validator.rb +26 -0
- data/lib/graphql/schema/validator/exclusion_validator.rb +3 -1
- data/lib/graphql/schema/validator/format_validator.rb +4 -5
- data/lib/graphql/schema/validator/inclusion_validator.rb +3 -1
- data/lib/graphql/schema/validator/length_validator.rb +5 -3
- data/lib/graphql/schema/validator/numericality_validator.rb +13 -2
- data/lib/graphql/schema/validator/required_validator.rb +56 -18
- data/lib/graphql/schema/validator.rb +38 -28
- data/lib/graphql/schema/visibility/migration.rb +188 -0
- data/lib/graphql/schema/visibility/profile.rb +359 -0
- data/lib/graphql/schema/visibility/visit.rb +190 -0
- data/lib/graphql/schema/visibility.rb +294 -0
- data/lib/graphql/schema/warden.rb +423 -134
- data/lib/graphql/schema/wrapper.rb +0 -5
- data/lib/graphql/schema.rb +1015 -1057
- data/lib/graphql/static_validation/all_rules.rb +3 -1
- data/lib/graphql/static_validation/base_visitor.rb +15 -28
- data/lib/graphql/static_validation/definition_dependencies.rb +7 -2
- data/lib/graphql/static_validation/error.rb +3 -1
- data/lib/graphql/static_validation/literal_validator.rb +24 -7
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +1 -1
- data/lib/graphql/static_validation/rules/argument_names_are_unique.rb +1 -1
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +4 -3
- data/lib/graphql/static_validation/rules/directives_are_defined.rb +13 -7
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +15 -13
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +12 -2
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +13 -5
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +62 -35
- data/lib/graphql/static_validation/rules/fields_will_merge_error.rb +25 -4
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +3 -3
- data/lib/graphql/static_validation/rules/fragment_types_exist.rb +12 -2
- data/lib/graphql/static_validation/rules/fragments_are_finite.rb +2 -2
- data/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +1 -1
- data/lib/graphql/static_validation/rules/mutation_root_exists.rb +1 -1
- data/lib/graphql/static_validation/rules/no_definitions_are_present.rb +1 -1
- data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb +66 -0
- data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb +29 -0
- data/lib/graphql/static_validation/rules/query_root_exists.rb +17 -0
- data/lib/graphql/static_validation/rules/query_root_exists_error.rb +26 -0
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +7 -5
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +5 -5
- data/lib/graphql/static_validation/rules/subscription_root_exists.rb +1 -1
- data/lib/graphql/static_validation/rules/unique_directives_per_location.rb +14 -8
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +18 -27
- data/lib/graphql/static_validation/rules/variable_names_are_unique.rb +1 -1
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +14 -8
- data/lib/graphql/static_validation/rules/variables_are_input_types.rb +11 -2
- data/lib/graphql/static_validation/validation_context.rb +32 -6
- data/lib/graphql/static_validation/validator.rb +11 -27
- data/lib/graphql/static_validation.rb +0 -3
- data/lib/graphql/string_encoding_error.rb +13 -3
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +49 -11
- data/lib/graphql/subscriptions/broadcast_analyzer.rb +11 -5
- data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +40 -1
- data/lib/graphql/subscriptions/event.rb +87 -38
- data/lib/graphql/subscriptions/serialize.rb +27 -3
- data/lib/graphql/subscriptions.rb +63 -49
- data/lib/graphql/testing/helpers.rb +155 -0
- data/lib/graphql/testing.rb +2 -0
- data/lib/graphql/tracing/active_support_notifications_trace.rb +16 -0
- data/lib/graphql/tracing/active_support_notifications_tracing.rb +6 -20
- data/lib/graphql/tracing/appoptics_trace.rb +253 -0
- data/lib/graphql/tracing/appoptics_tracing.rb +4 -2
- data/lib/graphql/tracing/appsignal_trace.rb +79 -0
- data/lib/graphql/tracing/appsignal_tracing.rb +17 -0
- data/lib/graphql/tracing/call_legacy_tracers.rb +66 -0
- data/lib/graphql/tracing/data_dog_trace.rb +185 -0
- data/lib/graphql/tracing/data_dog_tracing.rb +27 -15
- data/lib/graphql/{execution/instrumentation.rb → tracing/legacy_hooks_trace.rb} +11 -28
- data/lib/graphql/tracing/legacy_trace.rb +12 -0
- data/lib/graphql/tracing/new_relic_trace.rb +77 -0
- data/lib/graphql/tracing/new_relic_tracing.rb +2 -0
- data/lib/graphql/tracing/notifications_trace.rb +45 -0
- data/lib/graphql/tracing/notifications_tracing.rb +61 -0
- data/lib/graphql/tracing/null_trace.rb +9 -0
- data/lib/graphql/tracing/platform_trace.rb +118 -0
- data/lib/graphql/tracing/platform_tracing.rb +46 -49
- data/lib/graphql/tracing/{prometheus_tracing → prometheus_trace}/graphql_collector.rb +6 -2
- data/lib/graphql/tracing/prometheus_trace.rb +94 -0
- data/lib/graphql/tracing/prometheus_tracing.rb +5 -3
- data/lib/graphql/tracing/scout_trace.rb +74 -0
- data/lib/graphql/tracing/scout_tracing.rb +2 -0
- data/lib/graphql/tracing/sentry_trace.rb +114 -0
- data/lib/graphql/tracing/statsd_trace.rb +58 -0
- data/lib/graphql/tracing/statsd_tracing.rb +2 -0
- data/lib/graphql/tracing/trace.rb +79 -0
- data/lib/graphql/tracing.rb +29 -52
- data/lib/graphql/type_kinds.rb +7 -4
- data/lib/graphql/types/big_int.rb +5 -1
- data/lib/graphql/types/int.rb +1 -1
- data/lib/graphql/types/iso_8601_date.rb +17 -6
- data/lib/graphql/types/iso_8601_date_time.rb +12 -1
- data/lib/graphql/types/iso_8601_duration.rb +77 -0
- data/lib/graphql/types/relay/base_connection.rb +16 -6
- data/lib/graphql/types/relay/connection_behaviors.rb +92 -32
- data/lib/graphql/types/relay/edge_behaviors.rb +46 -7
- data/lib/graphql/types/relay/has_node_field.rb +2 -2
- data/lib/graphql/types/relay/has_nodes_field.rb +2 -2
- data/lib/graphql/types/relay/node_behaviors.rb +12 -2
- data/lib/graphql/types/relay/page_info_behaviors.rb +11 -2
- data/lib/graphql/types/relay.rb +0 -3
- data/lib/graphql/types/string.rb +2 -2
- data/lib/graphql/types.rb +18 -10
- data/lib/graphql/unauthorized_enum_value_error.rb +13 -0
- data/lib/graphql/unauthorized_error.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +82 -137
- data/readme.md +13 -6
- metadata +127 -186
- data/lib/graphql/analysis/analyze_query.rb +0 -98
- data/lib/graphql/analysis/ast/analyzer.rb +0 -84
- data/lib/graphql/analysis/ast/field_usage.rb +0 -28
- data/lib/graphql/analysis/ast/max_query_complexity.rb +0 -23
- data/lib/graphql/analysis/ast/max_query_depth.rb +0 -22
- data/lib/graphql/analysis/ast/query_complexity.rb +0 -234
- data/lib/graphql/analysis/ast/query_depth.rb +0 -56
- data/lib/graphql/analysis/ast/visitor.rb +0 -268
- data/lib/graphql/analysis/ast.rb +0 -91
- data/lib/graphql/analysis/reducer_state.rb +0 -48
- data/lib/graphql/argument.rb +0 -131
- data/lib/graphql/authorization.rb +0 -82
- data/lib/graphql/backtrace/legacy_tracer.rb +0 -56
- data/lib/graphql/backwards_compatibility.rb +0 -61
- data/lib/graphql/base_type.rb +0 -230
- data/lib/graphql/boolean_type.rb +0 -2
- data/lib/graphql/compatibility/execution_specification/counter_schema.rb +0 -53
- data/lib/graphql/compatibility/execution_specification/specification_schema.rb +0 -200
- data/lib/graphql/compatibility/execution_specification.rb +0 -436
- data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +0 -111
- data/lib/graphql/compatibility/lazy_execution_specification.rb +0 -215
- data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +0 -87
- data/lib/graphql/compatibility/query_parser_specification/query_assertions.rb +0 -79
- data/lib/graphql/compatibility/query_parser_specification.rb +0 -266
- data/lib/graphql/compatibility/schema_parser_specification.rb +0 -682
- data/lib/graphql/compatibility.rb +0 -5
- data/lib/graphql/define/assign_argument.rb +0 -12
- data/lib/graphql/define/assign_connection.rb +0 -13
- data/lib/graphql/define/assign_enum_value.rb +0 -18
- data/lib/graphql/define/assign_global_id_field.rb +0 -11
- data/lib/graphql/define/assign_mutation_function.rb +0 -34
- data/lib/graphql/define/assign_object_field.rb +0 -42
- data/lib/graphql/define/defined_object_proxy.rb +0 -53
- data/lib/graphql/define/instance_definable.rb +0 -240
- data/lib/graphql/define/no_definition_error.rb +0 -7
- data/lib/graphql/define/non_null_with_bang.rb +0 -16
- data/lib/graphql/define/type_definer.rb +0 -31
- data/lib/graphql/define.rb +0 -31
- data/lib/graphql/deprecated_dsl.rb +0 -47
- data/lib/graphql/deprecation.rb +0 -13
- data/lib/graphql/directive/deprecated_directive.rb +0 -2
- data/lib/graphql/directive/include_directive.rb +0 -2
- data/lib/graphql/directive/skip_directive.rb +0 -2
- data/lib/graphql/directive.rb +0 -111
- data/lib/graphql/enum_type.rb +0 -129
- data/lib/graphql/execution/execute.rb +0 -333
- data/lib/graphql/execution/flatten.rb +0 -40
- data/lib/graphql/execution/lazy/resolve.rb +0 -91
- data/lib/graphql/execution/typecast.rb +0 -50
- data/lib/graphql/field/resolve.rb +0 -59
- data/lib/graphql/field.rb +0 -226
- data/lib/graphql/filter.rb +0 -53
- data/lib/graphql/float_type.rb +0 -2
- data/lib/graphql/function.rb +0 -128
- data/lib/graphql/id_type.rb +0 -2
- data/lib/graphql/input_object_type.rb +0 -138
- data/lib/graphql/int_type.rb +0 -2
- data/lib/graphql/interface_type.rb +0 -72
- data/lib/graphql/internal_representation/document.rb +0 -27
- data/lib/graphql/internal_representation/node.rb +0 -206
- data/lib/graphql/internal_representation/print.rb +0 -51
- data/lib/graphql/internal_representation/rewrite.rb +0 -184
- data/lib/graphql/internal_representation/scope.rb +0 -88
- data/lib/graphql/internal_representation/visit.rb +0 -36
- data/lib/graphql/internal_representation.rb +0 -7
- data/lib/graphql/language/lexer.rl +0 -262
- data/lib/graphql/language/parser.y +0 -543
- data/lib/graphql/language/token.rb +0 -38
- data/lib/graphql/list_type.rb +0 -80
- data/lib/graphql/non_null_type.rb +0 -71
- data/lib/graphql/object_type.rb +0 -130
- data/lib/graphql/query/arguments.rb +0 -189
- data/lib/graphql/query/arguments_cache.rb +0 -24
- data/lib/graphql/query/executor.rb +0 -52
- data/lib/graphql/query/literal_input.rb +0 -136
- data/lib/graphql/query/serial_execution/field_resolution.rb +0 -92
- data/lib/graphql/query/serial_execution/operation_resolution.rb +0 -19
- data/lib/graphql/query/serial_execution/selection_resolution.rb +0 -23
- data/lib/graphql/query/serial_execution/value_resolution.rb +0 -87
- data/lib/graphql/query/serial_execution.rb +0 -40
- data/lib/graphql/relay/array_connection.rb +0 -83
- data/lib/graphql/relay/base_connection.rb +0 -189
- data/lib/graphql/relay/connection_instrumentation.rb +0 -54
- data/lib/graphql/relay/connection_resolve.rb +0 -43
- data/lib/graphql/relay/connection_type.rb +0 -41
- data/lib/graphql/relay/edge.rb +0 -27
- data/lib/graphql/relay/edge_type.rb +0 -19
- data/lib/graphql/relay/edges_instrumentation.rb +0 -40
- data/lib/graphql/relay/global_id_resolve.rb +0 -18
- data/lib/graphql/relay/mongo_relation_connection.rb +0 -50
- data/lib/graphql/relay/mutation/instrumentation.rb +0 -23
- data/lib/graphql/relay/mutation/resolve.rb +0 -56
- data/lib/graphql/relay/mutation/result.rb +0 -38
- data/lib/graphql/relay/mutation.rb +0 -106
- data/lib/graphql/relay/node.rb +0 -39
- data/lib/graphql/relay/page_info.rb +0 -7
- data/lib/graphql/relay/relation_connection.rb +0 -188
- data/lib/graphql/relay/type_extensions.rb +0 -32
- data/lib/graphql/scalar_type.rb +0 -91
- data/lib/graphql/schema/base_64_bp.rb +0 -26
- data/lib/graphql/schema/catchall_middleware.rb +0 -35
- data/lib/graphql/schema/default_parse_error.rb +0 -10
- data/lib/graphql/schema/default_type_error.rb +0 -17
- data/lib/graphql/schema/invalid_type_error.rb +0 -7
- data/lib/graphql/schema/member/accepts_definition.rb +0 -152
- data/lib/graphql/schema/member/cached_graphql_definition.rb +0 -31
- data/lib/graphql/schema/member/instrumentation.rb +0 -131
- data/lib/graphql/schema/middleware_chain.rb +0 -82
- data/lib/graphql/schema/possible_types.rb +0 -44
- data/lib/graphql/schema/rescue_middleware.rb +0 -60
- data/lib/graphql/schema/timeout_middleware.rb +0 -88
- data/lib/graphql/schema/traversal.rb +0 -228
- data/lib/graphql/schema/validation.rb +0 -313
- data/lib/graphql/static_validation/default_visitor.rb +0 -15
- data/lib/graphql/static_validation/no_validate_visitor.rb +0 -10
- data/lib/graphql/static_validation/type_stack.rb +0 -216
- data/lib/graphql/string_type.rb +0 -2
- data/lib/graphql/subscriptions/instrumentation.rb +0 -79
- data/lib/graphql/subscriptions/subscription_root.rb +0 -76
- data/lib/graphql/tracing/skylight_tracing.rb +0 -70
- data/lib/graphql/types/relay/default_relay.rb +0 -27
- data/lib/graphql/types/relay/node_field.rb +0 -25
- data/lib/graphql/types/relay/nodes_field.rb +0 -27
- data/lib/graphql/union_type.rb +0 -115
- data/lib/graphql/upgrader/member.rb +0 -937
- data/lib/graphql/upgrader/schema.rb +0 -38
@@ -1,1470 +1,367 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
module GraphQL
|
4
|
-
module Language
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
]
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 4, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 0, 0, 0, 6, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 12, 13, 14, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 15, 16, 17, 17, 19, 19, 20, 20, 8, 8, 17, 17, 21, 23, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 24, 22, 25, 25, 25, 25, 25, 25, 25, 25, 22, 25, 25, 25, 25, 25, 25, 25, 25, 22, 25, 25, 25, 22, 25, 25, 25, 22, 25, 25, 25, 25, 25, 22, 25, 25, 25, 22, 25, 22, 26, 27, 27, 25, 25, 25, 27, 27, 25, 25, 25, 25, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 25, 25, 25, 28, 28, 25, 25, 25, 25, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 25, 25, 25, 29, 29, 25, 25, 25, 25, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 22, 22, 25, 25, 25, 22, 22, 25, 25, 25, 25, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 31, 32, 30, 33, 34, 35, 36, 37, 38, 39, 30, 40, 41, 30, 42, 43, 44, 45, 46, 47, 47, 48, 30, 49, 47, 47, 47, 47, 50, 51, 52, 47, 47, 53, 47, 54, 55, 56, 47, 57, 47, 58, 59, 60, 47, 47, 47, 61, 62, 63, 31, 66, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 9, 69, 70, 71, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 72, 13, 73, 42, 43, 20, 20, 75, 74, 17, 17, 74, 74, 74, 74, 76, 74, 74, 74, 74, 74, 74, 74, 74, 76, 17, 17, 20, 20, 77, 77, 19, 19, 77, 77, 77, 77, 76, 77, 77, 77, 77, 77, 77, 77, 77, 76, 20, 20, 75, 74, 43, 43, 74, 74, 74, 74, 76, 74, 74, 74, 74, 74, 74, 74, 74, 76, 78, 47, 47, 8, 8, 8, 47, 47, 8, 8, 8, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 80, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 81, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 82, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 83, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 84, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 85, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 86, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 87, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 88, 47, 47, 47, 47, 47, 47, 47, 47, 89, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 90, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 91, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 92, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 93, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 94, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 95, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 96, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 97, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 98, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 99, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 100, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 101, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 102, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 103, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 104, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 105, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 106, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 107, 108, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 109, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 110, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 111, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 112, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 113, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 114, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 115, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 116, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 117, 47, 47, 47, 118, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 119, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 120, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 121, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 122, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 123, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 124, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 125, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 126, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 127, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 128, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 129, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 130, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 131, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 132, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 133, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 134, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 135, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 136, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 137, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 138, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 139, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 140, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 141, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 142, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 143, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 144, 47, 47, 47, 47, 47, 47, 145, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 146, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 147, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 148, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 149, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 150, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 151, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 152, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 153, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 154, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 155, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 156, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 157, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 158, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 159, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 160, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 161, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 163, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 164, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 165, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 166, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 167, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 168, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 169, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 170, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 47, 79, 79, 79, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 171, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 22, 0 ,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
]
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
end
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
def
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
end
|
369
|
-
|
370
|
-
end
|
371
|
-
when 25 then
|
372
|
-
begin
|
373
|
-
begin
|
374
|
-
begin
|
375
|
-
te = p+1;
|
376
|
-
begin
|
377
|
-
emit(:RBRACKET, ts, te, meta, "]")
|
378
|
-
end
|
379
|
-
|
380
|
-
end
|
381
|
-
|
382
|
-
end
|
383
|
-
|
384
|
-
end
|
385
|
-
when 24 then
|
386
|
-
begin
|
387
|
-
begin
|
388
|
-
begin
|
389
|
-
te = p+1;
|
390
|
-
begin
|
391
|
-
emit(:LBRACKET, ts, te, meta, "[")
|
392
|
-
end
|
393
|
-
|
394
|
-
end
|
395
|
-
|
396
|
-
end
|
397
|
-
|
398
|
-
end
|
399
|
-
when 20 then
|
400
|
-
begin
|
401
|
-
begin
|
402
|
-
begin
|
403
|
-
te = p+1;
|
404
|
-
begin
|
405
|
-
emit(:COLON, ts, te, meta, ":")
|
406
|
-
end
|
407
|
-
|
408
|
-
end
|
409
|
-
|
410
|
-
end
|
411
|
-
|
412
|
-
end
|
413
|
-
when 2 then
|
414
|
-
begin
|
415
|
-
begin
|
416
|
-
begin
|
417
|
-
te = p+1;
|
418
|
-
begin
|
419
|
-
emit_string(ts, te, meta, block: false)
|
420
|
-
end
|
421
|
-
|
422
|
-
end
|
423
|
-
|
424
|
-
end
|
425
|
-
|
426
|
-
end
|
427
|
-
when 34 then
|
428
|
-
begin
|
429
|
-
begin
|
430
|
-
begin
|
431
|
-
te = p+1;
|
432
|
-
begin
|
433
|
-
emit_string(ts, te, meta, block: true)
|
434
|
-
end
|
435
|
-
|
436
|
-
end
|
437
|
-
|
438
|
-
end
|
439
|
-
|
440
|
-
end
|
441
|
-
when 15 then
|
442
|
-
begin
|
443
|
-
begin
|
444
|
-
begin
|
445
|
-
te = p+1;
|
446
|
-
begin
|
447
|
-
emit(:VAR_SIGN, ts, te, meta, "$")
|
448
|
-
end
|
449
|
-
|
450
|
-
end
|
451
|
-
|
452
|
-
end
|
453
|
-
|
454
|
-
end
|
455
|
-
when 22 then
|
456
|
-
begin
|
457
|
-
begin
|
458
|
-
begin
|
459
|
-
te = p+1;
|
460
|
-
begin
|
461
|
-
emit(:DIR_SIGN, ts, te, meta, "@")
|
462
|
-
end
|
463
|
-
|
464
|
-
end
|
465
|
-
|
466
|
-
end
|
467
|
-
|
468
|
-
end
|
469
|
-
when 7 then
|
470
|
-
begin
|
471
|
-
begin
|
472
|
-
begin
|
473
|
-
te = p+1;
|
474
|
-
begin
|
475
|
-
emit(:ELLIPSIS, ts, te, meta, "...")
|
476
|
-
end
|
477
|
-
|
478
|
-
end
|
479
|
-
|
480
|
-
end
|
481
|
-
|
482
|
-
end
|
483
|
-
when 21 then
|
484
|
-
begin
|
485
|
-
begin
|
486
|
-
begin
|
487
|
-
te = p+1;
|
488
|
-
begin
|
489
|
-
emit(:EQUALS, ts, te, meta, "=")
|
490
|
-
end
|
491
|
-
|
492
|
-
end
|
493
|
-
|
494
|
-
end
|
495
|
-
|
496
|
-
end
|
497
|
-
when 13 then
|
498
|
-
begin
|
499
|
-
begin
|
500
|
-
begin
|
501
|
-
te = p+1;
|
502
|
-
begin
|
503
|
-
emit(:BANG, ts, te, meta, "!")
|
504
|
-
end
|
505
|
-
|
506
|
-
end
|
507
|
-
|
508
|
-
end
|
509
|
-
|
510
|
-
end
|
511
|
-
when 27 then
|
512
|
-
begin
|
513
|
-
begin
|
514
|
-
begin
|
515
|
-
te = p+1;
|
516
|
-
begin
|
517
|
-
emit(:PIPE, ts, te, meta, "|")
|
518
|
-
end
|
519
|
-
|
520
|
-
end
|
521
|
-
|
522
|
-
end
|
523
|
-
|
524
|
-
end
|
525
|
-
when 16 then
|
526
|
-
begin
|
527
|
-
begin
|
528
|
-
begin
|
529
|
-
te = p+1;
|
530
|
-
begin
|
531
|
-
emit(:AMP, ts, te, meta, "&")
|
532
|
-
end
|
533
|
-
|
534
|
-
end
|
535
|
-
|
536
|
-
end
|
537
|
-
|
538
|
-
end
|
539
|
-
when 12 then
|
540
|
-
begin
|
541
|
-
begin
|
542
|
-
begin
|
543
|
-
te = p+1;
|
544
|
-
begin
|
545
|
-
meta[:line] += 1
|
546
|
-
meta[:col] = 1
|
547
|
-
|
548
|
-
end
|
549
|
-
|
550
|
-
end
|
551
|
-
|
552
|
-
end
|
553
|
-
|
554
|
-
end
|
555
|
-
when 11 then
|
556
|
-
begin
|
557
|
-
begin
|
558
|
-
begin
|
559
|
-
te = p+1;
|
560
|
-
begin
|
561
|
-
emit(:UNKNOWN_CHAR, ts, te, meta)
|
562
|
-
end
|
563
|
-
|
564
|
-
end
|
565
|
-
|
566
|
-
end
|
567
|
-
|
568
|
-
end
|
569
|
-
when 36 then
|
570
|
-
begin
|
571
|
-
begin
|
572
|
-
begin
|
573
|
-
te = p;
|
574
|
-
p = p - 1;
|
575
|
-
begin
|
576
|
-
emit(:INT, ts, te, meta)
|
577
|
-
end
|
578
|
-
|
579
|
-
end
|
580
|
-
|
581
|
-
end
|
582
|
-
|
583
|
-
end
|
584
|
-
when 37 then
|
585
|
-
begin
|
586
|
-
begin
|
587
|
-
begin
|
588
|
-
te = p;
|
589
|
-
p = p - 1;
|
590
|
-
begin
|
591
|
-
emit(:FLOAT, ts, te, meta)
|
592
|
-
end
|
593
|
-
|
594
|
-
end
|
595
|
-
|
596
|
-
end
|
597
|
-
|
598
|
-
end
|
599
|
-
when 32 then
|
600
|
-
begin
|
601
|
-
begin
|
602
|
-
begin
|
603
|
-
te = p;
|
604
|
-
p = p - 1;
|
605
|
-
begin
|
606
|
-
emit_string(ts, te, meta, block: false)
|
607
|
-
end
|
608
|
-
|
609
|
-
end
|
610
|
-
|
611
|
-
end
|
612
|
-
|
613
|
-
end
|
614
|
-
when 33 then
|
615
|
-
begin
|
616
|
-
begin
|
617
|
-
begin
|
618
|
-
te = p;
|
619
|
-
p = p - 1;
|
620
|
-
begin
|
621
|
-
emit_string(ts, te, meta, block: true)
|
622
|
-
end
|
623
|
-
|
624
|
-
end
|
625
|
-
|
626
|
-
end
|
627
|
-
|
628
|
-
end
|
629
|
-
when 38 then
|
630
|
-
begin
|
631
|
-
begin
|
632
|
-
begin
|
633
|
-
te = p;
|
634
|
-
p = p - 1;
|
635
|
-
begin
|
636
|
-
emit(:IDENTIFIER, ts, te, meta)
|
637
|
-
end
|
638
|
-
|
639
|
-
end
|
640
|
-
|
641
|
-
end
|
642
|
-
|
643
|
-
end
|
644
|
-
when 35 then
|
645
|
-
begin
|
646
|
-
begin
|
647
|
-
begin
|
648
|
-
te = p;
|
649
|
-
p = p - 1;
|
650
|
-
begin
|
651
|
-
record_comment(ts, te, meta)
|
652
|
-
end
|
653
|
-
|
654
|
-
end
|
655
|
-
|
656
|
-
end
|
657
|
-
|
658
|
-
end
|
659
|
-
when 29 then
|
660
|
-
begin
|
661
|
-
begin
|
662
|
-
begin
|
663
|
-
te = p;
|
664
|
-
p = p - 1;
|
665
|
-
begin
|
666
|
-
meta[:col] += te - ts
|
667
|
-
end
|
668
|
-
|
669
|
-
end
|
670
|
-
|
671
|
-
end
|
672
|
-
|
673
|
-
end
|
674
|
-
when 30 then
|
675
|
-
begin
|
676
|
-
begin
|
677
|
-
begin
|
678
|
-
te = p;
|
679
|
-
p = p - 1;
|
680
|
-
begin
|
681
|
-
emit(:UNKNOWN_CHAR, ts, te, meta)
|
682
|
-
end
|
683
|
-
|
684
|
-
end
|
685
|
-
|
686
|
-
end
|
687
|
-
|
688
|
-
end
|
689
|
-
when 5 then
|
690
|
-
begin
|
691
|
-
begin
|
692
|
-
begin
|
693
|
-
p = ((te))-1;
|
694
|
-
begin
|
695
|
-
emit(:INT, ts, te, meta)
|
696
|
-
end
|
697
|
-
|
698
|
-
end
|
699
|
-
|
700
|
-
end
|
701
|
-
|
702
|
-
end
|
703
|
-
when 1 then
|
704
|
-
begin
|
705
|
-
begin
|
706
|
-
begin
|
707
|
-
p = ((te))-1;
|
708
|
-
begin
|
709
|
-
emit(:UNKNOWN_CHAR, ts, te, meta)
|
710
|
-
end
|
711
|
-
|
712
|
-
end
|
713
|
-
|
714
|
-
end
|
715
|
-
|
716
|
-
end
|
717
|
-
when 3 then
|
718
|
-
begin
|
719
|
-
begin
|
720
|
-
begin
|
721
|
-
case act
|
722
|
-
when -2 then
|
723
|
-
begin
|
724
|
-
end
|
725
|
-
when 2 then
|
726
|
-
begin
|
727
|
-
p = ((te))-1;
|
728
|
-
begin
|
729
|
-
emit(:INT, ts, te, meta)
|
730
|
-
end
|
731
|
-
|
732
|
-
end
|
733
|
-
when 3 then
|
734
|
-
begin
|
735
|
-
p = ((te))-1;
|
736
|
-
begin
|
737
|
-
emit(:FLOAT, ts, te, meta)
|
738
|
-
end
|
739
|
-
|
740
|
-
end
|
741
|
-
when 4 then
|
742
|
-
begin
|
743
|
-
p = ((te))-1;
|
744
|
-
begin
|
745
|
-
emit(:ON, ts, te, meta, "on")
|
746
|
-
end
|
747
|
-
|
748
|
-
end
|
749
|
-
when 5 then
|
750
|
-
begin
|
751
|
-
p = ((te))-1;
|
752
|
-
begin
|
753
|
-
emit(:FRAGMENT, ts, te, meta, "fragment")
|
754
|
-
end
|
755
|
-
|
756
|
-
end
|
757
|
-
when 6 then
|
758
|
-
begin
|
759
|
-
p = ((te))-1;
|
760
|
-
begin
|
761
|
-
emit(:TRUE, ts, te, meta, "true")
|
762
|
-
end
|
763
|
-
|
764
|
-
end
|
765
|
-
when 7 then
|
766
|
-
begin
|
767
|
-
p = ((te))-1;
|
768
|
-
begin
|
769
|
-
emit(:FALSE, ts, te, meta, "false")
|
770
|
-
end
|
771
|
-
|
772
|
-
end
|
773
|
-
when 8 then
|
774
|
-
begin
|
775
|
-
p = ((te))-1;
|
776
|
-
begin
|
777
|
-
emit(:NULL, ts, te, meta, "null")
|
778
|
-
end
|
779
|
-
|
780
|
-
end
|
781
|
-
when 9 then
|
782
|
-
begin
|
783
|
-
p = ((te))-1;
|
784
|
-
begin
|
785
|
-
emit(:QUERY, ts, te, meta, "query")
|
786
|
-
end
|
787
|
-
|
788
|
-
end
|
789
|
-
when 10 then
|
790
|
-
begin
|
791
|
-
p = ((te))-1;
|
792
|
-
begin
|
793
|
-
emit(:MUTATION, ts, te, meta, "mutation")
|
794
|
-
end
|
795
|
-
|
796
|
-
end
|
797
|
-
when 11 then
|
798
|
-
begin
|
799
|
-
p = ((te))-1;
|
800
|
-
begin
|
801
|
-
emit(:SUBSCRIPTION, ts, te, meta, "subscription")
|
802
|
-
end
|
803
|
-
|
804
|
-
end
|
805
|
-
when 12 then
|
806
|
-
begin
|
807
|
-
p = ((te))-1;
|
808
|
-
begin
|
809
|
-
emit(:SCHEMA, ts, te, meta)
|
810
|
-
end
|
811
|
-
|
812
|
-
end
|
813
|
-
when 13 then
|
814
|
-
begin
|
815
|
-
p = ((te))-1;
|
816
|
-
begin
|
817
|
-
emit(:SCALAR, ts, te, meta)
|
818
|
-
end
|
819
|
-
|
820
|
-
end
|
821
|
-
when 14 then
|
822
|
-
begin
|
823
|
-
p = ((te))-1;
|
824
|
-
begin
|
825
|
-
emit(:TYPE, ts, te, meta)
|
826
|
-
end
|
827
|
-
|
828
|
-
end
|
829
|
-
when 15 then
|
830
|
-
begin
|
831
|
-
p = ((te))-1;
|
832
|
-
begin
|
833
|
-
emit(:EXTEND, ts, te, meta)
|
834
|
-
end
|
835
|
-
|
836
|
-
end
|
837
|
-
when 16 then
|
838
|
-
begin
|
839
|
-
p = ((te))-1;
|
840
|
-
begin
|
841
|
-
emit(:IMPLEMENTS, ts, te, meta)
|
842
|
-
end
|
843
|
-
|
844
|
-
end
|
845
|
-
when 17 then
|
846
|
-
begin
|
847
|
-
p = ((te))-1;
|
848
|
-
begin
|
849
|
-
emit(:INTERFACE, ts, te, meta)
|
850
|
-
end
|
851
|
-
|
852
|
-
end
|
853
|
-
when 18 then
|
854
|
-
begin
|
855
|
-
p = ((te))-1;
|
856
|
-
begin
|
857
|
-
emit(:UNION, ts, te, meta)
|
858
|
-
end
|
859
|
-
|
860
|
-
end
|
861
|
-
when 19 then
|
862
|
-
begin
|
863
|
-
p = ((te))-1;
|
864
|
-
begin
|
865
|
-
emit(:ENUM, ts, te, meta)
|
866
|
-
end
|
867
|
-
|
868
|
-
end
|
869
|
-
when 20 then
|
870
|
-
begin
|
871
|
-
p = ((te))-1;
|
872
|
-
begin
|
873
|
-
emit(:INPUT, ts, te, meta)
|
874
|
-
end
|
875
|
-
|
876
|
-
end
|
877
|
-
when 21 then
|
878
|
-
begin
|
879
|
-
p = ((te))-1;
|
880
|
-
begin
|
881
|
-
emit(:DIRECTIVE, ts, te, meta)
|
882
|
-
end
|
883
|
-
|
884
|
-
end
|
885
|
-
when 29 then
|
886
|
-
begin
|
887
|
-
p = ((te))-1;
|
888
|
-
begin
|
889
|
-
emit_string(ts, te, meta, block: false)
|
890
|
-
end
|
891
|
-
|
892
|
-
end
|
893
|
-
when 30 then
|
894
|
-
begin
|
895
|
-
p = ((te))-1;
|
896
|
-
begin
|
897
|
-
emit_string(ts, te, meta, block: true)
|
898
|
-
end
|
899
|
-
|
900
|
-
end
|
901
|
-
when 38 then
|
902
|
-
begin
|
903
|
-
p = ((te))-1;
|
904
|
-
begin
|
905
|
-
emit(:IDENTIFIER, ts, te, meta)
|
906
|
-
end
|
907
|
-
|
908
|
-
|
909
|
-
end
|
910
|
-
end
|
911
|
-
|
912
|
-
end
|
913
|
-
|
914
|
-
|
915
|
-
end
|
916
|
-
|
917
|
-
end
|
918
|
-
when 19 then
|
919
|
-
begin
|
920
|
-
begin
|
921
|
-
begin
|
922
|
-
te = p+1;
|
923
|
-
|
924
|
-
end
|
925
|
-
|
926
|
-
end
|
927
|
-
begin
|
928
|
-
begin
|
929
|
-
act = 2;
|
930
|
-
|
931
|
-
end
|
932
|
-
|
933
|
-
end
|
934
|
-
|
935
|
-
end
|
936
|
-
when 6 then
|
937
|
-
begin
|
938
|
-
begin
|
939
|
-
begin
|
940
|
-
te = p+1;
|
941
|
-
|
942
|
-
end
|
943
|
-
|
944
|
-
end
|
945
|
-
begin
|
946
|
-
begin
|
947
|
-
act = 3;
|
948
|
-
|
949
|
-
end
|
950
|
-
|
951
|
-
end
|
952
|
-
|
953
|
-
end
|
954
|
-
when 49 then
|
955
|
-
begin
|
956
|
-
begin
|
957
|
-
begin
|
958
|
-
te = p+1;
|
959
|
-
|
960
|
-
end
|
961
|
-
|
962
|
-
end
|
963
|
-
begin
|
964
|
-
begin
|
965
|
-
act = 4;
|
966
|
-
|
967
|
-
end
|
968
|
-
|
969
|
-
end
|
970
|
-
|
971
|
-
end
|
972
|
-
when 43 then
|
973
|
-
begin
|
974
|
-
begin
|
975
|
-
begin
|
976
|
-
te = p+1;
|
977
|
-
|
978
|
-
end
|
979
|
-
|
980
|
-
end
|
981
|
-
begin
|
982
|
-
begin
|
983
|
-
act = 5;
|
984
|
-
|
985
|
-
end
|
986
|
-
|
987
|
-
end
|
988
|
-
|
989
|
-
end
|
990
|
-
when 54 then
|
991
|
-
begin
|
992
|
-
begin
|
993
|
-
begin
|
994
|
-
te = p+1;
|
995
|
-
|
996
|
-
end
|
997
|
-
|
998
|
-
end
|
999
|
-
begin
|
1000
|
-
begin
|
1001
|
-
act = 6;
|
1002
|
-
|
1003
|
-
end
|
1004
|
-
|
1005
|
-
end
|
1006
|
-
|
1007
|
-
end
|
1008
|
-
when 42 then
|
1009
|
-
begin
|
1010
|
-
begin
|
1011
|
-
begin
|
1012
|
-
te = p+1;
|
1013
|
-
|
1014
|
-
end
|
1015
|
-
|
1016
|
-
end
|
1017
|
-
begin
|
1018
|
-
begin
|
1019
|
-
act = 7;
|
1020
|
-
|
1021
|
-
end
|
1022
|
-
|
1023
|
-
end
|
1024
|
-
|
1025
|
-
end
|
1026
|
-
when 48 then
|
1027
|
-
begin
|
1028
|
-
begin
|
1029
|
-
begin
|
1030
|
-
te = p+1;
|
1031
|
-
|
1032
|
-
end
|
1033
|
-
|
1034
|
-
end
|
1035
|
-
begin
|
1036
|
-
begin
|
1037
|
-
act = 8;
|
1038
|
-
|
1039
|
-
end
|
1040
|
-
|
1041
|
-
end
|
1042
|
-
|
1043
|
-
end
|
1044
|
-
when 50 then
|
1045
|
-
begin
|
1046
|
-
begin
|
1047
|
-
begin
|
1048
|
-
te = p+1;
|
1049
|
-
|
1050
|
-
end
|
1051
|
-
|
1052
|
-
end
|
1053
|
-
begin
|
1054
|
-
begin
|
1055
|
-
act = 9;
|
1056
|
-
|
1057
|
-
end
|
1058
|
-
|
1059
|
-
end
|
1060
|
-
|
1061
|
-
end
|
1062
|
-
when 47 then
|
1063
|
-
begin
|
1064
|
-
begin
|
1065
|
-
begin
|
1066
|
-
te = p+1;
|
1067
|
-
|
1068
|
-
end
|
1069
|
-
|
1070
|
-
end
|
1071
|
-
begin
|
1072
|
-
begin
|
1073
|
-
act = 10;
|
1074
|
-
|
1075
|
-
end
|
1076
|
-
|
1077
|
-
end
|
1078
|
-
|
1079
|
-
end
|
1080
|
-
when 53 then
|
1081
|
-
begin
|
1082
|
-
begin
|
1083
|
-
begin
|
1084
|
-
te = p+1;
|
1085
|
-
|
1086
|
-
end
|
1087
|
-
|
1088
|
-
end
|
1089
|
-
begin
|
1090
|
-
begin
|
1091
|
-
act = 11;
|
1092
|
-
|
1093
|
-
end
|
1094
|
-
|
1095
|
-
end
|
1096
|
-
|
1097
|
-
end
|
1098
|
-
when 52 then
|
1099
|
-
begin
|
1100
|
-
begin
|
1101
|
-
begin
|
1102
|
-
te = p+1;
|
1103
|
-
|
1104
|
-
end
|
1105
|
-
|
1106
|
-
end
|
1107
|
-
begin
|
1108
|
-
begin
|
1109
|
-
act = 12;
|
1110
|
-
|
1111
|
-
end
|
1112
|
-
|
1113
|
-
end
|
1114
|
-
|
1115
|
-
end
|
1116
|
-
when 51 then
|
1117
|
-
begin
|
1118
|
-
begin
|
1119
|
-
begin
|
1120
|
-
te = p+1;
|
1121
|
-
|
1122
|
-
end
|
1123
|
-
|
1124
|
-
end
|
1125
|
-
begin
|
1126
|
-
begin
|
1127
|
-
act = 13;
|
1128
|
-
|
1129
|
-
end
|
1130
|
-
|
1131
|
-
end
|
1132
|
-
|
1133
|
-
end
|
1134
|
-
when 55 then
|
1135
|
-
begin
|
1136
|
-
begin
|
1137
|
-
begin
|
1138
|
-
te = p+1;
|
1139
|
-
|
1140
|
-
end
|
1141
|
-
|
1142
|
-
end
|
1143
|
-
begin
|
1144
|
-
begin
|
1145
|
-
act = 14;
|
1146
|
-
|
1147
|
-
end
|
1148
|
-
|
1149
|
-
end
|
1150
|
-
|
1151
|
-
end
|
1152
|
-
when 41 then
|
1153
|
-
begin
|
1154
|
-
begin
|
1155
|
-
begin
|
1156
|
-
te = p+1;
|
1157
|
-
|
1158
|
-
end
|
1159
|
-
|
1160
|
-
end
|
1161
|
-
begin
|
1162
|
-
begin
|
1163
|
-
act = 15;
|
1164
|
-
|
1165
|
-
end
|
1166
|
-
|
1167
|
-
end
|
1168
|
-
|
1169
|
-
end
|
1170
|
-
when 44 then
|
1171
|
-
begin
|
1172
|
-
begin
|
1173
|
-
begin
|
1174
|
-
te = p+1;
|
1175
|
-
|
1176
|
-
end
|
1177
|
-
|
1178
|
-
end
|
1179
|
-
begin
|
1180
|
-
begin
|
1181
|
-
act = 16;
|
1182
|
-
|
1183
|
-
end
|
1184
|
-
|
1185
|
-
end
|
1186
|
-
|
1187
|
-
end
|
1188
|
-
when 46 then
|
1189
|
-
begin
|
1190
|
-
begin
|
1191
|
-
begin
|
1192
|
-
te = p+1;
|
1193
|
-
|
1194
|
-
end
|
1195
|
-
|
1196
|
-
end
|
1197
|
-
begin
|
1198
|
-
begin
|
1199
|
-
act = 17;
|
1200
|
-
|
1201
|
-
end
|
1202
|
-
|
1203
|
-
end
|
1204
|
-
|
1205
|
-
end
|
1206
|
-
when 56 then
|
1207
|
-
begin
|
1208
|
-
begin
|
1209
|
-
begin
|
1210
|
-
te = p+1;
|
1211
|
-
|
1212
|
-
end
|
1213
|
-
|
1214
|
-
end
|
1215
|
-
begin
|
1216
|
-
begin
|
1217
|
-
act = 18;
|
1218
|
-
|
1219
|
-
end
|
1220
|
-
|
1221
|
-
end
|
1222
|
-
|
1223
|
-
end
|
1224
|
-
when 40 then
|
1225
|
-
begin
|
1226
|
-
begin
|
1227
|
-
begin
|
1228
|
-
te = p+1;
|
1229
|
-
|
1230
|
-
end
|
1231
|
-
|
1232
|
-
end
|
1233
|
-
begin
|
1234
|
-
begin
|
1235
|
-
act = 19;
|
1236
|
-
|
1237
|
-
end
|
1238
|
-
|
1239
|
-
end
|
1240
|
-
|
1241
|
-
end
|
1242
|
-
when 45 then
|
1243
|
-
begin
|
1244
|
-
begin
|
1245
|
-
begin
|
1246
|
-
te = p+1;
|
1247
|
-
|
1248
|
-
end
|
1249
|
-
|
1250
|
-
end
|
1251
|
-
begin
|
1252
|
-
begin
|
1253
|
-
act = 20;
|
1254
|
-
|
1255
|
-
end
|
1256
|
-
|
1257
|
-
end
|
1258
|
-
|
1259
|
-
end
|
1260
|
-
when 39 then
|
1261
|
-
begin
|
1262
|
-
begin
|
1263
|
-
begin
|
1264
|
-
te = p+1;
|
1265
|
-
|
1266
|
-
end
|
1267
|
-
|
1268
|
-
end
|
1269
|
-
begin
|
1270
|
-
begin
|
1271
|
-
act = 21;
|
1272
|
-
|
1273
|
-
end
|
1274
|
-
|
1275
|
-
end
|
1276
|
-
|
1277
|
-
end
|
1278
|
-
when 31 then
|
1279
|
-
begin
|
1280
|
-
begin
|
1281
|
-
begin
|
1282
|
-
te = p+1;
|
1283
|
-
|
1284
|
-
end
|
1285
|
-
|
1286
|
-
end
|
1287
|
-
begin
|
1288
|
-
begin
|
1289
|
-
act = 29;
|
1290
|
-
|
1291
|
-
end
|
1292
|
-
|
1293
|
-
end
|
1294
|
-
|
1295
|
-
end
|
1296
|
-
when 4 then
|
1297
|
-
begin
|
1298
|
-
begin
|
1299
|
-
begin
|
1300
|
-
te = p+1;
|
1301
|
-
|
1302
|
-
end
|
1303
|
-
|
1304
|
-
end
|
1305
|
-
begin
|
1306
|
-
begin
|
1307
|
-
act = 30;
|
1308
|
-
|
1309
|
-
end
|
1310
|
-
|
1311
|
-
end
|
1312
|
-
|
1313
|
-
end
|
1314
|
-
when 23 then
|
1315
|
-
begin
|
1316
|
-
begin
|
1317
|
-
begin
|
1318
|
-
te = p+1;
|
1319
|
-
|
1320
|
-
end
|
1321
|
-
|
1322
|
-
end
|
1323
|
-
begin
|
1324
|
-
begin
|
1325
|
-
act = 38;
|
1326
|
-
|
1327
|
-
end
|
1328
|
-
|
1329
|
-
end
|
1330
|
-
|
1331
|
-
|
1332
|
-
end
|
1333
|
-
end
|
1334
|
-
case _graphql_lexer_to_state_actions[cs]
|
1335
|
-
when -2 then
|
1336
|
-
begin
|
1337
|
-
end
|
1338
|
-
when 9 then
|
1339
|
-
begin
|
1340
|
-
begin
|
1341
|
-
begin
|
1342
|
-
ts = 0;
|
1343
|
-
|
1344
|
-
end
|
1345
|
-
|
1346
|
-
end
|
1347
|
-
|
1348
|
-
|
1349
|
-
end
|
1350
|
-
end
|
1351
|
-
if ( cs == 0 )
|
1352
|
-
_cont = 0;
|
1353
|
-
|
1354
|
-
end
|
1355
|
-
if ( _cont == 1 )
|
1356
|
-
p += 1;
|
1357
|
-
|
1358
|
-
end
|
1359
|
-
|
1360
|
-
end
|
1361
|
-
|
1362
|
-
end
|
1363
|
-
|
1364
|
-
end
|
1365
|
-
|
1366
|
-
end
|
1367
|
-
|
1368
|
-
end
|
1369
|
-
|
1370
|
-
end
|
1371
|
-
|
1372
|
-
end
|
1373
|
-
meta[:tokens]
|
1374
|
-
end
|
1375
|
-
|
1376
|
-
def self.record_comment(ts, te, meta)
|
1377
|
-
token = GraphQL::Language::Token.new(
|
1378
|
-
:COMMENT,
|
1379
|
-
meta[:data][ts, te - ts].pack(PACK_DIRECTIVE).force_encoding(UTF_8_ENCODING),
|
1380
|
-
meta[:line],
|
1381
|
-
meta[:col],
|
1382
|
-
meta[:previous_token],
|
1383
|
-
)
|
1384
|
-
|
1385
|
-
meta[:previous_token] = token
|
1386
|
-
|
1387
|
-
meta[:col] += te - ts
|
1388
|
-
end
|
1389
|
-
|
1390
|
-
def self.emit(token_name, ts, te, meta, token_value = nil)
|
1391
|
-
token_value ||= meta[:data][ts, te - ts].pack(PACK_DIRECTIVE).force_encoding(UTF_8_ENCODING)
|
1392
|
-
meta[:tokens] << token = GraphQL::Language::Token.new(
|
1393
|
-
token_name,
|
1394
|
-
token_value,
|
1395
|
-
meta[:line],
|
1396
|
-
meta[:col],
|
1397
|
-
meta[:previous_token],
|
1398
|
-
)
|
1399
|
-
meta[:previous_token] = token
|
1400
|
-
# Bump the column counter for the next token
|
1401
|
-
meta[:col] += te - ts
|
1402
|
-
end
|
1403
|
-
|
1404
|
-
ESCAPES = /\\["\\\/bfnrt]/
|
1405
|
-
ESCAPES_REPLACE = {
|
1406
|
-
'\\"' => '"',
|
1407
|
-
"\\\\" => "\\",
|
1408
|
-
"\\/" => '/',
|
1409
|
-
"\\b" => "\b",
|
1410
|
-
"\\f" => "\f",
|
1411
|
-
"\\n" => "\n",
|
1412
|
-
"\\r" => "\r",
|
1413
|
-
"\\t" => "\t",
|
1414
|
-
}
|
1415
|
-
|
1416
|
-
UTF_8 = /\\u[\dAa-f]{4}/i
|
1417
|
-
UTF_8_REPLACE = ->(m) { [m[-4..-1].to_i(16)].pack('U'.freeze) }
|
1418
|
-
|
1419
|
-
VALID_STRING = /\A(?:[^\\]|#{ESCAPES}|#{UTF_8})*\z/o
|
1420
|
-
|
1421
|
-
PACK_DIRECTIVE = "c*"
|
1422
|
-
UTF_8_ENCODING = "UTF-8"
|
1423
|
-
|
1424
|
-
def self.emit_string(ts, te, meta, block:)
|
1425
|
-
quotes_length = block ? 3 : 1
|
1426
|
-
value = meta[:data][ts + quotes_length, te - ts - 2 * quotes_length].pack(PACK_DIRECTIVE).force_encoding(UTF_8_ENCODING) || ''
|
1427
|
-
line_incr = 0
|
1428
|
-
if block && !value.empty?
|
1429
|
-
line_incr = value.count("\n")
|
1430
|
-
value = GraphQL::Language::BlockString.trim_whitespace(value)
|
1431
|
-
end
|
1432
|
-
# TODO: replace with `String#match?` when we support only Ruby 2.4+
|
1433
|
-
# (It's faster: https://bugs.ruby-lang.org/issues/8110)
|
1434
|
-
if !value.valid_encoding? || !value.match?(VALID_STRING)
|
1435
|
-
meta[:tokens] << token = GraphQL::Language::Token.new(
|
1436
|
-
:BAD_UNICODE_ESCAPE,
|
1437
|
-
value,
|
1438
|
-
meta[:line],
|
1439
|
-
meta[:col],
|
1440
|
-
meta[:previous_token],
|
1441
|
-
)
|
1442
|
-
else
|
1443
|
-
replace_escaped_characters_in_place(value)
|
1444
|
-
|
1445
|
-
if !value.valid_encoding?
|
1446
|
-
meta[:tokens] << token = GraphQL::Language::Token.new(
|
1447
|
-
:BAD_UNICODE_ESCAPE,
|
1448
|
-
value,
|
1449
|
-
meta[:line],
|
1450
|
-
meta[:col],
|
1451
|
-
meta[:previous_token],
|
1452
|
-
)
|
1453
|
-
else
|
1454
|
-
meta[:tokens] << token = GraphQL::Language::Token.new(
|
1455
|
-
:STRING,
|
1456
|
-
value,
|
1457
|
-
meta[:line],
|
1458
|
-
meta[:col],
|
1459
|
-
meta[:previous_token],
|
1460
|
-
)
|
1461
|
-
end
|
1462
|
-
end
|
1463
|
-
|
1464
|
-
meta[:previous_token] = token
|
1465
|
-
meta[:col] += te - ts
|
1466
|
-
meta[:line] += line_incr
|
1467
|
-
end
|
1468
|
-
end
|
1469
|
-
end
|
3
|
+
module Language
|
4
|
+
|
5
|
+
class Lexer
|
6
|
+
def initialize(graphql_str, filename: nil, max_tokens: nil)
|
7
|
+
if !(graphql_str.encoding == Encoding::UTF_8 || graphql_str.ascii_only?)
|
8
|
+
graphql_str = graphql_str.dup.force_encoding(Encoding::UTF_8)
|
9
|
+
end
|
10
|
+
@string = graphql_str
|
11
|
+
@filename = filename
|
12
|
+
@scanner = StringScanner.new(graphql_str)
|
13
|
+
@pos = nil
|
14
|
+
@max_tokens = max_tokens || Float::INFINITY
|
15
|
+
@tokens_count = 0
|
16
|
+
end
|
17
|
+
|
18
|
+
def eos?
|
19
|
+
@scanner.eos?
|
20
|
+
end
|
21
|
+
|
22
|
+
attr_reader :pos, :tokens_count
|
23
|
+
|
24
|
+
def advance
|
25
|
+
@scanner.skip(IGNORE_REGEXP)
|
26
|
+
return false if @scanner.eos?
|
27
|
+
@tokens_count += 1
|
28
|
+
if @tokens_count > @max_tokens
|
29
|
+
raise_parse_error("This query is too large to execute.")
|
30
|
+
end
|
31
|
+
@pos = @scanner.pos
|
32
|
+
next_byte = @string.getbyte(@pos)
|
33
|
+
next_byte_is_for = FIRST_BYTES[next_byte]
|
34
|
+
case next_byte_is_for
|
35
|
+
when ByteFor::PUNCTUATION
|
36
|
+
@scanner.pos += 1
|
37
|
+
PUNCTUATION_NAME_FOR_BYTE[next_byte]
|
38
|
+
when ByteFor::NAME
|
39
|
+
if len = @scanner.skip(KEYWORD_REGEXP)
|
40
|
+
case len
|
41
|
+
when 2
|
42
|
+
:ON
|
43
|
+
when 12
|
44
|
+
:SUBSCRIPTION
|
45
|
+
else
|
46
|
+
pos = @pos
|
47
|
+
|
48
|
+
# Use bytes 2 and 3 as a unique identifier for this keyword
|
49
|
+
bytes = (@string.getbyte(pos + 2) << 8) | @string.getbyte(pos + 1)
|
50
|
+
KEYWORD_BY_TWO_BYTES[_hash(bytes)]
|
51
|
+
end
|
52
|
+
else
|
53
|
+
@scanner.skip(IDENTIFIER_REGEXP)
|
54
|
+
:IDENTIFIER
|
55
|
+
end
|
56
|
+
when ByteFor::IDENTIFIER
|
57
|
+
@scanner.skip(IDENTIFIER_REGEXP)
|
58
|
+
:IDENTIFIER
|
59
|
+
when ByteFor::NUMBER
|
60
|
+
if len = @scanner.skip(NUMERIC_REGEXP)
|
61
|
+
|
62
|
+
if GraphQL.reject_numbers_followed_by_names
|
63
|
+
new_pos = @scanner.pos
|
64
|
+
peek_byte = @string.getbyte(new_pos)
|
65
|
+
next_first_byte = FIRST_BYTES[peek_byte]
|
66
|
+
if next_first_byte == ByteFor::NAME || next_first_byte == ByteFor::IDENTIFIER
|
67
|
+
number_part = token_value
|
68
|
+
name_part = @scanner.scan(IDENTIFIER_REGEXP)
|
69
|
+
raise_parse_error("Name after number is not allowed (in `#{number_part}#{name_part}`)")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
# Check for a matched decimal:
|
73
|
+
@scanner[1] ? :FLOAT : :INT
|
74
|
+
else
|
75
|
+
# Attempt to find the part after the `-`
|
76
|
+
value = @scanner.scan(/-\s?[a-z0-9]*/i)
|
77
|
+
invalid_byte_for_number_error_message = "Expected type 'number', but it was malformed#{value.nil? ? "" : ": #{value.inspect}"}."
|
78
|
+
raise_parse_error(invalid_byte_for_number_error_message)
|
79
|
+
end
|
80
|
+
when ByteFor::ELLIPSIS
|
81
|
+
if @string.getbyte(@pos + 1) != 46 || @string.getbyte(@pos + 2) != 46
|
82
|
+
raise_parse_error("Expected `...`, actual: #{@string[@pos..@pos + 2].inspect}")
|
83
|
+
end
|
84
|
+
@scanner.pos += 3
|
85
|
+
:ELLIPSIS
|
86
|
+
when ByteFor::STRING
|
87
|
+
if @scanner.skip(BLOCK_STRING_REGEXP) || @scanner.skip(QUOTED_STRING_REGEXP)
|
88
|
+
:STRING
|
89
|
+
else
|
90
|
+
raise_parse_error("Expected string or block string, but it was malformed")
|
91
|
+
end
|
92
|
+
else
|
93
|
+
@scanner.pos += 1
|
94
|
+
:UNKNOWN_CHAR
|
95
|
+
end
|
96
|
+
rescue ArgumentError => err
|
97
|
+
if err.message == "invalid byte sequence in UTF-8"
|
98
|
+
raise_parse_error("Parse error on bad Unicode escape sequence", nil, nil)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def token_value
|
103
|
+
@string.byteslice(@scanner.pos - @scanner.matched_size, @scanner.matched_size)
|
104
|
+
rescue StandardError => err
|
105
|
+
raise GraphQL::Error, "(token_value failed: #{err.class}: #{err.message})"
|
106
|
+
end
|
107
|
+
|
108
|
+
def debug_token_value(token_name)
|
109
|
+
if token_name && Lexer::Punctuation.const_defined?(token_name)
|
110
|
+
Lexer::Punctuation.const_get(token_name)
|
111
|
+
elsif token_name == :ELLIPSIS
|
112
|
+
"..."
|
113
|
+
elsif token_name == :STRING
|
114
|
+
string_value
|
115
|
+
elsif @scanner.matched_size.nil?
|
116
|
+
@scanner.peek(1)
|
117
|
+
else
|
118
|
+
token_value
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
ESCAPES = /\\["\\\/bfnrt]/
|
123
|
+
ESCAPES_REPLACE = {
|
124
|
+
'\\"' => '"',
|
125
|
+
"\\\\" => "\\",
|
126
|
+
"\\/" => '/',
|
127
|
+
"\\b" => "\b",
|
128
|
+
"\\f" => "\f",
|
129
|
+
"\\n" => "\n",
|
130
|
+
"\\r" => "\r",
|
131
|
+
"\\t" => "\t",
|
132
|
+
}
|
133
|
+
UTF_8 = /\\u(?:([\dAa-f]{4})|\{([\da-f]{4,})\})(?:\\u([\dAa-f]{4}))?/i
|
134
|
+
VALID_STRING = /\A(?:[^\\]|#{ESCAPES}|#{UTF_8})*\z/o
|
135
|
+
ESCAPED = /(?:#{ESCAPES}|#{UTF_8})/o
|
136
|
+
|
137
|
+
def string_value
|
138
|
+
str = token_value
|
139
|
+
is_block = str.start_with?('"""')
|
140
|
+
if is_block
|
141
|
+
str.gsub!(/\A"""|"""\z/, '')
|
142
|
+
return Language::BlockString.trim_whitespace(str)
|
143
|
+
else
|
144
|
+
str.gsub!(/\A"|"\z/, '')
|
145
|
+
|
146
|
+
if !str.valid_encoding? || !str.match?(VALID_STRING)
|
147
|
+
raise_parse_error("Bad unicode escape in #{str.inspect}")
|
148
|
+
else
|
149
|
+
Lexer.replace_escaped_characters_in_place(str)
|
150
|
+
|
151
|
+
if !str.valid_encoding?
|
152
|
+
raise_parse_error("Bad unicode escape in #{str.inspect}")
|
153
|
+
else
|
154
|
+
str
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def line_number
|
161
|
+
@scanner.string[0..@pos].count("\n") + 1
|
162
|
+
end
|
163
|
+
|
164
|
+
def column_number
|
165
|
+
@scanner.string[0..@pos].split("\n").last.length
|
166
|
+
end
|
167
|
+
|
168
|
+
def raise_parse_error(message, line = line_number, col = column_number)
|
169
|
+
raise GraphQL::ParseError.new(message, line, col, @string, filename: @filename)
|
170
|
+
end
|
171
|
+
|
172
|
+
IGNORE_REGEXP = %r{
|
173
|
+
(?:
|
174
|
+
[, \c\r\n\t]+ |
|
175
|
+
\#.*$
|
176
|
+
)*
|
177
|
+
}x
|
178
|
+
IDENTIFIER_REGEXP = /[_A-Za-z][_0-9A-Za-z]*/
|
179
|
+
INT_REGEXP = /-?(?:[0]|[1-9][0-9]*)/
|
180
|
+
FLOAT_DECIMAL_REGEXP = /[.][0-9]+/
|
181
|
+
FLOAT_EXP_REGEXP = /[eE][+-]?[0-9]+/
|
182
|
+
# TODO: FLOAT_EXP_REGEXP should not be allowed to follow INT_REGEXP, integers are not allowed to have exponent parts.
|
183
|
+
NUMERIC_REGEXP = /#{INT_REGEXP}(#{FLOAT_DECIMAL_REGEXP}#{FLOAT_EXP_REGEXP}|#{FLOAT_DECIMAL_REGEXP}|#{FLOAT_EXP_REGEXP})?/
|
184
|
+
|
185
|
+
KEYWORDS = [
|
186
|
+
"on",
|
187
|
+
"fragment",
|
188
|
+
"true",
|
189
|
+
"false",
|
190
|
+
"null",
|
191
|
+
"query",
|
192
|
+
"mutation",
|
193
|
+
"subscription",
|
194
|
+
"schema",
|
195
|
+
"scalar",
|
196
|
+
"type",
|
197
|
+
"extend",
|
198
|
+
"implements",
|
199
|
+
"interface",
|
200
|
+
"union",
|
201
|
+
"enum",
|
202
|
+
"input",
|
203
|
+
"directive",
|
204
|
+
"repeatable"
|
205
|
+
].freeze
|
206
|
+
|
207
|
+
KEYWORD_REGEXP = /#{Regexp.union(KEYWORDS.sort)}\b/
|
208
|
+
KEYWORD_BY_TWO_BYTES = [
|
209
|
+
:INTERFACE,
|
210
|
+
:MUTATION,
|
211
|
+
:EXTEND,
|
212
|
+
:FALSE,
|
213
|
+
:ENUM,
|
214
|
+
:TRUE,
|
215
|
+
:NULL,
|
216
|
+
nil,
|
217
|
+
nil,
|
218
|
+
nil,
|
219
|
+
nil,
|
220
|
+
nil,
|
221
|
+
nil,
|
222
|
+
nil,
|
223
|
+
:QUERY,
|
224
|
+
nil,
|
225
|
+
nil,
|
226
|
+
:REPEATABLE,
|
227
|
+
:IMPLEMENTS,
|
228
|
+
:INPUT,
|
229
|
+
:TYPE,
|
230
|
+
:SCHEMA,
|
231
|
+
nil,
|
232
|
+
nil,
|
233
|
+
nil,
|
234
|
+
:DIRECTIVE,
|
235
|
+
:UNION,
|
236
|
+
nil,
|
237
|
+
nil,
|
238
|
+
:SCALAR,
|
239
|
+
nil,
|
240
|
+
:FRAGMENT
|
241
|
+
]
|
242
|
+
|
243
|
+
# This produces a unique integer for bytes 2 and 3 of each keyword string
|
244
|
+
# See https://tenderlovemaking.com/2023/09/02/fast-tokenizers-with-stringscanner.html
|
245
|
+
def _hash key
|
246
|
+
(key * 18592990) >> 27 & 0x1f
|
247
|
+
end
|
248
|
+
|
249
|
+
module Punctuation
|
250
|
+
LCURLY = '{'
|
251
|
+
RCURLY = '}'
|
252
|
+
LPAREN = '('
|
253
|
+
RPAREN = ')'
|
254
|
+
LBRACKET = '['
|
255
|
+
RBRACKET = ']'
|
256
|
+
COLON = ':'
|
257
|
+
VAR_SIGN = '$'
|
258
|
+
DIR_SIGN = '@'
|
259
|
+
EQUALS = '='
|
260
|
+
BANG = '!'
|
261
|
+
PIPE = '|'
|
262
|
+
AMP = '&'
|
263
|
+
end
|
264
|
+
|
265
|
+
# A sparse array mapping the bytes for each punctuation
|
266
|
+
# to a symbol name for that punctuation
|
267
|
+
PUNCTUATION_NAME_FOR_BYTE = Punctuation.constants.each_with_object([]) { |name, arr|
|
268
|
+
punct = Punctuation.const_get(name)
|
269
|
+
arr[punct.ord] = name
|
270
|
+
}
|
271
|
+
|
272
|
+
QUOTE = '"'
|
273
|
+
UNICODE_DIGIT = /[0-9A-Za-z]/
|
274
|
+
FOUR_DIGIT_UNICODE = /#{UNICODE_DIGIT}{4}/
|
275
|
+
N_DIGIT_UNICODE = %r{#{Punctuation::LCURLY}#{UNICODE_DIGIT}{4,}#{Punctuation::RCURLY}}x
|
276
|
+
UNICODE_ESCAPE = %r{\\u(?:#{FOUR_DIGIT_UNICODE}|#{N_DIGIT_UNICODE})}
|
277
|
+
STRING_ESCAPE = %r{[\\][\\/bfnrt]}
|
278
|
+
BLOCK_QUOTE = '"""'
|
279
|
+
ESCAPED_QUOTE = /\\"/;
|
280
|
+
STRING_CHAR = /#{ESCAPED_QUOTE}|[^"\\\n\r]|#{UNICODE_ESCAPE}|#{STRING_ESCAPE}/
|
281
|
+
QUOTED_STRING_REGEXP = %r{#{QUOTE} (?:#{STRING_CHAR})* #{QUOTE}}x
|
282
|
+
BLOCK_STRING_REGEXP = %r{
|
283
|
+
#{BLOCK_QUOTE}
|
284
|
+
(?: [^"\\] | # Any characters that aren't a quote or slash
|
285
|
+
(?<!") ["]{1,2} (?!") | # Any quotes that don't have quotes next to them
|
286
|
+
\\"{0,3}(?!") | # A slash followed by <= 3 quotes that aren't followed by a quote
|
287
|
+
\\ | # A slash
|
288
|
+
"{1,2}(?!") # 1 or 2 " followed by something that isn't a quote
|
289
|
+
)*
|
290
|
+
(?:"")?
|
291
|
+
#{BLOCK_QUOTE}
|
292
|
+
}xm
|
293
|
+
|
294
|
+
# Use this array to check, for a given byte that will start a token,
|
295
|
+
# what kind of token might it start?
|
296
|
+
FIRST_BYTES = Array.new(255)
|
297
|
+
|
298
|
+
module ByteFor
|
299
|
+
NUMBER = 0 # int or float
|
300
|
+
NAME = 1 # identifier or keyword
|
301
|
+
STRING = 2
|
302
|
+
ELLIPSIS = 3
|
303
|
+
IDENTIFIER = 4 # identifier, *not* a keyword
|
304
|
+
PUNCTUATION = 5
|
305
|
+
end
|
306
|
+
|
307
|
+
(0..9).each { |i| FIRST_BYTES[i.to_s.ord] = ByteFor::NUMBER }
|
308
|
+
FIRST_BYTES["-".ord] = ByteFor::NUMBER
|
309
|
+
# Some of these may be overwritten below, if keywords start with the same character
|
310
|
+
("A".."Z").each { |char| FIRST_BYTES[char.ord] = ByteFor::IDENTIFIER }
|
311
|
+
("a".."z").each { |char| FIRST_BYTES[char.ord] = ByteFor::IDENTIFIER }
|
312
|
+
FIRST_BYTES['_'.ord] = ByteFor::IDENTIFIER
|
313
|
+
FIRST_BYTES['.'.ord] = ByteFor::ELLIPSIS
|
314
|
+
FIRST_BYTES['"'.ord] = ByteFor::STRING
|
315
|
+
KEYWORDS.each { |kw| FIRST_BYTES[kw.getbyte(0)] = ByteFor::NAME }
|
316
|
+
Punctuation.constants.each do |punct_name|
|
317
|
+
punct = Punctuation.const_get(punct_name)
|
318
|
+
FIRST_BYTES[punct.ord] = ByteFor::PUNCTUATION
|
319
|
+
end
|
320
|
+
|
321
|
+
|
322
|
+
# Replace any escaped unicode or whitespace with the _actual_ characters
|
323
|
+
# To avoid allocating more strings, this modifies the string passed into it
|
324
|
+
def self.replace_escaped_characters_in_place(raw_string)
|
325
|
+
raw_string.gsub!(ESCAPED) do |matched_str|
|
326
|
+
if (point_str_1 = $1 || $2)
|
327
|
+
codepoint_1 = point_str_1.to_i(16)
|
328
|
+
if (codepoint_2 = $3)
|
329
|
+
codepoint_2 = codepoint_2.to_i(16)
|
330
|
+
if (codepoint_1 >= 0xD800 && codepoint_1 <= 0xDBFF) && # leading surrogate
|
331
|
+
(codepoint_2 >= 0xDC00 && codepoint_2 <= 0xDFFF) # trailing surrogate
|
332
|
+
# A surrogate pair
|
333
|
+
combined = ((codepoint_1 - 0xD800) * 0x400) + (codepoint_2 - 0xDC00) + 0x10000
|
334
|
+
[combined].pack('U'.freeze)
|
335
|
+
else
|
336
|
+
# Two separate code points
|
337
|
+
[codepoint_1].pack('U'.freeze) + [codepoint_2].pack('U'.freeze)
|
338
|
+
end
|
339
|
+
else
|
340
|
+
[codepoint_1].pack('U'.freeze)
|
341
|
+
end
|
342
|
+
else
|
343
|
+
ESCAPES_REPLACE[matched_str]
|
344
|
+
end
|
345
|
+
end
|
346
|
+
nil
|
347
|
+
end
|
348
|
+
|
349
|
+
# This is not used during parsing because the parser
|
350
|
+
# doesn't actually need tokens.
|
351
|
+
def self.tokenize(string)
|
352
|
+
lexer = GraphQL::Language::Lexer.new(string)
|
353
|
+
tokens = []
|
354
|
+
while (token_name = lexer.advance)
|
355
|
+
new_token = [
|
356
|
+
token_name,
|
357
|
+
lexer.line_number,
|
358
|
+
lexer.column_number,
|
359
|
+
lexer.debug_token_value(token_name),
|
360
|
+
]
|
361
|
+
tokens << new_token
|
362
|
+
end
|
363
|
+
tokens
|
364
|
+
end
|
365
|
+
end
|
366
|
+
end
|
1470
367
|
end
|