/* 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_count_into = 107, /* count_into */ YYSYMBOL_collect_variable_list = 108, /* collect_variable_list */ YYSYMBOL_109_4 = 109, /* $@4 */ YYSYMBOL_collect_statement = 110, /* collect_statement */ YYSYMBOL_collect_list = 111, /* collect_list */ YYSYMBOL_collect_element = 112, /* collect_element */ YYSYMBOL_collect_optional_into = 113, /* collect_optional_into */ YYSYMBOL_variable_list = 114, /* variable_list */ YYSYMBOL_keep = 115, /* keep */ YYSYMBOL_116_5 = 116, /* $@5 */ YYSYMBOL_aggregate = 117, /* aggregate */ YYSYMBOL_118_6 = 118, /* $@6 */ YYSYMBOL_aggregate_list = 119, /* aggregate_list */ YYSYMBOL_aggregate_element = 120, /* aggregate_element */ YYSYMBOL_aggregate_function_call = 121, /* aggregate_function_call */ YYSYMBOL_122_7 = 122, /* $@7 */ YYSYMBOL_sort_statement = 123, /* sort_statement */ YYSYMBOL_124_8 = 124, /* $@8 */ YYSYMBOL_sort_list = 125, /* sort_list */ YYSYMBOL_sort_element = 126, /* sort_element */ YYSYMBOL_sort_direction = 127, /* sort_direction */ YYSYMBOL_limit_statement = 128, /* limit_statement */ YYSYMBOL_window_statement = 129, /* window_statement */ YYSYMBOL_return_statement = 130, /* return_statement */ YYSYMBOL_in_or_into_collection = 131, /* in_or_into_collection */ YYSYMBOL_remove_statement = 132, /* remove_statement */ YYSYMBOL_insert_statement = 133, /* insert_statement */ YYSYMBOL_update_parameters = 134, /* update_parameters */ YYSYMBOL_update_statement = 135, /* update_statement */ YYSYMBOL_replace_parameters = 136, /* replace_parameters */ YYSYMBOL_replace_statement = 137, /* replace_statement */ YYSYMBOL_update_or_replace = 138, /* update_or_replace */ YYSYMBOL_upsert_input = 139, /* upsert_input */ YYSYMBOL_upsert_statement = 140, /* upsert_statement */ YYSYMBOL_141_9 = 141, /* $@9 */ YYSYMBOL_142_10 = 142, /* $@10 */ YYSYMBOL_143_11 = 143, /* $@11 */ YYSYMBOL_quantifier = 144, /* quantifier */ YYSYMBOL_distinct_expression = 145, /* distinct_expression */ YYSYMBOL_146_12 = 146, /* $@12 */ YYSYMBOL_expression = 147, /* expression */ YYSYMBOL_function_name = 148, /* function_name */ YYSYMBOL_function_call = 149, /* function_call */ YYSYMBOL_150_13 = 150, /* $@13 */ YYSYMBOL_151_14 = 151, /* $@14 */ YYSYMBOL_operator_unary = 152, /* operator_unary */ YYSYMBOL_operator_binary = 153, /* operator_binary */ YYSYMBOL_154_15 = 154, /* $@15 */ YYSYMBOL_155_16 = 155, /* $@16 */ YYSYMBOL_operator_ternary = 156, /* operator_ternary */ YYSYMBOL_157_17 = 157, /* $@17 */ YYSYMBOL_158_18 = 158, /* $@18 */ YYSYMBOL_159_19 = 159, /* $@19 */ YYSYMBOL_optional_function_call_arguments = 160, /* optional_function_call_arguments */ YYSYMBOL_expression_or_query = 161, /* expression_or_query */ YYSYMBOL_162_20 = 162, /* $@20 */ YYSYMBOL_function_arguments_list = 163, /* function_arguments_list */ YYSYMBOL_compound_value = 164, /* compound_value */ YYSYMBOL_array = 165, /* array */ YYSYMBOL_166_21 = 166, /* $@21 */ YYSYMBOL_optional_array_elements = 167, /* optional_array_elements */ YYSYMBOL_array_elements_list = 168, /* array_elements_list */ YYSYMBOL_array_element = 169, /* array_element */ YYSYMBOL_for_options = 170, /* for_options */ YYSYMBOL_options = 171, /* options */ YYSYMBOL_object = 172, /* object */ YYSYMBOL_173_22 = 173, /* $@22 */ YYSYMBOL_optional_object_elements = 174, /* optional_object_elements */ YYSYMBOL_object_elements_list = 175, /* object_elements_list */ YYSYMBOL_object_element = 176, /* object_element */ YYSYMBOL_array_filter_operator = 177, /* array_filter_operator */ YYSYMBOL_array_map_operator = 178, /* array_map_operator */ YYSYMBOL_optional_array_filter = 179, /* optional_array_filter */ YYSYMBOL_optional_array_limit = 180, /* optional_array_limit */ YYSYMBOL_optional_array_return = 181, /* optional_array_return */ YYSYMBOL_graph_collection = 182, /* graph_collection */ YYSYMBOL_graph_collection_list = 183, /* graph_collection_list */ YYSYMBOL_graph_subject = 184, /* graph_subject */ YYSYMBOL_185_23 = 185, /* $@23 */ YYSYMBOL_graph_direction = 186, /* graph_direction */ YYSYMBOL_graph_direction_steps = 187, /* graph_direction_steps */ YYSYMBOL_reference = 188, /* reference */ YYSYMBOL_189_24 = 189, /* $@24 */ YYSYMBOL_190_25 = 190, /* $@25 */ YYSYMBOL_191_26 = 191, /* $@26 */ YYSYMBOL_simple_value = 192, /* simple_value */ YYSYMBOL_numeric_value = 193, /* numeric_value */ YYSYMBOL_value_literal = 194, /* value_literal */ YYSYMBOL_in_or_into_collection_name = 195, /* in_or_into_collection_name */ YYSYMBOL_bind_parameter = 196, /* bind_parameter */ YYSYMBOL_bind_parameter_datasource_expected = 197, /* bind_parameter_datasource_expected */ YYSYMBOL_object_element_name = 198, /* object_element_name */ YYSYMBOL_variable_name = 199 /* 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 { 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 checkOutVariables(Parser* parser, AstNode const* variableNamesNode, size_t minVariables, size_t maxVariables, char const* errorMessage, YYLTYPE const& yyloc) { TRI_ASSERT(variableNamesNode != nullptr); TRI_ASSERT(variableNamesNode->type == NODE_TYPE_ARRAY); if (variableNamesNode->numMembers() < minVariables || variableNamesNode->numMembers() > maxVariables) { parser->registerParseError(TRI_ERROR_QUERY_PARSE, errorMessage, 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 663 "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 1949 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 81 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 119 /* YYNRULES -- Number of rules. */ #define YYNRULES 278 /* YYNSTATES -- Number of states. */ #define YYNSTATES 483 /* 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, 564, 564, 570, 580, 583, 589, 593, 597, 604, 606, 606, 618, 623, 628, 630, 633, 636, 639, 642, 648, 650, 655, 657, 659, 661, 663, 665, 667, 669, 671, 673, 675, 677, 682, 689, 696, 702, 709, 733, 756, 769, 775, 781, 787, 796, 796, 854, 854, 894, 906, 918, 930, 945, 953, 958, 960, 965, 972, 983, 983, 994, 1004, 1017, 1041, 1096, 1115, 1146, 1148, 1153, 1160, 1163, 1166, 1175, 1188, 1204, 1204, 1219, 1219, 1229, 1231, 1236, 1243, 1243, 1255, 1255, 1266, 1269, 1275, 1281, 1284, 1287, 1290, 1296, 1301, 1308, 1323, 1341, 1349, 1352, 1358, 1368, 1378, 1386, 1397, 1402, 1410, 1421, 1426, 1429, 1435, 1438, 1444, 1460, 1444, 1507, 1507, 1566, 1569, 1572, 1578, 1578, 1588, 1594, 1597, 1600, 1603, 1606, 1609, 1615, 1618, 1631, 1631, 1638, 1638, 1648, 1651, 1654, 1660, 1660, 1666, 1666, 1672, 1675, 1678, 1681, 1684, 1687, 1690, 1693, 1696, 1699, 1702, 1705, 1708, 1711, 1718, 1725, 1731, 1737, 1743, 1750, 1753, 1756, 1759, 1762, 1765, 1768, 1771, 1774, 1778, 1782, 1786, 1790, 1794, 1798, 1802, 1809, 1845, 1809, 1853, 1853, 1886, 1888, 1893, 1896, 1896, 1916, 1919, 1925, 1928, 1934, 1934, 1943, 1945, 1947, 1952, 1954, 1959, 1965, 1968, 1993, 2013, 2016, 2031, 2031, 2040, 2042, 2044, 2049, 2051, 2056, 2072, 2076, 2086, 2093, 2096, 2102, 2105, 2111, 2114, 2118, 2122, 2126, 2134, 2137, 2140, 2146, 2149, 2155, 2158, 2161, 2165, 2171, 2175, 2182, 2188, 2188, 2197, 2201, 2205, 2214, 2217, 2220, 2226, 2229, 2235, 2267, 2270, 2273, 2277, 2286, 2286, 2303, 2318, 2331, 2344, 2344, 2389, 2389, 2447, 2450, 2456, 2460, 2467, 2470, 2473, 2476, 2479, 2485, 2490, 2495, 2506, 2514, 2521, 2529, 2537, 2540, 2545 }; #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", "count_into", "collect_variable_list", "$@4", "collect_statement", "collect_list", "collect_element", "collect_optional_into", "variable_list", "keep", "$@5", "aggregate", "$@6", "aggregate_list", "aggregate_element", "aggregate_function_call", "$@7", "sort_statement", "$@8", "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", "$@9", "$@10", "$@11", "quantifier", "distinct_expression", "$@12", "expression", "function_name", "function_call", "$@13", "$@14", "operator_unary", "operator_binary", "$@15", "$@16", "operator_ternary", "$@17", "$@18", "$@19", "optional_function_call_arguments", "expression_or_query", "$@20", "function_arguments_list", "compound_value", "array", "$@21", "optional_array_elements", "array_elements_list", "array_element", "for_options", "options", "object", "$@22", "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", "$@23", "graph_direction", "graph_direction_steps", "reference", "$@24", "$@25", "$@26", "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 (-417) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) #define YYTABLE_NINF (-279) #define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 44, -417, -417, 63, 6, -417, 550, -417, -417, -417, -417, -417, 70, -417, 36, 36, 1808, 1694, 13, -417, 1808, 1808, 1808, 1808, 1808, 1808, 25, -417, -417, -417, -417, -417, 243, -417, -417, -417, -417, -417, 14, 17, 18, 21, 24, 6, -417, -417, 27, 69, -417, 32, -417, 48, -417, -417, -417, -22, -417, -417, -417, -417, -417, 1808, 37, 1808, 1808, 1808, -417, -417, 1562, -8, -417, -417, -417, -417, -417, -417, -417, -40, -417, -417, -417, -417, -417, 1562, 76, -417, 92, 36, 85, 1808, 900, 944, 109, 989, 989, -417, 717, -417, 764, -417, -417, -417, -417, 36, 92, 98, 85, -417, 36, 199, 36, 1808, -417, -417, -417, -417, 1033, -417, 3, 1808, 1808, 47, -417, -417, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 74, 1808, -417, -417, -417, 72, 115, 105, -417, 1732, 108, 1808, 123, 36, 78, -417, 88, -417, 113, 92, 91, -417, 626, 1808, 78, -417, 1846, 150, 92, 92, 1808, 92, 1808, 92, 1808, 121, 117, -417, 78, 92, -417, 92, -417, -417, -417, -417, -417, -417, -417, -417, -417, 808, 51, 423, -417, 1562, 1770, -417, 96, 110, -417, 120, 1808, 127, 133, -417, 146, 1562, 118, 149, -417, 581, 1808, 1808, 1808, 1808, 1808, 581, 377, 377, 377, 377, 153, 153, 153, 153, 377, 231, 231, -417, -417, -417, 1808, 156, 201, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, -417, 1770, -417, -417, 1077, 154, 161, -417, -417, 1562, 36, 157, -417, 179, -417, 36, 1808, -417, 1808, -417, -417, -417, -417, -417, -417, 1562, 109, 521, 561, 591, -417, -417, -417, -417, -417, -417, -417, 989, -417, 989, -417, 1562, 1808, 1808, 36, -417, -417, 205, 124, 208, -417, 1808, 1808, 1808, 1808, 670, 1562, 180, -417, -417, 184, -417, 1808, 1121, -417, 3, 1808, -417, 1808, 377, 377, 377, 1649, 1606, 1165, 1808, 1210, 581, 581, 377, 377, 153, 153, 153, 153, 185, -417, -417, 278, -417, 278, -417, 36, 230, -417, 1562, -417, -417, 92, 92, 239, 856, 1562, 216, -417, 1884, -417, 1808, -417, 1254, 1298, 1342, 1386, 143, -417, 217, -417, 152, -417, -417, -417, 1808, 1562, 225, -417, 1562, -417, -417, 1562, 449, -417, 1808, 204, 282, 464, 222, 281, -417, -417, -417, 41, -417, -417, 1808, -417, -417, 1808, 36, -15, 260, 1562, 255, 1430, 1808, 1808, 1808, 1808, -417, -417, -417, -417, -417, -417, -417, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1562, 1808, 1808, 1808, -417, 1808, 288, -417, 856, 989, -417, 78, 1808, 1808, 670, 670, 670, 670, -3, 1562, 1562, 581, 581, 377, 377, 153, 153, 153, 153, 1474, 1562, 1562, 1518, 1808, 232, 1770, 1808, 92, -417, 1562, 1562, 92, 92, 92, 92, -417, 236, 292, 1808, 1562, -417, 237, 989, -417, -417, -417, -417, -417, -3, 1808, 1562, -417, 92, -417, 1562, -417 }; /* 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, 275, 274, 6, 11, 5, 0, 0, 0, 0, 59, 84, 0, 0, 0, 0, 0, 0, 0, 13, 21, 22, 24, 23, 70, 25, 26, 27, 28, 14, 29, 30, 31, 32, 33, 0, 8, 278, 36, 0, 34, 54, 55, 0, 266, 267, 268, 246, 264, 262, 263, 273, 272, 0, 0, 0, 0, 251, 204, 191, 53, 0, 249, 123, 124, 125, 247, 189, 190, 127, 265, 126, 248, 120, 97, 122, 0, 77, 202, 0, 70, 0, 93, 0, 190, 0, 0, 104, 0, 107, 0, 112, 115, 110, 111, 0, 202, 202, 70, 7, 0, 0, 0, 0, 137, 133, 135, 136, 0, 20, 206, 193, 0, 0, 140, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 177, 0, 118, 117, 119, 0, 0, 0, 131, 0, 0, 0, 0, 0, 0, 61, 60, 67, 0, 202, 85, 86, 89, 0, 0, 95, 0, 0, 202, 202, 0, 202, 0, 202, 0, 0, 71, 62, 75, 202, 65, 202, 35, 241, 242, 243, 47, 49, 50, 51, 52, 45, 244, 0, 56, 57, 185, 250, 0, 211, 277, 0, 0, 0, 207, 209, 0, 198, 0, 194, 196, 153, 0, 0, 0, 0, 0, 154, 159, 160, 147, 148, 149, 150, 151, 152, 158, 142, 143, 144, 145, 146, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 185, 217, 215, 0, 256, 258, 253, 254, 121, 0, 78, 79, 0, 203, 0, 0, 63, 0, 90, 91, 88, 92, 260, 261, 94, 0, 246, 264, 272, 98, 269, 270, 271, 99, 100, 101, 0, 102, 0, 105, 113, 0, 0, 0, 66, 64, 37, 243, 199, 245, 0, 0, 0, 0, 0, 184, 0, 187, 20, 183, 252, 0, 0, 205, 208, 0, 192, 195, 156, 157, 155, 141, 139, 0, 0, 0, 167, 168, 161, 162, 163, 164, 165, 166, 0, 255, 216, 219, 218, 219, 58, 0, 0, 68, 69, 87, 96, 202, 202, 0, 0, 72, 76, 73, 0, 48, 0, 46, 0, 0, 0, 0, 0, 229, 235, 40, 0, 230, 134, 186, 185, 213, 0, 210, 212, 197, 178, 181, 0, 132, 0, 0, 0, 0, 0, 224, 80, 129, 81, 0, 103, 106, 0, 108, 109, 0, 0, 246, 38, 2, 0, 200, 0, 0, 0, 0, 240, 239, 238, 236, 231, 232, 188, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 257, 0, 227, 82, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 214, 179, 175, 176, 169, 170, 171, 172, 173, 174, 0, 221, 223, 225, 0, 0, 185, 0, 202, 39, 3, 201, 202, 202, 202, 202, 233, 237, 0, 0, 228, 259, 0, 0, 116, 41, 42, 44, 43, 0, 0, 226, 83, 202, 234, 222, 114 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -417, -417, 8, -417, -417, -417, -417, -101, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, 190, 269, -417, -417, -417, -417, 45, -62, -417, -417, -417, -21, -417, -417, -31, -417, -417, -417, -417, -417, 57, -417, -417, -417, -417, -42, -417, -417, -417, -417, -417, -417, -120, -417, -417, -417, -417, -417, -276, -417, -417, -16, -17, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -241, -44, -417, -417, -417, -417, -417, -417, -417, 10, -417, 22, -11, -417, -417, -417, 16, -417, -417, -7, -417, -417, -416, -417, -160, -417, -96, -417, -417, -417, -417, -417, -417, -417, 164, 165, -14, 19, -417, -12 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { 0, 392, 11, 12, 2, 4, 3, 5, 27, 6, 28, 46, 47, 349, 185, 186, 187, 188, 189, 29, 292, 290, 30, 31, 49, 50, 86, 32, 87, 33, 155, 156, 105, 346, 178, 287, 88, 152, 254, 255, 382, 452, 34, 89, 159, 160, 264, 35, 36, 37, 167, 38, 39, 95, 40, 97, 41, 389, 100, 42, 173, 343, 174, 145, 82, 150, 299, 69, 70, 244, 195, 71, 72, 215, 214, 73, 231, 408, 232, 300, 301, 302, 303, 74, 75, 119, 207, 208, 209, 351, 154, 76, 118, 202, 203, 204, 248, 249, 378, 423, 451, 358, 463, 359, 435, 360, 192, 77, 117, 331, 333, 265, 78, 79, 273, 80, 361, 205, 51 }; /* 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[] = { 68, 83, 48, 328, 90, 91, 93, 94, 96, 98, 92, 106, 102, 191, -15, 101, 197, -16, -17, 462, 44, -18, -278, 13, -19, 148, 158, 84, 357, 85, 99, 13, 9, 10, 198, 199, -129, 8, 200, -129, 149, 9, 10, -129, 180, 112, -129, 114, 115, 116, 146, 107, 168, 147, 170, 376, 172, 376, 1, 480, 59, 60, 13, 7, 182, 183, 184, 45, 201, 294, 295, 164, 296, 161, -15, 157, -15, -16, -17, -16, -17, -18, 109, -18, -19, 111, -19, 108, 66, 211, 212, 175, 110, 190, 293, 194, 181, 213, 113, 146, 103, 8, 424, 206, 210, 9, 10, 151, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 153, 233, 85, 176, 179, 235, 177, 43, -180, 247, 234, 252, 251, 243, -118, 253, 250, 256, 66, 257, 59, 60, 285, 268, 267, 258, 210, 259, 261, 269, 280, 286, 282, 236, 284, 304, 237, 238, 239, 240, 241, 242, -118, 257, -276, -118, -118, -118, -118, -118, -118, 400, 401, 298, 305, 59, 60, 260, 274, 275, 404, 310, 306, 276, 59, 60, 278, 279, 307, 281, 308, 283, 312, 313, 314, 315, 316, 288, 363, 289, 309, 134, 135, 136, 137, 138, 311, 330, 468, 140, 318, 332, 317, 336, 335, 319, 320, 321, 322, 323, 324, 325, 326, 327, 52, 53, 54, 55, 56, 57, 58, 59, 60, 348, 61, 341, 350, 342, 334, 362, 338, 364, 161, 157, 373, 340, 62, 63, 64, 134, 135, 136, 137, 138, 84, 103, 85, 65, 381, 66, 386, 67, 418, 182, 183, 184, 344, 345, 458, 459, 460, 461, 347, 390, 403, 352, 353, 354, 355, 407, 374, 136, 137, 138, 419, 421, 365, 422, 428, 429, 368, 450, 206, 475, 476, 467, 478, 193, 104, 371, 337, 380, 453, 52, 53, 54, 55, 56, 57, 58, 59, 60, 377, 61, 377, 339, 383, 406, 369, 0, 256, 367, 266, 379, 0, 62, 63, 64, 277, 393, 0, 395, 0, 394, 0, 0, 65, 0, 66, 402, 67, 0, 0, 405, 141, 142, 143, 375, 0, 0, 0, 0, 0, 0, 0, 417, 0, 0, 0, 0, 384, 385, 0, 0, 0, 0, 0, 425, 0, 0, 426, 0, 0, 0, 0, 427, 0, 431, 432, 433, 434, 454, 0, 0, 0, 0, 0, 120, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 0, 446, 447, 448, 0, 449, 0, 0, 0, 0, 0, 0, 456, 457, 121, 0, 455, 124, 0, 0, 0, 0, 129, 130, 131, 132, 479, 134, 135, 136, 137, 138, 0, 466, 0, 140, 469, 0, 0, 0, 0, 0, 297, 0, 0, 0, 0, 0, 477, 0, 52, 53, 54, 55, 56, 57, 58, 59, 60, 481, 61, 409, 0, 0, 0, 0, 0, 0, 420, 0, 0, 0, 62, 63, 64, 470, 120, 0, 0, 471, 472, 473, 474, 65, 0, 66, 0, 67, 0, 410, 0, 0, 411, 412, 413, 414, 415, 416, 0, 0, 482, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, -269, 0, 140, -269, -269, -269, -269, -269, -269, -269, -269, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, -269, -269, -269, -269, -269, 0, 0, 0, -269, 14, 15, 16, 17, 18, 19, 20, 21, -270, 0, 0, -270, -270, -270, -270, -270, -270, -270, -270, 0, 22, 23, 24, 25, 26, 0, -129, 0, -269, -129, -269, -270, -270, -270, -270, -270, 0, 0, -271, -270, 0, -271, -271, -271, -271, -271, -271, -271, -271, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -271, -271, -271, -271, -271, 0, 0, -270, -271, -270, 0, 0, 0, 129, 130, 131, 132, 0, 134, 135, 136, 137, 138, 262, 263, 120, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -271, 0, -271, 52, 53, 54, 0, 56, 57, 58, 59, 60, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 356, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 357, 0, 0, 0, 9, 10, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 0, 0, 140, 165, 169, 166, 0, 0, 0, 0, 182, 183, 291, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 0, 0, 140, 165, 171, 166, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 0, 0, 140, 0, 120, 0, 0, 0, 0, 0, 182, 183, 291, 142, 143, 144, 387, 388, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 163, 140, 162, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 0, 165, 140, 166, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 196, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 329, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 366, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 370, 120, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 372, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 396, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 397, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 398, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 399, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 430, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 464, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 465, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 120, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 122, 0, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 120, 0, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 121, 0, 0, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 0, 0, 0, 140, 0, 0, 0, 0, 0, 0, 0, 81, 0, 141, 142, 143, 144, 52, 53, 54, 55, 56, 57, 58, 59, 60, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 66, 0, 67, 52, 53, 54, 55, 56, 57, 58, 59, 60, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, 245, 0, 0, 246, 0, 0, 0, 0, 65, 0, 66, 0, 67, 52, 53, 54, 55, 56, 57, 58, 59, 60, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, 65, -182, 66, 0, 67, 52, 53, 54, 55, 56, 57, 58, 59, 60, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 66, 0, 67, 52, 53, 54, 270, 271, 57, 58, 59, 272, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 66, 0, 67, 52, 53, 54, 391, 56, 57, 58, 59, 60, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 66, 0, 67 }; static const yytype_int16 yycheck[] = { 16, 17, 14, 244, 20, 21, 22, 23, 24, 25, 21, 32, 26, 109, 0, 26, 117, 0, 0, 435, 12, 0, 37, 4, 0, 65, 88, 14, 31, 16, 5, 12, 35, 36, 31, 32, 58, 31, 35, 61, 80, 35, 36, 58, 106, 61, 61, 63, 64, 65, 58, 43, 94, 61, 96, 331, 98, 333, 14, 475, 35, 36, 43, 0, 67, 68, 69, 31, 65, 18, 19, 92, 21, 89, 60, 87, 62, 60, 60, 62, 62, 60, 13, 62, 60, 37, 62, 60, 63, 42, 43, 103, 60, 109, 190, 111, 108, 50, 61, 58, 15, 31, 61, 119, 120, 35, 36, 31, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 31, 140, 16, 104, 105, 13, 31, 60, 57, 148, 61, 150, 149, 31, 13, 15, 31, 152, 63, 153, 35, 36, 24, 162, 161, 60, 165, 37, 60, 163, 169, 37, 171, 41, 173, 62, 44, 45, 46, 47, 48, 49, 41, 177, 57, 44, 45, 46, 47, 48, 49, 31, 32, 192, 57, 35, 36, 158, 31, 32, 31, 66, 201, 36, 35, 36, 167, 168, 64, 170, 60, 172, 211, 212, 213, 214, 215, 178, 302, 180, 57, 51, 52, 53, 54, 55, 60, 56, 452, 59, 57, 53, 231, 37, 60, 234, 235, 236, 237, 238, 239, 240, 241, 242, 28, 29, 30, 31, 32, 33, 34, 35, 36, 31, 38, 280, 31, 282, 253, 62, 259, 60, 261, 258, 62, 269, 50, 51, 52, 51, 52, 53, 54, 55, 14, 15, 16, 61, 31, 63, 24, 65, 61, 67, 68, 69, 285, 286, 431, 432, 433, 434, 287, 60, 60, 294, 295, 296, 297, 57, 5, 53, 54, 55, 5, 66, 305, 9, 31, 37, 309, 6, 311, 60, 5, 66, 62, 110, 32, 318, 258, 335, 425, 28, 29, 30, 31, 32, 33, 34, 35, 36, 331, 38, 333, 261, 336, 364, 311, -1, 335, 308, 161, 333, -1, 50, 51, 52, 166, 348, -1, 350, -1, 348, -1, -1, 61, -1, 63, 356, 65, -1, -1, 360, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 374, -1, -1, -1, -1, 341, 342, -1, -1, -1, -1, -1, 386, -1, -1, 389, -1, -1, -1, -1, 390, -1, 396, 397, 398, 399, 426, -1, -1, -1, -1, -1, 13, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, -1, 418, 419, 420, -1, 422, -1, -1, -1, -1, -1, -1, 429, 430, 38, -1, 428, 41, -1, -1, -1, -1, 46, 47, 48, 49, 469, 51, 52, 53, 54, 55, -1, 450, -1, 59, 453, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, 465, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 476, 38, 13, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 50, 51, 52, 454, 13, -1, -1, 458, 459, 460, 461, 61, -1, 63, -1, 65, -1, 41, -1, -1, 44, 45, 46, 47, 48, 49, -1, -1, 479, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 0, -1, 59, 3, 4, 5, 6, 7, 8, 9, 10, -1, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, -1, -1, -1, 31, 3, 4, 5, 6, 7, 8, 9, 10, 0, -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, -1, 23, 24, 25, 26, 27, -1, 58, -1, 60, 61, 62, 23, 24, 25, 26, 27, -1, -1, 0, 31, -1, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, -1, -1, 60, 31, 62, -1, -1, -1, 46, 47, 48, 49, -1, 51, 52, 53, 54, 55, 11, 12, 13, 59, -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, -1, -1, 22, -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, -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, 197, 3, 4, 5, 6, 7, 8, 9, 10, 23, 24, 25, 26, 27, 89, 91, 100, 103, 104, 108, 110, 123, 128, 129, 130, 132, 133, 135, 137, 140, 60, 83, 31, 92, 93, 199, 105, 106, 199, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 50, 51, 52, 61, 63, 65, 147, 148, 149, 152, 153, 156, 164, 165, 172, 188, 193, 194, 196, 22, 145, 147, 14, 16, 107, 109, 117, 124, 147, 147, 172, 147, 147, 134, 147, 136, 147, 5, 139, 172, 196, 15, 107, 113, 117, 83, 60, 13, 60, 37, 147, 61, 147, 147, 147, 189, 173, 166, 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, 144, 58, 61, 65, 80, 146, 31, 118, 31, 171, 111, 112, 199, 113, 125, 126, 147, 60, 14, 117, 13, 15, 131, 131, 14, 131, 14, 131, 141, 143, 199, 171, 31, 115, 171, 113, 199, 67, 68, 69, 95, 96, 97, 98, 99, 147, 186, 187, 106, 147, 151, 62, 88, 31, 32, 35, 65, 174, 175, 176, 198, 147, 167, 168, 169, 147, 42, 43, 50, 155, 154, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 157, 159, 147, 61, 13, 41, 44, 45, 46, 47, 48, 49, 31, 150, 53, 56, 147, 177, 178, 31, 196, 147, 15, 119, 120, 199, 172, 60, 37, 171, 60, 11, 12, 127, 192, 194, 196, 147, 172, 31, 32, 36, 195, 31, 32, 36, 195, 171, 171, 147, 171, 147, 171, 147, 24, 37, 116, 171, 171, 102, 69, 101, 186, 18, 19, 21, 20, 147, 147, 160, 161, 162, 163, 62, 57, 147, 64, 60, 57, 66, 60, 147, 147, 147, 147, 147, 147, 57, 147, 147, 147, 147, 147, 147, 147, 147, 147, 160, 66, 56, 190, 53, 191, 199, 60, 37, 112, 147, 126, 117, 131, 131, 142, 147, 147, 114, 199, 31, 94, 31, 170, 147, 147, 147, 147, 17, 31, 182, 184, 186, 197, 62, 88, 60, 147, 66, 176, 147, 169, 57, 147, 62, 62, 5, 72, 144, 147, 179, 179, 120, 31, 121, 148, 171, 171, 24, 25, 26, 138, 60, 31, 82, 147, 199, 147, 31, 31, 31, 31, 31, 32, 196, 60, 31, 196, 161, 57, 158, 13, 41, 44, 45, 46, 47, 48, 49, 147, 61, 5, 5, 66, 9, 180, 61, 147, 147, 199, 31, 37, 31, 147, 147, 147, 147, 185, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 6, 181, 122, 138, 131, 172, 147, 147, 184, 184, 184, 184, 182, 183, 62, 60, 147, 66, 160, 147, 171, 171, 171, 171, 171, 60, 5, 147, 62, 131, 182, 147, 171 }; /* 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, 94, 94, 94, 95, 96, 97, 98, 99, 101, 100, 102, 100, 100, 100, 100, 100, 103, 104, 105, 105, 106, 107, 109, 108, 110, 110, 110, 110, 110, 110, 111, 111, 112, 113, 113, 113, 114, 114, 116, 115, 118, 117, 119, 119, 120, 122, 121, 124, 123, 125, 125, 126, 127, 127, 127, 127, 128, 128, 129, 129, 130, 131, 131, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 139, 141, 142, 140, 143, 140, 144, 144, 144, 146, 145, 145, 147, 147, 147, 147, 147, 147, 148, 148, 150, 149, 151, 149, 152, 152, 152, 154, 153, 155, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 157, 158, 156, 159, 156, 160, 160, 161, 162, 161, 163, 163, 164, 164, 166, 165, 167, 167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 173, 172, 174, 174, 174, 175, 175, 176, 176, 176, 176, 177, 177, 178, 178, 179, 179, 179, 179, 179, 180, 180, 180, 181, 181, 182, 182, 182, 182, 183, 183, 184, 185, 184, 184, 184, 184, 186, 186, 186, 187, 187, 188, 188, 188, 188, 188, 189, 188, 188, 188, 188, 190, 188, 191, 188, 192, 192, 193, 193, 194, 194, 194, 194, 194, 195, 195, 195, 196, 196, 197, 197, 198, 198, 199 }; /* 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, 0, 2, 4, 3, 7, 7, 7, 7, 0, 6, 0, 6, 4, 4, 4, 4, 2, 2, 1, 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, 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 564 "grammar.y" { AstNode* node = parser->ast()->createNodeArray(); node->addMember(parser->ast()->createNodeNop()); node->addMember((yyvsp[0].node)); (yyval.node) = node; } #line 2704 "grammar.cpp" break; case 3: /* optional_prune_variable: variable_name "assignment" expression */ #line 570 "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 2716 "grammar.cpp" break; case 4: /* with_collection: "identifier" */ #line 580 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 2724 "grammar.cpp" break; case 5: /* with_collection: bind_parameter_datasource_expected */ #line 583 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 2732 "grammar.cpp" break; case 6: /* with_collection_list: with_collection */ #line 589 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 2741 "grammar.cpp" break; case 7: /* with_collection_list: with_collection_list "," with_collection */ #line 593 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 2750 "grammar.cpp" break; case 8: /* with_collection_list: with_collection_list with_collection */ #line 597 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 2759 "grammar.cpp" break; case 9: /* optional_with: %empty */ #line 604 "grammar.y" { } #line 2766 "grammar.cpp" break; case 10: /* $@1: %empty */ #line 606 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 2775 "grammar.cpp" break; case 11: /* optional_with: "WITH keyword" $@1 with_collection_list */ #line 609 "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 2786 "grammar.cpp" break; case 12: /* queryStart: optional_with query */ #line 618 "grammar.y" { } #line 2793 "grammar.cpp" break; case 13: /* query: optional_statement_block_statements final_statement */ #line 623 "grammar.y" { } #line 2800 "grammar.cpp" break; case 14: /* final_statement: return_statement */ #line 628 "grammar.y" { } #line 2807 "grammar.cpp" break; case 15: /* final_statement: remove_statement */ #line 630 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2815 "grammar.cpp" break; case 16: /* final_statement: insert_statement */ #line 633 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2823 "grammar.cpp" break; case 17: /* final_statement: update_statement */ #line 636 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2831 "grammar.cpp" break; case 18: /* final_statement: replace_statement */ #line 639 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2839 "grammar.cpp" break; case 19: /* final_statement: upsert_statement */ #line 642 "grammar.y" { parser->ast()->scopes()->endNested(); } #line 2847 "grammar.cpp" break; case 20: /* optional_statement_block_statements: %empty */ #line 648 "grammar.y" { } #line 2854 "grammar.cpp" break; case 21: /* optional_statement_block_statements: optional_statement_block_statements statement_block_statement */ #line 650 "grammar.y" { } #line 2861 "grammar.cpp" break; case 22: /* statement_block_statement: for_statement */ #line 655 "grammar.y" { } #line 2868 "grammar.cpp" break; case 23: /* statement_block_statement: let_statement */ #line 657 "grammar.y" { } #line 2875 "grammar.cpp" break; case 24: /* statement_block_statement: filter_statement */ #line 659 "grammar.y" { } #line 2882 "grammar.cpp" break; case 25: /* statement_block_statement: collect_statement */ #line 661 "grammar.y" { } #line 2889 "grammar.cpp" break; case 26: /* statement_block_statement: sort_statement */ #line 663 "grammar.y" { } #line 2896 "grammar.cpp" break; case 27: /* statement_block_statement: limit_statement */ #line 665 "grammar.y" { } #line 2903 "grammar.cpp" break; case 28: /* statement_block_statement: window_statement */ #line 667 "grammar.y" { } #line 2910 "grammar.cpp" break; case 29: /* statement_block_statement: remove_statement */ #line 669 "grammar.y" { } #line 2917 "grammar.cpp" break; case 30: /* statement_block_statement: insert_statement */ #line 671 "grammar.y" { } #line 2924 "grammar.cpp" break; case 31: /* statement_block_statement: update_statement */ #line 673 "grammar.y" { } #line 2931 "grammar.cpp" break; case 32: /* statement_block_statement: replace_statement */ #line 675 "grammar.y" { } #line 2938 "grammar.cpp" break; case 33: /* statement_block_statement: upsert_statement */ #line 677 "grammar.y" { } #line 2945 "grammar.cpp" break; case 34: /* more_output_variables: variable_name */ #line 682 "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 2957 "grammar.cpp" break; case 35: /* more_output_variables: more_output_variables "," variable_name */ #line 689 "grammar.y" { AstNode* node = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); parser->pushArrayElement(node); } #line 2966 "grammar.cpp" break; case 36: /* for_output_variables: more_output_variables */ #line 696 "grammar.y" { (yyval.node) = parser->popArray(); } #line 2974 "grammar.cpp" break; case 37: /* prune_and_options: %empty */ #line 702 "grammar.y" { auto node = static_cast(parser->peekStack()); // Prune node->addMember(parser->ast()->createNodeNop()); // Options node->addMember(parser->ast()->createNodeNop()); } #line 2986 "grammar.cpp" break; case 38: /* prune_and_options: "identifier" optional_prune_variable */ #line 709 "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 3015 "grammar.cpp" break; case 39: /* prune_and_options: "identifier" optional_prune_variable "identifier" object */ #line 733 "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 3040 "grammar.cpp" break; case 40: /* traversal_graph_info: graph_direction_steps expression graph_subject */ #line 756 "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 3055 "grammar.cpp" break; case 41: /* shortest_path_graph_info: graph_direction "SHORTEST_PATH keyword" expression "identifier" expression graph_subject options */ #line 769 "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 3063 "grammar.cpp" break; case 42: /* k_shortest_paths_graph_info: graph_direction "K_SHORTEST_PATHS keyword" expression "identifier" expression graph_subject options */ #line 775 "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 3071 "grammar.cpp" break; case 43: /* k_paths_graph_info: graph_direction_steps "K_PATHS keyword" expression "identifier" expression graph_subject options */ #line 781 "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 3079 "grammar.cpp" break; case 44: /* all_shortest_paths_graph_info: graph_direction "ALL_SHORTEST_PATHS keyword" expression "identifier" expression graph_subject options */ #line 787 "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 3090 "grammar.cpp" break; case 45: /* $@2: %empty */ #line 796 "grammar.y" { AstNode* variablesNode = static_cast((yyvsp[-2].node)); ::checkOutVariables(parser, variablesNode, 1, 1, "Collections and views FOR loops only allow a single return variable", yyloc); 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); // 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 3112 "grammar.cpp" break; case 46: /* for_statement: "FOR declaration" for_output_variables "IN keyword" expression $@2 for_options */ #line 812 "grammar.y" { parser->lazyConditions().popForceInline(); // now we can handle the optional SEARCH condition and OPTIONS. AstNode* variableNode = static_cast(parser->popStack()); Variable* variable = static_cast(variableNode->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); } #line 3159 "grammar.cpp" break; case 47: /* $@3: %empty */ #line 854 "grammar.y" { // Traversal auto variableNamesNode = static_cast((yyvsp[-2].node)); ::checkOutVariables(parser, variableNamesNode, 1, 3, "Traversals only have one, two or three return variables", 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 3181 "grammar.cpp" break; case 48: /* for_statement: "FOR declaration" for_output_variables "IN keyword" traversal_graph_info $@3 prune_and_options */ #line 870 "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 3210 "grammar.cpp" break; case 49: /* for_statement: "FOR declaration" for_output_variables "IN keyword" shortest_path_graph_info */ #line 894 "grammar.y" { // Shortest Path auto variableNamesNode = static_cast((yyvsp[-2].node)); ::checkOutVariables(parser, variableNamesNode, 1, 2, "SHORTEST_PATH must have one or two return variables", 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 3227 "grammar.cpp" break; case 50: /* for_statement: "FOR declaration" for_output_variables "IN keyword" k_shortest_paths_graph_info */ #line 906 "grammar.y" { // K Shortest Paths auto variableNamesNode = static_cast((yyvsp[-2].node)); ::checkOutVariables(parser, variableNamesNode, 1, 1, "K_SHORTEST_PATHS only has one return variable", 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 3244 "grammar.cpp" break; case 51: /* for_statement: "FOR declaration" for_output_variables "IN keyword" k_paths_graph_info */ #line 918 "grammar.y" { // K Paths auto variableNamesNode = static_cast((yyvsp[-2].node)); ::checkOutVariables(parser, variableNamesNode, 1, 1, "K_PATHS only has one return variable", 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 3261 "grammar.cpp" break; case 52: /* for_statement: "FOR declaration" for_output_variables "IN keyword" all_shortest_paths_graph_info */ #line 930 "grammar.y" { // All Shortest Paths auto variableNamesNode = static_cast((yyvsp[-2].node)); ::checkOutVariables(parser, variableNamesNode, 1, 1, "ALL_SHORTEST_PATHS only has one return variable", 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 3278 "grammar.cpp" break; case 53: /* filter_statement: "FILTER declaration" expression */ #line 945 "grammar.y" { // operand is a reference. can use it directly auto node = parser->ast()->createNodeFilter((yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3288 "grammar.cpp" break; case 54: /* let_statement: "LET declaration" let_list */ #line 953 "grammar.y" { } #line 3295 "grammar.cpp" break; case 55: /* let_list: let_element */ #line 958 "grammar.y" { } #line 3302 "grammar.cpp" break; case 56: /* let_list: let_list "," let_element */ #line 960 "grammar.y" { } #line 3309 "grammar.cpp" break; case 57: /* let_element: variable_name "assignment" expression */ #line 965 "grammar.y" { auto node = parser->ast()->createNodeLet((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node), true); parser->ast()->addOperation(node); } #line 3318 "grammar.cpp" break; case 58: /* count_into: "WITH keyword" "identifier" "INTO keyword" variable_name */ #line 972 "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 3331 "grammar.cpp" break; case 59: /* $@4: %empty */ #line 983 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 3340 "grammar.cpp" break; case 60: /* collect_variable_list: "COLLECT declaration" $@4 collect_list */ #line 986 "grammar.y" { auto list = static_cast(parser->popStack()); TRI_ASSERT(list != nullptr); (yyval.node) = list; } #line 3350 "grammar.cpp" break; case 61: /* collect_statement: "COLLECT declaration" count_into options */ #line 994 "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 3365 "grammar.cpp" break; case 62: /* collect_statement: collect_variable_list count_into options */ #line 1004 "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 3383 "grammar.cpp" break; case 63: /* collect_statement: "COLLECT declaration" aggregate collect_optional_into options */ #line 1017 "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 3412 "grammar.cpp" break; case 64: /* collect_statement: collect_variable_list aggregate collect_optional_into options */ #line 1041 "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 3472 "grammar.cpp" break; case 65: /* collect_statement: collect_variable_list collect_optional_into options */ #line 1096 "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 3496 "grammar.cpp" break; case 66: /* collect_statement: collect_variable_list collect_optional_into keep options */ #line 1115 "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 3529 "grammar.cpp" break; case 67: /* collect_list: collect_element */ #line 1146 "grammar.y" { } #line 3536 "grammar.cpp" break; case 68: /* collect_list: collect_list "," collect_element */ #line 1148 "grammar.y" { } #line 3543 "grammar.cpp" break; case 69: /* collect_element: variable_name "assignment" expression */ #line 1153 "grammar.y" { auto node = parser->ast()->createNodeAssign((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); parser->pushArrayElement(node); } #line 3552 "grammar.cpp" break; case 70: /* collect_optional_into: %empty */ #line 1160 "grammar.y" { (yyval.node) = nullptr; } #line 3560 "grammar.cpp" break; case 71: /* collect_optional_into: "INTO keyword" variable_name */ #line 1163 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 3568 "grammar.cpp" break; case 72: /* collect_optional_into: "INTO keyword" variable_name "assignment" expression */ #line 1166 "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 3579 "grammar.cpp" break; case 73: /* variable_list: variable_name */ #line 1175 "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 3597 "grammar.cpp" break; case 74: /* variable_list: variable_list "," variable_name */ #line 1188 "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 3615 "grammar.cpp" break; case 75: /* $@5: %empty */ #line 1204 "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 3629 "grammar.cpp" break; case 76: /* keep: "identifier" $@5 variable_list */ #line 1212 "grammar.y" { auto list = static_cast(parser->popStack()); (yyval.node) = list; } #line 3638 "grammar.cpp" break; case 77: /* $@6: %empty */ #line 1219 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 3647 "grammar.cpp" break; case 78: /* aggregate: "AGGREGATE keyword" $@6 aggregate_list */ #line 1222 "grammar.y" { auto list = static_cast(parser->popStack()); (yyval.node) = list; } #line 3656 "grammar.cpp" break; case 79: /* aggregate_list: aggregate_element */ #line 1229 "grammar.y" { } #line 3663 "grammar.cpp" break; case 80: /* aggregate_list: aggregate_list "," aggregate_element */ #line 1231 "grammar.y" { } #line 3670 "grammar.cpp" break; case 81: /* aggregate_element: variable_name "assignment" aggregate_function_call */ #line 1236 "grammar.y" { auto node = parser->ast()->createNodeAssign((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); parser->pushArrayElement(node); } #line 3679 "grammar.cpp" break; case 82: /* $@7: %empty */ #line 1243 "grammar.y" { parser->pushStack((yyvsp[-1].strval).value); auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 3689 "grammar.cpp" break; case 83: /* aggregate_function_call: function_name "(" $@7 optional_function_call_arguments ")" */ #line 1247 "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 3699 "grammar.cpp" break; case 84: /* $@8: %empty */ #line 1255 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); } #line 3708 "grammar.cpp" break; case 85: /* sort_statement: "SORT declaration" $@8 sort_list */ #line 1258 "grammar.y" { auto list = static_cast(parser->popStack()); auto node = parser->ast()->createNodeSort(list); parser->ast()->addOperation(node); } #line 3718 "grammar.cpp" break; case 86: /* sort_list: sort_element */ #line 1266 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 3726 "grammar.cpp" break; case 87: /* sort_list: sort_list "," sort_element */ #line 1269 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 3734 "grammar.cpp" break; case 88: /* sort_element: expression sort_direction */ #line 1275 "grammar.y" { (yyval.node) = parser->ast()->createNodeSortElement((yyvsp[-1].node), (yyvsp[0].node)); } #line 3742 "grammar.cpp" break; case 89: /* sort_direction: %empty */ #line 1281 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(true); } #line 3750 "grammar.cpp" break; case 90: /* sort_direction: "ASC keyword" */ #line 1284 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(true); } #line 3758 "grammar.cpp" break; case 91: /* sort_direction: "DESC keyword" */ #line 1287 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(false); } #line 3766 "grammar.cpp" break; case 92: /* sort_direction: simple_value */ #line 1290 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 3774 "grammar.cpp" break; case 93: /* limit_statement: "LIMIT declaration" expression */ #line 1296 "grammar.y" { auto offset = parser->ast()->createNodeValueInt(0); auto node = parser->ast()->createNodeLimit(offset, (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3784 "grammar.cpp" break; case 94: /* limit_statement: "LIMIT declaration" expression "," expression */ #line 1301 "grammar.y" { auto node = parser->ast()->createNodeLimit((yyvsp[-2].node), (yyvsp[0].node)); parser->ast()->addOperation(node); } #line 3793 "grammar.cpp" break; case 95: /* window_statement: "WINDOW declaration" object aggregate */ #line 1308 "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 3813 "grammar.cpp" break; case 96: /* window_statement: "WINDOW declaration" expression "WITH keyword" object aggregate */ #line 1323 "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 3833 "grammar.cpp" break; case 97: /* return_statement: "RETURN declaration" distinct_expression */ #line 1341 "grammar.y" { auto node = parser->ast()->createNodeReturn((yyvsp[0].node)); parser->ast()->addOperation(node); parser->ast()->scopes()->endNested(); } #line 3843 "grammar.cpp" break; case 98: /* in_or_into_collection: "IN keyword" in_or_into_collection_name */ #line 1349 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 3851 "grammar.cpp" break; case 99: /* in_or_into_collection: "INTO keyword" in_or_into_collection_name */ #line 1352 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 3859 "grammar.cpp" break; case 100: /* remove_statement: "REMOVE command" expression in_or_into_collection options */ #line 1358 "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 3871 "grammar.cpp" break; case 101: /* insert_statement: "INSERT command" expression in_or_into_collection options */ #line 1368 "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 3883 "grammar.cpp" break; case 102: /* update_parameters: expression in_or_into_collection options */ #line 1378 "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 3896 "grammar.cpp" break; case 103: /* update_parameters: expression "WITH keyword" expression in_or_into_collection options */ #line 1386 "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 3909 "grammar.cpp" break; case 104: /* update_statement: "UPDATE command" update_parameters */ #line 1397 "grammar.y" { } #line 3916 "grammar.cpp" break; case 105: /* replace_parameters: expression in_or_into_collection options */ #line 1402 "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 3929 "grammar.cpp" break; case 106: /* replace_parameters: expression "WITH keyword" expression in_or_into_collection options */ #line 1410 "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 3942 "grammar.cpp" break; case 107: /* replace_statement: "REPLACE command" replace_parameters */ #line 1421 "grammar.y" { } #line 3949 "grammar.cpp" break; case 108: /* update_or_replace: "UPDATE command" */ #line 1426 "grammar.y" { (yyval.intval) = static_cast(NODE_TYPE_UPDATE); } #line 3957 "grammar.cpp" break; case 109: /* update_or_replace: "REPLACE command" */ #line 1429 "grammar.y" { (yyval.intval) = static_cast(NODE_TYPE_REPLACE); } #line 3965 "grammar.cpp" break; case 110: /* upsert_input: object */ #line 1435 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 3973 "grammar.cpp" break; case 111: /* upsert_input: bind_parameter */ #line 1438 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 3981 "grammar.cpp" break; case 112: /* $@9: %empty */ #line 1444 "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 4003 "grammar.cpp" break; case 113: /* $@10: %empty */ #line 1460 "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 4040 "grammar.cpp" break; case 114: /* upsert_statement: "UPSERT command" "FILTER declaration" $@9 expression $@10 "INSERT command" expression update_or_replace expression in_or_into_collection options */ #line 1491 "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 4061 "grammar.cpp" break; case 115: /* $@11: %empty */ #line 1507 "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 4107 "grammar.cpp" break; case 116: /* upsert_statement: "UPSERT command" upsert_input $@11 "INSERT command" expression update_or_replace expression in_or_into_collection options */ #line 1547 "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 4128 "grammar.cpp" break; case 117: /* quantifier: "all modifier" */ #line 1566 "grammar.y" { (yyval.node) = parser->ast()->createNodeQuantifier(Quantifier::Type::kAll); } #line 4136 "grammar.cpp" break; case 118: /* quantifier: "any modifier" */ #line 1569 "grammar.y" { (yyval.node) = parser->ast()->createNodeQuantifier(Quantifier::Type::kAny); } #line 4144 "grammar.cpp" break; case 119: /* quantifier: "none modifier" */ #line 1572 "grammar.y" { (yyval.node) = parser->ast()->createNodeQuantifier(Quantifier::Type::kNone); } #line 4152 "grammar.cpp" break; case 120: /* $@12: %empty */ #line 1578 "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 4165 "grammar.cpp" break; case 121: /* distinct_expression: "DISTINCT modifier" $@12 expression */ #line 1585 "grammar.y" { (yyval.node) = parser->ast()->createNodeDistinct((yyvsp[0].node)); } #line 4173 "grammar.cpp" break; case 122: /* distinct_expression: expression */ #line 1588 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4181 "grammar.cpp" break; case 123: /* expression: operator_unary */ #line 1594 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4189 "grammar.cpp" break; case 124: /* expression: operator_binary */ #line 1597 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4197 "grammar.cpp" break; case 125: /* expression: operator_ternary */ #line 1600 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4205 "grammar.cpp" break; case 126: /* expression: value_literal */ #line 1603 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4213 "grammar.cpp" break; case 127: /* expression: reference */ #line 1606 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4221 "grammar.cpp" break; case 128: /* expression: expression ".." expression */ #line 1609 "grammar.y" { (yyval.node) = parser->ast()->createNodeRange((yyvsp[-2].node), (yyvsp[0].node)); } #line 4229 "grammar.cpp" break; case 129: /* function_name: "identifier" */ #line 1615 "grammar.y" { (yyval.strval) = (yyvsp[0].strval); } #line 4237 "grammar.cpp" break; case 130: /* function_name: function_name "::" "identifier" */ #line 1618 "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 4252 "grammar.cpp" break; case 131: /* $@13: %empty */ #line 1631 "grammar.y" { auto args = parser->ast()->createNodeArray(); parser->pushStack(args); } #line 4261 "grammar.cpp" break; case 132: /* function_call: function_name "(" $@13 optional_function_call_arguments ")" */ #line 1634 "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 4270 "grammar.cpp" break; case 133: /* $@14: %empty */ #line 1638 "grammar.y" { auto args = parser->ast()->createNodeArray(); parser->pushStack(args); } #line 4279 "grammar.cpp" break; case 134: /* function_call: "like operator" "(" $@14 optional_function_call_arguments ")" */ #line 1641 "grammar.y" { auto args = static_cast(parser->popStack()); (yyval.node) = parser->ast()->createNodeFunctionCall("LIKE", args, false); } #line 4288 "grammar.cpp" break; case 135: /* operator_unary: "+ operator" expression */ #line 1648 "grammar.y" { (yyval.node) = parser->ast()->optimizeUnaryOperatorArithmetic(parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_PLUS, (yyvsp[0].node))); } #line 4296 "grammar.cpp" break; case 136: /* operator_unary: "- operator" expression */ #line 1651 "grammar.y" { (yyval.node) = parser->ast()->optimizeUnaryOperatorArithmetic(parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_MINUS, (yyvsp[0].node))); } #line 4304 "grammar.cpp" break; case 137: /* operator_unary: "not operator" expression */ #line 1654 "grammar.y" { (yyval.node) = parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_NOT, (yyvsp[0].node)); } #line 4312 "grammar.cpp" break; case 138: /* $@15: %empty */ #line 1660 "grammar.y" { parser->lazyConditions().push((yyvsp[-1].node), /*negated*/ true); } #line 4320 "grammar.cpp" break; case 139: /* operator_binary: expression "or operator" $@15 expression */ #line 1662 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_OR, previous.condition, (yyvsp[0].node)); } #line 4329 "grammar.cpp" break; case 140: /* $@16: %empty */ #line 1666 "grammar.y" { parser->lazyConditions().push((yyvsp[-1].node), /*negated*/ false); } #line 4337 "grammar.cpp" break; case 141: /* operator_binary: expression "and operator" $@16 expression */ #line 1668 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_AND, previous.condition, (yyvsp[0].node)); } #line 4346 "grammar.cpp" break; case 142: /* operator_binary: expression "+ operator" expression */ #line 1672 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_PLUS, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4354 "grammar.cpp" break; case 143: /* operator_binary: expression "- operator" expression */ #line 1675 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_MINUS, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4362 "grammar.cpp" break; case 144: /* operator_binary: expression "* operator" expression */ #line 1678 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_TIMES, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4370 "grammar.cpp" break; case 145: /* operator_binary: expression "/ operator" expression */ #line 1681 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_DIV, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4378 "grammar.cpp" break; case 146: /* operator_binary: expression "% operator" expression */ #line 1684 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_MOD, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4386 "grammar.cpp" break; case 147: /* operator_binary: expression "== operator" expression */ #line 1687 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_EQ, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4394 "grammar.cpp" break; case 148: /* operator_binary: expression "!= operator" expression */ #line 1690 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_NE, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4402 "grammar.cpp" break; case 149: /* operator_binary: expression "< operator" expression */ #line 1693 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_LT, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4410 "grammar.cpp" break; case 150: /* operator_binary: expression "> operator" expression */ #line 1696 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_GT, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4418 "grammar.cpp" break; case 151: /* operator_binary: expression "<= operator" expression */ #line 1699 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_LE, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4426 "grammar.cpp" break; case 152: /* operator_binary: expression ">= operator" expression */ #line 1702 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_GE, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4434 "grammar.cpp" break; case 153: /* operator_binary: expression "IN keyword" expression */ #line 1705 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_IN, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4442 "grammar.cpp" break; case 154: /* operator_binary: expression "not in operator" expression */ #line 1708 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_NIN, (yyvsp[-2].node), (yyvsp[0].node)); } #line 4450 "grammar.cpp" break; case 155: /* operator_binary: expression "not operator" "like operator" expression */ #line 1711 "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 4462 "grammar.cpp" break; case 156: /* operator_binary: expression "not operator" "~= operator" expression */ #line 1718 "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 4474 "grammar.cpp" break; case 157: /* operator_binary: expression "not operator" "~! operator" expression */ #line 1725 "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 4485 "grammar.cpp" break; case 158: /* operator_binary: expression "like operator" expression */ #line 1731 "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 4496 "grammar.cpp" break; case 159: /* operator_binary: expression "~= operator" expression */ #line 1737 "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 4507 "grammar.cpp" break; case 160: /* operator_binary: expression "~! operator" expression */ #line 1743 "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 4519 "grammar.cpp" break; case 161: /* operator_binary: expression quantifier "== operator" expression */ #line 1750 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_EQ, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4527 "grammar.cpp" break; case 162: /* operator_binary: expression quantifier "!= operator" expression */ #line 1753 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_NE, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4535 "grammar.cpp" break; case 163: /* operator_binary: expression quantifier "< operator" expression */ #line 1756 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_LT, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4543 "grammar.cpp" break; case 164: /* operator_binary: expression quantifier "> operator" expression */ #line 1759 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_GT, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4551 "grammar.cpp" break; case 165: /* operator_binary: expression quantifier "<= operator" expression */ #line 1762 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_LE, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4559 "grammar.cpp" break; case 166: /* operator_binary: expression quantifier ">= operator" expression */ #line 1765 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_GE, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4567 "grammar.cpp" break; case 167: /* operator_binary: expression quantifier "IN keyword" expression */ #line 1768 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_IN, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4575 "grammar.cpp" break; case 168: /* operator_binary: expression quantifier "not in operator" expression */ #line 1771 "grammar.y" { (yyval.node) = parser->ast()->createNodeBinaryArrayOperator(NODE_TYPE_OPERATOR_BINARY_ARRAY_NIN, (yyvsp[-3].node), (yyvsp[0].node), (yyvsp[-2].node)); } #line 4583 "grammar.cpp" break; case 169: /* operator_binary: expression "at least modifier" "(" expression ")" "== operator" expression */ #line 1774 "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 4592 "grammar.cpp" break; case 170: /* operator_binary: expression "at least modifier" "(" expression ")" "!= operator" expression */ #line 1778 "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 4601 "grammar.cpp" break; case 171: /* operator_binary: expression "at least modifier" "(" expression ")" "< operator" expression */ #line 1782 "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 4610 "grammar.cpp" break; case 172: /* operator_binary: expression "at least modifier" "(" expression ")" "> operator" expression */ #line 1786 "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 4619 "grammar.cpp" break; case 173: /* operator_binary: expression "at least modifier" "(" expression ")" "<= operator" expression */ #line 1790 "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 4628 "grammar.cpp" break; case 174: /* operator_binary: expression "at least modifier" "(" expression ")" ">= operator" expression */ #line 1794 "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 4637 "grammar.cpp" break; case 175: /* operator_binary: expression "at least modifier" "(" expression ")" "IN keyword" expression */ #line 1798 "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 4646 "grammar.cpp" break; case 176: /* operator_binary: expression "at least modifier" "(" expression ")" "not in operator" expression */ #line 1802 "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 4655 "grammar.cpp" break; case 177: /* $@17: %empty */ #line 1809 "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 4697 "grammar.cpp" break; case 178: /* $@18: %empty */ #line 1845 "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 4707 "grammar.cpp" break; case 179: /* operator_ternary: expression "?" $@17 expression ":" $@18 expression */ #line 1849 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); (yyval.node) = parser->ast()->createNodeTernaryOperator(previous.condition, (yyvsp[-3].node), (yyvsp[0].node)); } #line 4716 "grammar.cpp" break; case 180: /* $@19: %empty */ #line 1853 "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 4748 "grammar.cpp" break; case 181: /* operator_ternary: expression "?" $@19 ":" expression */ #line 1879 "grammar.y" { LazyCondition previous = parser->lazyConditions().pop(); (yyval.node) = parser->ast()->createNodeTernaryOperator(previous.condition, (yyvsp[0].node)); } #line 4757 "grammar.cpp" break; case 182: /* optional_function_call_arguments: %empty */ #line 1886 "grammar.y" { } #line 4764 "grammar.cpp" break; case 183: /* optional_function_call_arguments: function_arguments_list */ #line 1888 "grammar.y" { } #line 4771 "grammar.cpp" break; case 184: /* expression_or_query: expression */ #line 1893 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4779 "grammar.cpp" break; case 185: /* $@20: %empty */ #line 1896 "grammar.y" { parser->lazyConditions().flushAssignments(); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_SUBQUERY); parser->ast()->startSubQuery(); parser->lazyConditions().flushFilters(); } #line 4792 "grammar.cpp" break; case 186: /* expression_or_query: $@20 query */ #line 1903 "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 4807 "grammar.cpp" break; case 187: /* function_arguments_list: expression_or_query */ #line 1916 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 4815 "grammar.cpp" break; case 188: /* function_arguments_list: function_arguments_list "," expression_or_query */ #line 1919 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 4823 "grammar.cpp" break; case 189: /* compound_value: array */ #line 1925 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4831 "grammar.cpp" break; case 190: /* compound_value: object */ #line 1928 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 4839 "grammar.cpp" break; case 191: /* $@21: %empty */ #line 1934 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushArray(node); } #line 4848 "grammar.cpp" break; case 192: /* array: "[" $@21 optional_array_elements "]" */ #line 1937 "grammar.y" { (yyval.node) = parser->popArray(); } #line 4856 "grammar.cpp" break; case 193: /* optional_array_elements: %empty */ #line 1943 "grammar.y" { } #line 4863 "grammar.cpp" break; case 194: /* optional_array_elements: array_elements_list */ #line 1945 "grammar.y" { } #line 4870 "grammar.cpp" break; case 195: /* optional_array_elements: array_elements_list "," */ #line 1947 "grammar.y" { } #line 4877 "grammar.cpp" break; case 196: /* array_elements_list: array_element */ #line 1952 "grammar.y" { } #line 4884 "grammar.cpp" break; case 197: /* array_elements_list: array_elements_list "," array_element */ #line 1954 "grammar.y" { } #line 4891 "grammar.cpp" break; case 198: /* array_element: expression */ #line 1959 "grammar.y" { parser->pushArrayElement((yyvsp[0].node)); } #line 4899 "grammar.cpp" break; case 199: /* for_options: %empty */ #line 1965 "grammar.y" { (yyval.node) = nullptr; } #line 4907 "grammar.cpp" break; case 200: /* for_options: "identifier" expression */ #line 1968 "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 4937 "grammar.cpp" break; case 201: /* for_options: "identifier" expression "identifier" expression */ #line 1993 "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 4959 "grammar.cpp" break; case 202: /* options: %empty */ #line 2013 "grammar.y" { (yyval.node) = nullptr; } #line 4967 "grammar.cpp" break; case 203: /* options: "identifier" object */ #line 2016 "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 4984 "grammar.cpp" break; case 204: /* $@22: %empty */ #line 2031 "grammar.y" { auto node = parser->ast()->createNodeObject(); parser->pushStack(node); } #line 4993 "grammar.cpp" break; case 205: /* object: "{" $@22 optional_object_elements "}" */ #line 2034 "grammar.y" { (yyval.node) = static_cast(parser->popStack()); } #line 5001 "grammar.cpp" break; case 206: /* optional_object_elements: %empty */ #line 2040 "grammar.y" { } #line 5008 "grammar.cpp" break; case 207: /* optional_object_elements: object_elements_list */ #line 2042 "grammar.y" { } #line 5015 "grammar.cpp" break; case 208: /* optional_object_elements: object_elements_list "," */ #line 2044 "grammar.y" { } #line 5022 "grammar.cpp" break; case 209: /* object_elements_list: object_element */ #line 2049 "grammar.y" { } #line 5029 "grammar.cpp" break; case 210: /* object_elements_list: object_elements_list "," object_element */ #line 2051 "grammar.y" { } #line 5036 "grammar.cpp" break; case 211: /* object_element: "identifier" */ #line 2056 "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 5057 "grammar.cpp" break; case 212: /* object_element: object_element_name ":" expression */ #line 2072 "grammar.y" { // attribute-name : attribute-value parser->pushObjectElement((yyvsp[-2].strval).value, (yyvsp[-2].strval).length, (yyvsp[0].node)); } #line 5066 "grammar.cpp" break; case 213: /* object_element: "bind parameter" ":" expression */ #line 2076 "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 5081 "grammar.cpp" break; case 214: /* object_element: "[" expression "]" ":" expression */ #line 2086 "grammar.y" { // [ attribute-name-expression ] : attribute-value parser->pushObjectElement((yyvsp[-3].node), (yyvsp[0].node)); } #line 5090 "grammar.cpp" break; case 215: /* array_filter_operator: "?" */ #line 2093 "grammar.y" { (yyval.intval) = 1; } #line 5098 "grammar.cpp" break; case 216: /* array_filter_operator: array_filter_operator "?" */ #line 2096 "grammar.y" { (yyval.intval) = (yyvsp[-1].intval) + 1; } #line 5106 "grammar.cpp" break; case 217: /* array_map_operator: "* operator" */ #line 2102 "grammar.y" { (yyval.intval) = 1; } #line 5114 "grammar.cpp" break; case 218: /* array_map_operator: array_map_operator "* operator" */ #line 2105 "grammar.y" { (yyval.intval) = (yyvsp[-1].intval) + 1; } #line 5122 "grammar.cpp" break; case 219: /* optional_array_filter: %empty */ #line 2111 "grammar.y" { (yyval.node) = nullptr; } #line 5130 "grammar.cpp" break; case 220: /* optional_array_filter: "FILTER declaration" expression */ #line 2114 "grammar.y" { // FILTER filter-condition (yyval.node) = parser->ast()->createNodeArrayFilter(nullptr, (yyvsp[0].node)); } #line 5139 "grammar.cpp" break; case 221: /* optional_array_filter: quantifier "FILTER declaration" expression */ #line 2118 "grammar.y" { // ALL|ANY|NONE|AT LEAST FILTER filter-condition (yyval.node) = parser->ast()->createNodeArrayFilter((yyvsp[-2].node), (yyvsp[0].node)); } #line 5148 "grammar.cpp" break; case 222: /* optional_array_filter: "at least modifier" "(" expression ")" "FILTER declaration" expression */ #line 2122 "grammar.y" { AstNode* quantifier = parser->ast()->createNodeQuantifier(Quantifier::Type::kAtLeast, (yyvsp[-3].node)); (yyval.node) = parser->ast()->createNodeArrayFilter(quantifier, (yyvsp[0].node)); } #line 5157 "grammar.cpp" break; case 223: /* optional_array_filter: expression "FILTER declaration" expression */ #line 2126 "grammar.y" { // 1 FILTER filter-condition // 2..5 FILTER filter-condition (yyval.node) = parser->ast()->createNodeArrayFilter((yyvsp[-2].node), (yyvsp[0].node)); } #line 5167 "grammar.cpp" break; case 224: /* optional_array_limit: %empty */ #line 2134 "grammar.y" { (yyval.node) = nullptr; } #line 5175 "grammar.cpp" break; case 225: /* optional_array_limit: "LIMIT declaration" expression */ #line 2137 "grammar.y" { (yyval.node) = parser->ast()->createNodeArrayLimit(nullptr, (yyvsp[0].node)); } #line 5183 "grammar.cpp" break; case 226: /* optional_array_limit: "LIMIT declaration" expression "," expression */ #line 2140 "grammar.y" { (yyval.node) = parser->ast()->createNodeArrayLimit((yyvsp[-2].node), (yyvsp[0].node)); } #line 5191 "grammar.cpp" break; case 227: /* optional_array_return: %empty */ #line 2146 "grammar.y" { (yyval.node) = nullptr; } #line 5199 "grammar.cpp" break; case 228: /* optional_array_return: "RETURN declaration" expression */ #line 2149 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5207 "grammar.cpp" break; case 229: /* graph_collection: "identifier" */ #line 2155 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 5215 "grammar.cpp" break; case 230: /* graph_collection: bind_parameter_datasource_expected */ #line 2158 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5223 "grammar.cpp" break; case 231: /* graph_collection: graph_direction "identifier" */ #line 2161 "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 5232 "grammar.cpp" break; case 232: /* graph_collection: graph_direction bind_parameter */ #line 2165 "grammar.y" { (yyval.node) = parser->ast()->createNodeCollectionDirection((yyvsp[-1].intval), (yyvsp[0].node)); } #line 5240 "grammar.cpp" break; case 233: /* graph_collection_list: graph_collection */ #line 2171 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 5249 "grammar.cpp" break; case 234: /* graph_collection_list: graph_collection_list "," graph_collection */ #line 2175 "grammar.y" { auto node = static_cast(parser->peekStack()); node->addMember((yyvsp[0].node)); } #line 5258 "grammar.cpp" break; case 235: /* graph_subject: graph_collection */ #line 2182 "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 5269 "grammar.cpp" break; case 236: /* $@23: %empty */ #line 2188 "grammar.y" { auto node = parser->ast()->createNodeArray(); parser->pushStack(node); node->addMember((yyvsp[-1].node)); } #line 5279 "grammar.cpp" break; case 237: /* graph_subject: graph_collection "," $@23 graph_collection_list */ #line 2192 "grammar.y" { auto node = static_cast(parser->popStack()); auto const& resolver = parser->query().resolver(); (yyval.node) = parser->ast()->createNodeCollectionList(node, resolver); } #line 5289 "grammar.cpp" break; case 238: /* graph_subject: "GRAPH keyword" bind_parameter */ #line 2197 "grammar.y" { // graph name (yyval.node) = (yyvsp[0].node); } #line 5298 "grammar.cpp" break; case 239: /* graph_subject: "GRAPH keyword" "quoted string" */ #line 2201 "grammar.y" { // graph name (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 5307 "grammar.cpp" break; case 240: /* graph_subject: "GRAPH keyword" "identifier" */ #line 2205 "grammar.y" { // graph name (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 5316 "grammar.cpp" break; case 241: /* graph_direction: "outbound modifier" */ #line 2214 "grammar.y" { (yyval.intval) = 2; } #line 5324 "grammar.cpp" break; case 242: /* graph_direction: "inbound modifier" */ #line 2217 "grammar.y" { (yyval.intval) = 1; } #line 5332 "grammar.cpp" break; case 243: /* graph_direction: "any modifier" */ #line 2220 "grammar.y" { (yyval.intval) = 0; } #line 5340 "grammar.cpp" break; case 244: /* graph_direction_steps: graph_direction */ #line 2226 "grammar.y" { (yyval.node) = parser->ast()->createNodeDirection((yyvsp[0].intval), 1); } #line 5348 "grammar.cpp" break; case 245: /* graph_direction_steps: expression graph_direction */ #line 2229 "grammar.y" { (yyval.node) = parser->ast()->createNodeDirection((yyvsp[0].intval), (yyvsp[-1].node)); } #line 5356 "grammar.cpp" break; case 246: /* reference: "identifier" */ #line 2235 "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 5393 "grammar.cpp" break; case 247: /* reference: compound_value */ #line 2267 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5401 "grammar.cpp" break; case 248: /* reference: bind_parameter */ #line 2270 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5409 "grammar.cpp" break; case 249: /* reference: function_call */ #line 2273 "grammar.y" { TRI_ASSERT((yyvsp[0].node) != nullptr); (yyval.node) = (yyvsp[0].node); } #line 5418 "grammar.cpp" break; case 250: /* reference: "(" expression ")" */ #line 2277 "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 5432 "grammar.cpp" break; case 251: /* $@24: %empty */ #line 2286 "grammar.y" { parser->lazyConditions().flushAssignments(); parser->ast()->scopes()->start(arangodb::aql::AQL_SCOPE_SUBQUERY); parser->ast()->startSubQuery(); parser->lazyConditions().flushFilters(); } #line 5445 "grammar.cpp" break; case 252: /* reference: "(" $@24 query ")" */ #line 2293 "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 5460 "grammar.cpp" break; case 253: /* reference: reference '.' "identifier" */ #line 2303 "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 5480 "grammar.cpp" break; case 254: /* reference: reference '.' bind_parameter */ #line 2318 "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 5498 "grammar.cpp" break; case 255: /* reference: reference "[" expression "]" */ #line 2331 "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 5516 "grammar.cpp" break; case 256: /* $@25: %empty */ #line 2344 "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 5548 "grammar.cpp" break; case 257: /* reference: reference "[" array_filter_operator $@25 optional_array_filter "]" */ #line 2370 "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 5572 "grammar.cpp" break; case 258: /* $@26: %empty */ #line 2389 "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 5604 "grammar.cpp" break; case 259: /* reference: reference "[" array_map_operator $@26 optional_array_filter optional_array_limit optional_array_return "]" */ #line 2415 "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 5638 "grammar.cpp" break; case 260: /* simple_value: value_literal */ #line 2447 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5646 "grammar.cpp" break; case 261: /* simple_value: bind_parameter */ #line 2450 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5654 "grammar.cpp" break; case 262: /* numeric_value: "integer number" */ #line 2456 "grammar.y" { TRI_ASSERT((yyvsp[0].node) != nullptr); (yyval.node) = (yyvsp[0].node); } #line 5663 "grammar.cpp" break; case 263: /* numeric_value: "number" */ #line 2460 "grammar.y" { TRI_ASSERT((yyvsp[0].node) != nullptr); (yyval.node) = (yyvsp[0].node); } #line 5672 "grammar.cpp" break; case 264: /* value_literal: "quoted string" */ #line 2467 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueString((yyvsp[0].strval).value, (yyvsp[0].strval).length); } #line 5680 "grammar.cpp" break; case 265: /* value_literal: numeric_value */ #line 2470 "grammar.y" { (yyval.node) = (yyvsp[0].node); } #line 5688 "grammar.cpp" break; case 266: /* value_literal: "null" */ #line 2473 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueNull(); } #line 5696 "grammar.cpp" break; case 267: /* value_literal: "true" */ #line 2476 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(true); } #line 5704 "grammar.cpp" break; case 268: /* value_literal: "false" */ #line 2479 "grammar.y" { (yyval.node) = parser->ast()->createNodeValueBool(false); } #line 5712 "grammar.cpp" break; case 269: /* in_or_into_collection_name: "identifier" */ #line 2485 "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 5722 "grammar.cpp" break; case 270: /* in_or_into_collection_name: "quoted string" */ #line 2490 "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 5732 "grammar.cpp" break; case 271: /* in_or_into_collection_name: "bind data source parameter" */ #line 2495 "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 5745 "grammar.cpp" break; case 272: /* bind_parameter: "bind data source parameter" */ #line 2506 "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 5758 "grammar.cpp" break; case 273: /* bind_parameter: "bind parameter" */ #line 2514 "grammar.y" { std::string_view name((yyvsp[0].strval).value, (yyvsp[0].strval).length); (yyval.node) = parser->ast()->createNodeParameter(name); } #line 5767 "grammar.cpp" break; case 274: /* bind_parameter_datasource_expected: "bind data source parameter" */ #line 2521 "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 5780 "grammar.cpp" break; case 275: /* bind_parameter_datasource_expected: "bind parameter" */ #line 2529 "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 5790 "grammar.cpp" break; case 276: /* object_element_name: "identifier" */ #line 2537 "grammar.y" { (yyval.strval) = (yyvsp[0].strval); } #line 5798 "grammar.cpp" break; case 277: /* object_element_name: "quoted string" */ #line 2540 "grammar.y" { (yyval.strval) = (yyvsp[0].strval); } #line 5806 "grammar.cpp" break; case 278: /* variable_name: "identifier" */ #line 2545 "grammar.y" { (yyval.strval) = (yyvsp[0].strval); } #line 5814 "grammar.cpp" break; #line 5818 "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; }