From 164b5def4682c741cf50dddaf8f1cb52d127abc6 Mon Sep 17 00:00:00 2001 From: Christian Joudrey Date: Sun, 25 Sep 2016 00:38:19 -0400 Subject: [PATCH] Add parser/generation support for directive definitions --- lib/graphql/language/generation.rb | 5 +- lib/graphql/language/lexer.rb | 667 +++++++------- lib/graphql/language/lexer.rl | 2 + lib/graphql/language/nodes.rb | 12 + lib/graphql/language/parser.rb | 1036 ++++++++++++---------- lib/graphql/language/parser.y | 10 + lib/graphql/language/parser_tests.rb | 19 + spec/graphql/language/generation_spec.rb | 4 + 8 files changed, 947 insertions(+), 808 deletions(-) diff --git a/lib/graphql/language/generation.rb b/lib/graphql/language/generation.rb index 84d6e758ff..fa50aa39f4 100644 --- a/lib/graphql/language/generation.rb +++ b/lib/graphql/language/generation.rb @@ -40,7 +40,6 @@ def generate(node, indent: "") out << generate_directives(node.directives) out << generate_selections(node.selections, indent: indent) out - when Nodes::FragmentSpread out = "#{indent}...#{node.name}" out << generate_directives(node.directives) @@ -123,6 +122,10 @@ def generate(node, indent: "") out << " #{generate(field)}\n" end out << "}" + when Nodes::DirectiveDefinition + out = "directive @#{node.name}" + out << "(#{node.arguments.map { |a| generate(a) }.join(", ")})" if node.arguments.any? + out << " on #{node.locations.join(' | ')}" when Nodes::AbstractNode node.to_query_string(indent: indent) when FalseClass, Float, Integer, NilClass, String, TrueClass diff --git a/lib/graphql/language/lexer.rb b/lib/graphql/language/lexer.rb index 6d237a4a09..b64b03a527 100644 --- a/lib/graphql/language/lexer.rb +++ b/lib/graphql/language/lexer.rb @@ -1,7 +1,7 @@ # line 1 "lib/graphql/language/lexer.rl" -# line 96 "lib/graphql/language/lexer.rl" +# line 98 "lib/graphql/language/lexer.rl" @@ -30,20 +30,21 @@ class << self end self._graphql_lexer_actions = [ 0, 1, 0, 1, 1, 1, 2, 1, - 24, 1, 25, 1, 26, 1, 27, 1, - 28, 1, 29, 1, 30, 1, 31, 1, - 32, 1, 33, 1, 34, 1, 35, 1, - 36, 1, 37, 1, 38, 1, 39, 1, - 40, 1, 41, 1, 42, 1, 43, 1, - 44, 1, 45, 1, 46, 1, 47, 1, - 48, 2, 2, 3, 2, 2, 4, 2, + 25, 1, 26, 1, 27, 1, 28, 1, + 29, 1, 30, 1, 31, 1, 32, 1, + 33, 1, 34, 1, 35, 1, 36, 1, + 37, 1, 38, 1, 39, 1, 40, 1, + 41, 1, 42, 1, 43, 1, 44, 1, + 45, 1, 46, 1, 47, 1, 48, 1, + 49, 2, 2, 3, 2, 2, 4, 2, 2, 5, 2, 2, 6, 2, 2, 7, 2, 2, 8, 2, 2, 9, 2, 2, 10, 2, 2, 11, 2, 2, 12, 2, 2, 13, 2, 2, 14, 2, 2, 15, 2, 2, 16, 2, 2, 17, 2, 2, 18, 2, 2, 19, 2, 2, 20, 2, - 2, 21, 2, 2, 22, 2, 2, 23 + 2, 21, 2, 2, 22, 2, 2, 23, + 2, 2, 24 ] class << self @@ -51,18 +52,19 @@ class << self private :_graphql_lexer_key_offsets, :_graphql_lexer_key_offsets= end self._graphql_lexer_key_offsets = [ - 0, 2, 4, 6, 8, 12, 13, 52, - 55, 57, 59, 62, 69, 71, 77, 84, - 85, 92, 100, 108, 116, 125, 133, 141, - 149, 157, 165, 173, 181, 189, 197, 206, - 214, 222, 230, 238, 246, 254, 262, 270, + 0, 2, 4, 6, 8, 12, 13, 53, + 56, 58, 60, 63, 70, 72, 78, 85, + 86, 93, 101, 109, 117, 125, 133, 141, + 149, 157, 165, 173, 181, 190, 198, 206, + 214, 222, 230, 238, 246, 254, 262, 271, 279, 287, 295, 303, 311, 319, 327, 335, - 343, 351, 359, 367, 375, 383, 391, 399, - 407, 415, 423, 431, 439, 447, 455, 463, - 472, 481, 489, 497, 505, 513, 521, 529, - 537, 545, 553, 561, 569, 577, 585, 593, - 601, 609, 618, 626, 634, 642, 650, 658, - 666, 674 + 344, 352, 360, 368, 376, 384, 392, 400, + 408, 416, 424, 432, 440, 448, 456, 464, + 472, 480, 488, 496, 504, 512, 520, 528, + 537, 546, 554, 562, 570, 578, 586, 594, + 602, 610, 618, 626, 634, 642, 650, 658, + 666, 674, 683, 691, 699, 707, 715, 723, + 731, 739 ] class << self @@ -74,88 +76,96 @@ class << self 43, 45, 48, 57, 46, 9, 10, 13, 32, 33, 34, 35, 36, 40, 41, 44, 45, 46, 48, 58, 61, 64, 91, 93, - 95, 101, 102, 105, 109, 110, 111, 113, - 115, 116, 117, 123, 124, 125, 49, 57, - 65, 90, 97, 122, 9, 32, 44, 34, - 92, 10, 13, 48, 49, 57, 43, 45, - 46, 69, 101, 48, 57, 48, 57, 43, - 45, 69, 101, 48, 57, 43, 45, 46, - 69, 101, 48, 57, 46, 95, 48, 57, - 65, 90, 97, 122, 95, 110, 48, 57, - 65, 90, 97, 122, 95, 117, 48, 57, - 65, 90, 97, 122, 95, 109, 48, 57, - 65, 90, 97, 122, 95, 97, 114, 48, - 57, 65, 90, 98, 122, 95, 108, 48, - 57, 65, 90, 97, 122, 95, 115, 48, + 95, 100, 101, 102, 105, 109, 110, 111, + 113, 115, 116, 117, 123, 124, 125, 49, + 57, 65, 90, 97, 122, 9, 32, 44, + 34, 92, 10, 13, 48, 49, 57, 43, + 45, 46, 69, 101, 48, 57, 48, 57, + 43, 45, 69, 101, 48, 57, 43, 45, + 46, 69, 101, 48, 57, 46, 95, 48, + 57, 65, 90, 97, 122, 95, 105, 48, + 57, 65, 90, 97, 122, 95, 114, 48, 57, 65, 90, 97, 122, 95, 101, 48, - 57, 65, 90, 97, 122, 95, 97, 48, - 57, 65, 90, 98, 122, 95, 103, 48, - 57, 65, 90, 97, 122, 95, 109, 48, + 57, 65, 90, 97, 122, 95, 99, 48, + 57, 65, 90, 97, 122, 95, 116, 48, + 57, 65, 90, 97, 122, 95, 105, 48, + 57, 65, 90, 97, 122, 95, 118, 48, 57, 65, 90, 97, 122, 95, 101, 48, 57, 65, 90, 97, 122, 95, 110, 48, - 57, 65, 90, 97, 122, 95, 116, 48, - 57, 65, 90, 97, 122, 95, 109, 110, - 48, 57, 65, 90, 97, 122, 95, 112, - 48, 57, 65, 90, 97, 122, 95, 108, + 57, 65, 90, 97, 122, 95, 117, 48, + 57, 65, 90, 97, 122, 95, 109, 48, + 57, 65, 90, 97, 122, 95, 97, 114, + 48, 57, 65, 90, 98, 122, 95, 108, + 48, 57, 65, 90, 97, 122, 95, 115, 48, 57, 65, 90, 97, 122, 95, 101, + 48, 57, 65, 90, 97, 122, 95, 97, + 48, 57, 65, 90, 98, 122, 95, 103, 48, 57, 65, 90, 97, 122, 95, 109, 48, 57, 65, 90, 97, 122, 95, 101, 48, 57, 65, 90, 97, 122, 95, 110, 48, 57, 65, 90, 97, 122, 95, 116, - 48, 57, 65, 90, 97, 122, 95, 115, - 48, 57, 65, 90, 97, 122, 95, 112, - 116, 48, 57, 65, 90, 97, 122, 95, - 117, 48, 57, 65, 90, 97, 122, 95, - 116, 48, 57, 65, 90, 97, 122, 95, - 101, 48, 57, 65, 90, 97, 122, 95, - 114, 48, 57, 65, 90, 97, 122, 95, - 102, 48, 57, 65, 90, 97, 122, 95, - 97, 48, 57, 65, 90, 98, 122, 95, - 99, 48, 57, 65, 90, 97, 122, 95, - 101, 48, 57, 65, 90, 97, 122, 95, - 117, 48, 57, 65, 90, 97, 122, 95, - 116, 48, 57, 65, 90, 97, 122, 95, - 97, 48, 57, 65, 90, 98, 122, 95, - 116, 48, 57, 65, 90, 97, 122, 95, - 105, 48, 57, 65, 90, 97, 122, 95, - 111, 48, 57, 65, 90, 97, 122, 95, + 48, 57, 65, 90, 97, 122, 95, 109, 110, 48, 57, 65, 90, 97, 122, 95, - 117, 48, 57, 65, 90, 97, 122, 95, - 108, 48, 57, 65, 90, 97, 122, 95, + 112, 48, 57, 65, 90, 97, 122, 95, 108, 48, 57, 65, 90, 97, 122, 95, - 110, 48, 57, 65, 90, 97, 122, 95, - 117, 48, 57, 65, 90, 97, 122, 95, 101, 48, 57, 65, 90, 97, 122, 95, - 114, 48, 57, 65, 90, 97, 122, 95, - 121, 48, 57, 65, 90, 97, 122, 95, - 99, 117, 48, 57, 65, 90, 97, 122, - 95, 97, 104, 48, 57, 65, 90, 98, - 122, 95, 108, 48, 57, 65, 90, 97, - 122, 95, 97, 48, 57, 65, 90, 98, - 122, 95, 114, 48, 57, 65, 90, 97, - 122, 95, 101, 48, 57, 65, 90, 97, - 122, 95, 109, 48, 57, 65, 90, 97, - 122, 95, 97, 48, 57, 65, 90, 98, - 122, 95, 98, 48, 57, 65, 90, 97, - 122, 95, 115, 48, 57, 65, 90, 97, - 122, 95, 99, 48, 57, 65, 90, 97, - 122, 95, 114, 48, 57, 65, 90, 97, - 122, 95, 105, 48, 57, 65, 90, 97, - 122, 95, 112, 48, 57, 65, 90, 97, - 122, 95, 116, 48, 57, 65, 90, 97, - 122, 95, 105, 48, 57, 65, 90, 97, - 122, 95, 111, 48, 57, 65, 90, 97, - 122, 95, 110, 48, 57, 65, 90, 97, - 122, 95, 114, 121, 48, 57, 65, 90, - 97, 122, 95, 117, 48, 57, 65, 90, + 109, 48, 57, 65, 90, 97, 122, 95, + 101, 48, 57, 65, 90, 97, 122, 95, + 110, 48, 57, 65, 90, 97, 122, 95, + 116, 48, 57, 65, 90, 97, 122, 95, + 115, 48, 57, 65, 90, 97, 122, 95, + 112, 116, 48, 57, 65, 90, 97, 122, + 95, 117, 48, 57, 65, 90, 97, 122, + 95, 116, 48, 57, 65, 90, 97, 122, + 95, 101, 48, 57, 65, 90, 97, 122, + 95, 114, 48, 57, 65, 90, 97, 122, + 95, 102, 48, 57, 65, 90, 97, 122, + 95, 97, 48, 57, 65, 90, 98, 122, + 95, 99, 48, 57, 65, 90, 97, 122, + 95, 101, 48, 57, 65, 90, 97, 122, + 95, 117, 48, 57, 65, 90, 97, 122, + 95, 116, 48, 57, 65, 90, 97, 122, + 95, 97, 48, 57, 65, 90, 98, 122, + 95, 116, 48, 57, 65, 90, 97, 122, + 95, 105, 48, 57, 65, 90, 97, 122, + 95, 111, 48, 57, 65, 90, 97, 122, + 95, 110, 48, 57, 65, 90, 97, 122, + 95, 117, 48, 57, 65, 90, 97, 122, + 95, 108, 48, 57, 65, 90, 97, 122, + 95, 108, 48, 57, 65, 90, 97, 122, + 95, 110, 48, 57, 65, 90, 97, 122, + 95, 117, 48, 57, 65, 90, 97, 122, + 95, 101, 48, 57, 65, 90, 97, 122, + 95, 114, 48, 57, 65, 90, 97, 122, + 95, 121, 48, 57, 65, 90, 97, 122, + 95, 99, 117, 48, 57, 65, 90, 97, + 122, 95, 97, 104, 48, 57, 65, 90, + 98, 122, 95, 108, 48, 57, 65, 90, + 97, 122, 95, 97, 48, 57, 65, 90, + 98, 122, 95, 114, 48, 57, 65, 90, 97, 122, 95, 101, 48, 57, 65, 90, + 97, 122, 95, 109, 48, 57, 65, 90, + 97, 122, 95, 97, 48, 57, 65, 90, + 98, 122, 95, 98, 48, 57, 65, 90, + 97, 122, 95, 115, 48, 57, 65, 90, + 97, 122, 95, 99, 48, 57, 65, 90, + 97, 122, 95, 114, 48, 57, 65, 90, + 97, 122, 95, 105, 48, 57, 65, 90, 97, 122, 95, 112, 48, 57, 65, 90, - 97, 122, 95, 101, 48, 57, 65, 90, - 97, 122, 95, 110, 48, 57, 65, 90, + 97, 122, 95, 116, 48, 57, 65, 90, 97, 122, 95, 105, 48, 57, 65, 90, 97, 122, 95, 111, 48, 57, 65, 90, 97, 122, 95, 110, 48, 57, 65, 90, - 97, 122, 0 + 97, 122, 95, 114, 121, 48, 57, 65, + 90, 97, 122, 95, 117, 48, 57, 65, + 90, 97, 122, 95, 101, 48, 57, 65, + 90, 97, 122, 95, 112, 48, 57, 65, + 90, 97, 122, 95, 101, 48, 57, 65, + 90, 97, 122, 95, 110, 48, 57, 65, + 90, 97, 122, 95, 105, 48, 57, 65, + 90, 97, 122, 95, 111, 48, 57, 65, + 90, 97, 122, 95, 110, 48, 57, 65, + 90, 97, 122, 0 ] class << self @@ -163,9 +173,10 @@ class << self private :_graphql_lexer_single_lengths, :_graphql_lexer_single_lengths= end self._graphql_lexer_single_lengths = [ - 2, 2, 0, 0, 2, 1, 33, 3, + 2, 2, 0, 0, 2, 1, 34, 3, 2, 2, 1, 5, 0, 4, 5, 1, - 1, 2, 2, 2, 3, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, @@ -193,6 +204,7 @@ class << self 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 ] @@ -201,18 +213,19 @@ class << self private :_graphql_lexer_index_offsets, :_graphql_lexer_index_offsets= end self._graphql_lexer_index_offsets = [ - 0, 3, 6, 8, 10, 14, 16, 53, - 57, 60, 63, 66, 73, 75, 81, 88, - 90, 95, 101, 107, 113, 120, 126, 132, - 138, 144, 150, 156, 162, 168, 174, 181, - 187, 193, 199, 205, 211, 217, 223, 229, + 0, 3, 6, 8, 10, 14, 16, 54, + 58, 61, 64, 67, 74, 76, 82, 89, + 91, 96, 102, 108, 114, 120, 126, 132, + 138, 144, 150, 156, 162, 169, 175, 181, + 187, 193, 199, 205, 211, 217, 223, 230, 236, 242, 248, 254, 260, 266, 272, 278, - 284, 290, 296, 302, 308, 314, 320, 326, - 332, 338, 344, 350, 356, 362, 368, 374, - 381, 388, 394, 400, 406, 412, 418, 424, - 430, 436, 442, 448, 454, 460, 466, 472, - 478, 484, 491, 497, 503, 509, 515, 521, - 527, 533 + 285, 291, 297, 303, 309, 315, 321, 327, + 333, 339, 345, 351, 357, 363, 369, 375, + 381, 387, 393, 399, 405, 411, 417, 423, + 430, 437, 443, 449, 455, 461, 467, 473, + 479, 485, 491, 497, 503, 509, 515, 521, + 527, 533, 540, 546, 552, 558, 564, 570, + 576, 582 ] class << self @@ -224,70 +237,76 @@ class << self 13, 6, 2, 2, 12, 6, 6, 6, 7, 6, 6, 7, 6, 8, 9, 6, 6, 6, 7, 10, 15, 11, 6, 6, - 6, 6, 6, 16, 17, 20, 30, 48, - 55, 58, 59, 63, 81, 86, 6, 6, - 6, 14, 16, 16, 6, 7, 7, 7, - 6, 6, 1, 0, 6, 6, 9, 11, - 14, 6, 2, 2, 3, 4, 4, 12, - 6, 12, 6, 2, 2, 4, 4, 13, - 6, 2, 2, 3, 4, 4, 14, 6, - 5, 6, 16, 16, 16, 16, 6, 16, - 18, 16, 16, 16, 6, 16, 19, 16, - 16, 16, 6, 16, 16, 16, 16, 16, - 6, 16, 21, 24, 16, 16, 16, 6, + 6, 6, 6, 16, 17, 25, 28, 38, + 56, 63, 66, 67, 71, 89, 94, 6, + 6, 6, 14, 16, 16, 6, 7, 7, + 7, 6, 6, 1, 0, 6, 6, 9, + 11, 14, 6, 2, 2, 3, 4, 4, + 12, 6, 12, 6, 2, 2, 4, 4, + 13, 6, 2, 2, 3, 4, 4, 14, + 6, 5, 6, 16, 16, 16, 16, 6, + 16, 18, 16, 16, 16, 6, 16, 19, + 16, 16, 16, 6, 16, 20, 16, 16, + 16, 6, 16, 21, 16, 16, 16, 6, 16, 22, 16, 16, 16, 6, 16, 23, - 16, 16, 16, 6, 16, 16, 16, 16, - 16, 6, 16, 25, 16, 16, 16, 6, + 16, 16, 16, 6, 16, 24, 16, 16, + 16, 6, 16, 16, 16, 16, 16, 6, 16, 26, 16, 16, 16, 6, 16, 27, - 16, 16, 16, 6, 16, 28, 16, 16, - 16, 6, 16, 29, 16, 16, 16, 6, - 16, 16, 16, 16, 16, 6, 16, 31, - 39, 16, 16, 16, 6, 16, 32, 16, + 16, 16, 16, 6, 16, 16, 16, 16, + 16, 6, 16, 29, 32, 16, 16, 16, + 6, 16, 30, 16, 16, 16, 6, 16, + 31, 16, 16, 16, 6, 16, 16, 16, 16, 16, 6, 16, 33, 16, 16, 16, 6, 16, 34, 16, 16, 16, 6, 16, 35, 16, 16, 16, 6, 16, 36, 16, 16, 16, 6, 16, 37, 16, 16, 16, - 6, 16, 38, 16, 16, 16, 6, 16, - 16, 16, 16, 16, 6, 16, 40, 42, + 6, 16, 16, 16, 16, 16, 6, 16, + 39, 47, 16, 16, 16, 6, 16, 40, 16, 16, 16, 6, 16, 41, 16, 16, - 16, 6, 16, 16, 16, 16, 16, 6, + 16, 6, 16, 42, 16, 16, 16, 6, 16, 43, 16, 16, 16, 6, 16, 44, 16, 16, 16, 6, 16, 45, 16, 16, 16, 6, 16, 46, 16, 16, 16, 6, - 16, 47, 16, 16, 16, 6, 16, 16, - 16, 16, 16, 6, 16, 49, 16, 16, - 16, 6, 16, 50, 16, 16, 16, 6, - 16, 51, 16, 16, 16, 6, 16, 52, - 16, 16, 16, 6, 16, 53, 16, 16, - 16, 6, 16, 54, 16, 16, 16, 6, - 16, 16, 16, 16, 16, 6, 16, 56, - 16, 16, 16, 6, 16, 57, 16, 16, - 16, 6, 16, 16, 16, 16, 16, 6, - 16, 16, 16, 16, 16, 6, 16, 60, - 16, 16, 16, 6, 16, 61, 16, 16, - 16, 6, 16, 62, 16, 16, 16, 6, - 16, 16, 16, 16, 16, 6, 16, 64, - 71, 16, 16, 16, 6, 16, 65, 68, - 16, 16, 16, 6, 16, 66, 16, 16, - 16, 6, 16, 67, 16, 16, 16, 6, - 16, 16, 16, 16, 16, 6, 16, 69, - 16, 16, 16, 6, 16, 70, 16, 16, - 16, 6, 16, 16, 16, 16, 16, 6, - 16, 72, 16, 16, 16, 6, 16, 73, - 16, 16, 16, 6, 16, 74, 16, 16, - 16, 6, 16, 75, 16, 16, 16, 6, - 16, 76, 16, 16, 16, 6, 16, 77, - 16, 16, 16, 6, 16, 78, 16, 16, - 16, 6, 16, 79, 16, 16, 16, 6, - 16, 80, 16, 16, 16, 6, 16, 16, - 16, 16, 16, 6, 16, 82, 84, 16, - 16, 16, 6, 16, 83, 16, 16, 16, + 16, 16, 16, 16, 16, 6, 16, 48, + 50, 16, 16, 16, 6, 16, 49, 16, + 16, 16, 6, 16, 16, 16, 16, 16, + 6, 16, 51, 16, 16, 16, 6, 16, + 52, 16, 16, 16, 6, 16, 53, 16, + 16, 16, 6, 16, 54, 16, 16, 16, + 6, 16, 55, 16, 16, 16, 6, 16, + 16, 16, 16, 16, 6, 16, 57, 16, + 16, 16, 6, 16, 58, 16, 16, 16, + 6, 16, 59, 16, 16, 16, 6, 16, + 60, 16, 16, 16, 6, 16, 61, 16, + 16, 16, 6, 16, 62, 16, 16, 16, + 6, 16, 16, 16, 16, 16, 6, 16, + 64, 16, 16, 16, 6, 16, 65, 16, + 16, 16, 6, 16, 16, 16, 16, 16, + 6, 16, 16, 16, 16, 16, 6, 16, + 68, 16, 16, 16, 6, 16, 69, 16, + 16, 16, 6, 16, 70, 16, 16, 16, + 6, 16, 16, 16, 16, 16, 6, 16, + 72, 79, 16, 16, 16, 6, 16, 73, + 76, 16, 16, 16, 6, 16, 74, 16, + 16, 16, 6, 16, 75, 16, 16, 16, 6, 16, 16, 16, 16, 16, 6, 16, - 85, 16, 16, 16, 6, 16, 16, 16, + 77, 16, 16, 16, 6, 16, 78, 16, + 16, 16, 6, 16, 16, 16, 16, 16, + 6, 16, 80, 16, 16, 16, 6, 16, + 81, 16, 16, 16, 6, 16, 82, 16, + 16, 16, 6, 16, 83, 16, 16, 16, + 6, 16, 84, 16, 16, 16, 6, 16, + 85, 16, 16, 16, 6, 16, 86, 16, 16, 16, 6, 16, 87, 16, 16, 16, 6, 16, 88, 16, 16, 16, 6, 16, - 89, 16, 16, 16, 6, 16, 16, 16, - 16, 16, 6, 6, 6, 6, 6, 6, + 16, 16, 16, 16, 6, 16, 90, 92, + 16, 16, 16, 6, 16, 91, 16, 16, + 16, 6, 16, 16, 16, 16, 16, 6, + 16, 93, 16, 16, 16, 6, 16, 16, + 16, 16, 16, 6, 16, 95, 16, 16, + 16, 6, 16, 96, 16, 16, 16, 6, + 16, 97, 16, 16, 16, 6, 16, 16, + 16, 16, 16, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, @@ -298,7 +317,8 @@ class << self 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 0 + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 0 ] class << self @@ -306,76 +326,83 @@ class << self private :_graphql_lexer_trans_actions, :_graphql_lexer_trans_actions= end self._graphql_lexer_trans_actions = [ - 21, 0, 0, 111, 0, 0, 0, 55, + 21, 0, 0, 114, 0, 0, 0, 55, 60, 51, 0, 0, 0, 55, 27, 53, - 0, 35, 35, 0, 31, 117, 0, 23, + 0, 35, 35, 0, 31, 120, 0, 23, 13, 11, 0, 0, 5, 57, 19, 29, - 25, 17, 15, 114, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 9, 33, - 7, 57, 114, 114, 37, 0, 0, 0, - 45, 21, 0, 0, 47, 47, 0, 57, - 57, 49, 0, 0, 0, 0, 0, 0, - 39, 0, 41, 0, 0, 0, 0, 60, - 41, 0, 0, 0, 0, 0, 57, 39, - 0, 49, 114, 114, 114, 114, 55, 114, - 0, 114, 114, 114, 43, 114, 0, 114, - 114, 114, 43, 114, 105, 114, 114, 114, - 43, 114, 0, 0, 114, 114, 114, 43, - 114, 0, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 72, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 0, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 66, 114, 114, 114, 43, 114, 0, - 0, 114, 114, 114, 43, 114, 0, 114, - 114, 114, 43, 114, 0, 114, 114, 114, - 43, 114, 0, 114, 114, 114, 43, 114, - 0, 114, 114, 114, 43, 114, 0, 114, - 114, 114, 43, 114, 0, 114, 114, 114, - 43, 114, 0, 114, 114, 114, 43, 114, - 96, 114, 114, 114, 43, 114, 0, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 108, 114, 114, 114, 43, - 114, 0, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 0, 114, 114, 114, 43, 114, 99, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 0, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 81, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 75, 114, 114, 114, 43, - 114, 63, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 78, 114, 114, 114, 43, 114, 0, - 0, 114, 114, 114, 43, 114, 0, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 90, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 87, 114, 114, 114, 43, - 114, 0, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 0, 114, 114, 114, 43, 114, 0, - 114, 114, 114, 43, 114, 0, 114, 114, - 114, 43, 114, 0, 114, 114, 114, 43, - 114, 0, 114, 114, 114, 43, 114, 84, - 114, 114, 114, 43, 114, 0, 0, 114, - 114, 114, 43, 114, 0, 114, 114, 114, - 43, 114, 69, 114, 114, 114, 43, 114, - 0, 114, 114, 114, 43, 114, 93, 114, - 114, 114, 43, 114, 0, 114, 114, 114, - 43, 114, 0, 114, 114, 114, 43, 114, - 0, 114, 114, 114, 43, 114, 102, 114, - 114, 114, 43, 55, 55, 55, 51, 55, - 53, 45, 55, 47, 49, 39, 41, 41, - 39, 49, 55, 43, 43, 43, 43, 43, + 25, 17, 15, 117, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 9, + 33, 7, 57, 117, 117, 37, 0, 0, + 0, 45, 21, 0, 0, 47, 47, 0, + 57, 57, 49, 0, 0, 0, 0, 0, + 0, 39, 0, 41, 0, 0, 0, 0, + 60, 41, 0, 0, 0, 0, 0, 57, + 39, 0, 49, 117, 117, 117, 117, 55, + 117, 0, 117, 117, 117, 43, 117, 0, + 117, 117, 117, 43, 117, 0, 117, 117, + 117, 43, 117, 0, 117, 117, 117, 43, + 117, 0, 117, 117, 117, 43, 117, 0, + 117, 117, 117, 43, 117, 0, 117, 117, + 117, 43, 117, 111, 117, 117, 117, 43, + 117, 0, 117, 117, 117, 43, 117, 0, + 117, 117, 117, 43, 117, 105, 117, 117, + 117, 43, 117, 0, 0, 117, 117, 117, + 43, 117, 0, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 72, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 0, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 66, 117, 117, 117, 43, 117, + 0, 0, 117, 117, 117, 43, 117, 0, + 117, 117, 117, 43, 117, 0, 117, 117, + 117, 43, 117, 0, 117, 117, 117, 43, + 117, 0, 117, 117, 117, 43, 117, 0, + 117, 117, 117, 43, 117, 0, 117, 117, + 117, 43, 117, 0, 117, 117, 117, 43, + 117, 96, 117, 117, 117, 43, 117, 0, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 108, 117, 117, 117, + 43, 117, 0, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 0, 117, 117, 117, 43, 117, + 99, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 0, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 81, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 75, 117, 117, 117, + 43, 117, 63, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 78, 117, 117, 117, 43, 117, + 0, 0, 117, 117, 117, 43, 117, 0, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 90, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 87, 117, 117, 117, + 43, 117, 0, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 0, 117, 117, 117, 43, 117, + 0, 117, 117, 117, 43, 117, 0, 117, + 117, 117, 43, 117, 0, 117, 117, 117, + 43, 117, 0, 117, 117, 117, 43, 117, + 84, 117, 117, 117, 43, 117, 0, 0, + 117, 117, 117, 43, 117, 0, 117, 117, + 117, 43, 117, 69, 117, 117, 117, 43, + 117, 0, 117, 117, 117, 43, 117, 93, + 117, 117, 117, 43, 117, 0, 117, 117, + 117, 43, 117, 0, 117, 117, 117, 43, + 117, 0, 117, 117, 117, 43, 117, 102, + 117, 117, 117, 43, 55, 55, 55, 51, + 55, 53, 45, 55, 47, 49, 39, 41, + 41, 39, 49, 55, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, @@ -384,7 +411,7 @@ class << self 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 0 + 43, 43, 43, 43, 43, 0 ] class << self @@ -403,6 +430,7 @@ class << self 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] @@ -422,6 +450,7 @@ class << self 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] @@ -430,18 +459,19 @@ class << self private :_graphql_lexer_eof_trans, :_graphql_lexer_eof_trans= end self._graphql_lexer_eof_trans = [ - 555, 555, 555, 543, 555, 545, 0, 546, - 555, 548, 554, 553, 552, 552, 553, 554, - 555, 628, 628, 628, 628, 628, 628, 628, - 628, 628, 628, 628, 628, 628, 628, 628, - 628, 628, 628, 628, 628, 628, 628, 628, - 628, 628, 628, 628, 628, 628, 628, 628, - 628, 628, 628, 628, 628, 628, 628, 628, - 628, 628, 628, 628, 628, 628, 628, 628, - 628, 628, 628, 628, 628, 628, 628, 628, - 628, 628, 628, 628, 628, 628, 628, 628, - 628, 628, 628, 628, 628, 628, 628, 628, - 628, 628 + 604, 604, 604, 592, 604, 594, 0, 595, + 604, 597, 603, 602, 601, 601, 602, 603, + 604, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685 ] class << self @@ -463,7 +493,7 @@ class << self self.graphql_lexer_en_main = 6; -# line 117 "lib/graphql/language/lexer.rl" +# line 119 "lib/graphql/language/lexer.rl" def self.run_lexer(query_string) data = query_string.unpack("c*") @@ -477,7 +507,7 @@ def self.run_lexer(query_string) } -# line 481 "lib/graphql/language/lexer.rb" +# line 511 "lib/graphql/language/lexer.rb" begin p ||= 0 pe ||= data.length @@ -487,14 +517,14 @@ def self.run_lexer(query_string) act = 0 end -# line 130 "lib/graphql/language/lexer.rl" +# line 132 "lib/graphql/language/lexer.rl" emit_token = -> (name) { emit(name, ts, te, meta) } -# line 498 "lib/graphql/language/lexer.rb" +# line 528 "lib/graphql/language/lexer.rb" begin _klen, _trans, _keys, _acts, _nacts = nil _goto_level = 0 @@ -524,7 +554,7 @@ def self.run_lexer(query_string) begin ts = p end -# line 528 "lib/graphql/language/lexer.rb" +# line 558 "lib/graphql/language/lexer.rb" end # from state action switch end if _trigger_goto @@ -596,175 +626,179 @@ def self.run_lexer(query_string) te = p+1 end when 3 then -# line 51 "lib/graphql/language/lexer.rl" +# line 52 "lib/graphql/language/lexer.rl" begin act = 1; end when 4 then -# line 52 "lib/graphql/language/lexer.rl" +# line 53 "lib/graphql/language/lexer.rl" begin act = 2; end when 5 then -# line 53 "lib/graphql/language/lexer.rl" +# line 54 "lib/graphql/language/lexer.rl" begin act = 3; end when 6 then -# line 54 "lib/graphql/language/lexer.rl" +# line 55 "lib/graphql/language/lexer.rl" begin act = 4; end when 7 then -# line 55 "lib/graphql/language/lexer.rl" +# line 56 "lib/graphql/language/lexer.rl" begin act = 5; end when 8 then -# line 56 "lib/graphql/language/lexer.rl" +# line 57 "lib/graphql/language/lexer.rl" begin act = 6; end when 9 then -# line 57 "lib/graphql/language/lexer.rl" +# line 58 "lib/graphql/language/lexer.rl" begin act = 7; end when 10 then -# line 58 "lib/graphql/language/lexer.rl" +# line 59 "lib/graphql/language/lexer.rl" begin act = 8; end when 11 then -# line 59 "lib/graphql/language/lexer.rl" +# line 60 "lib/graphql/language/lexer.rl" begin act = 9; end when 12 then -# line 60 "lib/graphql/language/lexer.rl" +# line 61 "lib/graphql/language/lexer.rl" begin act = 10; end when 13 then -# line 61 "lib/graphql/language/lexer.rl" +# line 62 "lib/graphql/language/lexer.rl" begin act = 11; end when 14 then -# line 62 "lib/graphql/language/lexer.rl" +# line 63 "lib/graphql/language/lexer.rl" begin act = 12; end when 15 then -# line 63 "lib/graphql/language/lexer.rl" +# line 64 "lib/graphql/language/lexer.rl" begin act = 13; end when 16 then -# line 64 "lib/graphql/language/lexer.rl" +# line 65 "lib/graphql/language/lexer.rl" begin act = 14; end when 17 then -# line 65 "lib/graphql/language/lexer.rl" +# line 66 "lib/graphql/language/lexer.rl" begin act = 15; end when 18 then -# line 66 "lib/graphql/language/lexer.rl" +# line 67 "lib/graphql/language/lexer.rl" begin act = 16; end when 19 then -# line 67 "lib/graphql/language/lexer.rl" +# line 68 "lib/graphql/language/lexer.rl" begin act = 17; end when 20 then -# line 68 "lib/graphql/language/lexer.rl" +# line 69 "lib/graphql/language/lexer.rl" begin act = 18; end when 21 then -# line 76 "lib/graphql/language/lexer.rl" +# line 70 "lib/graphql/language/lexer.rl" begin -act = 26; end +act = 19; end when 22 then -# line 83 "lib/graphql/language/lexer.rl" +# line 78 "lib/graphql/language/lexer.rl" begin -act = 33; end +act = 27; end when 23 then -# line 93 "lib/graphql/language/lexer.rl" +# line 85 "lib/graphql/language/lexer.rl" begin -act = 37; end +act = 34; end when 24 then -# line 69 "lib/graphql/language/lexer.rl" +# line 95 "lib/graphql/language/lexer.rl" + begin +act = 38; end +when 25 then +# line 71 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:RCURLY) end end -when 25 then -# line 70 "lib/graphql/language/lexer.rl" +when 26 then +# line 72 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:LCURLY) end end -when 26 then -# line 71 "lib/graphql/language/lexer.rl" +when 27 then +# line 73 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:RPAREN) end end -when 27 then -# line 72 "lib/graphql/language/lexer.rl" +when 28 then +# line 74 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:LPAREN) end end -when 28 then -# line 73 "lib/graphql/language/lexer.rl" +when 29 then +# line 75 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:RBRACKET) end end -when 29 then -# line 74 "lib/graphql/language/lexer.rl" +when 30 then +# line 76 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:LBRACKET) end end -when 30 then -# line 75 "lib/graphql/language/lexer.rl" +when 31 then +# line 77 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:COLON) end end -when 31 then -# line 76 "lib/graphql/language/lexer.rl" +when 32 then +# line 78 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_string(ts + 1, te - 1, meta) end end -when 32 then -# line 77 "lib/graphql/language/lexer.rl" +when 33 then +# line 79 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:VAR_SIGN) end end -when 33 then -# line 78 "lib/graphql/language/lexer.rl" +when 34 then +# line 80 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:DIR_SIGN) end end -when 34 then -# line 79 "lib/graphql/language/lexer.rl" +when 35 then +# line 81 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:ELLIPSIS) end end -when 35 then -# line 80 "lib/graphql/language/lexer.rl" +when 36 then +# line 82 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:EQUALS) end end -when 36 then -# line 81 "lib/graphql/language/lexer.rl" +when 37 then +# line 83 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:BANG) end end -when 37 then -# line 82 "lib/graphql/language/lexer.rl" +when 38 then +# line 84 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:PIPE) end end -when 38 then -# line 85 "lib/graphql/language/lexer.rl" +when 39 then +# line 87 "lib/graphql/language/lexer.rl" begin te = p+1 begin @@ -772,38 +806,32 @@ def self.run_lexer(query_string) meta[:col] = 1 end end -when 39 then -# line 93 "lib/graphql/language/lexer.rl" +when 40 then +# line 95 "lib/graphql/language/lexer.rl" begin te = p+1 begin emit_token.call(:UNKNOWN_CHAR) end end -when 40 then -# line 51 "lib/graphql/language/lexer.rl" - begin -te = p -p = p - 1; begin emit_token.call(:INT) end - end when 41 then # line 52 "lib/graphql/language/lexer.rl" begin te = p -p = p - 1; begin emit_token.call(:FLOAT) end +p = p - 1; begin emit_token.call(:INT) end end when 42 then -# line 83 "lib/graphql/language/lexer.rl" +# line 53 "lib/graphql/language/lexer.rl" begin te = p -p = p - 1; begin emit_token.call(:IDENTIFIER) end +p = p - 1; begin emit_token.call(:FLOAT) end end when 43 then -# line 90 "lib/graphql/language/lexer.rl" +# line 85 "lib/graphql/language/lexer.rl" begin te = p -p = p - 1; begin meta[:col] += te - ts end +p = p - 1; begin emit_token.call(:IDENTIFIER) end end when 44 then -# line 91 "lib/graphql/language/lexer.rl" +# line 92 "lib/graphql/language/lexer.rl" begin te = p p = p - 1; begin meta[:col] += te - ts end @@ -812,21 +840,27 @@ def self.run_lexer(query_string) # line 93 "lib/graphql/language/lexer.rl" begin te = p -p = p - 1; begin emit_token.call(:UNKNOWN_CHAR) end +p = p - 1; begin meta[:col] += te - ts end end when 46 then -# line 51 "lib/graphql/language/lexer.rl" +# line 95 "lib/graphql/language/lexer.rl" + begin +te = p +p = p - 1; begin emit_token.call(:UNKNOWN_CHAR) end + end +when 47 then +# line 52 "lib/graphql/language/lexer.rl" begin begin p = ((te))-1; end begin emit_token.call(:INT) end end -when 47 then -# line 93 "lib/graphql/language/lexer.rl" +when 48 then +# line 95 "lib/graphql/language/lexer.rl" begin begin p = ((te))-1; end begin emit_token.call(:UNKNOWN_CHAR) end end -when 48 then +when 49 then # line 1 "NONE" begin case act @@ -884,18 +918,21 @@ def self.run_lexer(query_string) when 18 then begin begin p = ((te))-1; end emit_token.call(:INPUT) end - when 26 then + when 19 then + begin begin p = ((te))-1; end + emit_token.call(:DIRECTIVE) end + when 27 then begin begin p = ((te))-1; end emit_string(ts + 1, te - 1, meta) end - when 33 then + when 34 then begin begin p = ((te))-1; end emit_token.call(:IDENTIFIER) end - when 37 then + when 38 then begin begin p = ((te))-1; end emit_token.call(:UNKNOWN_CHAR) end end end -# line 899 "lib/graphql/language/lexer.rb" +# line 936 "lib/graphql/language/lexer.rb" end # action switch end end @@ -915,7 +952,7 @@ def self.run_lexer(query_string) # line 1 "NONE" begin ts = nil; end -# line 919 "lib/graphql/language/lexer.rb" +# line 956 "lib/graphql/language/lexer.rb" end # to state action switch end if _trigger_goto @@ -942,7 +979,7 @@ def self.run_lexer(query_string) end end -# line 136 "lib/graphql/language/lexer.rl" +# line 138 "lib/graphql/language/lexer.rl" meta[:tokens] end diff --git a/lib/graphql/language/lexer.rl b/lib/graphql/language/lexer.rl index bda409e2ee..46b3df00ae 100644 --- a/lib/graphql/language/lexer.rl +++ b/lib/graphql/language/lexer.rl @@ -31,6 +31,7 @@ RPAREN = ')'; LBRACKET = '['; RBRACKET = ']'; + DIRECTIVE = 'directive'; COLON = ':'; QUOTE = '"'; ESCAPED_QUOTE = '\\"'; @@ -66,6 +67,7 @@ UNION => { emit_token.call(:UNION) }; ENUM => { emit_token.call(:ENUM) }; INPUT => { emit_token.call(:INPUT) }; + DIRECTIVE => { emit_token.call(:DIRECTIVE) }; RCURLY => { emit_token.call(:RCURLY) }; LCURLY => { emit_token.call(:LCURLY) }; RPAREN => { emit_token.call(:RPAREN) }; diff --git a/lib/graphql/language/nodes.rb b/lib/graphql/language/nodes.rb index 8e5580c876..f09663497f 100644 --- a/lib/graphql/language/nodes.rb +++ b/lib/graphql/language/nodes.rb @@ -142,6 +142,18 @@ def initialize_node(name: nil, arguments: []) end end + class DirectiveDefinition < AbstractNode + attr_accessor :name, :arguments, :locations + scalar_attributes :name + child_attributes :arguments, :locations + + def initialize_node(name: nil, arguments: [], locations: []) + @name = name + @arguments = arguments + @locations = locations + end + end + # This is the AST root for normal queries # # @example Deriving a document by parsing a string diff --git a/lib/graphql/language/parser.rb b/lib/graphql/language/parser.rb index 94db9f72f1..19e2717087 100644 --- a/lib/graphql/language/parser.rb +++ b/lib/graphql/language/parser.rb @@ -12,7 +12,7 @@ module GraphQL module Language class Parser < Racc::Parser -module_eval(<<'...end parser.y/module_eval...', 'parser.y', 333) +module_eval(<<'...end parser.y/module_eval...', 'parser.y', 343) def initialize(query_string) @query_string = query_string @@ -75,501 +75,525 @@ def make_node(node_name, assigns) ##### State transition tables begin ### racc_action_table = [ - 10, 11, 12, 198, 177, 74, 199, 198, 73, 198, - 132, 210, 50, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 10, 11, 12, 77, - 57, 198, 119, 95, 199, 10, 11, 12, 70, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 10, 11, 12, 77, 57, 74, 127, 74, - 13, 150, 77, 13, 13, 79, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 10, 11, - 12, 77, 13, 162, 117, 169, 163, 201, 116, 164, - 173, 141, 36, 37, 38, 39, 40, 41, 42, 43, - 139, 140, 156, 157, 153, 154, 155, 10, 11, 12, - 77, 115, 162, 77, 114, 163, 77, 13, 164, 110, - 141, 36, 37, 38, 39, 40, 41, 42, 43, 139, - 140, 156, 157, 153, 154, 155, 10, 11, 12, 13, - 77, 162, 77, 77, 163, 185, 194, 164, 95, 141, - 36, 37, 38, 39, 40, 41, 42, 43, 139, 140, - 156, 157, 153, 154, 155, 10, 11, 12, 77, 77, - 162, 77, 77, 163, 77, 205, 164, 87, 141, 36, - 37, 38, 39, 40, 41, 42, 43, 139, 140, 156, - 157, 153, 154, 155, 10, 11, 12, 77, 81, 162, - 69, 67, 163, 60, 30, 164, 77, 141, 36, 37, - 38, 39, 40, 41, 42, 43, 139, 140, 156, 157, - 153, 154, 155, 10, 11, 12, nil, 206, nil, nil, - nil, nil, nil, nil, nil, nil, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 10, - 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 10, 11, 12, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 10, 11, 12, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 10, 11, 12, + 10, 11, 12, 77, 208, 208, 76, 209, 208, 208, + 220, 13, 209, 184, 18, 25, 26, 138, 27, 28, + 29, 30, 80, 14, 10, 11, 12, 80, 77, 10, + 11, 12, 31, 125, 99, 13, 133, 77, 18, 25, + 26, 112, 27, 28, 29, 30, 13, 14, 10, 11, + 12, 10, 11, 12, 13, 157, 31, 158, 80, 122, + 73, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 10, 11, 12, 13, 59, 13, + 121, 122, 120, 180, 80, 119, 52, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 10, 11, 12, 80, 59, 118, 80, 114, 13, 13, + 80, 80, 80, 82, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 10, 11, 12, 80, + 99, 170, 203, 80, 171, 211, 80, 172, 206, 147, + 38, 39, 40, 41, 42, 43, 44, 45, 145, 146, + 164, 165, 161, 162, 163, 10, 11, 12, 80, 80, + 170, 80, 90, 171, 215, 80, 172, 84, 147, 38, + 39, 40, 41, 42, 43, 44, 45, 145, 146, 164, + 165, 161, 162, 163, 10, 11, 12, 72, 70, 170, + 69, 62, 171, 195, 32, 172, 80, 147, 38, 39, + 40, 41, 42, 43, 44, 45, 145, 146, 164, 165, + 161, 162, 163, 10, 11, 12, nil, nil, 170, nil, + nil, 171, nil, nil, 172, nil, 147, 38, 39, 40, + 41, 42, 43, 44, 45, 145, 146, 164, 165, 161, + 162, 163, 10, 11, 12, nil, nil, 170, nil, nil, + 171, nil, nil, 172, nil, 147, 38, 39, 40, 41, + 42, 43, 44, 45, 145, 146, 164, 165, 161, 162, + 163, 10, 11, 12, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 202, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 10, 11, 12, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 10, - 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 10, 11, 12, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 10, 11, 12, nil, 125, nil, nil, nil, nil, - nil, nil, nil, nil, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 10, 11, 12, + 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 10, + 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 10, 11, 12, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 10, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 10, 11, 12, nil, nil, - nil, nil, nil, 182, nil, nil, nil, nil, 35, 36, + nil, nil, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, + nil, nil, nil, nil, nil, 192, nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 10, 11, 12, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 10, 11, 12, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 203, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 10, 11, 12, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 10, - 11, 12, nil, nil, nil, nil, nil, 182, nil, nil, - nil, nil, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 10, 11, 12, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 35, 36, + 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 213, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 10, + 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, + nil, nil, nil, 192, nil, nil, nil, nil, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 10, 11, 12, nil, 131, nil, nil, nil, nil, + nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, + nil, nil, nil, nil, nil, 192, nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 10, 11, 12, nil, nil, nil, nil, nil, 182, - nil, nil, nil, nil, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 10, 11, 12, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 172, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 10, 11, 12, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 10, + 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 10, 11, 12, nil, 98, - nil, nil, nil, nil, nil, nil, nil, nil, 35, 36, + nil, nil, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 198, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 10, 11, 12, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 192, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 10, 11, 12, + 47, 48, 49, 10, 11, 12, nil, 102, nil, nil, + nil, nil, nil, nil, nil, nil, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 10, + 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 10, 11, 12, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 188, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 10, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, + nil, 192, nil, nil, nil, nil, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 10, 11, 12, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 35, 36, + nil, nil, nil, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, + nil, 187, nil, nil, nil, nil, nil, nil, nil, nil, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 10, 11, 12, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 10, 11, 12, + 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 10, + 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, + nil, 186, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 179, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 10, 11, 12, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 10, - 11, 12, nil, nil, nil, nil, nil, 182, nil, nil, - nil, nil, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 10, 11, 12, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 10, 11, 12, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 179, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 10, 11, 12, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 10, 11, 12, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 176, 141, 36, 37, 38, - 39, 40, 41, 42, 43, 139, 140, 10, 11, 12, - nil, nil, 10, 11, 12, nil, nil, nil, 13, nil, - nil, 17, 24, 25, 108, 26, 27, 28, 29, nil, - 14, 10, 11, 12, nil, nil, nil, nil, nil, nil, - nil, nil, 13, nil, nil, 17, 24, 25, nil, 26, - 27, 28, 29, nil, 14, 10, 11, 12, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 141, 36, - 37, 38, 39, 40, 41, 42, 43, 139, 140 ] + 47, 48, 49, 10, 11, 12, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 10, + 11, 12, nil, nil, nil, nil, nil, nil, nil, nil, + nil, 183, 147, 38, 39, 40, 41, 42, 43, 44, + 45, 145, 146, 10, 11, 12, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 147, 38, 39, 40, + 41, 42, 43, 44, 45, 145, 146 ] racc_action_check = [ - 13, 13, 13, 196, 147, 56, 196, 207, 56, 200, - 111, 200, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 51, 51, 51, 207, - 13, 180, 93, 93, 180, 60, 60, 60, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 57, 57, 57, 105, 51, 103, 101, 97, - 96, 121, 124, 92, 129, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 186, 186, - 186, 57, 130, 186, 91, 134, 186, 186, 90, 186, - 138, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 127, 127, 127, - 144, 89, 127, 107, 88, 127, 86, 151, 127, 84, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 163, 163, 163, 80, - 78, 163, 75, 72, 163, 163, 170, 163, 69, 163, - 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, - 163, 163, 163, 163, 163, 205, 205, 205, 68, 66, - 205, 65, 64, 205, 63, 191, 205, 62, 205, 205, - 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, - 205, 205, 205, 205, 199, 199, 199, 61, 58, 199, - 32, 30, 199, 17, 1, 199, 208, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 193, 193, 193, nil, 193, nil, nil, - nil, nil, nil, nil, nil, nil, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, 193, 26, - 26, 26, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 27, 27, 27, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 28, 28, 28, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, + 0, 0, 0, 58, 205, 216, 58, 205, 210, 190, + 210, 0, 190, 153, 0, 0, 0, 115, 0, 0, + 0, 0, 109, 0, 3, 3, 3, 216, 107, 85, + 85, 85, 0, 97, 97, 3, 105, 101, 3, 3, + 3, 85, 3, 3, 3, 3, 100, 3, 53, 53, + 53, 62, 62, 62, 96, 123, 3, 127, 130, 95, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 13, 13, 13, 135, 53, 136, + 94, 140, 93, 144, 150, 92, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 59, 59, 59, 111, 13, 91, 89, 87, 83, 159, + 81, 78, 75, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 196, 196, 196, 59, + 72, 196, 177, 71, 196, 196, 68, 196, 188, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 196, 196, 215, 215, 215, 67, 66, + 215, 65, 64, 215, 201, 63, 215, 60, 215, 215, + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, + 215, 215, 215, 215, 171, 171, 171, 34, 32, 171, + 31, 18, 171, 171, 1, 171, 217, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 133, 133, 133, nil, nil, 133, nil, + nil, 133, nil, nil, 133, nil, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 209, 209, 209, nil, nil, 209, nil, nil, + 209, nil, nil, 209, nil, 209, 209, 209, 209, 209, + 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, + 209, 176, 176, 176, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 29, 29, 29, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 115, 115, 115, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 24, - 24, 24, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 14, 14, 14, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 99, 99, 99, nil, 99, nil, nil, nil, nil, - nil, nil, nil, nil, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 110, 110, 110, + 29, 29, 29, 30, 30, 30, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 114, + 114, 114, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 27, 27, 27, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 206, 206, 206, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 26, 26, 26, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 117, 117, 117, nil, nil, nil, nil, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 117, 117, 117, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 95, - 95, 95, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 194, 194, 194, nil, nil, - nil, nil, nil, 194, nil, nil, nil, nil, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 25, 25, 25, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 189, 189, 189, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 189, - 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, - 189, 189, 189, 8, 8, 8, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 182, - 182, 182, nil, nil, nil, nil, nil, 182, nil, nil, - nil, nil, 182, 182, 182, 182, 182, 182, 182, 182, - 182, 182, 182, 182, 182, 114, 114, 114, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 114, 114, - 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, - 114, 177, 177, 177, nil, nil, nil, nil, nil, 177, - nil, nil, nil, nil, 177, 177, 177, 177, 177, 177, - 177, 177, 177, 177, 177, 177, 177, 136, 136, 136, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 169, 169, 169, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 73, - 73, 73, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 74, 74, 74, nil, 74, - nil, nil, nil, nil, nil, nil, nil, nil, 74, 74, - 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - 74, 168, 168, 168, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 168, 168, 168, 168, 168, 168, 168, - 168, 168, 168, 168, 168, 168, 168, 77, 77, 77, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 25, + 25, 25, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 118, 118, 118, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 119, 119, 119, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 203, 203, 203, + nil, nil, nil, nil, nil, 203, nil, nil, nil, nil, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 199, 199, 199, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 14, + 14, 14, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 192, 192, 192, nil, nil, + nil, nil, nil, 192, nil, nil, nil, nil, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 103, 103, 103, nil, 103, nil, nil, nil, nil, + nil, nil, nil, nil, 103, 103, 103, 103, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 184, 184, 184, + nil, nil, nil, nil, nil, 184, nil, nil, nil, nil, + 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, + 184, 184, 184, 69, 69, 69, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 180, + 180, 180, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 180, 180, 180, 180, 180, 180, 180, 180, + 180, 180, 180, 180, 180, 28, 28, 28, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 172, 172, 172, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 76, 76, 76, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 164, 164, 164, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 79, - 79, 79, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 113, 113, 113, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, - 113, 81, 81, 81, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 132, 132, 132, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 77, 77, 77, nil, 77, nil, nil, + nil, nil, nil, nil, nil, nil, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 8, + 8, 8, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 122, 122, 122, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 170, 170, 170, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 82, 82, 82, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 162, 162, 162, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 150, - 150, 150, nil, nil, nil, nil, nil, 150, nil, nil, - nil, nil, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 87, 87, 87, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 87, 87, - 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 149, 149, 149, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 173, 173, 173, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 158, 158, 158, nil, nil, nil, nil, + nil, 158, nil, nil, nil, nil, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 84, + 84, 84, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 121, 121, 121, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 157, 157, 157, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 156, 156, 156, + nil, 156, nil, nil, nil, nil, nil, nil, nil, nil, + 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, + 156, 156, 156, 90, 90, 90, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 155, + 155, 155, nil, nil, nil, nil, nil, nil, nil, nil, + nil, 155, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 99, 99, 99, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 142, 142, 142, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 142, 142, 142, 142, 142, 142, 142, + 142, 142, 142, 142, 142, 142, 142, 138, 138, 138, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 146, 146, 146, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 0, 0, 0, - nil, nil, 82, 82, 82, nil, nil, nil, 0, nil, - nil, 0, 0, 0, 82, 0, 0, 0, 0, nil, - 0, 3, 3, 3, nil, nil, nil, nil, nil, nil, - nil, nil, 3, nil, nil, 3, 3, 3, nil, 3, - 3, 3, 3, nil, 3, 116, 116, 116, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116 ] + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 80, 80, 80, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 152, + 152, 152, nil, nil, nil, nil, nil, nil, nil, nil, + nil, 152, 152, 152, 152, 152, 152, 152, 152, 152, + 152, 152, 152, 120, 120, 120, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 120, 120, 120, 120, + 120, 120, 120, 120, 120, 120, 120 ] racc_action_pointer = [ - 1155, 204, nil, 1179, nil, nil, nil, nil, 611, nil, - nil, nil, nil, -2, 403, nil, nil, 190, nil, nil, - nil, nil, nil, nil, 377, 559, 247, 273, 299, 325, - 201, nil, 195, nil, nil, nil, nil, nil, nil, nil, + -2, 194, nil, 22, nil, nil, nil, nil, 867, nil, + nil, nil, nil, 72, 607, nil, nil, nil, 178, nil, + nil, nil, nil, nil, nil, 477, 425, 373, 763, 295, + 321, 159, 188, nil, 182, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, 24, nil, nil, nil, nil, 0, 50, 183, nil, - 33, 166, 158, 143, 141, 140, 138, nil, 137, 141, - nil, nil, 112, 767, 793, 111, nil, 845, 109, 897, - 126, 949, 1160, nil, 111, nil, 85, 1053, 101, 99, - 75, 71, 50, 26, nil, 507, 47, 54, nil, 429, - nil, 50, nil, 52, nil, 24, nil, 82, nil, nil, - 455, -3, nil, 923, 663, 351, 1203, 481, nil, nil, - nil, 53, nil, nil, 31, nil, nil, 105, nil, 51, - 69, nil, 975, nil, 80, nil, 715, nil, 57, nil, - nil, nil, nil, nil, 79, nil, 1131, -4, nil, 1079, - 1027, 104, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 1001, 134, 871, nil, nil, nil, 819, 741, - 138, nil, nil, 1105, nil, nil, nil, 689, nil, nil, - 22, nil, 637, nil, nil, nil, 76, nil, nil, 585, - nil, 167, nil, 221, 533, nil, -6, nil, nil, 192, - 0, nil, nil, nil, nil, 163, nil, -2, 175, nil, + nil, nil, nil, 46, nil, nil, nil, nil, -2, 98, + 152, nil, 49, 134, 143, 130, 128, 127, 105, 711, + nil, 102, 123, nil, nil, 81, 815, 841, 80, nil, + 1231, 79, 945, 95, 997, 27, nil, 99, nil, 75, + 1101, 92, 73, 69, 67, 54, 41, 27, nil, 1153, + 33, 32, nil, 659, nil, 28, nil, 23, nil, -9, + nil, 72, nil, nil, 347, 4, nil, 451, 503, 529, + 1281, 1023, 893, 40, nil, nil, nil, 49, nil, nil, + 27, nil, nil, 211, nil, 64, 66, nil, 1205, nil, + 76, nil, 1179, nil, 50, nil, nil, nil, nil, nil, + 53, nil, 1257, 5, nil, 1127, 1075, 1049, 971, 96, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + 919, 182, 789, nil, nil, nil, 269, 124, nil, nil, + 737, nil, nil, nil, 685, nil, nil, nil, 105, nil, + 0, nil, 633, nil, nil, nil, 124, nil, nil, 581, + nil, 156, nil, 555, nil, -5, 399, nil, nil, 240, + -1, nil, nil, nil, nil, 153, -4, 165, nil, nil, nil, nil, nil, nil ] racc_action_default = [ - -129, -129, -1, -2, -3, -5, -6, -7, -13, -9, - -10, -11, -12, -129, -97, -99, -100, -129, -105, -106, - -107, -108, -109, -110, -129, -129, -129, -129, -129, -129, - -129, -4, -15, -14, -36, -37, -38, -39, -40, -41, - -42, -43, -44, -45, -46, -47, -48, -49, -50, -51, - -25, -129, -29, -31, -32, -33, -62, -88, -129, -98, - -129, -88, -113, -88, -88, -88, -88, 214, -88, -129, - -26, -30, -88, -129, -129, -89, -90, -129, -88, -129, - -129, -129, -129, -102, -129, -111, -88, -129, -129, -129, - -129, -129, -129, -129, -17, -129, -27, -62, -63, -129, - -65, -129, -91, -62, -93, -88, -95, -88, -101, -103, - -129, -129, -57, -114, -129, -129, -129, -129, -8, -16, - -18, -129, -28, -34, -88, -64, -66, -129, -92, -129, - -129, -104, -129, -58, -118, -121, -129, -124, -126, -52, - -53, -54, -55, -56, -88, -60, -129, -129, -116, -129, - -129, -27, -67, -68, -69, -70, -71, -72, -73, -74, - -75, -76, -129, -129, -129, -87, -94, -96, -129, -129, - -129, -122, -123, -129, -59, -61, -127, -129, -117, -128, - -23, -20, -129, -35, -77, -78, -129, -80, -82, -129, - -84, -129, -112, -129, -129, -125, -23, -19, -21, -129, - -129, -79, -81, -83, -85, -129, -119, -88, -88, -24, - -22, -86, -120, -115 ] + -133, -133, -1, -2, -3, -5, -6, -7, -13, -9, + -10, -11, -12, -133, -97, -99, -100, -101, -133, -106, + -107, -108, -109, -110, -111, -133, -133, -133, -133, -133, + -133, -133, -133, -4, -15, -14, -36, -37, -38, -39, + -40, -41, -42, -43, -44, -45, -46, -47, -48, -49, + -50, -51, -25, -133, -29, -31, -32, -33, -62, -88, + -133, -98, -133, -88, -114, -88, -88, -88, -88, -133, + 224, -88, -133, -26, -30, -88, -133, -133, -89, -90, + -133, -88, -133, -133, -133, -133, -103, -133, -112, -88, + -133, -133, -133, -133, -133, -119, -133, -133, -17, -133, + -27, -62, -63, -133, -65, -133, -91, -62, -93, -88, + -95, -88, -102, -104, -133, -133, -57, -115, -133, -133, + -133, -133, -133, -133, -8, -16, -18, -133, -28, -34, + -88, -64, -66, -133, -92, -133, -133, -105, -133, -58, + -119, -122, -133, -125, -127, -52, -53, -54, -55, -56, + -88, -60, -133, -133, -117, -133, -133, -133, -133, -27, + -67, -68, -69, -70, -71, -72, -73, -74, -75, -76, + -133, -133, -133, -87, -94, -96, -133, -133, -123, -124, + -133, -59, -61, -128, -133, -118, -129, -120, -130, -131, + -23, -20, -133, -35, -77, -78, -133, -80, -82, -133, + -84, -133, -113, -133, -126, -23, -133, -19, -21, -133, + -133, -79, -81, -83, -85, -133, -88, -88, -132, -24, + -22, -86, -121, -116 ] racc_goto_table = [ - 8, 123, 152, 8, 72, 149, 33, 1, 52, 59, - 190, 56, 94, 144, 178, 171, 106, 146, 197, 99, - 143, 113, 61, 62, 63, 64, 65, 66, 118, 145, - 100, 143, 122, 80, 208, 204, 120, 85, 187, 88, - 89, 90, 91, 144, 92, 124, 71, 171, 96, 56, - 143, 128, 78, 186, 104, 126, 183, 193, 178, 175, - 84, 202, 111, 189, 83, 166, 167, 143, 51, 102, - 136, 97, 101, 58, 209, 103, 107, 105, 180, 82, - 211, 129, 84, 130, 93, 112, 109, 122, 168, 4, - 143, 86, 31, 121, 68, 32, 3, 101, 170, 2, - 151, 138, nil, 143, nil, 196, nil, nil, 131, 143, - 200, 133, nil, 137, nil, 147, 142, nil, nil, nil, - 174, nil, 207, nil, nil, nil, nil, 142, nil, nil, + 8, 61, 110, 8, 129, 149, 123, 54, 35, 150, + 98, 160, 200, 58, 4, 124, 75, 33, 149, 128, + 185, 185, 1, 178, 104, 63, 64, 65, 66, 67, + 68, 103, 151, 117, 190, 126, 83, 149, 86, 214, + 88, 150, 91, 92, 93, 94, 81, 74, 96, 197, + 132, 177, 100, 58, 174, 175, 149, 178, 108, 130, + 205, 113, 87, 193, 182, 134, 115, 196, 210, 95, + 199, 111, 142, 152, 212, 106, 101, 105, 128, 216, + 107, 149, 109, 207, 60, 87, 135, 219, 136, 85, + 116, 53, 176, 221, 149, 155, 156, 89, 217, 127, + 149, 97, 71, 105, 34, 3, 2, 159, 144, 188, + nil, nil, nil, nil, 137, nil, nil, 139, nil, 143, + 148, 153, 153, nil, nil, nil, nil, 181, nil, nil, + nil, nil, nil, 148, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 142, 147, 181, nil, + nil, nil, 148, nil, nil, 153, 153, 189, 191, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 184, nil, 191, 142, nil, nil, nil, 147, nil, nil, - nil, 195, nil, nil, nil, 181, nil, nil, nil, nil, - 181, nil, nil, 212, 213, nil, 142, 191, nil, nil, - nil, 147, 181, nil, nil, nil, nil, nil, nil, 142, - nil, nil, nil, nil, nil, 142 ] + 194, 148, 201, nil, nil, nil, nil, nil, nil, nil, + 204, nil, nil, nil, 191, nil, nil, nil, nil, nil, + nil, nil, 191, 222, 223, nil, 148, nil, nil, 201, + nil, nil, nil, 191, nil, nil, 218, nil, nil, 148, + nil, nil, nil, nil, nil, 148 ] racc_goto_check = [ - 8, 20, 18, 8, 25, 57, 13, 1, 21, 26, - 40, 13, 15, 28, 56, 59, 12, 31, 17, 32, - 27, 29, 13, 13, 13, 13, 13, 13, 12, 30, - 33, 27, 12, 11, 17, 40, 15, 11, 18, 11, - 11, 11, 11, 28, 11, 25, 21, 59, 11, 13, - 27, 25, 26, 38, 11, 33, 20, 57, 56, 30, - 8, 18, 11, 39, 47, 12, 12, 27, 19, 42, - 55, 13, 13, 43, 18, 13, 26, 13, 16, 46, - 18, 11, 8, 11, 14, 13, 47, 12, 55, 4, - 27, 54, 4, 13, 10, 9, 3, 13, 58, 2, - 11, 60, nil, 27, nil, 16, nil, nil, 13, 27, - 16, 13, nil, 13, nil, 13, 8, nil, nil, nil, - 11, nil, 16, nil, nil, nil, nil, 8, nil, nil, + 8, 26, 12, 8, 20, 27, 59, 21, 13, 28, + 15, 18, 40, 13, 4, 12, 25, 4, 27, 12, + 57, 57, 1, 60, 33, 13, 13, 13, 13, 13, + 13, 32, 30, 29, 16, 15, 11, 27, 48, 40, + 11, 28, 11, 11, 11, 11, 26, 21, 11, 18, + 33, 59, 11, 13, 12, 12, 27, 60, 11, 25, + 16, 48, 8, 20, 30, 25, 11, 38, 16, 13, + 39, 26, 56, 31, 18, 42, 13, 13, 12, 16, + 13, 27, 13, 17, 43, 8, 11, 18, 11, 47, + 13, 19, 56, 18, 27, 58, 58, 55, 17, 13, + 27, 14, 10, 13, 9, 3, 2, 11, 61, 62, + nil, nil, nil, nil, 13, nil, nil, 13, nil, 13, + 8, 13, 13, nil, nil, nil, nil, 11, nil, nil, + nil, nil, nil, 8, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 8, 13, 13, nil, + nil, nil, 8, nil, nil, 13, 13, 13, 13, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 13, nil, 13, 8, nil, nil, nil, 13, nil, nil, - nil, 13, nil, nil, nil, 13, nil, nil, nil, nil, - 13, nil, nil, 11, 11, nil, 8, 13, nil, nil, - nil, 13, 13, nil, nil, nil, nil, nil, nil, 8, + 13, 8, 13, nil, nil, nil, nil, nil, nil, nil, + 13, nil, nil, nil, 13, nil, nil, nil, nil, nil, + nil, nil, 13, 11, 11, nil, 8, nil, nil, 13, + nil, nil, nil, 13, nil, nil, 13, nil, nil, 8, nil, nil, nil, nil, nil, 8 ] racc_goto_pointer = [ - nil, 7, 99, 96, 89, nil, nil, nil, 0, 87, - 62, -24, -64, -2, 15, -57, -72, -162, -125, 55, - -95, -5, nil, nil, nil, -52, -5, -96, -103, -66, - -87, -99, -55, -44, nil, nil, nil, nil, -110, -101, - -154, nil, -6, 59, nil, nil, 19, 4, nil, nil, - nil, nil, nil, nil, 29, -44, -135, -112, -36, -121, - -14 ] + nil, 22, 106, 105, 14, nil, nil, nil, 0, 96, + 68, -23, -81, 0, 29, -62, -124, -107, -122, 78, + -96, -6, nil, nil, nil, -42, -13, -115, -111, -57, + -88, -47, -46, -53, nil, nil, nil, nil, -104, -102, + -160, nil, -3, 70, nil, nil, nil, 27, -24, nil, + nil, nil, nil, nil, nil, 33, -46, -135, -26, -89, + -119, -11, -48 ] racc_goto_default = [ - nil, nil, nil, nil, nil, 5, 6, 7, 48, nil, - nil, nil, 9, 134, nil, nil, nil, nil, nil, nil, - nil, nil, 53, 54, 55, nil, 34, 49, 165, nil, - nil, nil, nil, nil, 158, 159, 160, 161, nil, nil, - nil, 75, 76, nil, 15, 16, nil, nil, 18, 19, - 20, 21, 22, 23, nil, nil, 148, nil, nil, 135, - nil ] + nil, nil, nil, nil, nil, 5, 6, 7, 50, nil, + nil, nil, 9, 140, nil, nil, nil, nil, nil, nil, + nil, nil, 55, 56, 57, nil, 36, 51, 173, nil, + nil, nil, nil, nil, 166, 167, 168, 169, nil, nil, + nil, 78, 79, nil, 15, 16, 17, nil, nil, 19, + 20, 21, 22, 23, 24, nil, nil, 154, nil, nil, + 141, nil, nil ] racc_reduce_table = [ 0, 0, :racc_error, - 1, 35, :_reduce_none, - 1, 36, :_reduce_2, - 1, 37, :_reduce_3, - 2, 37, :_reduce_4, - 1, 38, :_reduce_none, - 1, 38, :_reduce_none, - 1, 38, :_reduce_none, - 5, 39, :_reduce_8, - 1, 39, :_reduce_9, - 1, 42, :_reduce_none, - 1, 42, :_reduce_none, - 1, 42, :_reduce_none, - 0, 43, :_reduce_13, + 1, 36, :_reduce_none, + 1, 37, :_reduce_2, + 1, 38, :_reduce_3, + 2, 38, :_reduce_4, + 1, 39, :_reduce_none, + 1, 39, :_reduce_none, + 1, 39, :_reduce_none, + 5, 40, :_reduce_8, + 1, 40, :_reduce_9, 1, 43, :_reduce_none, - 0, 44, :_reduce_15, - 3, 44, :_reduce_16, - 1, 48, :_reduce_17, - 2, 48, :_reduce_18, - 5, 49, :_reduce_19, - 1, 50, :_reduce_20, - 2, 50, :_reduce_21, - 3, 50, :_reduce_22, - 0, 51, :_reduce_23, - 2, 51, :_reduce_24, - 2, 46, :_reduce_25, - 3, 46, :_reduce_26, - 0, 54, :_reduce_27, - 1, 54, :_reduce_28, - 1, 53, :_reduce_29, - 2, 53, :_reduce_30, - 1, 55, :_reduce_none, - 1, 55, :_reduce_none, - 1, 55, :_reduce_none, - 4, 56, :_reduce_34, - 6, 56, :_reduce_35, - 1, 47, :_reduce_none, - 1, 47, :_reduce_none, - 1, 61, :_reduce_none, - 1, 61, :_reduce_none, + 1, 43, :_reduce_none, + 1, 43, :_reduce_none, + 0, 44, :_reduce_13, + 1, 44, :_reduce_none, + 0, 45, :_reduce_15, + 3, 45, :_reduce_16, + 1, 49, :_reduce_17, + 2, 49, :_reduce_18, + 5, 50, :_reduce_19, + 1, 51, :_reduce_20, + 2, 51, :_reduce_21, + 3, 51, :_reduce_22, + 0, 52, :_reduce_23, + 2, 52, :_reduce_24, + 2, 47, :_reduce_25, + 3, 47, :_reduce_26, + 0, 55, :_reduce_27, + 1, 55, :_reduce_28, + 1, 54, :_reduce_29, + 2, 54, :_reduce_30, + 1, 56, :_reduce_none, + 1, 56, :_reduce_none, + 1, 56, :_reduce_none, + 4, 57, :_reduce_34, + 6, 57, :_reduce_35, + 1, 48, :_reduce_none, + 1, 48, :_reduce_none, + 1, 62, :_reduce_none, + 1, 62, :_reduce_none, + 1, 62, :_reduce_none, + 1, 62, :_reduce_none, + 1, 62, :_reduce_none, + 1, 62, :_reduce_none, + 1, 62, :_reduce_none, + 1, 62, :_reduce_none, 1, 61, :_reduce_none, 1, 61, :_reduce_none, 1, 61, :_reduce_none, 1, 61, :_reduce_none, 1, 61, :_reduce_none, 1, 61, :_reduce_none, - 1, 60, :_reduce_none, - 1, 60, :_reduce_none, - 1, 60, :_reduce_none, - 1, 60, :_reduce_none, - 1, 60, :_reduce_none, - 1, 60, :_reduce_none, - 1, 62, :_reduce_none, - 1, 62, :_reduce_none, - 1, 62, :_reduce_none, - 1, 62, :_reduce_none, - 1, 62, :_reduce_none, - 1, 63, :_reduce_57, - 2, 63, :_reduce_58, - 2, 64, :_reduce_59, - 1, 65, :_reduce_60, - 2, 65, :_reduce_61, - 0, 59, :_reduce_62, - 2, 59, :_reduce_63, - 3, 59, :_reduce_64, - 1, 66, :_reduce_65, - 2, 66, :_reduce_66, - 3, 67, :_reduce_67, - 1, 52, :_reduce_68, - 1, 52, :_reduce_69, - 1, 52, :_reduce_70, - 1, 52, :_reduce_71, - 1, 52, :_reduce_72, - 1, 52, :_reduce_none, - 1, 52, :_reduce_none, - 1, 52, :_reduce_none, - 1, 52, :_reduce_none, - 2, 68, :_reduce_77, - 2, 69, :_reduce_78, - 3, 69, :_reduce_79, - 1, 72, :_reduce_80, - 2, 72, :_reduce_81, - 2, 70, :_reduce_82, - 3, 70, :_reduce_83, - 1, 73, :_reduce_84, - 2, 73, :_reduce_85, - 3, 74, :_reduce_86, - 1, 71, :_reduce_87, - 0, 45, :_reduce_88, - 1, 45, :_reduce_none, - 1, 75, :_reduce_90, - 2, 75, :_reduce_91, - 3, 76, :_reduce_92, - 3, 57, :_reduce_93, - 5, 58, :_reduce_94, - 3, 58, :_reduce_95, - 6, 40, :_reduce_96, - 0, 77, :_reduce_97, - 1, 77, :_reduce_none, - 1, 41, :_reduce_none, - 1, 41, :_reduce_none, - 4, 78, :_reduce_101, + 1, 63, :_reduce_none, + 1, 63, :_reduce_none, + 1, 63, :_reduce_none, + 1, 63, :_reduce_none, + 1, 63, :_reduce_none, + 1, 64, :_reduce_57, + 2, 64, :_reduce_58, + 2, 65, :_reduce_59, + 1, 66, :_reduce_60, + 2, 66, :_reduce_61, + 0, 60, :_reduce_62, + 2, 60, :_reduce_63, + 3, 60, :_reduce_64, + 1, 67, :_reduce_65, + 2, 67, :_reduce_66, + 3, 68, :_reduce_67, + 1, 53, :_reduce_68, + 1, 53, :_reduce_69, + 1, 53, :_reduce_70, + 1, 53, :_reduce_71, + 1, 53, :_reduce_72, + 1, 53, :_reduce_none, + 1, 53, :_reduce_none, + 1, 53, :_reduce_none, + 1, 53, :_reduce_none, + 2, 69, :_reduce_77, + 2, 70, :_reduce_78, + 3, 70, :_reduce_79, + 1, 73, :_reduce_80, + 2, 73, :_reduce_81, + 2, 71, :_reduce_82, + 3, 71, :_reduce_83, + 1, 74, :_reduce_84, + 2, 74, :_reduce_85, + 3, 75, :_reduce_86, + 1, 72, :_reduce_87, + 0, 46, :_reduce_88, + 1, 46, :_reduce_none, + 1, 76, :_reduce_90, + 2, 76, :_reduce_91, + 3, 77, :_reduce_92, + 3, 58, :_reduce_93, + 5, 59, :_reduce_94, + 3, 59, :_reduce_95, + 6, 41, :_reduce_96, + 0, 78, :_reduce_97, + 1, 78, :_reduce_none, + 1, 42, :_reduce_none, + 1, 42, :_reduce_none, + 1, 42, :_reduce_none, + 4, 79, :_reduce_102, + 1, 82, :_reduce_none, + 2, 82, :_reduce_104, + 3, 83, :_reduce_105, + 1, 80, :_reduce_none, 1, 80, :_reduce_none, - 2, 80, :_reduce_103, - 3, 81, :_reduce_104, - 1, 79, :_reduce_none, - 1, 79, :_reduce_none, - 1, 79, :_reduce_none, - 1, 79, :_reduce_none, - 1, 79, :_reduce_none, - 1, 79, :_reduce_none, - 3, 82, :_reduce_111, - 7, 83, :_reduce_112, - 0, 88, :_reduce_113, - 2, 88, :_reduce_114, - 5, 90, :_reduce_115, - 1, 91, :_reduce_116, - 2, 91, :_reduce_117, - 0, 92, :_reduce_118, - 3, 92, :_reduce_119, - 5, 93, :_reduce_120, - 1, 89, :_reduce_121, - 2, 89, :_reduce_122, - 6, 84, :_reduce_123, - 1, 94, :_reduce_124, - 3, 94, :_reduce_125, - 5, 85, :_reduce_126, - 6, 86, :_reduce_127, - 6, 87, :_reduce_128 ] - -racc_reduce_n = 129 - -racc_shift_n = 214 + 1, 80, :_reduce_none, + 1, 80, :_reduce_none, + 1, 80, :_reduce_none, + 1, 80, :_reduce_none, + 3, 84, :_reduce_112, + 7, 85, :_reduce_113, + 0, 90, :_reduce_114, + 2, 90, :_reduce_115, + 5, 92, :_reduce_116, + 1, 93, :_reduce_117, + 2, 93, :_reduce_118, + 0, 94, :_reduce_119, + 3, 94, :_reduce_120, + 5, 95, :_reduce_121, + 1, 91, :_reduce_122, + 2, 91, :_reduce_123, + 6, 86, :_reduce_124, + 1, 96, :_reduce_125, + 3, 96, :_reduce_126, + 5, 87, :_reduce_127, + 6, 88, :_reduce_128, + 6, 89, :_reduce_129, + 6, 81, :_reduce_130, + 1, 97, :_reduce_131, + 3, 97, :_reduce_132 ] + +racc_reduce_n = 133 + +racc_shift_n = 224 racc_token_table = { false => 0, @@ -605,9 +629,10 @@ def make_node(node_name, assigns) :STRING => 30, :DIR_SIGN => 31, :ELLIPSIS => 32, - :PIPE => 33 } + :PIPE => 33, + :DIRECTIVE => 34 } -racc_nt_base = 34 +racc_nt_base = 35 racc_use_result_var = true @@ -662,6 +687,7 @@ def make_node(node_name, assigns) "DIR_SIGN", "ELLIPSIS", "PIPE", + "DIRECTIVE", "$start", "target", "document", @@ -708,6 +734,7 @@ def make_node(node_name, assigns) "fragment_name_opt", "schema_definition", "type_definition", + "directive_definition", "operation_type_definition_list", "operation_type_definition", "scalar_type_definition", @@ -722,7 +749,8 @@ def make_node(node_name, assigns) "input_value_definition_list", "arguments_definitions_opt", "field_definition", - "union_members" ] + "union_members", + "directive_locations" ] Racc_debug_parser = false @@ -1291,31 +1319,31 @@ def _reduce_97(val, _values, result) # reduce 100 omitted -module_eval(<<'.,.,', 'parser.y', 253) - def _reduce_101(val, _values, result) +# reduce 101 omitted + +module_eval(<<'.,.,', 'parser.y', 254) + def _reduce_102(val, _values, result) return make_node(:SchemaDefinition, val[2]) result end .,., -# reduce 102 omitted +# reduce 103 omitted -module_eval(<<'.,.,', 'parser.y', 257) - def _reduce_103(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 258) + def _reduce_104(val, _values, result) return val[0].merge(val[1]) result end .,., -module_eval(<<'.,.,', 'parser.y', 260) - def _reduce_104(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 261) + def _reduce_105(val, _values, result) return { val[0].to_s.to_sym => val[2] } result end .,., -# reduce 105 omitted - # reduce 106 omitted # reduce 107 omitted @@ -1326,139 +1354,163 @@ def _reduce_104(val, _values, result) # reduce 110 omitted -module_eval(<<'.,.,', 'parser.y', 270) - def _reduce_111(val, _values, result) +# reduce 111 omitted + +module_eval(<<'.,.,', 'parser.y', 271) + def _reduce_112(val, _values, result) return make_node(:ScalarTypeDefinition, name: val[1], directives: val[2]) result end .,., -module_eval(<<'.,.,', 'parser.y', 274) - def _reduce_112(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 275) + def _reduce_113(val, _values, result) return make_node(:ObjectTypeDefinition, name: val[1], interfaces: val[2], directives: val[3], fields: val[5]) result end .,., -module_eval(<<'.,.,', 'parser.y', 278) - def _reduce_113(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 279) + def _reduce_114(val, _values, result) return [] result end .,., -module_eval(<<'.,.,', 'parser.y', 279) - def _reduce_114(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 280) + def _reduce_115(val, _values, result) return val[1] result end .,., -module_eval(<<'.,.,', 'parser.y', 283) - def _reduce_115(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 284) + def _reduce_116(val, _values, result) return make_node(:InputValueDefinition, name: val[0], type: val[2], default_value: val[3], directives: val[4]) result end .,., -module_eval(<<'.,.,', 'parser.y', 287) - def _reduce_116(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 288) + def _reduce_117(val, _values, result) return [val[0]] result end .,., -module_eval(<<'.,.,', 'parser.y', 288) - def _reduce_117(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 289) + def _reduce_118(val, _values, result) val[0] << val[1] result end .,., -module_eval(<<'.,.,', 'parser.y', 291) - def _reduce_118(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 292) + def _reduce_119(val, _values, result) return [] result end .,., -module_eval(<<'.,.,', 'parser.y', 292) - def _reduce_119(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 293) + def _reduce_120(val, _values, result) return val[1] result end .,., -module_eval(<<'.,.,', 'parser.y', 296) - def _reduce_120(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 297) + def _reduce_121(val, _values, result) return make_node(:FieldDefinition, name: val[0], arguments: val[1], type: val[3], directives: val[4]) result end .,., -module_eval(<<'.,.,', 'parser.y', 300) - def _reduce_121(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 301) + def _reduce_122(val, _values, result) return [val[0]] result end .,., -module_eval(<<'.,.,', 'parser.y', 301) - def _reduce_122(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 302) + def _reduce_123(val, _values, result) val[0] << val[1] result end .,., -module_eval(<<'.,.,', 'parser.y', 305) - def _reduce_123(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 306) + def _reduce_124(val, _values, result) return make_node(:InterfaceTypeDefinition, name: val[1], directives: val[2], fields: val[4]) result end .,., -module_eval(<<'.,.,', 'parser.y', 309) - def _reduce_124(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 310) + def _reduce_125(val, _values, result) return [val[0].to_s] result end .,., -module_eval(<<'.,.,', 'parser.y', 310) - def _reduce_125(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 311) + def _reduce_126(val, _values, result) val[0] << val[2].to_s result end .,., -module_eval(<<'.,.,', 'parser.y', 314) - def _reduce_126(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 315) + def _reduce_127(val, _values, result) return make_node(:UnionTypeDefinition, name: val[1], directives: val[2], types: val[4]) result end .,., -module_eval(<<'.,.,', 'parser.y', 319) - def _reduce_127(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 320) + def _reduce_128(val, _values, result) return make_node(:EnumTypeDefinition, name: val[1], directives: val[2], values: val[4]) result end .,., -module_eval(<<'.,.,', 'parser.y', 324) - def _reduce_128(val, _values, result) +module_eval(<<'.,.,', 'parser.y', 325) + def _reduce_129(val, _values, result) return make_node(:InputObjectTypeDefinition, name: val[1], directives: val[2], fields: val[4]) result end .,., +module_eval(<<'.,.,', 'parser.y', 330) + def _reduce_130(val, _values, result) + return make_node(:DirectiveDefinition, name: val[2], arguments: val[3], locations: val[5]) + + result + end +.,., + +module_eval(<<'.,.,', 'parser.y', 334) + def _reduce_131(val, _values, result) + return [val[0].to_s] + result + end +.,., + +module_eval(<<'.,.,', 'parser.y', 335) + def _reduce_132(val, _values, result) + val[0] << val[2].to_s + result + end +.,., + def _reduce_none(val, _values, result) val[0] end diff --git a/lib/graphql/language/parser.y b/lib/graphql/language/parser.y index e68007a758..1f3d71068a 100644 --- a/lib/graphql/language/parser.y +++ b/lib/graphql/language/parser.y @@ -249,6 +249,7 @@ rule type_system_definition: schema_definition | type_definition + | directive_definition schema_definition: SCHEMA LCURLY operation_type_definition_list RCURLY { return make_node(:SchemaDefinition, val[2]) } @@ -324,6 +325,15 @@ rule INPUT name directives_list_opt LCURLY input_value_definition_list RCURLY { return make_node(:InputObjectTypeDefinition, name: val[1], directives: val[2], fields: val[4]) } + + directive_definition: + DIRECTIVE DIR_SIGN name arguments_definitions_opt ON directive_locations { + return make_node(:DirectiveDefinition, name: val[2], arguments: val[3], locations: val[5]) + } + + directive_locations: + name { return [val[0].to_s] } + | directive_locations PIPE name { val[0] << val[2].to_s } end ---- header ---- diff --git a/lib/graphql/language/parser_tests.rb b/lib/graphql/language/parser_tests.rb index ef39788e60..fc50e1b0eb 100644 --- a/lib/graphql/language/parser_tests.rb +++ b/lib/graphql/language/parser_tests.rb @@ -380,6 +380,25 @@ def self.included(test) assert_equal 'No longer supported', deprecated_directive.arguments[0].value end + it "parses directive definition" do + document = subject.parse(' + directive @include(if: Boolean!) + on FIELD + | FRAGMENT_SPREAD + | INLINE_FRAGMENT + ') + + type = document.definitions.first + assert_equal GraphQL::Language::Nodes::DirectiveDefinition, type.class + assert_equal 'include', type.name + + assert_equal 1, type.arguments.length + assert_equal 'if', type.arguments[0].name + assert_equal 'Boolean', type.arguments[0].type.of_type.name + + assert_equal ['FIELD', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'], type.locations + end + it "parses scalar types" do document = subject.parse('scalar DateTime') diff --git a/spec/graphql/language/generation_spec.rb b/spec/graphql/language/generation_spec.rb index e9f54c5f7b..89cc8c496e 100644 --- a/spec/graphql/language/generation_spec.rb +++ b/spec/graphql/language/generation_spec.rb @@ -96,6 +96,10 @@ input AnnotatedInput @onInputObjectType { annotatedField: Type @onField } + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT schema }