/* clang-format off */ /* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output, and Bison version. */ #define YYBISON 30802 /* Bison version string. */ #define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Substitute the variable and function names. */ #define yyparse Aqlparse #define yylex Aqllex #define yyerror Aqlerror #define yydebug Aqldebug #define yynerrs Aqlnerrs /* First part of user prologue. */ #line 9 "grammar.y" // we are using alloca here explicitly because we may // otherwise leak error messages that are generated by Bison. // Bison reports all its errors via the function `Aqlerror`, which // will receive the error message as a constant string. So we // must not free the string inside `Aqlerror`, and we cannot even // tell if the error message is a dynamically allocated error // message or a hard-coded error message that resides in some // static part of the program. // Even worse, `Aqlerror` does not return control to Bison but throws // an exception... So the best thing we can do here is to not use // dynamically memory allocation by Bison, but make it use alloca. #define YYSTACK_USE_ALLOCA 1 #include "Aql/Aggregator.h" #include "Aql/Ast.h" #include "Aql/AstNode.h" #include "Aql/Function.h" #include "Aql/Parser.h" #include "Aql/Quantifier.h" #include "Aql/QueryContext.h" #include "Aql/types.h" #include "Basics/StaticStrings.h" #include "Basics/StringUtils.h" #include "Containers/HashSet.h" #include "Containers/SmallVector.h" #include "Graph/PathType.h" #include "VocBase/AccessMode.h" #include #include #include #include #include #line 114 "grammar.cpp" # ifndef YY_CAST # ifdef __cplusplus # define YY_CAST(Type, Val) static_cast (Val) # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) # else # define YY_CAST(Type, Val) ((Type) (Val)) # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) # endif # endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # else # define YY_NULLPTR ((void*)0) # endif # endif #include "grammar.hpp" /* Symbol kind. */ enum yysymbol_kind_t { YYSYMBOL_YYEMPTY = -2, YYSYMBOL_YYEOF = 0, /* "end of query string" */ YYSYMBOL_YYerror = 1, /* error */ YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ YYSYMBOL_T_FOR = 3, /* "FOR declaration" */ YYSYMBOL_T_LET = 4, /* "LET declaration" */ YYSYMBOL_T_FILTER = 5, /* "FILTER declaration" */ YYSYMBOL_T_RETURN = 6, /* "RETURN declaration" */ YYSYMBOL_T_COLLECT = 7, /* "COLLECT declaration" */ YYSYMBOL_T_SORT = 8, /* "SORT declaration" */ YYSYMBOL_T_LIMIT = 9, /* "LIMIT declaration" */ YYSYMBOL_T_WINDOW = 10, /* "WINDOW declaration" */ YYSYMBOL_T_ASC = 11, /* "ASC keyword" */ YYSYMBOL_T_DESC = 12, /* "DESC keyword" */ YYSYMBOL_T_IN = 13, /* "IN keyword" */ YYSYMBOL_T_WITH = 14, /* "WITH keyword" */ YYSYMBOL_T_INTO = 15, /* "INTO keyword" */ YYSYMBOL_T_AGGREGATE = 16, /* "AGGREGATE keyword" */ YYSYMBOL_T_GRAPH = 17, /* "GRAPH keyword" */ YYSYMBOL_T_SHORTEST_PATH = 18, /* "SHORTEST_PATH keyword" */ YYSYMBOL_T_K_SHORTEST_PATHS = 19, /* "K_SHORTEST_PATHS keyword" */ YYSYMBOL_T_K_PATHS = 20, /* "K_PATHS keyword" */ YYSYMBOL_T_ALL_SHORTEST_PATHS = 21, /* "ALL_SHORTEST_PATHS keyword" */ YYSYMBOL_T_DISTINCT = 22, /* "DISTINCT modifier" */ YYSYMBOL_T_REMOVE = 23, /* "REMOVE command" */ YYSYMBOL_T_INSERT = 24, /* "INSERT command" */ YYSYMBOL_T_UPDATE = 25, /* "UPDATE command" */ YYSYMBOL_T_REPLACE = 26, /* "REPLACE command" */ YYSYMBOL_T_UPSERT = 27, /* "UPSERT command" */ YYSYMBOL_T_NULL = 28, /* "null" */ YYSYMBOL_T_TRUE = 29, /* "true" */ YYSYMBOL_T_FALSE = 30, /* "false" */ YYSYMBOL_T_STRING = 31, /* "identifier" */ YYSYMBOL_T_QUOTED_STRING = 32, /* "quoted string" */ YYSYMBOL_T_INTEGER = 33, /* "integer number" */ YYSYMBOL_T_DOUBLE = 34, /* "number" */ YYSYMBOL_T_PARAMETER = 35, /* "bind parameter" */ YYSYMBOL_T_DATA_SOURCE_PARAMETER = 36, /* "bind data source parameter" */ YYSYMBOL_T_ASSIGN = 37, /* "assignment" */ YYSYMBOL_T_NOT = 38, /* "not operator" */ YYSYMBOL_T_AND = 39, /* "and operator" */ YYSYMBOL_T_OR = 40, /* "or operator" */ YYSYMBOL_T_NOT_IN = 41, /* "not in operator" */ YYSYMBOL_T_REGEX_MATCH = 42, /* "~= operator" */ YYSYMBOL_T_REGEX_NON_MATCH = 43, /* "~! operator" */ YYSYMBOL_T_EQ = 44, /* "== operator" */ YYSYMBOL_T_NE = 45, /* "!= operator" */ YYSYMBOL_T_LT = 46, /* "< operator" */ YYSYMBOL_T_GT = 47, /* "> operator" */ YYSYMBOL_T_LE = 48, /* "<= operator" */ YYSYMBOL_T_GE = 49, /* ">= operator" */ YYSYMBOL_T_LIKE = 50, /* "like operator" */ YYSYMBOL_T_PLUS = 51, /* "+ operator" */ YYSYMBOL_T_MINUS = 52, /* "- operator" */ YYSYMBOL_T_TIMES = 53, /* "* operator" */ YYSYMBOL_T_DIV = 54, /* "/ operator" */ YYSYMBOL_T_MOD = 55, /* "% operator" */ YYSYMBOL_T_QUESTION = 56, /* "?" */ YYSYMBOL_T_COLON = 57, /* ":" */ YYSYMBOL_T_SCOPE = 58, /* "::" */ YYSYMBOL_T_RANGE = 59, /* ".." */ YYSYMBOL_T_COMMA = 60, /* "," */ YYSYMBOL_T_OPEN = 61, /* "(" */ YYSYMBOL_T_CLOSE = 62, /* ")" */ YYSYMBOL_T_OBJECT_OPEN = 63, /* "{" */ YYSYMBOL_T_OBJECT_CLOSE = 64, /* "}" */ YYSYMBOL_T_ARRAY_OPEN = 65, /* "[" */ YYSYMBOL_T_ARRAY_CLOSE = 66, /* "]" */ YYSYMBOL_T_OUTBOUND = 67, /* "outbound modifier" */ YYSYMBOL_T_INBOUND = 68, /* "inbound modifier" */ YYSYMBOL_T_ANY = 69, /* "any modifier" */ YYSYMBOL_T_ALL = 70, /* "all modifier" */ YYSYMBOL_T_NONE = 71, /* "none modifier" */ YYSYMBOL_T_AT_LEAST = 72, /* "at least modifier" */ YYSYMBOL_UMINUS = 73, /* UMINUS */ YYSYMBOL_UPLUS = 74, /* UPLUS */ YYSYMBOL_UNEGATION = 75, /* UNEGATION */ YYSYMBOL_FUNCCALL = 76, /* FUNCCALL */ YYSYMBOL_REFERENCE = 77, /* REFERENCE */ YYSYMBOL_INDEXED = 78, /* INDEXED */ YYSYMBOL_EXPANSION = 79, /* EXPANSION */ YYSYMBOL_80_ = 80, /* '.' */ YYSYMBOL_YYACCEPT = 81, /* $accept */ YYSYMBOL_optional_prune_variable = 82, /* optional_prune_variable */ YYSYMBOL_with_collection = 83, /* with_collection */ YYSYMBOL_with_collection_list = 84, /* with_collection_list */ YYSYMBOL_optional_with = 85, /* optional_with */ YYSYMBOL_86_1 = 86, /* $@1 */ YYSYMBOL_queryStart = 87, /* queryStart */ YYSYMBOL_query = 88, /* query */ YYSYMBOL_final_statement = 89, /* final_statement */ YYSYMBOL_optional_statement_block_statements = 90, /* optional_statement_block_statements */ YYSYMBOL_statement_block_statement = 91, /* statement_block_statement */ YYSYMBOL_more_output_variables = 92, /* more_output_variables */ YYSYMBOL_for_output_variables = 93, /* for_output_variables */ YYSYMBOL_prune_and_options = 94, /* prune_and_options */ YYSYMBOL_traversal_graph_info = 95, /* traversal_graph_info */ YYSYMBOL_shortest_path_graph_info = 96, /* shortest_path_graph_info */ YYSYMBOL_k_shortest_paths_graph_info = 97, /* k_shortest_paths_graph_info */ YYSYMBOL_k_paths_graph_info = 98, /* k_paths_graph_info */ YYSYMBOL_all_shortest_paths_graph_info = 99, /* all_shortest_paths_graph_info */ YYSYMBOL_for_statement = 100, /* for_statement */ YYSYMBOL_101_2 = 101, /* $@2 */ YYSYMBOL_102_3 = 102, /* $@3 */ YYSYMBOL_filter_statement = 103, /* filter_statement */ YYSYMBOL_let_statement = 104, /* let_statement */ YYSYMBOL_let_list = 105, /* let_list */ YYSYMBOL_let_element = 106, /* let_element */ YYSYMBOL_array_destructuring = 107, /* array_destructuring */ YYSYMBOL_108_4 = 108, /* $@4 */ YYSYMBOL_array_destructuring_element = 109, /* array_destructuring_element */ YYSYMBOL_object_destructuring = 110, /* object_destructuring */ YYSYMBOL_111_5 = 111, /* $@5 */ YYSYMBOL_object_destructuring_element = 112, /* object_destructuring_element */ YYSYMBOL_count_into = 113, /* count_into */ YYSYMBOL_collect_variable_list = 114, /* collect_variable_list */ YYSYMBOL_115_6 = 115, /* $@6 */ YYSYMBOL_collect_statement = 116, /* collect_statement */ YYSYMBOL_collect_list = 117, /* collect_list */ YYSYMBOL_collect_element = 118, /* collect_element */ YYSYMBOL_collect_optional_into = 119, /* collect_optional_into */ YYSYMBOL_variable_list = 120, /* variable_list */ YYSYMBOL_keep = 121, /* keep */ YYSYMBOL_122_7 = 122, /* $@7 */ YYSYMBOL_aggregate = 123, /* aggregate */ YYSYMBOL_124_8 = 124, /* $@8 */ YYSYMBOL_aggregate_list = 125, /* aggregate_list */ YYSYMBOL_aggregate_element = 126, /* aggregate_element */ YYSYMBOL_aggregate_function_call = 127, /* aggregate_function_call */ YYSYMBOL_128_9 = 128, /* $@9 */ YYSYMBOL_sort_statement = 129, /* sort_statement */ YYSYMBOL_130_10 = 130, /* $@10 */ YYSYMBOL_sort_list = 131, /* sort_list */ YYSYMBOL_sort_element = 132, /* sort_element */ YYSYMBOL_sort_direction = 133, /* sort_direction */ YYSYMBOL_limit_statement = 134, /* limit_statement */ YYSYMBOL_window_statement = 135, /* window_statement */ YYSYMBOL_return_statement = 136, /* return_statement */ YYSYMBOL_in_or_into_collection = 137, /* in_or_into_collection */ YYSYMBOL_remove_statement = 138, /* remove_statement */ YYSYMBOL_insert_statement = 139, /* insert_statement */ YYSYMBOL_update_parameters = 140, /* update_parameters */ YYSYMBOL_update_statement = 141, /* update_statement */ YYSYMBOL_replace_parameters = 142, /* replace_parameters */ YYSYMBOL_replace_statement = 143, /* replace_statement */ YYSYMBOL_update_or_replace = 144, /* update_or_replace */ YYSYMBOL_upsert_input = 145, /* upsert_input */ YYSYMBOL_upsert_statement = 146, /* upsert_statement */ YYSYMBOL_147_11 = 147, /* $@11 */ YYSYMBOL_148_12 = 148, /* $@12 */ YYSYMBOL_149_13 = 149, /* $@13 */ YYSYMBOL_quantifier = 150, /* quantifier */ YYSYMBOL_distinct_expression = 151, /* distinct_expression */ YYSYMBOL_152_14 = 152, /* $@14 */ YYSYMBOL_expression = 153, /* expression */ YYSYMBOL_function_name = 154, /* function_name */ YYSYMBOL_function_call = 155, /* function_call */ YYSYMBOL_156_15 = 156, /* $@15 */ YYSYMBOL_157_16 = 157, /* $@16 */ YYSYMBOL_operator_unary = 158, /* operator_unary */ YYSYMBOL_operator_binary = 159, /* operator_binary */ YYSYMBOL_160_17 = 160, /* $@17 */ YYSYMBOL_161_18 = 161, /* $@18 */ YYSYMBOL_operator_ternary = 162, /* operator_ternary */ YYSYMBOL_163_19 = 163, /* $@19 */ YYSYMBOL_164_20 = 164, /* $@20 */ YYSYMBOL_165_21 = 165, /* $@21 */ YYSYMBOL_optional_function_call_arguments = 166, /* optional_function_call_arguments */ YYSYMBOL_expression_or_query = 167, /* expression_or_query */ YYSYMBOL_168_22 = 168, /* $@22 */ YYSYMBOL_function_arguments_list = 169, /* function_arguments_list */ YYSYMBOL_compound_value = 170, /* compound_value */ YYSYMBOL_array = 171, /* array */ YYSYMBOL_172_23 = 172, /* $@23 */ YYSYMBOL_optional_array_elements = 173, /* optional_array_elements */ YYSYMBOL_array_elements_list = 174, /* array_elements_list */ YYSYMBOL_array_element = 175, /* array_element */ YYSYMBOL_for_options = 176, /* for_options */ YYSYMBOL_options = 177, /* options */ YYSYMBOL_object = 178, /* object */ YYSYMBOL_179_24 = 179, /* $@24 */ YYSYMBOL_optional_object_elements = 180, /* optional_object_elements */ YYSYMBOL_object_elements_list = 181, /* object_elements_list */ YYSYMBOL_object_element = 182, /* object_element */ YYSYMBOL_array_filter_operator = 183, /* array_filter_operator */ YYSYMBOL_array_map_operator = 184, /* array_map_operator */ YYSYMBOL_optional_array_filter = 185, /* optional_array_filter */ YYSYMBOL_optional_array_limit = 186, /* optional_array_limit */ YYSYMBOL_optional_array_return = 187, /* optional_array_return */ YYSYMBOL_graph_collection = 188, /* graph_collection */ YYSYMBOL_graph_collection_list = 189, /* graph_collection_list */ YYSYMBOL_graph_subject = 190, /* graph_subject */ YYSYMBOL_191_25 = 191, /* $@25 */ YYSYMBOL_graph_direction = 192, /* graph_direction */ YYSYMBOL_graph_direction_steps = 193, /* graph_direction_steps */ YYSYMBOL_reference = 194, /* reference */ YYSYMBOL_195_26 = 195, /* $@26 */ YYSYMBOL_196_27 = 196, /* $@27 */ YYSYMBOL_197_28 = 197, /* $@28 */ YYSYMBOL_simple_value = 198, /* simple_value */ YYSYMBOL_numeric_value = 199, /* numeric_value */ YYSYMBOL_value_literal = 200, /* value_literal */ YYSYMBOL_in_or_into_collection_name = 201, /* in_or_into_collection_name */ YYSYMBOL_bind_parameter = 202, /* bind_parameter */ YYSYMBOL_bind_parameter_datasource_expected = 203, /* bind_parameter_datasource_expected */ YYSYMBOL_object_element_name = 204, /* object_element_name */ YYSYMBOL_variable_name = 205 /* variable_name */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; /* Second part of user prologue. */ #line 57 "grammar.y" using namespace arangodb::aql; #define scanner parser->scanner() /// @brief forward for lexer function defined in Aql/tokens.ll int Aqllex(YYSTYPE*, YYLTYPE*, void*); /// @brief register parse error (this will also abort the currently running query) void Aqlerror(YYLTYPE* locp, arangodb::aql::Parser* parser, char const* message) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, message, locp->first_line, locp->first_column); } namespace { // forward declaration void destructureObject(Parser* parser, std::string_view sourceVariable, arangodb::containers::SmallVector& paths, AstNode const* array); void destructureArray(Parser* parser, std::string_view sourceVariable, arangodb::containers::SmallVector& paths, AstNode const* array) { int64_t index = 0; size_t const n = array->numMembers(); for (size_t i = 0; i < n; ++i) { auto member = array->getMember(i); if (member->type == NODE_TYPE_ARRAY) { // array value => recurse AstNode* indexNode = parser->ast()->createNodeValueInt(index); paths.emplace_back(indexNode); int64_t tag = member->getIntValue(true); if (tag == 1) { destructureArray(parser, sourceVariable, paths, member); } else { destructureObject(parser, sourceVariable, paths, member); } paths.pop_back(); } else if (member->type == NODE_TYPE_VARIABLE) { // an actual variable assignment. we need to do something! AstNode* indexNode = parser->ast()->createNodeValueInt(index); paths.emplace_back(indexNode); AstNode const* accessor = parser->ast()->createNodeReference(sourceVariable); for (auto const& it : paths) { accessor = parser->ast()->createNodeIndexedAccess(accessor, it); } AstNode* node = parser->ast()->createNodeLet(member, accessor); parser->ast()->addOperation(node); paths.pop_back(); } ++index; } } void destructureObject(Parser* parser, std::string_view sourceVariable, arangodb::containers::SmallVector& paths, AstNode const* array) { size_t const n = array->numMembers(); for (size_t i = 0; i < n; i += 2) { auto member = array->getMember(i); if (member->isStringValue()) { AstNode const* assigned = array->getMember(i + 1); paths.emplace_back(member); if (assigned->type == NODE_TYPE_ARRAY) { // need to recurse int64_t tag = assigned->getIntValue(true); if (tag == 1) { destructureArray(parser, sourceVariable, paths, assigned); } else { destructureObject(parser, sourceVariable, paths, assigned); } } else if (assigned->type == NODE_TYPE_VARIABLE) { AstNode* accessor = parser->ast()->createNodeReference(sourceVariable); for (auto const& it : paths) { accessor = parser->ast()->createNodeIndexedAccess(accessor, it); } AstNode* node = parser->ast()->createNodeLet(assigned, accessor); parser->ast()->addOperation(node); } paths.pop_back(); } } } bool caseInsensitiveEqual(std::string_view lhs, std::string_view rhs) noexcept { return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), [](char l, char r) { return arangodb::basics::StringUtils::tolower(l) == arangodb::basics::StringUtils::tolower(r); }); } void handleUpsertOptions(AstNode const* options, AstNode* forNode, AstNode* forOptionsNode, AstNode* upsertOptionsNode, bool& canReadOwnWrites) { TRI_ASSERT(canReadOwnWrites); if (options != nullptr && options->type == NODE_TYPE_OBJECT) { for (size_t i = 0; i < options->numMembers(); ++i) { auto nodeMember = options->getMember(i); if (nodeMember->type == NODE_TYPE_OBJECT_ELEMENT) { std::string_view nodeMemberName = nodeMember->getStringView(); if (nodeMemberName == arangodb::StaticStrings::IndexHintOption || nodeMemberName == arangodb::StaticStrings::IndexHintOptionForce || nodeMemberName == arangodb::StaticStrings::IndexHintDisableIndex || nodeMemberName == arangodb::StaticStrings::UseCache) { forOptionsNode->addMember(nodeMember); } else { upsertOptionsNode->addMember(nodeMember); } if (nodeMemberName == arangodb::StaticStrings::ReadOwnWrites) { canReadOwnWrites = nodeMember->getMember(0)->isTrue(); } } } forNode->changeMember(2, forOptionsNode); } if (canReadOwnWrites) { forNode->setFlag(AstNodeFlagType::FLAG_READ_OWN_WRITES); } } AstNode* buildShortestPathInfo(Parser* parser, char const* seperator, AstNode* direction, AstNode* startNode, AstNode* endNode, AstNode* graph, AstNode* options, YYLTYPE const& yyloc) { if (!caseInsensitiveEqual(seperator, "TO")) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'TO'", seperator, yyloc.first_line, yyloc.first_column); } auto infoNode = parser->ast()->createNodeArray(); infoNode->addMember(direction); infoNode->addMember(startNode); infoNode->addMember(endNode); infoNode->addMember(graph); auto opts = parser->ast()->createNodeOptions(options); TRI_ASSERT(opts != nullptr); infoNode->addMember(opts); return infoNode; } void validateForOutVariables(Parser* parser, AstNode const* variableNamesNode, size_t minVariables, size_t maxVariables, bool allowDestructuring, std::string_view nodeType, YYLTYPE const& yyloc) { TRI_ASSERT(variableNamesNode != nullptr); TRI_ASSERT(variableNamesNode->type == NODE_TYPE_ARRAY || variableNamesNode->type == NODE_TYPE_DESTRUCTURING); if (variableNamesNode->type == NODE_TYPE_DESTRUCTURING) { // array/object destructuring TRI_ASSERT(variableNamesNode->numMembers() == 1); if (!allowDestructuring) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, absl::StrCat(nodeType, " does not support array/object destructuring"), yyloc.first_line, yyloc.first_column); } } else { if (variableNamesNode->numMembers() < minVariables || variableNamesNode->numMembers() > maxVariables) { if (maxVariables == 1) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, absl::StrCat(nodeType, " should only have a single output variable"), yyloc.first_line, yyloc.first_column); } else { parser->registerParseError(TRI_ERROR_QUERY_PARSE, absl::StrCat(nodeType, " should have between ", minVariables, " and ", maxVariables, " output variables"), yyloc.first_line, yyloc.first_column); } } } } void validateOptions(Parser* parser, AstNode const* node, int line, int column) { TRI_ASSERT(node != nullptr); if (!node->isObject()) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "'OPTIONS' have to be an object", line, column); } if (!node->isConstant()) { parser->registerParseError(TRI_ERROR_QUERY_COMPILE_TIME_OPTIONS, "'OPTIONS' have to be known at query compile time", line, column); } } /// @brief check if any of the variables used in the INTO expression were /// introduced by the COLLECT itself, in which case it would fail void checkCollectVariables(Parser* parser, char const* context, AstNode const* expression, int line, int column, VarSet const& variablesIntroduced) { if (expression == nullptr) { return; } arangodb::containers::SmallVector toTraverse = { expression }; // recursively find all variables in expression auto preVisitor = [](AstNode const* node) -> bool { // ignore constant nodes, as they can't contain variables return !node->isConstant(); }; auto visitor = [&](AstNode const* node) { // reference to a variable if (node != nullptr && node->type == NODE_TYPE_REFERENCE) { auto variable = static_cast(node->getData()); if (variable == nullptr) { THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid reference in AST"); } if (variable->needsRegister()) { if (variablesIntroduced.contains(variable)) { auto msg = absl::StrCat("use of COLLECT variable '", variable->name, "' inside same COLLECT's expression"); parser->registerParseError(TRI_ERROR_QUERY_VARIABLE_NAME_UNKNOWN, msg.c_str(), variable->name, line, column); } if (auto subquery = parser->ast()->getSubqueryForVariable(variable); subquery != nullptr) { toTraverse.push_back(subquery); } } } }; size_t pos = 0; while (pos < toTraverse.size()) { AstNode const* node = toTraverse[pos++]; // note: the traverseReadOnly may add to the toTraverse vector! Ast::traverseReadOnly(node, preVisitor, visitor); } } /// @brief register variables in the scope void registerAssignVariables(Parser* parser, arangodb::aql::Scopes* scopes, int line, int column, VarSet& variablesIntroduced, AstNode const* vars) { size_t const n = vars->numMembers(); for (size_t i = 0; i < n; ++i) { auto member = vars->getMemberUnchecked(i); if (member != nullptr) { TRI_ASSERT(member->type == NODE_TYPE_ASSIGN); // keep track of the variable for our assignment auto v = static_cast(member->getMember(0)->getData()); scopes->addVariable(v); variablesIntroduced.emplace(v); } } } /// @brief validate the aggregate variables expressions bool validateAggregates(Parser* parser, AstNode const* aggregates, int line, int column) { VarSet variablesIntroduced{}; VarSet varsInAssignment{}; size_t const n = aggregates->numMembers(); for (size_t i = 0; i < n; ++i) { auto member = aggregates->getMemberUnchecked(i); if (member != nullptr) { TRI_ASSERT(member->type == NODE_TYPE_ASSIGN); // keep track of the variable for our assignment auto v = static_cast(member->getMember(0)->getData()); variablesIntroduced.emplace(v); auto func = member->getMember(1); if (func->type != NODE_TYPE_FCALL) { // aggregate expression must be a function call constexpr std::string_view error = "aggregate expression must be a function call"; parser->registerParseError(TRI_ERROR_QUERY_INVALID_AGGREGATE_EXPRESSION, error, line, column); } else { auto f = static_cast(func->getData()); if (!Aggregator::isValid(f->name)) { // aggregate expression must be a call to MIN|MAX|LENGTH... constexpr std::string_view error = "unknown aggregate function used"; parser->registerParseError(TRI_ERROR_QUERY_INVALID_AGGREGATE_EXPRESSION, error, line, column); } } // check if any of the assignment refers to a variable introduced by this very // same COLLECT, e.g. COLLECT aggregate x = .., y = x varsInAssignment.clear(); Ast::getReferencedVariables(member->getMember(1), varsInAssignment); for (auto const& it : varsInAssignment) { if (variablesIntroduced.contains(it)) { auto msg = absl::StrCat("use of COLLECT variable '", it->name, "' inside same COLLECT"); parser->registerParseError(TRI_ERROR_QUERY_VARIABLE_NAME_UNKNOWN, msg.c_str(), it->name, line, column); } } } } return true; } /// @brief validate the WINDOW specification bool validateWindowSpec(Parser* parser, AstNode const* spec, int line, int column) { bool preceding = false; bool following = false; size_t const n = spec->numMembers(); if (n == 0) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "At least one WINDOW bound must be specified ('preceding'/'following')", line, column); } for (size_t i = 0; i < n; ++i) { auto member = spec->getMemberUnchecked(i); if (member != nullptr) { TRI_ASSERT(member->type == NODE_TYPE_OBJECT_ELEMENT); bool* attr{}; auto name = member->getString(); if (name == "preceding") { attr = &preceding; } else if (name == "following") { attr = &following; } else { char const* error = "Invalid WINDOW attribute '%s'; only \"preceding\" and \"following\" are supported"; parser->registerParseError(TRI_ERROR_QUERY_PARSE, error, name, line, column); } if (*attr) { char const* error = "WINDOW attribute '%s' is specified multiple times"; parser->registerParseError(TRI_ERROR_QUERY_PARSE, error, name, line, column); } // mark this attribute as "seen" *attr = true; } } return true; } /// @brief start a new scope for the collect bool startCollectScope(arangodb::aql::Scopes* scopes) { // check if we are in the main scope if (scopes->type() == arangodb::aql::AQL_SCOPE_MAIN || scopes->type() == arangodb::aql::AQL_SCOPE_SUBQUERY) { return false; } // end the active scopes scopes->endNested(); // start a new scope scopes->start(arangodb::aql::AQL_SCOPE_COLLECT); return true; } /// @brief get the INTO variable stored in a node (may not exist) AstNode const* getIntoVariable(Parser* parser, AstNode const* node) { if (node == nullptr) { return nullptr; } if (node->type == NODE_TYPE_VALUE) { // node is a string containing the variable name return parser->ast()->createNodeVariable(node->getStringView(), true); } // node is an array with the variable name as the first member TRI_ASSERT(node->type == NODE_TYPE_ARRAY); TRI_ASSERT(node->numMembers() == 2); auto v = node->getMember(0); TRI_ASSERT(v->type == NODE_TYPE_VALUE); return parser->ast()->createNodeVariable(v->getStringView(), true); } /// @brief get the INTO variable = expression stored in a node (may not exist) AstNode const* getIntoExpression(AstNode const* node) { if (node == nullptr || node->type == NODE_TYPE_VALUE) { return nullptr; } // node is an array with the expression as the second member TRI_ASSERT(node->type == NODE_TYPE_ARRAY); TRI_ASSERT(node->numMembers() == 2); return node->getMember(1); } AstNode* transformOutputVariables(Parser* parser, AstNode const* names) { auto wrapperNode = parser->ast()->createNodeArray(); for (size_t i = 0; i < names->numMembers(); ++i) { AstNode* variableNameNode = names->getMemberUnchecked(i); TRI_ASSERT(variableNameNode->isStringValue()); AstNode* variableNode = parser->ast()->createNodeVariable(variableNameNode->getStringView(), true); wrapperNode->addMember(variableNode); } return wrapperNode; } } // namespace #line 760 "grammar.cpp" #ifdef short # undef short #endif /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure and (if available) are included so that the code can choose integer types of a good width. */ #ifndef __PTRDIFF_MAX__ # include /* INFRINGES ON USER NAME SPACE */ # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YY_STDINT_H # endif #endif /* Narrow types that promote to a signed type and that can represent a signed or unsigned integer of at least N bits. In tables they can save space and decrease cache pressure. Promoting to a signed type helps avoid bugs in integer arithmetic. */ #ifdef __INT_LEAST8_MAX__ typedef __INT_LEAST8_TYPE__ yytype_int8; #elif defined YY_STDINT_H typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef __INT_LEAST16_MAX__ typedef __INT_LEAST16_TYPE__ yytype_int16; #elif defined YY_STDINT_H typedef int_least16_t yytype_int16; #else typedef short yytype_int16; #endif /* Work around bug in HP-UX 11.23, which defines these macros incorrectly for preprocessor constants. This workaround can likely be removed in 2023, as HPE has promised support for HP-UX 11.23 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of . */ #ifdef __hpux # undef UINT_LEAST8_MAX # undef UINT_LEAST16_MAX # define UINT_LEAST8_MAX 255 # define UINT_LEAST16_MAX 65535 #endif #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ && UINT_LEAST8_MAX <= INT_MAX) typedef uint_least8_t yytype_uint8; #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX typedef unsigned char yytype_uint8; #else typedef short yytype_uint8; #endif #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ typedef __UINT_LEAST16_TYPE__ yytype_uint16; #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ && UINT_LEAST16_MAX <= INT_MAX) typedef uint_least16_t yytype_uint16; #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX typedef unsigned short yytype_uint16; #else typedef int yytype_uint16; #endif #ifndef YYPTRDIFF_T # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ # define YYPTRDIFF_T __PTRDIFF_TYPE__ # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ # elif defined PTRDIFF_MAX # ifndef ptrdiff_t # include /* INFRINGES ON USER NAME SPACE */ # endif # define YYPTRDIFF_T ptrdiff_t # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX # else # define YYPTRDIFF_T long # define YYPTRDIFF_MAXIMUM LONG_MAX # endif #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif #define YYSIZE_MAXIMUM \ YY_CAST (YYPTRDIFF_T, \ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ ? YYPTRDIFF_MAXIMUM \ : YY_CAST (YYSIZE_T, -1))) #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) /* Stored state numbers (used for stacks). */ typedef yytype_int16 yy_state_t; /* State numbers in computations. */ typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE_PURE # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define YY_ATTRIBUTE_PURE # endif #endif #ifndef YY_ATTRIBUTE_UNUSED # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else # define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YY_USE(E) ((void) (E)) #else # define YY_USE(E) /* empty */ #endif /* Suppress an incorrect diagnostic about yylval being uninitialized. */ #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") # else # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ # define YY_IGNORE_USELESS_CAST_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") # define YY_IGNORE_USELESS_CAST_END \ _Pragma ("GCC diagnostic pop") #endif #ifndef YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_END #endif #define YY_ASSERT(E) ((void) (0 && (E))) #if 1 /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* 1 */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \ + YYSIZEOF (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 7 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 2004 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 81 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 125 /* YYNRULES -- Number of rules. */ #define YYNRULES 307 /* YYNSTATES -- Number of states. */ #define YYNSTATES 541 /* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 334 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ (0 <= (YYX) && (YYX) <= YYMAXUTOK \ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 80, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 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, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { 0, 667, 667, 673, 683, 686, 692, 696, 700, 707, 709, 709, 721, 726, 731, 733, 736, 739, 742, 745, 751, 753, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 785, 792, 799, 802, 805, 811, 818, 842, 865, 878, 884, 890, 896, 905, 905, 1017, 1017, 1058, 1070, 1082, 1094, 1109, 1117, 1122, 1124, 1129, 1133, 1141, 1152, 1152, 1162, 1165, 1168, 1171, 1174, 1179, 1179, 1189, 1193, 1197, 1201, 1205, 1209, 1214, 1225, 1225, 1236, 1246, 1259, 1283, 1338, 1357, 1388, 1390, 1395, 1402, 1405, 1408, 1417, 1430, 1446, 1446, 1461, 1461, 1471, 1473, 1478, 1485, 1485, 1497, 1497, 1508, 1511, 1517, 1523, 1526, 1529, 1532, 1538, 1543, 1550, 1565, 1583, 1591, 1594, 1600, 1610, 1620, 1628, 1639, 1644, 1652, 1663, 1668, 1671, 1677, 1680, 1686, 1702, 1686, 1749, 1749, 1808, 1811, 1814, 1820, 1820, 1830, 1836, 1839, 1842, 1845, 1848, 1851, 1857, 1860, 1873, 1873, 1880, 1880, 1890, 1893, 1896, 1902, 1902, 1908, 1908, 1914, 1917, 1920, 1923, 1926, 1929, 1932, 1935, 1938, 1941, 1944, 1947, 1950, 1953, 1960, 1967, 1973, 1979, 1985, 1992, 1995, 1998, 2001, 2004, 2007, 2010, 2013, 2016, 2020, 2024, 2028, 2032, 2036, 2040, 2044, 2051, 2087, 2051, 2095, 2095, 2128, 2130, 2135, 2138, 2138, 2158, 2161, 2167, 2170, 2176, 2176, 2185, 2187, 2189, 2194, 2196, 2201, 2207, 2210, 2235, 2255, 2258, 2273, 2273, 2282, 2284, 2286, 2291, 2293, 2298, 2314, 2318, 2322, 2326, 2330, 2334, 2338, 2342, 2346, 2350, 2354, 2358, 2368, 2375, 2378, 2384, 2387, 2393, 2396, 2400, 2404, 2408, 2416, 2419, 2422, 2428, 2431, 2437, 2440, 2443, 2447, 2453, 2457, 2464, 2470, 2470, 2479, 2486, 2490, 2499, 2502, 2505, 2511, 2514, 2520, 2552, 2555, 2558, 2562, 2571, 2571, 2588, 2603, 2616, 2629, 2629, 2674, 2674, 2732, 2735, 2741, 2745, 2752, 2755, 2758, 2761, 2764, 2770, 2775, 2780, 2791, 2799, 2806, 2814, 2822, 2825, 2830 }; #endif /** Accessing symbol of state STATE. */ #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) #if 1 /* The user-facing name of the symbol whose (internal) number is YYSYMBOL. No bounds checking. */ static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "\"end of query string\"", "error", "\"invalid token\"", "\"FOR declaration\"", "\"LET declaration\"", "\"FILTER declaration\"", "\"RETURN declaration\"", "\"COLLECT declaration\"", "\"SORT declaration\"", "\"LIMIT declaration\"", "\"WINDOW declaration\"", "\"ASC keyword\"", "\"DESC keyword\"", "\"IN keyword\"", "\"WITH keyword\"", "\"INTO keyword\"", "\"AGGREGATE keyword\"", "\"GRAPH keyword\"", "\"SHORTEST_PATH keyword\"", "\"K_SHORTEST_PATHS keyword\"", "\"K_PATHS keyword\"", "\"ALL_SHORTEST_PATHS keyword\"", "\"DISTINCT modifier\"", "\"REMOVE command\"", "\"INSERT command\"", "\"UPDATE command\"", "\"REPLACE command\"", "\"UPSERT command\"", "\"null\"", "\"true\"", "\"false\"", "\"identifier\"", "\"quoted string\"", "\"integer number\"", "\"number\"", "\"bind parameter\"", "\"bind data source parameter\"", "\"assignment\"", "\"not operator\"", "\"and operator\"", "\"or operator\"", "\"not in operator\"", "\"~= operator\"", "\"~! operator\"", "\"== operator\"", "\"!= operator\"", "\"< operator\"", "\"> operator\"", "\"<= operator\"", "\">= operator\"", "\"like operator\"", "\"+ operator\"", "\"- operator\"", "\"* operator\"", "\"/ operator\"", "\"% operator\"", "\"?\"", "\":\"", "\"::\"", "\"..\"", "\",\"", "\"(\"", "\")\"", "\"{\"", "\"}\"", "\"[\"", "\"]\"", "\"outbound modifier\"", "\"inbound modifier\"", "\"any modifier\"", "\"all modifier\"", "\"none modifier\"", "\"at least modifier\"", "UMINUS", "UPLUS", "UNEGATION", "FUNCCALL", "REFERENCE", "INDEXED", "EXPANSION", "'.'", "$accept", "optional_prune_variable", "with_collection", "with_collection_list", "optional_with", "$@1", "queryStart", "query", "final_statement", "optional_statement_block_statements", "statement_block_statement", "more_output_variables", "for_output_variables", "prune_and_options", "traversal_graph_info", "shortest_path_graph_info", "k_shortest_paths_graph_info", "k_paths_graph_info", "all_shortest_paths_graph_info", "for_statement", "$@2", "$@3", "filter_statement", "let_statement", "let_list", "let_element", "array_destructuring", "$@4", "array_destructuring_element", "object_destructuring", "$@5", "object_destructuring_element", "count_into", "collect_variable_list", "$@6", "collect_statement", "collect_list", "collect_element", "collect_optional_into", "variable_list", "keep", "$@7", "aggregate", "$@8", "aggregate_list", "aggregate_element", "aggregate_function_call", "$@9", "sort_statement", "$@10", "sort_list", "sort_element", "sort_direction", "limit_statement", "window_statement", "return_statement", "in_or_into_collection", "remove_statement", "insert_statement", "update_parameters", "update_statement", "replace_parameters", "replace_statement", "update_or_replace", "upsert_input", "upsert_statement", "$@11", "$@12", "$@13", "quantifier", "distinct_expression", "$@14", "expression", "function_name", "function_call", "$@15", "$@16", "operator_unary", "operator_binary", "$@17", "$@18", "operator_ternary", "$@19", "$@20", "$@21", "optional_function_call_arguments", "expression_or_query", "$@22", "function_arguments_list", "compound_value", "array", "$@23", "optional_array_elements", "array_elements_list", "array_element", "for_options", "options", "object", "$@24", "optional_object_elements", "object_elements_list", "object_element", "array_filter_operator", "array_map_operator", "optional_array_filter", "optional_array_limit", "optional_array_return", "graph_collection", "graph_collection_list", "graph_subject", "$@25", "graph_direction", "graph_direction_steps", "reference", "$@26", "$@27", "$@28", "simple_value", "numeric_value", "value_literal", "in_or_into_collection_name", "bind_parameter", "bind_parameter_datasource_expected", "object_element_name", "variable_name", YY_NULLPTR }; static const char * yysymbol_name (yysymbol_kind_t yysymbol) { return yytname[yysymbol]; } #endif #define YYPACT_NINF (-459) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) #define YYTABLE_NINF (-308) #define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 20, -459, -459, 52, 115, -459, 617, -459, -459, -459, -459, -459, -4, -459, 76, 76, 1863, 1749, 159, -459, 1863, 1863, 1863, 1863, 1863, 1863, 101, -459, -459, -459, -459, -459, 251, -459, -459, -459, -459, -459, 16, 24, 28, 29, 73, 115, -459, -459, -459, -459, 8, 74, -459, -459, -459, 33, -459, 62, 106, 111, -459, -459, -459, 100, -459, -459, -459, -459, -459, 1863, 50, 1863, 1863, 1863, -459, -459, 1579, 130, -459, -459, -459, -459, -459, -459, -459, 75, -459, -459, -459, -459, -459, 1579, 107, -459, 129, 135, 181, 1863, 917, 961, 187, 1006, 1006, -459, 734, -459, 781, -459, -459, -459, -459, 135, 129, 173, 181, -459, 135, 76, 135, 334, 76, 1863, 1863, 1863, -459, -459, -459, -459, 1050, -459, 27, 1863, 1863, 67, -459, -459, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 155, 1863, -459, -459, -459, 152, 242, 191, -459, 1787, 171, 1863, 213, 135, 199, -459, 203, -459, 232, 129, 210, -459, 643, 1863, 199, -459, 1901, 178, 129, 129, 1863, 129, 1863, 129, 1863, 248, 237, -459, 199, 129, -459, 129, 21, 218, -459, -27, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, 825, 151, 1711, -459, 1579, 1579, 1579, 1825, -459, 222, 228, 238, 249, 250, 252, -459, 253, 259, 1863, 262, 271, 277, 278, 280, 241, 279, -459, 284, 1579, 276, 286, -459, 430, 1863, 1863, 1863, 1863, 1863, 430, 302, 302, 302, 302, 186, 186, 186, 186, 302, 239, 239, -459, -459, -459, 1863, 287, 206, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, -459, 1825, -459, -459, 1094, 291, 299, -459, -459, 1579, 135, 311, -459, 322, -459, 135, 1863, -459, 1863, -459, -459, -459, -459, -459, -459, 1579, 187, 174, 40, 608, -459, -459, -459, -459, -459, -459, -459, 1006, -459, 1006, -459, 1579, 1863, 1863, 135, -459, -459, 135, -459, 76, 76, -459, 342, 255, 343, -459, 1863, 1863, 1863, 1863, 687, 1579, 246, -459, -459, 315, -459, 1863, 1863, 1863, 1863, 1863, 1863, 1138, 1863, 1863, 1863, 1863, 1863, -459, 27, 1863, -459, 1863, 302, 302, 302, 1666, 1623, 1182, 1863, 1227, 430, 430, 302, 302, 186, 186, 186, 186, 314, -459, -459, 535, -459, 535, -459, 135, 346, -459, 1579, -459, -459, 129, 129, 354, 873, 1579, 319, -459, -459, -459, -459, -459, -459, 1939, -459, 1863, -459, 1271, 1315, 1359, 1403, 158, -459, 321, -459, 184, -459, -459, -459, 1863, 1579, 1579, 1579, 1579, 1579, 1579, 330, 1579, 1579, 1579, 1579, 1579, -459, 1579, -459, -459, 1579, 456, -459, 1863, 328, 386, 483, 326, 384, -459, -459, -459, 172, -459, -459, 1863, -459, -459, 1863, 135, 110, 365, 1579, 361, 1447, 1863, 1863, 1863, 1863, -459, -459, -459, -459, -459, -459, -459, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1579, 1863, 1863, 1863, -459, 1863, 394, -459, 873, 1006, -459, 199, 1863, 1863, 687, 687, 687, 687, 118, 1579, 1579, 430, 430, 302, 302, 186, 186, 186, 186, 1491, 1579, 1579, 1535, 1863, 340, 1825, 1863, 129, -459, 1579, 1579, 129, 129, 129, 129, -459, 347, 407, 1863, 1579, -459, 351, 1006, -459, -459, -459, -459, -459, 118, 1863, 1579, -459, 129, -459, 1579, -459 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_int16 yydefact[] = { 9, 10, 20, 0, 0, 12, 0, 1, 4, 304, 303, 6, 11, 5, 0, 0, 0, 0, 78, 103, 0, 0, 0, 0, 0, 0, 0, 13, 21, 22, 24, 23, 89, 25, 26, 27, 28, 14, 29, 30, 31, 32, 33, 0, 8, 307, 69, 62, 36, 0, 37, 38, 34, 56, 57, 0, 0, 0, 295, 296, 297, 275, 293, 291, 292, 302, 301, 0, 0, 0, 0, 280, 223, 210, 55, 0, 278, 142, 143, 144, 276, 208, 209, 146, 294, 145, 277, 139, 116, 141, 0, 96, 221, 0, 89, 0, 112, 0, 209, 0, 0, 123, 0, 126, 0, 131, 134, 129, 130, 0, 221, 221, 89, 7, 71, 64, 0, 0, 0, 0, 0, 0, 156, 152, 154, 155, 0, 20, 225, 212, 0, 0, 159, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 0, 137, 136, 138, 0, 0, 0, 150, 0, 0, 0, 0, 0, 0, 80, 79, 86, 0, 221, 104, 105, 108, 0, 0, 114, 0, 0, 221, 221, 0, 221, 0, 221, 0, 0, 90, 81, 94, 221, 84, 221, 0, 72, 66, 0, 67, 65, 35, 270, 271, 272, 49, 51, 52, 53, 54, 47, 273, 0, 58, 60, 61, 59, 204, 279, 0, 0, 0, 0, 0, 230, 306, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 228, 0, 217, 0, 213, 215, 172, 0, 0, 0, 0, 0, 173, 178, 179, 166, 167, 168, 169, 170, 171, 177, 161, 162, 163, 164, 165, 0, 0, 147, 0, 0, 0, 0, 0, 0, 0, 0, 0, 149, 204, 246, 244, 0, 285, 287, 282, 283, 140, 0, 97, 98, 0, 222, 0, 0, 82, 0, 109, 110, 107, 111, 289, 290, 113, 0, 275, 293, 301, 117, 298, 299, 300, 118, 119, 120, 0, 121, 0, 124, 132, 0, 0, 0, 85, 83, 71, 70, 0, 64, 63, 39, 272, 218, 274, 0, 0, 0, 0, 0, 203, 0, 206, 20, 202, 281, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224, 227, 0, 211, 214, 175, 176, 174, 160, 158, 0, 0, 0, 186, 187, 180, 181, 182, 183, 184, 185, 0, 284, 245, 248, 247, 248, 77, 0, 0, 87, 88, 106, 115, 221, 221, 0, 0, 91, 95, 92, 76, 75, 74, 73, 68, 0, 50, 0, 48, 0, 0, 0, 0, 0, 258, 264, 42, 0, 259, 153, 205, 204, 240, 239, 238, 237, 242, 236, 0, 232, 231, 233, 234, 235, 229, 241, 216, 197, 200, 0, 151, 0, 0, 0, 0, 0, 253, 99, 148, 100, 0, 122, 125, 0, 127, 128, 0, 0, 275, 40, 2, 0, 219, 0, 0, 0, 0, 269, 268, 267, 265, 260, 261, 207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249, 0, 0, 0, 286, 0, 256, 101, 0, 0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 243, 198, 194, 195, 188, 189, 190, 191, 192, 193, 0, 250, 252, 254, 0, 0, 204, 0, 221, 41, 3, 220, 221, 221, 221, 221, 262, 266, 0, 0, 257, 288, 0, 0, 135, 43, 44, 46, 45, 0, 0, 255, 102, 221, 263, 251, 133 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -459, -459, 14, -459, -459, -459, -459, -114, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, 296, -3, -459, 94, 0, -459, 103, 387, -459, -459, -459, -459, 132, -74, -459, -459, -459, -15, -459, -459, 46, -459, -459, -459, -459, -459, 136, -459, -459, -459, -459, -79, -459, -459, -459, -459, -459, -459, -57, -459, -459, -459, -459, -459, -132, -459, -459, -16, 48, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -254, 22, -459, -459, -459, -459, -459, -459, -459, 78, -459, -108, -11, -459, -459, -459, 79, -459, -459, 57, -459, -459, -458, -459, -211, -459, -98, -459, -459, -459, -459, -459, -459, -459, 264, 260, -14, 18, -459, 102 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { 0, 450, 11, 12, 2, 4, 3, 5, 27, 6, 28, 48, 49, 397, 201, 202, 203, 204, 205, 29, 325, 323, 30, 31, 53, 54, 55, 115, 194, 56, 114, 191, 92, 32, 93, 33, 165, 166, 111, 389, 188, 315, 94, 162, 282, 283, 440, 510, 34, 95, 169, 170, 292, 35, 36, 37, 177, 38, 39, 101, 40, 103, 41, 447, 106, 42, 183, 386, 184, 155, 88, 160, 332, 75, 76, 272, 213, 77, 78, 243, 242, 79, 259, 466, 260, 333, 334, 335, 336, 80, 81, 129, 235, 236, 237, 399, 164, 82, 128, 230, 231, 232, 276, 277, 436, 481, 509, 406, 521, 407, 493, 408, 208, 83, 127, 374, 376, 293, 84, 85, 301, 86, 409, 233, 57 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 74, 89, 186, 189, 96, 97, 99, 100, 102, 104, 98, 50, 108, 215, 51, 107, -15, 112, 371, 207, 168, 178, 13, 180, -16, 182, 44, 8, -17, -18, 13, 9, 10, 321, 1, 520, 216, 217, 190, 322, -299, 218, 219, -299, -299, -299, -299, -299, -299, -299, -299, 122, 7, 124, 125, 126, 43, 113, 220, 221, 288, 13, 222, -299, -299, -299, -299, -299, 116, 306, 307, -299, 309, -19, 311, 538, -15, 223, -15, 171, 316, 318, 317, 174, -16, 319, -16, 117, -17, -18, -17, -18, 224, 118, 225, 226, 227, 228, 229, 119, -299, 206, -299, 210, 211, 212, 105, 45, 326, 239, 240, 123, 193, 234, 238, 195, 52, 241, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, -19, 261, -19, 65, 66, 161, 46, 158, 47, 275, 120, 280, 279, 8, -307, 121, 405, 9, 10, 285, 9, 10, 159, 296, 295, -148, 238, 163, -148, 297, 308, 72, 310, 45, 312, -148, 327, 328, -148, 329, 90, -298, 91, 285, -298, -298, -298, -298, -298, -298, -298, -298, 198, 199, 200, 156, 458, 459, 157, 331, 65, 66, 167, 109, -298, -298, -298, -298, -298, 278, 91, 187, -298, 65, 66, 344, 302, 303, 185, -199, 262, 304, 462, 192, 196, 197, 65, 66, 411, 271, 355, 356, 357, 358, 359, 281, 384, 156, 385, -148, 482, -298, -148, -298, 144, 145, 146, 147, 148, 434, 360, 434, 150, 362, 363, 364, 365, 366, 367, 368, 369, 370, 263, 526, 144, 145, 146, 147, 148, 72, 286, 284, 90, 109, 91, -137, 287, 289, 381, 313, 171, 314, 320, 442, 443, 516, 517, 518, 519, 383, 264, 337, 338, 265, 266, 267, 268, 269, 270, 146, 147, 148, 339, -137, 387, 388, -137, -137, -137, -137, -137, -137, 350, 340, 341, 410, -305, 342, 400, 401, 402, 403, 130, 343, 392, 193, 345, 393, 195, 413, 414, 415, 416, 417, 418, 346, 420, 421, 422, 423, 424, 347, 348, 426, 349, 234, 351, 131, 352, 353, 134, 361, 429, 354, 373, 139, 140, 141, 142, 375, 144, 145, 146, 147, 148, 435, 379, 435, 150, 58, 59, 60, 61, 62, 63, 64, 65, 66, 378, 67, 396, 398, 412, 431, 439, 444, 448, 451, 461, 453, 377, 68, 69, 70, 465, 167, 476, 460, 477, 479, 480, 463, 71, 486, 72, 487, 73, 508, 198, 199, 200, 528, 512, 525, 533, 529, 530, 531, 532, 534, 536, 209, 395, 475, 390, 380, 110, 192, 391, 394, 196, 438, 382, 511, 441, 483, 540, 425, 484, 427, 437, 464, 294, 305, 0, 489, 490, 491, 492, 0, 0, 0, 0, 0, 0, 537, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 0, 504, 505, 506, 0, 507, 0, 0, 0, 0, 467, 0, 514, 515, 0, 0, 513, 139, 140, 141, 142, 284, 144, 145, 146, 147, 148, 0, 0, 478, 150, 0, 0, 524, 0, 0, 527, 130, 468, 452, 0, 469, 470, 471, 472, 473, 474, 0, 535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 539, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 432, 0, 150, 0, 0, 0, 0, 0, 0, 0, 485, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 72, 0, 73, 0, 0, 0, 151, 152, 153, 433, -300, 0, 0, -300, -300, -300, -300, -300, -300, -300, -300, 0, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, -300, -300, -300, -300, -300, 0, 0, 0, -300, 22, 23, 24, 25, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 290, 291, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -300, 0, -300, 58, 59, 60, 0, 62, 63, 64, 65, 66, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 404, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 405, 0, 0, 0, 9, 10, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 0, 0, 150, 175, 179, 176, 0, 0, 0, 0, 198, 199, 324, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 0, 0, 150, 175, 181, 176, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 0, 0, 150, 0, 130, 0, 0, 0, 0, 0, 198, 199, 324, 152, 153, 154, 445, 446, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 173, 150, 172, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 0, 175, 150, 176, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 214, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 372, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 419, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 428, 130, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 430, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 454, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 455, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 456, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 457, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 488, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 522, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 523, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 130, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 132, 0, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 130, 0, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 131, 0, 0, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 0, 0, 0, 150, 0, 0, 0, 0, 0, 330, 0, 0, 0, 151, 152, 153, 154, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, 87, 71, 0, 72, 0, 73, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 72, 0, 73, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, 273, 0, 0, 274, 0, 0, 0, 0, 71, 0, 72, 0, 73, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 71, -201, 72, 0, 73, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 72, 0, 73, 58, 59, 60, 298, 299, 63, 64, 65, 300, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 72, 0, 73, 58, 59, 60, 449, 62, 63, 64, 65, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 72, 0, 73 }; static const yytype_int16 yycheck[] = { 16, 17, 110, 111, 20, 21, 22, 23, 24, 25, 21, 14, 26, 127, 14, 26, 0, 32, 272, 117, 94, 100, 4, 102, 0, 104, 12, 31, 0, 0, 12, 35, 36, 60, 14, 493, 9, 10, 112, 66, 0, 14, 15, 3, 4, 5, 6, 7, 8, 9, 10, 67, 0, 69, 70, 71, 60, 43, 31, 32, 168, 43, 35, 23, 24, 25, 26, 27, 60, 177, 178, 31, 180, 0, 182, 533, 60, 50, 62, 95, 188, 60, 190, 98, 60, 64, 62, 13, 60, 60, 62, 62, 65, 60, 67, 68, 69, 70, 71, 37, 60, 117, 62, 119, 120, 121, 5, 31, 206, 42, 43, 61, 115, 129, 130, 115, 14, 50, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 60, 150, 62, 35, 36, 31, 63, 65, 65, 158, 37, 160, 159, 31, 37, 37, 31, 35, 36, 163, 35, 36, 80, 172, 171, 58, 175, 31, 61, 173, 179, 63, 181, 31, 183, 58, 18, 19, 61, 21, 14, 0, 16, 187, 3, 4, 5, 6, 7, 8, 9, 10, 67, 68, 69, 58, 31, 32, 61, 208, 35, 36, 93, 15, 23, 24, 25, 26, 27, 31, 16, 31, 31, 35, 36, 224, 31, 32, 109, 57, 61, 36, 31, 114, 115, 116, 35, 36, 335, 31, 239, 240, 241, 242, 243, 15, 308, 58, 310, 58, 61, 60, 61, 62, 51, 52, 53, 54, 55, 374, 259, 376, 59, 262, 263, 264, 265, 266, 267, 268, 269, 270, 13, 510, 51, 52, 53, 54, 55, 63, 60, 162, 14, 15, 16, 13, 37, 60, 287, 24, 289, 37, 57, 384, 385, 489, 490, 491, 492, 297, 41, 62, 57, 44, 45, 46, 47, 48, 49, 53, 54, 55, 57, 41, 313, 314, 44, 45, 46, 47, 48, 49, 64, 57, 57, 62, 57, 57, 327, 328, 329, 330, 13, 57, 320, 321, 57, 320, 321, 338, 339, 340, 341, 342, 343, 57, 345, 346, 347, 348, 349, 57, 57, 352, 57, 354, 60, 38, 57, 66, 41, 57, 361, 60, 56, 46, 47, 48, 49, 53, 51, 52, 53, 54, 55, 374, 37, 376, 59, 28, 29, 30, 31, 32, 33, 34, 35, 36, 60, 38, 31, 31, 60, 62, 31, 24, 60, 396, 60, 398, 281, 50, 51, 52, 57, 286, 61, 404, 5, 66, 9, 408, 61, 31, 63, 37, 65, 6, 67, 68, 69, 512, 484, 66, 60, 516, 517, 518, 519, 5, 62, 118, 321, 432, 315, 286, 32, 318, 318, 320, 321, 378, 289, 483, 379, 444, 537, 351, 447, 354, 376, 412, 171, 176, -1, 454, 455, 456, 457, -1, -1, -1, -1, -1, -1, 527, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, -1, 476, 477, 478, -1, 480, -1, -1, -1, -1, 13, -1, 487, 488, -1, -1, 486, 46, 47, 48, 49, 378, 51, 52, 53, 54, 55, -1, -1, 5, 59, -1, -1, 508, -1, -1, 511, 13, 41, 396, -1, 44, 45, 46, 47, 48, 49, -1, 523, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 534, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 5, -1, 59, -1, -1, -1, -1, -1, -1, -1, 448, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, 63, -1, 65, -1, -1, -1, 69, 70, 71, 72, 0, -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, -1, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, 23, 24, 25, 26, 27, -1, -1, -1, 31, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, 28, 29, 30, -1, 32, 33, 34, 35, 36, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, 17, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, 31, -1, -1, -1, 35, 36, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, -1, -1, 59, 13, 14, 15, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, -1, -1, 59, 13, 14, 15, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, -1, -1, 59, -1, 13, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 25, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, 14, 59, 60, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, -1, 13, 59, 15, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, 62, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, 66, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, 66, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 13, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, 62, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, 31, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, 31, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, 31, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, 31, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, 31, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, 62, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, 60, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 13, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 13, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, -1, -1, -1, 59, -1, -1, -1, -1, -1, 20, -1, -1, -1, 69, 70, 71, 72, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, -1, -1, -1, -1, -1, -1, -1, 22, 61, -1, 63, -1, 65, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, 63, -1, 65, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, 53, -1, -1, 56, -1, -1, -1, -1, 61, -1, 63, -1, 65, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, -1, 65, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, 63, -1, 65, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, 63, -1, 65, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, 63, -1, 65 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 14, 85, 87, 86, 88, 90, 0, 31, 35, 36, 83, 84, 203, 3, 4, 5, 6, 7, 8, 9, 10, 23, 24, 25, 26, 27, 89, 91, 100, 103, 104, 114, 116, 129, 134, 135, 136, 138, 139, 141, 143, 146, 60, 83, 31, 63, 65, 92, 93, 107, 110, 205, 105, 106, 107, 110, 205, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 50, 51, 52, 61, 63, 65, 153, 154, 155, 158, 159, 162, 170, 171, 178, 194, 199, 200, 202, 22, 151, 153, 14, 16, 113, 115, 123, 130, 153, 153, 178, 153, 153, 140, 153, 142, 153, 5, 145, 178, 202, 15, 113, 119, 123, 83, 111, 108, 60, 13, 60, 37, 37, 37, 153, 61, 153, 153, 153, 195, 179, 172, 13, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 69, 70, 71, 72, 150, 58, 61, 65, 80, 152, 31, 124, 31, 177, 117, 118, 205, 119, 131, 132, 153, 60, 14, 123, 13, 15, 137, 137, 14, 137, 14, 137, 147, 149, 205, 177, 31, 121, 177, 119, 112, 205, 107, 109, 110, 205, 205, 67, 68, 69, 95, 96, 97, 98, 99, 153, 192, 193, 106, 153, 153, 153, 157, 62, 88, 9, 10, 14, 15, 31, 32, 35, 50, 65, 67, 68, 69, 70, 71, 180, 181, 182, 204, 153, 173, 174, 175, 153, 42, 43, 50, 161, 160, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 163, 165, 153, 61, 13, 41, 44, 45, 46, 47, 48, 49, 31, 156, 53, 56, 153, 183, 184, 31, 202, 153, 15, 125, 126, 205, 178, 60, 37, 177, 60, 11, 12, 133, 198, 200, 202, 153, 178, 31, 32, 36, 201, 31, 32, 36, 201, 177, 177, 153, 177, 153, 177, 153, 24, 37, 122, 177, 177, 60, 64, 57, 60, 66, 102, 69, 101, 192, 18, 19, 21, 20, 153, 153, 166, 167, 168, 169, 62, 57, 57, 57, 57, 57, 57, 153, 57, 57, 57, 57, 57, 64, 60, 57, 66, 60, 153, 153, 153, 153, 153, 153, 57, 153, 153, 153, 153, 153, 153, 153, 153, 153, 166, 66, 56, 196, 53, 197, 205, 60, 37, 118, 153, 132, 123, 137, 137, 148, 153, 153, 120, 205, 112, 107, 110, 205, 109, 31, 94, 31, 176, 153, 153, 153, 153, 17, 31, 188, 190, 192, 203, 62, 88, 60, 153, 153, 153, 153, 153, 153, 66, 153, 153, 153, 153, 153, 182, 153, 175, 57, 153, 62, 62, 5, 72, 150, 153, 185, 185, 126, 31, 127, 154, 177, 177, 24, 25, 26, 144, 60, 31, 82, 153, 205, 153, 31, 31, 31, 31, 31, 32, 202, 60, 31, 202, 167, 57, 164, 13, 41, 44, 45, 46, 47, 48, 49, 153, 61, 5, 5, 66, 9, 186, 61, 153, 153, 205, 31, 37, 31, 153, 153, 153, 153, 191, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 6, 187, 128, 144, 137, 178, 153, 153, 190, 190, 190, 190, 188, 189, 62, 60, 153, 66, 166, 153, 177, 177, 177, 177, 177, 60, 5, 153, 62, 137, 188, 153, 177 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_uint8 yyr1[] = { 0, 81, 82, 82, 83, 83, 84, 84, 84, 85, 86, 85, 87, 88, 89, 89, 89, 89, 89, 89, 90, 90, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 93, 93, 93, 94, 94, 94, 95, 96, 97, 98, 99, 101, 100, 102, 100, 100, 100, 100, 100, 103, 104, 105, 105, 106, 106, 106, 108, 107, 109, 109, 109, 109, 109, 111, 110, 112, 112, 112, 112, 112, 112, 113, 115, 114, 116, 116, 116, 116, 116, 116, 117, 117, 118, 119, 119, 119, 120, 120, 122, 121, 124, 123, 125, 125, 126, 128, 127, 130, 129, 131, 131, 132, 133, 133, 133, 133, 134, 134, 135, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 145, 147, 148, 146, 149, 146, 150, 150, 150, 152, 151, 151, 153, 153, 153, 153, 153, 153, 154, 154, 156, 155, 157, 155, 158, 158, 158, 160, 159, 161, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 163, 164, 162, 165, 162, 166, 166, 167, 168, 167, 169, 169, 170, 170, 172, 171, 173, 173, 173, 174, 174, 175, 176, 176, 176, 177, 177, 179, 178, 180, 180, 180, 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, 184, 184, 185, 185, 185, 185, 185, 186, 186, 186, 187, 187, 188, 188, 188, 188, 189, 189, 190, 191, 190, 190, 190, 190, 192, 192, 192, 193, 193, 194, 194, 194, 194, 194, 195, 194, 194, 194, 194, 196, 194, 197, 194, 198, 198, 199, 199, 200, 200, 200, 200, 200, 201, 201, 201, 202, 202, 203, 203, 204, 204, 205 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ static const yytype_int8 yyr2[] = { 0, 2, 1, 3, 1, 1, 1, 3, 2, 0, 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 0, 2, 4, 3, 7, 7, 7, 7, 0, 6, 0, 6, 4, 4, 4, 4, 2, 2, 1, 3, 3, 3, 3, 0, 4, 0, 1, 1, 1, 3, 0, 4, 0, 1, 3, 3, 3, 3, 4, 0, 3, 3, 3, 4, 4, 3, 4, 1, 3, 3, 0, 2, 4, 1, 3, 0, 3, 0, 3, 1, 3, 3, 0, 5, 0, 3, 1, 3, 2, 0, 1, 1, 1, 2, 4, 3, 5, 2, 2, 2, 4, 4, 3, 5, 2, 3, 5, 2, 1, 1, 1, 1, 0, 0, 11, 0, 9, 1, 1, 1, 0, 3, 1, 1, 1, 1, 1, 1, 3, 1, 3, 0, 5, 0, 5, 2, 2, 2, 0, 4, 0, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 0, 5, 0, 1, 1, 0, 2, 1, 3, 1, 1, 0, 4, 0, 1, 2, 1, 3, 1, 0, 2, 4, 0, 2, 0, 4, 0, 1, 2, 1, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 1, 2, 1, 2, 0, 2, 3, 6, 3, 0, 2, 4, 0, 2, 1, 1, 2, 2, 1, 3, 1, 0, 4, 2, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 0, 4, 3, 3, 4, 0, 6, 0, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; enum { YYENOMEM = -2 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (&yylloc, parser, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Backward compatibility with an undocumented macro. Use YYerror or YYUNDEF. */ #define YYERRCODE YYUNDEF /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (0) #endif #define YYRHSLOC(Rhs, K) ((Rhs)[K]) /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* YYLOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ # ifndef YYLOCATION_PRINT # if defined YY_LOCATION_PRINT /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ # define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) # elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ YY_ATTRIBUTE_UNUSED static int yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += YYFPRINTF (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += YYFPRINTF (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += YYFPRINTF (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += YYFPRINTF (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += YYFPRINTF (yyo, "-%d", end_col); } return res; } # define YYLOCATION_PRINT yy_location_print_ /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ # define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) # else # define YYLOCATION_PRINT(File, Loc) ((void) 0) /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ # define YY_LOCATION_PRINT YYLOCATION_PRINT # endif # endif /* !defined YYLOCATION_PRINT */ # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Kind, Value, Location, parser); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*-----------------------------------. | Print this symbol's value on YYO. | `-----------------------------------*/ static void yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, arangodb::aql::Parser* parser) { FILE *yyoutput = yyo; YY_USE (yyoutput); YY_USE (yylocationp); YY_USE (parser); if (!yyvaluep) return; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*---------------------------. | Print this symbol on YYO. | `---------------------------*/ static void yy_symbol_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, arangodb::aql::Parser* parser) { YYFPRINTF (yyo, "%s %s (", yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); YYLOCATION_PRINT (yyo, yylocationp); YYFPRINTF (yyo, ": "); yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, parser); YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, arangodb::aql::Parser* parser) { int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), &yyvsp[(yyi + 1) - (yynrhs)], &(yylsp[(yyi + 1) - (yynrhs)]), parser); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, yylsp, Rule, parser); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) ((void) 0) # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif /* Context of a parse error. */ typedef struct { yy_state_t *yyssp; yysymbol_kind_t yytoken; YYLTYPE *yylloc; } yypcontext_t; /* Put in YYARG at most YYARGN of the expected tokens given the current YYCTX, and return the number of tokens stored in YYARG. If YYARG is null, return the number of expected tokens (guaranteed to be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. Return 0 if there are more than YYARGN expected tokens, yet fill YYARG up to YYARGN. */ static int yypcontext_expected_tokens (const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn) { /* Actual size of YYARG. */ int yycount = 0; int yyn = yypact[+*yyctx->yyssp]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror && !yytable_value_is_error (yytable[yyx + yyn])) { if (!yyarg) ++yycount; else if (yycount == yyargn) return 0; else yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); } } if (yyarg && yycount == 0 && 0 < yyargn) yyarg[0] = YYSYMBOL_YYEMPTY; return yycount; } #ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ static YYPTRDIFF_T yystrlen (const char *yystr) { YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif #endif #ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif #endif #ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; else goto append; append: default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (yyres) return yystpcpy (yyres, yystr) - yyres; else return yystrlen (yystr); } #endif static int yy_syntax_error_arguments (const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn) { /* Actual size of YYARG. */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yyctx->yytoken != YYSYMBOL_YYEMPTY) { int yyn; if (yyarg) yyarg[yycount] = yyctx->yytoken; ++yycount; yyn = yypcontext_expected_tokens (yyctx, yyarg ? yyarg + 1 : yyarg, yyargn - 1); if (yyn == YYENOMEM) return YYENOMEM; else yycount += yyn; } return yycount; } /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the required number of bytes is too large to store. */ static int yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, const yypcontext_t *yyctx) { enum { YYARGS_MAX = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat: reported tokens (one for the "unexpected", one per "expected"). */ yysymbol_kind_t yyarg[YYARGS_MAX]; /* Cumulated lengths of YYARG. */ YYPTRDIFF_T yysize = 0; /* Actual size of YYARG. */ int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); if (yycount == YYENOMEM) return YYENOMEM; switch (yycount) { #define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); #undef YYCASE_ } /* Compute error message size. Don't count the "%s"s, but reserve room for the terminator. */ yysize = yystrlen (yyformat) - 2 * yycount + 1; { int yyi; for (yyi = 0; yyi < yycount; ++yyi) { YYPTRDIFF_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return YYENOMEM; } } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return -1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); yyformat += 2; } else { ++yyp; ++yyformat; } } return 0; } /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, arangodb::aql::Parser* parser) { YY_USE (yyvaluep); YY_USE (yylocationp); YY_USE (parser); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*----------. | yyparse. | `----------*/ int yyparse (arangodb::aql::Parser* parser) { /* Lookahead token kind. */ int yychar; /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Location data for the lookahead symbol. */ static YYLTYPE yyloc_default # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL = { 1, 1, 1, 1 } # endif ; YYLTYPE yylloc = yyloc_default; /* Number of syntax errors so far. */ int yynerrs = 0; yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus = 0; /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* Their size. */ YYPTRDIFF_T yystacksize = YYINITDEPTH; /* The state stack: array, bottom, top. */ yy_state_t yyssa[YYINITDEPTH]; yy_state_t *yyss = yyssa; yy_state_t *yyssp = yyss; /* The semantic value stack: array, bottom, top. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp = yyvs; /* The location stack: array, bottom, top. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp = yyls; int yyn; /* The return value of yyparse. */ int yyresult; /* Lookahead symbol kind. */ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; /* The locations where the error started and ended. */ YYLTYPE yyerror_range[3]; /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; /* Cause a token to be read. */ yylsp[0] = yylloc; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; /*--------------------------------------------------------------------. | yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE YYNOMEM; #else { /* Get the current used size of the three stacks, in elements. */ YYPTRDIFF_T yysize = yyssp - yyss + 1; # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF (*yyssp), &yyvs1, yysize * YYSIZEOF (*yyvsp), &yyls1, yysize * YYSIZEOF (*yylsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; yyls = yyls1; } # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yy_state_t *yyss1 = yyss; union yyalloc *yyptr = YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; YY_IGNORE_USELESS_CAST_BEGIN YYDPRINTF ((stderr, "Stack size increased to %ld\n", YY_CAST (long, yystacksize))); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (&yylval, &yylloc, scanner); } if (yychar <= T_END) { yychar = T_END; yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else if (yychar == YYerror) { /* The scanner already issued an error message, process directly to error recovery. But do not keep the error token as lookahead, it is too special and may lead us to an endless loop in error recovery. */ yychar = YYUNDEF; yytoken = YYSYMBOL_YYerror; yyerror_range[1] = yylloc; goto yyerrlab1; } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END *++yylsp = yylloc; /* Discard the shifted token. */ yychar = YYEMPTY; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); yyerror_range[1] = yyloc; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: /* optional_prune_variable: expression */ #line 667 "grammar.y" { AstNode* node = parser->ast()->createNodeArray(); node->addMember(parser->ast()->createNodeNop()); node->addMember((yyvsp[0].node)); (yyval.node) = node; } #line 2844 "grammar.cpp" break; case 3: /* optional_prune_variable: variable_name "assignment" expression */ #line 673 "grammar.y" { AstNode* node = parser->ast()->createNodeArray(); AstNode* variableNode = parser->ast()->createNodeLet((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node), true); node->addMember(variableNode); node->addMember((yyvsp[0].node)); (yyval.node) = node; } #line 2856 "grammar.cpp" break; case 4: /* with_collection: "identifier" */ #line 683 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 2864 "grammar.cpp" break; case 5: /* with_collection: bind_parameter_datasource_expected */ #line 686 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 2872 "grammar.cpp" break; case 6: /* with_collection_list: with_collection */ #line 692 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 2881 "grammar.cpp" break; case 7: /* with_collection_list: with_collection_list "," with_collection */ #line 696 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 2890 "grammar.cpp" break; case 8: /* with_collection_list: with_collection_list with_collection */ #line 700 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 2899 "grammar.cpp" break; case 9: /* optional_with: %empty */ #line 707 "grammar.y" { } #line 2906 "grammar.cpp" break; case 10: /* $@1: %empty */ #line 709 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 2915 "grammar.cpp" break; case 11: /* optional_with: "WITH keyword" $@1 with_collection_list */ #line 712 "grammar.y" { auto node = static_cast(parser->popStack()); auto const& resolver = parser->query().resolver(); auto withNode = parser->ast()->createNodeWithCollections(node, resolver); parser->ast()->addOperation(withNode); } #line 2926 "grammar.cpp" break; case 12: /* queryStart: optional_with query */ #line 721 "grammar.y" { } #line 2933 "grammar.cpp" break; case 13: /* query: optional_statement_block_statements final_statement */ #line 726 "grammar.y" { } #line 2940 "grammar.cpp" break; case 14: /* final_statement: return_statement */ #line 731 "grammar.y" { } #line 2947 "grammar.cpp" break; case 15: /* final_statement: remove_statement */ #line 733 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2955 "grammar.cpp" break; case 16: /* final_statement: insert_statement */ #line 736 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2963 "grammar.cpp" break; case 17: /* final_statement: update_statement */ #line 739 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2971 "grammar.cpp" break; case 18: /* final_statement: replace_statement */ #line 742 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2979 "grammar.cpp" break; case 19: /* final_statement: upsert_statement */ #line 745 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2987 "grammar.cpp" break; case 20: /* optional_statement_block_statements: %empty */ #line 751 "grammar.y" { } #line 2994 "grammar.cpp" break; case 21: /* optional_statement_block_statements: optional_statement_block_statements statement_block_statement */ #line 753 "grammar.y" { } #line 3001 "grammar.cpp" break; case 22: /* statement_block_statement: for_statement */ #line 758 "grammar.y" { } #line 3008 "grammar.cpp" break; case 23: /* statement_block_statement: let_statement */ #line 760 "grammar.y" { } #line 3015 "grammar.cpp" break; case 24: /* statement_block_statement: filter_statement */ #line 762 "grammar.y" { } #line 3022 "grammar.cpp" break; case 25: /* statement_block_statement: collect_statement */ #line 764 "grammar.y" { } #line 3029 "grammar.cpp" break; case 26: /* statement_block_statement: sort_statement */ #line 766 "grammar.y" { } #line 3036 "grammar.cpp" break; case 27: /* statement_block_statement: limit_statement */ #line 768 "grammar.y" { } #line 3043 "grammar.cpp" break; case 28: /* statement_block_statement: window_statement */ #line 770 "grammar.y" { } #line 3050 "grammar.cpp" break; case 29: /* statement_block_statement: remove_statement */ #line 772 "grammar.y" { } #line 3057 "grammar.cpp" break; case 30: /* statement_block_statement: insert_statement */ #line 774 "grammar.y" { } #line 3064 "grammar.cpp" break; case 31: /* statement_block_statement: update_statement */ #line 776 "grammar.y" { } #line 3071 "grammar.cpp" break; case 32: /* statement_block_statement: replace_statement */ #line 778 "grammar.y" { } #line 3078 "grammar.cpp" break; case 33: /* statement_block_statement: upsert_statement */ #line 780 "grammar.y" { } #line 3085 "grammar.cpp" break; case 34: /* more_output_variables: variable_name */ #line 785 "grammar.y" { auto wrapperNode = parser->ast()->createNodeArray(); parser->pushArray(wrapperNode); // This is guaranteed to be called on the first variable AstNode* node = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); parser->pushArrayElement(node); } #line 3097 "grammar.cpp" break; case 35: /* more_output_variables: more_output_variables "," variable_name */ #line 792 "grammar.y" { AstNode* node = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); parser->pushArrayElement(node); } #line 3106 "grammar.cpp" break; case 36: /* for_output_variables: more_output_variables */ #line 799 "grammar.y" { (yyval.node) = parser->popArray(); } #line 3114 "grammar.cpp" break; case 37: /* for_output_variables: array_destructuring */ #line 802 "grammar.y" { (yyval.node) = parser->ast()->createNodeDestructuring((yyvsp[0].node), /*isObject*/ false); } #line 3122 "grammar.cpp" break; case 38: /* for_output_variables: object_destructuring */ #line 805 "grammar.y" { (yyval.node) = parser->ast()->createNodeDestructuring((yyvsp[0].node), /*isObject*/ true); } #line 3130 "grammar.cpp" break; case 39: /* prune_and_options: %empty */ #line 811 "grammar.y" { auto node = static_cast(parser->peekStack()); // Prune node->addMember(parser->ast()->createNodeNop()); // Options node->addMember(parser->ast()->createNodeNop()); } #line 3142 "grammar.cpp" break; case 40: /* prune_and_options: "identifier" optional_prune_variable */ #line 818 "grammar.y" { std::string_view operation((yyvsp[-1].strval).value, (yyvsp[-1].strval).length); auto node = static_cast(parser->peekStack()); if (::caseInsensitiveEqual(operation, "PRUNE")) { /* Only Prune */ TRI_ASSERT((yyvsp[0].node) != nullptr); // Prune node->addMember((yyvsp[0].node)); // Options node->addMember(parser->ast()->createNodeNop()); } else if (::caseInsensitiveEqual(operation, "OPTIONS")) { auto const* optionsArgument = (yyvsp[0].node)->getMember(1); /* Only Options */ TRI_ASSERT(optionsArgument != nullptr); ::validateOptions(parser, optionsArgument, yylloc.first_line, yylloc.first_column); // Prune node->addMember(parser->ast()->createNodeNop()); // Options node->addMember(optionsArgument); } else { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'PRUNE' or 'OPTIONS'", operation, yylloc.first_line, yylloc.first_column); } } #line 3171 "grammar.cpp" break; case 41: /* prune_and_options: "identifier" optional_prune_variable "identifier" object */ #line 842 "grammar.y" { /* prune and options */ std::string_view operation((yyvsp[-3].strval).value, (yyvsp[-3].strval).length); auto node = static_cast(parser->peekStack()); if (!::caseInsensitiveEqual(operation, "PRUNE")) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'PRUNE'", operation, yylloc.first_line, yylloc.first_column); } TRI_ASSERT((yyvsp[-2].node) != nullptr); operation = {(yyvsp[-1].strval).value, (yyvsp[-1].strval).length}; if (!::caseInsensitiveEqual(operation, "OPTIONS")) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'OPTIONS'", operation, yylloc.first_line, yylloc.first_column); } TRI_ASSERT((yyvsp[0].node) != nullptr); ::validateOptions(parser, (yyvsp[0].node), yylloc.first_line, yylloc.first_column); // Prune node->addMember((yyvsp[-2].node)); // Options node->addMember((yyvsp[0].node)); } #line 3196 "grammar.cpp" break; case 42: /* traversal_graph_info: graph_direction_steps expression graph_subject */ #line 865 "grammar.y" { auto infoNode = parser->ast()->createNodeArray(); // Direction infoNode->addMember((yyvsp[-2].node)); // Source infoNode->addMember((yyvsp[-1].node)); // Graph infoNode->addMember((yyvsp[0].node)); (yyval.node) = infoNode; } #line 3211 "grammar.cpp" break; case 43: /* shortest_path_graph_info: graph_direction "SHORTEST_PATH keyword" expression "identifier" expression graph_subject options */ #line 878 "grammar.y" { (yyval.node) = ::buildShortestPathInfo(parser, (yyvsp[-3].strval).value, parser->ast()->createNodeDirection((yyvsp[-6].intval), 1), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node), yyloc); } #line 3219 "grammar.cpp" break; case 44: /* k_shortest_paths_graph_info: graph_direction "K_SHORTEST_PATHS keyword" expression "identifier" expression graph_subject options */ #line 884 "grammar.y" { (yyval.node) = ::buildShortestPathInfo(parser, (yyvsp[-3].strval).value, parser->ast()->createNodeDirection((yyvsp[-6].intval), 1), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node), yyloc); } #line 3227 "grammar.cpp" break; case 45: /* k_paths_graph_info: graph_direction_steps "K_PATHS keyword" expression "identifier" expression graph_subject options */ #line 890 "grammar.y" { (yyval.node) = ::buildShortestPathInfo(parser, (yyvsp[-3].strval).value, (yyvsp[-6].node), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node), yyloc); } #line 3235 "grammar.cpp" break; case 46: /* all_shortest_paths_graph_info: graph_direction "ALL_SHORTEST_PATHS keyword" expression "identifier" expression graph_subject options */ #line 896 "grammar.y" { auto nodeStart = parser->ast()->createNodeValueInt(0); auto nodeEnd = parser->ast()->createNodeValueInt(INT64_MAX-1); auto nodeRange = parser->ast()->createNodeRange(nodeStart, nodeEnd); (yyval.node) = ::buildShortestPathInfo(parser, (yyvsp[-3].strval).value, parser->ast()->createNodeDirection((yyvsp[-6].intval), nodeRange), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node), yyloc); } #line 3246 "grammar.cpp" break; case 47: /* $@2: %empty */ #line 905 "grammar.y" { AstNode* variablesNode = static_cast((yyvsp[-2].node)); ::validateForOutVariables(parser, variablesNode, 1, 1, /*allowDestructuring*/ true, "Collections and views FOR loops", yyloc); if (variablesNode->type == NODE_TYPE_ARRAY) { parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_FOR); // now create an out variable for the FOR statement // this prepares us to handle the optional SEARCH condition, which may // or may not refer to the FOR's variable AstNode* variableNameNode = variablesNode->getMemberUnchecked(0); TRI_ASSERT(variableNameNode->isStringValue()); AstNode* variableNode = parser->ast()->createNodeVariable(variableNameNode->getStringView(), true); parser->pushStack(variableNode); } else { TRI_ASSERT(variablesNode->type == NODE_TYPE_DESTRUCTURING); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_FOR); parser->pushStack(variablesNode); } // we are temporarily forcing all conditionals to be inlined, just for // evaluating a potential SEARCH condition, which must remain a single // condition parser->lazyConditions().pushForceInline(); } #line 3276 "grammar.cpp" break; case 48: /* for_statement: "FOR declaration" for_output_variables "IN keyword" expression $@2 for_options */ #line 929 "grammar.y" { parser->lazyConditions().popForceInline(); // now we can handle the optional SEARCH condition and OPTIONS. AstNode* variablesNode = static_cast(parser->popStack()); TRI_ASSERT(variablesNode != nullptr); if (variablesNode->type == NODE_TYPE_VARIABLE) { Variable* variable = static_cast(variablesNode->getData()); AstNode* node = nullptr; AstNode* search = nullptr; AstNode* options = nullptr; if ((yyvsp[0].node) != nullptr) { // we got a SEARCH and/or OPTIONS clause TRI_ASSERT((yyvsp[0].node)->type == NODE_TYPE_ARRAY); TRI_ASSERT((yyvsp[0].node)->numMembers() == 2); search = (yyvsp[0].node)->getMemberUnchecked(0); if (search->type == NODE_TYPE_NOP) { search = nullptr; } options = (yyvsp[0].node)->getMemberUnchecked(1); if (options->type == NODE_TYPE_NOP) { options = nullptr; } } if (search != nullptr) { // we got a SEARCH clause. this is always a view. node = parser->ast()->createNodeForView(variable, (yyvsp[-2].node), search, options); if ((yyvsp[-2].node)->type != NODE_TYPE_PARAMETER_DATASOURCE && (yyvsp[-2].node)->type != NODE_TYPE_VIEW && (yyvsp[-2].node)->type != NODE_TYPE_COLLECTION) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "SEARCH condition used on non-view", yylloc.first_line, yylloc.first_column); } } else { node = parser->ast()->createNodeFor(variable, (yyvsp[-2].node), options); } parser->ast()->addOperation(node); } else { TRI_ASSERT(variablesNode->type == NODE_TYPE_DESTRUCTURING); // create a temporary output variable std::string nextName = parser->ast()->variables()->nextName(); AstNode* variableNode = parser->ast()->createNodeVariable(nextName, false); Variable* variable = static_cast(variableNode->getData()); AstNode* search = nullptr; AstNode* options = nullptr; if ((yyvsp[0].node) != nullptr) { // we got a SEARCH and/or OPTIONS clause TRI_ASSERT((yyvsp[0].node)->type == NODE_TYPE_ARRAY); TRI_ASSERT((yyvsp[0].node)->numMembers() == 2); search = (yyvsp[0].node)->getMemberUnchecked(0); if (search->type == NODE_TYPE_NOP) { search = nullptr; } options = (yyvsp[0].node)->getMemberUnchecked(1); if (options->type == NODE_TYPE_NOP) { options = nullptr; } } if (search != nullptr) { // we got a SEARCH clause. this is disallowed with destructuring parser->registerParseError(TRI_ERROR_QUERY_PARSE, "SEARCH condition is incompatible with destructuring", yylloc.first_line, yylloc.first_column); } AstNode* node = parser->ast()->createNodeFor(variable, (yyvsp[-2].node), options); parser->ast()->addOperation(node); if (variablesNode->getBoolValue()) { // destructure object arangodb::containers::SmallVector paths; ::destructureObject(parser, nextName, paths, variablesNode->getMember(0)); } else { // destructure array arangodb::containers::SmallVector paths; ::destructureArray(parser, nextName, paths, variablesNode->getMember(0)); } } } #line 3369 "grammar.cpp" break; case 49: /* $@3: %empty */ #line 1017 "grammar.y" { // Traversal auto variableNamesNode = static_cast((yyvsp[-2].node)); TRI_ASSERT(variableNamesNode != nullptr); ::validateForOutVariables(parser, variableNamesNode, 1, 3, /*allowDestructuring*/ false, "Traversal", yyloc); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_FOR); auto variablesNode = ::transformOutputVariables(parser, variableNamesNode); auto graphInfoNode = static_cast((yyvsp[0].node)); TRI_ASSERT(graphInfoNode != nullptr); TRI_ASSERT(graphInfoNode->type == NODE_TYPE_ARRAY); // This stack push/pop magic is necessary to allow v, e, and p in the prune condition parser->pushStack(variablesNode); parser->pushStack(graphInfoNode); // we are temporarily forcing all conditionals to be inlined, just for // evaluating the PRUNE condition, which must remain a single condition parser->lazyConditions().pushForceInline(); } #line 3392 "grammar.cpp" break; case 50: /* for_statement: "FOR declaration" for_output_variables "IN keyword" traversal_graph_info $@3 prune_and_options */ #line 1034 "grammar.y" { parser->lazyConditions().popForceInline(); auto graphInfoNode = static_cast(parser->popStack()); auto variablesNode = static_cast(parser->popStack()); auto prune = graphInfoNode->getMember(3); TRI_ASSERT(prune != nullptr); if (prune->type == NODE_TYPE_ARRAY) { TRI_ASSERT(prune->numMembers() == 2); Ast::traverseReadOnly(prune->getMember(1), [&](AstNode const* node) { if (node->type == NODE_TYPE_REFERENCE && node->hasFlag(AstNodeFlagType::FLAG_SUBQUERY_REFERENCE)) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "PRUNE condition must not use a subquery", yylloc.first_line, yylloc.first_column); } }); graphInfoNode->changeMember(3, prune->getMember(1)); } auto node = parser->ast()->createNodeTraversal(variablesNode, graphInfoNode); parser->ast()->addOperation(node); if (prune->type == NODE_TYPE_ARRAY && prune->getMember(0)->type != NODE_TYPE_NOP) { auto pruneLetVariableName = prune->getMember(0); parser->ast()->addOperation(pruneLetVariableName); } } #line 3421 "grammar.cpp" break; case 51: /* for_statement: "FOR declaration" for_output_variables "IN keyword" shortest_path_graph_info */ #line 1058 "grammar.y" { // Shortest Path auto variableNamesNode = static_cast((yyvsp[-2].node)); ::validateForOutVariables(parser, variableNamesNode, 1, 2, /*allowDestructuring*/ false, "SHORTEST_PATH", yyloc); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_FOR); auto variablesNode = ::transformOutputVariables(parser, variableNamesNode); auto graphInfoNode = static_cast((yyvsp[0].node)); TRI_ASSERT(graphInfoNode != nullptr); TRI_ASSERT(graphInfoNode->type == NODE_TYPE_ARRAY); auto node = parser->ast()->createNodeShortestPath(variablesNode, graphInfoNode); parser->ast()->addOperation(node); } #line 3438 "grammar.cpp" break; case 52: /* for_statement: "FOR declaration" for_output_variables "IN keyword" k_shortest_paths_graph_info */ #line 1070 "grammar.y" { // K Shortest Paths auto variableNamesNode = static_cast((yyvsp[-2].node)); ::validateForOutVariables(parser, variableNamesNode, 1, 1, /*allowDestructuring*/ false, "K_SHORTEST_PATHS", yyloc); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_FOR); auto variablesNode = ::transformOutputVariables(parser, variableNamesNode); auto graphInfoNode = static_cast((yyvsp[0].node)); TRI_ASSERT(graphInfoNode != nullptr); TRI_ASSERT(graphInfoNode->type == NODE_TYPE_ARRAY); auto node = parser->ast()->createNodeEnumeratePaths(arangodb::graph::PathType::Type::KShortestPaths, variablesNode, graphInfoNode); parser->ast()->addOperation(node); } #line 3455 "grammar.cpp" break; case 53: /* for_statement: "FOR declaration" for_output_variables "IN keyword" k_paths_graph_info */ #line 1082 "grammar.y" { // K Paths auto variableNamesNode = static_cast((yyvsp[-2].node)); ::validateForOutVariables(parser, variableNamesNode, 1, 1, /*allowDestructuring*/ false, "K_PATHS", yyloc); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_FOR); auto variablesNode = ::transformOutputVariables(parser, variableNamesNode); auto graphInfoNode = static_cast((yyvsp[0].node)); TRI_ASSERT(graphInfoNode != nullptr); TRI_ASSERT(graphInfoNode->type == NODE_TYPE_ARRAY); auto node = parser->ast()->createNodeEnumeratePaths(arangodb::graph::PathType::Type::KPaths, variablesNode, graphInfoNode); parser->ast()->addOperation(node); } #line 3472 "grammar.cpp" break; case 54: /* for_statement: "FOR declaration" for_output_variables "IN keyword" all_shortest_paths_graph_info */ #line 1094 "grammar.y" { // All Shortest Paths auto variableNamesNode = static_cast((yyvsp[-2].node)); ::validateForOutVariables(parser, variableNamesNode, 1, 1, /*allowDestructuring*/ false, "ALL_SHORTEST_PATHS", yyloc); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_FOR); auto variablesNode = ::transformOutputVariables(parser, variableNamesNode); auto graphInfoNode = static_cast((yyvsp[0].node)); TRI_ASSERT(graphInfoNode != nullptr); TRI_ASSERT(graphInfoNode->type == NODE_TYPE_ARRAY); auto node = parser->ast()->createNodeEnumeratePaths(arangodb::graph::PathType::Type::AllShortestPaths, variablesNode, graphInfoNode); parser->ast()->addOperation(node); } #line 3489 "grammar.cpp" break; case 55: /* filter_statement: "FILTER declaration" expression */ #line 1109 "grammar.y" { // operand is a reference. can use it directly auto node = parser->ast()->createNodeFilter((yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3499 "grammar.cpp" break; case 56: /* let_statement: "LET declaration" let_list */ #line 1117 "grammar.y" { } #line 3506 "grammar.cpp" break; case 57: /* let_list: let_element */ #line 1122 "grammar.y" { } #line 3513 "grammar.cpp" break; case 58: /* let_list: let_list "," let_element */ #line 1124 "grammar.y" { } #line 3520 "grammar.cpp" break; case 59: /* let_element: variable_name "assignment" expression */ #line 1129 "grammar.y" { auto node = parser->ast()->createNodeLet((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node), true); parser->ast()->addOperation(node); } #line 3529 "grammar.cpp" break; case 60: /* let_element: array_destructuring "assignment" expression */ #line 1133 "grammar.y" { std::string nextName = parser->ast()->variables()->nextName(); auto node = parser->ast()->createNodeLet(nextName.c_str(), nextName.size(), (yyvsp[0].node), false); parser->ast()->addOperation(node); arangodb::containers::SmallVector paths; ::destructureArray(parser, nextName, paths, (yyvsp[-2].node)); } #line 3542 "grammar.cpp" break; case 61: /* let_element: object_destructuring "assignment" expression */ #line 1141 "grammar.y" { std::string nextName = parser->ast()->variables()->nextName(); auto node = parser->ast()->createNodeLet(nextName.c_str(), nextName.size(), (yyvsp[0].node), false); parser->ast()->addOperation(node); arangodb::containers::SmallVector paths; ::destructureObject(parser, nextName, paths, (yyvsp[-2].node)); } #line 3555 "grammar.cpp" break; case 62: /* $@4: %empty */ #line 1152 "grammar.y" { AstNode* node = parser->ast()->createNodeArray(); node->setIntValue(1); parser->pushStack(node); } #line 3565 "grammar.cpp" break; case 63: /* array_destructuring: "[" $@4 array_destructuring_element "]" */ #line 1156 "grammar.y" { (yyval.node) = static_cast(parser->popStack()); } #line 3573 "grammar.cpp" break; case 64: /* array_destructuring_element: %empty */ #line 1162 "grammar.y" { parser->pushArrayElement(parser->ast()->createNodeValueNull()); } #line 3581 "grammar.cpp" break; case 65: /* array_destructuring_element: variable_name */ #line 1165 "grammar.y" { parser->pushArrayElement(parser->ast()->createNodeVariable({(yyvsp[0].strval).value, (yyvsp[0].strval).length}, true)); } #line 3589 "grammar.cpp" break; case 66: /* array_destructuring_element: array_destructuring */ #line 1168 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 3597 "grammar.cpp" break; case 67: /* array_destructuring_element: object_destructuring */ #line 1171 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 3605 "grammar.cpp" break; case 68: /* array_destructuring_element: array_destructuring_element "," array_destructuring_element */ #line 1174 "grammar.y" { } #line 3612 "grammar.cpp" break; case 69: /* $@5: %empty */ #line 1179 "grammar.y" { AstNode* node = parser->ast()->createNodeArray(); node->setIntValue(2); parser->pushStack(node); } #line 3622 "grammar.cpp" break; case 70: /* object_destructuring: "{" $@5 object_destructuring_element "}" */ #line 1183 "grammar.y" { (yyval.node) = static_cast(parser->popStack()); } #line 3630 "grammar.cpp" break; case 71: /* object_destructuring_element: %empty */ #line 1189 "grammar.y" { parser->pushArrayElement(parser->ast()->createNodeValueNull()); parser->pushArrayElement(parser->ast()->createNodeValueNull()); } #line 3639 "grammar.cpp" break; case 72: /* object_destructuring_element: variable_name */ #line 1193 "grammar.y" { parser->pushArrayElement(parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length)); parser->pushArrayElement(parser->ast()->createNodeVariable({(yyvsp[0].strval).value, (yyvsp[0].strval).length}, true)); } #line 3648 "grammar.cpp" break; case 73: /* object_destructuring_element: variable_name ":" variable_name */ #line 1197 "grammar.y" { parser->pushArrayElement(parser->ast()->createNodeValueString((yyvsp[-2].strval).value, (yyvsp[-2].strval).length)); parser->pushArrayElement(parser->ast()->createNodeVariable({(yyvsp[0].strval).value, (yyvsp[0].strval).length}, true)); } #line 3657 "grammar.cpp" break; case 74: /* object_destructuring_element: variable_name ":" object_destructuring */ #line 1201 "grammar.y" { parser->pushArrayElement(parser->ast()->createNodeValueString((yyvsp[-2].strval).value, (yyvsp[-2].strval).length)); parser->pushArrayElement((yyvsp[0].node)); } #line 3666 "grammar.cpp" break; case 75: /* object_destructuring_element: variable_name ":" array_destructuring */ #line 1205 "grammar.y" { parser->pushArrayElement(parser->ast()->createNodeValueString((yyvsp[-2].strval).value, (yyvsp[-2].strval).length)); parser->pushArrayElement((yyvsp[0].node)); } #line 3675 "grammar.cpp" break; case 76: /* object_destructuring_element: object_destructuring_element "," object_destructuring_element */ #line 1209 "grammar.y" { } #line 3682 "grammar.cpp" break; case 77: /* count_into: "WITH keyword" "identifier" "INTO keyword" variable_name */ #line 1214 "grammar.y" { std::string_view operation((yyvsp[-2].strval).value, (yyvsp[-2].strval).length); if (!::caseInsensitiveEqual(operation, "COUNT")) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'COUNT'", operation, yylloc.first_line, yylloc.first_column); } (yyval.strval) = (yyvsp[0].strval); } #line 3695 "grammar.cpp" break; case 78: /* $@6: %empty */ #line 1225 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 3704 "grammar.cpp" break; case 79: /* collect_variable_list: "COLLECT declaration" $@6 collect_list */ #line 1228 "grammar.y" { auto list = static_cast(parser->popStack()); TRI_ASSERT(list != nullptr); (yyval.node) = list; } #line 3714 "grammar.cpp" break; case 80: /* collect_statement: "COLLECT declaration" count_into options */ #line 1236 "grammar.y" { /* COLLECT WITH COUNT INTO var OPTIONS ... */ auto scopes = parser->ast()->scopes(); ::startCollectScope(scopes); // in the AST this is transformed to COLLECT AGGREGATE var = COUNT() auto node = parser->ast()->createNodeCollectCount(parser->ast()->createNodeArray(), (yyvsp[-1].strval).value, (yyvsp[-1].strval).length, (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3729 "grammar.cpp" break; case 81: /* collect_statement: collect_variable_list count_into options */ #line 1246 "grammar.y" { /* COLLECT var = expr WITH COUNT INTO var OPTIONS ... */ auto scopes = parser->ast()->scopes(); if (::startCollectScope(scopes)) { VarSet variables{}; ::registerAssignVariables(parser, scopes, yylloc.first_line, yylloc.first_column, variables, (yyvsp[-2].node)); } // in the AST this is transformed to COLLECT var = expr AGGREGATE var = COUNT() auto node = parser->ast()->createNodeCollectCount((yyvsp[-2].node), (yyvsp[-1].strval).value, (yyvsp[-1].strval).length, (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3747 "grammar.cpp" break; case 82: /* collect_statement: "COLLECT declaration" aggregate collect_optional_into options */ #line 1259 "grammar.y" { /* AGGREGATE var = expr OPTIONS ... */ VarSet variablesIntroduced{}; auto scopes = parser->ast()->scopes(); if (::startCollectScope(scopes)) { ::registerAssignVariables(parser, scopes, yylloc.first_line, yylloc.first_column, variablesIntroduced, (yyvsp[-2].node)); } // validate aggregates if (!::validateAggregates(parser, (yyvsp[-2].node), yylloc.first_line, yylloc.first_column)) { YYABORT; } if ((yyvsp[-1].node) != nullptr && (yyvsp[-1].node)->type == NODE_TYPE_ARRAY) { ::checkCollectVariables(parser, "INTO", (yyvsp[-1].node)->getMember(1), yylloc.first_line, yylloc.first_column, variablesIntroduced); } AstNode const* into = ::getIntoVariable(parser, (yyvsp[-1].node)); AstNode const* intoExpression = ::getIntoExpression((yyvsp[-1].node)); auto node = parser->ast()->createNodeCollect(parser->ast()->createNodeArray(), (yyvsp[-2].node), into, intoExpression, nullptr, (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3776 "grammar.cpp" break; case 83: /* collect_statement: collect_variable_list aggregate collect_optional_into options */ #line 1283 "grammar.y" { /* COLLECT var = expr AGGREGATE var = expr OPTIONS ... */ VarSet variablesIntroduced{}; auto scopes = parser->ast()->scopes(); if (::startCollectScope(scopes)) { ::registerAssignVariables(parser, scopes, yylloc.first_line, yylloc.first_column, variablesIntroduced, (yyvsp[-3].node)); ::registerAssignVariables(parser, scopes, yylloc.first_line, yylloc.first_column, variablesIntroduced, (yyvsp[-2].node)); } if (!::validateAggregates(parser, (yyvsp[-2].node), yylloc.first_line, yylloc.first_column)) { YYABORT; } if ((yyvsp[-1].node) != nullptr && (yyvsp[-1].node)->type == NODE_TYPE_ARRAY) { ::checkCollectVariables(parser, "INTO", (yyvsp[-1].node)->getMember(1), yylloc.first_line, yylloc.first_column, variablesIntroduced); } // note all group variables VarSet groupVars{}; size_t n = (yyvsp[-3].node)->numMembers(); for (size_t i = 0; i < n; ++i) { auto member = (yyvsp[-3].node)->getMember(i); if (member != nullptr) { TRI_ASSERT(member->type == NODE_TYPE_ASSIGN); groupVars.emplace(static_cast(member->getMember(0)->getData())); } } // now validate if any aggregate refers to one of the group variables n = (yyvsp[-2].node)->numMembers(); for (size_t i = 0; i < n; ++i) { auto member = (yyvsp[-2].node)->getMember(i); if (member != nullptr) { TRI_ASSERT(member->type == NODE_TYPE_ASSIGN); VarSet variablesUsed{}; Ast::getReferencedVariables(member->getMember(1), variablesUsed); for (auto& it : groupVars) { if (variablesUsed.contains(it)) { parser->registerParseError(TRI_ERROR_QUERY_VARIABLE_NAME_UNKNOWN, "use of unknown variable '%s' in AGGREGATE expression", it->name, yylloc.first_line, yylloc.first_column); } } } } AstNode const* into = ::getIntoVariable(parser, (yyvsp[-1].node)); AstNode const* intoExpression = ::getIntoExpression((yyvsp[-1].node)); auto node = parser->ast()->createNodeCollect((yyvsp[-3].node), (yyvsp[-2].node), into, intoExpression, nullptr, (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3836 "grammar.cpp" break; case 84: /* collect_statement: collect_variable_list collect_optional_into options */ #line 1338 "grammar.y" { /* COLLECT var = expr INTO var OPTIONS ... */ VarSet variablesIntroduced{}; auto scopes = parser->ast()->scopes(); if (::startCollectScope(scopes)) { ::registerAssignVariables(parser, scopes, yylloc.first_line, yylloc.first_column, variablesIntroduced, (yyvsp[-2].node)); } if ((yyvsp[-1].node) != nullptr && (yyvsp[-1].node)->type == NODE_TYPE_ARRAY) { ::checkCollectVariables(parser, "INTO", (yyvsp[-1].node)->getMember(1), yylloc.first_line, yylloc.first_column, variablesIntroduced); } AstNode const* into = ::getIntoVariable(parser, (yyvsp[-1].node)); AstNode const* intoExpression = ::getIntoExpression((yyvsp[-1].node)); auto node = parser->ast()->createNodeCollect((yyvsp[-2].node), parser->ast()->createNodeArray(), into, intoExpression, nullptr, (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3860 "grammar.cpp" break; case 85: /* collect_statement: collect_variable_list collect_optional_into keep options */ #line 1357 "grammar.y" { /* COLLECT var = expr INTO var KEEP ... OPTIONS ... */ VarSet variablesIntroduced{}; auto scopes = parser->ast()->scopes(); if (::startCollectScope(scopes)) { ::registerAssignVariables(parser, scopes, yylloc.first_line, yylloc.first_column, variablesIntroduced, (yyvsp[-3].node)); } if ((yyvsp[-2].node) == nullptr && (yyvsp[-1].node) != nullptr) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "use of 'KEEP' without 'INTO'", yylloc.first_line, yylloc.first_column); } if ((yyvsp[-2].node) != nullptr && (yyvsp[-2].node)->type == NODE_TYPE_ARRAY) { ::checkCollectVariables(parser, "INTO", (yyvsp[-2].node)->getMember(1), yylloc.first_line, yylloc.first_column, variablesIntroduced); } if ((yyvsp[-1].node) != nullptr && (yyvsp[-1].node)->type == NODE_TYPE_ARRAY) { ::checkCollectVariables(parser, "KEEP", (yyvsp[-1].node), yylloc.first_line, yylloc.first_column, variablesIntroduced); } AstNode const* into = ::getIntoVariable(parser, (yyvsp[-2].node)); AstNode const* intoExpression = ::getIntoExpression((yyvsp[-2].node)); auto node = parser->ast()->createNodeCollect((yyvsp[-3].node), parser->ast()->createNodeArray(), into, intoExpression, (yyvsp[-1].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3893 "grammar.cpp" break; case 86: /* collect_list: collect_element */ #line 1388 "grammar.y" { } #line 3900 "grammar.cpp" break; case 87: /* collect_list: collect_list "," collect_element */ #line 1390 "grammar.y" { } #line 3907 "grammar.cpp" break; case 88: /* collect_element: variable_name "assignment" expression */ #line 1395 "grammar.y" { auto node = parser->ast()->createNodeAssign((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); parser->pushArrayElement(node); } #line 3916 "grammar.cpp" break; case 89: /* collect_optional_into: %empty */ #line 1402 "grammar.y" { (yyval.node) = nullptr; } #line 3924 "grammar.cpp" break; case 90: /* collect_optional_into: "INTO keyword" variable_name */ #line 1405 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 3932 "grammar.cpp" break; case 91: /* collect_optional_into: "INTO keyword" variable_name "assignment" expression */ #line 1408 "grammar.y" { auto node = parser->ast()->createNodeArray(); node->addMember(parser->ast()->createNodeValueString((yyvsp[-2].strval).value, (yyvsp[-2].strval).length)); node->addMember((yyvsp[0].node)); (yyval.node) = node; } #line 3943 "grammar.cpp" break; case 92: /* variable_list: variable_name */ #line 1417 "grammar.y" { std::string_view variableName((yyvsp[0].strval).value, (yyvsp[0].strval).length); if (!parser->ast()->scopes()->existsVariable(variableName)) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "use of unknown variable '%s' for KEEP", variableName, yylloc.first_line, yylloc.first_column); } auto node = parser->ast()->createNodeReference(variableName); TRI_ASSERT(node != nullptr); // indicate the this node is a reference to the variable name, not the variable value node->setFlag(FLAG_KEEP_VARIABLENAME); parser->pushArrayElement(node); } #line 3961 "grammar.cpp" break; case 93: /* variable_list: variable_list "," variable_name */ #line 1430 "grammar.y" { std::string_view variableName((yyvsp[0].strval).value, (yyvsp[0].strval).length); if (!parser->ast()->scopes()->existsVariable(variableName)) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "use of unknown variable '%s' for KEEP", variableName, yylloc.first_line, yylloc.first_column); } auto node = parser->ast()->createNodeReference(variableName); TRI_ASSERT(node != nullptr); // indicate the this node is a reference to the variable name, not the variable value node->setFlag(FLAG_KEEP_VARIABLENAME); parser->pushArrayElement(node); } #line 3979 "grammar.cpp" break; case 94: /* $@7: %empty */ #line 1446 "grammar.y" { std::string_view operation((yyvsp[0].strval).value, (yyvsp[0].strval).length); if (!::caseInsensitiveEqual(operation, "KEEP")) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'KEEP'", operation, yylloc.first_line, yylloc.first_column); } auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 3993 "grammar.cpp" break; case 95: /* keep: "identifier" $@7 variable_list */ #line 1454 "grammar.y" { auto list = static_cast(parser->popStack()); (yyval.node) = list; } #line 4002 "grammar.cpp" break; case 96: /* $@8: %empty */ #line 1461 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 4011 "grammar.cpp" break; case 97: /* aggregate: "AGGREGATE keyword" $@8 aggregate_list */ #line 1464 "grammar.y" { auto list = static_cast(parser->popStack()); (yyval.node) = list; } #line 4020 "grammar.cpp" break; case 98: /* aggregate_list: aggregate_element */ #line 1471 "grammar.y" { } #line 4027 "grammar.cpp" break; case 99: /* aggregate_list: aggregate_list "," aggregate_element */ #line 1473 "grammar.y" { } #line 4034 "grammar.cpp" break; case 100: /* aggregate_element: variable_name "assignment" aggregate_function_call */ #line 1478 "grammar.y" { auto node = parser->ast()->createNodeAssign((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); parser->pushArrayElement(node); } #line 4043 "grammar.cpp" break; case 101: /* $@9: %empty */ #line 1485 "grammar.y" { parser->pushStack((yyvsp[-1].strval).value); auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 4053 "grammar.cpp" break; case 102: /* aggregate_function_call: function_name "(" $@9 optional_function_call_arguments ")" */ #line 1489 "grammar.y" { auto list = static_cast(parser->popStack()); // this works because the function name here is always NUL-terminated (yyval.node) = parser->ast()->createNodeAggregateFunctionCall(static_cast(parser->popStack()), list); } #line 4063 "grammar.cpp" break; case 103: /* $@10: %empty */ #line 1497 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 4072 "grammar.cpp" break; case 104: /* sort_statement: "SORT declaration" $@10 sort_list */ #line 1500 "grammar.y" { auto list = static_cast(parser->popStack()); auto node = parser->ast()->createNodeSort(list); parser->ast()->addOperation(node); } #line 4082 "grammar.cpp" break; case 105: /* sort_list: sort_element */ #line 1508 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 4090 "grammar.cpp" break; case 106: /* sort_list: sort_list "," sort_element */ #line 1511 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 4098 "grammar.cpp" break; case 107: /* sort_element: expression sort_direction */ #line 1517 "grammar.y" { (yyval.node) = parser->ast()->createNodeSortElement((yyvsp[-1].node), (yyvsp[0].node)); } #line 4106 "grammar.cpp" break; case 108: /* sort_direction: %empty */ #line 1523 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(true); } #line 4114 "grammar.cpp" break; case 109: /* sort_direction: "ASC keyword" */ #line 1526 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(true); } #line 4122 "grammar.cpp" break; case 110: /* sort_direction: "DESC keyword" */ #line 1529 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(false); } #line 4130 "grammar.cpp" break; case 111: /* sort_direction: simple_value */ #line 1532 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4138 "grammar.cpp" break; case 112: /* limit_statement: "LIMIT declaration" expression */ #line 1538 "grammar.y" { auto offset = parser->ast()->createNodeValueInt(0); auto node = parser->ast()->createNodeLimit(offset, (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4148 "grammar.cpp" break; case 113: /* limit_statement: "LIMIT declaration" expression "," expression */ #line 1543 "grammar.y" { auto node = parser->ast()->createNodeLimit((yyvsp[-2].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4157 "grammar.cpp" break; case 114: /* window_statement: "WINDOW declaration" object aggregate */ #line 1550 "grammar.y" { /* WINDOW {preceding:2, following:2} AGGREGATE x = AVG(x) */ // validate aggregates if (!::validateAggregates(parser, (yyvsp[0].node), yylloc.first_line, yylloc.first_column)) { YYABORT; } if (!::validateWindowSpec(parser, (yyvsp[-1].node), yylloc.first_line, yylloc.first_column)) { YYABORT; } auto node = parser->ast()->createNodeWindow(/*spec*/(yyvsp[-1].node), /*range*/nullptr, /*aggrs*/(yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4177 "grammar.cpp" break; case 115: /* window_statement: "WINDOW declaration" expression "WITH keyword" object aggregate */ #line 1565 "grammar.y" { /* WINDOW rangeVar WITH {preceding:"1d", following:"1d"} AGGREGATE x = AVG(x) */ // validate aggregates if (!::validateAggregates(parser, (yyvsp[0].node), yylloc.first_line, yylloc.first_column)) { YYABORT; } if (!::validateWindowSpec(parser, (yyvsp[-1].node), yylloc.first_line, yylloc.first_column)) { YYABORT; } auto node = parser->ast()->createNodeWindow(/*spec*/(yyvsp[-1].node), /*range*/(yyvsp[-3].node), /*aggrs*/(yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4197 "grammar.cpp" break; case 116: /* return_statement: "RETURN declaration" distinct_expression */ #line 1583 "grammar.y" { auto node = parser->ast()->createNodeReturn((yyvsp[0].node)); parser->ast()->addOperation(node); parser->ast()->scopes()->endNested(); } #line 4207 "grammar.cpp" break; case 117: /* in_or_into_collection: "IN keyword" in_or_into_collection_name */ #line 1591 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4215 "grammar.cpp" break; case 118: /* in_or_into_collection: "INTO keyword" in_or_into_collection_name */ #line 1594 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4223 "grammar.cpp" break; case 119: /* remove_statement: "REMOVE command" expression in_or_into_collection options */ #line 1600 "grammar.y" { if (!parser->configureWriteQuery((yyvsp[-1].node), (yyvsp[0].node))) { YYABORT; } auto node = parser->ast()->createNodeRemove((yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4235 "grammar.cpp" break; case 120: /* insert_statement: "INSERT command" expression in_or_into_collection options */ #line 1610 "grammar.y" { if (!parser->configureWriteQuery((yyvsp[-1].node), (yyvsp[0].node))) { YYABORT; } auto node = parser->ast()->createNodeInsert((yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4247 "grammar.cpp" break; case 121: /* update_parameters: expression in_or_into_collection options */ #line 1620 "grammar.y" { if (!parser->configureWriteQuery((yyvsp[-1].node), (yyvsp[0].node))) { YYABORT; } AstNode* node = parser->ast()->createNodeUpdate(nullptr, (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4260 "grammar.cpp" break; case 122: /* update_parameters: expression "WITH keyword" expression in_or_into_collection options */ #line 1628 "grammar.y" { if (!parser->configureWriteQuery((yyvsp[-1].node), (yyvsp[0].node))) { YYABORT; } AstNode* node = parser->ast()->createNodeUpdate((yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4273 "grammar.cpp" break; case 123: /* update_statement: "UPDATE command" update_parameters */ #line 1639 "grammar.y" { } #line 4280 "grammar.cpp" break; case 124: /* replace_parameters: expression in_or_into_collection options */ #line 1644 "grammar.y" { if (!parser->configureWriteQuery((yyvsp[-1].node), (yyvsp[0].node))) { YYABORT; } AstNode* node = parser->ast()->createNodeReplace(nullptr, (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4293 "grammar.cpp" break; case 125: /* replace_parameters: expression "WITH keyword" expression in_or_into_collection options */ #line 1652 "grammar.y" { if (!parser->configureWriteQuery((yyvsp[-1].node), (yyvsp[0].node))) { YYABORT; } AstNode* node = parser->ast()->createNodeReplace((yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 4306 "grammar.cpp" break; case 126: /* replace_statement: "REPLACE command" replace_parameters */ #line 1663 "grammar.y" { } #line 4313 "grammar.cpp" break; case 127: /* update_or_replace: "UPDATE command" */ #line 1668 "grammar.y" { (yyval.intval) = static_cast(NODE_TYPE_UPDATE); } #line 4321 "grammar.cpp" break; case 128: /* update_or_replace: "REPLACE command" */ #line 1671 "grammar.y" { (yyval.intval) = static_cast(NODE_TYPE_REPLACE); } #line 4329 "grammar.cpp" break; case 129: /* upsert_input: object */ #line 1677 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4337 "grammar.cpp" break; case 130: /* upsert_input: bind_parameter */ #line 1680 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4345 "grammar.cpp" break; case 131: /* $@11: %empty */ #line 1686 "grammar.y" { // reserve a variable named "$OLD", we might need it in the update expression // and in a later return thing AstNode* variableNode = parser->ast()->createNodeVariable(Variable::NAME_OLD, false); parser->pushStack(variableNode); auto scopes = parser->ast()->scopes(); scopes->start(arangodb::aql::AQL_SCOPE_SUBQUERY); parser->ast()->startSubQuery(); scopes->start(arangodb::aql::AQL_SCOPE_FOR); auto forNode = parser->ast()->createNodeForUpsert(Variable::NAME_CURRENT.data(), Variable::NAME_CURRENT.size(), parser->ast()->createNodeArray(), false); scopes->stackCurrentVariable(scopes->getVariable(Variable::NAME_CURRENT)); parser->ast()->addOperation(forNode); parser->pushStack(forNode); } #line 4367 "grammar.cpp" break; case 132: /* $@12: %empty */ #line 1702 "grammar.y" { AstNode* forNode = static_cast(parser->popStack()); AstNode* variableNode = static_cast(parser->popStack()); auto filterNode = parser->ast()->createNodeFilter((yyvsp[0].node)); parser->ast()->addOperation(filterNode); auto scopes = parser->ast()->scopes(); scopes->unstackCurrentVariable(); auto offsetValue = parser->ast()->createNodeValueInt(0); auto limitValue = parser->ast()->createNodeValueInt(1); auto limitNode = parser->ast()->createNodeLimit(offsetValue, limitValue); parser->ast()->addOperation(limitNode); auto refNode = parser->ast()->createNodeReference(static_cast(forNode->getMember(0)->getData())); auto returnNode = parser->ast()->createNodeReturn(refNode); parser->ast()->addOperation(returnNode); scopes->endNested(); AstNode* subqueryNode = parser->ast()->endSubQuery(); scopes->endCurrent(); std::string const subqueryName = parser->ast()->variables()->nextName(); auto subQuery = parser->ast()->createNodeLet(subqueryName.data(), subqueryName.size(), subqueryNode, false); parser->ast()->addOperation(subQuery); auto index = parser->ast()->createNodeValueInt(0); auto firstDoc = parser->ast()->createNodeLet(variableNode, parser->ast()->createNodeIndexedAccess(parser->ast()->createNodeReference(subqueryName), index)); parser->ast()->addOperation(firstDoc); parser->pushStack(forNode); } #line 4404 "grammar.cpp" break; case 133: /* upsert_statement: "UPSERT command" "FILTER declaration" $@11 expression $@12 "INSERT command" expression update_or_replace expression in_or_into_collection options */ #line 1733 "grammar.y" { AstNode* forNode = static_cast(parser->popStack()); forNode->changeMember(1, (yyvsp[-1].node)); bool canReadOwnWrites = true; auto* forOptionsNode = parser->ast()->createNodeObject(); auto* upsertOptionsNode = parser->ast()->createNodeObject(); handleUpsertOptions((yyvsp[0].node), forNode, forOptionsNode, upsertOptionsNode, canReadOwnWrites); TRI_ASSERT(forNode->hasFlag(AstNodeFlagType::FLAG_READ_OWN_WRITES) || !canReadOwnWrites); if (!parser->configureWriteQuery((yyvsp[-1].node), (yyvsp[0].node))) { YYABORT; } auto node = parser->ast()->createNodeUpsert(static_cast((yyvsp[-3].intval)), parser->ast()->createNodeReference(Variable::NAME_OLD), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), upsertOptionsNode, canReadOwnWrites); parser->ast()->addOperation(node); } #line 4425 "grammar.cpp" break; case 134: /* $@13: %empty */ #line 1749 "grammar.y" { // reserve a variable named "$OLD", we might need it in the update expression // and in a later return thing AstNode* variableNode = parser->ast()->createNodeVariable(Variable::NAME_OLD, false); auto scopes = parser->ast()->scopes(); scopes->start(arangodb::aql::AQL_SCOPE_SUBQUERY); parser->ast()->startSubQuery(); scopes->start(arangodb::aql::AQL_SCOPE_FOR); std::string const variableName = parser->ast()->variables()->nextName(); auto forNode = parser->ast()->createNodeForUpsert(variableName.c_str(), variableName.size(), parser->ast()->createNodeArray(), false); parser->ast()->addOperation(forNode); auto filterNode = parser->ast()->createNodeUpsertFilter(parser->ast()->createNodeReference(variableName), (yyvsp[0].node)); parser->ast()->addOperation(filterNode); auto offsetValue = parser->ast()->createNodeValueInt(0); auto limitValue = parser->ast()->createNodeValueInt(1); auto limitNode = parser->ast()->createNodeLimit(offsetValue, limitValue); parser->ast()->addOperation(limitNode); auto refNode = parser->ast()->createNodeReference(variableName); auto returnNode = parser->ast()->createNodeReturn(refNode); parser->ast()->addOperation(returnNode); scopes->endNested(); AstNode* subqueryNode = parser->ast()->endSubQuery(); scopes->endCurrent(); std::string const subqueryName = parser->ast()->variables()->nextName(); auto subQuery = parser->ast()->createNodeLet(subqueryName.c_str(), subqueryName.size(), subqueryNode, false); parser->ast()->addOperation(subQuery); auto index = parser->ast()->createNodeValueInt(0); auto firstDoc = parser->ast()->createNodeLet(variableNode, parser->ast()->createNodeIndexedAccess(parser->ast()->createNodeReference(subqueryName), index)); parser->ast()->addOperation(firstDoc); parser->pushStack(forNode); } #line 4471 "grammar.cpp" break; case 135: /* upsert_statement: "UPSERT command" upsert_input $@13 "INSERT command" expression update_or_replace expression in_or_into_collection options */ #line 1789 "grammar.y" { AstNode* forNode = static_cast(parser->popStack()); forNode->changeMember(1, (yyvsp[-1].node)); bool canReadOwnWrites = true; auto* forOptionsNode = parser->ast()->createNodeObject(); auto* upsertOptionsNode = parser->ast()->createNodeObject(); handleUpsertOptions((yyvsp[0].node), forNode, forOptionsNode, upsertOptionsNode, canReadOwnWrites); TRI_ASSERT(forNode->hasFlag(AstNodeFlagType::FLAG_READ_OWN_WRITES) || !canReadOwnWrites); if (!parser->configureWriteQuery((yyvsp[-1].node), (yyvsp[0].node))) { YYABORT; } auto node = parser->ast()->createNodeUpsert(static_cast((yyvsp[-3].intval)), parser->ast()->createNodeReference(Variable::NAME_OLD), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), upsertOptionsNode, canReadOwnWrites); parser->ast()->addOperation(node); } #line 4492 "grammar.cpp" break; case 136: /* quantifier: "all modifier" */ #line 1808 "grammar.y" { (yyval.node) = parser->ast()->createNodeQuantifier(Quantifier::Type::kAll); } #line 4500 "grammar.cpp" break; case 137: /* quantifier: "any modifier" */ #line 1811 "grammar.y" { (yyval.node) = parser->ast()->createNodeQuantifier(Quantifier::Type::kAny); } #line 4508 "grammar.cpp" break; case 138: /* quantifier: "none modifier" */ #line 1814 "grammar.y" { (yyval.node) = parser->ast()->createNodeQuantifier(Quantifier::Type::kNone); } #line 4516 "grammar.cpp" break; case 139: /* $@14: %empty */ #line 1820 "grammar.y" { auto const scopeType = parser->ast()->scopes()->type(); if (scopeType == AQL_SCOPE_MAIN || scopeType == AQL_SCOPE_SUBQUERY) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "cannot use DISTINCT modifier on top-level query element", yylloc.first_line, yylloc.first_column); } } #line 4529 "grammar.cpp" break; case 140: /* distinct_expression: "DISTINCT modifier" $@14 expression */ #line 1827 "grammar.y" { (yyval.node) = parser->ast()->createNodeDistinct((yyvsp[0].node)); } #line 4537 "grammar.cpp" break; case 141: /* distinct_expression: expression */ #line 1830 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4545 "grammar.cpp" break; case 142: /* expression: operator_unary */ #line 1836 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4553 "grammar.cpp" break; case 143: /* expression: operator_binary */ #line 1839 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4561 "grammar.cpp" break; case 144: /* expression: operator_ternary */ #line 1842 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4569 "grammar.cpp" break; case 145: /* expression: value_literal */ #line 1845 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4577 "grammar.cpp" break; case 146: /* expression: reference */ #line 1848 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4585 "grammar.cpp" break; case 147: /* expression: expression ".." expression */ #line 1851 "grammar.y" { (yyval.node) = parser->ast()->createNodeRange((yyvsp[-2].node), (yyvsp[0].node)); } #line 4593 "grammar.cpp" break; case 148: /* function_name: "identifier" */ #line 1857 "grammar.y" { (yyval.strval) = (yyvsp[0].strval); } #line 4601 "grammar.cpp" break; case 149: /* function_name: function_name "::" "identifier" */ #line 1860 "grammar.y" { std::string temp((yyvsp[-2].strval).value, (yyvsp[-2].strval).length); temp.append("::"); temp.append((yyvsp[0].strval).value, (yyvsp[0].strval).length); auto p = parser->ast()->resources().registerString(temp); TRI_ASSERT(p != nullptr); (yyval.strval).value = p; (yyval.strval).length = temp.size(); } #line 4616 "grammar.cpp" break; case 150: /* $@15: %empty */ #line 1873 "grammar.y" { auto args = parser->ast()->createNodeArray(); parser->pushStack(args); } #line 4625 "grammar.cpp" break; case 151: /* function_call: function_name "(" $@15 optional_function_call_arguments ")" */ #line 1876 "grammar.y" { auto args = static_cast(parser->popStack()); (yyval.node) = parser->ast()->createNodeFunctionCall(/*function name*/ {(yyvsp[-4].strval).value, (yyvsp[-4].strval).length}, args, false); } #line 4634 "grammar.cpp" break; case 152: /* $@16: %empty */ #line 1880 "grammar.y" { auto args = parser->ast()->createNodeArray(); parser->pushStack(args); } #line 4643 "grammar.cpp" break; case 153: /* function_call: "like operator" "(" $@16 optional_function_call_arguments ")" */ #line 1883 "grammar.y" { auto args = static_cast(parser->popStack()); (yyval.node) = parser->ast()->createNodeFunctionCall("LIKE", args, false); } #line 4652 "grammar.cpp" break; case 154: /* operator_unary: "+ operator" expression */ #line 1890 "grammar.y" { (yyval.node) = parser->ast()->optimizeUnaryOperatorArithmetic(parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_PLUS, (yyvsp[0].node))); } #line 4660 "grammar.cpp" break; case 155: /* operator_unary: "- operator" expression */ #line 1893 "grammar.y" { (yyval.node) = parser->ast()->optimizeUnaryOperatorArithmetic(parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_MINUS, (yyvsp[0].node))); } #line 4668 "grammar.cpp" break; case 156: /* operator_unary: "not operator" expression */ #line 1896 "grammar.y" { (yyval.node) = parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_NOT, (yyvsp[0].node)); } #line 4676 "grammar.cpp" break; case 157: /* $@17: %empty */ #line 1902 "grammar.y" { parser->lazyConditions().push((yyvsp[-1].node), /*negated*/ true); } #line 4684 "grammar.cpp" break; case 158: /* operator_binary: expression "or operator" $@17 expression */ #line 1904 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_OR, previous.condition, (yyvsp[0].node)); } #line 4693 "grammar.cpp" break; case 159: /* $@18: %empty */ #line 1908 "grammar.y" { parser->lazyConditions().push((yyvsp[-1].node), /*negated*/ false); } #line 4701 "grammar.cpp" break; case 160: /* operator_binary: expression "and operator" $@18 expression */ #line 1910 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_AND, previous.condition, (yyvsp[0].node)); } #line 4710 "grammar.cpp" break; case 161: /* operator_binary: expression "+ operator" expression */ #line 1914 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_PLUS, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4718 "grammar.cpp" break; case 162: /* operator_binary: expression "- operator" expression */ #line 1917 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_MINUS, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4726 "grammar.cpp" break; case 163: /* operator_binary: expression "* operator" expression */ #line 1920 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_TIMES, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4734 "grammar.cpp" break; case 164: /* operator_binary: expression "/ operator" expression */ #line 1923 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_DIV, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4742 "grammar.cpp" break; case 165: /* operator_binary: expression "% operator" expression */ #line 1926 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_MOD, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4750 "grammar.cpp" break; case 166: /* operator_binary: expression "== operator" expression */ #line 1929 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_EQ, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4758 "grammar.cpp" break; case 167: /* operator_binary: expression "!= operator" expression */ #line 1932 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_NE, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4766 "grammar.cpp" break; case 168: /* operator_binary: expression "< operator" expression */ #line 1935 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_LT, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4774 "grammar.cpp" break; case 169: /* operator_binary: expression "> operator" expression */ #line 1938 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_GT, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4782 "grammar.cpp" break; case 170: /* operator_binary: expression "<= operator" expression */ #line 1941 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_LE, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4790 "grammar.cpp" break; case 171: /* operator_binary: expression ">= operator" expression */ #line 1944 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_GE, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4798 "grammar.cpp" break; case 172: /* operator_binary: expression "IN keyword" expression */ #line 1947 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_IN, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4806 "grammar.cpp" break; case 173: /* operator_binary: expression "not in operator" expression */ #line 1950 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_NIN, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4814 "grammar.cpp" break; case 174: /* operator_binary: expression "not operator" "like operator" expression */ #line 1953 "grammar.y" { AstNode* arguments = parser->ast()->createNodeArray(2); arguments->addMember((yyvsp[-3].node)); arguments->addMember((yyvsp[0].node)); AstNode* expression = parser->ast()->createNodeFunctionCall("LIKE", arguments, false); (yyval.node) = parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_NOT, expression); } #line 4826 "grammar.cpp" break; case 175: /* operator_binary: expression "not operator" "~= operator" expression */ #line 1960 "grammar.y" { AstNode* arguments = parser->ast()->createNodeArray(2); arguments->addMember((yyvsp[-3].node)); arguments->addMember((yyvsp[0].node)); AstNode* expression = parser->ast()->createNodeFunctionCall("REGEX_TEST", arguments, false); (yyval.node) = parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_NOT, expression); } #line 4838 "grammar.cpp" break; case 176: /* operator_binary: expression "not operator" "~! operator" expression */ #line 1967 "grammar.y" { AstNode* arguments = parser->ast()->createNodeArray(2); arguments->addMember((yyvsp[-3].node)); arguments->addMember((yyvsp[0].node)); (yyval.node) = parser->ast()->createNodeFunctionCall("REGEX_TEST", arguments, false); } #line 4849 "grammar.cpp" break; case 177: /* operator_binary: expression "like operator" expression */ #line 1973 "grammar.y" { AstNode* arguments = parser->ast()->createNodeArray(2); arguments->addMember((yyvsp[-2].node)); arguments->addMember((yyvsp[0].node)); (yyval.node) = parser->ast()->createNodeFunctionCall("LIKE", arguments, false); } #line 4860 "grammar.cpp" break; case 178: /* operator_binary: expression "~= operator" expression */ #line 1979 "grammar.y" { AstNode* arguments = parser->ast()->createNodeArray(2); arguments->addMember((yyvsp[-2].node)); arguments->addMember((yyvsp[0].node)); (yyval.node) = parser->ast()->createNodeFunctionCall("REGEX_TEST", arguments, false); } #line 4871 "grammar.cpp" break; case 179: /* operator_binary: expression "~! operator" expression */ #line 1985 "grammar.y" { AstNode* arguments = parser->ast()->createNodeArray(2); arguments->addMember((yyvsp[-2].node)); arguments->addMember((yyvsp[0].node)); AstNode* node = parser->ast()->createNodeFunctionCall("REGEX_TEST", arguments, false); (yyval.node) = parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_NOT, node); } #line 4883 "grammar.cpp" break; case 180: /* operator_binary: expression quantifier "== operator" expression */ #line 1992 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_EQ, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4891 "grammar.cpp" break; case 181: /* operator_binary: expression quantifier "!= operator" expression */ #line 1995 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_NE, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4899 "grammar.cpp" break; case 182: /* operator_binary: expression quantifier "< operator" expression */ #line 1998 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_LT, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4907 "grammar.cpp" break; case 183: /* operator_binary: expression quantifier "> operator" expression */ #line 2001 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_GT, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4915 "grammar.cpp" break; case 184: /* operator_binary: expression quantifier "<= operator" expression */ #line 2004 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_LE, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4923 "grammar.cpp" break; case 185: /* operator_binary: expression quantifier ">= operator" expression */ #line 2007 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_GE, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4931 "grammar.cpp" break; case 186: /* operator_binary: expression quantifier "IN keyword" expression */ #line 2010 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_IN, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4939 "grammar.cpp" break; case 187: /* operator_binary: expression quantifier "not in operator" expression */ #line 2013 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_NIN, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4947 "grammar.cpp" break; case 188: /* operator_binary: expression "at least modifier" "(" expression ")" "== operator" expression */ #line 2016 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_EQ, (yyvsp[-6].node), (yyvsp[0].node), quantifier); } #line 4956 "grammar.cpp" break; case 189: /* operator_binary: expression "at least modifier" "(" expression ")" "!= operator" expression */ #line 2020 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_NE, (yyvsp[-6].node), (yyvsp[0].node), quantifier); } #line 4965 "grammar.cpp" break; case 190: /* operator_binary: expression "at least modifier" "(" expression ")" "< operator" expression */ #line 2024 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_LT, (yyvsp[-6].node), (yyvsp[0].node), quantifier); } #line 4974 "grammar.cpp" break; case 191: /* operator_binary: expression "at least modifier" "(" expression ")" "> operator" expression */ #line 2028 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_GT, (yyvsp[-6].node), (yyvsp[0].node), quantifier); } #line 4983 "grammar.cpp" break; case 192: /* operator_binary: expression "at least modifier" "(" expression ")" "<= operator" expression */ #line 2032 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_LE, (yyvsp[-6].node), (yyvsp[0].node), quantifier); } #line 4992 "grammar.cpp" break; case 193: /* operator_binary: expression "at least modifier" "(" expression ")" ">= operator" expression */ #line 2036 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_GE, (yyvsp[-6].node), (yyvsp[0].node), quantifier); } #line 5001 "grammar.cpp" break; case 194: /* operator_binary: expression "at least modifier" "(" expression ")" "IN keyword" expression */ #line 2040 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_IN, (yyvsp[-6].node), (yyvsp[0].node), quantifier); } #line 5010 "grammar.cpp" break; case 195: /* operator_binary: expression "at least modifier" "(" expression ")" "not in operator" expression */ #line 2044 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_NIN, (yyvsp[-6].node), (yyvsp[0].node), quantifier); } #line 5019 "grammar.cpp" break; case 196: /* $@19: %empty */ #line 2051 "grammar.y" { // ternary operator: // condition ? true part : false part // // check if we must inline the condition of the ternary operator. // this is the case if we must execute a single expression, e.g. in computed values. // for normal AQL queries we normally want the condition of the ternary operator // to be placed in its own LET node, so we can move it around. // if the condition is not inlined, the condition expression is assigned to a // temporary variable using a LET statement. insertConditional() also pushes // this LET variable onto the stack of conditions to honor in any subqueries that // are started inside the ternary operator. // for example, consider the following query: // RETURN IS_ARRAY(values) ? (FOR v IN values ...) : (FOR i IN 1..10 ...) // if the condition is not forced to be inlined, the generated AST for the query // will look like this: // LET tmp1 = IS_ARRAY(values) // LET tmp2 = ( // FILTER tmp1 // FOR v IN values // ... // ) // LET tmp3 = ( // FILTER !tmp1 // FOR i IN 1..10 // ... // ) // RETURN tmp1 ? tmp2 : tmp3 // this ensures that we execute the ternary's condition expression only once. // this is important because the expression may be expensive or even have side // effects. // additionally, we only execute the true part of the ternary operator if the // condition is truthy, and the false part of the ternary operator only if the // condition is falsy. parser->lazyConditions().push((yyvsp[-1].node), /*negated*/ false); } #line 5061 "grammar.cpp" break; case 197: /* $@20: %empty */ #line 2087 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); // negate the condition and push the negated version onto the stack parser->lazyConditions().push(previous.condition, /*negated*/ true); } #line 5071 "grammar.cpp" break; case 198: /* operator_ternary: expression "?" $@19 expression ":" $@20 expression */ #line 2091 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); (yyval.node) = parser->ast()->createNodeTernaryOperator(previous.condition, (yyvsp[-3].node), (yyvsp[0].node)); } #line 5080 "grammar.cpp" break; case 199: /* $@21: %empty */ #line 2095 "grammar.y" { // shortcut ternary operator: // condition ? : false part // // if the condition is not inlined, the condition expression is assigned to a // temporary variable using a LET statement. insertConditional() also pushes // this LET variable onto the stack of conditions to honor in any subqueries that // are started inside the ternary operator. // for example, consider the following query: // RETURN !IS_ARRAY(values) ?: (FOR v IN values ...) // if the condition is not forced to be inlined, the generated AST for the query // will look like this: // LET tmp1 = !IS_ARRAY(values) // LET tmp2 = ( // FILTER !tmp1 // FOR v IN values // ... // ) // RETURN tmp1 ? tmp1 : tmp2 // this ensures that we execute the ternary's condition expression only once. // this is important because the expression may be expensive or even have side // effects. // additionally, we only execute the true part of the ternary operator if the // condition is truthy, and the false part of the ternary operator only if the // condition is falsy. parser->lazyConditions().push((yyvsp[-1].node), /*negated*/ true); } #line 5112 "grammar.cpp" break; case 200: /* operator_ternary: expression "?" $@21 ":" expression */ #line 2121 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); (yyval.node) = parser->ast()->createNodeTernaryOperator(previous.condition, (yyvsp[0].node)); } #line 5121 "grammar.cpp" break; case 201: /* optional_function_call_arguments: %empty */ #line 2128 "grammar.y" { } #line 5128 "grammar.cpp" break; case 202: /* optional_function_call_arguments: function_arguments_list */ #line 2130 "grammar.y" { } #line 5135 "grammar.cpp" break; case 203: /* expression_or_query: expression */ #line 2135 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5143 "grammar.cpp" break; case 204: /* $@22: %empty */ #line 2138 "grammar.y" { parser->lazyConditions().flushAssignments(); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_SUBQUERY); parser->ast()->startSubQuery(); parser->lazyConditions().flushFilters(); } #line 5156 "grammar.cpp" break; case 205: /* expression_or_query: $@22 query */ #line 2145 "grammar.y" { AstNode* node = parser->ast()->endSubQuery(); parser->ast()->scopes()->endCurrent(); std::string const variableName = parser->ast()->variables()->nextName(); auto subQuery = parser->ast()->createNodeLet(variableName.c_str(), variableName.size(), node, false); parser->ast()->addOperation(subQuery); (yyval.node) = parser->ast()->createNodeSubqueryReference(variableName, node); } #line 5171 "grammar.cpp" break; case 206: /* function_arguments_list: expression_or_query */ #line 2158 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 5179 "grammar.cpp" break; case 207: /* function_arguments_list: function_arguments_list "," expression_or_query */ #line 2161 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 5187 "grammar.cpp" break; case 208: /* compound_value: array */ #line 2167 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5195 "grammar.cpp" break; case 209: /* compound_value: object */ #line 2170 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5203 "grammar.cpp" break; case 210: /* $@23: %empty */ #line 2176 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushArray(node); } #line 5212 "grammar.cpp" break; case 211: /* array: "[" $@23 optional_array_elements "]" */ #line 2179 "grammar.y" { (yyval.node) = parser->popArray(); } #line 5220 "grammar.cpp" break; case 212: /* optional_array_elements: %empty */ #line 2185 "grammar.y" { } #line 5227 "grammar.cpp" break; case 213: /* optional_array_elements: array_elements_list */ #line 2187 "grammar.y" { } #line 5234 "grammar.cpp" break; case 214: /* optional_array_elements: array_elements_list "," */ #line 2189 "grammar.y" { } #line 5241 "grammar.cpp" break; case 215: /* array_elements_list: array_element */ #line 2194 "grammar.y" { } #line 5248 "grammar.cpp" break; case 216: /* array_elements_list: array_elements_list "," array_element */ #line 2196 "grammar.y" { } #line 5255 "grammar.cpp" break; case 217: /* array_element: expression */ #line 2201 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 5263 "grammar.cpp" break; case 218: /* for_options: %empty */ #line 2207 "grammar.y" { (yyval.node) = nullptr; } #line 5271 "grammar.cpp" break; case 219: /* for_options: "identifier" expression */ #line 2210 "grammar.y" { std::string_view operation((yyvsp[-1].strval).value, (yyvsp[-1].strval).length); TRI_ASSERT((yyvsp[0].node) != nullptr); // we always return an array with two values: SEARCH and OPTIONS // as only one of these values will be set here, the other value is NOP auto node = parser->ast()->createNodeArray(2); // only one extra qualifier. now we need to check if it is SEARCH or OPTIONS if (::caseInsensitiveEqual(operation, "SEARCH")) { // found SEARCH node->addMember((yyvsp[0].node)); node->addMember(parser->ast()->createNodeNop()); } else { // everything else must be OPTIONS if (!::caseInsensitiveEqual(operation, "OPTIONS")) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'SEARCH' or 'OPTIONS'", operation, yylloc.first_line, yylloc.first_column); } ::validateOptions(parser, (yyvsp[0].node), yylloc.first_line, yylloc.first_column); node->addMember(parser->ast()->createNodeNop()); node->addMember((yyvsp[0].node)); } (yyval.node) = node; } #line 5301 "grammar.cpp" break; case 220: /* for_options: "identifier" expression "identifier" expression */ #line 2235 "grammar.y" { std::string_view operation((yyvsp[-3].strval).value, (yyvsp[-3].strval).length); TRI_ASSERT((yyvsp[-2].node) != nullptr); // two extra qualifiers. we expect them in the order: SEARCH, then OPTIONS if (!::caseInsensitiveEqual(operation, "SEARCH") || !::caseInsensitiveEqual({(yyvsp[-1].strval).value, (yyvsp[-1].strval).length}, "OPTIONS")) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'SEARCH' and 'OPTIONS'", operation, yylloc.first_line, yylloc.first_column); } ::validateOptions(parser, (yyvsp[0].node), yylloc.first_line, yylloc.first_column); auto node = parser->ast()->createNodeArray(2); node->addMember((yyvsp[-2].node)); node->addMember((yyvsp[0].node)); (yyval.node) = node; } #line 5323 "grammar.cpp" break; case 221: /* options: %empty */ #line 2255 "grammar.y" { (yyval.node) = nullptr; } #line 5331 "grammar.cpp" break; case 222: /* options: "identifier" object */ #line 2258 "grammar.y" { std::string_view operation((yyvsp[-1].strval).value, (yyvsp[-1].strval).length); TRI_ASSERT((yyvsp[0].node) != nullptr); if (!::caseInsensitiveEqual(operation, "OPTIONS")) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected qualifier '%s', expecting 'OPTIONS'", operation, yylloc.first_line, yylloc.first_column); } ::validateOptions(parser, (yyvsp[0].node), yylloc.first_line, yylloc.first_column); (yyval.node) = (yyvsp[0].node); } #line 5348 "grammar.cpp" break; case 223: /* $@24: %empty */ #line 2273 "grammar.y" { auto node = parser->ast()->createNodeObject(); parser->pushStack(node); } #line 5357 "grammar.cpp" break; case 224: /* object: "{" $@24 optional_object_elements "}" */ #line 2276 "grammar.y" { (yyval.node) = static_cast(parser->popStack()); } #line 5365 "grammar.cpp" break; case 225: /* optional_object_elements: %empty */ #line 2282 "grammar.y" { } #line 5372 "grammar.cpp" break; case 226: /* optional_object_elements: object_elements_list */ #line 2284 "grammar.y" { } #line 5379 "grammar.cpp" break; case 227: /* optional_object_elements: object_elements_list "," */ #line 2286 "grammar.y" { } #line 5386 "grammar.cpp" break; case 228: /* object_elements_list: object_element */ #line 2291 "grammar.y" { } #line 5393 "grammar.cpp" break; case 229: /* object_elements_list: object_elements_list "," object_element */ #line 2293 "grammar.y" { } #line 5400 "grammar.cpp" break; case 230: /* object_element: "identifier" */ #line 2298 "grammar.y" { // attribute-name-only (comparable to JS enhanced object literals, e.g. { foo, bar }) std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); auto ast = parser->ast(); auto variable = ast->scopes()->getVariable(name, true); if (variable == nullptr) { // variable does not exist parser->registerParseError(TRI_ERROR_QUERY_VARIABLE_NAME_UNKNOWN, "use of unknown variable '%s' in object literal", name, yylloc.first_line, yylloc.first_column); } // create a reference to the variable auto node = ast->createNodeReference(variable); parser->pushObjectElement((yyvsp[0].strval).value, (yyvsp[0].strval).length, node); } #line 5421 "grammar.cpp" break; case 231: /* object_element: "inbound modifier" ":" expression */ #line 2314 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5430 "grammar.cpp" break; case 232: /* object_element: "outbound modifier" ":" expression */ #line 2318 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5439 "grammar.cpp" break; case 233: /* object_element: "any modifier" ":" expression */ #line 2322 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5448 "grammar.cpp" break; case 234: /* object_element: "all modifier" ":" expression */ #line 2326 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5457 "grammar.cpp" break; case 235: /* object_element: "none modifier" ":" expression */ #line 2330 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5466 "grammar.cpp" break; case 236: /* object_element: "like operator" ":" expression */ #line 2334 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5475 "grammar.cpp" break; case 237: /* object_element: "INTO keyword" ":" expression */ #line 2338 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5484 "grammar.cpp" break; case 238: /* object_element: "WITH keyword" ":" expression */ #line 2342 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5493 "grammar.cpp" break; case 239: /* object_element: "WINDOW declaration" ":" expression */ #line 2346 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5502 "grammar.cpp" break; case 240: /* object_element: "LIMIT declaration" ":" expression */ #line 2350 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5511 "grammar.cpp" break; case 241: /* object_element: object_element_name ":" expression */ #line 2354 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5520 "grammar.cpp" break; case 242: /* object_element: "bind parameter" ":" expression */ #line 2358 "grammar.y" { // bind-parameter : attribute-value std::string_view name((yyvsp[-2].strval).value, (yyvsp[-2].strval).length); if ((yyvsp[-2].strval).length < 1 || (yyvsp[-2].strval).value[0] == '@') { parser->registerParseError(TRI_ERROR_QUERY_BIND_PARAMETER_TYPE, TRI_errno_string(TRI_ERROR_QUERY_BIND_PARAMETER_TYPE).data(), name, yylloc.first_line, yylloc.first_column); } auto param = parser->ast()->createNodeParameter(name); parser->pushObjectElement(param, (yyvsp[0].node)); } #line 5535 "grammar.cpp" break; case 243: /* object_element: "[" expression "]" ":" expression */ #line 2368 "grammar.y" { // [ attribute-name-expression ] : attribute-value parser->pushObjectElement((yyvsp[-3].node), (yyvsp[0].node)); } #line 5544 "grammar.cpp" break; case 244: /* array_filter_operator: "?" */ #line 2375 "grammar.y" { (yyval.intval) = 1; } #line 5552 "grammar.cpp" break; case 245: /* array_filter_operator: array_filter_operator "?" */ #line 2378 "grammar.y" { (yyval.intval) = (yyvsp[-1].intval) + 1; } #line 5560 "grammar.cpp" break; case 246: /* array_map_operator: "* operator" */ #line 2384 "grammar.y" { (yyval.intval) = 1; } #line 5568 "grammar.cpp" break; case 247: /* array_map_operator: array_map_operator "* operator" */ #line 2387 "grammar.y" { (yyval.intval) = (yyvsp[-1].intval) + 1; } #line 5576 "grammar.cpp" break; case 248: /* optional_array_filter: %empty */ #line 2393 "grammar.y" { (yyval.node) = nullptr; } #line 5584 "grammar.cpp" break; case 249: /* optional_array_filter: "FILTER declaration" expression */ #line 2396 "grammar.y" { // FILTER filter-condition (yyval.node) = parser->ast()->createNodeArrayFilter(nullptr, (yyvsp[0].node)); } #line 5593 "grammar.cpp" break; case 250: /* optional_array_filter: quantifier "FILTER declaration" expression */ #line 2400 "grammar.y" { // ALL|ANY|NONE|AT LEAST FILTER filter-condition (yyval.node) = parser->ast()->createNodeArrayFilter((yyvsp[-2].node), (yyvsp[0].node)); } #line 5602 "grammar.cpp" break; case 251: /* optional_array_filter: "at least modifier" "(" expression ")" "FILTER declaration" expression */ #line 2404 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeArrayFilter(quantifier, (yyvsp[0].node)); } #line 5611 "grammar.cpp" break; case 252: /* optional_array_filter: expression "FILTER declaration" expression */ #line 2408 "grammar.y" { // 1 FILTER filter-condition // 2..5 FILTER filter-condition (yyval.node) = parser->ast()->createNodeArrayFilter((yyvsp[-2].node), (yyvsp[0].node)); } #line 5621 "grammar.cpp" break; case 253: /* optional_array_limit: %empty */ #line 2416 "grammar.y" { (yyval.node) = nullptr; } #line 5629 "grammar.cpp" break; case 254: /* optional_array_limit: "LIMIT declaration" expression */ #line 2419 "grammar.y" { (yyval.node) = parser->ast()->createNodeArrayLimit(nullptr, (yyvsp[0].node)); } #line 5637 "grammar.cpp" break; case 255: /* optional_array_limit: "LIMIT declaration" expression "," expression */ #line 2422 "grammar.y" { (yyval.node) = parser->ast()->createNodeArrayLimit((yyvsp[-2].node), (yyvsp[0].node)); } #line 5645 "grammar.cpp" break; case 256: /* optional_array_return: %empty */ #line 2428 "grammar.y" { (yyval.node) = nullptr; } #line 5653 "grammar.cpp" break; case 257: /* optional_array_return: "RETURN declaration" expression */ #line 2431 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5661 "grammar.cpp" break; case 258: /* graph_collection: "identifier" */ #line 2437 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 5669 "grammar.cpp" break; case 259: /* graph_collection: bind_parameter_datasource_expected */ #line 2440 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5677 "grammar.cpp" break; case 260: /* graph_collection: graph_direction "identifier" */ #line 2443 "grammar.y" { auto tmp = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); (yyval.node) = parser->ast()->createNodeCollectionDirection((yyvsp[-1].intval), tmp); } #line 5686 "grammar.cpp" break; case 261: /* graph_collection: graph_direction bind_parameter */ #line 2447 "grammar.y" { (yyval.node) = parser->ast()->createNodeCollectionDirection((yyvsp[-1].intval), (yyvsp[0].node)); } #line 5694 "grammar.cpp" break; case 262: /* graph_collection_list: graph_collection */ #line 2453 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 5703 "grammar.cpp" break; case 263: /* graph_collection_list: graph_collection_list "," graph_collection */ #line 2457 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 5712 "grammar.cpp" break; case 264: /* graph_subject: graph_collection */ #line 2464 "grammar.y" { auto node = parser->ast()->createNodeArray(); node->addMember((yyvsp[0].node)); auto const& resolver = parser->query().resolver(); (yyval.node) = parser->ast()->createNodeCollectionList(node, resolver); } #line 5723 "grammar.cpp" break; case 265: /* $@25: %empty */ #line 2470 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); node->addMember((yyvsp[-1].node)); } #line 5733 "grammar.cpp" break; case 266: /* graph_subject: graph_collection "," $@25 graph_collection_list */ #line 2474 "grammar.y" { auto node = static_cast(parser->popStack()); auto const& resolver = parser->query().resolver(); (yyval.node) = parser->ast()->createNodeCollectionList(node, resolver); } #line 5743 "grammar.cpp" break; case 267: /* graph_subject: "GRAPH keyword" bind_parameter */ #line 2479 "grammar.y" { // graph name if ((yyvsp[0].node)->type == NODE_TYPE_PARAMETER) { parser->ast()->setContainsGraphNameValueBindParameters(); } (yyval.node) = (yyvsp[0].node); } #line 5755 "grammar.cpp" break; case 268: /* graph_subject: "GRAPH keyword" "quoted string" */ #line 2486 "grammar.y" { // graph name (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 5764 "grammar.cpp" break; case 269: /* graph_subject: "GRAPH keyword" "identifier" */ #line 2490 "grammar.y" { // graph name (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 5773 "grammar.cpp" break; case 270: /* graph_direction: "outbound modifier" */ #line 2499 "grammar.y" { (yyval.intval) = 2; } #line 5781 "grammar.cpp" break; case 271: /* graph_direction: "inbound modifier" */ #line 2502 "grammar.y" { (yyval.intval) = 1; } #line 5789 "grammar.cpp" break; case 272: /* graph_direction: "any modifier" */ #line 2505 "grammar.y" { (yyval.intval) = 0; } #line 5797 "grammar.cpp" break; case 273: /* graph_direction_steps: graph_direction */ #line 2511 "grammar.y" { (yyval.node) = parser->ast()->createNodeDirection((yyvsp[0].intval), 1); } #line 5805 "grammar.cpp" break; case 274: /* graph_direction_steps: expression graph_direction */ #line 2514 "grammar.y" { (yyval.node) = parser->ast()->createNodeDirection((yyvsp[0].intval), (yyvsp[-1].node)); } #line 5813 "grammar.cpp" break; case 275: /* reference: "identifier" */ #line 2520 "grammar.y" { // variable or collection or view auto ast = parser->ast(); AstNode* node = nullptr; std::string_view variableName((yyvsp[0].strval).value, (yyvsp[0].strval).length); auto variable = ast->scopes()->getVariable(variableName, true); if (variable == nullptr) { // variable does not exist // now try special variables if (ast->scopes()->canUseCurrentVariable() && (variableName == Variable::NAME_CURRENT || variableName == Variable::NAME_CURRENT.substr(1))) { variable = ast->scopes()->getCurrentVariable(); } } if (variable != nullptr) { // variable alias exists, now use it node = ast->createNodeReference(variable); } if (node == nullptr) { // variable not found. so it must have been a collection or view auto const& resolver = parser->query().resolver(); node = ast->createNodeDataSource(resolver, variableName, arangodb::AccessMode::Type::READ, true, false); } TRI_ASSERT(node != nullptr); (yyval.node) = node; } #line 5850 "grammar.cpp" break; case 276: /* reference: compound_value */ #line 2552 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5858 "grammar.cpp" break; case 277: /* reference: bind_parameter */ #line 2555 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5866 "grammar.cpp" break; case 278: /* reference: function_call */ #line 2558 "grammar.y" { TRI_ASSERT((yyvsp[0].node) != nullptr); (yyval.node) = (yyvsp[0].node); } #line 5875 "grammar.cpp" break; case 279: /* reference: "(" expression ")" */ #line 2562 "grammar.y" { if ((yyvsp[-1].node)->type == NODE_TYPE_EXPANSION) { // create a dummy passthru node that reduces and evaluates the expansion first // and the expansion on top of the stack won't be chained with any other expansions (yyval.node) = parser->ast()->createNodePassthru((yyvsp[-1].node)); } else { (yyval.node) = (yyvsp[-1].node); } } #line 5889 "grammar.cpp" break; case 280: /* $@26: %empty */ #line 2571 "grammar.y" { parser->lazyConditions().flushAssignments(); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_SUBQUERY); parser->ast()->startSubQuery(); parser->lazyConditions().flushFilters(); } #line 5902 "grammar.cpp" break; case 281: /* reference: "(" $@26 query ")" */ #line 2578 "grammar.y" { AstNode* node = parser->ast()->endSubQuery(); parser->ast()->scopes()->endCurrent(); std::string const variableName = parser->ast()->variables()->nextName(); auto subQuery = parser->ast()->createNodeLet(variableName.c_str(), variableName.size(), node, false); parser->ast()->addOperation(subQuery); (yyval.node) = parser->ast()->createNodeSubqueryReference(variableName, node); } #line 5917 "grammar.cpp" break; case 282: /* reference: reference '.' "identifier" */ #line 2588 "grammar.y" { std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); // named variable access, e.g. variable.reference if ((yyvsp[-2].node)->type == NODE_TYPE_EXPANSION) { // if left operand is an expansion already... // dive into the expansion's right-hand child nodes for further expansion and // patch the bottom-most one auto current = const_cast(parser->ast()->findExpansionSubNode((yyvsp[-2].node))); TRI_ASSERT(current->type == NODE_TYPE_EXPANSION); current->changeMember(1, parser->ast()->createNodeAttributeAccess(current->getMember(1), name)); (yyval.node) = (yyvsp[-2].node); } else { (yyval.node) = parser->ast()->createNodeAttributeAccess((yyvsp[-2].node), name); } } #line 5937 "grammar.cpp" break; case 283: /* reference: reference '.' bind_parameter */ #line 2603 "grammar.y" { // named variable access, e.g. variable.@reference if ((yyvsp[-2].node)->type == NODE_TYPE_EXPANSION) { // if left operand is an expansion already... // patch the existing expansion auto current = const_cast(parser->ast()->findExpansionSubNode((yyvsp[-2].node))); TRI_ASSERT(current->type == NODE_TYPE_EXPANSION); current->changeMember(1, parser->ast()->createNodeBoundAttributeAccess(current->getMember(1), (yyvsp[0].node))); (yyval.node) = (yyvsp[-2].node); } else { (yyval.node) = parser->ast()->createNodeBoundAttributeAccess((yyvsp[-2].node), (yyvsp[0].node)); } } #line 5955 "grammar.cpp" break; case 284: /* reference: reference "[" expression "]" */ #line 2616 "grammar.y" { // indexed variable access, e.g. variable[index] if ((yyvsp[-3].node)->type == NODE_TYPE_EXPANSION) { // if left operand is an expansion already... // patch the existing expansion auto current = const_cast(parser->ast()->findExpansionSubNode((yyvsp[-3].node))); TRI_ASSERT(current->type == NODE_TYPE_EXPANSION); current->changeMember(1, parser->ast()->createNodeIndexedAccess(current->getMember(1), (yyvsp[-1].node))); (yyval.node) = (yyvsp[-3].node); } else { (yyval.node) = parser->ast()->createNodeIndexedAccess((yyvsp[-3].node), (yyvsp[-1].node)); } } #line 5973 "grammar.cpp" break; case 285: /* $@27: %empty */ #line 2629 "grammar.y" { // variable expansion, e.g. variable[?], with optional FILTER clause if ((yyvsp[0].intval) > 1 && (yyvsp[-2].node)->type == NODE_TYPE_EXPANSION) { // create a dummy passthru node that reduces and evaluates the expansion first // and the expansion on top of the stack won't be chained with any other expansions (yyvsp[-2].node) = parser->ast()->createNodePassthru((yyvsp[-2].node)); } // create a temporary iterator variable std::string const nextName = parser->ast()->variables()->nextName() + "_"; if ((yyvsp[-2].node)->type == NODE_TYPE_EXPANSION) { auto iterator = parser->ast()->createNodeIterator(nextName.c_str(), nextName.size(), (yyvsp[-2].node)->getMember(1)); parser->pushStack(iterator); } else { auto iterator = parser->ast()->createNodeIterator(nextName.c_str(), nextName.size(), (yyvsp[-2].node)); parser->pushStack(iterator); } auto scopes = parser->ast()->scopes(); scopes->stackCurrentVariable(scopes->getVariable(nextName)); // we are temporarily forcing all conditionals to be inlined, just for // evaluating the FILTER condition, which must remain a single // condition parser->lazyConditions().pushForceInline(); } #line 6005 "grammar.cpp" break; case 286: /* reference: reference "[" array_filter_operator $@27 optional_array_filter "]" */ #line 2655 "grammar.y" { parser->lazyConditions().popForceInline(); auto scopes = parser->ast()->scopes(); scopes->unstackCurrentVariable(); auto iterator = static_cast(parser->popStack()); auto variableNode = iterator->getMember(0); TRI_ASSERT(variableNode->type == NODE_TYPE_VARIABLE); auto variable = static_cast(variableNode->getData()); if ((yyvsp[-5].node)->type == NODE_TYPE_EXPANSION) { auto expand = parser->ast()->createNodeBooleanExpansion((yyvsp[-3].intval), iterator, parser->ast()->createNodeReference(variable->name), (yyvsp[-1].node)); (yyvsp[-5].node)->changeMember(1, expand); (yyval.node) = (yyvsp[-5].node); } else { (yyval.node) = parser->ast()->createNodeBooleanExpansion((yyvsp[-3].intval), iterator, parser->ast()->createNodeReference(variable->name), (yyvsp[-1].node)); } } #line 6029 "grammar.cpp" break; case 287: /* $@28: %empty */ #line 2674 "grammar.y" { // variable expansion, e.g. variable[*], with optional FILTER, LIMIT and RETURN clauses if ((yyvsp[0].intval) > 1 && (yyvsp[-2].node)->type == NODE_TYPE_EXPANSION) { // create a dummy passthru node that reduces and evaluates the expansion first // and the expansion on top of the stack won't be chained with any other expansions (yyvsp[-2].node) = parser->ast()->createNodePassthru((yyvsp[-2].node)); } // create a temporary iterator variable std::string const nextName = parser->ast()->variables()->nextName() + "_"; if ((yyvsp[-2].node)->type == NODE_TYPE_EXPANSION) { auto iterator = parser->ast()->createNodeIterator(nextName.c_str(), nextName.size(), (yyvsp[-2].node)->getMember(1)); parser->pushStack(iterator); } else { auto iterator = parser->ast()->createNodeIterator(nextName.c_str(), nextName.size(), (yyvsp[-2].node)); parser->pushStack(iterator); } auto scopes = parser->ast()->scopes(); scopes->stackCurrentVariable(scopes->getVariable(nextName)); // we are temporarily forcing all conditionals to be inlined, just for // evaluating the FILTER condition, which must remain a single // condition parser->lazyConditions().pushForceInline(); } #line 6061 "grammar.cpp" break; case 288: /* reference: reference "[" array_map_operator $@28 optional_array_filter optional_array_limit optional_array_return "]" */ #line 2700 "grammar.y" { parser->lazyConditions().popForceInline(); auto scopes = parser->ast()->scopes(); scopes->unstackCurrentVariable(); auto iterator = static_cast(parser->popStack()); auto variableNode = iterator->getMember(0); TRI_ASSERT(variableNode->type == NODE_TYPE_VARIABLE); auto variable = static_cast(variableNode->getData()); if ((yyvsp[-3].node) != nullptr) { // array filter members are [quantifier, filter] // quantifier is optional. TRI_ASSERT((yyvsp[-3].node)->type == NODE_TYPE_ARRAY_FILTER); TRI_ASSERT((yyvsp[-3].node)->numMembers() == 2); if ((yyvsp[-3].node)->getMember(0) != nullptr && (yyvsp[-3].node)->getMember(0)->type != NODE_TYPE_NOP) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected quantifier value found for array expansion operation.", yylloc.first_line, yylloc.first_column); } } if ((yyvsp[-7].node)->type == NODE_TYPE_EXPANSION) { auto expand = parser->ast()->createNodeExpansion((yyvsp[-5].intval), iterator, parser->ast()->createNodeReference(variable->name), (yyvsp[-3].node), (yyvsp[-2].node), (yyvsp[-1].node)); (yyvsp[-7].node)->changeMember(1, expand); (yyval.node) = (yyvsp[-7].node); } else { (yyval.node) = parser->ast()->createNodeExpansion((yyvsp[-5].intval), iterator, parser->ast()->createNodeReference(variable->name), (yyvsp[-3].node), (yyvsp[-2].node), (yyvsp[-1].node)); } } #line 6095 "grammar.cpp" break; case 289: /* simple_value: value_literal */ #line 2732 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 6103 "grammar.cpp" break; case 290: /* simple_value: bind_parameter */ #line 2735 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 6111 "grammar.cpp" break; case 291: /* numeric_value: "integer number" */ #line 2741 "grammar.y" { TRI_ASSERT((yyvsp[0].node) != nullptr); (yyval.node) = (yyvsp[0].node); } #line 6120 "grammar.cpp" break; case 292: /* numeric_value: "number" */ #line 2745 "grammar.y" { TRI_ASSERT((yyvsp[0].node) != nullptr); (yyval.node) = (yyvsp[0].node); } #line 6129 "grammar.cpp" break; case 293: /* value_literal: "quoted string" */ #line 2752 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 6137 "grammar.cpp" break; case 294: /* value_literal: numeric_value */ #line 2755 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 6145 "grammar.cpp" break; case 295: /* value_literal: "null" */ #line 2758 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueNull(); } #line 6153 "grammar.cpp" break; case 296: /* value_literal: "true" */ #line 2761 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(true); } #line 6161 "grammar.cpp" break; case 297: /* value_literal: "false" */ #line 2764 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(false); } #line 6169 "grammar.cpp" break; case 298: /* in_or_into_collection_name: "identifier" */ #line 2770 "grammar.y" { std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); auto const& resolver = parser->query().resolver(); (yyval.node) = parser->ast()->createNodeCollection(resolver, name, arangodb::AccessMode::Type::WRITE); } #line 6179 "grammar.cpp" break; case 299: /* in_or_into_collection_name: "quoted string" */ #line 2775 "grammar.y" { std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); auto const& resolver = parser->query().resolver(); (yyval.node) = parser->ast()->createNodeCollection(resolver, name, arangodb::AccessMode::Type::WRITE); } #line 6189 "grammar.cpp" break; case 300: /* in_or_into_collection_name: "bind data source parameter" */ #line 2780 "grammar.y" { std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); if (name.size() < 2 || name.front() != '@') { parser->registerParseError(TRI_ERROR_QUERY_BIND_PARAMETER_TYPE, TRI_errno_string(TRI_ERROR_QUERY_BIND_PARAMETER_TYPE).data(), name, yylloc.first_line, yylloc.first_column); } (yyval.node) = parser->ast()->createNodeParameterDatasource(name); } #line 6202 "grammar.cpp" break; case 301: /* bind_parameter: "bind data source parameter" */ #line 2791 "grammar.y" { std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); if (name.size() < 2 || name.front() != '@') { parser->registerParseError(TRI_ERROR_QUERY_BIND_PARAMETER_TYPE, TRI_errno_string(TRI_ERROR_QUERY_BIND_PARAMETER_TYPE).data(), name, yylloc.first_line, yylloc.first_column); } (yyval.node) = parser->ast()->createNodeParameterDatasource(name); } #line 6215 "grammar.cpp" break; case 302: /* bind_parameter: "bind parameter" */ #line 2799 "grammar.y" { std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); (yyval.node) = parser->ast()->createNodeParameter(name); } #line 6224 "grammar.cpp" break; case 303: /* bind_parameter_datasource_expected: "bind data source parameter" */ #line 2806 "grammar.y" { std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); if (name.size() < 2 || name.front() != '@') { parser->registerParseError(TRI_ERROR_QUERY_BIND_PARAMETER_TYPE, TRI_errno_string(TRI_ERROR_QUERY_BIND_PARAMETER_TYPE).data(), (yyvsp[0].strval).value, yylloc.first_line, yylloc.first_column); } (yyval.node) = parser->ast()->createNodeParameterDatasource(name); } #line 6237 "grammar.cpp" break; case 304: /* bind_parameter_datasource_expected: "bind parameter" */ #line 2814 "grammar.y" { // convert normal value bind parameter into datasource bind parameter std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); (yyval.node) = parser->ast()->createNodeParameterDatasource(name); } #line 6247 "grammar.cpp" break; case 305: /* object_element_name: "identifier" */ #line 2822 "grammar.y" { (yyval.strval) = (yyvsp[0].strval); } #line 6255 "grammar.cpp" break; case 306: /* object_element_name: "quoted string" */ #line 2825 "grammar.y" { (yyval.strval) = (yyvsp[0].strval); } #line 6263 "grammar.cpp" break; case 307: /* variable_name: "identifier" */ #line 2830 "grammar.y" { (yyval.strval) = (yyvsp[0].strval); } #line 6271 "grammar.cpp" break; #line 6275 "grammar.cpp" default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; *++yyvsp = yyval; *++yylsp = yyloc; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ { const int yylhs = yyr1[yyn] - YYNTOKENS; const int yyi = yypgoto[yylhs] + *yyssp; yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp ? yytable[yyi] : yydefgoto[yylhs]); } goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; { yypcontext_t yyctx = {yyssp, yytoken, &yylloc}; char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == -1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (yymsg) { yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); yymsgp = yymsg; } else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = YYENOMEM; } } yyerror (&yylloc, parser, yymsgp); if (yysyntax_error_status == YYENOMEM) YYNOMEM; } } yyerror_range[1] = yylloc; if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= T_END) { /* Return failure if at end of input. */ if (yychar == T_END) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, &yylloc, parser); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYSYMBOL_YYerror; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yyerror_range[1] = *yylsp; yydestruct ("Error: popping", YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp, parser); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END yyerror_range[2] = yylloc; ++yylsp; YYLLOC_DEFAULT (*yylsp, yyerror_range, 2); /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturnlab; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturnlab; /*-----------------------------------------------------------. | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | `-----------------------------------------------------------*/ yyexhaustedlab: yyerror (&yylloc, parser, YY_("memory exhausted")); yyresult = 2; goto yyreturnlab; /*----------------------------------------------------------. | yyreturnlab -- parsing is finished, clean up and return. | `----------------------------------------------------------*/ yyreturnlab: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, parser); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp, parser); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); return yyresult; }