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