diff options
author | Nick Zolnierz <nicholas.zolnierz@mongodb.com> | 2020-08-31 14:25:25 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-08 14:19:50 +0000 |
commit | f265019ab76d4a73e19e3300b9e52bc927cc6bbe (patch) | |
tree | d4668055ceb95e99b025cbdd1f3517e68b0d88fa /src/mongo/db/cst | |
parent | 936b49351e74b9c12d5730b175dedabc94fe5a59 (diff) | |
download | mongo-f265019ab76d4a73e19e3300b9e52bc927cc6bbe.tar.gz |
SERVER-50642 Move to generic grammar.yy and avoid constructing vector of BSONElements in lexer
Diffstat (limited to 'src/mongo/db/cst')
-rw-r--r-- | src/mongo/db/cst/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/db/cst/bson_lexer.cpp | 330 | ||||
-rw-r--r-- | src/mongo/db/cst/bson_lexer.h | 15 | ||||
-rw-r--r-- | src/mongo/db/cst/bson_lexer_test.cpp | 315 | ||||
-rwxr-xr-x | src/mongo/db/cst/cst_error_test.cpp | 82 | ||||
-rwxr-xr-x | src/mongo/db/cst/cst_expression_test.cpp | 110 | ||||
-rw-r--r-- | src/mongo/db/cst/cst_test.cpp | 234 | ||||
-rw-r--r-- | src/mongo/db/cst/grammar.yy (renamed from src/mongo/db/cst/pipeline_grammar.yy) | 36 | ||||
-rw-r--r-- | src/mongo/db/cst/parser_gen.cpp | 6165 | ||||
-rw-r--r-- | src/mongo/db/cst/parser_gen.hpp (renamed from src/mongo/db/cst/pipeline_parser_gen.hpp) | 2477 | ||||
-rw-r--r-- | src/mongo/db/cst/pipeline_parser_gen.cpp | 6219 |
11 files changed, 7767 insertions, 8218 deletions
diff --git a/src/mongo/db/cst/SConscript b/src/mongo/db/cst/SConscript index 1f17c8ddc06..8077cce2ce7 100644 --- a/src/mongo/db/cst/SConscript +++ b/src/mongo/db/cst/SConscript @@ -14,8 +14,8 @@ env.Library( 'c_node.cpp', 'c_node_validation.cpp', 'c_node_disambiguation.cpp', - 'pipeline_parser_gen.cpp', 'cst_sort_translation.cpp', + 'parser_gen.cpp', ], LIBDEPS=[ "$BUILD_DIR/mongo/base", diff --git a/src/mongo/db/cst/bson_lexer.cpp b/src/mongo/db/cst/bson_lexer.cpp index 5fccfac805f..dbce1618749 100644 --- a/src/mongo/db/cst/bson_lexer.cpp +++ b/src/mongo/db/cst/bson_lexer.cpp @@ -31,7 +31,7 @@ #include "mongo/base/string_data.h" #include "mongo/db/cst/bson_lexer.h" -#include "mongo/db/cst/pipeline_parser_gen.hpp" +#include "mongo/db/cst/parser_gen.hpp" #include "mongo/util/string_map.h" namespace mongo { @@ -42,105 +42,109 @@ namespace { // Mapping of reserved keywords to BSON token. Any key which is not included in this map is assumed // to be a user field name and is treated as a terminal by the parser. -const StringMap<PipelineParserGen::token_type> reservedKeyLookup = { - {"_id", PipelineParserGen::token::ID}, +const StringMap<ParserGen::token_type> reservedKeyLookup = { + {"_id", ParserGen::token::ID}, // Stages and their arguments. - {"$_internalInhibitOptimization", PipelineParserGen::token::STAGE_INHIBIT_OPTIMIZATION}, - {"$limit", PipelineParserGen::token::STAGE_LIMIT}, - {"$project", PipelineParserGen::token::STAGE_PROJECT}, - {"$sample", PipelineParserGen::token::STAGE_SAMPLE}, - {"size", PipelineParserGen::token::ARG_SIZE}, - {"$skip", PipelineParserGen::token::STAGE_SKIP}, - {"$unionWith", PipelineParserGen::token::STAGE_UNION_WITH}, - {"coll", PipelineParserGen::token::ARG_COLL}, - {"pipeline", PipelineParserGen::token::ARG_PIPELINE}, + {"$_internalInhibitOptimization", ParserGen::token::STAGE_INHIBIT_OPTIMIZATION}, + {"$limit", ParserGen::token::STAGE_LIMIT}, + {"$project", ParserGen::token::STAGE_PROJECT}, + {"$sample", ParserGen::token::STAGE_SAMPLE}, + {"size", ParserGen::token::ARG_SIZE}, + {"$skip", ParserGen::token::STAGE_SKIP}, + {"$unionWith", ParserGen::token::STAGE_UNION_WITH}, + {"coll", ParserGen::token::ARG_COLL}, + {"pipeline", ParserGen::token::ARG_PIPELINE}, // Expressions - {"$add", PipelineParserGen::token::ADD}, - {"$atan2", PipelineParserGen::token::ATAN2}, - {"$and", PipelineParserGen::token::AND}, - {"$or", PipelineParserGen::token::OR}, - {"$not", PipelineParserGen::token::NOT}, - {"$const", PipelineParserGen::token::CONST_EXPR}, - {"$literal", PipelineParserGen::token::LITERAL}, - {"$cmp", PipelineParserGen::token::CMP}, - {"$eq", PipelineParserGen::token::EQ}, - {"$gt", PipelineParserGen::token::GT}, - {"$gte", PipelineParserGen::token::GTE}, - {"$lt", PipelineParserGen::token::LT}, - {"$lte", PipelineParserGen::token::LTE}, - {"$ne", PipelineParserGen::token::NE}, - {"$convert", PipelineParserGen::token::CONVERT}, - {"input", PipelineParserGen::token::ARG_INPUT}, - {"to", PipelineParserGen::token::ARG_TO}, - {"onError", PipelineParserGen::token::ARG_ON_ERROR}, - {"onNull", PipelineParserGen::token::ARG_ON_NULL}, - {"$toBool", PipelineParserGen::token::TO_BOOL}, - {"$toDate", PipelineParserGen::token::TO_DATE}, - {"$toDecimal", PipelineParserGen::token::TO_DECIMAL}, - {"$toDouble", PipelineParserGen::token::TO_DOUBLE}, - {"$toInt", PipelineParserGen::token::TO_INT}, - {"$toLong", PipelineParserGen::token::TO_LONG}, - {"$toObjectId", PipelineParserGen::token::TO_OBJECT_ID}, - {"$toString", PipelineParserGen::token::TO_STRING}, - {"$type", PipelineParserGen::token::TYPE}, - {"$abs", PipelineParserGen::token::ABS}, - {"$ceil", PipelineParserGen::token::CEIL}, - {"$divide", PipelineParserGen::token::DIVIDE}, - {"$exp", PipelineParserGen::token::EXPONENT}, - {"$floor", PipelineParserGen::token::FLOOR}, - {"$ln", PipelineParserGen::token::LN}, - {"$log", PipelineParserGen::token::LOG}, - {"$log10", PipelineParserGen::token::LOGTEN}, - {"$mod", PipelineParserGen::token::MOD}, - {"$multiply", PipelineParserGen::token::MULTIPLY}, - {"$pow", PipelineParserGen::token::POW}, - {"$round", PipelineParserGen::token::ROUND}, - {"$sqrt", PipelineParserGen::token::SQRT}, - {"$subtract", PipelineParserGen::token::SUBTRACT}, - {"$trunc", PipelineParserGen::token::TRUNC}, - {"$concat", PipelineParserGen::token::CONCAT}, - {"$dateFromString", PipelineParserGen::token::DATE_FROM_STRING}, - {"$dateToString", PipelineParserGen::token::DATE_TO_STRING}, - {"$indexOfBytes", PipelineParserGen::token::INDEX_OF_BYTES}, - {"$indexOfCP", PipelineParserGen::token::INDEX_OF_CP}, - {"$ltrim", PipelineParserGen::token::LTRIM}, - {"$meta", PipelineParserGen::token::META}, - {"$regexFind", PipelineParserGen::token::REGEX_FIND}, - {"$regexFindAll", PipelineParserGen::token::REGEX_FIND_ALL}, - {"$regexMatch", PipelineParserGen::token::REGEX_MATCH}, - {"$replaceOne", PipelineParserGen::token::REPLACE_ONE}, - {"$replaceAll", PipelineParserGen::token::REPLACE_ALL}, - {"$rtrim", PipelineParserGen::token::RTRIM}, - {"$split", PipelineParserGen::token::SPLIT}, - {"$strLenBytes", PipelineParserGen::token::STR_LEN_BYTES}, - {"$strLenCP", PipelineParserGen::token::STR_LEN_CP}, - {"$strcasecmp", PipelineParserGen::token::STR_CASE_CMP}, - {"$substr", PipelineParserGen::token::SUBSTR}, - {"$substrBytes", PipelineParserGen::token::SUBSTR_BYTES}, - {"$substrCP", PipelineParserGen::token::SUBSTR_CP}, - {"$toLower", PipelineParserGen::token::TO_LOWER}, - {"$trim", PipelineParserGen::token::TRIM}, - {"$toUpper", PipelineParserGen::token::TO_UPPER}, - {"dateString", PipelineParserGen::token::ARG_DATE_STRING}, - {"format", PipelineParserGen::token::ARG_FORMAT}, - {"timezone", PipelineParserGen::token::ARG_TIMEZONE}, - {"date", PipelineParserGen::token::ARG_DATE}, - {"chars", PipelineParserGen::token::ARG_CHARS}, - {"regex", PipelineParserGen::token::ARG_REGEX}, - {"options", PipelineParserGen::token::ARG_OPTIONS}, - {"find", PipelineParserGen::token::ARG_FIND}, - {"replacement", PipelineParserGen::token::ARG_REPLACEMENT}, + {"$add", ParserGen::token::ADD}, + {"$atan2", ParserGen::token::ATAN2}, + {"$and", ParserGen::token::AND}, + {"$or", ParserGen::token::OR}, + {"$not", ParserGen::token::NOT}, + {"$const", ParserGen::token::CONST_EXPR}, + {"$literal", ParserGen::token::LITERAL}, + {"$cmp", ParserGen::token::CMP}, + {"$eq", ParserGen::token::EQ}, + {"$gt", ParserGen::token::GT}, + {"$gte", ParserGen::token::GTE}, + {"$lt", ParserGen::token::LT}, + {"$lte", ParserGen::token::LTE}, + {"$ne", ParserGen::token::NE}, + {"$convert", ParserGen::token::CONVERT}, + {"input", ParserGen::token::ARG_INPUT}, + {"to", ParserGen::token::ARG_TO}, + {"onError", ParserGen::token::ARG_ON_ERROR}, + {"onNull", ParserGen::token::ARG_ON_NULL}, + {"$toBool", ParserGen::token::TO_BOOL}, + {"$toDate", ParserGen::token::TO_DATE}, + {"$toDecimal", ParserGen::token::TO_DECIMAL}, + {"$toDouble", ParserGen::token::TO_DOUBLE}, + {"$toInt", ParserGen::token::TO_INT}, + {"$toLong", ParserGen::token::TO_LONG}, + {"$toObjectId", ParserGen::token::TO_OBJECT_ID}, + {"$toString", ParserGen::token::TO_STRING}, + {"$type", ParserGen::token::TYPE}, + {"$abs", ParserGen::token::ABS}, + {"$ceil", ParserGen::token::CEIL}, + {"$divide", ParserGen::token::DIVIDE}, + {"$exp", ParserGen::token::EXPONENT}, + {"$floor", ParserGen::token::FLOOR}, + {"$ln", ParserGen::token::LN}, + {"$log", ParserGen::token::LOG}, + {"$log10", ParserGen::token::LOGTEN}, + {"$mod", ParserGen::token::MOD}, + {"$multiply", ParserGen::token::MULTIPLY}, + {"$pow", ParserGen::token::POW}, + {"$round", ParserGen::token::ROUND}, + {"$sqrt", ParserGen::token::SQRT}, + {"$subtract", ParserGen::token::SUBTRACT}, + {"$trunc", ParserGen::token::TRUNC}, + {"$concat", ParserGen::token::CONCAT}, + {"$dateFromString", ParserGen::token::DATE_FROM_STRING}, + {"$dateToString", ParserGen::token::DATE_TO_STRING}, + {"$indexOfBytes", ParserGen::token::INDEX_OF_BYTES}, + {"$indexOfCP", ParserGen::token::INDEX_OF_CP}, + {"$ltrim", ParserGen::token::LTRIM}, + {"$meta", ParserGen::token::META}, + {"$regexFind", ParserGen::token::REGEX_FIND}, + {"$regexFindAll", ParserGen::token::REGEX_FIND_ALL}, + {"$regexMatch", ParserGen::token::REGEX_MATCH}, + {"$replaceOne", ParserGen::token::REPLACE_ONE}, + {"$replaceAll", ParserGen::token::REPLACE_ALL}, + {"$rtrim", ParserGen::token::RTRIM}, + {"$split", ParserGen::token::SPLIT}, + {"$strLenBytes", ParserGen::token::STR_LEN_BYTES}, + {"$strLenCP", ParserGen::token::STR_LEN_CP}, + {"$strcasecmp", ParserGen::token::STR_CASE_CMP}, + {"$substr", ParserGen::token::SUBSTR}, + {"$substrBytes", ParserGen::token::SUBSTR_BYTES}, + {"$substrCP", ParserGen::token::SUBSTR_CP}, + {"$toLower", ParserGen::token::TO_LOWER}, + {"$trim", ParserGen::token::TRIM}, + {"$toUpper", ParserGen::token::TO_UPPER}, + {"dateString", ParserGen::token::ARG_DATE_STRING}, + {"format", ParserGen::token::ARG_FORMAT}, + {"timezone", ParserGen::token::ARG_TIMEZONE}, + {"date", ParserGen::token::ARG_DATE}, + {"chars", ParserGen::token::ARG_CHARS}, + {"regex", ParserGen::token::ARG_REGEX}, + {"options", ParserGen::token::ARG_OPTIONS}, + {"find", ParserGen::token::ARG_FIND}, + {"replacement", ParserGen::token::ARG_REPLACEMENT}, + {"filter", ParserGen::token::ARG_FILTER}, + {"query", ParserGen::token::ARG_QUERY}, + {"q", ParserGen::token::ARG_Q}, + {"sort", ParserGen::token::ARG_SORT}, }; // Mapping of reserved keywords to BSON tokens. Any key which is not included in this map is // assumed to be a user value. -const StringMap<PipelineParserGen::token_type> reservedKeyValueLookup = { - {"randVal", PipelineParserGen::token::RAND_VAL}, - {"textScore", PipelineParserGen::token::TEXT_SCORE}, +const StringMap<ParserGen::token_type> reservedKeyValueLookup = { + {"randVal", ParserGen::token::RAND_VAL}, + {"textScore", ParserGen::token::TEXT_SCORE}, }; -bool isCompound(PipelineParserGen::symbol_type token) { - return token.type_get() == static_cast<int>(PipelineParserGen::token::START_OBJECT) || - token.type_get() == static_cast<int>(PipelineParserGen::token::START_ARRAY); +bool isCompound(ParserGen::symbol_type token) { + return token.type_get() == static_cast<int>(ParserGen::token::START_OBJECT) || + token.type_get() == static_cast<int>(ParserGen::token::START_ARRAY); } } // namespace @@ -148,8 +152,7 @@ bool isCompound(PipelineParserGen::symbol_type token) { void BSONLexer::sortObjTokens() { // A TokenElement is similar to a BSONElement, with the payload being a vector of Bison symbols // if the type is compound (object or array). - using TokenElement = - std::pair<PipelineParserGen::symbol_type, std::vector<PipelineParserGen::symbol_type>>; + using TokenElement = std::pair<ParserGen::symbol_type, std::vector<ParserGen::symbol_type>>; struct TokenElementCompare { bool operator()(const TokenElement& elem1, const TokenElement& elem2) const { return elem1.first.type_get() < elem2.first.type_get(); @@ -157,8 +160,7 @@ void BSONLexer::sortObjTokens() { }; auto currentPosition = _position; - if (_tokens[currentPosition].type_get() != - static_cast<int>(PipelineParserGen::token::START_OBJECT)) { + if (_tokens[currentPosition].type_get() != static_cast<int>(ParserGen::token::START_OBJECT)) { return; } @@ -166,13 +168,12 @@ void BSONLexer::sortObjTokens() { // Increment to get to the first token after the START_OBJECT. We will sort tokens until the // matching END_OBJECT is found. currentPosition++; - while (_tokens[currentPosition].type_get() != - static_cast<int>(PipelineParserGen::token::END_OBJECT)) { + while (_tokens[currentPosition].type_get() != static_cast<int>(ParserGen::token::END_OBJECT)) { invariant(size_t(currentPosition) < _tokens.size()); auto keyToken = _tokens[currentPosition++]; - std::vector<PipelineParserGen::symbol_type> rhsTokens; + std::vector<ParserGen::symbol_type> rhsTokens; rhsTokens.push_back(_tokens[currentPosition]); if (isCompound(_tokens[currentPosition])) { auto braceCount = 1; @@ -183,9 +184,9 @@ void BSONLexer::sortObjTokens() { if (isCompound(_tokens[currentPosition])) braceCount++; if (_tokens[currentPosition].type_get() == - static_cast<int>(PipelineParserGen::token::END_OBJECT) || + static_cast<int>(ParserGen::token::END_OBJECT) || _tokens[currentPosition].type_get() == - static_cast<int>(PipelineParserGen::token::END_ARRAY)) + static_cast<int>(ParserGen::token::END_ARRAY)) braceCount--; rhsTokens.push_back(_tokens[currentPosition++]); @@ -223,43 +224,42 @@ void BSONLexer::tokenize(BSONElement elem, bool includeFieldName) { context.emplace(this, elem.fieldNameStringData()); } else if (elem.fieldNameStringData()[0] == '$') { pushToken(elem.fieldNameStringData(), - PipelineParserGen::token::DOLLAR_PREF_FIELDNAME, + ParserGen::token::DOLLAR_PREF_FIELDNAME, elem.fieldName()); } else { // If we don't care about the keyword, then it's treated as a generic fieldname. - pushToken( - elem.fieldNameStringData(), PipelineParserGen::token::FIELDNAME, elem.fieldName()); + pushToken(elem.fieldNameStringData(), ParserGen::token::FIELDNAME, elem.fieldName()); } } switch (elem.type()) { case BSONType::Array: { - pushToken("start array", PipelineParserGen::token::START_ARRAY); + pushToken("start array", ParserGen::token::START_ARRAY); auto index = 0; - for (auto&& nestedElem : elem.Array()) { + for (auto&& nestedElem : elem.embeddedObject()) { ScopedLocationTracker arrayCtx{this, index++}; // For arrays, do not tokenize the field names. tokenize(nestedElem, false); } - pushToken("end array", PipelineParserGen::token::END_ARRAY); + pushToken("end array", ParserGen::token::END_ARRAY); break; } case BSONType::Object: - pushToken("start object", PipelineParserGen::token::START_OBJECT); + pushToken("start object", ParserGen::token::START_OBJECT); for (auto&& nestedElem : elem.embeddedObject()) { tokenize(nestedElem, true); } - pushToken("end object", PipelineParserGen::token::END_OBJECT); + pushToken("end object", ParserGen::token::END_OBJECT); break; case NumberDouble: if (elem.numberDouble() == 0.0) - pushToken(elem, PipelineParserGen::token::DOUBLE_ZERO); + pushToken(elem, ParserGen::token::DOUBLE_ZERO); else if (elem.numberDouble() == 1.0) - pushToken(elem, PipelineParserGen::token::DOUBLE_ONE); + pushToken(elem, ParserGen::token::DOUBLE_ONE); else if (elem.numberDouble() == -1.0) - pushToken(elem, PipelineParserGen::token::DOUBLE_NEGATIVE_ONE); + pushToken(elem, ParserGen::token::DOUBLE_NEGATIVE_ONE); else - pushToken(elem, PipelineParserGen::token::DOUBLE_OTHER, elem.numberDouble()); + pushToken(elem, ParserGen::token::DOUBLE_OTHER, elem.numberDouble()); break; case BSONType::String: if (auto it = reservedKeyValueLookup.find(elem.valueStringData()); @@ -268,146 +268,114 @@ void BSONLexer::tokenize(BSONElement elem, bool includeFieldName) { } else if (elem.valueStringData()[0] == '$') { if (elem.valueStringData()[1] == '$') { pushToken(elem.valueStringData(), - PipelineParserGen::token::DOLLAR_DOLLAR_STRING, + ParserGen::token::DOLLAR_DOLLAR_STRING, elem.String()); } else { - pushToken(elem.valueStringData(), - PipelineParserGen::token::DOLLAR_STRING, - elem.String()); + pushToken( + elem.valueStringData(), ParserGen::token::DOLLAR_STRING, elem.String()); } } else { - pushToken(elem.valueStringData(), PipelineParserGen::token::STRING, elem.String()); + pushToken(elem.valueStringData(), ParserGen::token::STRING, elem.String()); } break; case BSONType::BinData: { int len; auto data = elem.binData(len); - pushToken( - elem, PipelineParserGen::token::BINARY, BSONBinData{data, len, elem.binDataType()}); + pushToken(elem, ParserGen::token::BINARY, BSONBinData{data, len, elem.binDataType()}); break; } case BSONType::Undefined: - pushToken(elem, PipelineParserGen::token::UNDEFINED, UserUndefined{}); + pushToken(elem, ParserGen::token::UNDEFINED, UserUndefined{}); break; case BSONType::jstOID: - pushToken(elem, PipelineParserGen::token::OBJECT_ID, elem.OID()); + pushToken(elem, ParserGen::token::OBJECT_ID, elem.OID()); break; case Bool: pushToken(elem, - elem.boolean() ? PipelineParserGen::token::BOOL_TRUE - : PipelineParserGen::token::BOOL_FALSE); + elem.boolean() ? ParserGen::token::BOOL_TRUE : ParserGen::token::BOOL_FALSE); break; case BSONType::Date: - pushToken(elem, PipelineParserGen::token::DATE_LITERAL, elem.date()); + pushToken(elem, ParserGen::token::DATE_LITERAL, elem.date()); break; case BSONType::jstNULL: - pushToken(elem, PipelineParserGen::token::JSNULL, UserNull{}); + pushToken(elem, ParserGen::token::JSNULL, UserNull{}); break; case BSONType::RegEx: - pushToken( - elem, PipelineParserGen::token::REGEX, BSONRegEx{elem.regex(), elem.regexFlags()}); + pushToken(elem, ParserGen::token::REGEX, BSONRegEx{elem.regex(), elem.regexFlags()}); break; case BSONType::DBRef: - pushToken(elem, - PipelineParserGen::token::DB_POINTER, - BSONDBRef{elem.dbrefNS(), elem.dbrefOID()}); + pushToken( + elem, ParserGen::token::DB_POINTER, BSONDBRef{elem.dbrefNS(), elem.dbrefOID()}); break; case BSONType::Code: - pushToken(elem, PipelineParserGen::token::JAVASCRIPT, BSONCode{elem.valueStringData()}); + pushToken(elem, ParserGen::token::JAVASCRIPT, BSONCode{elem.valueStringData()}); break; case BSONType::Symbol: - pushToken(elem, PipelineParserGen::token::SYMBOL, BSONSymbol{elem.valueStringData()}); + pushToken(elem, ParserGen::token::SYMBOL, BSONSymbol{elem.valueStringData()}); break; case BSONType::CodeWScope: { auto code = StringData{elem.codeWScopeCode(), static_cast<size_t>(elem.codeWScopeCodeLen()) - 1ull}; pushToken(elem, - PipelineParserGen::token::JAVASCRIPT_W_SCOPE, + ParserGen::token::JAVASCRIPT_W_SCOPE, BSONCodeWScope{code, elem.codeWScopeObject()}); break; } case NumberInt: if (elem.numberInt() == 0) - pushToken(elem, PipelineParserGen::token::INT_ZERO); + pushToken(elem, ParserGen::token::INT_ZERO); else if (elem.numberInt() == 1) - pushToken(elem, PipelineParserGen::token::INT_ONE); + pushToken(elem, ParserGen::token::INT_ONE); else if (elem.numberInt() == -1) - pushToken(elem, PipelineParserGen::token::INT_NEGATIVE_ONE); + pushToken(elem, ParserGen::token::INT_NEGATIVE_ONE); else - pushToken(elem, PipelineParserGen::token::INT_OTHER, elem.numberInt()); + pushToken(elem, ParserGen::token::INT_OTHER, elem.numberInt()); break; case BSONType::bsonTimestamp: - pushToken(elem, PipelineParserGen::token::TIMESTAMP, elem.timestamp()); + pushToken(elem, ParserGen::token::TIMESTAMP, elem.timestamp()); break; case NumberLong: if (elem.numberLong() == 0ll) - pushToken(elem, PipelineParserGen::token::LONG_ZERO); + pushToken(elem, ParserGen::token::LONG_ZERO); else if (elem.numberLong() == 1ll) - pushToken(elem, PipelineParserGen::token::LONG_ONE); + pushToken(elem, ParserGen::token::LONG_ONE); else if (elem.numberLong() == -1ll) - pushToken(elem, PipelineParserGen::token::LONG_NEGATIVE_ONE); + pushToken(elem, ParserGen::token::LONG_NEGATIVE_ONE); else - pushToken(elem, PipelineParserGen::token::LONG_OTHER, elem.numberLong()); + pushToken(elem, ParserGen::token::LONG_OTHER, elem.numberLong()); break; case NumberDecimal: if (elem.numberDecimal() == Decimal128::kNormalizedZero) - pushToken(elem, PipelineParserGen::token::DECIMAL_ZERO); + pushToken(elem, ParserGen::token::DECIMAL_ZERO); else if (elem.numberDecimal() == Decimal128(1)) { - pushToken(elem, PipelineParserGen::token::DECIMAL_ONE); + pushToken(elem, ParserGen::token::DECIMAL_ONE); } else if (elem.numberDecimal() == Decimal128(-1)) { - pushToken(elem, PipelineParserGen::token::DECIMAL_NEGATIVE_ONE); + pushToken(elem, ParserGen::token::DECIMAL_NEGATIVE_ONE); } else - pushToken(elem, PipelineParserGen::token::DECIMAL_OTHER, elem.numberDecimal()); + pushToken(elem, ParserGen::token::DECIMAL_OTHER, elem.numberDecimal()); break; case BSONType::MinKey: - pushToken(elem, PipelineParserGen::token::MIN_KEY, UserMinKey{}); + pushToken(elem, ParserGen::token::MIN_KEY, UserMinKey{}); break; case BSONType::MaxKey: - pushToken(elem, PipelineParserGen::token::MAX_KEY, UserMaxKey{}); + pushToken(elem, ParserGen::token::MAX_KEY, UserMaxKey{}); break; default: MONGO_UNREACHABLE; } } -BSONLexer::BSONLexer(BSONObj obj, PipelineParserGen::token_type startingToken) { - ScopedLocationTracker matchCtx{this, "filter"}; - pushToken("start", startingToken); - pushToken("start object", PipelineParserGen::token::START_OBJECT); - for (auto&& elem : obj) { - // Include field names in the object. - tokenize(elem, true); - } - pushToken("end object", PipelineParserGen::token::END_OBJECT); - - // Final token must indicate EOF. - pushToken("EOF", PipelineParserGen::token::END_OF_FILE); - - // Reset the position to use in yylex(). - _position = 0; -}; - -BSONLexer::BSONLexer(std::vector<BSONElement> pipeline, - PipelineParserGen::token_type startingToken) { - ScopedLocationTracker pipelineCtx{this, "pipeline"}; - pushToken("start", startingToken); - pushToken("start array", PipelineParserGen::token::START_ARRAY); - auto index = 0; - for (auto&& elem : pipeline) { - ScopedLocationTracker stageCtx{this, index++}; - // Don't include field names for stages of the pipeline (aka indexes of the pipeline array). - tokenize(elem, false); - } - pushToken("end array", PipelineParserGen::token::END_ARRAY); +BSONLexer::BSONLexer(BSONElement input) { + tokenize(input, true); // Final token must indicate EOF. - pushToken("EOF", PipelineParserGen::token::END_OF_FILE); + pushToken("EOF", ParserGen::token::END_OF_FILE); // Reset the position to use in yylex(). _position = 0; }; -PipelineParserGen::symbol_type yylex(mongo::BSONLexer& lexer) { +ParserGen::symbol_type yylex(mongo::BSONLexer& lexer) { return lexer.getNext(); } diff --git a/src/mongo/db/cst/bson_lexer.h b/src/mongo/db/cst/bson_lexer.h index a8c82d55b46..a6ca5cfade4 100644 --- a/src/mongo/db/cst/bson_lexer.h +++ b/src/mongo/db/cst/bson_lexer.h @@ -35,19 +35,18 @@ #include "mongo/bson/bsonobj.h" #include "mongo/db/cst/bson_location.h" -#include "mongo/db/cst/pipeline_parser_gen.hpp" +#include "mongo/db/cst/parser_gen.hpp" namespace mongo { class BSONLexer { public: - BSONLexer(BSONObj obj, PipelineParserGen::token_type startingToken); - BSONLexer(std::vector<BSONElement> pipeline, PipelineParserGen::token_type startingToken); + explicit BSONLexer(BSONElement input); /** * Retrieves the next token in the stream. */ - PipelineParserGen::symbol_type getNext() { + ParserGen::symbol_type getNext() { return _tokens[_position++]; } @@ -88,8 +87,8 @@ private: template <class LocationType, class... Args> void pushToken(LocationType name, Args&&... args) { - auto token = PipelineParserGen::symbol_type( - std::forward<Args>(args)..., BSONLocation{std::move(name), _locationPrefixes}); + auto token = ParserGen::symbol_type(std::forward<Args>(args)..., + BSONLocation{std::move(name), _locationPrefixes}); _tokens.emplace_back(std::move(token)); _position++; } @@ -102,11 +101,11 @@ private: // BSON, this will change depending on the context that we're parsing. std::vector<BSONLocation::LocationPrefix> _locationPrefixes; - std::vector<PipelineParserGen::symbol_type> _tokens; + std::vector<ParserGen::symbol_type> _tokens; }; // This is the entry point for retrieving the next token from the lexer, invoked from Bison's // yyparse(). -PipelineParserGen::symbol_type yylex(mongo::BSONLexer& lexer); +ParserGen::symbol_type yylex(mongo::BSONLexer& lexer); } // namespace mongo diff --git a/src/mongo/db/cst/bson_lexer_test.cpp b/src/mongo/db/cst/bson_lexer_test.cpp index 459c16a64e4..fe9685cd2c6 100644 --- a/src/mongo/db/cst/bson_lexer_test.cpp +++ b/src/mongo/db/cst/bson_lexer_test.cpp @@ -33,88 +33,87 @@ #include "mongo/bson/json.h" #include "mongo/db/cst/bson_lexer.h" -#include "mongo/db/cst/pipeline_parser_gen.hpp" +#include "mongo/db/cst/parser_gen.hpp" #include "mongo/unittest/unittest.h" namespace mongo { namespace { -void assertTokensMatch(BSONLexer& lexer, - std::vector<PipelineParserGen::token::yytokentype> tokens) { +void assertTokensMatch(BSONLexer& lexer, std::vector<ParserGen::token::yytokentype> tokens) { for (auto&& token : tokens) { ASSERT_EQ(lexer.getNext().type_get(), token); } - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::END_OF_FILE); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::END_OF_FILE); } TEST(BSONLexerTest, TokenizesOpaqueUserObjects) { auto input = fromjson("{pipeline: [{a: 2, b: '1', c: \"$path\", d: \"$$NOW\"}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); + BSONLexer lexer(input["pipeline"]); assertTokensMatch(lexer, - {PipelineParserGen::token::START_PIPELINE, - PipelineParserGen::token::START_ARRAY, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::INT_OTHER, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::STRING, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::DOLLAR_STRING, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::DOLLAR_DOLLAR_STRING, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY}); + {ParserGen::token::ARG_PIPELINE, + ParserGen::token::START_ARRAY, + ParserGen::token::START_OBJECT, + ParserGen::token::FIELDNAME, + ParserGen::token::INT_OTHER, + ParserGen::token::FIELDNAME, + ParserGen::token::STRING, + ParserGen::token::FIELDNAME, + ParserGen::token::DOLLAR_STRING, + ParserGen::token::FIELDNAME, + ParserGen::token::DOLLAR_DOLLAR_STRING, + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY}); } TEST(BSONLexerTest, TokenizesReservedKeywords) { auto input = fromjson("{pipeline: [{$_internalInhibitOptimization: {}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); + BSONLexer lexer(input["pipeline"]); assertTokensMatch(lexer, - {PipelineParserGen::token::START_PIPELINE, - PipelineParserGen::token::START_ARRAY, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::STAGE_INHIBIT_OPTIMIZATION, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY}); + {ParserGen::token::ARG_PIPELINE, + ParserGen::token::START_ARRAY, + ParserGen::token::START_OBJECT, + ParserGen::token::STAGE_INHIBIT_OPTIMIZATION, + ParserGen::token::START_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY}); } TEST(BSONLexerTest, TokenizesReservedKeywordsAtAnyDepth) { auto input = fromjson("{pipeline: [{a: {$_internalInhibitOptimization: {}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); + BSONLexer lexer(input["pipeline"]); assertTokensMatch(lexer, - {PipelineParserGen::token::START_PIPELINE, - PipelineParserGen::token::START_ARRAY, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::STAGE_INHIBIT_OPTIMIZATION, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY}); + {ParserGen::token::ARG_PIPELINE, + ParserGen::token::START_ARRAY, + ParserGen::token::START_OBJECT, + ParserGen::token::FIELDNAME, + ParserGen::token::START_OBJECT, + ParserGen::token::STAGE_INHIBIT_OPTIMIZATION, + ParserGen::token::START_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY}); } TEST(BSONLexerTest, MidRuleActionToSortNestedObject) { auto input = fromjson("{pipeline: [{pipeline: 2.0, coll: 'test'}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); + BSONLexer lexer(input["pipeline"]); // Iterate until the first object. - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_PIPELINE); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_ARRAY); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::ARG_PIPELINE); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::START_ARRAY); // Kick the lexer to sort the object, which should move element 'coll' in front of 'pipeline'. // Not that this only works because these are reserved keywords recognized by the lexer, // arbitrary string field names with *not* get sorted. lexer.sortObjTokens(); - auto expected = {PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::ARG_COLL, - PipelineParserGen::token::STRING, - PipelineParserGen::token::ARG_PIPELINE, - PipelineParserGen::token::DOUBLE_OTHER, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY}; + auto expected = {ParserGen::token::START_OBJECT, + ParserGen::token::ARG_COLL, + ParserGen::token::STRING, + ParserGen::token::ARG_PIPELINE, + ParserGen::token::DOUBLE_OTHER, + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY}; assertTokensMatch(lexer, expected); } @@ -122,30 +121,30 @@ TEST(BSONLexerTest, MidRuleActionToSortNestedObject) { TEST(BSONLexerTest, MidRuleActionToSortDoesNotSortNestedObjects) { auto input = fromjson( "{pipeline: [{$unionWith: {pipeline: [{$unionWith: 'inner', a: 3.0}], coll: 'outer'}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); + BSONLexer lexer(input["pipeline"]); // Iterate until we reach the $unionWith object. - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_PIPELINE); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_ARRAY); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_OBJECT); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::STAGE_UNION_WITH); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::ARG_PIPELINE); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::START_ARRAY); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::START_OBJECT); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::STAGE_UNION_WITH); lexer.sortObjTokens(); auto expected = { - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::ARG_COLL, - PipelineParserGen::token::STRING, // coll: 'outer' - PipelineParserGen::token::ARG_PIPELINE, // inner pipeline - PipelineParserGen::token::START_ARRAY, - PipelineParserGen::token::START_OBJECT, + ParserGen::token::START_OBJECT, + ParserGen::token::ARG_COLL, + ParserGen::token::STRING, // coll: 'outer' + ParserGen::token::ARG_PIPELINE, // inner pipeline + ParserGen::token::START_ARRAY, + ParserGen::token::START_OBJECT, // The nested pipeline does *not* get sorted, meaning '$unionWith' stays before 'a'. - PipelineParserGen::token::STAGE_UNION_WITH, - PipelineParserGen::token::STRING, // $unionWith: 'inner' - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::DOUBLE_OTHER, // a: 3.0 - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY, + ParserGen::token::STAGE_UNION_WITH, + ParserGen::token::STRING, // $unionWith: 'inner' + ParserGen::token::FIELDNAME, + ParserGen::token::DOUBLE_OTHER, // a: 3.0 + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY, }; assertTokensMatch(lexer, expected); } @@ -154,39 +153,39 @@ TEST(BSONLexerTest, MultipleNestedObjectsAreReorderedCorrectly) { auto input = fromjson( "{pipeline: [{$unionWith: {pipeline: [{$unionWith: 'inner', a: 3.0}], coll: [{$unionWith: " "'innerB', a: 2.0}]}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); + BSONLexer lexer(input["pipeline"]); // Iterate until we reach the $unionWith object. - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_PIPELINE); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_ARRAY); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_OBJECT); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::STAGE_UNION_WITH); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::ARG_PIPELINE); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::START_ARRAY); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::START_OBJECT); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::STAGE_UNION_WITH); lexer.sortObjTokens(); auto expected = { - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::ARG_COLL, - PipelineParserGen::token::START_ARRAY, - PipelineParserGen::token::START_OBJECT, + ParserGen::token::START_OBJECT, + ParserGen::token::ARG_COLL, + ParserGen::token::START_ARRAY, + ParserGen::token::START_OBJECT, // The nested pipeline does *not* get sorted, meaning '$unionWith' stays before 'a'. - PipelineParserGen::token::STAGE_UNION_WITH, - PipelineParserGen::token::STRING, // innerb - PipelineParserGen::token::FIELDNAME, // a - PipelineParserGen::token::DOUBLE_OTHER, // a: 2.0 - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY, + ParserGen::token::STAGE_UNION_WITH, + ParserGen::token::STRING, // innerb + ParserGen::token::FIELDNAME, // a + ParserGen::token::DOUBLE_OTHER, // a: 2.0 + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY, // Coll nested object ends here. - PipelineParserGen::token::ARG_PIPELINE, // inner pipeline - PipelineParserGen::token::START_ARRAY, - PipelineParserGen::token::START_OBJECT, + ParserGen::token::ARG_PIPELINE, // inner pipeline + ParserGen::token::START_ARRAY, + ParserGen::token::START_OBJECT, // The nested pipeline does *not* get sorted, meaning '$unionWith' stays before 'a'. - PipelineParserGen::token::STAGE_UNION_WITH, - PipelineParserGen::token::STRING, // $unionWith: 'inner' - PipelineParserGen::token::FIELDNAME, // a - PipelineParserGen::token::DOUBLE_OTHER, // a: 3.0 - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY, + ParserGen::token::STAGE_UNION_WITH, + ParserGen::token::STRING, // $unionWith: 'inner' + ParserGen::token::FIELDNAME, // a + ParserGen::token::DOUBLE_OTHER, // a: 3.0 + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY, }; assertTokensMatch(lexer, expected); } @@ -194,95 +193,95 @@ TEST(BSONLexerTest, MultiLevelBSONDoesntSortChildren) { auto input = fromjson( "{pipeline: [{$unionWith: {pipeline: [{$unionWith: {'nested': 3.0, 'apple': 3.0}, a: 3.0}]," " coll: 'outer'}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); + BSONLexer lexer(input["pipeline"]); // Iterate until we reach the $unionWith object. - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_PIPELINE); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_ARRAY); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::START_OBJECT); - ASSERT_EQ(lexer.getNext().type_get(), PipelineParserGen::token::STAGE_UNION_WITH); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::ARG_PIPELINE); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::START_ARRAY); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::START_OBJECT); + ASSERT_EQ(lexer.getNext().type_get(), ParserGen::token::STAGE_UNION_WITH); lexer.sortObjTokens(); auto expected = { - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::ARG_COLL, - PipelineParserGen::token::STRING, // coll: 'outer' - PipelineParserGen::token::ARG_PIPELINE, // inner pipeline + ParserGen::token::START_OBJECT, + ParserGen::token::ARG_COLL, + ParserGen::token::STRING, // coll: 'outer' + ParserGen::token::ARG_PIPELINE, // inner pipeline // First nested object - PipelineParserGen::token::START_ARRAY, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::STAGE_UNION_WITH, + ParserGen::token::START_ARRAY, + ParserGen::token::START_OBJECT, + ParserGen::token::STAGE_UNION_WITH, // Second nested object - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::FIELDNAME, // nested: 3.0 - PipelineParserGen::token::DOUBLE_OTHER, - PipelineParserGen::token::FIELDNAME, // apple: 3.0 - PipelineParserGen::token::DOUBLE_OTHER, - PipelineParserGen::token::END_OBJECT, + ParserGen::token::START_OBJECT, + ParserGen::token::FIELDNAME, // nested: 3.0 + ParserGen::token::DOUBLE_OTHER, + ParserGen::token::FIELDNAME, // apple: 3.0 + ParserGen::token::DOUBLE_OTHER, + ParserGen::token::END_OBJECT, // End second nested object - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::DOUBLE_OTHER, // a: 3.0 - PipelineParserGen::token::END_OBJECT, + ParserGen::token::FIELDNAME, + ParserGen::token::DOUBLE_OTHER, // a: 3.0 + ParserGen::token::END_OBJECT, // End first nested object - PipelineParserGen::token::END_ARRAY, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY, + ParserGen::token::END_ARRAY, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY, }; assertTokensMatch(lexer, expected); } TEST(BSONLexerTest, EmptyMatchExpressionsAreLexedCorrectly) { - BSONLexer lexer(fromjson("{}"), PipelineParserGen::token::START_MATCH); + BSONLexer lexer(fromjson("{filter: {}}").firstElement()); assertTokensMatch(lexer, - {PipelineParserGen::token::START_MATCH, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::END_OBJECT}); + {ParserGen::token::ARG_FILTER, + ParserGen::token::START_OBJECT, + ParserGen::token::END_OBJECT}); } TEST(BSONLexerTest, TokenizesObjWithPathCorrectly) { auto input = fromjson( "{pipeline: [{$project: { m: { $dateToString: { date: '$date', " "format: '%Y-%m-%d' } } } } ] }"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); + BSONLexer lexer(input["pipeline"]); assertTokensMatch(lexer, { - PipelineParserGen::token::START_PIPELINE, - PipelineParserGen::token::START_ARRAY, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::STAGE_PROJECT, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::DATE_TO_STRING, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::ARG_DATE, - PipelineParserGen::token::DOLLAR_STRING, - PipelineParserGen::token::ARG_FORMAT, - PipelineParserGen::token::STRING, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_ARRAY, + ParserGen::token::ARG_PIPELINE, + ParserGen::token::START_ARRAY, + ParserGen::token::START_OBJECT, + ParserGen::token::STAGE_PROJECT, + ParserGen::token::START_OBJECT, + ParserGen::token::FIELDNAME, + ParserGen::token::START_OBJECT, + ParserGen::token::DATE_TO_STRING, + ParserGen::token::START_OBJECT, + ParserGen::token::ARG_DATE, + ParserGen::token::DOLLAR_STRING, + ParserGen::token::ARG_FORMAT, + ParserGen::token::STRING, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, + ParserGen::token::END_ARRAY, }); } TEST(BSONLexerTest, SortSpecTokensGeneratedCorrectly) { - auto input = fromjson("{val: 1, test: -1.0, rand: {$meta: 'textScore'}}"); - BSONLexer lexer(input, PipelineParserGen::token::START_SORT); + auto input = fromjson("{sort: {val: 1, test: -1.0, rand: {$meta: 'textScore'}}}"); + BSONLexer lexer(input["sort"]); assertTokensMatch(lexer, { - PipelineParserGen::token::START_SORT, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::INT_ONE, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::DOUBLE_NEGATIVE_ONE, - PipelineParserGen::token::FIELDNAME, - PipelineParserGen::token::START_OBJECT, - PipelineParserGen::token::META, - PipelineParserGen::token::TEXT_SCORE, - PipelineParserGen::token::END_OBJECT, - PipelineParserGen::token::END_OBJECT, + ParserGen::token::ARG_SORT, + ParserGen::token::START_OBJECT, + ParserGen::token::FIELDNAME, + ParserGen::token::INT_ONE, + ParserGen::token::FIELDNAME, + ParserGen::token::DOUBLE_NEGATIVE_ONE, + ParserGen::token::FIELDNAME, + ParserGen::token::START_OBJECT, + ParserGen::token::META, + ParserGen::token::TEXT_SCORE, + ParserGen::token::END_OBJECT, + ParserGen::token::END_OBJECT, }); } diff --git a/src/mongo/db/cst/cst_error_test.cpp b/src/mongo/db/cst/cst_error_test.cpp index 10a0cbdda2b..057c9a2767a 100755 --- a/src/mongo/db/cst/cst_error_test.cpp +++ b/src/mongo/db/cst/cst_error_test.cpp @@ -36,7 +36,7 @@ #include "mongo/db/cst/c_node.h"
#include "mongo/db/cst/key_fieldname.h"
#include "mongo/db/cst/key_value.h"
-#include "mongo/db/cst/pipeline_parser_gen.hpp"
+#include "mongo/db/cst/parser_gen.hpp"
#include "mongo/unittest/bson_test_util.h"
#include "mongo/unittest/unittest.h"
@@ -45,8 +45,8 @@ namespace { TEST(CstErrorTest, EmptyStageSpec) {
auto input = fromjson("{pipeline: [{}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- ASSERT_THROWS_CODE_AND_WHAT(PipelineParserGen(lexer, nullptr).parse(),
+ BSONLexer lexer(input["pipeline"]);
+ ASSERT_THROWS_CODE_AND_WHAT(ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected end of object at element 'end object' "
@@ -57,8 +57,8 @@ TEST(CstErrorTest, UnknownStageName) { // First stage.
{
auto input = fromjson("{pipeline: [{$unknownStage: {}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- ASSERT_THROWS_CODE_AND_WHAT(PipelineParserGen(lexer, nullptr).parse(),
+ BSONLexer lexer(input["pipeline"]);
+ ASSERT_THROWS_CODE_AND_WHAT(ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected $-prefixed fieldname at element "
@@ -67,8 +67,8 @@ TEST(CstErrorTest, UnknownStageName) { // Subsequent stage.
{
auto input = fromjson("{pipeline: [{$limit: 1}, {$unknownStage: {}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- ASSERT_THROWS_CODE_AND_WHAT(PipelineParserGen(lexer, nullptr).parse(),
+ BSONLexer lexer(input["pipeline"]);
+ ASSERT_THROWS_CODE_AND_WHAT(ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected $-prefixed fieldname at element "
@@ -79,9 +79,9 @@ TEST(CstErrorTest, UnknownStageName) { TEST(CstErrorTest, InvalidStageArgument) {
{
auto input = fromjson("{pipeline: [{$sample: 2}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
+ BSONLexer lexer(input["pipeline"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected arbitrary integer, expecting object at element '2' within "
@@ -89,8 +89,8 @@ TEST(CstErrorTest, InvalidStageArgument) { }
{
auto input = fromjson("{pipeline: [{$project: {a: 1}}, {$limit: {}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- ASSERT_THROWS_CODE_AND_WHAT(PipelineParserGen(lexer, nullptr).parse(),
+ BSONLexer lexer(input["pipeline"]);
+ ASSERT_THROWS_CODE_AND_WHAT(ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected object at element 'start object' "
@@ -101,9 +101,9 @@ TEST(CstErrorTest, InvalidStageArgument) { TEST(CstErrorTest, UnknownArgumentInStageSpec) {
{
auto input = fromjson("{pipeline: [{$sample: {huh: 1}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
+ BSONLexer lexer(input["pipeline"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected fieldname, expecting size argument at element 'huh' within "
@@ -111,9 +111,9 @@ TEST(CstErrorTest, UnknownArgumentInStageSpec) { }
{
auto input = fromjson("{pipeline: [{$project: {a: 1}}, {$limit: 1}, {$sample: {huh: 1}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
+ BSONLexer lexer(input["pipeline"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected fieldname, expecting size argument at element 'huh' within "
@@ -124,9 +124,9 @@ TEST(CstErrorTest, UnknownArgumentInStageSpec) { TEST(CstErrorTest, InvalidArgumentTypeWithinStageSpec) {
{
auto input = fromjson("{pipeline: [{$sample: {size: 'cmon'}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
+ BSONLexer lexer(input["pipeline"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected string at element 'cmon' within 'size' within '$sample' "
@@ -134,8 +134,8 @@ TEST(CstErrorTest, InvalidArgumentTypeWithinStageSpec) { }
{
auto input = fromjson("{pipeline: [{$project: {a: 1}}, {$sample: {size: true}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- ASSERT_THROWS_CODE_AND_WHAT(PipelineParserGen(lexer, nullptr).parse(),
+ BSONLexer lexer(input["pipeline"]);
+ ASSERT_THROWS_CODE_AND_WHAT(ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected true at element 'true' within 'size' "
@@ -145,9 +145,9 @@ TEST(CstErrorTest, InvalidArgumentTypeWithinStageSpec) { TEST(CstErrorTest, MissingRequiredArgument) {
auto input = fromjson("{pipeline: [{$sample: {}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
+ BSONLexer lexer(input["pipeline"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected end of object, expecting size argument at element 'end object' "
@@ -156,9 +156,9 @@ TEST(CstErrorTest, MissingRequiredArgument) { TEST(CstErrorTest, MissingRequiredArgumentOfMultiArgStage) {
auto input = fromjson("{pipeline: [{$unionWith: {pipeline: 0.0}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
+ BSONLexer lexer(input["pipeline"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected pipeline argument, expecting coll argument at element 'pipeline' "
@@ -167,8 +167,8 @@ TEST(CstErrorTest, MissingRequiredArgumentOfMultiArgStage) { TEST(CstErrorTest, InvalidArgumentTypeForProjectionExpression) {
auto input = fromjson("{pipeline: [{$project: {a: {$eq: '$b'}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- ASSERT_THROWS_CODE_AND_WHAT(PipelineParserGen(lexer, nullptr).parse(),
+ BSONLexer lexer(input["pipeline"]);
+ ASSERT_THROWS_CODE_AND_WHAT(ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected $-prefixed string, expecting array at "
@@ -178,9 +178,9 @@ TEST(CstErrorTest, InvalidArgumentTypeForProjectionExpression) { TEST(CstErrorTest, MixedProjectionTypes) {
auto input = fromjson("{pipeline: [{$project: {a: 1, b: 0}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
+ BSONLexer lexer(input["pipeline"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"$project containing inclusion and/or computed fields must contain no exclusion fields at "
@@ -189,9 +189,9 @@ TEST(CstErrorTest, MixedProjectionTypes) { TEST(CstErrorTest, DeeplyNestedSyntaxError) {
auto input = fromjson("{pipeline: [{$project: {a: {$and: [1, {$or: [{$eq: '$b'}]}]}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
+ BSONLexer lexer(input["pipeline"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected $-prefixed string, expecting array at element '$b' within '$eq' "
@@ -201,33 +201,33 @@ TEST(CstErrorTest, DeeplyNestedSyntaxError) { }
TEST(CstErrorTest, SortWithRandomIntFails) {
- auto input = fromjson("{val: 5}");
- BSONLexer lexer(input, PipelineParserGen::token::START_SORT);
+ auto input = fromjson("{sort: {val: 5}}");
+ BSONLexer lexer(input["sort"]);
ASSERT_THROWS_CODE_AND_WHAT(
- PipelineParserGen(lexer, nullptr).parse(),
+ ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
- "syntax error, unexpected arbitrary integer at element '5' of input filter");
+ "syntax error, unexpected arbitrary integer at element '5' of input sort");
}
TEST(CstErrorTest, SortWithInvalidMetaFails) {
- auto input = fromjson("{val: {$meta: \"str\"}}");
- BSONLexer lexer(input, PipelineParserGen::token::START_SORT);
- ASSERT_THROWS_CODE_AND_WHAT(PipelineParserGen(lexer, nullptr).parse(),
+ auto input = fromjson("{sort: {val: {$meta: \"str\"}}}");
+ BSONLexer lexer(input["sort"]);
+ ASSERT_THROWS_CODE_AND_WHAT(ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected string, expecting randVal or textScore "
- "at element 'str' within '$meta' of input filter");
+ "at element 'str' within '$meta' of input sort");
}
TEST(CstErrorTest, SortWithMetaSiblingKeyFails) {
- auto input = fromjson("{val: {$meta: \"textScore\", someKey: 4}}");
- BSONLexer lexer(input, PipelineParserGen::token::START_SORT);
- ASSERT_THROWS_CODE_AND_WHAT(PipelineParserGen(lexer, nullptr).parse(),
+ auto input = fromjson("{sort: {val: {$meta: \"textScore\", someKey: 4}}}");
+ BSONLexer lexer(input["sort"]);
+ ASSERT_THROWS_CODE_AND_WHAT(ParserGen(lexer, nullptr).parse(),
AssertionException,
ErrorCodes::FailedToParse,
"syntax error, unexpected fieldname, expecting end of object at "
- "element 'someKey' of input filter");
+ "element 'someKey' of input sort");
}
} // namespace
diff --git a/src/mongo/db/cst/cst_expression_test.cpp b/src/mongo/db/cst/cst_expression_test.cpp index c9418e87a5e..262fc299c62 100755 --- a/src/mongo/db/cst/cst_expression_test.cpp +++ b/src/mongo/db/cst/cst_expression_test.cpp @@ -36,7 +36,7 @@ #include "mongo/db/cst/c_node.h"
#include "mongo/db/cst/key_fieldname.h"
#include "mongo/db/cst/key_value.h"
-#include "mongo/db/cst/pipeline_parser_gen.hpp"
+#include "mongo/db/cst/parser_gen.hpp"
#include "mongo/unittest/bson_test_util.h"
#include "mongo/unittest/unittest.h"
@@ -48,8 +48,8 @@ TEST(CstExpressionTest, ParsesProjectWithAnd) { auto input = fromjson(
"{pipeline: [{$project: {_id: 9.10, a: {$and: [4, {$and: [7, 8]}]}, b: {$and: [2, "
"-3]}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -65,8 +65,8 @@ TEST(CstExpressionTest, ParsesProjectWithOr) { CNode output;
auto input = fromjson(
"{pipeline: [{$project: {_id: 9.10, a: {$or: [4, {$or: [7, 8]}]}, b: {$or: [2, -3]}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -83,8 +83,8 @@ TEST(CstExpressionTest, ParsesProjectWithNot) { auto input = fromjson(
"{pipeline: [{$project: {_id: 9.10, a: {$not: [4]}, b: {$and: [1.0, {$not: "
"[true]}]}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -99,8 +99,8 @@ TEST(CstExpressionTest, ParsesComparisonExpressions) { auto parseAndTest = [](StringData expr) {
CNode output;
auto input = fromjson("{pipeline: [{$project: {_id: {$" + expr + ": [1, 2.5]}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -120,22 +120,22 @@ TEST(CstExpressionTest, FailsToParseInvalidComparisonExpressions) { {
CNode output;
auto input = fromjson("{pipeline: [{$project: {_id: {$" + expr + ": [1]}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse);
}
{
CNode output;
auto input = fromjson("{pipeline: [{$project: {_id: {$" + expr + ": [1, 2, 3]}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse);
}
{
CNode output;
auto input = fromjson("{pipeline: [{$project: {_id: {$" + expr + ": 1}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse);
}
};
@@ -149,15 +149,15 @@ TEST(CstExpressionTest, FailsToParseInvalidConvertExpressions) { {
CNode output;
auto input = fromjson("{pipeline: [{$project: {a: {$convert: 'x'}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse);
}
{
CNode output;
auto input = fromjson("{pipeline: [{$project: {a: {$convert: {input: 'x'}}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse);
}
}
@@ -168,8 +168,8 @@ TEST(CstExpressionTest, ParsesConvertExpressions) { "{pipeline: [{$project: {a: {$toBool: 1}, b: {$toDate: 1100000000000}, "
"c: {$toDecimal: 5}, d: {$toDouble: -2}, e: {$toInt: 1.999999}, "
"f: {$toLong: 1.999999}, g: {$toObjectId: '$_id'}, h: {$toString: false}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -187,8 +187,8 @@ TEST(CstExpressionTest, ParsesConvertExpressionsNoOptArgs) { auto input = fromjson(
"{pipeline: [{$project: {a: {$convert: {input: 1, to: 'string'}}, "
"b: {$convert : {input: 'true', to: 'bool'}}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -208,8 +208,8 @@ TEST(CstExpressionTest, ParsesConvertExpressionsWithOptArgs) { "{pipeline: [{$project: {a: {$convert: {input: 1, to: 'string', "
"onError: 'Could not convert'}}, b : {$convert : {input: "
"true, to : 'double', onNull : 0}}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -230,8 +230,8 @@ TEST(CstExpressionTest, ParsesIndexOf) { "b: { $indexOfBytes: ['ABC', 'B']}, "
"c: { $indexOfCP: [ 'cafeteria', 'e' ] }, "
"d: { $indexOfBytes: [ 'foo.bar.fi', '.', 5, 7 ] }}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -249,8 +249,8 @@ TEST(CstExpressionTest, ParsesDateFromString) { auto input = fromjson(
"{pipeline: [{$project: { m: { $dateFromString: { dateString: '2017-02-08T12:10:40.787', "
"timezone: 'America/New_York' } } }}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -267,8 +267,8 @@ TEST(CstExpressionTest, ParsesDateToString) { auto input = fromjson(
"{pipeline: [{$project: { m: { $dateToString: { date: '$date', "
"format: '%Y-%m-%d' } } } } ] }");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -286,8 +286,8 @@ TEST(CstExpressionTest, ParsesReplaceStringExpressions) { "{pipeline: [{$project: { "
"h: { $replaceOne: { input: '$name', find: 'Cafe', replacement: 'CAFE' } }, "
"i: { $replaceAll: { input: 'cafeSeattle', find: 'cafe', replacement: 'CAFE' } } }}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -307,8 +307,8 @@ TEST(CstExpressionTest, ParsesTrim) { "d: { $ltrim: { input: ' ggggoodbyeeeee' } }, "
"e: { $rtrim: { input: 'ggggoodbyeeeee '} }, "
"f: { $trim: { input: ' ggggoodbyeeeee', chars: ' ge' } } }}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -327,8 +327,8 @@ TEST(CstExpressionTest, ParsesToUpperAndLower) { "{pipeline: [{$project: { "
"g: { $toUpper: 'abc' }, "
"v: { $toLower: 'ABC' }}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -346,8 +346,8 @@ TEST(CstExpressionTest, ParsesRegexExpressions) { "j: { $regexFind: { input: '$details', regex: /^[a-z0-9_.+-]/, options: 'i' } }, "
"k: { $regexFindAll: { input: '$fname', regex: /(C(ar)*)ol/ } }, "
"l: { $regexMatch: { input: '$description', regex: /lin(e|k)/ } } }}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -369,8 +369,8 @@ TEST(CstExpressionTest, ParsesSubstrExpressions) { "s: { $substr: [ '$quarter', 2, -1 ] }, "
"t: { $substrBytes: [ '$name', 0, 3 ] }, "
"u: { $substrCP: [ 'Hello World!', 6, 5 ] }}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -390,8 +390,8 @@ TEST(CstExpressionTest, ParsesStringLengthExpressions) { "{pipeline: [{$project: { "
"p: { $strLenBytes: 'cafeteria' }, "
"q: { $strLenCP: 'Hello World!' }}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -407,8 +407,8 @@ TEST(CstExpressionTest, ParsesSplit) { auto input = fromjson(
"{pipeline: [{$project: { "
"o: { $split: [ {$toUpper: 'abc'}, '-' ] }}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -423,8 +423,8 @@ TEST(CstExpressionTest, ParsesStrCaseCmp) { auto input = fromjson(
"{pipeline: [{$project: { "
"r: { $strcasecmp: [ '$quarter', '13q4' ] }}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -440,8 +440,8 @@ TEST(CstExpressionTest, ParsesConcat) { auto input = fromjson(
"{pipeline: [{$project: { "
"a: { $concat: [ 'item', ' - ', '$description' ]}}}]}");
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_EQ(0, parseTree.parse());
auto stages = stdx::get<CNode::ArrayChildren>(output.payload);
ASSERT_EQ(1, stages.size());
@@ -456,8 +456,8 @@ TEST(CstExpressionTest, FailsToParseTripleDollar) { CNode output;
auto input = BSON("pipeline" << BSON_ARRAY(BSON("$project" << BSON("a"
<< "$$$triple"))));
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse);
}
@@ -465,8 +465,8 @@ TEST(CstExpressionTest, FailsToParseLoneDollar) { CNode output;
auto input = BSON("pipeline" << BSON_ARRAY(BSON("$project" << BSON("a"
<< "$"))));
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse);
}
@@ -474,8 +474,8 @@ TEST(CstExpressionTest, FailsToParseInvalidVarName) { CNode output;
auto input = BSON("pipeline" << BSON_ARRAY(BSON("$project" << BSON("a"
<< "$$invalid"))));
- BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE);
- auto parseTree = PipelineParserGen(lexer, &output);
+ BSONLexer lexer(input["pipeline"]);
+ auto parseTree = ParserGen(lexer, &output);
ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse);
}
} // namespace
diff --git a/src/mongo/db/cst/cst_test.cpp b/src/mongo/db/cst/cst_test.cpp index 18425a72fc5..ee1c2aacc17 100644 --- a/src/mongo/db/cst/cst_test.cpp +++ b/src/mongo/db/cst/cst_test.cpp @@ -36,7 +36,7 @@ #include "mongo/db/cst/c_node.h" #include "mongo/db/cst/key_fieldname.h" #include "mongo/db/cst/key_value.h" -#include "mongo/db/cst/pipeline_parser_gen.hpp" +#include "mongo/db/cst/parser_gen.hpp" #include "mongo/unittest/bson_test_util.h" #include "mongo/unittest/unittest.h" @@ -67,8 +67,8 @@ TEST(CstTest, BuildsAndPrints) { TEST(CstGrammarTest, EmptyPipeline) { CNode output; auto input = fromjson("{pipeline: []}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); ASSERT_TRUE(stdx::get_if<CNode::ArrayChildren>(&output.payload)); ASSERT_EQ(0, stdx::get_if<CNode::ArrayChildren>(&output.payload)->size()); @@ -78,8 +78,8 @@ TEST(CstGrammarTest, ParsesInternalInhibitOptimization) { { CNode output; auto input = fromjson("{pipeline: [{$_internalInhibitOptimization: {}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -88,8 +88,8 @@ TEST(CstGrammarTest, ParsesInternalInhibitOptimization) { { CNode output; auto input = fromjson("{pipeline: [{$_internalInhibitOptimization: 'invalid'}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } } @@ -98,8 +98,8 @@ TEST(CstGrammarTest, ParsesUnionWith) { { CNode output; auto input = fromjson("{pipeline: [{$unionWith: {coll: 'hey', pipeline: 1.0}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -108,8 +108,8 @@ TEST(CstGrammarTest, ParsesUnionWith) { { CNode output; auto input = fromjson("{pipeline: [{$unionWith: {pipeline: 1.0, coll: 'hey'}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -123,8 +123,8 @@ TEST(CstGrammarTest, ParsesUnionWith) { TEST(CstGrammarTest, ParseSkipInt) { CNode output; auto input = fromjson("{pipeline: [{$skip: 5}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -135,8 +135,8 @@ TEST(CstGrammarTest, ParseSkipInt) { TEST(CstGrammarTest, ParseSkipDouble) { CNode output; auto input = fromjson("{pipeline: [{$skip: 1.5}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -147,8 +147,8 @@ TEST(CstGrammarTest, ParseSkipDouble) { TEST(CstGrammarTest, ParseSkipLong) { CNode output; auto input = fromjson("{pipeline: [{$skip: 8223372036854775807}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -159,24 +159,24 @@ TEST(CstGrammarTest, ParseSkipLong) { TEST(CstGrammarTest, InvalidParseSkipObject) { CNode output; auto input = fromjson("{pipeline: [{$skip: {}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } TEST(CstGrammarTest, InvalidParseSkipString) { CNode output; auto input = fromjson("{pipeline: [{$skip: '5'}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } TEST(CstGrammarTest, ParsesLimitInt) { CNode output; auto input = fromjson("{pipeline: [{$limit: 5}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -187,8 +187,8 @@ TEST(CstGrammarTest, ParsesLimitInt) { TEST(CstGrammarTest, ParsesLimitDouble) { CNode output; auto input = fromjson("{pipeline: [{$limit: 5.0}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -199,8 +199,8 @@ TEST(CstGrammarTest, ParsesLimitDouble) { TEST(CstGrammarTest, ParsesLimitLong) { CNode output; auto input = fromjson("{pipeline: [{$limit: 123123123123}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -211,24 +211,24 @@ TEST(CstGrammarTest, ParsesLimitLong) { TEST(CstGrammarTest, InvalidParseLimitString) { CNode output; auto input = fromjson("{pipeline: [{$limit: \"5\"}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } TEST(CstGrammarTest, InvalidParseLimitObject) { CNode output; auto input = fromjson("{pipeline: [{$limit: {}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } TEST(CstGrammarTest, InvalidParseLimitArray) { CNode output; auto input = fromjson("{pipeline: [{$limit: [2]}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } @@ -238,8 +238,8 @@ TEST(CstGrammarTest, ParsesProject) { auto input = fromjson( "{pipeline: [{$project: {a: 1.0, b: {c: NumberInt(1), d: NumberDecimal('1.0') }, _id: " "NumberLong(1)}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -254,8 +254,8 @@ TEST(CstGrammarTest, ParsesProject) { CNode output; auto input = fromjson( "{pipeline: [{$project: {a: 0.0, b: NumberInt(0), c: { d: { e: NumberLong(0)}}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -271,8 +271,8 @@ TEST(CstGrammarTest, ParsesProject) { "{pipeline: [{$project: {_id: 9.10, a: {$add: [4, 5, {$add: [6, 7, 8]}]}, b: " "{$atan2: " "[1.0, {$add: [2, -3]}]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -287,8 +287,8 @@ TEST(CstGrammarTest, ParsesProject) { { CNode output; auto input = fromjson("{pipeline: [{$project: {a: {$add: [6]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -302,15 +302,15 @@ TEST(CstGrammarTest, FailsToParseMixedProject) { { CNode output; auto input = fromjson("{pipeline: [{$project: {a: 1, b: 0.0}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } { CNode output; auto input = fromjson("{pipeline: [{$project: {a: 0, b: {$add: [5, 67]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } } @@ -319,15 +319,15 @@ TEST(CstGrammarTest, FailsToParseCompoundMixedProject) { { CNode output; auto input = fromjson("{pipeline: [{$project: {a: {b: 1, c: 0.0}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } { CNode output; auto input = fromjson("{pipeline: [{$project: {a: {b: {c: {d: NumberLong(0)}, e: 45}}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } } @@ -336,15 +336,15 @@ TEST(CstGrammarTest, FailsToParseProjectWithDollarFieldNames) { { CNode output; auto input = fromjson("{pipeline: [{$project: {$a: 1}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } { CNode output; auto input = fromjson("{pipeline: [{$project: {b: 1, $a: 1}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } } @@ -448,8 +448,8 @@ TEST(CstGrammarTest, ParsesSampleWithNumericSizeArgument) { { CNode output; auto input = fromjson("{pipeline: [{$sample: {size: NumberInt(1)}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -459,8 +459,8 @@ TEST(CstGrammarTest, ParsesSampleWithNumericSizeArgument) { // Although negative numbers are not valid, this is enforced at translation time. CNode output; auto input = fromjson("{pipeline: [{$sample: {size: NumberInt(-1)}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -469,8 +469,8 @@ TEST(CstGrammarTest, ParsesSampleWithNumericSizeArgument) { { CNode output; auto input = fromjson("{pipeline: [{$sample: {size: NumberLong(5)}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -479,8 +479,8 @@ TEST(CstGrammarTest, ParsesSampleWithNumericSizeArgument) { { CNode output; auto input = fromjson("{pipeline: [{$sample: {size: 10.0}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -490,8 +490,8 @@ TEST(CstGrammarTest, ParsesSampleWithNumericSizeArgument) { { CNode output; auto input = fromjson("{pipeline: [{$sample: {size: 0}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -503,22 +503,22 @@ TEST(CstGrammarTest, InvalidParseSample) { { CNode output; auto input = fromjson("{pipeline: [{$sample: 2}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } { CNode output; auto input = fromjson("{pipeline: [{$sample: {notSize: 2}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } { CNode output; auto input = fromjson("{pipeline: [{$sample: {size: 'gots ta be a number'}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_THROWS_CODE(parseTree.parse(), AssertionException, ErrorCodes::FailedToParse); } } @@ -674,8 +674,8 @@ TEST(CstTest, BuildsAndPrintsType) { TEST(CstGrammarTest, ParsesValidNumberAbs) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$abs: 1}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -687,8 +687,8 @@ TEST(CstGrammarTest, ParsesValidNumberAbs) { TEST(CstGrammarTest, ParsesValidCeil) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$ceil: 1.5}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -700,8 +700,8 @@ TEST(CstGrammarTest, ParsesValidCeil) { TEST(CstGrammarTest, ParsesValidDivide) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$divide: [10, 5]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -713,8 +713,8 @@ TEST(CstGrammarTest, ParsesValidDivide) { TEST(CstGrammarTest, ParsesValidExp) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$exp: 1.5}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -726,8 +726,8 @@ TEST(CstGrammarTest, ParsesValidExp) { TEST(CstGrammarTest, ParsesValidFloor) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$floor: 1.5}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -739,8 +739,8 @@ TEST(CstGrammarTest, ParsesValidFloor) { TEST(CstGrammarTest, ParsesValidLn) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$ln: [37, 10]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -752,8 +752,8 @@ TEST(CstGrammarTest, ParsesValidLn) { TEST(CstGrammarTest, ParsesValidLog) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$log: [10, 5]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -765,8 +765,8 @@ TEST(CstGrammarTest, ParsesValidLog) { TEST(CstGrammarTest, ParsesValidLog10) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$log10: 1.5}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -778,8 +778,8 @@ TEST(CstGrammarTest, ParsesValidLog10) { TEST(CstGrammarTest, ParsesValidMod) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$mod: [10, 5]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -791,8 +791,8 @@ TEST(CstGrammarTest, ParsesValidMod) { TEST(CstGrammarTest, ParsesValidMultiply) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$multiply: [10, 5]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -804,8 +804,8 @@ TEST(CstGrammarTest, ParsesValidMultiply) { TEST(CstGrammarTest, ParsesValidPow) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$pow: [10, 5]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -817,8 +817,8 @@ TEST(CstGrammarTest, ParsesValidPow) { TEST(CstGrammarTest, ParsesValidRound) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$round: [1.234, 2]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -831,8 +831,8 @@ TEST(CstGrammarTest, ParsesValidRound) { TEST(CstGrammarTest, ParsesValidSqrt) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$sqrt: 25}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -844,8 +844,8 @@ TEST(CstGrammarTest, ParsesValidSqrt) { TEST(CstGrammarTest, ParsesValidSubtract) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$subtract: [10, 5]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -857,8 +857,8 @@ TEST(CstGrammarTest, ParsesValidSubtract) { TEST(CstGrammarTest, ParsesValidTrunc) { CNode output; auto input = fromjson("{pipeline: [{$project: {val: {$trunc: [1.234, 2]}}}]}"); - BSONLexer lexer(input["pipeline"].Array(), PipelineParserGen::token::START_PIPELINE); - auto parseTree = PipelineParserGen(lexer, &output); + BSONLexer lexer(input["pipeline"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); auto stages = stdx::get<CNode::ArrayChildren>(output.payload); ASSERT_EQ(1, stages.size()); @@ -870,18 +870,18 @@ TEST(CstGrammarTest, ParsesValidTrunc) { TEST(CstGrammarTest, ParsesEmptyMatchInFind) { CNode output; - auto input = fromjson("{}"); - BSONLexer lexer(input, PipelineParserGen::token::START_MATCH); - auto parseTree = PipelineParserGen(lexer, &output); + auto input = fromjson("{filter: {}}"); + BSONLexer lexer(input["filter"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); ASSERT_EQ(output.toBson().toString(), "{}"); } TEST(CstGrammarTest, ParsesMatchWithEqualityPredicates) { CNode output; - auto input = fromjson("{a: 5.0, b: NumberInt(10), _id: NumberLong(15)}"); - BSONLexer lexer(input, PipelineParserGen::token::START_MATCH); - auto parseTree = PipelineParserGen(lexer, &output); + auto input = fromjson("{filter: {a: 5.0, b: NumberInt(10), _id: NumberLong(15)}}"); + BSONLexer lexer(input["filter"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); ASSERT_EQ(output.toBson().toString(), "{ a: \"<UserDouble 5.000000>\", b: \"<UserInt 10>\", _id: \"<UserLong 15>\" }"); @@ -889,19 +889,19 @@ TEST(CstGrammarTest, ParsesMatchWithEqualityPredicates) { TEST(CstGrammarTest, FailsToParseDollarPrefixedPredicates) { { - auto input = fromjson("{$atan2: [3, 5]}"); - BSONLexer lexer(input, PipelineParserGen::token::START_MATCH); + auto input = fromjson("{filter: {$atan2: [3, 5]}}"); + BSONLexer lexer(input["filter"]); ASSERT_THROWS_CODE_AND_WHAT( - PipelineParserGen(lexer, nullptr).parse(), + ParserGen(lexer, nullptr).parse(), AssertionException, ErrorCodes::FailedToParse, "syntax error, unexpected ATAN2 at element '$atan2' of input filter"); } { - auto input = fromjson("{$prefixed: 5}"); - BSONLexer lexer(input, PipelineParserGen::token::START_MATCH); + auto input = fromjson("{filter: {$prefixed: 5}}"); + BSONLexer lexer(input["filter"]); ASSERT_THROWS_CODE_AND_WHAT( - PipelineParserGen(lexer, nullptr).parse(), + ParserGen(lexer, nullptr).parse(), AssertionException, ErrorCodes::FailedToParse, "syntax error, unexpected $-prefixed fieldname at element '$prefixed' of input filter"); @@ -910,9 +910,9 @@ TEST(CstGrammarTest, FailsToParseDollarPrefixedPredicates) { TEST(CstGrammarTest, ParsesBasicSort) { CNode output; - auto input = fromjson("{val: 1, test: -1}"); - BSONLexer lexer(input, PipelineParserGen::token::START_SORT); - auto parseTree = PipelineParserGen(lexer, &output); + auto input = fromjson("{sort: {val: 1, test: -1}}"); + BSONLexer lexer(input["sort"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); ASSERT_EQ(output.toBson().toString(), "{ val: \"<KeyValue intOneKey>\", test: \"<KeyValue intNegOneKey>\" }"); @@ -920,9 +920,9 @@ TEST(CstGrammarTest, ParsesBasicSort) { TEST(CstGrammarTest, ParsesMetaSort) { CNode output; - auto input = fromjson("{val: {$meta: \"textScore\"}}"); - BSONLexer lexer(input, PipelineParserGen::token::START_SORT); - auto parseTree = PipelineParserGen(lexer, &output); + auto input = fromjson("{sort: {val: {$meta: \"textScore\"}}}"); + BSONLexer lexer(input["sort"]); + auto parseTree = ParserGen(lexer, &output); ASSERT_EQ(0, parseTree.parse()); ASSERT_EQ(output.toBson().toString(), "{ val: { meta: \"<KeyValue textScore>\" } }"); } diff --git a/src/mongo/db/cst/pipeline_grammar.yy b/src/mongo/db/cst/grammar.yy index fa9580fedcd..dd3cd8ae01e 100644 --- a/src/mongo/db/cst/pipeline_grammar.yy +++ b/src/mongo/db/cst/grammar.yy @@ -28,12 +28,11 @@ */ // -// This is a grammar file to describe the syntax of the aggregation pipeline language. It is +// This is a grammar file to describe the syntax of the Mongo Query Language. It is // ingested by GNU Bison (https://www.gnu.org/software/bison/) to generate native C++ parser code // based on the rules provided here. // -// To manually generate the parser files, run -// 'bison pipeline_grammar.yy -o pipeline_parser_gen.cpp'. +// To manually generate the parser files, run 'bison grammar.yy -o parser_gen.cpp'. // %require "3.5" %language "c++" @@ -56,7 +55,7 @@ %define parse.assert %define api.namespace {mongo} -%define api.parser.class {PipelineParserGen} +%define api.parser.class {ParserGen} // Track locations of symbols. %locations @@ -90,7 +89,7 @@ namespace mongo { // Mandatory error function. - void PipelineParserGen::error (const PipelineParserGen::location_type& loc, + void ParserGen::error (const ParserGen::location_type& loc, const std::string& msg) { uasserted(ErrorCodes::FailedToParse, str::stream() << msg << " at element " << loc); } @@ -122,6 +121,7 @@ ARG_COLL "coll argument" ARG_DATE "date argument" ARG_DATE_STRING "dateString argument" + ARG_FILTER "filter" ARG_FIND "find argument" ARG_FORMAT "format argument" ARG_INPUT "input argument" @@ -129,9 +129,12 @@ ARG_ON_NULL "onNull argument" ARG_OPTIONS "options argument" ARG_PIPELINE "pipeline argument" + ARG_Q "q" + ARG_QUERY "query" ARG_REGEX "regex argument" ARG_REPLACEMENT "replacement argument" ARG_SIZE "size argument" + ARG_SORT "sort argument" ARG_TIMEZONE "timezone argument" ARG_TO "to argument" ATAN2 @@ -246,7 +249,6 @@ %token <std::string> DOLLAR_STRING "$-prefixed string" %token <std::string> DOLLAR_DOLLAR_STRING "$$-prefixed string" %token <std::string> DOLLAR_PREF_FIELDNAME "$-prefixed fieldname" -%token START_PIPELINE START_MATCH START_SORT // // Semantic values (aka the C++ types produced by the actions). @@ -294,16 +296,20 @@ %% start: - START_PIPELINE pipeline { - invariant(cst); + ARG_PIPELINE pipeline { *cst = $pipeline; } - | START_MATCH matchExpression { - invariant(cst); + | ARG_FILTER matchExpression { *cst = $matchExpression; } - | START_SORT sortSpecs { - *cst = CNode{$sortSpecs}; + | ARG_QUERY matchExpression { + *cst = $matchExpression; + } + | ARG_Q matchExpression { + *cst = $matchExpression; + } + | ARG_SORT sortSpecs { + *cst = $sortSpecs; } ; @@ -596,6 +602,12 @@ argAsUserFieldname: | ARG_REPLACEMENT { $$ = UserFieldname{"replacement"}; } + | ARG_FILTER { + $$ = UserFieldname{"filter"}; + } + | ARG_Q { + $$ = UserFieldname{"q"}; + } ; aggExprAsUserFieldname: diff --git a/src/mongo/db/cst/parser_gen.cpp b/src/mongo/db/cst/parser_gen.cpp new file mode 100644 index 00000000000..8a09ff6ad2c --- /dev/null +++ b/src/mongo/db/cst/parser_gen.cpp @@ -0,0 +1,6165 @@ +// A Bison parser, made by GNU Bison 3.5.4. + +// Skeleton implementation for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015, 2018-2020 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 <http://www.gnu.org/licenses/>. + +// 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. + +// Undocumented macros, especially those whose name start with YY_, +// are private implementation details. Do not rely on them. + + +#include "parser_gen.hpp" + + +// Unqualified %code blocks. +#line 82 "src/mongo/db/cst/grammar.yy" + +#include "mongo/db/cst/bson_lexer.h" +#include "mongo/db/cst/c_node_disambiguation.h" +#include "mongo/db/cst/c_node_validation.h" +#include "mongo/db/cst/key_fieldname.h" +#include "mongo/platform/decimal128.h" +#include "mongo/stdx/variant.h" + +namespace mongo { +// Mandatory error function. +void ParserGen::error(const ParserGen::location_type& loc, const std::string& msg) { + uasserted(ErrorCodes::FailedToParse, str::stream() << msg << " at element " << loc); +} +} // namespace mongo + +// Default location for actions, called each time a rule is matched but before the action is +// run. Also called when bison encounters a syntax ambiguity, which should not be relevant for +// mongo. +#define YYLLOC_DEFAULT(newPos, rhsPositions, nRhs) + +#line 67 "src/mongo/db/cst/parser_gen.cpp" + + +#ifndef YY_ +#if defined YYENABLE_NLS && YYENABLE_NLS +#if ENABLE_NLS +#include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE. +#define YY_(msgid) dgettext("bison-runtime", msgid) +#endif +#endif +#ifndef YY_ +#define YY_(msgid) msgid +#endif +#endif + +// Whether we are compiled with exception support. +#ifndef YY_EXCEPTIONS +#if defined __GNUC__ && !defined __EXCEPTIONS +#define YY_EXCEPTIONS 0 +#else +#define YY_EXCEPTIONS 1 +#endif +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) +/* 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).begin = YYRHSLOC(Rhs, 1).begin; \ + (Current).end = YYRHSLOC(Rhs, N).end; \ + } else { \ + (Current).begin = (Current).end = YYRHSLOC(Rhs, 0).end; \ + } \ + while (false) +#endif + + +// Enable debugging if requested. +#if YYDEBUG + +// A pseudo ostream that takes yydebug_ into account. +#define YYCDEBUG \ + if (yydebug_) \ + (*yycdebug_) + +#define YY_SYMBOL_PRINT(Title, Symbol) \ + do { \ + if (yydebug_) { \ + *yycdebug_ << Title << ' '; \ + yy_print_(*yycdebug_, Symbol); \ + *yycdebug_ << '\n'; \ + } \ + } while (false) + +#define YY_REDUCE_PRINT(Rule) \ + do { \ + if (yydebug_) \ + yy_reduce_print_(Rule); \ + } while (false) + +#define YY_STACK_PRINT() \ + do { \ + if (yydebug_) \ + yystack_print_(); \ + } while (false) + +#else // !YYDEBUG + +#define YYCDEBUG \ + if (false) \ + std::cerr +#define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol) +#define YY_REDUCE_PRINT(Rule) static_cast<void>(0) +#define YY_STACK_PRINT() static_cast<void>(0) + +#endif // !YYDEBUG + +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yyla.clear()) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) + +#line 57 "src/mongo/db/cst/grammar.yy" +namespace mongo { +#line 159 "src/mongo/db/cst/parser_gen.cpp" + + +/* Return 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. */ +std::string ParserGen::yytnamerr_(const char* yystr) { + if (*yystr == '"') { + std::string yyr; + 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: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes:; + } + + return yystr; +} + + +/// Build a parser object. +ParserGen::ParserGen(BSONLexer& lexer_yyarg, CNode* cst_yyarg) +#if YYDEBUG + : yydebug_(false), + yycdebug_(&std::cerr), +#else + : +#endif + lexer(lexer_yyarg), + cst(cst_yyarg) { +} + +ParserGen::~ParserGen() {} + +ParserGen::syntax_error::~syntax_error() YY_NOEXCEPT YY_NOTHROW {} + +/*---------------. +| Symbol types. | +`---------------*/ + + +// by_state. +ParserGen::by_state::by_state() YY_NOEXCEPT : state(empty_state) {} + +ParserGen::by_state::by_state(const by_state& that) YY_NOEXCEPT : state(that.state) {} + +void ParserGen::by_state::clear() YY_NOEXCEPT { + state = empty_state; +} + +void ParserGen::by_state::move(by_state& that) { + state = that.state; + that.clear(); +} + +ParserGen::by_state::by_state(state_type s) YY_NOEXCEPT : state(s) {} + +ParserGen::symbol_number_type ParserGen::by_state::type_get() const YY_NOEXCEPT { + if (state == empty_state) + return empty_symbol; + else + return yystos_[+state]; +} + +ParserGen::stack_symbol_type::stack_symbol_type() {} + +ParserGen::stack_symbol_type::stack_symbol_type(YY_RVREF(stack_symbol_type) that) + : super_type(YY_MOVE(that.state), YY_MOVE(that.location)) { + switch (that.type_get()) { + case 114: // "BinData" + value.YY_MOVE_OR_COPY<BSONBinData>(YY_MOVE(that.value)); + break; + + case 121: // "Code" + value.YY_MOVE_OR_COPY<BSONCode>(YY_MOVE(that.value)); + break; + + case 123: // "CodeWScope" + value.YY_MOVE_OR_COPY<BSONCodeWScope>(YY_MOVE(that.value)); + break; + + case 120: // "dbPointer" + value.YY_MOVE_OR_COPY<BSONDBRef>(YY_MOVE(that.value)); + break; + + case 119: // "regex" + value.YY_MOVE_OR_COPY<BSONRegEx>(YY_MOVE(that.value)); + break; + + case 122: // "Symbol" + value.YY_MOVE_OR_COPY<BSONSymbol>(YY_MOVE(that.value)); + break; + + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword + value.YY_MOVE_OR_COPY<CNode>(YY_MOVE(that.value)); + break; + + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname + value.YY_MOVE_OR_COPY<CNode::Fieldname>(YY_MOVE(that.value)); + break; + + case 117: // "Date" + value.YY_MOVE_OR_COPY<Date_t>(YY_MOVE(that.value)); + break; + + case 127: // "arbitrary decimal" + value.YY_MOVE_OR_COPY<Decimal128>(YY_MOVE(that.value)); + break; + + case 116: // "ObjectID" + value.YY_MOVE_OR_COPY<OID>(YY_MOVE(that.value)); + break; + + case 128: // "Timestamp" + value.YY_MOVE_OR_COPY<Timestamp>(YY_MOVE(that.value)); + break; + + case 130: // "maxKey" + value.YY_MOVE_OR_COPY<UserMaxKey>(YY_MOVE(that.value)); + break; + + case 129: // "minKey" + value.YY_MOVE_OR_COPY<UserMinKey>(YY_MOVE(that.value)); + break; + + case 118: // "null" + value.YY_MOVE_OR_COPY<UserNull>(YY_MOVE(that.value)); + break; + + case 115: // "undefined" + value.YY_MOVE_OR_COPY<UserUndefined>(YY_MOVE(that.value)); + break; + + case 126: // "arbitrary double" + value.YY_MOVE_OR_COPY<double>(YY_MOVE(that.value)); + break; + + case 124: // "arbitrary integer" + value.YY_MOVE_OR_COPY<int>(YY_MOVE(that.value)); + break; + + case 125: // "arbitrary long" + value.YY_MOVE_OR_COPY<long long>(YY_MOVE(that.value)); + break; + + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec + value.YY_MOVE_OR_COPY<std::pair<CNode::Fieldname, CNode>>(YY_MOVE(that.value)); + break; + + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" + value.YY_MOVE_OR_COPY<std::string>(YY_MOVE(that.value)); + break; + + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo + value.YY_MOVE_OR_COPY<std::vector<CNode>>(YY_MOVE(that.value)); + break; + + default: + break; + } + +#if 201103L <= YY_CPLUSPLUS + // that is emptied. + that.state = empty_state; +#endif +} + +ParserGen::stack_symbol_type::stack_symbol_type(state_type s, YY_MOVE_REF(symbol_type) that) + : super_type(s, YY_MOVE(that.location)) { + switch (that.type_get()) { + case 114: // "BinData" + value.move<BSONBinData>(YY_MOVE(that.value)); + break; + + case 121: // "Code" + value.move<BSONCode>(YY_MOVE(that.value)); + break; + + case 123: // "CodeWScope" + value.move<BSONCodeWScope>(YY_MOVE(that.value)); + break; + + case 120: // "dbPointer" + value.move<BSONDBRef>(YY_MOVE(that.value)); + break; + + case 119: // "regex" + value.move<BSONRegEx>(YY_MOVE(that.value)); + break; + + case 122: // "Symbol" + value.move<BSONSymbol>(YY_MOVE(that.value)); + break; + + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword + value.move<CNode>(YY_MOVE(that.value)); + break; + + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname + value.move<CNode::Fieldname>(YY_MOVE(that.value)); + break; + + case 117: // "Date" + value.move<Date_t>(YY_MOVE(that.value)); + break; + + case 127: // "arbitrary decimal" + value.move<Decimal128>(YY_MOVE(that.value)); + break; + + case 116: // "ObjectID" + value.move<OID>(YY_MOVE(that.value)); + break; + + case 128: // "Timestamp" + value.move<Timestamp>(YY_MOVE(that.value)); + break; + + case 130: // "maxKey" + value.move<UserMaxKey>(YY_MOVE(that.value)); + break; + + case 129: // "minKey" + value.move<UserMinKey>(YY_MOVE(that.value)); + break; + + case 118: // "null" + value.move<UserNull>(YY_MOVE(that.value)); + break; + + case 115: // "undefined" + value.move<UserUndefined>(YY_MOVE(that.value)); + break; + + case 126: // "arbitrary double" + value.move<double>(YY_MOVE(that.value)); + break; + + case 124: // "arbitrary integer" + value.move<int>(YY_MOVE(that.value)); + break; + + case 125: // "arbitrary long" + value.move<long long>(YY_MOVE(that.value)); + break; + + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec + value.move<std::pair<CNode::Fieldname, CNode>>(YY_MOVE(that.value)); + break; + + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" + value.move<std::string>(YY_MOVE(that.value)); + break; + + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo + value.move<std::vector<CNode>>(YY_MOVE(that.value)); + break; + + default: + break; + } + + // that is emptied. + that.type = empty_symbol; +} + +#if YY_CPLUSPLUS < 201103L +ParserGen::stack_symbol_type& ParserGen::stack_symbol_type::operator=( + const stack_symbol_type& that) { + state = that.state; + switch (that.type_get()) { + case 114: // "BinData" + value.copy<BSONBinData>(that.value); + break; + + case 121: // "Code" + value.copy<BSONCode>(that.value); + break; + + case 123: // "CodeWScope" + value.copy<BSONCodeWScope>(that.value); + break; + + case 120: // "dbPointer" + value.copy<BSONDBRef>(that.value); + break; + + case 119: // "regex" + value.copy<BSONRegEx>(that.value); + break; + + case 122: // "Symbol" + value.copy<BSONSymbol>(that.value); + break; + + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword + value.copy<CNode>(that.value); + break; + + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname + value.copy<CNode::Fieldname>(that.value); + break; + + case 117: // "Date" + value.copy<Date_t>(that.value); + break; + + case 127: // "arbitrary decimal" + value.copy<Decimal128>(that.value); + break; + + case 116: // "ObjectID" + value.copy<OID>(that.value); + break; + + case 128: // "Timestamp" + value.copy<Timestamp>(that.value); + break; + + case 130: // "maxKey" + value.copy<UserMaxKey>(that.value); + break; + + case 129: // "minKey" + value.copy<UserMinKey>(that.value); + break; + + case 118: // "null" + value.copy<UserNull>(that.value); + break; + + case 115: // "undefined" + value.copy<UserUndefined>(that.value); + break; + + case 126: // "arbitrary double" + value.copy<double>(that.value); + break; + + case 124: // "arbitrary integer" + value.copy<int>(that.value); + break; + + case 125: // "arbitrary long" + value.copy<long long>(that.value); + break; + + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec + value.copy<std::pair<CNode::Fieldname, CNode>>(that.value); + break; + + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" + value.copy<std::string>(that.value); + break; + + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo + value.copy<std::vector<CNode>>(that.value); + break; + + default: + break; + } + + location = that.location; + return *this; +} + +ParserGen::stack_symbol_type& ParserGen::stack_symbol_type::operator=(stack_symbol_type& that) { + state = that.state; + switch (that.type_get()) { + case 114: // "BinData" + value.move<BSONBinData>(that.value); + break; + + case 121: // "Code" + value.move<BSONCode>(that.value); + break; + + case 123: // "CodeWScope" + value.move<BSONCodeWScope>(that.value); + break; + + case 120: // "dbPointer" + value.move<BSONDBRef>(that.value); + break; + + case 119: // "regex" + value.move<BSONRegEx>(that.value); + break; + + case 122: // "Symbol" + value.move<BSONSymbol>(that.value); + break; + + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword + value.move<CNode>(that.value); + break; + + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname + value.move<CNode::Fieldname>(that.value); + break; + + case 117: // "Date" + value.move<Date_t>(that.value); + break; + + case 127: // "arbitrary decimal" + value.move<Decimal128>(that.value); + break; + + case 116: // "ObjectID" + value.move<OID>(that.value); + break; + + case 128: // "Timestamp" + value.move<Timestamp>(that.value); + break; + + case 130: // "maxKey" + value.move<UserMaxKey>(that.value); + break; + + case 129: // "minKey" + value.move<UserMinKey>(that.value); + break; + + case 118: // "null" + value.move<UserNull>(that.value); + break; + + case 115: // "undefined" + value.move<UserUndefined>(that.value); + break; + + case 126: // "arbitrary double" + value.move<double>(that.value); + break; + + case 124: // "arbitrary integer" + value.move<int>(that.value); + break; + + case 125: // "arbitrary long" + value.move<long long>(that.value); + break; + + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec + value.move<std::pair<CNode::Fieldname, CNode>>(that.value); + break; + + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" + value.move<std::string>(that.value); + break; + + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo + value.move<std::vector<CNode>>(that.value); + break; + + default: + break; + } + + location = that.location; + // that is emptied. + that.state = empty_state; + return *this; +} +#endif + +template <typename Base> +void ParserGen::yy_destroy_(const char* yymsg, basic_symbol<Base>& yysym) const { + if (yymsg) + YY_SYMBOL_PRINT(yymsg, yysym); +} + +#if YYDEBUG +template <typename Base> +void ParserGen::yy_print_(std::ostream& yyo, const basic_symbol<Base>& yysym) const { + std::ostream& yyoutput = yyo; + YYUSE(yyoutput); + symbol_number_type yytype = yysym.type_get(); +#if defined __GNUC__ && !defined __clang__ && !defined __ICC && \ + __GNUC__ * 100 + __GNUC_MINOR__ <= 408 + // Avoid a (spurious) G++ 4.8 warning about "array subscript is + // below array bounds". + if (yysym.empty()) + std::abort(); +#endif + yyo << (yytype < yyntokens_ ? "token" : "nterm") << ' ' << yytname_[yytype] << " (" + << yysym.location << ": "; + YYUSE(yytype); + yyo << ')'; +} +#endif + +void ParserGen::yypush_(const char* m, YY_MOVE_REF(stack_symbol_type) sym) { + if (m) + YY_SYMBOL_PRINT(m, sym); + yystack_.push(YY_MOVE(sym)); +} + +void ParserGen::yypush_(const char* m, state_type s, YY_MOVE_REF(symbol_type) sym) { +#if 201103L <= YY_CPLUSPLUS + yypush_(m, stack_symbol_type(s, std::move(sym))); +#else + stack_symbol_type ss(s, sym); + yypush_(m, ss); +#endif +} + +void ParserGen::yypop_(int n) { + yystack_.pop(n); +} + +#if YYDEBUG +std::ostream& ParserGen::debug_stream() const { + return *yycdebug_; +} + +void ParserGen::set_debug_stream(std::ostream& o) { + yycdebug_ = &o; +} + + +ParserGen::debug_level_type ParserGen::debug_level() const { + return yydebug_; +} + +void ParserGen::set_debug_level(debug_level_type l) { + yydebug_ = l; +} +#endif // YYDEBUG + +ParserGen::state_type ParserGen::yy_lr_goto_state_(state_type yystate, int yysym) { + int yyr = yypgoto_[yysym - yyntokens_] + yystate; + if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) + return yytable_[yyr]; + else + return yydefgoto_[yysym - yyntokens_]; +} + +bool ParserGen::yy_pact_value_is_default_(int yyvalue) { + return yyvalue == yypact_ninf_; +} + +bool ParserGen::yy_table_value_is_error_(int yyvalue) { + return yyvalue == yytable_ninf_; +} + +int ParserGen::operator()() { + return parse(); +} + +int ParserGen::parse() { + int yyn; + /// Length of the RHS of the rule being reduced. + int yylen = 0; + + // Error handling. + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// The lookahead symbol. + symbol_type yyla; + + /// The locations where the error started and ended. + stack_symbol_type yyerror_range[3]; + + /// The return value of parse (). + int yyresult; + +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + YYCDEBUG << "Starting parse\n"; + + + /* Initialize the stack. The initial state will be set in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystack_.clear(); + yypush_(YY_NULLPTR, 0, YY_MOVE(yyla)); + + /*-----------------------------------------------. + | yynewstate -- push a new symbol on the stack. | + `-----------------------------------------------*/ + yynewstate: + YYCDEBUG << "Entering state " << int(yystack_[0].state) << '\n'; + + // Accept? + if (yystack_[0].state == yyfinal_) + YYACCEPT; + + goto yybackup; + + + /*-----------. + | yybackup. | + `-----------*/ + yybackup: + // Try to take a decision without lookahead. + yyn = yypact_[+yystack_[0].state]; + if (yy_pact_value_is_default_(yyn)) + goto yydefault; + + // Read a lookahead token. + if (yyla.empty()) { + YYCDEBUG << "Reading a token: "; +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + symbol_type yylookahead(yylex(lexer)); + yyla.move(yylookahead); + } +#if YY_EXCEPTIONS + catch (const syntax_error& yyexc) { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; + error(yyexc); + goto yyerrlab1; + } +#endif // YY_EXCEPTIONS + } + YY_SYMBOL_PRINT("Next token is", yyla); + + /* If the proper action on seeing token YYLA.TYPE is to reduce or + to detect an error, take that action. */ + yyn += yyla.type_get(); + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get()) { + goto yydefault; + } + + // Reduce or error. + yyn = yytable_[yyn]; + if (yyn <= 0) { + if (yy_table_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. + yypush_("Shifting", state_type(yyn), YY_MOVE(yyla)); + goto yynewstate; + + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[+yystack_[0].state]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + + /*-----------------------------. + | yyreduce -- do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + { + stack_symbol_type yylhs; + yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]); + /* Variants are always initialized to an empty instance of the + correct type. The default '$$ = $1' action is NOT applied + when using variants. */ + switch (yyr1_[yyn]) { + case 114: // "BinData" + yylhs.value.emplace<BSONBinData>(); + break; + + case 121: // "Code" + yylhs.value.emplace<BSONCode>(); + break; + + case 123: // "CodeWScope" + yylhs.value.emplace<BSONCodeWScope>(); + break; + + case 120: // "dbPointer" + yylhs.value.emplace<BSONDBRef>(); + break; + + case 119: // "regex" + yylhs.value.emplace<BSONRegEx>(); + break; + + case 122: // "Symbol" + yylhs.value.emplace<BSONSymbol>(); + break; + + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword + yylhs.value.emplace<CNode>(); + break; + + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname + yylhs.value.emplace<CNode::Fieldname>(); + break; + + case 117: // "Date" + yylhs.value.emplace<Date_t>(); + break; + + case 127: // "arbitrary decimal" + yylhs.value.emplace<Decimal128>(); + break; + + case 116: // "ObjectID" + yylhs.value.emplace<OID>(); + break; + + case 128: // "Timestamp" + yylhs.value.emplace<Timestamp>(); + break; + + case 130: // "maxKey" + yylhs.value.emplace<UserMaxKey>(); + break; + + case 129: // "minKey" + yylhs.value.emplace<UserMinKey>(); + break; + + case 118: // "null" + yylhs.value.emplace<UserNull>(); + break; + + case 115: // "undefined" + yylhs.value.emplace<UserUndefined>(); + break; + + case 126: // "arbitrary double" + yylhs.value.emplace<double>(); + break; + + case 124: // "arbitrary integer" + yylhs.value.emplace<int>(); + break; + + case 125: // "arbitrary long" + yylhs.value.emplace<long long>(); + break; + + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec + yylhs.value.emplace<std::pair<CNode::Fieldname, CNode>>(); + break; + + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" + yylhs.value.emplace<std::string>(); + break; + + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo + yylhs.value.emplace<std::vector<CNode>>(); + break; + + default: + break; + } + + + // Default location. + { + stack_type::slice range(yystack_, yylen); + YYLLOC_DEFAULT(yylhs.location, range, yylen); + yyerror_range[1].location = yylhs.location; + } + + // Perform the reduction. + YY_REDUCE_PRINT(yyn); +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + switch (yyn) { + case 2: +#line 299 "src/mongo/db/cst/grammar.yy" + { + *cst = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1749 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 3: +#line 302 "src/mongo/db/cst/grammar.yy" + { + *cst = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1757 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 4: +#line 305 "src/mongo/db/cst/grammar.yy" + { + *cst = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1765 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 5: +#line 308 "src/mongo/db/cst/grammar.yy" + { + *cst = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1773 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 6: +#line 311 "src/mongo/db/cst/grammar.yy" + { + *cst = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1781 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 7: +#line 318 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + } +#line 1789 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 8: +#line 324 "src/mongo/db/cst/grammar.yy" + { + } +#line 1795 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 9: +#line 325 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>())}}; + } +#line 1803 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 10: +#line 333 "src/mongo/db/cst/grammar.yy" + { + lexer.sortObjTokens(); + } +#line 1809 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 12: +#line 336 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1815 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 13: +#line 336 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1821 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 14: +#line 336 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1827 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 15: +#line 336 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1833 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 16: +#line 336 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1839 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 17: +#line 336 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1845 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 18: +#line 339 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{std::pair{ + KeyFieldname::sample, + CNode{CNode::ObjectChildren{ + {KeyFieldname::sizeArg, YY_MOVE(yystack_[1].value.as<CNode>())}, + }}}}}; + } +#line 1857 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 19: +#line 349 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + std::pair{KeyFieldname::inhibitOptimization, CNode::noopLeaf()}}}; + } +#line 1865 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 20: +#line 355 "src/mongo/db/cst/grammar.yy" + { + auto pipeline = YY_MOVE(yystack_[1].value.as<CNode>()); + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{std::pair{ + KeyFieldname::unionWith, + CNode{CNode::ObjectChildren{ + {KeyFieldname::collArg, YY_MOVE(yystack_[3].value.as<CNode>())}, + {KeyFieldname::pipelineArg, std::move(pipeline)}}}}}}; + } +#line 1878 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 21: +#line 365 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1884 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 22: +#line 365 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1890 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 23: +#line 365 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1896 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 24: +#line 365 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1902 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 25: +#line 369 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + std::pair{KeyFieldname::skip, YY_MOVE(yystack_[0].value.as<CNode>())}}}; + } +#line 1910 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 26: +#line 374 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{std::pair{ + KeyFieldname::limit, YY_MOVE(yystack_[0].value.as<CNode>())}}}; + } +#line 1918 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 27: +#line 379 "src/mongo/db/cst/grammar.yy" + { + auto&& fields = YY_MOVE(yystack_[1].value.as<CNode>()); + if (auto inclusion = + c_node_validation::validateProjectionAsInclusionOrExclusion(fields); + inclusion.isOK()) + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{std::pair{ + inclusion.getValue() == c_node_validation::IsInclusion::yes + ? KeyFieldname::projectInclusion + : KeyFieldname::projectExclusion, + std::move(fields)}}}; + else + // Pass the location of the $project token to the error reporting + // function. + error(yystack_[3].location, inclusion.getStatus().reason()); + } +#line 1936 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 28: +#line 395 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode::noopLeaf(); + } +#line 1944 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 29: +#line 398 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + yylhs.value.as<CNode>().objectChildren().emplace_back( + YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); + } +#line 1953 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 30: +#line 405 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { + KeyFieldname::id, YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 1961 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 31: +#line 408 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { + YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), + YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 1969 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 32: +#line 414 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1975 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 33: +#line 415 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1981 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 34: +#line 416 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1987 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 35: +#line 417 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1993 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 36: +#line 418 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 1999 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 37: +#line 419 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2005 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 38: +#line 420 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2011 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 39: +#line 421 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2017 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 40: +#line 422 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2023 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 41: +#line 423 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2029 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 42: +#line 424 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2035 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 43: +#line 425 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{NonZeroKey{1}}; + } +#line 2043 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 44: +#line 428 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{NonZeroKey{-1}}; + } +#line 2051 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 45: +#line 431 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{NonZeroKey{YY_MOVE(yystack_[0].value.as<int>())}}; + } +#line 2059 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 46: +#line 434 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::intZeroKey}; + } +#line 2067 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 47: +#line 437 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{NonZeroKey{1ll}}; + } +#line 2075 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 48: +#line 440 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{NonZeroKey{-1ll}}; + } +#line 2083 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 49: +#line 443 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{NonZeroKey{YY_MOVE(yystack_[0].value.as<long long>())}}; + } +#line 2091 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 50: +#line 446 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::longZeroKey}; + } +#line 2099 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 51: +#line 449 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{NonZeroKey{1.0}}; + } +#line 2107 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 52: +#line 452 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{NonZeroKey{-1.0}}; + } +#line 2115 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 53: +#line 455 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{NonZeroKey{YY_MOVE(yystack_[0].value.as<double>())}}; + } +#line 2123 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 54: +#line 458 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::doubleZeroKey}; + } +#line 2131 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 55: +#line 461 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{NonZeroKey{1.0}}; + } +#line 2139 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 56: +#line 464 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{NonZeroKey{-1.0}}; + } +#line 2147 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 57: +#line 467 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{NonZeroKey{YY_MOVE(yystack_[0].value.as<Decimal128>())}}; + } +#line 2155 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 58: +#line 470 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::decimalZeroKey}; + } +#line 2163 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 59: +#line 473 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::trueKey}; + } +#line 2171 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 60: +#line 476 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::falseKey}; + } +#line 2179 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 61: +#line 479 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2185 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 62: +#line 480 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2191 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 63: +#line 481 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2197 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 64: +#line 482 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + c_node_disambiguation::disambiguateCompoundProjection( + YY_MOVE(yystack_[0].value.as<CNode>())); + if (stdx::holds_alternative<CompoundInconsistentKey>( + yylhs.value.as<CNode>().payload)) + // TODO SERVER-50498: error() instead of uasserting + uasserted(ErrorCodes::FailedToParse, + "object project field cannot contain both inclusion and " + "exclusion indicators"); + } +#line 2208 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 65: +#line 491 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 2214 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 66: +#line 491 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 2220 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 67: +#line 491 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 2226 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 68: +#line 491 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 2232 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 69: +#line 495 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + } +#line 2240 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 70: +#line 501 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode::noopLeaf(); + } +#line 2248 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 71: +#line 504 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + yylhs.value.as<CNode>().objectChildren().emplace_back( + YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); + } +#line 2257 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 72: +#line 510 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { + YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), + YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 2265 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 73: +#line 516 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 2271 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 74: +#line 521 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 2277 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 75: +#line 521 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 2283 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 76: +#line 521 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 2289 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 77: +#line 525 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + UserFieldname{YY_MOVE(yystack_[0].value.as<std::string>())}; + } +#line 2297 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 78: +#line 533 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + UserFieldname{"$_internalInhibitOptimization"}; + } +#line 2305 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 79: +#line 536 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$unionWith"}; + } +#line 2313 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 80: +#line 539 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$skip"}; + } +#line 2321 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 81: +#line 542 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$limit"}; + } +#line 2329 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 82: +#line 545 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$project"}; + } +#line 2337 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 83: +#line 548 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$sample"}; + } +#line 2345 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 84: +#line 557 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"coll"}; + } +#line 2353 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 85: +#line 560 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"pipeline"}; + } +#line 2361 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 86: +#line 563 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"size"}; + } +#line 2369 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 87: +#line 566 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"input"}; + } +#line 2377 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 88: +#line 569 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"to"}; + } +#line 2385 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 89: +#line 572 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"onError"}; + } +#line 2393 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 90: +#line 575 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"onNull"}; + } +#line 2401 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 91: +#line 578 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"dateString"}; + } +#line 2409 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 92: +#line 581 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"format"}; + } +#line 2417 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 93: +#line 584 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"timezone"}; + } +#line 2425 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 94: +#line 587 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"date"}; + } +#line 2433 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 95: +#line 590 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"chars"}; + } +#line 2441 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 96: +#line 593 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"regex"}; + } +#line 2449 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 97: +#line 596 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"options"}; + } +#line 2457 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 98: +#line 599 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"find"}; + } +#line 2465 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 99: +#line 602 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"replacement"}; + } +#line 2473 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 100: +#line 605 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"filter"}; + } +#line 2481 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 101: +#line 608 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"q"}; + } +#line 2489 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 102: +#line 616 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$add"}; + } +#line 2497 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 103: +#line 619 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$atan2"}; + } +#line 2505 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 104: +#line 622 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$and"}; + } +#line 2513 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 105: +#line 625 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$const"}; + } +#line 2521 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 106: +#line 628 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$literal"}; + } +#line 2529 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 107: +#line 631 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$or"}; + } +#line 2537 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 108: +#line 634 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$not"}; + } +#line 2545 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 109: +#line 637 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$cmp"}; + } +#line 2553 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 110: +#line 640 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$eq"}; + } +#line 2561 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 111: +#line 643 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$gt"}; + } +#line 2569 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 112: +#line 646 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$gte"}; + } +#line 2577 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 113: +#line 649 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$lt"}; + } +#line 2585 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 114: +#line 652 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$lte"}; + } +#line 2593 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 115: +#line 655 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$ne"}; + } +#line 2601 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 116: +#line 658 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$convert"}; + } +#line 2609 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 117: +#line 661 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toBool"}; + } +#line 2617 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 118: +#line 664 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toDate"}; + } +#line 2625 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 119: +#line 667 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toDecimal"}; + } +#line 2633 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 120: +#line 670 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toDouble"}; + } +#line 2641 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 121: +#line 673 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toInt"}; + } +#line 2649 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 122: +#line 676 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toLong"}; + } +#line 2657 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 123: +#line 679 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toObjectId"}; + } +#line 2665 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 124: +#line 682 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toString"}; + } +#line 2673 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 125: +#line 685 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$type"}; + } +#line 2681 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 126: +#line 688 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$abs"}; + } +#line 2689 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 127: +#line 691 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$ceil"}; + } +#line 2697 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 128: +#line 694 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$divide"}; + } +#line 2705 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 129: +#line 697 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$exp"}; + } +#line 2713 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 130: +#line 700 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$floor"}; + } +#line 2721 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 131: +#line 703 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$ln"}; + } +#line 2729 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 132: +#line 706 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$log"}; + } +#line 2737 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 133: +#line 709 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$log10"}; + } +#line 2745 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 134: +#line 712 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$mod"}; + } +#line 2753 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 135: +#line 715 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$multiply"}; + } +#line 2761 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 136: +#line 718 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$pow"}; + } +#line 2769 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 137: +#line 721 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$round"}; + } +#line 2777 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 138: +#line 724 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$sqrt"}; + } +#line 2785 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 139: +#line 727 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$subtract"}; + } +#line 2793 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 140: +#line 730 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$trunc"}; + } +#line 2801 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 141: +#line 733 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$concat"}; + } +#line 2809 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 142: +#line 736 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$dateFromString"}; + } +#line 2817 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 143: +#line 739 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$dateToString"}; + } +#line 2825 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 144: +#line 742 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$indexOfBytes"}; + } +#line 2833 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 145: +#line 745 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$indexOfCP"}; + } +#line 2841 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 146: +#line 748 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$ltrim"}; + } +#line 2849 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 147: +#line 751 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$meta"}; + } +#line 2857 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 148: +#line 754 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$regexFind"}; + } +#line 2865 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 149: +#line 757 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$regexFindAll"}; + } +#line 2873 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 150: +#line 760 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$regexMatch"}; + } +#line 2881 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 151: +#line 763 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$replaceOne"}; + } +#line 2889 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 152: +#line 766 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$replaceAll"}; + } +#line 2897 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 153: +#line 769 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$rtrim"}; + } +#line 2905 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 154: +#line 772 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$split"}; + } +#line 2913 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 155: +#line 775 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$strLenBytes"}; + } +#line 2921 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 156: +#line 778 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$strLenCP"}; + } +#line 2929 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 157: +#line 781 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$strcasecmp"}; + } +#line 2937 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 158: +#line 784 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$substr"}; + } +#line 2945 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 159: +#line 787 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$substrBytes"}; + } +#line 2953 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 160: +#line 790 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$substrCP"}; + } +#line 2961 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 161: +#line 793 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toLower"}; + } +#line 2969 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 162: +#line 796 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$trim"}; + } +#line 2977 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 163: +#line 799 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toUpper"}; + } +#line 2985 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 164: +#line 806 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserString{YY_MOVE(yystack_[0].value.as<std::string>())}}; + } +#line 2993 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 165: +#line 811 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserString{"randVal"}}; + } +#line 3001 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 166: +#line 814 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserString{"textScore"}}; + } +#line 3009 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 167: +#line 820 "src/mongo/db/cst/grammar.yy" + { + std::string str = YY_MOVE(yystack_[0].value.as<std::string>()); + if (str.size() == 1) { + error(yystack_[0].location, "'$' by iteslf is not a valid FieldPath"); + } + yylhs.value.as<CNode>() = CNode{UserFieldPath{str.substr(1), false}}; + } +#line 3021 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 168: +#line 828 "src/mongo/db/cst/grammar.yy" + { + std::string str = YY_MOVE(yystack_[0].value.as<std::string>()).substr(2); + auto status = c_node_validation::validateVariableName(str); + if (!status.isOK()) { + error(yystack_[0].location, status.reason()); + } + yylhs.value.as<CNode>() = CNode{UserFieldPath{str, true}}; + } +#line 3034 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 169: +#line 837 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserBinary{YY_MOVE(yystack_[0].value.as<BSONBinData>())}}; + } +#line 3042 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 170: +#line 843 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserUndefined{}}; + } +#line 3050 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 171: +#line 849 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserObjectId{}}; + } +#line 3058 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 172: +#line 855 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserDate{YY_MOVE(yystack_[0].value.as<Date_t>())}}; + } +#line 3066 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 173: +#line 861 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserNull{}}; + } +#line 3074 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 174: +#line 867 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserRegex{YY_MOVE(yystack_[0].value.as<BSONRegEx>())}}; + } +#line 3082 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 175: +#line 873 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserDBPointer{YY_MOVE(yystack_[0].value.as<BSONDBRef>())}}; + } +#line 3090 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 176: +#line 879 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserJavascript{YY_MOVE(yystack_[0].value.as<BSONCode>())}}; + } +#line 3098 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 177: +#line 885 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserSymbol{YY_MOVE(yystack_[0].value.as<BSONSymbol>())}}; + } +#line 3106 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 178: +#line 891 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserJavascriptWithScope{ + YY_MOVE(yystack_[0].value.as<BSONCodeWScope>())}}; + } +#line 3114 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 179: +#line 897 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserTimestamp{YY_MOVE(yystack_[0].value.as<Timestamp>())}}; + } +#line 3122 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 180: +#line 903 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserMinKey{YY_MOVE(yystack_[0].value.as<UserMinKey>())}}; + } +#line 3130 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 181: +#line 909 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserMaxKey{YY_MOVE(yystack_[0].value.as<UserMaxKey>())}}; + } +#line 3138 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 182: +#line 915 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserInt{YY_MOVE(yystack_[0].value.as<int>())}}; + } +#line 3146 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 183: +#line 918 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserInt{0}}; + } +#line 3154 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 184: +#line 921 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserInt{1}}; + } +#line 3162 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 185: +#line 924 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserInt{-1}}; + } +#line 3170 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 186: +#line 930 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserLong{YY_MOVE(yystack_[0].value.as<long long>())}}; + } +#line 3178 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 187: +#line 933 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserLong{0ll}}; + } +#line 3186 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 188: +#line 936 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserLong{1ll}}; + } +#line 3194 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 189: +#line 939 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserLong{-1ll}}; + } +#line 3202 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 190: +#line 945 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserDouble{YY_MOVE(yystack_[0].value.as<double>())}}; + } +#line 3210 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 191: +#line 948 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserDouble{0.0}}; + } +#line 3218 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 192: +#line 951 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserDouble{1.0}}; + } +#line 3226 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 193: +#line 954 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserDouble{-1.0}}; + } +#line 3234 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 194: +#line 960 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{UserDecimal{YY_MOVE(yystack_[0].value.as<Decimal128>())}}; + } +#line 3242 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 195: +#line 963 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserDecimal{0.0}}; + } +#line 3250 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 196: +#line 966 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserDecimal{1.0}}; + } +#line 3258 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 197: +#line 969 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserDecimal{-1.0}}; + } +#line 3266 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 198: +#line 975 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserBoolean{true}}; + } +#line 3274 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 199: +#line 978 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{UserBoolean{false}}; + } +#line 3282 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 200: +#line 984 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3288 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 201: +#line 985 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3294 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 202: +#line 986 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3300 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 203: +#line 987 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3306 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 204: +#line 988 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3312 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 205: +#line 989 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3318 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 206: +#line 990 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3324 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 207: +#line 991 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3330 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 208: +#line 992 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3336 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 209: +#line 993 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3342 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 210: +#line 994 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3348 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 211: +#line 995 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3354 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 212: +#line 996 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3360 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 213: +#line 997 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3366 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 214: +#line 998 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3372 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 215: +#line 999 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3378 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 216: +#line 1000 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3384 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 217: +#line 1001 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3390 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 218: +#line 1002 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3396 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 219: +#line 1003 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3402 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 220: +#line 1004 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3408 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 221: +#line 1011 "src/mongo/db/cst/grammar.yy" + { + } +#line 3414 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 222: +#line 1012 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::vector<CNode>>() = + YY_MOVE(yystack_[0].value.as<std::vector<CNode>>()); + yylhs.value.as<std::vector<CNode>>().emplace_back( + YY_MOVE(yystack_[1].value.as<CNode>())); + } +#line 3423 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 223: +#line 1019 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3429 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 224: +#line 1019 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3435 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 225: +#line 1023 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>()), + YY_MOVE(yystack_[1].value.as<CNode>())}}; + } +#line 3443 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 226: +#line 1028 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3449 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 227: +#line 1028 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3455 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 228: +#line 1028 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3461 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 229: +#line 1028 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3467 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 230: +#line 1028 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3473 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 231: +#line 1028 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3479 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 232: +#line 1029 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3485 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 233: +#line 1029 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3491 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 234: +#line 1035 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{YY_MOVE(yystack_[1].value.as<std::vector<CNode>>())}; + } +#line 3499 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 235: +#line 1043 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + } +#line 3507 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 236: +#line 1049 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode::noopLeaf(); + } +#line 3515 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 237: +#line 1052 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + yylhs.value.as<CNode>().objectChildren().emplace_back( + YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); + } +#line 3524 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 238: +#line 1059 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { + YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), + YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 3532 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 239: +#line 1066 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 3538 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 240: +#line 1066 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 3544 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 241: +#line 1066 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 3550 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 242: +#line 1066 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 3556 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 243: +#line 1070 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = UserFieldname{"_id"}; + } +#line 3564 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 244: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3570 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 245: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3576 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 246: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3582 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 247: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3588 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 248: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3594 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 249: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3600 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 250: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3606 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 251: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3612 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 252: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3618 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 253: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3624 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 254: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3630 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 255: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3636 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 256: +#line 1076 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3642 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 257: +#line 1077 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3648 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 258: +#line 1077 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3654 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 259: +#line 1077 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3660 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 260: +#line 1077 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3666 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 261: +#line 1081 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::add, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3675 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 262: +#line 1088 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::atan2, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3684 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 263: +#line 1094 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::abs, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3692 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 264: +#line 1099 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::ceil, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3700 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 265: +#line 1104 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::divide, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 3709 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 266: +#line 1110 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::exponent, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3717 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 267: +#line 1115 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::floor, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3725 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 268: +#line 1120 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::ln, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3733 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 269: +#line 1125 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::log, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 3742 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 270: +#line 1131 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::logten, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3750 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 271: +#line 1136 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::mod, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 3759 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 272: +#line 1142 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::multiply, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), + YY_MOVE(yystack_[3].value.as<CNode>())}}}}}; + auto&& others = YY_MOVE(yystack_[2].value.as<std::vector<CNode>>()); + auto&& array = + yylhs.value.as<CNode>().objectChildren()[0].second.arrayChildren(); + array.insert(array.end(), others.begin(), others.end()); + } +#line 3771 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 273: +#line 1151 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::pow, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 3780 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 274: +#line 1157 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::round, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 3789 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 275: +#line 1163 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::sqrt, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3797 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 276: +#line 1168 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::subtract, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 3806 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 277: +#line 1174 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::trunc, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 3815 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 278: +#line 1180 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3821 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 279: +#line 1180 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3827 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 280: +#line 1180 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3833 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 281: +#line 1184 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::andExpr, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3842 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 282: +#line 1191 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::orExpr, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 3851 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 283: +#line 1198 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::notExpr, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 3860 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 284: +#line 1205 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3866 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 285: +#line 1205 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3872 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 286: +#line 1205 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3878 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 287: +#line 1205 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3884 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 288: +#line 1205 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3890 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 289: +#line 1205 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3896 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 290: +#line 1205 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3902 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 291: +#line 1206 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3908 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 292: +#line 1206 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3914 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 293: +#line 1206 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3920 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 294: +#line 1206 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3926 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 295: +#line 1206 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3932 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 296: +#line 1206 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3938 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 297: +#line 1206 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3944 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 298: +#line 1206 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3950 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 299: +#line 1207 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3956 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 300: +#line 1207 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3962 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 301: +#line 1207 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3968 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 302: +#line 1207 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3974 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 303: +#line 1207 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3980 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 304: +#line 1207 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3986 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 305: +#line 1207 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 3992 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 306: +#line 1211 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::concat, CNode{CNode::ArrayChildren{}}}}}; + auto&& others = YY_MOVE(yystack_[2].value.as<std::vector<CNode>>()); + auto&& array = + yylhs.value.as<CNode>().objectChildren()[0].second.arrayChildren(); + array.insert(array.end(), others.begin(), others.end()); + } +#line 4004 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 307: +#line 1221 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = + std::pair{KeyFieldname::formatArg, CNode{KeyValue::absentKey}}; + } +#line 4012 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 308: +#line 1224 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ + KeyFieldname::formatArg, YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4020 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 309: +#line 1230 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = + std::pair{KeyFieldname::timezoneArg, CNode{KeyValue::absentKey}}; + } +#line 4028 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 310: +#line 1233 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ + KeyFieldname::timezoneArg, YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4036 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 311: +#line 1240 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::dateFromString, + CNode{CNode::ObjectChildren{ + {KeyFieldname::dateStringArg, + YY_MOVE(yystack_[6].value.as<CNode>())}, + YY_MOVE( + yystack_[5].value.as<std::pair<CNode::Fieldname, CNode>>()), + YY_MOVE( + yystack_[4].value.as<std::pair<CNode::Fieldname, CNode>>()), + YY_MOVE( + yystack_[3].value.as<std::pair<CNode::Fieldname, CNode>>()), + YY_MOVE(yystack_[2] + .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; + } +#line 4046 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 312: +#line 1249 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::dateToString, + CNode{CNode::ObjectChildren{ + {KeyFieldname::dateArg, YY_MOVE(yystack_[5].value.as<CNode>())}, + YY_MOVE( + yystack_[4].value.as<std::pair<CNode::Fieldname, CNode>>()), + YY_MOVE( + yystack_[3].value.as<std::pair<CNode::Fieldname, CNode>>()), + YY_MOVE(yystack_[2] + .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; + } +#line 4056 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 313: +#line 1257 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::vector<CNode>>() = CNode::ArrayChildren{}; + } +#line 4064 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 314: +#line 1260 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::vector<CNode>>() = + CNode::ArrayChildren{YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4072 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 315: +#line 1263 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::vector<CNode>>() = + CNode::ArrayChildren{YY_MOVE(yystack_[1].value.as<CNode>()), + YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4080 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 316: +#line 1270 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::indexOfBytes, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), + YY_MOVE(yystack_[3].value.as<CNode>())}}}}}; + auto&& others = YY_MOVE(yystack_[2].value.as<std::vector<CNode>>()); + auto&& array = + yylhs.value.as<CNode>().objectChildren()[0].second.arrayChildren(); + array.insert(array.end(), others.begin(), others.end()); + } +#line 4092 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 317: +#line 1281 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::indexOfCP, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), + YY_MOVE(yystack_[3].value.as<CNode>())}}}}}; + auto&& others = YY_MOVE(yystack_[2].value.as<std::vector<CNode>>()); + auto&& array = + yylhs.value.as<CNode>().objectChildren()[0].second.arrayChildren(); + array.insert(array.end(), others.begin(), others.end()); + } +#line 4104 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 318: +#line 1291 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = + std::pair{KeyFieldname::charsArg, CNode{KeyValue::absentKey}}; + } +#line 4112 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 319: +#line 1294 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ + KeyFieldname::charsArg, YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4120 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 320: +#line 1300 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::ltrim, + CNode{CNode::ObjectChildren{ + {KeyFieldname::inputArg, YY_MOVE(yystack_[2].value.as<CNode>())}, + YY_MOVE(yystack_[4] + .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; + } +#line 4130 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 321: +#line 1308 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::rtrim, + CNode{CNode::ObjectChildren{ + {KeyFieldname::inputArg, YY_MOVE(yystack_[2].value.as<CNode>())}, + YY_MOVE(yystack_[4] + .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; + } +#line 4140 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 322: +#line 1316 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::trim, + CNode{CNode::ObjectChildren{ + {KeyFieldname::inputArg, YY_MOVE(yystack_[2].value.as<CNode>())}, + YY_MOVE(yystack_[4] + .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; + } +#line 4150 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 323: +#line 1324 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = + std::pair{KeyFieldname::optionsArg, CNode{KeyValue::absentKey}}; + } +#line 4158 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 324: +#line 1327 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ + KeyFieldname::optionsArg, YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4166 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 325: +#line 1332 "src/mongo/db/cst/grammar.yy" + { + // Note that the order of these arguments must match the constructor for the + // regex expression. + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::inputArg, YY_MOVE(yystack_[4].value.as<CNode>())}, + {KeyFieldname::regexArg, YY_MOVE(yystack_[1].value.as<CNode>())}, + YY_MOVE(yystack_[3].value.as<std::pair<CNode::Fieldname, CNode>>())}}; + } +#line 4178 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 326: +#line 1341 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::regexFind, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4186 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 327: +#line 1347 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::regexFindAll, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4194 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 328: +#line 1353 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::regexMatch, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4202 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 329: +#line 1360 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::replaceOne, + CNode{CNode::ObjectChildren{ + {KeyFieldname::inputArg, YY_MOVE(yystack_[4].value.as<CNode>())}, + {KeyFieldname::findArg, YY_MOVE(yystack_[6].value.as<CNode>())}, + {KeyFieldname::replacementArg, + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}}; + } +#line 4213 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 330: +#line 1370 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::replaceAll, + CNode{CNode::ObjectChildren{ + {KeyFieldname::inputArg, YY_MOVE(yystack_[4].value.as<CNode>())}, + {KeyFieldname::findArg, YY_MOVE(yystack_[6].value.as<CNode>())}, + {KeyFieldname::replacementArg, + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}}; + } +#line 4224 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 331: +#line 1379 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::split, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 4233 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 332: +#line 1386 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::strLenBytes, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4242 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 333: +#line 1393 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::strLenCP, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4251 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 334: +#line 1401 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::strcasecmp, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 4260 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 335: +#line 1409 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::substr, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), + YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 4269 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 336: +#line 1417 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::substrBytes, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), + YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 4278 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 337: +#line 1425 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::substrCP, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), + YY_MOVE(yystack_[3].value.as<CNode>()), + YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 4287 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 338: +#line 1432 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toLower, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4295 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 339: +#line 1438 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toUpper, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4303 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 340: +#line 1444 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::randVal}; + } +#line 4311 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 341: +#line 1447 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::textScore}; + } +#line 4319 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 342: +#line 1453 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::meta, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4327 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 343: +#line 1459 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + } +#line 4335 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 344: +#line 1464 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode::noopLeaf(); + } +#line 4343 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 345: +#line 1467 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + yylhs.value.as<CNode>().objectChildren().emplace_back( + YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); + } +#line 4352 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 346: +#line 1474 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::intOneKey}; + } +#line 4360 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 347: +#line 1477 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::intNegOneKey}; + } +#line 4368 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 348: +#line 1480 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::longOneKey}; + } +#line 4376 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 349: +#line 1483 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::longNegOneKey}; + } +#line 4384 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 350: +#line 1486 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::doubleOneKey}; + } +#line 4392 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 351: +#line 1489 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::doubleNegOneKey}; + } +#line 4400 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 352: +#line 1492 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::decimalOneKey}; + } +#line 4408 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 353: +#line 1495 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{KeyValue::decimalNegOneKey}; + } +#line 4416 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 354: +#line 1500 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { + YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), + YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4424 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 355: +#line 1502 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { + YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), + YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4432 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 356: +#line 1508 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4438 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 357: +#line 1508 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4444 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 358: +#line 1512 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::constExpr, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 4453 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 359: +#line 1519 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::literal, + CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; + } +#line 4462 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 360: +#line 1526 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4468 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 361: +#line 1526 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4474 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 362: +#line 1530 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4480 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 363: +#line 1530 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4486 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 364: +#line 1534 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = + CNode{YY_MOVE(yystack_[1].value.as<std::vector<CNode>>())}; + } +#line 4494 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 365: +#line 1540 "src/mongo/db/cst/grammar.yy" + { + } +#line 4500 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 366: +#line 1541 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::vector<CNode>>() = + YY_MOVE(yystack_[0].value.as<std::vector<CNode>>()); + yylhs.value.as<std::vector<CNode>>().emplace_back( + YY_MOVE(yystack_[1].value.as<CNode>())); + } +#line 4509 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 367: +#line 1548 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + } +#line 4517 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 368: +#line 1554 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode::noopLeaf(); + } +#line 4525 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 369: +#line 1557 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); + yylhs.value.as<CNode>().objectChildren().emplace_back( + YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); + } +#line 4534 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 370: +#line 1564 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { + YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), + YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4542 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 371: +#line 1571 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 4548 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 372: +#line 1572 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 4554 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 373: +#line 1573 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 4560 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 374: +#line 1574 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 4566 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 375: +#line 1575 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode::Fieldname>() = + YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); + } +#line 4572 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 376: +#line 1578 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4578 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 377: +#line 1578 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4584 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 378: +#line 1578 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4590 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 379: +#line 1578 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4596 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 380: +#line 1578 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4602 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 381: +#line 1578 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4608 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 382: +#line 1578 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4614 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 383: +#line 1580 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::cmp, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4623 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 384: +#line 1585 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::eq, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4632 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 385: +#line 1590 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::gt, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4641 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 386: +#line 1595 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::gte, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4650 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 387: +#line 1600 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::lt, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4659 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 388: +#line 1605 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::lte, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4668 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 389: +#line 1610 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::ne, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4677 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 390: +#line 1616 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4683 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 391: +#line 1617 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4689 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 392: +#line 1618 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4695 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 393: +#line 1619 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4701 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 394: +#line 1620 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4707 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 395: +#line 1621 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4713 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 396: +#line 1622 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4719 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 397: +#line 1623 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4725 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 398: +#line 1624 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4731 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 399: +#line 1625 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); + } +#line 4737 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 400: +#line 1630 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = + std::pair{KeyFieldname::onErrorArg, CNode{KeyValue::absentKey}}; + } +#line 4745 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 401: +#line 1633 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ + KeyFieldname::onErrorArg, YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4753 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 402: +#line 1640 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = + std::pair{KeyFieldname::onNullArg, CNode{KeyValue::absentKey}}; + } +#line 4761 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 403: +#line 1643 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ + KeyFieldname::onNullArg, YY_MOVE(yystack_[0].value.as<CNode>())}; + } +#line 4769 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 404: +#line 1650 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::convert, + CNode{CNode::ObjectChildren{ + {KeyFieldname::inputArg, YY_MOVE(yystack_[6].value.as<CNode>())}, + {KeyFieldname::toArg, YY_MOVE(yystack_[2].value.as<CNode>())}, + YY_MOVE( + yystack_[5].value.as<std::pair<CNode::Fieldname, CNode>>()), + YY_MOVE(yystack_[4] + .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; + } +#line 4780 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 405: +#line 1659 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toBool, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4788 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 406: +#line 1664 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toDate, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4796 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 407: +#line 1669 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toDecimal, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4804 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 408: +#line 1674 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toDouble, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4812 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 409: +#line 1679 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toInt, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4820 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 410: +#line 1684 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toLong, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4828 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 411: +#line 1689 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toObjectId, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4836 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 412: +#line 1694 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::toString, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4844 "src/mongo/db/cst/parser_gen.cpp" + break; + + case 413: +#line 1699 "src/mongo/db/cst/grammar.yy" + { + yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ + {KeyFieldname::type, YY_MOVE(yystack_[1].value.as<CNode>())}}}; + } +#line 4852 "src/mongo/db/cst/parser_gen.cpp" + break; + + +#line 4856 "src/mongo/db/cst/parser_gen.cpp" + + default: + break; + } + } +#if YY_EXCEPTIONS + catch (const syntax_error& yyexc) { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; + error(yyexc); + YYERROR; + } +#endif // YY_EXCEPTIONS + YY_SYMBOL_PRINT("-> $$ =", yylhs); + yypop_(yylen); + yylen = 0; + YY_STACK_PRINT(); + + // Shift the result of the reduction. + yypush_(YY_NULLPTR, YY_MOVE(yylhs)); + } + goto yynewstate; + + + /*--------------------------------------. + | yyerrlab -- here on detecting error. | + `--------------------------------------*/ + yyerrlab: + // If not already recovering from an error, report this error. + if (!yyerrstatus_) { + ++yynerrs_; + error(yyla.location, yysyntax_error_(yystack_[0].state, yyla)); + } + + + yyerror_range[1].location = yyla.location; + if (yyerrstatus_ == 3) { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + // Return failure if at end of input. + if (yyla.type_get() == yyeof_) + YYABORT; + else if (!yyla.empty()) { + yy_destroy_("Error: discarding", yyla); + yyla.clear(); + } + } + + // 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 (false) + YYERROR; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + yypop_(yylen); + yylen = 0; + goto yyerrlab1; + + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; // Each real token shifted decrements this. + { + stack_symbol_type error_token; + for (;;) { + yyn = yypact_[+yystack_[0].state]; + if (!yy_pact_value_is_default_(yyn)) { + yyn += yy_error_token_; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_) { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + // Pop the current state because it cannot handle the error token. + if (yystack_.size() == 1) + YYABORT; + + yyerror_range[1].location = yystack_[0].location; + yy_destroy_("Error: popping", yystack_[0]); + yypop_(); + YY_STACK_PRINT(); + } + + yyerror_range[2].location = yyla.location; + YYLLOC_DEFAULT(error_token.location, yyerror_range, 2); + + // Shift the error token. + error_token.state = state_type(yyn); + yypush_("Shifting", YY_MOVE(error_token)); + } + goto yynewstate; + + + /*-------------------------------------. + | yyacceptlab -- YYACCEPT comes here. | + `-------------------------------------*/ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + + /*-----------------------------------. + | yyabortlab -- YYABORT comes here. | + `-----------------------------------*/ + yyabortlab: + yyresult = 1; + goto yyreturn; + + + /*-----------------------------------------------------. + | yyreturn -- parsing is finished, return the result. | + `-----------------------------------------------------*/ + yyreturn: + if (!yyla.empty()) + yy_destroy_("Cleanup: discarding lookahead", yyla); + + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + yypop_(yylen); + while (1 < yystack_.size()) { + yy_destroy_("Cleanup: popping", yystack_[0]); + yypop_(); + } + + return yyresult; + } +#if YY_EXCEPTIONS + catch (...) { + YYCDEBUG << "Exception caught: cleaning lookahead and stack\n"; + // Do not try to display the values of the reclaimed symbols, + // as their printers might throw an exception. + if (!yyla.empty()) + yy_destroy_(YY_NULLPTR, yyla); + + while (1 < yystack_.size()) { + yy_destroy_(YY_NULLPTR, yystack_[0]); + yypop_(); + } + throw; + } +#endif // YY_EXCEPTIONS +} + +void ParserGen::error(const syntax_error& yyexc) { + error(yyexc.location, yyexc.what()); +} + +// Generate an error message. +std::string ParserGen::yysyntax_error_(state_type yystate, const symbol_type& yyla) const { + // Number of reported tokens (one for the "unexpected", one per + // "expected"). + std::ptrdiff_t yycount = 0; + // Its maximum. + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + // Arguments of yyformat. + char const* yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + + /* 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 yyla) 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 + yyla. (However, yyla is currently not documented for users.) + - 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 (!yyla.empty()) { + symbol_number_type yytoken = yyla.type_get(); + yyarg[yycount++] = yytname_[yytoken]; + + int yyn = yypact_[+yystate]; + if (!yy_pact_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_; + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck_[yyx + yyn] == yyx && yyx != yy_error_token_ && + !yy_table_value_is_error_(yytable_[yyx + yyn])) { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { + yycount = 1; + break; + } else + yyarg[yycount++] = yytname_[yyx]; + } + } + } + + char const* yyformat = YY_NULLPTR; + 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_ + } + + std::string yyres; + // Argument number. + std::ptrdiff_t yyi = 0; + for (char const* yyp = yyformat; *yyp; ++yyp) + if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) { + yyres += yytnamerr_(yyarg[yyi++]); + ++yyp; + } else + yyres += *yyp; + return yyres; +} + + +const short ParserGen::yypact_ninf_ = -619; + +const signed char ParserGen::yytable_ninf_ = -1; + +const short ParserGen::yypact_[] = { + 77, -82, -75, -82, -82, -71, 38, -619, -619, -28, -619, -619, -619, -619, -619, -619, + 849, 174, 10, 413, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, 850, -619, -619, -619, -619, -26, 18, + -22, -13, 18, -619, 41, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, 132, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, 850, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, 47, -619, -619, -619, -619, -619, -619, + 60, -619, 86, 9, -28, -619, -619, -619, -619, -619, -619, -619, -619, 35, -619, -619, + 850, 68, 523, -619, 633, 18, -56, -619, -619, -49, -619, -619, -619, 850, -619, -619, + 1062, 1062, -619, -619, -619, -619, -619, 73, 120, -619, -619, 102, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, 956, 743, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, 6, -619, -619, 956, -619, 115, 956, 72, + 72, 88, 956, 88, 114, 116, -619, -619, -619, 118, 88, 956, 956, 88, 88, 119, + 121, 122, 956, 125, 956, 88, 88, -619, 130, 131, 88, 134, 72, 137, -619, -619, + -619, -619, -619, 138, -619, 141, 956, 142, 956, 956, 144, 147, 148, 149, 956, 956, + 956, 956, 956, 956, 956, 956, 956, 956, -619, 151, 956, 19, 160, -619, -619, 177, + 198, 199, 956, 203, 205, 207, 956, 850, 153, 166, 244, 956, 219, 220, 221, 222, + 223, 956, 956, 850, 225, 956, 226, 227, 228, 267, 956, 956, 230, 956, 231, 956, + 232, 264, 236, 237, 271, 273, 956, 267, 956, 241, 956, 242, 243, 956, 956, 956, + 956, 245, 246, 247, 249, 250, 254, 256, 257, 258, 259, 267, 956, 261, -619, 956, + -619, -619, -619, -619, -619, -619, -619, -619, -619, 956, -619, -619, -619, 265, 266, 956, + 956, 956, 956, -619, -619, -619, -619, -619, 956, 956, 268, -619, 956, -619, -619, -619, + 956, 275, 956, 956, -619, 269, -619, 956, -619, 956, -619, -619, 956, 956, 956, 294, + 956, -619, 956, -619, -619, 956, 956, 956, 956, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, 300, 956, -619, -619, 272, 270, 274, 302, 305, 305, 278, 956, 956, + 280, 282, -619, 956, 286, 956, 287, 289, 314, 320, 321, 293, 956, 296, 297, 956, + 956, 956, 298, 956, 299, -619, -619, -619, 956, 322, 956, 323, 323, 301, 956, 303, + 306, -619, 304, 308, 311, 307, -619, 313, 956, 324, 956, 956, 315, 316, 317, 318, + 325, 326, 327, 319, 328, 329, -619, 956, 333, -619, 956, 302, 322, -619, -619, 334, + 335, -619, 336, -619, 337, -619, -619, 956, 343, 345, -619, 338, -619, -619, 339, 340, + 341, -619, 342, -619, -619, 956, -619, 322, 344, -619, -619, -619, -619, 346, 956, 956, + -619, -619, -619, -619, -619, 347, 348, 349, -619, 350, 351, 352, 353, -619, 354, 355, + -619, -619, -619, -619}; + +const short ParserGen::yydefact_[] = { + 0, 0, 0, 0, 0, 0, 0, 70, 3, 8, 2, 5, 4, 344, 6, 1, 0, 0, 0, + 0, 95, 84, 94, 91, 100, 98, 92, 87, 89, 90, 97, 85, 101, 96, 99, 86, 93, 88, + 69, 243, 77, 0, 76, 75, 74, 71, 0, 0, 0, 0, 0, 10, 0, 12, 13, 14, 15, + 16, 17, 7, 126, 102, 104, 103, 127, 109, 141, 105, 116, 142, 143, 128, 343, 110, 129, 130, + 111, 112, 144, 145, 106, 131, 132, 133, 113, 114, 146, 147, 134, 135, 115, 108, 107, 136, 148, + 149, 150, 152, 151, 137, 153, 154, 138, 78, 81, 82, 83, 80, 79, 157, 155, 156, 158, 159, + 160, 139, 117, 118, 119, 120, 121, 122, 161, 123, 124, 163, 162, 140, 125, 372, 373, 374, 371, + 375, 0, 345, 199, 198, 197, 196, 195, 193, 192, 191, 185, 184, 183, 189, 188, 187, 165, 365, + 368, 166, 164, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 182, 186, 190, 194, 179, 180, + 181, 167, 168, 209, 210, 211, 212, 213, 218, 214, 215, 216, 219, 220, 73, 200, 201, 203, 204, + 205, 217, 206, 207, 208, 360, 361, 362, 363, 202, 72, 0, 21, 22, 23, 24, 26, 28, 0, + 25, 0, 0, 8, 353, 352, 351, 350, 347, 346, 349, 348, 0, 354, 355, 365, 0, 0, 19, + 0, 0, 0, 11, 9, 0, 366, 364, 367, 0, 369, 27, 0, 0, 66, 67, 68, 65, 29, + 0, 0, 340, 341, 0, 370, 60, 59, 56, 55, 58, 52, 51, 54, 44, 43, 46, 48, 47, + 50, 221, 236, 45, 49, 53, 57, 39, 40, 41, 42, 61, 62, 63, 32, 33, 34, 35, 36, + 37, 38, 30, 64, 226, 227, 228, 244, 245, 229, 278, 279, 280, 230, 356, 357, 233, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 305, + 304, 231, 376, 377, 378, 379, 380, 381, 382, 232, 390, 391, 392, 393, 394, 395, 396, 397, 398, + 399, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 31, 18, 0, + 342, 223, 221, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 10, + 10, 10, 10, 10, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 222, 234, 0, 0, 0, 0, 0, 0, + 0, 221, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 318, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 318, 0, 0, + 235, 0, 240, 241, 239, 242, 237, 20, 263, 261, 281, 0, 262, 264, 383, 0, 0, 0, 0, + 0, 0, 384, 266, 267, 385, 386, 0, 0, 0, 268, 0, 270, 387, 388, 0, 0, 0, 0, + 389, 0, 282, 0, 326, 0, 327, 328, 0, 0, 0, 0, 0, 275, 0, 332, 333, 0, 0, + 0, 0, 405, 406, 407, 408, 409, 410, 338, 411, 412, 339, 0, 0, 413, 238, 0, 0, 0, + 400, 307, 307, 0, 313, 313, 0, 0, 319, 0, 0, 221, 0, 0, 323, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 225, 306, 358, 0, 402, 0, 309, 309, 0, 314, 0, + 0, 359, 0, 0, 0, 0, 283, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 401, 0, 0, 308, 0, 400, 402, 265, 315, 0, 0, 269, 0, 271, 0, 273, + 324, 0, 0, 0, 274, 0, 331, 334, 0, 0, 0, 276, 0, 277, 403, 0, 310, 402, 0, + 316, 317, 320, 272, 0, 0, 0, 321, 335, 336, 337, 322, 0, 0, 0, 325, 0, 0, 0, + 0, 312, 0, 0, 404, 311, 330, 329}; + +const short ParserGen::yypgoto_[] = { + -619, -619, -619, -221, -619, -16, 139, -15, -14, 145, -619, -619, -619, -619, -189, + -174, -152, -143, -35, -132, -34, -41, -27, -125, -112, -36, -165, -619, -107, -105, + -101, -619, -91, -85, -70, -37, -619, -619, -619, -619, -619, -619, 165, -619, -619, + -619, -619, -619, -619, -619, -619, 146, -40, -296, -61, -230, -346, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -209, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, + -619, -619, -619, -619, -619, -619, -619, -246, -618, -172, -203, -410, -619, -352, 180, + -170, 194, -619, -619, -619, -619, -619, -619, -619, -619, -619, -48, -619}; + +const short ParserGen::yydefgoto_[] = { + -1, 241, 495, 129, 41, 130, 131, 132, 133, 134, 246, 500, 238, 45, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 224, 186, 187, 188, 189, 190, 191, 192, 193, 194, 362, 196, 197, + 198, 226, 199, 10, 18, 52, 53, 54, 55, 56, 57, 58, 228, 287, 206, 363, 364, 435, 289, + 290, 427, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 464, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 601, 632, 603, 635, 529, 617, + 365, 225, 607, 8, 16, 200, 14, 19, 222, 223, 251, 135, 6, 465, 211}; + +const short ParserGen::yytable_[] = { + 42, 43, 44, 210, 195, 185, 204, 242, 7, 204, 209, 429, 202, 203, 9, 202, 203, 150, 664, + 13, 205, 432, 433, 205, 249, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 15, 33, 34, 35, 153, 36, 37, 678, 141, 142, 143, 250, 462, 273, 273, 59, 138, 139, 140, + 154, 141, 142, 143, 543, 17, 494, 201, 248, 274, 274, 207, 39, 431, 144, 145, 146, 436, 280, + 280, 208, 147, 148, 149, 563, 229, 445, 446, 212, 509, 1, 275, 275, 452, 227, 454, 230, 2, + 3, 4, 276, 276, 231, 5, 233, 103, 104, 105, 106, 107, 108, 277, 277, 473, 235, 475, 476, + 195, 278, 278, 359, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 279, 279, 493, 40, 167, + 281, 281, 282, 282, 360, 505, 283, 283, 437, 165, 166, 167, 168, 361, 514, 444, 284, 284, 447, + 448, 520, 521, 285, 285, 524, 430, 455, 456, 267, 530, 531, 460, 533, 511, 535, 213, 214, 286, + 286, 215, 216, 542, 512, 544, 434, 546, 288, 288, 549, 550, 551, 552, 217, 218, 195, 204, 247, + 466, 467, 219, 220, 202, 203, 564, 11, 12, 566, 195, 252, 205, 438, 501, 439, 496, 443, 449, + 567, 450, 451, 243, 245, 453, 570, 571, 572, 573, 458, 459, 502, 221, 461, 574, 575, 463, 470, + 577, 613, 472, 474, 578, 477, 580, 581, 478, 479, 480, 583, 492, 584, 503, 504, 585, 586, 587, + 506, 589, 507, 590, 508, 513, 591, 592, 593, 594, 46, 47, 48, 49, 50, 51, 515, 516, 517, + 518, 519, 596, 523, 525, 526, 527, 528, 532, 534, 536, 537, 606, 606, 538, 539, 540, 611, 541, + 545, 547, 548, 579, 553, 554, 555, 621, 556, 557, 624, 625, 626, 558, 628, 559, 560, 561, 562, + 630, 565, 633, 588, 568, 569, 638, 576, 582, 595, 598, 597, 600, 602, 599, 428, 646, 605, 648, + 649, 609, 610, 440, 441, 442, 612, 616, 614, 615, 618, 619, 660, 620, 631, 662, 622, 623, 627, + 629, 457, 647, 637, 639, 634, 641, 640, 644, 669, 642, 468, 469, 643, 471, 645, 661, 650, 651, + 652, 653, 657, 670, 677, 671, 244, 654, 655, 656, 237, 658, 659, 681, 682, 491, 232, 665, 666, + 667, 668, 672, 673, 674, 675, 676, 358, 679, 663, 680, 683, 684, 685, 686, 687, 688, 689, 690, + 691, 604, 636, 195, 510, 234, 608, 0, 0, 0, 0, 0, 497, 498, 499, 195, 522, 60, 61, + 62, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 33, 34, 35, 0, + 36, 37, 63, 0, 0, 64, 65, 66, 67, 68, 69, 70, 0, 0, 0, 71, 0, 0, 0, + 0, 72, 73, 74, 75, 76, 77, 39, 78, 79, 0, 0, 0, 80, 81, 82, 83, 0, 0, + 0, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 0, 0, 109, 110, 111, 112, 113, 114, 115, 0, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 40, 60, 61, 62, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 33, 34, 35, 0, 36, 37, 63, 0, + 0, 64, 65, 66, 67, 68, 69, 70, 0, 0, 0, 71, 0, 0, 0, 0, 236, 73, 74, + 75, 76, 77, 39, 78, 79, 0, 0, 0, 80, 81, 82, 83, 0, 0, 0, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 0, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 0, 0, 109, 110, 111, 112, 113, 114, 115, 0, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 40, 60, 61, 62, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 0, 33, 34, 35, 0, 36, 37, 63, 0, 0, 64, 65, 66, + 67, 68, 69, 70, 0, 0, 0, 71, 0, 0, 0, 0, 239, 73, 74, 75, 76, 77, 240, + 78, 79, 0, 0, 0, 80, 81, 82, 83, 0, 0, 0, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 0, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 0, 0, 109, 110, 111, 112, 113, 114, 115, 0, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 40, 366, 367, 368, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 369, 0, 0, 370, 371, 372, 373, 374, 375, 376, + 0, 0, 0, 377, 0, 0, 0, 0, 0, 378, 379, 380, 381, 382, 0, 383, 384, 0, 0, + 0, 385, 386, 387, 388, 0, 0, 0, 389, 390, 391, 0, 392, 393, 394, 395, 396, 397, 0, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 0, 0, 0, 0, 0, 0, 0, 0, 407, 408, + 409, 410, 411, 412, 413, 0, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 33, 34, 35, 0, 36, + 37, 0, 0, 136, 137, 0, 0, 0, 0, 0, 0, 0, 138, 139, 140, 0, 141, 142, 143, + 38, 0, 0, 0, 0, 0, 39, 0, 0, 0, 144, 145, 146, 0, 0, 0, 0, 147, 148, + 149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 151, 152, 0, 0, 0, 0, 0, 0, 0, 153, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 136, 137, 0, 0, 0, + 0, 0, 0, 0, 138, 139, 140, 0, 141, 142, 143, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 144, 145, 146, 0, 0, 0, 0, 147, 148, 149, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 267, 268, 0, 0, 0, 0, 0, 0, 0, 153, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 253, 254, 0, 0, 0, 0, 0, 0, 0, 255, 256, 257, 0, + 258, 259, 260, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 261, 262, 263, 0, 0, 0, + 0, 264, 265, 266, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 267, 268, 0, 0, 0, 0, 0, 0, + 0, 153, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 269, 270, 271, 272, 169, 170, 171}; + +const short ParserGen::yycheck_[] = { + 16, 16, 16, 51, 41, 41, 47, 228, 90, 50, 50, 363, 47, 47, 89, 50, 50, 73, 636, + 90, 47, 367, 368, 50, 73, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 0, 20, 21, 22, 98, 24, 25, 663, 40, 41, 42, 98, 396, 240, 241, 43, 36, 37, 38, + 113, 40, 41, 42, 471, 90, 44, 90, 230, 240, 241, 90, 50, 366, 53, 54, 55, 370, 240, + 241, 90, 60, 61, 62, 491, 22, 379, 380, 44, 438, 10, 240, 241, 386, 44, 388, 7, 17, + 18, 19, 240, 241, 90, 23, 66, 83, 84, 85, 86, 87, 88, 240, 241, 406, 43, 408, 409, + 151, 240, 241, 44, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 240, 241, 426, 112, 126, + 240, 241, 240, 241, 17, 434, 240, 241, 371, 124, 125, 126, 127, 44, 443, 378, 240, 241, 381, + 382, 449, 450, 240, 241, 453, 43, 389, 390, 89, 458, 459, 394, 461, 13, 463, 36, 37, 240, + 241, 40, 41, 470, 9, 472, 89, 474, 240, 241, 477, 478, 479, 480, 53, 54, 224, 229, 229, + 399, 400, 60, 61, 229, 229, 492, 3, 4, 495, 237, 237, 229, 89, 44, 89, 427, 89, 89, + 505, 89, 89, 228, 228, 89, 511, 512, 513, 514, 89, 89, 44, 90, 89, 520, 521, 89, 89, + 524, 581, 89, 89, 528, 89, 530, 531, 89, 89, 89, 535, 89, 537, 44, 44, 540, 541, 542, + 44, 544, 44, 546, 44, 8, 549, 550, 551, 552, 83, 84, 85, 86, 87, 88, 44, 44, 44, + 44, 44, 564, 44, 44, 44, 44, 6, 44, 44, 44, 13, 574, 575, 44, 44, 11, 579, 11, + 44, 44, 44, 13, 44, 44, 44, 588, 44, 44, 591, 592, 593, 44, 595, 44, 44, 44, 44, + 600, 44, 602, 13, 43, 43, 606, 43, 43, 13, 44, 43, 14, 12, 44, 360, 616, 43, 618, + 619, 44, 43, 374, 375, 376, 43, 16, 44, 43, 13, 13, 631, 43, 15, 634, 43, 43, 43, + 43, 391, 20, 44, 43, 24, 44, 43, 43, 647, 44, 401, 402, 44, 404, 44, 25, 44, 44, + 44, 44, 44, 21, 661, 21, 228, 43, 43, 43, 226, 44, 44, 670, 671, 424, 212, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 241, 44, 635, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 572, 604, 439, 439, 224, 575, -1, -1, -1, -1, -1, 427, 427, 427, 451, 451, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, 20, 21, 22, -1, + 24, 25, 26, -1, -1, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, 39, -1, -1, -1, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, -1, -1, 56, 57, 58, 59, -1, -1, + -1, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, -1, -1, 91, 92, 93, 94, 95, 96, 97, -1, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, 20, 21, 22, -1, 24, 25, 26, -1, + -1, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, 39, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, -1, -1, -1, 56, 57, 58, 59, -1, -1, -1, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, -1, -1, 91, 92, 93, 94, 95, 96, 97, -1, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, -1, 20, 21, 22, -1, 24, 25, 26, -1, -1, 29, 30, 31, + 32, 33, 34, 35, -1, -1, -1, 39, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, + 51, 52, -1, -1, -1, 56, 57, 58, 59, -1, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + -1, -1, 91, 92, 93, 94, 95, 96, 97, -1, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, -1, 29, 30, 31, 32, 33, 34, 35, + -1, -1, -1, 39, -1, -1, -1, -1, -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, -1, + -1, 56, 57, 58, 59, -1, -1, -1, 63, 64, 65, -1, 67, 68, 69, 70, 71, 72, -1, + 74, 75, 76, 77, 78, 79, 80, 81, 82, -1, -1, -1, -1, -1, -1, -1, -1, 91, 92, + 93, 94, 95, 96, 97, -1, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, 20, 21, 22, -1, 24, + 25, -1, -1, 27, 28, -1, -1, -1, -1, -1, -1, -1, 36, 37, 38, -1, 40, 41, 42, + 44, -1, -1, -1, -1, -1, 50, -1, -1, -1, 53, 54, 55, -1, -1, -1, -1, 60, 61, + 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 89, 90, -1, -1, -1, -1, -1, -1, -1, 98, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 27, 28, -1, -1, -1, + -1, -1, -1, -1, 36, 37, 38, -1, 40, 41, 42, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 53, 54, 55, -1, -1, -1, -1, 60, 61, 62, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 89, 90, -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 27, 28, -1, -1, -1, -1, -1, -1, -1, 36, 37, 38, -1, + 40, 41, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, 54, 55, -1, -1, -1, + -1, 60, 61, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, 90, -1, -1, -1, -1, -1, -1, + -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130}; + +const short ParserGen::yystos_[] = { + 0, 10, 17, 18, 19, 23, 279, 90, 270, 89, 175, 270, 270, 90, 273, 0, 271, 90, 176, + 274, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 24, 25, + 44, 50, 112, 138, 139, 141, 142, 147, 83, 84, 85, 86, 87, 88, 177, 178, 179, 180, 181, + 182, 183, 43, 3, 4, 5, 26, 29, 30, 31, 32, 33, 34, 35, 39, 44, 45, 46, 47, + 48, 49, 51, 52, 56, 57, 58, 59, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 91, 92, 93, 94, 95, + 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 137, 139, 140, 141, + 142, 143, 278, 27, 28, 36, 37, 38, 40, 41, 42, 53, 54, 55, 60, 61, 62, 73, 89, + 90, 98, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 272, 90, 152, 154, 155, 156, 186, 90, 90, + 186, 280, 281, 44, 36, 37, 40, 41, 53, 54, 60, 61, 90, 275, 276, 159, 268, 173, 44, + 184, 22, 7, 90, 176, 66, 268, 43, 44, 143, 146, 44, 50, 135, 137, 139, 140, 141, 144, + 186, 160, 73, 98, 277, 159, 27, 28, 36, 37, 38, 40, 41, 42, 53, 54, 55, 60, 61, + 62, 89, 90, 124, 125, 126, 127, 148, 149, 150, 151, 153, 157, 158, 160, 162, 163, 164, 166, + 167, 168, 185, 188, 190, 191, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 185, 44, 17, + 44, 169, 187, 188, 267, 3, 4, 5, 26, 29, 30, 31, 32, 33, 34, 35, 39, 45, 46, + 47, 48, 49, 51, 52, 56, 57, 58, 59, 63, 64, 65, 67, 68, 69, 70, 71, 72, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 192, 155, 267, 43, 187, 190, 190, 89, 189, 187, + 189, 89, 89, 280, 280, 280, 89, 189, 187, 187, 189, 189, 89, 89, 89, 187, 89, 187, 189, + 189, 280, 89, 89, 189, 89, 190, 89, 213, 280, 213, 213, 280, 280, 89, 280, 89, 187, 89, + 187, 187, 89, 89, 89, 89, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 280, 89, 187, + 44, 136, 137, 139, 141, 142, 145, 44, 44, 44, 44, 187, 44, 44, 44, 267, 159, 13, 9, + 8, 187, 44, 44, 44, 44, 44, 187, 187, 159, 44, 187, 44, 44, 44, 6, 265, 187, 187, + 44, 187, 44, 187, 44, 13, 44, 44, 11, 11, 187, 265, 187, 44, 187, 44, 44, 187, 187, + 187, 187, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 265, 187, 44, 187, 187, 43, 43, + 187, 187, 187, 187, 187, 187, 43, 187, 187, 13, 187, 187, 43, 187, 187, 187, 187, 187, 13, + 187, 187, 187, 187, 187, 187, 13, 187, 43, 44, 44, 14, 261, 12, 263, 263, 43, 187, 269, + 269, 44, 43, 187, 43, 267, 44, 43, 16, 266, 13, 13, 43, 187, 43, 43, 187, 187, 187, + 43, 187, 43, 187, 15, 262, 187, 24, 264, 264, 44, 187, 43, 43, 44, 44, 44, 43, 44, + 187, 20, 187, 187, 44, 44, 44, 44, 43, 43, 43, 44, 44, 44, 187, 25, 187, 261, 262, + 44, 44, 44, 44, 187, 21, 21, 44, 44, 44, 44, 44, 187, 262, 44, 44, 187, 187, 44, + 44, 44, 44, 44, 44, 44, 44, 44}; + +const short ParserGen::yyr1_[] = { + 0, 134, 279, 279, 279, 279, 279, 175, 176, 176, 281, 280, 177, 177, 177, 177, 177, 177, 183, + 178, 179, 186, 186, 186, 186, 180, 181, 182, 184, 184, 144, 144, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 135, 135, 135, 135, 270, 271, 271, 147, 272, 138, 138, + 138, 141, 137, 137, 137, 137, 137, 137, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 160, 160, 161, 174, 162, 163, + 164, 166, 167, 168, 148, 149, 150, 151, 153, 157, 158, 152, 152, 152, 152, 154, 154, 154, 154, + 155, 155, 155, 155, 156, 156, 156, 156, 165, 165, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 267, 267, 187, 187, 189, 188, 188, + 188, 188, 188, 188, 188, 188, 190, 191, 192, 192, 145, 136, 136, 136, 136, 142, 193, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 194, 195, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 196, 196, 196, 197, 198, 199, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 204, 263, 263, 264, 264, 205, 206, 269, 269, 269, 207, 208, 265, 265, 209, 216, 226, + 266, 266, 213, 210, 211, 212, 214, 215, 217, 218, 219, 220, 221, 222, 223, 224, 225, 277, 277, + 275, 273, 274, 274, 276, 276, 276, 276, 276, 276, 276, 276, 278, 278, 200, 200, 201, 202, 159, + 159, 170, 170, 171, 268, 268, 172, 173, 173, 146, 143, 143, 143, 143, 143, 227, 227, 227, 227, + 227, 227, 227, 228, 229, 230, 231, 232, 233, 234, 235, 235, 235, 235, 235, 235, 235, 235, 235, + 235, 261, 261, 262, 262, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245}; + +const signed char ParserGen::yyr2_[] = { + 0, 2, 2, 2, 2, 2, 2, 3, 0, 4, 0, 2, 1, 1, 1, 1, 1, 1, 5, 3, 7, 1, 1, 1, 1, 2, 2, 4, 0, 2, + 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 0, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 7, 4, 4, 4, 7, + 4, 7, 8, 7, 7, 4, 7, 7, 1, 1, 1, 4, 4, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 6, 0, 2, 0, 2, 11, 10, 0, 1, 2, 8, 8, 0, 2, 8, 8, 8, 0, 2, 7, 4, 4, 4, 11, + 11, 7, 4, 4, 7, 8, 8, 8, 4, 4, 1, 1, 4, 3, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 6, 6, + 1, 1, 1, 1, 3, 0, 2, 3, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 2, 11, 4, 4, 4, 4, 4, 4, 4, 4, 4}; + + +// YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +// First, the terminals, then, starting at \a yyntokens_, nonterminals. +const char* const ParserGen::yytname_[] = {"\"EOF\"", + "error", + "$undefined", + "ABS", + "ADD", + "AND", + "\"chars argument\"", + "\"coll argument\"", + "\"date argument\"", + "\"dateString argument\"", + "\"filter\"", + "\"find argument\"", + "\"format argument\"", + "\"input argument\"", + "\"onError argument\"", + "\"onNull argument\"", + "\"options argument\"", + "\"pipeline argument\"", + "\"q\"", + "\"query\"", + "\"regex argument\"", + "\"replacement argument\"", + "\"size argument\"", + "\"sort argument\"", + "\"timezone argument\"", + "\"to argument\"", + "ATAN2", + "\"false\"", + "\"true\"", + "CEIL", + "CMP", + "CONCAT", + "CONST_EXPR", + "CONVERT", + "DATE_FROM_STRING", + "DATE_TO_STRING", + "\"-1 (decimal)\"", + "\"1 (decimal)\"", + "\"zero (decimal)\"", + "DIVIDE", + "\"-1 (double)\"", + "\"1 (double)\"", + "\"zero (double)\"", + "\"end of array\"", + "\"end of object\"", + "EQ", + "EXPONENT", + "FLOOR", + "GT", + "GTE", + "ID", + "INDEX_OF_BYTES", + "INDEX_OF_CP", + "\"-1 (int)\"", + "\"1 (int)\"", + "\"zero (int)\"", + "LITERAL", + "LN", + "LOG", + "LOGTEN", + "\"-1 (long)\"", + "\"1 (long)\"", + "\"zero (long)\"", + "LT", + "LTE", + "LTRIM", + "META", + "MOD", + "MULTIPLY", + "NE", + "NOT", + "OR", + "POW", + "\"randVal\"", + "REGEX_FIND", + "REGEX_FIND_ALL", + "REGEX_MATCH", + "REPLACE_ALL", + "REPLACE_ONE", + "ROUND", + "RTRIM", + "SPLIT", + "SQRT", + "STAGE_INHIBIT_OPTIMIZATION", + "STAGE_LIMIT", + "STAGE_PROJECT", + "STAGE_SAMPLE", + "STAGE_SKIP", + "STAGE_UNION_WITH", + "\"array\"", + "\"object\"", + "STR_CASE_CMP", + "STR_LEN_BYTES", + "STR_LEN_CP", + "SUBSTR", + "SUBSTR_BYTES", + "SUBSTR_CP", + "SUBTRACT", + "\"textScore\"", + "TO_BOOL", + "TO_DATE", + "TO_DECIMAL", + "TO_DOUBLE", + "TO_INT", + "TO_LONG", + "TO_LOWER", + "TO_OBJECT_ID", + "TO_STRING", + "TO_UPPER", + "TRIM", + "TRUNC", + "TYPE", + "\"fieldname\"", + "\"string\"", + "\"BinData\"", + "\"undefined\"", + "\"ObjectID\"", + "\"Date\"", + "\"null\"", + "\"regex\"", + "\"dbPointer\"", + "\"Code\"", + "\"Symbol\"", + "\"CodeWScope\"", + "\"arbitrary integer\"", + "\"arbitrary long\"", + "\"arbitrary double\"", + "\"arbitrary decimal\"", + "\"Timestamp\"", + "\"minKey\"", + "\"maxKey\"", + "\"$-prefixed string\"", + "\"$$-prefixed string\"", + "\"$-prefixed fieldname\"", + "$accept", + "projectionFieldname", + "expressionFieldname", + "stageAsUserFieldname", + "filterFieldname", + "argAsUserFieldname", + "aggExprAsUserFieldname", + "invariableUserFieldname", + "idAsUserFieldname", + "valueFieldname", + "projectField", + "expressionField", + "valueField", + "filterField", + "dbPointer", + "javascript", + "symbol", + "javascriptWScope", + "int", + "timestamp", + "long", + "double", + "decimal", + "minKey", + "maxKey", + "value", + "string", + "fieldPath", + "binary", + "undefined", + "objectId", + "bool", + "date", + "null", + "regex", + "simpleValue", + "compoundValue", + "valueArray", + "valueObject", + "valueFields", + "variable", + "pipeline", + "stageList", + "stage", + "inhibitOptimization", + "unionWith", + "skip", + "limit", + "project", + "sample", + "projectFields", + "projection", + "num", + "expression", + "compoundExpression", + "exprFixedTwoArg", + "expressionArray", + "expressionObject", + "expressionFields", + "maths", + "add", + "atan2", + "boolExps", + "and", + "or", + "not", + "literalEscapes", + "const", + "literal", + "stringExps", + "concat", + "dateFromString", + "dateToString", + "indexOfBytes", + "indexOfCP", + "ltrim", + "regexFind", + "regexFindAll", + "regexMatch", + "regexArgs", + "replaceOne", + "replaceAll", + "rtrim", + "split", + "strLenBytes", + "strLenCP", + "strcasecmp", + "substr", + "substrBytes", + "substrCP", + "toLower", + "toUpper", + "trim", + "compExprs", + "cmp", + "eq", + "gt", + "gte", + "lt", + "lte", + "ne", + "typeExpression", + "convert", + "toBool", + "toDate", + "toDecimal", + "toDouble", + "toInt", + "toLong", + "toObjectId", + "toString", + "type", + "abs", + "ceil", + "divide", + "exponent", + "floor", + "ln", + "log", + "logten", + "mod", + "multiply", + "pow", + "round", + "sqrt", + "subtract", + "trunc", + "onErrorArg", + "onNullArg", + "formatArg", + "timezoneArg", + "charsArg", + "optionsArg", + "expressions", + "values", + "exprZeroToTwo", + "matchExpression", + "filterFields", + "filterVal", + "sortSpecs", + "specList", + "metaSort", + "oneOrNegOne", + "metaSortKeyword", + "sortSpec", + "start", + "START_ORDERED_OBJECT", + "$@1", + YY_NULLPTR}; + +#if YYDEBUG +const short ParserGen::yyrline_[] = { + 0, 299, 299, 302, 305, 308, 311, 318, 324, 325, 333, 333, 336, 336, 336, 336, + 336, 336, 339, 349, 355, 365, 365, 365, 365, 369, 374, 379, 395, 398, 405, 408, + 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 428, 431, 434, 437, + 440, 443, 446, 449, 452, 455, 458, 461, 464, 467, 470, 473, 476, 479, 480, 481, + 482, 491, 491, 491, 491, 495, 501, 504, 510, 516, 521, 521, 521, 525, 533, 536, + 539, 542, 545, 548, 557, 560, 563, 566, 569, 572, 575, 578, 581, 584, 587, 590, + 593, 596, 599, 602, 605, 608, 616, 619, 622, 625, 628, 631, 634, 637, 640, 643, + 646, 649, 652, 655, 658, 661, 664, 667, 670, 673, 676, 679, 682, 685, 688, 691, + 694, 697, 700, 703, 706, 709, 712, 715, 718, 721, 724, 727, 730, 733, 736, 739, + 742, 745, 748, 751, 754, 757, 760, 763, 766, 769, 772, 775, 778, 781, 784, 787, + 790, 793, 796, 799, 806, 811, 814, 820, 828, 837, 843, 849, 855, 861, 867, 873, + 879, 885, 891, 897, 903, 909, 915, 918, 921, 924, 930, 933, 936, 939, 945, 948, + 951, 954, 960, 963, 966, 969, 975, 978, 984, 985, 986, 987, 988, 989, 990, 991, + 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1011, 1012, 1019, + 1019, 1023, 1028, 1028, 1028, 1028, 1028, 1028, 1029, 1029, 1035, 1043, 1049, 1052, 1059, 1066, + 1066, 1066, 1066, 1070, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, + 1076, 1077, 1077, 1077, 1077, 1081, 1088, 1094, 1099, 1104, 1110, 1115, 1120, 1125, 1131, 1136, + 1142, 1151, 1157, 1163, 1168, 1174, 1180, 1180, 1180, 1184, 1191, 1198, 1205, 1205, 1205, 1205, + 1205, 1205, 1205, 1206, 1206, 1206, 1206, 1206, 1206, 1206, 1206, 1207, 1207, 1207, 1207, 1207, + 1207, 1207, 1211, 1221, 1224, 1230, 1233, 1239, 1248, 1257, 1260, 1263, 1269, 1280, 1291, 1294, + 1300, 1308, 1316, 1324, 1327, 1332, 1341, 1347, 1353, 1359, 1369, 1379, 1386, 1393, 1400, 1408, + 1416, 1424, 1432, 1438, 1444, 1447, 1453, 1459, 1464, 1467, 1474, 1477, 1480, 1483, 1486, 1489, + 1492, 1495, 1500, 1502, 1508, 1508, 1512, 1519, 1526, 1526, 1530, 1530, 1534, 1540, 1541, 1548, + 1554, 1557, 1564, 1571, 1572, 1573, 1574, 1575, 1578, 1578, 1578, 1578, 1578, 1578, 1578, 1580, + 1585, 1590, 1595, 1600, 1605, 1610, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, + 1630, 1633, 1640, 1643, 1649, 1659, 1664, 1669, 1674, 1679, 1684, 1689, 1694, 1699}; + +// Print the state stack on the debug stream. +void ParserGen::yystack_print_() { + *yycdebug_ << "Stack now"; + for (stack_type::const_iterator i = yystack_.begin(), i_end = yystack_.end(); i != i_end; ++i) + *yycdebug_ << ' ' << int(i->state); + *yycdebug_ << '\n'; +} + +// Report on the debug stream that the rule \a yyrule is going to be reduced. +void ParserGen::yy_reduce_print_(int yyrule) { + int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + // Print the symbols being reduced, and their result. + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 << " (line " << yylno << "):\n"; + // The symbols being reduced. + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT(" $" << yyi + 1 << " =", yystack_[(yynrhs) - (yyi + 1)]); +} +#endif // YYDEBUG + + +#line 57 "src/mongo/db/cst/grammar.yy" +} // namespace mongo +#line 5887 "src/mongo/db/cst/parser_gen.cpp" + +#line 1703 "src/mongo/db/cst/grammar.yy" diff --git a/src/mongo/db/cst/pipeline_parser_gen.hpp b/src/mongo/db/cst/parser_gen.hpp index 9c9296172ee..7fe3e6dfe2e 100644 --- a/src/mongo/db/cst/pipeline_parser_gen.hpp +++ b/src/mongo/db/cst/parser_gen.hpp @@ -1,4 +1,4 @@ -// A Bison parser, made by GNU Bison 3.7. +// A Bison parser, made by GNU Bison 3.5.4. // Skeleton interface for Bison LALR(1) parsers in C++ @@ -32,20 +32,19 @@ /** - ** \file pipeline_parser_gen.hpp + ** \file src/mongo/db/cst/parser_gen.hpp ** Define the mongo::parser class. */ // C++ LALR(1) parser skeleton written by Akim Demaille. -// 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. +// Undocumented macros, especially those whose name start with YY_, +// are private implementation details. Do not rely on them. -#ifndef YY_YY_PIPELINE_PARSER_GEN_HPP_INCLUDED -#define YY_YY_PIPELINE_PARSER_GEN_HPP_INCLUDED +#ifndef YY_YY_SRC_MONGO_DB_CST_PARSER_GEN_HPP_INCLUDED +#define YY_YY_SRC_MONGO_DB_CST_PARSER_GEN_HPP_INCLUDED // "%code requires" blocks. -#line 67 "pipeline_grammar.yy" +#line 66 "src/mongo/db/cst/grammar.yy" #include "mongo/db/cst/bson_location.h" #include "mongo/db/cst/c_node.h" @@ -60,7 +59,7 @@ class BSONLexer; #pragma warning(disable : 4065) #endif -#line 64 "pipeline_parser_gen.hpp" +#line 63 "src/mongo/db/cst/parser_gen.hpp" #include <cassert> #include <cstdlib> // std::abort @@ -189,13 +188,13 @@ class BSONLexer; #define YYDEBUG 0 #endif -#line 58 "pipeline_grammar.yy" +#line 57 "src/mongo/db/cst/grammar.yy" namespace mongo { -#line 199 "pipeline_parser_gen.hpp" +#line 198 "src/mongo/db/cst/parser_gen.hpp" /// A Bison parser. -class PipelineParserGen { +class ParserGen { public: #ifndef YYSTYPE /// A buffer to store and retrieve objects. @@ -218,13 +217,6 @@ public: new (yyas_<T>()) T(YY_MOVE(t)); } -#if 201103L <= YY_CPLUSPLUS - /// Non copyable. - semantic_type(const self_type&) = delete; - /// Non copyable. - self_type& operator=(const self_type&) = delete; -#endif - /// Destruction, allowed only if empty. ~semantic_type() YY_NOEXCEPT { YY_ASSERT(!yytypeid_); @@ -343,12 +335,9 @@ public: } private: -#if YY_CPLUSPLUS < 201103L - /// Non copyable. - semantic_type(const self_type&); - /// Non copyable. + /// Prohibit blind copies. self_type& operator=(const self_type&); -#endif + semantic_type(const self_type&); /// Accessor to raw memory as \a T. template <typename T> @@ -610,453 +599,160 @@ public: location_type location; }; - /// Token kinds. + /// Tokens. struct token { - enum token_kind_type { - YYEMPTY = -2, - END_OF_FILE = 0, // "EOF" - YYerror = 1, // error - YYUNDEF = 2, // "invalid token" - ABS = 3, // ABS - ADD = 4, // ADD - AND = 5, // AND - ARG_CHARS = 6, // "chars argument" - ARG_COLL = 7, // "coll argument" - ARG_DATE = 8, // "date argument" - ARG_DATE_STRING = 9, // "dateString argument" - ARG_FIND = 10, // "find argument" - ARG_FORMAT = 11, // "format argument" - ARG_INPUT = 12, // "input argument" - ARG_ON_ERROR = 13, // "onError argument" - ARG_ON_NULL = 14, // "onNull argument" - ARG_OPTIONS = 15, // "options argument" - ARG_PIPELINE = 16, // "pipeline argument" - ARG_REGEX = 17, // "regex argument" - ARG_REPLACEMENT = 18, // "replacement argument" - ARG_SIZE = 19, // "size argument" - ARG_TIMEZONE = 20, // "timezone argument" - ARG_TO = 21, // "to argument" - ATAN2 = 22, // ATAN2 - BOOL_FALSE = 23, // "false" - BOOL_TRUE = 24, // "true" - CEIL = 25, // CEIL - CMP = 26, // CMP - CONCAT = 27, // CONCAT - CONST_EXPR = 28, // CONST_EXPR - CONVERT = 29, // CONVERT - DATE_FROM_STRING = 30, // DATE_FROM_STRING - DATE_TO_STRING = 31, // DATE_TO_STRING - DECIMAL_NEGATIVE_ONE = 32, // "-1 (decimal)" - DECIMAL_ONE = 33, // "1 (decimal)" - DECIMAL_ZERO = 34, // "zero (decimal)" - DIVIDE = 35, // DIVIDE - DOUBLE_NEGATIVE_ONE = 36, // "-1 (double)" - DOUBLE_ONE = 37, // "1 (double)" - DOUBLE_ZERO = 38, // "zero (double)" - END_ARRAY = 39, // "end of array" - END_OBJECT = 40, // "end of object" - EQ = 41, // EQ - EXPONENT = 42, // EXPONENT - FLOOR = 43, // FLOOR - GT = 44, // GT - GTE = 45, // GTE - ID = 46, // ID - INDEX_OF_BYTES = 47, // INDEX_OF_BYTES - INDEX_OF_CP = 48, // INDEX_OF_CP - INT_NEGATIVE_ONE = 49, // "-1 (int)" - INT_ONE = 50, // "1 (int)" - INT_ZERO = 51, // "zero (int)" - LITERAL = 52, // LITERAL - LN = 53, // LN - LOG = 54, // LOG - LOGTEN = 55, // LOGTEN - LONG_NEGATIVE_ONE = 56, // "-1 (long)" - LONG_ONE = 57, // "1 (long)" - LONG_ZERO = 58, // "zero (long)" - LT = 59, // LT - LTE = 60, // LTE - LTRIM = 61, // LTRIM - META = 62, // META - MOD = 63, // MOD - MULTIPLY = 64, // MULTIPLY - NE = 65, // NE - NOT = 66, // NOT - OR = 67, // OR - POW = 68, // POW - RAND_VAL = 69, // "randVal" - REGEX_FIND = 70, // REGEX_FIND - REGEX_FIND_ALL = 71, // REGEX_FIND_ALL - REGEX_MATCH = 72, // REGEX_MATCH - REPLACE_ALL = 73, // REPLACE_ALL - REPLACE_ONE = 74, // REPLACE_ONE - ROUND = 75, // ROUND - RTRIM = 76, // RTRIM - SPLIT = 77, // SPLIT - SQRT = 78, // SQRT - STAGE_INHIBIT_OPTIMIZATION = 79, // STAGE_INHIBIT_OPTIMIZATION - STAGE_LIMIT = 80, // STAGE_LIMIT - STAGE_PROJECT = 81, // STAGE_PROJECT - STAGE_SAMPLE = 82, // STAGE_SAMPLE - STAGE_SKIP = 83, // STAGE_SKIP - STAGE_UNION_WITH = 84, // STAGE_UNION_WITH - START_ARRAY = 85, // "array" - START_OBJECT = 86, // "object" - STR_CASE_CMP = 87, // STR_CASE_CMP - STR_LEN_BYTES = 88, // STR_LEN_BYTES - STR_LEN_CP = 89, // STR_LEN_CP - SUBSTR = 90, // SUBSTR - SUBSTR_BYTES = 91, // SUBSTR_BYTES - SUBSTR_CP = 92, // SUBSTR_CP - SUBTRACT = 93, // SUBTRACT - TEXT_SCORE = 94, // "textScore" - TO_BOOL = 95, // TO_BOOL - TO_DATE = 96, // TO_DATE - TO_DECIMAL = 97, // TO_DECIMAL - TO_DOUBLE = 98, // TO_DOUBLE - TO_INT = 99, // TO_INT - TO_LONG = 100, // TO_LONG - TO_LOWER = 101, // TO_LOWER - TO_OBJECT_ID = 102, // TO_OBJECT_ID - TO_STRING = 103, // TO_STRING - TO_UPPER = 104, // TO_UPPER - TRIM = 105, // TRIM - TRUNC = 106, // TRUNC - TYPE = 107, // TYPE - FIELDNAME = 108, // "fieldname" - STRING = 109, // "string" - BINARY = 110, // "BinData" - UNDEFINED = 111, // "undefined" - OBJECT_ID = 112, // "ObjectID" - DATE_LITERAL = 113, // "Date" - JSNULL = 114, // "null" - REGEX = 115, // "regex" - DB_POINTER = 116, // "dbPointer" - JAVASCRIPT = 117, // "Code" - SYMBOL = 118, // "Symbol" - JAVASCRIPT_W_SCOPE = 119, // "CodeWScope" - INT_OTHER = 120, // "arbitrary integer" - LONG_OTHER = 121, // "arbitrary long" - DOUBLE_OTHER = 122, // "arbitrary double" - DECIMAL_OTHER = 123, // "arbitrary decimal" - TIMESTAMP = 124, // "Timestamp" - MIN_KEY = 125, // "minKey" - MAX_KEY = 126, // "maxKey" - DOLLAR_STRING = 127, // "$-prefixed string" - DOLLAR_DOLLAR_STRING = 128, // "$$-prefixed string" - DOLLAR_PREF_FIELDNAME = 129, // "$-prefixed fieldname" - START_PIPELINE = 130, // START_PIPELINE - START_MATCH = 131, // START_MATCH - START_SORT = 132 // START_SORT + enum yytokentype { + END_OF_FILE = 0, + ABS = 3, + ADD = 4, + AND = 5, + ARG_CHARS = 6, + ARG_COLL = 7, + ARG_DATE = 8, + ARG_DATE_STRING = 9, + ARG_FILTER = 10, + ARG_FIND = 11, + ARG_FORMAT = 12, + ARG_INPUT = 13, + ARG_ON_ERROR = 14, + ARG_ON_NULL = 15, + ARG_OPTIONS = 16, + ARG_PIPELINE = 17, + ARG_Q = 18, + ARG_QUERY = 19, + ARG_REGEX = 20, + ARG_REPLACEMENT = 21, + ARG_SIZE = 22, + ARG_SORT = 23, + ARG_TIMEZONE = 24, + ARG_TO = 25, + ATAN2 = 26, + BOOL_FALSE = 27, + BOOL_TRUE = 28, + CEIL = 29, + CMP = 30, + CONCAT = 31, + CONST_EXPR = 32, + CONVERT = 33, + DATE_FROM_STRING = 34, + DATE_TO_STRING = 35, + DECIMAL_NEGATIVE_ONE = 36, + DECIMAL_ONE = 37, + DECIMAL_ZERO = 38, + DIVIDE = 39, + DOUBLE_NEGATIVE_ONE = 40, + DOUBLE_ONE = 41, + DOUBLE_ZERO = 42, + END_ARRAY = 43, + END_OBJECT = 44, + EQ = 45, + EXPONENT = 46, + FLOOR = 47, + GT = 48, + GTE = 49, + ID = 50, + INDEX_OF_BYTES = 51, + INDEX_OF_CP = 52, + INT_NEGATIVE_ONE = 53, + INT_ONE = 54, + INT_ZERO = 55, + LITERAL = 56, + LN = 57, + LOG = 58, + LOGTEN = 59, + LONG_NEGATIVE_ONE = 60, + LONG_ONE = 61, + LONG_ZERO = 62, + LT = 63, + LTE = 64, + LTRIM = 65, + META = 66, + MOD = 67, + MULTIPLY = 68, + NE = 69, + NOT = 70, + OR = 71, + POW = 72, + RAND_VAL = 73, + REGEX_FIND = 74, + REGEX_FIND_ALL = 75, + REGEX_MATCH = 76, + REPLACE_ALL = 77, + REPLACE_ONE = 78, + ROUND = 79, + RTRIM = 80, + SPLIT = 81, + SQRT = 82, + STAGE_INHIBIT_OPTIMIZATION = 83, + STAGE_LIMIT = 84, + STAGE_PROJECT = 85, + STAGE_SAMPLE = 86, + STAGE_SKIP = 87, + STAGE_UNION_WITH = 88, + START_ARRAY = 89, + START_OBJECT = 90, + STR_CASE_CMP = 91, + STR_LEN_BYTES = 92, + STR_LEN_CP = 93, + SUBSTR = 94, + SUBSTR_BYTES = 95, + SUBSTR_CP = 96, + SUBTRACT = 97, + TEXT_SCORE = 98, + TO_BOOL = 99, + TO_DATE = 100, + TO_DECIMAL = 101, + TO_DOUBLE = 102, + TO_INT = 103, + TO_LONG = 104, + TO_LOWER = 105, + TO_OBJECT_ID = 106, + TO_STRING = 107, + TO_UPPER = 108, + TRIM = 109, + TRUNC = 110, + TYPE = 111, + FIELDNAME = 112, + STRING = 113, + BINARY = 114, + UNDEFINED = 115, + OBJECT_ID = 116, + DATE_LITERAL = 117, + JSNULL = 118, + REGEX = 119, + DB_POINTER = 120, + JAVASCRIPT = 121, + SYMBOL = 122, + JAVASCRIPT_W_SCOPE = 123, + INT_OTHER = 124, + LONG_OTHER = 125, + DOUBLE_OTHER = 126, + DECIMAL_OTHER = 127, + TIMESTAMP = 128, + MIN_KEY = 129, + MAX_KEY = 130, + DOLLAR_STRING = 131, + DOLLAR_DOLLAR_STRING = 132, + DOLLAR_PREF_FIELDNAME = 133 }; - /// Backward compatibility alias (Bison 3.6). - typedef token_kind_type yytokentype; }; - /// Token kind, as returned by yylex. - typedef token::yytokentype token_kind_type; - - /// Backward compatibility alias (Bison 3.6). - typedef token_kind_type token_type; - - /// Symbol kinds. - struct symbol_kind { - enum symbol_kind_type { - YYNTOKENS = 133, ///< Number of tokens. - S_YYEMPTY = -2, - S_YYEOF = 0, // "EOF" - S_YYerror = 1, // error - S_YYUNDEF = 2, // "invalid token" - S_ABS = 3, // ABS - S_ADD = 4, // ADD - S_AND = 5, // AND - S_ARG_CHARS = 6, // "chars argument" - S_ARG_COLL = 7, // "coll argument" - S_ARG_DATE = 8, // "date argument" - S_ARG_DATE_STRING = 9, // "dateString argument" - S_ARG_FIND = 10, // "find argument" - S_ARG_FORMAT = 11, // "format argument" - S_ARG_INPUT = 12, // "input argument" - S_ARG_ON_ERROR = 13, // "onError argument" - S_ARG_ON_NULL = 14, // "onNull argument" - S_ARG_OPTIONS = 15, // "options argument" - S_ARG_PIPELINE = 16, // "pipeline argument" - S_ARG_REGEX = 17, // "regex argument" - S_ARG_REPLACEMENT = 18, // "replacement argument" - S_ARG_SIZE = 19, // "size argument" - S_ARG_TIMEZONE = 20, // "timezone argument" - S_ARG_TO = 21, // "to argument" - S_ATAN2 = 22, // ATAN2 - S_BOOL_FALSE = 23, // "false" - S_BOOL_TRUE = 24, // "true" - S_CEIL = 25, // CEIL - S_CMP = 26, // CMP - S_CONCAT = 27, // CONCAT - S_CONST_EXPR = 28, // CONST_EXPR - S_CONVERT = 29, // CONVERT - S_DATE_FROM_STRING = 30, // DATE_FROM_STRING - S_DATE_TO_STRING = 31, // DATE_TO_STRING - S_DECIMAL_NEGATIVE_ONE = 32, // "-1 (decimal)" - S_DECIMAL_ONE = 33, // "1 (decimal)" - S_DECIMAL_ZERO = 34, // "zero (decimal)" - S_DIVIDE = 35, // DIVIDE - S_DOUBLE_NEGATIVE_ONE = 36, // "-1 (double)" - S_DOUBLE_ONE = 37, // "1 (double)" - S_DOUBLE_ZERO = 38, // "zero (double)" - S_END_ARRAY = 39, // "end of array" - S_END_OBJECT = 40, // "end of object" - S_EQ = 41, // EQ - S_EXPONENT = 42, // EXPONENT - S_FLOOR = 43, // FLOOR - S_GT = 44, // GT - S_GTE = 45, // GTE - S_ID = 46, // ID - S_INDEX_OF_BYTES = 47, // INDEX_OF_BYTES - S_INDEX_OF_CP = 48, // INDEX_OF_CP - S_INT_NEGATIVE_ONE = 49, // "-1 (int)" - S_INT_ONE = 50, // "1 (int)" - S_INT_ZERO = 51, // "zero (int)" - S_LITERAL = 52, // LITERAL - S_LN = 53, // LN - S_LOG = 54, // LOG - S_LOGTEN = 55, // LOGTEN - S_LONG_NEGATIVE_ONE = 56, // "-1 (long)" - S_LONG_ONE = 57, // "1 (long)" - S_LONG_ZERO = 58, // "zero (long)" - S_LT = 59, // LT - S_LTE = 60, // LTE - S_LTRIM = 61, // LTRIM - S_META = 62, // META - S_MOD = 63, // MOD - S_MULTIPLY = 64, // MULTIPLY - S_NE = 65, // NE - S_NOT = 66, // NOT - S_OR = 67, // OR - S_POW = 68, // POW - S_RAND_VAL = 69, // "randVal" - S_REGEX_FIND = 70, // REGEX_FIND - S_REGEX_FIND_ALL = 71, // REGEX_FIND_ALL - S_REGEX_MATCH = 72, // REGEX_MATCH - S_REPLACE_ALL = 73, // REPLACE_ALL - S_REPLACE_ONE = 74, // REPLACE_ONE - S_ROUND = 75, // ROUND - S_RTRIM = 76, // RTRIM - S_SPLIT = 77, // SPLIT - S_SQRT = 78, // SQRT - S_STAGE_INHIBIT_OPTIMIZATION = 79, // STAGE_INHIBIT_OPTIMIZATION - S_STAGE_LIMIT = 80, // STAGE_LIMIT - S_STAGE_PROJECT = 81, // STAGE_PROJECT - S_STAGE_SAMPLE = 82, // STAGE_SAMPLE - S_STAGE_SKIP = 83, // STAGE_SKIP - S_STAGE_UNION_WITH = 84, // STAGE_UNION_WITH - S_START_ARRAY = 85, // "array" - S_START_OBJECT = 86, // "object" - S_STR_CASE_CMP = 87, // STR_CASE_CMP - S_STR_LEN_BYTES = 88, // STR_LEN_BYTES - S_STR_LEN_CP = 89, // STR_LEN_CP - S_SUBSTR = 90, // SUBSTR - S_SUBSTR_BYTES = 91, // SUBSTR_BYTES - S_SUBSTR_CP = 92, // SUBSTR_CP - S_SUBTRACT = 93, // SUBTRACT - S_TEXT_SCORE = 94, // "textScore" - S_TO_BOOL = 95, // TO_BOOL - S_TO_DATE = 96, // TO_DATE - S_TO_DECIMAL = 97, // TO_DECIMAL - S_TO_DOUBLE = 98, // TO_DOUBLE - S_TO_INT = 99, // TO_INT - S_TO_LONG = 100, // TO_LONG - S_TO_LOWER = 101, // TO_LOWER - S_TO_OBJECT_ID = 102, // TO_OBJECT_ID - S_TO_STRING = 103, // TO_STRING - S_TO_UPPER = 104, // TO_UPPER - S_TRIM = 105, // TRIM - S_TRUNC = 106, // TRUNC - S_TYPE = 107, // TYPE - S_FIELDNAME = 108, // "fieldname" - S_STRING = 109, // "string" - S_BINARY = 110, // "BinData" - S_UNDEFINED = 111, // "undefined" - S_OBJECT_ID = 112, // "ObjectID" - S_DATE_LITERAL = 113, // "Date" - S_JSNULL = 114, // "null" - S_REGEX = 115, // "regex" - S_DB_POINTER = 116, // "dbPointer" - S_JAVASCRIPT = 117, // "Code" - S_SYMBOL = 118, // "Symbol" - S_JAVASCRIPT_W_SCOPE = 119, // "CodeWScope" - S_INT_OTHER = 120, // "arbitrary integer" - S_LONG_OTHER = 121, // "arbitrary long" - S_DOUBLE_OTHER = 122, // "arbitrary double" - S_DECIMAL_OTHER = 123, // "arbitrary decimal" - S_TIMESTAMP = 124, // "Timestamp" - S_MIN_KEY = 125, // "minKey" - S_MAX_KEY = 126, // "maxKey" - S_DOLLAR_STRING = 127, // "$-prefixed string" - S_DOLLAR_DOLLAR_STRING = 128, // "$$-prefixed string" - S_DOLLAR_PREF_FIELDNAME = 129, // "$-prefixed fieldname" - S_START_PIPELINE = 130, // START_PIPELINE - S_START_MATCH = 131, // START_MATCH - S_START_SORT = 132, // START_SORT - S_YYACCEPT = 133, // $accept - S_projectionFieldname = 134, // projectionFieldname - S_expressionFieldname = 135, // expressionFieldname - S_stageAsUserFieldname = 136, // stageAsUserFieldname - S_filterFieldname = 137, // filterFieldname - S_argAsUserFieldname = 138, // argAsUserFieldname - S_aggExprAsUserFieldname = 139, // aggExprAsUserFieldname - S_invariableUserFieldname = 140, // invariableUserFieldname - S_idAsUserFieldname = 141, // idAsUserFieldname - S_valueFieldname = 142, // valueFieldname - S_projectField = 143, // projectField - S_expressionField = 144, // expressionField - S_valueField = 145, // valueField - S_filterField = 146, // filterField - S_dbPointer = 147, // dbPointer - S_javascript = 148, // javascript - S_symbol = 149, // symbol - S_javascriptWScope = 150, // javascriptWScope - S_int = 151, // int - S_timestamp = 152, // timestamp - S_long = 153, // long - S_double = 154, // double - S_decimal = 155, // decimal - S_minKey = 156, // minKey - S_maxKey = 157, // maxKey - S_value = 158, // value - S_string = 159, // string - S_fieldPath = 160, // fieldPath - S_binary = 161, // binary - S_undefined = 162, // undefined - S_objectId = 163, // objectId - S_bool = 164, // bool - S_date = 165, // date - S_null = 166, // null - S_regex = 167, // regex - S_simpleValue = 168, // simpleValue - S_compoundValue = 169, // compoundValue - S_valueArray = 170, // valueArray - S_valueObject = 171, // valueObject - S_valueFields = 172, // valueFields - S_variable = 173, // variable - S_pipeline = 174, // pipeline - S_stageList = 175, // stageList - S_stage = 176, // stage - S_inhibitOptimization = 177, // inhibitOptimization - S_unionWith = 178, // unionWith - S_skip = 179, // skip - S_limit = 180, // limit - S_project = 181, // project - S_sample = 182, // sample - S_projectFields = 183, // projectFields - S_projection = 184, // projection - S_num = 185, // num - S_expression = 186, // expression - S_compoundExpression = 187, // compoundExpression - S_exprFixedTwoArg = 188, // exprFixedTwoArg - S_expressionArray = 189, // expressionArray - S_expressionObject = 190, // expressionObject - S_expressionFields = 191, // expressionFields - S_maths = 192, // maths - S_add = 193, // add - S_atan2 = 194, // atan2 - S_boolExps = 195, // boolExps - S_and = 196, // and - S_or = 197, // or - S_not = 198, // not - S_literalEscapes = 199, // literalEscapes - S_const = 200, // const - S_literal = 201, // literal - S_stringExps = 202, // stringExps - S_concat = 203, // concat - S_dateFromString = 204, // dateFromString - S_dateToString = 205, // dateToString - S_indexOfBytes = 206, // indexOfBytes - S_indexOfCP = 207, // indexOfCP - S_ltrim = 208, // ltrim - S_regexFind = 209, // regexFind - S_regexFindAll = 210, // regexFindAll - S_regexMatch = 211, // regexMatch - S_regexArgs = 212, // regexArgs - S_replaceOne = 213, // replaceOne - S_replaceAll = 214, // replaceAll - S_rtrim = 215, // rtrim - S_split = 216, // split - S_strLenBytes = 217, // strLenBytes - S_strLenCP = 218, // strLenCP - S_strcasecmp = 219, // strcasecmp - S_substr = 220, // substr - S_substrBytes = 221, // substrBytes - S_substrCP = 222, // substrCP - S_toLower = 223, // toLower - S_toUpper = 224, // toUpper - S_trim = 225, // trim - S_compExprs = 226, // compExprs - S_cmp = 227, // cmp - S_eq = 228, // eq - S_gt = 229, // gt - S_gte = 230, // gte - S_lt = 231, // lt - S_lte = 232, // lte - S_ne = 233, // ne - S_typeExpression = 234, // typeExpression - S_convert = 235, // convert - S_toBool = 236, // toBool - S_toDate = 237, // toDate - S_toDecimal = 238, // toDecimal - S_toDouble = 239, // toDouble - S_toInt = 240, // toInt - S_toLong = 241, // toLong - S_toObjectId = 242, // toObjectId - S_toString = 243, // toString - S_type = 244, // type - S_abs = 245, // abs - S_ceil = 246, // ceil - S_divide = 247, // divide - S_exponent = 248, // exponent - S_floor = 249, // floor - S_ln = 250, // ln - S_log = 251, // log - S_logten = 252, // logten - S_mod = 253, // mod - S_multiply = 254, // multiply - S_pow = 255, // pow - S_round = 256, // round - S_sqrt = 257, // sqrt - S_subtract = 258, // subtract - S_trunc = 259, // trunc - S_onErrorArg = 260, // onErrorArg - S_onNullArg = 261, // onNullArg - S_formatArg = 262, // formatArg - S_timezoneArg = 263, // timezoneArg - S_charsArg = 264, // charsArg - S_optionsArg = 265, // optionsArg - S_expressions = 266, // expressions - S_values = 267, // values - S_exprZeroToTwo = 268, // exprZeroToTwo - S_matchExpression = 269, // matchExpression - S_filterFields = 270, // filterFields - S_filterVal = 271, // filterVal - S_sortSpecs = 272, // sortSpecs - S_specList = 273, // specList - S_metaSort = 274, // metaSort - S_oneOrNegOne = 275, // oneOrNegOne - S_metaSortKeyword = 276, // metaSortKeyword - S_sortSpec = 277, // sortSpec - S_start = 278, // start - S_START_ORDERED_OBJECT = 279, // START_ORDERED_OBJECT - S_280_1 = 280 // $@1 - }; - }; + /// (External) token type, as returned by yylex. + typedef token::yytokentype token_type; + + /// Symbol type: an internal symbol number. + typedef int symbol_number_type; - /// (Internal) symbol kind. - typedef symbol_kind::symbol_kind_type symbol_kind_type; + /// The symbol type number to denote an empty symbol. + enum { empty_symbol = -2 }; - /// The number of tokens. - static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS; + /// Internal symbol number for tokens (subsumed by symbol_number_type). + typedef unsigned char token_number_type; /// A complete symbol. /// - /// Expects its Base type to provide access to the symbol kind - /// via kind (). + /// Expects its Base type to provide access to the symbol type + /// via type_get (). /// /// Provide access to semantic value and location. template <typename Base> @@ -1069,245 +765,7 @@ public: #if 201103L <= YY_CPLUSPLUS /// Move constructor. - basic_symbol(basic_symbol&& that) - : Base(std::move(that)), value(), location(std::move(that.location)) { - switch (this->kind()) { - case symbol_kind::S_BINARY: // "BinData" - value.move<BSONBinData>(std::move(that.value)); - break; - - case symbol_kind::S_JAVASCRIPT: // "Code" - value.move<BSONCode>(std::move(that.value)); - break; - - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" - value.move<BSONCodeWScope>(std::move(that.value)); - break; - - case symbol_kind::S_DB_POINTER: // "dbPointer" - value.move<BSONDBRef>(std::move(that.value)); - break; - - case symbol_kind::S_REGEX: // "regex" - value.move<BSONRegEx>(std::move(that.value)); - break; - - case symbol_kind::S_SYMBOL: // "Symbol" - value.move<BSONSymbol>(std::move(that.value)); - break; - - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword - value.move<CNode>(std::move(that.value)); - break; - - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname - value.move<CNode::Fieldname>(std::move(that.value)); - break; - - case symbol_kind::S_DATE_LITERAL: // "Date" - value.move<Date_t>(std::move(that.value)); - break; - - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" - value.move<Decimal128>(std::move(that.value)); - break; - - case symbol_kind::S_OBJECT_ID: // "ObjectID" - value.move<OID>(std::move(that.value)); - break; - - case symbol_kind::S_TIMESTAMP: // "Timestamp" - value.move<Timestamp>(std::move(that.value)); - break; - - case symbol_kind::S_MAX_KEY: // "maxKey" - value.move<UserMaxKey>(std::move(that.value)); - break; - - case symbol_kind::S_MIN_KEY: // "minKey" - value.move<UserMinKey>(std::move(that.value)); - break; - - case symbol_kind::S_JSNULL: // "null" - value.move<UserNull>(std::move(that.value)); - break; - - case symbol_kind::S_UNDEFINED: // "undefined" - value.move<UserUndefined>(std::move(that.value)); - break; - - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" - value.move<double>(std::move(that.value)); - break; - - case symbol_kind::S_INT_OTHER: // "arbitrary integer" - value.move<int>(std::move(that.value)); - break; - - case symbol_kind::S_LONG_OTHER: // "arbitrary long" - value.move<long long>(std::move(that.value)); - break; - - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec - value.move<std::pair<CNode::Fieldname, CNode>>(std::move(that.value)); - break; - - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" - value.move<std::string>(std::move(that.value)); - break; - - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo - value.move<std::vector<CNode>>(std::move(that.value)); - break; - - default: - break; - } - } + basic_symbol(basic_symbol&& that); #endif /// Copy constructor. @@ -1489,245 +947,245 @@ public: /// Destroy contents, and record that is empty. void clear() { // User destructor. - symbol_kind_type yykind = this->kind(); + symbol_number_type yytype = this->type_get(); basic_symbol<Base>& yysym = *this; (void)yysym; - switch (yykind) { + switch (yytype) { default: break; } - // Value type destructor. - switch (yykind) { - case symbol_kind::S_BINARY: // "BinData" + // Type destructor. + switch (yytype) { + case 114: // "BinData" value.template destroy<BSONBinData>(); break; - case symbol_kind::S_JAVASCRIPT: // "Code" + case 121: // "Code" value.template destroy<BSONCode>(); break; - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" + case 123: // "CodeWScope" value.template destroy<BSONCodeWScope>(); break; - case symbol_kind::S_DB_POINTER: // "dbPointer" + case 120: // "dbPointer" value.template destroy<BSONDBRef>(); break; - case symbol_kind::S_REGEX: // "regex" + case 119: // "regex" value.template destroy<BSONRegEx>(); break; - case symbol_kind::S_SYMBOL: // "Symbol" + case 122: // "Symbol" value.template destroy<BSONSymbol>(); break; - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword value.template destroy<CNode>(); break; - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname value.template destroy<CNode::Fieldname>(); break; - case symbol_kind::S_DATE_LITERAL: // "Date" + case 117: // "Date" value.template destroy<Date_t>(); break; - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" + case 127: // "arbitrary decimal" value.template destroy<Decimal128>(); break; - case symbol_kind::S_OBJECT_ID: // "ObjectID" + case 116: // "ObjectID" value.template destroy<OID>(); break; - case symbol_kind::S_TIMESTAMP: // "Timestamp" + case 128: // "Timestamp" value.template destroy<Timestamp>(); break; - case symbol_kind::S_MAX_KEY: // "maxKey" + case 130: // "maxKey" value.template destroy<UserMaxKey>(); break; - case symbol_kind::S_MIN_KEY: // "minKey" + case 129: // "minKey" value.template destroy<UserMinKey>(); break; - case symbol_kind::S_JSNULL: // "null" + case 118: // "null" value.template destroy<UserNull>(); break; - case symbol_kind::S_UNDEFINED: // "undefined" + case 115: // "undefined" value.template destroy<UserUndefined>(); break; - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" + case 126: // "arbitrary double" value.template destroy<double>(); break; - case symbol_kind::S_INT_OTHER: // "arbitrary integer" + case 124: // "arbitrary integer" value.template destroy<int>(); break; - case symbol_kind::S_LONG_OTHER: // "arbitrary long" + case 125: // "arbitrary long" value.template destroy<long long>(); break; - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec value.template destroy<std::pair<CNode::Fieldname, CNode>>(); break; - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" value.template destroy<std::string>(); break; - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo value.template destroy<std::vector<CNode>>(); break; @@ -1738,14 +1196,6 @@ public: Base::clear(); } - /// The user-facing name of this symbol. - std::string name() const YY_NOEXCEPT { - return PipelineParserGen::symbol_name(this->kind()); - } - - /// Backward compatibility (Bison 3.6). - symbol_kind_type type_get() const YY_NOEXCEPT; - /// Whether empty. bool empty() const YY_NOEXCEPT; @@ -1766,49 +1216,44 @@ public: }; /// Type access provider for token (enum) based symbols. - struct by_kind { + struct by_type { /// Default constructor. - by_kind(); + by_type(); #if 201103L <= YY_CPLUSPLUS /// Move constructor. - by_kind(by_kind&& that); + by_type(by_type&& that); #endif /// Copy constructor. - by_kind(const by_kind& that); + by_type(const by_type& that); - /// The symbol kind as needed by the constructor. - typedef token_kind_type kind_type; + /// The symbol type as needed by the constructor. + typedef token_type kind_type; /// Constructor from (external) token numbers. - by_kind(kind_type t); + by_type(kind_type t); /// Record that this symbol is empty. void clear(); - /// Steal the symbol kind from \a that. - void move(by_kind& that); + /// Steal the symbol type from \a that. + void move(by_type& that); /// The (internal) type number (corresponding to \a type). /// \a empty when empty. - symbol_kind_type kind() const YY_NOEXCEPT; + symbol_number_type type_get() const YY_NOEXCEPT; - /// Backward compatibility (Bison 3.6). - symbol_kind_type type_get() const YY_NOEXCEPT; - - /// The symbol kind. - /// \a S_YYEMPTY when empty. - symbol_kind_type kind_; + /// The symbol type. + /// \a empty_symbol when empty. + /// An int, not token_number_type, to be able to store empty_symbol. + int type; }; - /// Backward compatibility for a private implementation detail (Bison 3.6). - typedef by_kind by_type; - /// "External" symbols: returned by the scanner. - struct symbol_type : basic_symbol<by_kind> { + struct symbol_type : basic_symbol<by_type> { /// Superclass. - typedef basic_symbol<by_kind> super_type; + typedef basic_symbol<by_type> super_type; /// Empty symbol. symbol_type() {} @@ -1817,20 +1262,21 @@ public: #if 201103L <= YY_CPLUSPLUS symbol_type(int tok, location_type l) : super_type(token_type(tok), std::move(l)) { YY_ASSERT( - tok == token::END_OF_FILE || tok == token::YYerror || tok == token::YYUNDEF || - tok == token::ABS || tok == token::ADD || tok == token::AND || - tok == token::ARG_CHARS || tok == token::ARG_COLL || tok == token::ARG_DATE || - tok == token::ARG_DATE_STRING || tok == token::ARG_FIND || - tok == token::ARG_FORMAT || tok == token::ARG_INPUT || tok == token::ARG_ON_ERROR || + tok == token::END_OF_FILE || tok == token::ABS || tok == token::ADD || + tok == token::AND || tok == token::ARG_CHARS || tok == token::ARG_COLL || + tok == token::ARG_DATE || tok == token::ARG_DATE_STRING || + tok == token::ARG_FILTER || tok == token::ARG_FIND || tok == token::ARG_FORMAT || + tok == token::ARG_INPUT || tok == token::ARG_ON_ERROR || tok == token::ARG_ON_NULL || tok == token::ARG_OPTIONS || - tok == token::ARG_PIPELINE || tok == token::ARG_REGEX || - tok == token::ARG_REPLACEMENT || tok == token::ARG_SIZE || - tok == token::ARG_TIMEZONE || tok == token::ARG_TO || tok == token::ATAN2 || - tok == token::BOOL_FALSE || tok == token::BOOL_TRUE || tok == token::CEIL || - tok == token::CMP || tok == token::CONCAT || tok == token::CONST_EXPR || - tok == token::CONVERT || tok == token::DATE_FROM_STRING || - tok == token::DATE_TO_STRING || tok == token::DECIMAL_NEGATIVE_ONE || - tok == token::DECIMAL_ONE || tok == token::DECIMAL_ZERO || tok == token::DIVIDE || + tok == token::ARG_PIPELINE || tok == token::ARG_Q || tok == token::ARG_QUERY || + tok == token::ARG_REGEX || tok == token::ARG_REPLACEMENT || + tok == token::ARG_SIZE || tok == token::ARG_SORT || tok == token::ARG_TIMEZONE || + tok == token::ARG_TO || tok == token::ATAN2 || tok == token::BOOL_FALSE || + tok == token::BOOL_TRUE || tok == token::CEIL || tok == token::CMP || + tok == token::CONCAT || tok == token::CONST_EXPR || tok == token::CONVERT || + tok == token::DATE_FROM_STRING || tok == token::DATE_TO_STRING || + tok == token::DECIMAL_NEGATIVE_ONE || tok == token::DECIMAL_ONE || + tok == token::DECIMAL_ZERO || tok == token::DIVIDE || tok == token::DOUBLE_NEGATIVE_ONE || tok == token::DOUBLE_ONE || tok == token::DOUBLE_ZERO || tok == token::END_ARRAY || tok == token::END_OBJECT || tok == token::EQ || tok == token::EXPONENT || tok == token::FLOOR || @@ -1858,26 +1304,26 @@ public: tok == token::TO_DOUBLE || tok == token::TO_INT || tok == token::TO_LONG || tok == token::TO_LOWER || tok == token::TO_OBJECT_ID || tok == token::TO_STRING || tok == token::TO_UPPER || tok == token::TRIM || tok == token::TRUNC || - tok == token::TYPE || tok == token::START_PIPELINE || tok == token::START_MATCH || - tok == token::START_SORT); + tok == token::TYPE); } #else symbol_type(int tok, const location_type& l) : super_type(token_type(tok), l) { YY_ASSERT( - tok == token::END_OF_FILE || tok == token::YYerror || tok == token::YYUNDEF || - tok == token::ABS || tok == token::ADD || tok == token::AND || - tok == token::ARG_CHARS || tok == token::ARG_COLL || tok == token::ARG_DATE || - tok == token::ARG_DATE_STRING || tok == token::ARG_FIND || - tok == token::ARG_FORMAT || tok == token::ARG_INPUT || tok == token::ARG_ON_ERROR || + tok == token::END_OF_FILE || tok == token::ABS || tok == token::ADD || + tok == token::AND || tok == token::ARG_CHARS || tok == token::ARG_COLL || + tok == token::ARG_DATE || tok == token::ARG_DATE_STRING || + tok == token::ARG_FILTER || tok == token::ARG_FIND || tok == token::ARG_FORMAT || + tok == token::ARG_INPUT || tok == token::ARG_ON_ERROR || tok == token::ARG_ON_NULL || tok == token::ARG_OPTIONS || - tok == token::ARG_PIPELINE || tok == token::ARG_REGEX || - tok == token::ARG_REPLACEMENT || tok == token::ARG_SIZE || - tok == token::ARG_TIMEZONE || tok == token::ARG_TO || tok == token::ATAN2 || - tok == token::BOOL_FALSE || tok == token::BOOL_TRUE || tok == token::CEIL || - tok == token::CMP || tok == token::CONCAT || tok == token::CONST_EXPR || - tok == token::CONVERT || tok == token::DATE_FROM_STRING || - tok == token::DATE_TO_STRING || tok == token::DECIMAL_NEGATIVE_ONE || - tok == token::DECIMAL_ONE || tok == token::DECIMAL_ZERO || tok == token::DIVIDE || + tok == token::ARG_PIPELINE || tok == token::ARG_Q || tok == token::ARG_QUERY || + tok == token::ARG_REGEX || tok == token::ARG_REPLACEMENT || + tok == token::ARG_SIZE || tok == token::ARG_SORT || tok == token::ARG_TIMEZONE || + tok == token::ARG_TO || tok == token::ATAN2 || tok == token::BOOL_FALSE || + tok == token::BOOL_TRUE || tok == token::CEIL || tok == token::CMP || + tok == token::CONCAT || tok == token::CONST_EXPR || tok == token::CONVERT || + tok == token::DATE_FROM_STRING || tok == token::DATE_TO_STRING || + tok == token::DECIMAL_NEGATIVE_ONE || tok == token::DECIMAL_ONE || + tok == token::DECIMAL_ZERO || tok == token::DIVIDE || tok == token::DOUBLE_NEGATIVE_ONE || tok == token::DOUBLE_ONE || tok == token::DOUBLE_ZERO || tok == token::END_ARRAY || tok == token::END_OBJECT || tok == token::EQ || tok == token::EXPONENT || tok == token::FLOOR || @@ -1905,8 +1351,7 @@ public: tok == token::TO_DOUBLE || tok == token::TO_INT || tok == token::TO_LONG || tok == token::TO_LOWER || tok == token::TO_OBJECT_ID || tok == token::TO_STRING || tok == token::TO_UPPER || tok == token::TRIM || tok == token::TRUNC || - tok == token::TYPE || tok == token::START_PIPELINE || tok == token::START_MATCH || - tok == token::START_SORT); + tok == token::TYPE); } #endif #if 201103L <= YY_CPLUSPLUS @@ -2114,15 +1559,8 @@ public: }; /// Build a parser object. - PipelineParserGen(BSONLexer& lexer_yyarg, CNode* cst_yyarg); - virtual ~PipelineParserGen(); - -#if 201103L <= YY_CPLUSPLUS - /// Non copyable. - PipelineParserGen(const PipelineParserGen&) = delete; - /// Non copyable. - PipelineParserGen& operator=(const PipelineParserGen&) = delete; -#endif + ParserGen(BSONLexer& lexer_yyarg, CNode* cst_yyarg); + virtual ~ParserGen(); /// Parse. An alias for parse (). /// \returns 0 iff parsing succeeded. @@ -2154,10 +1592,6 @@ public: /// Report a syntax error. void error(const syntax_error& err); - /// The user-facing name of the symbol whose (internal) number is - /// YYSYMBOL. No bounds checking. - static std::string symbol_name(symbol_kind_type yysymbol); - // Implementation of make_symbol for each symbol type. #if 201103L <= YY_CPLUSPLUS static symbol_type make_END_OF_FILE(location_type l) { @@ -2169,24 +1603,6 @@ public: } #endif #if 201103L <= YY_CPLUSPLUS - static symbol_type make_YYerror(location_type l) { - return symbol_type(token::YYerror, std::move(l)); - } -#else - static symbol_type make_YYerror(const location_type& l) { - return symbol_type(token::YYerror, l); - } -#endif -#if 201103L <= YY_CPLUSPLUS - static symbol_type make_YYUNDEF(location_type l) { - return symbol_type(token::YYUNDEF, std::move(l)); - } -#else - static symbol_type make_YYUNDEF(const location_type& l) { - return symbol_type(token::YYUNDEF, l); - } -#endif -#if 201103L <= YY_CPLUSPLUS static symbol_type make_ABS(location_type l) { return symbol_type(token::ABS, std::move(l)); } @@ -2250,6 +1666,15 @@ public: } #endif #if 201103L <= YY_CPLUSPLUS + static symbol_type make_ARG_FILTER(location_type l) { + return symbol_type(token::ARG_FILTER, std::move(l)); + } +#else + static symbol_type make_ARG_FILTER(const location_type& l) { + return symbol_type(token::ARG_FILTER, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS static symbol_type make_ARG_FIND(location_type l) { return symbol_type(token::ARG_FIND, std::move(l)); } @@ -2313,6 +1738,24 @@ public: } #endif #if 201103L <= YY_CPLUSPLUS + static symbol_type make_ARG_Q(location_type l) { + return symbol_type(token::ARG_Q, std::move(l)); + } +#else + static symbol_type make_ARG_Q(const location_type& l) { + return symbol_type(token::ARG_Q, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static symbol_type make_ARG_QUERY(location_type l) { + return symbol_type(token::ARG_QUERY, std::move(l)); + } +#else + static symbol_type make_ARG_QUERY(const location_type& l) { + return symbol_type(token::ARG_QUERY, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS static symbol_type make_ARG_REGEX(location_type l) { return symbol_type(token::ARG_REGEX, std::move(l)); } @@ -2340,6 +1783,15 @@ public: } #endif #if 201103L <= YY_CPLUSPLUS + static symbol_type make_ARG_SORT(location_type l) { + return symbol_type(token::ARG_SORT, std::move(l)); + } +#else + static symbol_type make_ARG_SORT(const location_type& l) { + return symbol_type(token::ARG_SORT, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS static symbol_type make_ARG_TIMEZONE(location_type l) { return symbol_type(token::ARG_TIMEZONE, std::move(l)); } @@ -3329,78 +2781,21 @@ public: return symbol_type(token::DOLLAR_PREF_FIELDNAME, v, l); } #endif -#if 201103L <= YY_CPLUSPLUS - static symbol_type make_START_PIPELINE(location_type l) { - return symbol_type(token::START_PIPELINE, std::move(l)); - } -#else - static symbol_type make_START_PIPELINE(const location_type& l) { - return symbol_type(token::START_PIPELINE, l); - } -#endif -#if 201103L <= YY_CPLUSPLUS - static symbol_type make_START_MATCH(location_type l) { - return symbol_type(token::START_MATCH, std::move(l)); - } -#else - static symbol_type make_START_MATCH(const location_type& l) { - return symbol_type(token::START_MATCH, l); - } -#endif -#if 201103L <= YY_CPLUSPLUS - static symbol_type make_START_SORT(location_type l) { - return symbol_type(token::START_SORT, std::move(l)); - } -#else - static symbol_type make_START_SORT(const location_type& l) { - return symbol_type(token::START_SORT, l); - } -#endif - - - class context { - public: - context(const PipelineParserGen& yyparser, const symbol_type& yyla); - const symbol_type& lookahead() const { - return yyla_; - } - symbol_kind_type token() const { - return yyla_.kind(); - } - const location_type& location() const { - return yyla_.location; - } - /// Put in YYARG at most YYARGN of the expected tokens, 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). - int expected_tokens(symbol_kind_type yyarg[], int yyargn) const; - - private: - const PipelineParserGen& yyparser_; - const symbol_type& yyla_; - }; private: -#if YY_CPLUSPLUS < 201103L - /// Non copyable. - PipelineParserGen(const PipelineParserGen&); - /// Non copyable. - PipelineParserGen& operator=(const PipelineParserGen&); -#endif - + /// This class is not copyable. + ParserGen(const ParserGen&); + ParserGen& operator=(const ParserGen&); /// Stored state numbers (used for stacks). typedef short state_type; - /// The arguments of the error message. - int yy_syntax_error_arguments_(const context& yyctx, - symbol_kind_type yyarg[], - int yyargn) const; - /// Generate an error message. - /// \param yyctx the context in which the error occurred. - virtual std::string yysyntax_error_(const context& yyctx) const; + /// \param yystate the state where the error occurred. + /// \param yyla the lookahead token. + virtual std::string yysyntax_error_(state_type yystate, const symbol_type& yyla) const; + /// Compute post-reduction state. /// \param yystate the current state /// \param yysym the nonterminal to push on the stack @@ -3417,17 +2812,10 @@ private: static const short yypact_ninf_; static const signed char yytable_ninf_; - /// Convert a scanner token kind \a t to a symbol kind. - /// In theory \a t should be a token_kind_type, but character literals + /// Convert a scanner token number \a t to a symbol number. + /// In theory \a t should be a token_type, but character literals /// are valid, yet not members of the token_type enum. - static symbol_kind_type yytranslate_(int t); - - /// Convert the symbol name \a n to a form suitable for a diagnostic. - static std::string yytnamerr_(const char* yystr); - - /// For a symbol, its name in clear. - static const char* const yytname_[]; - + static token_number_type yytranslate_(int t); // Tables. // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -3463,20 +2851,26 @@ private: static const signed char yyr2_[]; + /// Convert the symbol name \a n to a form suitable for a diagnostic. + static std::string yytnamerr_(const char* n); + + + /// For a symbol, its name in clear. + static const char* const yytname_[]; #if YYDEBUG // YYRLINE[YYN] -- Source line where rule number YYN was defined. static const short yyrline_[]; /// Report on the debug stream that the rule \a r is going to be reduced. - virtual void yy_reduce_print_(int r) const; + virtual void yy_reduce_print_(int r); /// Print the state stack on the debug stream. - virtual void yy_stack_print_() const; + virtual void yystack_print_(); /// Debugging level. int yydebug_; /// Debug stream. std::ostream* yycdebug_; - /// \brief Display a symbol kind, value and location. + /// \brief Display a symbol type, value and location. /// \param yyo The output stream. /// \param yysym The symbol. template <typename Base> @@ -3496,7 +2890,7 @@ private: /// Default constructor. by_state() YY_NOEXCEPT; - /// The symbol kind as needed by the constructor. + /// The symbol type as needed by the constructor. typedef state_type kind_type; /// Constructor. @@ -3508,12 +2902,12 @@ private: /// Record that this symbol is empty. void clear() YY_NOEXCEPT; - /// Steal the symbol kind from \a that. + /// Steal the symbol type from \a that. void move(by_state& that); - /// The symbol kind (corresponding to \a state). - /// \a symbol_kind::S_YYEMPTY when empty. - symbol_kind_type kind() const YY_NOEXCEPT; + /// The (internal) type number (corresponding to \a state). + /// \a empty_symbol when empty. + symbol_number_type type_get() const YY_NOEXCEPT; /// The state number used to denote an empty symbol. /// We use the initial state, as it does not have a value. @@ -3550,20 +2944,13 @@ private: class stack { public: // Hide our reversed order. - typedef typename S::iterator iterator; - typedef typename S::const_iterator const_iterator; + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; typedef typename S::size_type size_type; typedef typename std::ptrdiff_t index_type; stack(size_type n = 200) : seq_(n) {} -#if 201103L <= YY_CPLUSPLUS - /// Non copyable. - stack(const stack&) = delete; - /// Non copyable. - stack& operator=(const stack&) = delete; -#endif - /// Random access. /// /// Index 0 returns the topmost element. @@ -3602,14 +2989,18 @@ private: return index_type(seq_.size()); } + std::ptrdiff_t ssize() const YY_NOEXCEPT { + return std::ptrdiff_t(size()); + } + /// Iterator on top of the stack (going downwards). const_iterator begin() const YY_NOEXCEPT { - return seq_.begin(); + return seq_.rbegin(); } /// Bottom of the stack. const_iterator end() const YY_NOEXCEPT { - return seq_.end(); + return seq_.rend(); } /// Present a slice of the top of a stack. @@ -3627,12 +3018,8 @@ private: }; private: -#if YY_CPLUSPLUS < 201103L - /// Non copyable. stack(const stack&); - /// Non copyable. stack& operator=(const stack&); -#endif /// The wrapped container. S seq_; }; @@ -3662,11 +3049,17 @@ private: /// Pop \a n symbols from the stack. void yypop_(int n = 1); + /// Some specific tokens. + static const token_number_type yy_error_token_ = 1; + static const token_number_type yy_undef_token_ = 2; + /// Constants. enum { - yylast_ = 1306, ///< Last index in yytable_. - yynnts_ = 148, ///< Number of nonterminal symbols. - yyfinal_ = 11 ///< Termination state number. + yyeof_ = 0, + yylast_ = 1192, ///< Last index in yytable_. + yynnts_ = 148, ///< Number of nonterminal symbols. + yyfinal_ = 15, ///< Termination state number. + yyntokens_ = 134 ///< Number of tokens. }; @@ -3675,244 +3068,487 @@ private: CNode* cst; }; -inline PipelineParserGen::symbol_kind_type PipelineParserGen::yytranslate_(int t) { - return static_cast<symbol_kind_type>(t); +inline ParserGen::token_number_type ParserGen::yytranslate_(int t) { + return static_cast<token_number_type>(t); } // basic_symbol. +#if 201103L <= YY_CPLUSPLUS template <typename Base> -PipelineParserGen::basic_symbol<Base>::basic_symbol(const basic_symbol& that) +ParserGen::basic_symbol<Base>::basic_symbol(basic_symbol&& that) + : Base(std::move(that)), value(), location(std::move(that.location)) { + switch (this->type_get()) { + case 114: // "BinData" + value.move<BSONBinData>(std::move(that.value)); + break; + + case 121: // "Code" + value.move<BSONCode>(std::move(that.value)); + break; + + case 123: // "CodeWScope" + value.move<BSONCodeWScope>(std::move(that.value)); + break; + + case 120: // "dbPointer" + value.move<BSONDBRef>(std::move(that.value)); + break; + + case 119: // "regex" + value.move<BSONRegEx>(std::move(that.value)); + break; + + case 122: // "Symbol" + value.move<BSONSymbol>(std::move(that.value)); + break; + + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword + value.move<CNode>(std::move(that.value)); + break; + + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname + value.move<CNode::Fieldname>(std::move(that.value)); + break; + + case 117: // "Date" + value.move<Date_t>(std::move(that.value)); + break; + + case 127: // "arbitrary decimal" + value.move<Decimal128>(std::move(that.value)); + break; + + case 116: // "ObjectID" + value.move<OID>(std::move(that.value)); + break; + + case 128: // "Timestamp" + value.move<Timestamp>(std::move(that.value)); + break; + + case 130: // "maxKey" + value.move<UserMaxKey>(std::move(that.value)); + break; + + case 129: // "minKey" + value.move<UserMinKey>(std::move(that.value)); + break; + + case 118: // "null" + value.move<UserNull>(std::move(that.value)); + break; + + case 115: // "undefined" + value.move<UserUndefined>(std::move(that.value)); + break; + + case 126: // "arbitrary double" + value.move<double>(std::move(that.value)); + break; + + case 124: // "arbitrary integer" + value.move<int>(std::move(that.value)); + break; + + case 125: // "arbitrary long" + value.move<long long>(std::move(that.value)); + break; + + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec + value.move<std::pair<CNode::Fieldname, CNode>>(std::move(that.value)); + break; + + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" + value.move<std::string>(std::move(that.value)); + break; + + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo + value.move<std::vector<CNode>>(std::move(that.value)); + break; + + default: + break; + } +} +#endif + +template <typename Base> +ParserGen::basic_symbol<Base>::basic_symbol(const basic_symbol& that) : Base(that), value(), location(that.location) { - switch (this->kind()) { - case symbol_kind::S_BINARY: // "BinData" + switch (this->type_get()) { + case 114: // "BinData" value.copy<BSONBinData>(YY_MOVE(that.value)); break; - case symbol_kind::S_JAVASCRIPT: // "Code" + case 121: // "Code" value.copy<BSONCode>(YY_MOVE(that.value)); break; - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" + case 123: // "CodeWScope" value.copy<BSONCodeWScope>(YY_MOVE(that.value)); break; - case symbol_kind::S_DB_POINTER: // "dbPointer" + case 120: // "dbPointer" value.copy<BSONDBRef>(YY_MOVE(that.value)); break; - case symbol_kind::S_REGEX: // "regex" + case 119: // "regex" value.copy<BSONRegEx>(YY_MOVE(that.value)); break; - case symbol_kind::S_SYMBOL: // "Symbol" + case 122: // "Symbol" value.copy<BSONSymbol>(YY_MOVE(that.value)); break; - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword value.copy<CNode>(YY_MOVE(that.value)); break; - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname value.copy<CNode::Fieldname>(YY_MOVE(that.value)); break; - case symbol_kind::S_DATE_LITERAL: // "Date" + case 117: // "Date" value.copy<Date_t>(YY_MOVE(that.value)); break; - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" + case 127: // "arbitrary decimal" value.copy<Decimal128>(YY_MOVE(that.value)); break; - case symbol_kind::S_OBJECT_ID: // "ObjectID" + case 116: // "ObjectID" value.copy<OID>(YY_MOVE(that.value)); break; - case symbol_kind::S_TIMESTAMP: // "Timestamp" + case 128: // "Timestamp" value.copy<Timestamp>(YY_MOVE(that.value)); break; - case symbol_kind::S_MAX_KEY: // "maxKey" + case 130: // "maxKey" value.copy<UserMaxKey>(YY_MOVE(that.value)); break; - case symbol_kind::S_MIN_KEY: // "minKey" + case 129: // "minKey" value.copy<UserMinKey>(YY_MOVE(that.value)); break; - case symbol_kind::S_JSNULL: // "null" + case 118: // "null" value.copy<UserNull>(YY_MOVE(that.value)); break; - case symbol_kind::S_UNDEFINED: // "undefined" + case 115: // "undefined" value.copy<UserUndefined>(YY_MOVE(that.value)); break; - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" + case 126: // "arbitrary double" value.copy<double>(YY_MOVE(that.value)); break; - case symbol_kind::S_INT_OTHER: // "arbitrary integer" + case 124: // "arbitrary integer" value.copy<int>(YY_MOVE(that.value)); break; - case symbol_kind::S_LONG_OTHER: // "arbitrary long" + case 125: // "arbitrary long" value.copy<long long>(YY_MOVE(that.value)); break; - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec value.copy<std::pair<CNode::Fieldname, CNode>>(YY_MOVE(that.value)); break; - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" value.copy<std::string>(YY_MOVE(that.value)); break; - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo value.copy<std::vector<CNode>>(YY_MOVE(that.value)); break; @@ -3923,249 +3559,243 @@ PipelineParserGen::basic_symbol<Base>::basic_symbol(const basic_symbol& that) template <typename Base> -PipelineParserGen::symbol_kind_type PipelineParserGen::basic_symbol<Base>::type_get() const - YY_NOEXCEPT { - return this->kind(); -} - -template <typename Base> -bool PipelineParserGen::basic_symbol<Base>::empty() const YY_NOEXCEPT { - return this->kind() == symbol_kind::S_YYEMPTY; +bool ParserGen::basic_symbol<Base>::empty() const YY_NOEXCEPT { + return Base::type_get() == empty_symbol; } template <typename Base> -void PipelineParserGen::basic_symbol<Base>::move(basic_symbol& s) { +void ParserGen::basic_symbol<Base>::move(basic_symbol& s) { super_type::move(s); - switch (this->kind()) { - case symbol_kind::S_BINARY: // "BinData" + switch (this->type_get()) { + case 114: // "BinData" value.move<BSONBinData>(YY_MOVE(s.value)); break; - case symbol_kind::S_JAVASCRIPT: // "Code" + case 121: // "Code" value.move<BSONCode>(YY_MOVE(s.value)); break; - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" + case 123: // "CodeWScope" value.move<BSONCodeWScope>(YY_MOVE(s.value)); break; - case symbol_kind::S_DB_POINTER: // "dbPointer" + case 120: // "dbPointer" value.move<BSONDBRef>(YY_MOVE(s.value)); break; - case symbol_kind::S_REGEX: // "regex" + case 119: // "regex" value.move<BSONRegEx>(YY_MOVE(s.value)); break; - case symbol_kind::S_SYMBOL: // "Symbol" + case 122: // "Symbol" value.move<BSONSymbol>(YY_MOVE(s.value)); break; - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword + case 148: // dbPointer + case 149: // javascript + case 150: // symbol + case 151: // javascriptWScope + case 152: // int + case 153: // timestamp + case 154: // long + case 155: // double + case 156: // decimal + case 157: // minKey + case 158: // maxKey + case 159: // value + case 160: // string + case 161: // fieldPath + case 162: // binary + case 163: // undefined + case 164: // objectId + case 165: // bool + case 166: // date + case 167: // null + case 168: // regex + case 169: // simpleValue + case 170: // compoundValue + case 171: // valueArray + case 172: // valueObject + case 173: // valueFields + case 174: // variable + case 175: // pipeline + case 176: // stageList + case 177: // stage + case 178: // inhibitOptimization + case 179: // unionWith + case 180: // skip + case 181: // limit + case 182: // project + case 183: // sample + case 184: // projectFields + case 185: // projection + case 186: // num + case 187: // expression + case 188: // compoundExpression + case 189: // exprFixedTwoArg + case 190: // expressionArray + case 191: // expressionObject + case 192: // expressionFields + case 193: // maths + case 194: // add + case 195: // atan2 + case 196: // boolExps + case 197: // and + case 198: // or + case 199: // not + case 200: // literalEscapes + case 201: // const + case 202: // literal + case 203: // stringExps + case 204: // concat + case 205: // dateFromString + case 206: // dateToString + case 207: // indexOfBytes + case 208: // indexOfCP + case 209: // ltrim + case 210: // regexFind + case 211: // regexFindAll + case 212: // regexMatch + case 213: // regexArgs + case 214: // replaceOne + case 215: // replaceAll + case 216: // rtrim + case 217: // split + case 218: // strLenBytes + case 219: // strLenCP + case 220: // strcasecmp + case 221: // substr + case 222: // substrBytes + case 223: // substrCP + case 224: // toLower + case 225: // toUpper + case 226: // trim + case 227: // compExprs + case 228: // cmp + case 229: // eq + case 230: // gt + case 231: // gte + case 232: // lt + case 233: // lte + case 234: // ne + case 235: // typeExpression + case 236: // convert + case 237: // toBool + case 238: // toDate + case 239: // toDecimal + case 240: // toDouble + case 241: // toInt + case 242: // toLong + case 243: // toObjectId + case 244: // toString + case 245: // type + case 246: // abs + case 247: // ceil + case 248: // divide + case 249: // exponent + case 250: // floor + case 251: // ln + case 252: // log + case 253: // logten + case 254: // mod + case 255: // multiply + case 256: // pow + case 257: // round + case 258: // sqrt + case 259: // subtract + case 260: // trunc + case 270: // matchExpression + case 271: // filterFields + case 272: // filterVal + case 273: // sortSpecs + case 274: // specList + case 275: // metaSort + case 276: // oneOrNegOne + case 277: // metaSortKeyword value.move<CNode>(YY_MOVE(s.value)); break; - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname + case 135: // projectionFieldname + case 136: // expressionFieldname + case 137: // stageAsUserFieldname + case 138: // filterFieldname + case 139: // argAsUserFieldname + case 140: // aggExprAsUserFieldname + case 141: // invariableUserFieldname + case 142: // idAsUserFieldname + case 143: // valueFieldname value.move<CNode::Fieldname>(YY_MOVE(s.value)); break; - case symbol_kind::S_DATE_LITERAL: // "Date" + case 117: // "Date" value.move<Date_t>(YY_MOVE(s.value)); break; - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" + case 127: // "arbitrary decimal" value.move<Decimal128>(YY_MOVE(s.value)); break; - case symbol_kind::S_OBJECT_ID: // "ObjectID" + case 116: // "ObjectID" value.move<OID>(YY_MOVE(s.value)); break; - case symbol_kind::S_TIMESTAMP: // "Timestamp" + case 128: // "Timestamp" value.move<Timestamp>(YY_MOVE(s.value)); break; - case symbol_kind::S_MAX_KEY: // "maxKey" + case 130: // "maxKey" value.move<UserMaxKey>(YY_MOVE(s.value)); break; - case symbol_kind::S_MIN_KEY: // "minKey" + case 129: // "minKey" value.move<UserMinKey>(YY_MOVE(s.value)); break; - case symbol_kind::S_JSNULL: // "null" + case 118: // "null" value.move<UserNull>(YY_MOVE(s.value)); break; - case symbol_kind::S_UNDEFINED: // "undefined" + case 115: // "undefined" value.move<UserUndefined>(YY_MOVE(s.value)); break; - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" + case 126: // "arbitrary double" value.move<double>(YY_MOVE(s.value)); break; - case symbol_kind::S_INT_OTHER: // "arbitrary integer" + case 124: // "arbitrary integer" value.move<int>(YY_MOVE(s.value)); break; - case symbol_kind::S_LONG_OTHER: // "arbitrary long" + case 125: // "arbitrary long" value.move<long long>(YY_MOVE(s.value)); break; - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec + case 144: // projectField + case 145: // expressionField + case 146: // valueField + case 147: // filterField + case 261: // onErrorArg + case 262: // onNullArg + case 263: // formatArg + case 264: // timezoneArg + case 265: // charsArg + case 266: // optionsArg + case 278: // sortSpec value.move<std::pair<CNode::Fieldname, CNode>>(YY_MOVE(s.value)); break; - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" + case 112: // "fieldname" + case 113: // "string" + case 131: // "$-prefixed string" + case 132: // "$$-prefixed string" + case 133: // "$-prefixed fieldname" value.move<std::string>(YY_MOVE(s.value)); break; - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo + case 267: // expressions + case 268: // values + case 269: // exprZeroToTwo value.move<std::vector<CNode>>(YY_MOVE(s.value)); break; @@ -4176,40 +3806,35 @@ void PipelineParserGen::basic_symbol<Base>::move(basic_symbol& s) { location = YY_MOVE(s.location); } -// by_kind. -inline PipelineParserGen::by_kind::by_kind() : kind_(symbol_kind::S_YYEMPTY) {} +// by_type. +inline ParserGen::by_type::by_type() : type(empty_symbol) {} #if 201103L <= YY_CPLUSPLUS -inline PipelineParserGen::by_kind::by_kind(by_kind&& that) : kind_(that.kind_) { +inline ParserGen::by_type::by_type(by_type&& that) : type(that.type) { that.clear(); } #endif -inline PipelineParserGen::by_kind::by_kind(const by_kind& that) : kind_(that.kind_) {} +inline ParserGen::by_type::by_type(const by_type& that) : type(that.type) {} -inline PipelineParserGen::by_kind::by_kind(token_kind_type t) : kind_(yytranslate_(t)) {} +inline ParserGen::by_type::by_type(token_type t) : type(yytranslate_(t)) {} -inline void PipelineParserGen::by_kind::clear() { - kind_ = symbol_kind::S_YYEMPTY; +inline void ParserGen::by_type::clear() { + type = empty_symbol; } -inline void PipelineParserGen::by_kind::move(by_kind& that) { - kind_ = that.kind_; +inline void ParserGen::by_type::move(by_type& that) { + type = that.type; that.clear(); } -inline PipelineParserGen::symbol_kind_type PipelineParserGen::by_kind::kind() const YY_NOEXCEPT { - return kind_; -} - -inline PipelineParserGen::symbol_kind_type PipelineParserGen::by_kind::type_get() const - YY_NOEXCEPT { - return this->kind(); +inline int ParserGen::by_type::type_get() const YY_NOEXCEPT { + return type; } -#line 58 "pipeline_grammar.yy" +#line 57 "src/mongo/db/cst/grammar.yy" } // namespace mongo -#line 5223 "pipeline_parser_gen.hpp" +#line 4844 "src/mongo/db/cst/parser_gen.hpp" -#endif // !YY_YY_PIPELINE_PARSER_GEN_HPP_INCLUDED +#endif // !YY_YY_SRC_MONGO_DB_CST_PARSER_GEN_HPP_INCLUDED diff --git a/src/mongo/db/cst/pipeline_parser_gen.cpp b/src/mongo/db/cst/pipeline_parser_gen.cpp deleted file mode 100644 index e7bf5ae4429..00000000000 --- a/src/mongo/db/cst/pipeline_parser_gen.cpp +++ /dev/null @@ -1,6219 +0,0 @@ -// A Bison parser, made by GNU Bison 3.7. - -// Skeleton implementation for Bison LALR(1) parsers in C++ - -// Copyright (C) 2002-2015, 2018-2020 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 <http://www.gnu.org/licenses/>. - -// 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. - -// 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. - - -#include "pipeline_parser_gen.hpp" - - -// Unqualified %code blocks. -#line 83 "pipeline_grammar.yy" - -#include "mongo/db/cst/bson_lexer.h" -#include "mongo/db/cst/c_node_disambiguation.h" -#include "mongo/db/cst/c_node_validation.h" -#include "mongo/db/cst/key_fieldname.h" -#include "mongo/platform/decimal128.h" -#include "mongo/stdx/variant.h" - -namespace mongo { -// Mandatory error function. -void PipelineParserGen::error(const PipelineParserGen::location_type& loc, const std::string& msg) { - uasserted(ErrorCodes::FailedToParse, str::stream() << msg << " at element " << loc); -} -} // namespace mongo - -// Default location for actions, called each time a rule is matched but before the action is -// run. Also called when bison encounters a syntax ambiguity, which should not be relevant for -// mongo. -#define YYLLOC_DEFAULT(newPos, rhsPositions, nRhs) - -#line 68 "pipeline_parser_gen.cpp" - - -#ifndef YY_ -#if defined YYENABLE_NLS && YYENABLE_NLS -#if ENABLE_NLS -#include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE. -#define YY_(msgid) dgettext("bison-runtime", msgid) -#endif -#endif -#ifndef YY_ -#define YY_(msgid) msgid -#endif -#endif - - -// Whether we are compiled with exception support. -#ifndef YY_EXCEPTIONS -#if defined __GNUC__ && !defined __EXCEPTIONS -#define YY_EXCEPTIONS 0 -#else -#define YY_EXCEPTIONS 1 -#endif -#endif - -#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) -/* 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).begin = YYRHSLOC(Rhs, 1).begin; \ - (Current).end = YYRHSLOC(Rhs, N).end; \ - } else { \ - (Current).begin = (Current).end = YYRHSLOC(Rhs, 0).end; \ - } \ - while (false) -#endif - - -// Enable debugging if requested. -#if YYDEBUG - -// A pseudo ostream that takes yydebug_ into account. -#define YYCDEBUG \ - if (yydebug_) \ - (*yycdebug_) - -#define YY_SYMBOL_PRINT(Title, Symbol) \ - do { \ - if (yydebug_) { \ - *yycdebug_ << Title << ' '; \ - yy_print_(*yycdebug_, Symbol); \ - *yycdebug_ << '\n'; \ - } \ - } while (false) - -#define YY_REDUCE_PRINT(Rule) \ - do { \ - if (yydebug_) \ - yy_reduce_print_(Rule); \ - } while (false) - -#define YY_STACK_PRINT() \ - do { \ - if (yydebug_) \ - yy_stack_print_(); \ - } while (false) - -#else // !YYDEBUG - -#define YYCDEBUG \ - if (false) \ - std::cerr -#define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol) -#define YY_REDUCE_PRINT(Rule) static_cast<void>(0) -#define YY_STACK_PRINT() static_cast<void>(0) - -#endif // !YYDEBUG - -#define yyerrok (yyerrstatus_ = 0) -#define yyclearin (yyla.clear()) - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab -#define YYRECOVERING() (!!yyerrstatus_) - -#line 58 "pipeline_grammar.yy" -namespace mongo { -#line 161 "pipeline_parser_gen.cpp" - -/// Build a parser object. -PipelineParserGen::PipelineParserGen(BSONLexer& lexer_yyarg, CNode* cst_yyarg) -#if YYDEBUG - : yydebug_(false), - yycdebug_(&std::cerr), -#else - : -#endif - lexer(lexer_yyarg), - cst(cst_yyarg) { -} - -PipelineParserGen::~PipelineParserGen() {} - -PipelineParserGen::syntax_error::~syntax_error() YY_NOEXCEPT YY_NOTHROW {} - -/*---------------. -| symbol kinds. | -`---------------*/ - - -// by_state. -PipelineParserGen::by_state::by_state() YY_NOEXCEPT : state(empty_state) {} - -PipelineParserGen::by_state::by_state(const by_state& that) YY_NOEXCEPT : state(that.state) {} - -void PipelineParserGen::by_state::clear() YY_NOEXCEPT { - state = empty_state; -} - -void PipelineParserGen::by_state::move(by_state& that) { - state = that.state; - that.clear(); -} - -PipelineParserGen::by_state::by_state(state_type s) YY_NOEXCEPT : state(s) {} - -PipelineParserGen::symbol_kind_type PipelineParserGen::by_state::kind() const YY_NOEXCEPT { - if (state == empty_state) - return symbol_kind::S_YYEMPTY; - else - return YY_CAST(symbol_kind_type, yystos_[+state]); -} - -PipelineParserGen::stack_symbol_type::stack_symbol_type() {} - -PipelineParserGen::stack_symbol_type::stack_symbol_type(YY_RVREF(stack_symbol_type) that) - : super_type(YY_MOVE(that.state), YY_MOVE(that.location)) { - switch (that.kind()) { - case symbol_kind::S_BINARY: // "BinData" - value.YY_MOVE_OR_COPY<BSONBinData>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_JAVASCRIPT: // "Code" - value.YY_MOVE_OR_COPY<BSONCode>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" - value.YY_MOVE_OR_COPY<BSONCodeWScope>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_DB_POINTER: // "dbPointer" - value.YY_MOVE_OR_COPY<BSONDBRef>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_REGEX: // "regex" - value.YY_MOVE_OR_COPY<BSONRegEx>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_SYMBOL: // "Symbol" - value.YY_MOVE_OR_COPY<BSONSymbol>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword - value.YY_MOVE_OR_COPY<CNode>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname - value.YY_MOVE_OR_COPY<CNode::Fieldname>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_DATE_LITERAL: // "Date" - value.YY_MOVE_OR_COPY<Date_t>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" - value.YY_MOVE_OR_COPY<Decimal128>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_OBJECT_ID: // "ObjectID" - value.YY_MOVE_OR_COPY<OID>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_TIMESTAMP: // "Timestamp" - value.YY_MOVE_OR_COPY<Timestamp>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_MAX_KEY: // "maxKey" - value.YY_MOVE_OR_COPY<UserMaxKey>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_MIN_KEY: // "minKey" - value.YY_MOVE_OR_COPY<UserMinKey>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_JSNULL: // "null" - value.YY_MOVE_OR_COPY<UserNull>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_UNDEFINED: // "undefined" - value.YY_MOVE_OR_COPY<UserUndefined>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" - value.YY_MOVE_OR_COPY<double>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_INT_OTHER: // "arbitrary integer" - value.YY_MOVE_OR_COPY<int>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_LONG_OTHER: // "arbitrary long" - value.YY_MOVE_OR_COPY<long long>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec - value.YY_MOVE_OR_COPY<std::pair<CNode::Fieldname, CNode>>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" - value.YY_MOVE_OR_COPY<std::string>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo - value.YY_MOVE_OR_COPY<std::vector<CNode>>(YY_MOVE(that.value)); - break; - - default: - break; - } - -#if 201103L <= YY_CPLUSPLUS - // that is emptied. - that.state = empty_state; -#endif -} - -PipelineParserGen::stack_symbol_type::stack_symbol_type(state_type s, YY_MOVE_REF(symbol_type) that) - : super_type(s, YY_MOVE(that.location)) { - switch (that.kind()) { - case symbol_kind::S_BINARY: // "BinData" - value.move<BSONBinData>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_JAVASCRIPT: // "Code" - value.move<BSONCode>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" - value.move<BSONCodeWScope>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_DB_POINTER: // "dbPointer" - value.move<BSONDBRef>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_REGEX: // "regex" - value.move<BSONRegEx>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_SYMBOL: // "Symbol" - value.move<BSONSymbol>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword - value.move<CNode>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname - value.move<CNode::Fieldname>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_DATE_LITERAL: // "Date" - value.move<Date_t>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" - value.move<Decimal128>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_OBJECT_ID: // "ObjectID" - value.move<OID>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_TIMESTAMP: // "Timestamp" - value.move<Timestamp>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_MAX_KEY: // "maxKey" - value.move<UserMaxKey>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_MIN_KEY: // "minKey" - value.move<UserMinKey>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_JSNULL: // "null" - value.move<UserNull>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_UNDEFINED: // "undefined" - value.move<UserUndefined>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" - value.move<double>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_INT_OTHER: // "arbitrary integer" - value.move<int>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_LONG_OTHER: // "arbitrary long" - value.move<long long>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec - value.move<std::pair<CNode::Fieldname, CNode>>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" - value.move<std::string>(YY_MOVE(that.value)); - break; - - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo - value.move<std::vector<CNode>>(YY_MOVE(that.value)); - break; - - default: - break; - } - - // that is emptied. - that.kind_ = symbol_kind::S_YYEMPTY; -} - -#if YY_CPLUSPLUS < 201103L -PipelineParserGen::stack_symbol_type& PipelineParserGen::stack_symbol_type::operator=( - const stack_symbol_type& that) { - state = that.state; - switch (that.kind()) { - case symbol_kind::S_BINARY: // "BinData" - value.copy<BSONBinData>(that.value); - break; - - case symbol_kind::S_JAVASCRIPT: // "Code" - value.copy<BSONCode>(that.value); - break; - - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" - value.copy<BSONCodeWScope>(that.value); - break; - - case symbol_kind::S_DB_POINTER: // "dbPointer" - value.copy<BSONDBRef>(that.value); - break; - - case symbol_kind::S_REGEX: // "regex" - value.copy<BSONRegEx>(that.value); - break; - - case symbol_kind::S_SYMBOL: // "Symbol" - value.copy<BSONSymbol>(that.value); - break; - - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword - value.copy<CNode>(that.value); - break; - - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname - value.copy<CNode::Fieldname>(that.value); - break; - - case symbol_kind::S_DATE_LITERAL: // "Date" - value.copy<Date_t>(that.value); - break; - - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" - value.copy<Decimal128>(that.value); - break; - - case symbol_kind::S_OBJECT_ID: // "ObjectID" - value.copy<OID>(that.value); - break; - - case symbol_kind::S_TIMESTAMP: // "Timestamp" - value.copy<Timestamp>(that.value); - break; - - case symbol_kind::S_MAX_KEY: // "maxKey" - value.copy<UserMaxKey>(that.value); - break; - - case symbol_kind::S_MIN_KEY: // "minKey" - value.copy<UserMinKey>(that.value); - break; - - case symbol_kind::S_JSNULL: // "null" - value.copy<UserNull>(that.value); - break; - - case symbol_kind::S_UNDEFINED: // "undefined" - value.copy<UserUndefined>(that.value); - break; - - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" - value.copy<double>(that.value); - break; - - case symbol_kind::S_INT_OTHER: // "arbitrary integer" - value.copy<int>(that.value); - break; - - case symbol_kind::S_LONG_OTHER: // "arbitrary long" - value.copy<long long>(that.value); - break; - - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec - value.copy<std::pair<CNode::Fieldname, CNode>>(that.value); - break; - - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" - value.copy<std::string>(that.value); - break; - - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo - value.copy<std::vector<CNode>>(that.value); - break; - - default: - break; - } - - location = that.location; - return *this; -} - -PipelineParserGen::stack_symbol_type& PipelineParserGen::stack_symbol_type::operator=( - stack_symbol_type& that) { - state = that.state; - switch (that.kind()) { - case symbol_kind::S_BINARY: // "BinData" - value.move<BSONBinData>(that.value); - break; - - case symbol_kind::S_JAVASCRIPT: // "Code" - value.move<BSONCode>(that.value); - break; - - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" - value.move<BSONCodeWScope>(that.value); - break; - - case symbol_kind::S_DB_POINTER: // "dbPointer" - value.move<BSONDBRef>(that.value); - break; - - case symbol_kind::S_REGEX: // "regex" - value.move<BSONRegEx>(that.value); - break; - - case symbol_kind::S_SYMBOL: // "Symbol" - value.move<BSONSymbol>(that.value); - break; - - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword - value.move<CNode>(that.value); - break; - - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname - value.move<CNode::Fieldname>(that.value); - break; - - case symbol_kind::S_DATE_LITERAL: // "Date" - value.move<Date_t>(that.value); - break; - - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" - value.move<Decimal128>(that.value); - break; - - case symbol_kind::S_OBJECT_ID: // "ObjectID" - value.move<OID>(that.value); - break; - - case symbol_kind::S_TIMESTAMP: // "Timestamp" - value.move<Timestamp>(that.value); - break; - - case symbol_kind::S_MAX_KEY: // "maxKey" - value.move<UserMaxKey>(that.value); - break; - - case symbol_kind::S_MIN_KEY: // "minKey" - value.move<UserMinKey>(that.value); - break; - - case symbol_kind::S_JSNULL: // "null" - value.move<UserNull>(that.value); - break; - - case symbol_kind::S_UNDEFINED: // "undefined" - value.move<UserUndefined>(that.value); - break; - - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" - value.move<double>(that.value); - break; - - case symbol_kind::S_INT_OTHER: // "arbitrary integer" - value.move<int>(that.value); - break; - - case symbol_kind::S_LONG_OTHER: // "arbitrary long" - value.move<long long>(that.value); - break; - - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec - value.move<std::pair<CNode::Fieldname, CNode>>(that.value); - break; - - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" - value.move<std::string>(that.value); - break; - - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo - value.move<std::vector<CNode>>(that.value); - break; - - default: - break; - } - - location = that.location; - // that is emptied. - that.state = empty_state; - return *this; -} -#endif - -template <typename Base> -void PipelineParserGen::yy_destroy_(const char* yymsg, basic_symbol<Base>& yysym) const { - if (yymsg) - YY_SYMBOL_PRINT(yymsg, yysym); -} - -#if YYDEBUG -template <typename Base> -void PipelineParserGen::yy_print_(std::ostream& yyo, const basic_symbol<Base>& yysym) const { - std::ostream& yyoutput = yyo; - YYUSE(yyoutput); - if (yysym.empty()) - yyo << "empty symbol"; - else { - symbol_kind_type yykind = yysym.kind(); - yyo << (yykind < YYNTOKENS ? "token" : "nterm") << ' ' << yysym.name() << " (" - << yysym.location << ": "; - YYUSE(yykind); - yyo << ')'; - } -} -#endif - -void PipelineParserGen::yypush_(const char* m, YY_MOVE_REF(stack_symbol_type) sym) { - if (m) - YY_SYMBOL_PRINT(m, sym); - yystack_.push(YY_MOVE(sym)); -} - -void PipelineParserGen::yypush_(const char* m, state_type s, YY_MOVE_REF(symbol_type) sym) { -#if 201103L <= YY_CPLUSPLUS - yypush_(m, stack_symbol_type(s, std::move(sym))); -#else - stack_symbol_type ss(s, sym); - yypush_(m, ss); -#endif -} - -void PipelineParserGen::yypop_(int n) { - yystack_.pop(n); -} - -#if YYDEBUG -std::ostream& PipelineParserGen::debug_stream() const { - return *yycdebug_; -} - -void PipelineParserGen::set_debug_stream(std::ostream& o) { - yycdebug_ = &o; -} - - -PipelineParserGen::debug_level_type PipelineParserGen::debug_level() const { - return yydebug_; -} - -void PipelineParserGen::set_debug_level(debug_level_type l) { - yydebug_ = l; -} -#endif // YYDEBUG - -PipelineParserGen::state_type PipelineParserGen::yy_lr_goto_state_(state_type yystate, int yysym) { - int yyr = yypgoto_[yysym - YYNTOKENS] + yystate; - if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) - return yytable_[yyr]; - else - return yydefgoto_[yysym - YYNTOKENS]; -} - -bool PipelineParserGen::yy_pact_value_is_default_(int yyvalue) { - return yyvalue == yypact_ninf_; -} - -bool PipelineParserGen::yy_table_value_is_error_(int yyvalue) { - return yyvalue == yytable_ninf_; -} - -int PipelineParserGen::operator()() { - return parse(); -} - -int PipelineParserGen::parse() { - int yyn; - /// Length of the RHS of the rule being reduced. - int yylen = 0; - - // Error handling. - int yynerrs_ = 0; - int yyerrstatus_ = 0; - - /// The lookahead symbol. - symbol_type yyla; - - /// The locations where the error started and ended. - stack_symbol_type yyerror_range[3]; - - /// The return value of parse (). - int yyresult; - -#if YY_EXCEPTIONS - try -#endif // YY_EXCEPTIONS - { - YYCDEBUG << "Starting parse\n"; - - - /* Initialize the stack. The initial state will be set in - yynewstate, since the latter expects the semantical and the - location values to have been already stored, initialize these - stacks with a primary value. */ - yystack_.clear(); - yypush_(YY_NULLPTR, 0, YY_MOVE(yyla)); - - /*-----------------------------------------------. - | yynewstate -- push a new symbol on the stack. | - `-----------------------------------------------*/ - yynewstate: - YYCDEBUG << "Entering state " << int(yystack_[0].state) << '\n'; - YY_STACK_PRINT(); - - // Accept? - if (yystack_[0].state == yyfinal_) - YYACCEPT; - - goto yybackup; - - - /*-----------. - | yybackup. | - `-----------*/ - yybackup: - // Try to take a decision without lookahead. - yyn = yypact_[+yystack_[0].state]; - if (yy_pact_value_is_default_(yyn)) - goto yydefault; - - // Read a lookahead token. - if (yyla.empty()) { - YYCDEBUG << "Reading a token\n"; -#if YY_EXCEPTIONS - try -#endif // YY_EXCEPTIONS - { - symbol_type yylookahead(yylex(lexer)); - yyla.move(yylookahead); - } -#if YY_EXCEPTIONS - catch (const syntax_error& yyexc) { - YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; - error(yyexc); - goto yyerrlab1; - } -#endif // YY_EXCEPTIONS - } - YY_SYMBOL_PRINT("Next token is", yyla); - - if (yyla.kind() == symbol_kind::S_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. */ - yyla.kind_ = symbol_kind::S_YYUNDEF; - goto yyerrlab1; - } - - /* If the proper action on seeing token YYLA.TYPE is to reduce or - to detect an error, take that action. */ - yyn += yyla.kind(); - if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind()) { - goto yydefault; - } - - // Reduce or error. - yyn = yytable_[yyn]; - if (yyn <= 0) { - if (yy_table_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. - yypush_("Shifting", state_type(yyn), YY_MOVE(yyla)); - goto yynewstate; - - - /*-----------------------------------------------------------. - | yydefault -- do the default action for the current state. | - `-----------------------------------------------------------*/ - yydefault: - yyn = yydefact_[+yystack_[0].state]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - - /*-----------------------------. - | yyreduce -- do a reduction. | - `-----------------------------*/ - yyreduce: - yylen = yyr2_[yyn]; - { - stack_symbol_type yylhs; - yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]); - /* Variants are always initialized to an empty instance of the - correct type. The default '$$ = $1' action is NOT applied - when using variants. */ - switch (yyr1_[yyn]) { - case symbol_kind::S_BINARY: // "BinData" - yylhs.value.emplace<BSONBinData>(); - break; - - case symbol_kind::S_JAVASCRIPT: // "Code" - yylhs.value.emplace<BSONCode>(); - break; - - case symbol_kind::S_JAVASCRIPT_W_SCOPE: // "CodeWScope" - yylhs.value.emplace<BSONCodeWScope>(); - break; - - case symbol_kind::S_DB_POINTER: // "dbPointer" - yylhs.value.emplace<BSONDBRef>(); - break; - - case symbol_kind::S_REGEX: // "regex" - yylhs.value.emplace<BSONRegEx>(); - break; - - case symbol_kind::S_SYMBOL: // "Symbol" - yylhs.value.emplace<BSONSymbol>(); - break; - - case symbol_kind::S_dbPointer: // dbPointer - case symbol_kind::S_javascript: // javascript - case symbol_kind::S_symbol: // symbol - case symbol_kind::S_javascriptWScope: // javascriptWScope - case symbol_kind::S_int: // int - case symbol_kind::S_timestamp: // timestamp - case symbol_kind::S_long: // long - case symbol_kind::S_double: // double - case symbol_kind::S_decimal: // decimal - case symbol_kind::S_minKey: // minKey - case symbol_kind::S_maxKey: // maxKey - case symbol_kind::S_value: // value - case symbol_kind::S_string: // string - case symbol_kind::S_fieldPath: // fieldPath - case symbol_kind::S_binary: // binary - case symbol_kind::S_undefined: // undefined - case symbol_kind::S_objectId: // objectId - case symbol_kind::S_bool: // bool - case symbol_kind::S_date: // date - case symbol_kind::S_null: // null - case symbol_kind::S_regex: // regex - case symbol_kind::S_simpleValue: // simpleValue - case symbol_kind::S_compoundValue: // compoundValue - case symbol_kind::S_valueArray: // valueArray - case symbol_kind::S_valueObject: // valueObject - case symbol_kind::S_valueFields: // valueFields - case symbol_kind::S_variable: // variable - case symbol_kind::S_pipeline: // pipeline - case symbol_kind::S_stageList: // stageList - case symbol_kind::S_stage: // stage - case symbol_kind::S_inhibitOptimization: // inhibitOptimization - case symbol_kind::S_unionWith: // unionWith - case symbol_kind::S_skip: // skip - case symbol_kind::S_limit: // limit - case symbol_kind::S_project: // project - case symbol_kind::S_sample: // sample - case symbol_kind::S_projectFields: // projectFields - case symbol_kind::S_projection: // projection - case symbol_kind::S_num: // num - case symbol_kind::S_expression: // expression - case symbol_kind::S_compoundExpression: // compoundExpression - case symbol_kind::S_exprFixedTwoArg: // exprFixedTwoArg - case symbol_kind::S_expressionArray: // expressionArray - case symbol_kind::S_expressionObject: // expressionObject - case symbol_kind::S_expressionFields: // expressionFields - case symbol_kind::S_maths: // maths - case symbol_kind::S_add: // add - case symbol_kind::S_atan2: // atan2 - case symbol_kind::S_boolExps: // boolExps - case symbol_kind::S_and: // and - case symbol_kind::S_or: // or - case symbol_kind::S_not: // not - case symbol_kind::S_literalEscapes: // literalEscapes - case symbol_kind::S_const: // const - case symbol_kind::S_literal: // literal - case symbol_kind::S_stringExps: // stringExps - case symbol_kind::S_concat: // concat - case symbol_kind::S_dateFromString: // dateFromString - case symbol_kind::S_dateToString: // dateToString - case symbol_kind::S_indexOfBytes: // indexOfBytes - case symbol_kind::S_indexOfCP: // indexOfCP - case symbol_kind::S_ltrim: // ltrim - case symbol_kind::S_regexFind: // regexFind - case symbol_kind::S_regexFindAll: // regexFindAll - case symbol_kind::S_regexMatch: // regexMatch - case symbol_kind::S_regexArgs: // regexArgs - case symbol_kind::S_replaceOne: // replaceOne - case symbol_kind::S_replaceAll: // replaceAll - case symbol_kind::S_rtrim: // rtrim - case symbol_kind::S_split: // split - case symbol_kind::S_strLenBytes: // strLenBytes - case symbol_kind::S_strLenCP: // strLenCP - case symbol_kind::S_strcasecmp: // strcasecmp - case symbol_kind::S_substr: // substr - case symbol_kind::S_substrBytes: // substrBytes - case symbol_kind::S_substrCP: // substrCP - case symbol_kind::S_toLower: // toLower - case symbol_kind::S_toUpper: // toUpper - case symbol_kind::S_trim: // trim - case symbol_kind::S_compExprs: // compExprs - case symbol_kind::S_cmp: // cmp - case symbol_kind::S_eq: // eq - case symbol_kind::S_gt: // gt - case symbol_kind::S_gte: // gte - case symbol_kind::S_lt: // lt - case symbol_kind::S_lte: // lte - case symbol_kind::S_ne: // ne - case symbol_kind::S_typeExpression: // typeExpression - case symbol_kind::S_convert: // convert - case symbol_kind::S_toBool: // toBool - case symbol_kind::S_toDate: // toDate - case symbol_kind::S_toDecimal: // toDecimal - case symbol_kind::S_toDouble: // toDouble - case symbol_kind::S_toInt: // toInt - case symbol_kind::S_toLong: // toLong - case symbol_kind::S_toObjectId: // toObjectId - case symbol_kind::S_toString: // toString - case symbol_kind::S_type: // type - case symbol_kind::S_abs: // abs - case symbol_kind::S_ceil: // ceil - case symbol_kind::S_divide: // divide - case symbol_kind::S_exponent: // exponent - case symbol_kind::S_floor: // floor - case symbol_kind::S_ln: // ln - case symbol_kind::S_log: // log - case symbol_kind::S_logten: // logten - case symbol_kind::S_mod: // mod - case symbol_kind::S_multiply: // multiply - case symbol_kind::S_pow: // pow - case symbol_kind::S_round: // round - case symbol_kind::S_sqrt: // sqrt - case symbol_kind::S_subtract: // subtract - case symbol_kind::S_trunc: // trunc - case symbol_kind::S_matchExpression: // matchExpression - case symbol_kind::S_filterFields: // filterFields - case symbol_kind::S_filterVal: // filterVal - case symbol_kind::S_sortSpecs: // sortSpecs - case symbol_kind::S_specList: // specList - case symbol_kind::S_metaSort: // metaSort - case symbol_kind::S_oneOrNegOne: // oneOrNegOne - case symbol_kind::S_metaSortKeyword: // metaSortKeyword - yylhs.value.emplace<CNode>(); - break; - - case symbol_kind::S_projectionFieldname: // projectionFieldname - case symbol_kind::S_expressionFieldname: // expressionFieldname - case symbol_kind::S_stageAsUserFieldname: // stageAsUserFieldname - case symbol_kind::S_filterFieldname: // filterFieldname - case symbol_kind::S_argAsUserFieldname: // argAsUserFieldname - case symbol_kind::S_aggExprAsUserFieldname: // aggExprAsUserFieldname - case symbol_kind::S_invariableUserFieldname: // invariableUserFieldname - case symbol_kind::S_idAsUserFieldname: // idAsUserFieldname - case symbol_kind::S_valueFieldname: // valueFieldname - yylhs.value.emplace<CNode::Fieldname>(); - break; - - case symbol_kind::S_DATE_LITERAL: // "Date" - yylhs.value.emplace<Date_t>(); - break; - - case symbol_kind::S_DECIMAL_OTHER: // "arbitrary decimal" - yylhs.value.emplace<Decimal128>(); - break; - - case symbol_kind::S_OBJECT_ID: // "ObjectID" - yylhs.value.emplace<OID>(); - break; - - case symbol_kind::S_TIMESTAMP: // "Timestamp" - yylhs.value.emplace<Timestamp>(); - break; - - case symbol_kind::S_MAX_KEY: // "maxKey" - yylhs.value.emplace<UserMaxKey>(); - break; - - case symbol_kind::S_MIN_KEY: // "minKey" - yylhs.value.emplace<UserMinKey>(); - break; - - case symbol_kind::S_JSNULL: // "null" - yylhs.value.emplace<UserNull>(); - break; - - case symbol_kind::S_UNDEFINED: // "undefined" - yylhs.value.emplace<UserUndefined>(); - break; - - case symbol_kind::S_DOUBLE_OTHER: // "arbitrary double" - yylhs.value.emplace<double>(); - break; - - case symbol_kind::S_INT_OTHER: // "arbitrary integer" - yylhs.value.emplace<int>(); - break; - - case symbol_kind::S_LONG_OTHER: // "arbitrary long" - yylhs.value.emplace<long long>(); - break; - - case symbol_kind::S_projectField: // projectField - case symbol_kind::S_expressionField: // expressionField - case symbol_kind::S_valueField: // valueField - case symbol_kind::S_filterField: // filterField - case symbol_kind::S_onErrorArg: // onErrorArg - case symbol_kind::S_onNullArg: // onNullArg - case symbol_kind::S_formatArg: // formatArg - case symbol_kind::S_timezoneArg: // timezoneArg - case symbol_kind::S_charsArg: // charsArg - case symbol_kind::S_optionsArg: // optionsArg - case symbol_kind::S_sortSpec: // sortSpec - yylhs.value.emplace<std::pair<CNode::Fieldname, CNode>>(); - break; - - case symbol_kind::S_FIELDNAME: // "fieldname" - case symbol_kind::S_STRING: // "string" - case symbol_kind::S_DOLLAR_STRING: // "$-prefixed string" - case symbol_kind::S_DOLLAR_DOLLAR_STRING: // "$$-prefixed string" - case symbol_kind::S_DOLLAR_PREF_FIELDNAME: // "$-prefixed fieldname" - yylhs.value.emplace<std::string>(); - break; - - case symbol_kind::S_expressions: // expressions - case symbol_kind::S_values: // values - case symbol_kind::S_exprZeroToTwo: // exprZeroToTwo - yylhs.value.emplace<std::vector<CNode>>(); - break; - - default: - break; - } - - - // Default location. - { - stack_type::slice range(yystack_, yylen); - YYLLOC_DEFAULT(yylhs.location, range, yylen); - yyerror_range[1].location = yylhs.location; - } - - // Perform the reduction. - YY_REDUCE_PRINT(yyn); -#if YY_EXCEPTIONS - try -#endif // YY_EXCEPTIONS - { - switch (yyn) { - case 2: // start: START_PIPELINE pipeline -#line 297 "pipeline_grammar.yy" - { - invariant(cst); - *cst = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1719 "pipeline_parser_gen.cpp" - break; - - case 3: // start: START_MATCH matchExpression -#line 301 "pipeline_grammar.yy" - { - invariant(cst); - *cst = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1728 "pipeline_parser_gen.cpp" - break; - - case 4: // start: START_SORT sortSpecs -#line 305 "pipeline_grammar.yy" - { - *cst = CNode{YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 1736 "pipeline_parser_gen.cpp" - break; - - case 5: // pipeline: "array" stageList "end of array" -#line 312 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - } -#line 1744 "pipeline_parser_gen.cpp" - break; - - case 6: // stageList: %empty -#line 318 "pipeline_grammar.yy" - { - } -#line 1750 "pipeline_parser_gen.cpp" - break; - - case 7: // stageList: "object" stage "end of object" stageList -#line 319 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>())}}; - } -#line 1758 "pipeline_parser_gen.cpp" - break; - - case 8: // $@1: %empty -#line 327 "pipeline_grammar.yy" - { - lexer.sortObjTokens(); - } -#line 1764 "pipeline_parser_gen.cpp" - break; - - case 10: // stage: inhibitOptimization -#line 330 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1770 "pipeline_parser_gen.cpp" - break; - - case 11: // stage: unionWith -#line 330 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1776 "pipeline_parser_gen.cpp" - break; - - case 12: // stage: skip -#line 330 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1782 "pipeline_parser_gen.cpp" - break; - - case 13: // stage: limit -#line 330 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1788 "pipeline_parser_gen.cpp" - break; - - case 14: // stage: project -#line 330 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1794 "pipeline_parser_gen.cpp" - break; - - case 15: // stage: sample -#line 330 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1800 "pipeline_parser_gen.cpp" - break; - - case 16: // sample: STAGE_SAMPLE "object" "size argument" num "end of object" -#line 333 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{std::pair{ - KeyFieldname::sample, - CNode{CNode::ObjectChildren{ - {KeyFieldname::sizeArg, YY_MOVE(yystack_[1].value.as<CNode>())}, - }}}}}; - } -#line 1812 "pipeline_parser_gen.cpp" - break; - - case 17: // inhibitOptimization: STAGE_INHIBIT_OPTIMIZATION "object" "end of - // object" -#line 343 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - std::pair{KeyFieldname::inhibitOptimization, CNode::noopLeaf()}}}; - } -#line 1820 "pipeline_parser_gen.cpp" - break; - - case 18: // unionWith: STAGE_UNION_WITH START_ORDERED_OBJECT "coll argument" - // string "pipeline argument" double "end of object" -#line 349 "pipeline_grammar.yy" - { - auto pipeline = YY_MOVE(yystack_[1].value.as<CNode>()); - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{std::pair{ - KeyFieldname::unionWith, - CNode{CNode::ObjectChildren{ - {KeyFieldname::collArg, YY_MOVE(yystack_[3].value.as<CNode>())}, - {KeyFieldname::pipelineArg, std::move(pipeline)}}}}}}; - } -#line 1833 "pipeline_parser_gen.cpp" - break; - - case 19: // num: int -#line 359 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1839 "pipeline_parser_gen.cpp" - break; - - case 20: // num: long -#line 359 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1845 "pipeline_parser_gen.cpp" - break; - - case 21: // num: double -#line 359 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1851 "pipeline_parser_gen.cpp" - break; - - case 22: // num: decimal -#line 359 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1857 "pipeline_parser_gen.cpp" - break; - - case 23: // skip: STAGE_SKIP num -#line 363 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - std::pair{KeyFieldname::skip, YY_MOVE(yystack_[0].value.as<CNode>())}}}; - } -#line 1865 "pipeline_parser_gen.cpp" - break; - - case 24: // limit: STAGE_LIMIT num -#line 368 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{std::pair{ - KeyFieldname::limit, YY_MOVE(yystack_[0].value.as<CNode>())}}}; - } -#line 1873 "pipeline_parser_gen.cpp" - break; - - case 25: // project: STAGE_PROJECT "object" projectFields "end of object" -#line 373 "pipeline_grammar.yy" - { - auto&& fields = YY_MOVE(yystack_[1].value.as<CNode>()); - if (auto inclusion = - c_node_validation::validateProjectionAsInclusionOrExclusion(fields); - inclusion.isOK()) - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{std::pair{ - inclusion.getValue() == c_node_validation::IsInclusion::yes - ? KeyFieldname::projectInclusion - : KeyFieldname::projectExclusion, - std::move(fields)}}}; - else - // Pass the location of the $project token to the error reporting - // function. - error(yystack_[3].location, inclusion.getStatus().reason()); - } -#line 1891 "pipeline_parser_gen.cpp" - break; - - case 26: // projectFields: %empty -#line 389 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode::noopLeaf(); - } -#line 1899 "pipeline_parser_gen.cpp" - break; - - case 27: // projectFields: projectFields projectField -#line 392 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - yylhs.value.as<CNode>().objectChildren().emplace_back( - YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); - } -#line 1908 "pipeline_parser_gen.cpp" - break; - - case 28: // projectField: ID projection -#line 399 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { - KeyFieldname::id, YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 1916 "pipeline_parser_gen.cpp" - break; - - case 29: // projectField: projectionFieldname projection -#line 402 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { - YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), - YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 1924 "pipeline_parser_gen.cpp" - break; - - case 30: // projection: string -#line 408 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1930 "pipeline_parser_gen.cpp" - break; - - case 31: // projection: binary -#line 409 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1936 "pipeline_parser_gen.cpp" - break; - - case 32: // projection: undefined -#line 410 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1942 "pipeline_parser_gen.cpp" - break; - - case 33: // projection: objectId -#line 411 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1948 "pipeline_parser_gen.cpp" - break; - - case 34: // projection: date -#line 412 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1954 "pipeline_parser_gen.cpp" - break; - - case 35: // projection: null -#line 413 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1960 "pipeline_parser_gen.cpp" - break; - - case 36: // projection: regex -#line 414 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1966 "pipeline_parser_gen.cpp" - break; - - case 37: // projection: dbPointer -#line 415 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1972 "pipeline_parser_gen.cpp" - break; - - case 38: // projection: javascript -#line 416 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1978 "pipeline_parser_gen.cpp" - break; - - case 39: // projection: symbol -#line 417 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1984 "pipeline_parser_gen.cpp" - break; - - case 40: // projection: javascriptWScope -#line 418 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 1990 "pipeline_parser_gen.cpp" - break; - - case 41: // projection: "1 (int)" -#line 419 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{NonZeroKey{1}}; - } -#line 1998 "pipeline_parser_gen.cpp" - break; - - case 42: // projection: "-1 (int)" -#line 422 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{NonZeroKey{-1}}; - } -#line 2006 "pipeline_parser_gen.cpp" - break; - - case 43: // projection: "arbitrary integer" -#line 425 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{NonZeroKey{YY_MOVE(yystack_[0].value.as<int>())}}; - } -#line 2014 "pipeline_parser_gen.cpp" - break; - - case 44: // projection: "zero (int)" -#line 428 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::intZeroKey}; - } -#line 2022 "pipeline_parser_gen.cpp" - break; - - case 45: // projection: "1 (long)" -#line 431 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{NonZeroKey{1ll}}; - } -#line 2030 "pipeline_parser_gen.cpp" - break; - - case 46: // projection: "-1 (long)" -#line 434 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{NonZeroKey{-1ll}}; - } -#line 2038 "pipeline_parser_gen.cpp" - break; - - case 47: // projection: "arbitrary long" -#line 437 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{NonZeroKey{YY_MOVE(yystack_[0].value.as<long long>())}}; - } -#line 2046 "pipeline_parser_gen.cpp" - break; - - case 48: // projection: "zero (long)" -#line 440 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::longZeroKey}; - } -#line 2054 "pipeline_parser_gen.cpp" - break; - - case 49: // projection: "1 (double)" -#line 443 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{NonZeroKey{1.0}}; - } -#line 2062 "pipeline_parser_gen.cpp" - break; - - case 50: // projection: "-1 (double)" -#line 446 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{NonZeroKey{-1.0}}; - } -#line 2070 "pipeline_parser_gen.cpp" - break; - - case 51: // projection: "arbitrary double" -#line 449 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{NonZeroKey{YY_MOVE(yystack_[0].value.as<double>())}}; - } -#line 2078 "pipeline_parser_gen.cpp" - break; - - case 52: // projection: "zero (double)" -#line 452 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::doubleZeroKey}; - } -#line 2086 "pipeline_parser_gen.cpp" - break; - - case 53: // projection: "1 (decimal)" -#line 455 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{NonZeroKey{1.0}}; - } -#line 2094 "pipeline_parser_gen.cpp" - break; - - case 54: // projection: "-1 (decimal)" -#line 458 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{NonZeroKey{-1.0}}; - } -#line 2102 "pipeline_parser_gen.cpp" - break; - - case 55: // projection: "arbitrary decimal" -#line 461 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{NonZeroKey{YY_MOVE(yystack_[0].value.as<Decimal128>())}}; - } -#line 2110 "pipeline_parser_gen.cpp" - break; - - case 56: // projection: "zero (decimal)" -#line 464 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::decimalZeroKey}; - } -#line 2118 "pipeline_parser_gen.cpp" - break; - - case 57: // projection: "true" -#line 467 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::trueKey}; - } -#line 2126 "pipeline_parser_gen.cpp" - break; - - case 58: // projection: "false" -#line 470 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::falseKey}; - } -#line 2134 "pipeline_parser_gen.cpp" - break; - - case 59: // projection: timestamp -#line 473 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 2140 "pipeline_parser_gen.cpp" - break; - - case 60: // projection: minKey -#line 474 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 2146 "pipeline_parser_gen.cpp" - break; - - case 61: // projection: maxKey -#line 475 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 2152 "pipeline_parser_gen.cpp" - break; - - case 62: // projection: compoundExpression -#line 476 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - c_node_disambiguation::disambiguateCompoundProjection( - YY_MOVE(yystack_[0].value.as<CNode>())); - if (stdx::holds_alternative<CompoundInconsistentKey>( - yylhs.value.as<CNode>().payload)) - // TODO SERVER-50498: error() instead of uasserting - uasserted(ErrorCodes::FailedToParse, - "object project field cannot contain both inclusion and " - "exclusion indicators"); - } -#line 2163 "pipeline_parser_gen.cpp" - break; - - case 63: // projectionFieldname: invariableUserFieldname -#line 485 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 2169 "pipeline_parser_gen.cpp" - break; - - case 64: // projectionFieldname: stageAsUserFieldname -#line 485 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 2175 "pipeline_parser_gen.cpp" - break; - - case 65: // projectionFieldname: argAsUserFieldname -#line 485 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 2181 "pipeline_parser_gen.cpp" - break; - - case 66: // projectionFieldname: aggExprAsUserFieldname -#line 485 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 2187 "pipeline_parser_gen.cpp" - break; - - case 67: // matchExpression: "object" filterFields "end of object" -#line 489 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - } -#line 2195 "pipeline_parser_gen.cpp" - break; - - case 68: // filterFields: %empty -#line 495 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode::noopLeaf(); - } -#line 2203 "pipeline_parser_gen.cpp" - break; - - case 69: // filterFields: filterFields filterField -#line 498 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - yylhs.value.as<CNode>().objectChildren().emplace_back( - YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); - } -#line 2212 "pipeline_parser_gen.cpp" - break; - - case 70: // filterField: filterFieldname filterVal -#line 504 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { - YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), - YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 2220 "pipeline_parser_gen.cpp" - break; - - case 71: // filterVal: value -#line 510 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 2226 "pipeline_parser_gen.cpp" - break; - - case 72: // filterFieldname: idAsUserFieldname -#line 515 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 2232 "pipeline_parser_gen.cpp" - break; - - case 73: // filterFieldname: invariableUserFieldname -#line 515 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 2238 "pipeline_parser_gen.cpp" - break; - - case 74: // filterFieldname: argAsUserFieldname -#line 515 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 2244 "pipeline_parser_gen.cpp" - break; - - case 75: // invariableUserFieldname: "fieldname" -#line 519 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - UserFieldname{YY_MOVE(yystack_[0].value.as<std::string>())}; - } -#line 2252 "pipeline_parser_gen.cpp" - break; - - case 76: // stageAsUserFieldname: STAGE_INHIBIT_OPTIMIZATION -#line 527 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - UserFieldname{"$_internalInhibitOptimization"}; - } -#line 2260 "pipeline_parser_gen.cpp" - break; - - case 77: // stageAsUserFieldname: STAGE_UNION_WITH -#line 530 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$unionWith"}; - } -#line 2268 "pipeline_parser_gen.cpp" - break; - - case 78: // stageAsUserFieldname: STAGE_SKIP -#line 533 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$skip"}; - } -#line 2276 "pipeline_parser_gen.cpp" - break; - - case 79: // stageAsUserFieldname: STAGE_LIMIT -#line 536 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$limit"}; - } -#line 2284 "pipeline_parser_gen.cpp" - break; - - case 80: // stageAsUserFieldname: STAGE_PROJECT -#line 539 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$project"}; - } -#line 2292 "pipeline_parser_gen.cpp" - break; - - case 81: // stageAsUserFieldname: STAGE_SAMPLE -#line 542 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$sample"}; - } -#line 2300 "pipeline_parser_gen.cpp" - break; - - case 82: // argAsUserFieldname: "coll argument" -#line 551 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"coll"}; - } -#line 2308 "pipeline_parser_gen.cpp" - break; - - case 83: // argAsUserFieldname: "pipeline argument" -#line 554 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"pipeline"}; - } -#line 2316 "pipeline_parser_gen.cpp" - break; - - case 84: // argAsUserFieldname: "size argument" -#line 557 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"size"}; - } -#line 2324 "pipeline_parser_gen.cpp" - break; - - case 85: // argAsUserFieldname: "input argument" -#line 560 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"input"}; - } -#line 2332 "pipeline_parser_gen.cpp" - break; - - case 86: // argAsUserFieldname: "to argument" -#line 563 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"to"}; - } -#line 2340 "pipeline_parser_gen.cpp" - break; - - case 87: // argAsUserFieldname: "onError argument" -#line 566 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"onError"}; - } -#line 2348 "pipeline_parser_gen.cpp" - break; - - case 88: // argAsUserFieldname: "onNull argument" -#line 569 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"onNull"}; - } -#line 2356 "pipeline_parser_gen.cpp" - break; - - case 89: // argAsUserFieldname: "dateString argument" -#line 572 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"dateString"}; - } -#line 2364 "pipeline_parser_gen.cpp" - break; - - case 90: // argAsUserFieldname: "format argument" -#line 575 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"format"}; - } -#line 2372 "pipeline_parser_gen.cpp" - break; - - case 91: // argAsUserFieldname: "timezone argument" -#line 578 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"timezone"}; - } -#line 2380 "pipeline_parser_gen.cpp" - break; - - case 92: // argAsUserFieldname: "date argument" -#line 581 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"date"}; - } -#line 2388 "pipeline_parser_gen.cpp" - break; - - case 93: // argAsUserFieldname: "chars argument" -#line 584 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"chars"}; - } -#line 2396 "pipeline_parser_gen.cpp" - break; - - case 94: // argAsUserFieldname: "regex argument" -#line 587 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"regex"}; - } -#line 2404 "pipeline_parser_gen.cpp" - break; - - case 95: // argAsUserFieldname: "options argument" -#line 590 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"options"}; - } -#line 2412 "pipeline_parser_gen.cpp" - break; - - case 96: // argAsUserFieldname: "find argument" -#line 593 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"find"}; - } -#line 2420 "pipeline_parser_gen.cpp" - break; - - case 97: // argAsUserFieldname: "replacement argument" -#line 596 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"replacement"}; - } -#line 2428 "pipeline_parser_gen.cpp" - break; - - case 98: // aggExprAsUserFieldname: ADD -#line 604 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$add"}; - } -#line 2436 "pipeline_parser_gen.cpp" - break; - - case 99: // aggExprAsUserFieldname: ATAN2 -#line 607 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$atan2"}; - } -#line 2444 "pipeline_parser_gen.cpp" - break; - - case 100: // aggExprAsUserFieldname: AND -#line 610 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$and"}; - } -#line 2452 "pipeline_parser_gen.cpp" - break; - - case 101: // aggExprAsUserFieldname: CONST_EXPR -#line 613 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$const"}; - } -#line 2460 "pipeline_parser_gen.cpp" - break; - - case 102: // aggExprAsUserFieldname: LITERAL -#line 616 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$literal"}; - } -#line 2468 "pipeline_parser_gen.cpp" - break; - - case 103: // aggExprAsUserFieldname: OR -#line 619 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$or"}; - } -#line 2476 "pipeline_parser_gen.cpp" - break; - - case 104: // aggExprAsUserFieldname: NOT -#line 622 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$not"}; - } -#line 2484 "pipeline_parser_gen.cpp" - break; - - case 105: // aggExprAsUserFieldname: CMP -#line 625 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$cmp"}; - } -#line 2492 "pipeline_parser_gen.cpp" - break; - - case 106: // aggExprAsUserFieldname: EQ -#line 628 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$eq"}; - } -#line 2500 "pipeline_parser_gen.cpp" - break; - - case 107: // aggExprAsUserFieldname: GT -#line 631 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$gt"}; - } -#line 2508 "pipeline_parser_gen.cpp" - break; - - case 108: // aggExprAsUserFieldname: GTE -#line 634 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$gte"}; - } -#line 2516 "pipeline_parser_gen.cpp" - break; - - case 109: // aggExprAsUserFieldname: LT -#line 637 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$lt"}; - } -#line 2524 "pipeline_parser_gen.cpp" - break; - - case 110: // aggExprAsUserFieldname: LTE -#line 640 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$lte"}; - } -#line 2532 "pipeline_parser_gen.cpp" - break; - - case 111: // aggExprAsUserFieldname: NE -#line 643 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$ne"}; - } -#line 2540 "pipeline_parser_gen.cpp" - break; - - case 112: // aggExprAsUserFieldname: CONVERT -#line 646 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$convert"}; - } -#line 2548 "pipeline_parser_gen.cpp" - break; - - case 113: // aggExprAsUserFieldname: TO_BOOL -#line 649 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toBool"}; - } -#line 2556 "pipeline_parser_gen.cpp" - break; - - case 114: // aggExprAsUserFieldname: TO_DATE -#line 652 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toDate"}; - } -#line 2564 "pipeline_parser_gen.cpp" - break; - - case 115: // aggExprAsUserFieldname: TO_DECIMAL -#line 655 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toDecimal"}; - } -#line 2572 "pipeline_parser_gen.cpp" - break; - - case 116: // aggExprAsUserFieldname: TO_DOUBLE -#line 658 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toDouble"}; - } -#line 2580 "pipeline_parser_gen.cpp" - break; - - case 117: // aggExprAsUserFieldname: TO_INT -#line 661 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toInt"}; - } -#line 2588 "pipeline_parser_gen.cpp" - break; - - case 118: // aggExprAsUserFieldname: TO_LONG -#line 664 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toLong"}; - } -#line 2596 "pipeline_parser_gen.cpp" - break; - - case 119: // aggExprAsUserFieldname: TO_OBJECT_ID -#line 667 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toObjectId"}; - } -#line 2604 "pipeline_parser_gen.cpp" - break; - - case 120: // aggExprAsUserFieldname: TO_STRING -#line 670 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toString"}; - } -#line 2612 "pipeline_parser_gen.cpp" - break; - - case 121: // aggExprAsUserFieldname: TYPE -#line 673 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$type"}; - } -#line 2620 "pipeline_parser_gen.cpp" - break; - - case 122: // aggExprAsUserFieldname: ABS -#line 676 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$abs"}; - } -#line 2628 "pipeline_parser_gen.cpp" - break; - - case 123: // aggExprAsUserFieldname: CEIL -#line 679 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$ceil"}; - } -#line 2636 "pipeline_parser_gen.cpp" - break; - - case 124: // aggExprAsUserFieldname: DIVIDE -#line 682 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$divide"}; - } -#line 2644 "pipeline_parser_gen.cpp" - break; - - case 125: // aggExprAsUserFieldname: EXPONENT -#line 685 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$exp"}; - } -#line 2652 "pipeline_parser_gen.cpp" - break; - - case 126: // aggExprAsUserFieldname: FLOOR -#line 688 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$floor"}; - } -#line 2660 "pipeline_parser_gen.cpp" - break; - - case 127: // aggExprAsUserFieldname: LN -#line 691 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$ln"}; - } -#line 2668 "pipeline_parser_gen.cpp" - break; - - case 128: // aggExprAsUserFieldname: LOG -#line 694 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$log"}; - } -#line 2676 "pipeline_parser_gen.cpp" - break; - - case 129: // aggExprAsUserFieldname: LOGTEN -#line 697 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$log10"}; - } -#line 2684 "pipeline_parser_gen.cpp" - break; - - case 130: // aggExprAsUserFieldname: MOD -#line 700 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$mod"}; - } -#line 2692 "pipeline_parser_gen.cpp" - break; - - case 131: // aggExprAsUserFieldname: MULTIPLY -#line 703 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$multiply"}; - } -#line 2700 "pipeline_parser_gen.cpp" - break; - - case 132: // aggExprAsUserFieldname: POW -#line 706 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$pow"}; - } -#line 2708 "pipeline_parser_gen.cpp" - break; - - case 133: // aggExprAsUserFieldname: ROUND -#line 709 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$round"}; - } -#line 2716 "pipeline_parser_gen.cpp" - break; - - case 134: // aggExprAsUserFieldname: SQRT -#line 712 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$sqrt"}; - } -#line 2724 "pipeline_parser_gen.cpp" - break; - - case 135: // aggExprAsUserFieldname: SUBTRACT -#line 715 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$subtract"}; - } -#line 2732 "pipeline_parser_gen.cpp" - break; - - case 136: // aggExprAsUserFieldname: TRUNC -#line 718 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$trunc"}; - } -#line 2740 "pipeline_parser_gen.cpp" - break; - - case 137: // aggExprAsUserFieldname: CONCAT -#line 721 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$concat"}; - } -#line 2748 "pipeline_parser_gen.cpp" - break; - - case 138: // aggExprAsUserFieldname: DATE_FROM_STRING -#line 724 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$dateFromString"}; - } -#line 2756 "pipeline_parser_gen.cpp" - break; - - case 139: // aggExprAsUserFieldname: DATE_TO_STRING -#line 727 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$dateToString"}; - } -#line 2764 "pipeline_parser_gen.cpp" - break; - - case 140: // aggExprAsUserFieldname: INDEX_OF_BYTES -#line 730 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$indexOfBytes"}; - } -#line 2772 "pipeline_parser_gen.cpp" - break; - - case 141: // aggExprAsUserFieldname: INDEX_OF_CP -#line 733 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$indexOfCP"}; - } -#line 2780 "pipeline_parser_gen.cpp" - break; - - case 142: // aggExprAsUserFieldname: LTRIM -#line 736 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$ltrim"}; - } -#line 2788 "pipeline_parser_gen.cpp" - break; - - case 143: // aggExprAsUserFieldname: META -#line 739 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$meta"}; - } -#line 2796 "pipeline_parser_gen.cpp" - break; - - case 144: // aggExprAsUserFieldname: REGEX_FIND -#line 742 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$regexFind"}; - } -#line 2804 "pipeline_parser_gen.cpp" - break; - - case 145: // aggExprAsUserFieldname: REGEX_FIND_ALL -#line 745 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$regexFindAll"}; - } -#line 2812 "pipeline_parser_gen.cpp" - break; - - case 146: // aggExprAsUserFieldname: REGEX_MATCH -#line 748 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$regexMatch"}; - } -#line 2820 "pipeline_parser_gen.cpp" - break; - - case 147: // aggExprAsUserFieldname: REPLACE_ONE -#line 751 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$replaceOne"}; - } -#line 2828 "pipeline_parser_gen.cpp" - break; - - case 148: // aggExprAsUserFieldname: REPLACE_ALL -#line 754 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$replaceAll"}; - } -#line 2836 "pipeline_parser_gen.cpp" - break; - - case 149: // aggExprAsUserFieldname: RTRIM -#line 757 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$rtrim"}; - } -#line 2844 "pipeline_parser_gen.cpp" - break; - - case 150: // aggExprAsUserFieldname: SPLIT -#line 760 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$split"}; - } -#line 2852 "pipeline_parser_gen.cpp" - break; - - case 151: // aggExprAsUserFieldname: STR_LEN_BYTES -#line 763 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$strLenBytes"}; - } -#line 2860 "pipeline_parser_gen.cpp" - break; - - case 152: // aggExprAsUserFieldname: STR_LEN_CP -#line 766 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$strLenCP"}; - } -#line 2868 "pipeline_parser_gen.cpp" - break; - - case 153: // aggExprAsUserFieldname: STR_CASE_CMP -#line 769 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$strcasecmp"}; - } -#line 2876 "pipeline_parser_gen.cpp" - break; - - case 154: // aggExprAsUserFieldname: SUBSTR -#line 772 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$substr"}; - } -#line 2884 "pipeline_parser_gen.cpp" - break; - - case 155: // aggExprAsUserFieldname: SUBSTR_BYTES -#line 775 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$substrBytes"}; - } -#line 2892 "pipeline_parser_gen.cpp" - break; - - case 156: // aggExprAsUserFieldname: SUBSTR_CP -#line 778 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$substrCP"}; - } -#line 2900 "pipeline_parser_gen.cpp" - break; - - case 157: // aggExprAsUserFieldname: TO_LOWER -#line 781 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toLower"}; - } -#line 2908 "pipeline_parser_gen.cpp" - break; - - case 158: // aggExprAsUserFieldname: TRIM -#line 784 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$trim"}; - } -#line 2916 "pipeline_parser_gen.cpp" - break; - - case 159: // aggExprAsUserFieldname: TO_UPPER -#line 787 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"$toUpper"}; - } -#line 2924 "pipeline_parser_gen.cpp" - break; - - case 160: // string: "string" -#line 794 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserString{YY_MOVE(yystack_[0].value.as<std::string>())}}; - } -#line 2932 "pipeline_parser_gen.cpp" - break; - - case 161: // string: "randVal" -#line 799 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserString{"randVal"}}; - } -#line 2940 "pipeline_parser_gen.cpp" - break; - - case 162: // string: "textScore" -#line 802 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserString{"textScore"}}; - } -#line 2948 "pipeline_parser_gen.cpp" - break; - - case 163: // fieldPath: "$-prefixed string" -#line 808 "pipeline_grammar.yy" - { - std::string str = YY_MOVE(yystack_[0].value.as<std::string>()); - if (str.size() == 1) { - error(yystack_[0].location, "'$' by iteslf is not a valid FieldPath"); - } - yylhs.value.as<CNode>() = CNode{UserFieldPath{str.substr(1), false}}; - } -#line 2960 "pipeline_parser_gen.cpp" - break; - - case 164: // variable: "$$-prefixed string" -#line 816 "pipeline_grammar.yy" - { - std::string str = YY_MOVE(yystack_[0].value.as<std::string>()).substr(2); - auto status = c_node_validation::validateVariableName(str); - if (!status.isOK()) { - error(yystack_[0].location, status.reason()); - } - yylhs.value.as<CNode>() = CNode{UserFieldPath{str, true}}; - } -#line 2973 "pipeline_parser_gen.cpp" - break; - - case 165: // binary: "BinData" -#line 825 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserBinary{YY_MOVE(yystack_[0].value.as<BSONBinData>())}}; - } -#line 2981 "pipeline_parser_gen.cpp" - break; - - case 166: // undefined: "undefined" -#line 831 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserUndefined{}}; - } -#line 2989 "pipeline_parser_gen.cpp" - break; - - case 167: // objectId: "ObjectID" -#line 837 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserObjectId{}}; - } -#line 2997 "pipeline_parser_gen.cpp" - break; - - case 168: // date: "Date" -#line 843 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserDate{YY_MOVE(yystack_[0].value.as<Date_t>())}}; - } -#line 3005 "pipeline_parser_gen.cpp" - break; - - case 169: // null: "null" -#line 849 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserNull{}}; - } -#line 3013 "pipeline_parser_gen.cpp" - break; - - case 170: // regex: "regex" -#line 855 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserRegex{YY_MOVE(yystack_[0].value.as<BSONRegEx>())}}; - } -#line 3021 "pipeline_parser_gen.cpp" - break; - - case 171: // dbPointer: "dbPointer" -#line 861 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserDBPointer{YY_MOVE(yystack_[0].value.as<BSONDBRef>())}}; - } -#line 3029 "pipeline_parser_gen.cpp" - break; - - case 172: // javascript: "Code" -#line 867 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserJavascript{YY_MOVE(yystack_[0].value.as<BSONCode>())}}; - } -#line 3037 "pipeline_parser_gen.cpp" - break; - - case 173: // symbol: "Symbol" -#line 873 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserSymbol{YY_MOVE(yystack_[0].value.as<BSONSymbol>())}}; - } -#line 3045 "pipeline_parser_gen.cpp" - break; - - case 174: // javascriptWScope: "CodeWScope" -#line 879 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserJavascriptWithScope{ - YY_MOVE(yystack_[0].value.as<BSONCodeWScope>())}}; - } -#line 3053 "pipeline_parser_gen.cpp" - break; - - case 175: // timestamp: "Timestamp" -#line 885 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserTimestamp{YY_MOVE(yystack_[0].value.as<Timestamp>())}}; - } -#line 3061 "pipeline_parser_gen.cpp" - break; - - case 176: // minKey: "minKey" -#line 891 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserMinKey{YY_MOVE(yystack_[0].value.as<UserMinKey>())}}; - } -#line 3069 "pipeline_parser_gen.cpp" - break; - - case 177: // maxKey: "maxKey" -#line 897 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserMaxKey{YY_MOVE(yystack_[0].value.as<UserMaxKey>())}}; - } -#line 3077 "pipeline_parser_gen.cpp" - break; - - case 178: // int: "arbitrary integer" -#line 903 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserInt{YY_MOVE(yystack_[0].value.as<int>())}}; - } -#line 3085 "pipeline_parser_gen.cpp" - break; - - case 179: // int: "zero (int)" -#line 906 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserInt{0}}; - } -#line 3093 "pipeline_parser_gen.cpp" - break; - - case 180: // int: "1 (int)" -#line 909 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserInt{1}}; - } -#line 3101 "pipeline_parser_gen.cpp" - break; - - case 181: // int: "-1 (int)" -#line 912 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserInt{-1}}; - } -#line 3109 "pipeline_parser_gen.cpp" - break; - - case 182: // long: "arbitrary long" -#line 918 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserLong{YY_MOVE(yystack_[0].value.as<long long>())}}; - } -#line 3117 "pipeline_parser_gen.cpp" - break; - - case 183: // long: "zero (long)" -#line 921 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserLong{0ll}}; - } -#line 3125 "pipeline_parser_gen.cpp" - break; - - case 184: // long: "1 (long)" -#line 924 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserLong{1ll}}; - } -#line 3133 "pipeline_parser_gen.cpp" - break; - - case 185: // long: "-1 (long)" -#line 927 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserLong{-1ll}}; - } -#line 3141 "pipeline_parser_gen.cpp" - break; - - case 186: // double: "arbitrary double" -#line 933 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserDouble{YY_MOVE(yystack_[0].value.as<double>())}}; - } -#line 3149 "pipeline_parser_gen.cpp" - break; - - case 187: // double: "zero (double)" -#line 936 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserDouble{0.0}}; - } -#line 3157 "pipeline_parser_gen.cpp" - break; - - case 188: // double: "1 (double)" -#line 939 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserDouble{1.0}}; - } -#line 3165 "pipeline_parser_gen.cpp" - break; - - case 189: // double: "-1 (double)" -#line 942 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserDouble{-1.0}}; - } -#line 3173 "pipeline_parser_gen.cpp" - break; - - case 190: // decimal: "arbitrary decimal" -#line 948 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{UserDecimal{YY_MOVE(yystack_[0].value.as<Decimal128>())}}; - } -#line 3181 "pipeline_parser_gen.cpp" - break; - - case 191: // decimal: "zero (decimal)" -#line 951 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserDecimal{0.0}}; - } -#line 3189 "pipeline_parser_gen.cpp" - break; - - case 192: // decimal: "1 (decimal)" -#line 954 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserDecimal{1.0}}; - } -#line 3197 "pipeline_parser_gen.cpp" - break; - - case 193: // decimal: "-1 (decimal)" -#line 957 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserDecimal{-1.0}}; - } -#line 3205 "pipeline_parser_gen.cpp" - break; - - case 194: // bool: "true" -#line 963 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserBoolean{true}}; - } -#line 3213 "pipeline_parser_gen.cpp" - break; - - case 195: // bool: "false" -#line 966 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{UserBoolean{false}}; - } -#line 3221 "pipeline_parser_gen.cpp" - break; - - case 196: // simpleValue: string -#line 972 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3227 "pipeline_parser_gen.cpp" - break; - - case 197: // simpleValue: fieldPath -#line 973 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3233 "pipeline_parser_gen.cpp" - break; - - case 198: // simpleValue: variable -#line 974 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3239 "pipeline_parser_gen.cpp" - break; - - case 199: // simpleValue: binary -#line 975 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3245 "pipeline_parser_gen.cpp" - break; - - case 200: // simpleValue: undefined -#line 976 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3251 "pipeline_parser_gen.cpp" - break; - - case 201: // simpleValue: objectId -#line 977 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3257 "pipeline_parser_gen.cpp" - break; - - case 202: // simpleValue: date -#line 978 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3263 "pipeline_parser_gen.cpp" - break; - - case 203: // simpleValue: null -#line 979 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3269 "pipeline_parser_gen.cpp" - break; - - case 204: // simpleValue: regex -#line 980 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3275 "pipeline_parser_gen.cpp" - break; - - case 205: // simpleValue: dbPointer -#line 981 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3281 "pipeline_parser_gen.cpp" - break; - - case 206: // simpleValue: javascript -#line 982 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3287 "pipeline_parser_gen.cpp" - break; - - case 207: // simpleValue: symbol -#line 983 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3293 "pipeline_parser_gen.cpp" - break; - - case 208: // simpleValue: javascriptWScope -#line 984 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3299 "pipeline_parser_gen.cpp" - break; - - case 209: // simpleValue: int -#line 985 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3305 "pipeline_parser_gen.cpp" - break; - - case 210: // simpleValue: long -#line 986 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3311 "pipeline_parser_gen.cpp" - break; - - case 211: // simpleValue: double -#line 987 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3317 "pipeline_parser_gen.cpp" - break; - - case 212: // simpleValue: decimal -#line 988 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3323 "pipeline_parser_gen.cpp" - break; - - case 213: // simpleValue: bool -#line 989 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3329 "pipeline_parser_gen.cpp" - break; - - case 214: // simpleValue: timestamp -#line 990 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3335 "pipeline_parser_gen.cpp" - break; - - case 215: // simpleValue: minKey -#line 991 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3341 "pipeline_parser_gen.cpp" - break; - - case 216: // simpleValue: maxKey -#line 992 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3347 "pipeline_parser_gen.cpp" - break; - - case 217: // expressions: %empty -#line 999 "pipeline_grammar.yy" - { - } -#line 3353 "pipeline_parser_gen.cpp" - break; - - case 218: // expressions: expression expressions -#line 1000 "pipeline_grammar.yy" - { - yylhs.value.as<std::vector<CNode>>() = - YY_MOVE(yystack_[0].value.as<std::vector<CNode>>()); - yylhs.value.as<std::vector<CNode>>().emplace_back( - YY_MOVE(yystack_[1].value.as<CNode>())); - } -#line 3362 "pipeline_parser_gen.cpp" - break; - - case 219: // expression: simpleValue -#line 1007 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3368 "pipeline_parser_gen.cpp" - break; - - case 220: // expression: compoundExpression -#line 1007 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3374 "pipeline_parser_gen.cpp" - break; - - case 221: // exprFixedTwoArg: "array" expression expression "end of array" -#line 1011 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>()), - YY_MOVE(yystack_[1].value.as<CNode>())}}; - } -#line 3382 "pipeline_parser_gen.cpp" - break; - - case 222: // compoundExpression: expressionArray -#line 1016 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3388 "pipeline_parser_gen.cpp" - break; - - case 223: // compoundExpression: expressionObject -#line 1016 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3394 "pipeline_parser_gen.cpp" - break; - - case 224: // compoundExpression: maths -#line 1016 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3400 "pipeline_parser_gen.cpp" - break; - - case 225: // compoundExpression: boolExps -#line 1016 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3406 "pipeline_parser_gen.cpp" - break; - - case 226: // compoundExpression: literalEscapes -#line 1016 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3412 "pipeline_parser_gen.cpp" - break; - - case 227: // compoundExpression: compExprs -#line 1016 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3418 "pipeline_parser_gen.cpp" - break; - - case 228: // compoundExpression: typeExpression -#line 1017 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3424 "pipeline_parser_gen.cpp" - break; - - case 229: // compoundExpression: stringExps -#line 1017 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3430 "pipeline_parser_gen.cpp" - break; - - case 230: // expressionArray: "array" expressions "end of array" -#line 1023 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{YY_MOVE(yystack_[1].value.as<std::vector<CNode>>())}; - } -#line 3438 "pipeline_parser_gen.cpp" - break; - - case 231: // expressionObject: "object" expressionFields "end of object" -#line 1031 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - } -#line 3446 "pipeline_parser_gen.cpp" - break; - - case 232: // expressionFields: %empty -#line 1037 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode::noopLeaf(); - } -#line 3454 "pipeline_parser_gen.cpp" - break; - - case 233: // expressionFields: expressionFields expressionField -#line 1040 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - yylhs.value.as<CNode>().objectChildren().emplace_back( - YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); - } -#line 3463 "pipeline_parser_gen.cpp" - break; - - case 234: // expressionField: expressionFieldname expression -#line 1047 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { - YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), - YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 3471 "pipeline_parser_gen.cpp" - break; - - case 235: // expressionFieldname: invariableUserFieldname -#line 1054 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 3477 "pipeline_parser_gen.cpp" - break; - - case 236: // expressionFieldname: stageAsUserFieldname -#line 1054 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 3483 "pipeline_parser_gen.cpp" - break; - - case 237: // expressionFieldname: argAsUserFieldname -#line 1054 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 3489 "pipeline_parser_gen.cpp" - break; - - case 238: // expressionFieldname: idAsUserFieldname -#line 1054 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 3495 "pipeline_parser_gen.cpp" - break; - - case 239: // idAsUserFieldname: ID -#line 1058 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = UserFieldname{"_id"}; - } -#line 3503 "pipeline_parser_gen.cpp" - break; - - case 240: // maths: add -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3509 "pipeline_parser_gen.cpp" - break; - - case 241: // maths: atan2 -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3515 "pipeline_parser_gen.cpp" - break; - - case 242: // maths: abs -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3521 "pipeline_parser_gen.cpp" - break; - - case 243: // maths: ceil -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3527 "pipeline_parser_gen.cpp" - break; - - case 244: // maths: divide -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3533 "pipeline_parser_gen.cpp" - break; - - case 245: // maths: exponent -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3539 "pipeline_parser_gen.cpp" - break; - - case 246: // maths: floor -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3545 "pipeline_parser_gen.cpp" - break; - - case 247: // maths: ln -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3551 "pipeline_parser_gen.cpp" - break; - - case 248: // maths: log -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3557 "pipeline_parser_gen.cpp" - break; - - case 249: // maths: logten -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3563 "pipeline_parser_gen.cpp" - break; - - case 250: // maths: mod -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3569 "pipeline_parser_gen.cpp" - break; - - case 251: // maths: multiply -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3575 "pipeline_parser_gen.cpp" - break; - - case 252: // maths: pow -#line 1064 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3581 "pipeline_parser_gen.cpp" - break; - - case 253: // maths: round -#line 1065 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3587 "pipeline_parser_gen.cpp" - break; - - case 254: // maths: sqrt -#line 1065 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3593 "pipeline_parser_gen.cpp" - break; - - case 255: // maths: subtract -#line 1065 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3599 "pipeline_parser_gen.cpp" - break; - - case 256: // maths: trunc -#line 1065 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3605 "pipeline_parser_gen.cpp" - break; - - case 257: // add: "object" ADD expressionArray "end of object" -#line 1069 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::add, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3614 "pipeline_parser_gen.cpp" - break; - - case 258: // atan2: "object" ATAN2 exprFixedTwoArg "end of object" -#line 1076 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::atan2, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3623 "pipeline_parser_gen.cpp" - break; - - case 259: // abs: "object" ABS expression "end of object" -#line 1082 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::abs, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3631 "pipeline_parser_gen.cpp" - break; - - case 260: // ceil: "object" CEIL expression "end of object" -#line 1087 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::ceil, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3639 "pipeline_parser_gen.cpp" - break; - - case 261: // divide: "object" DIVIDE "array" expression expression "end of - // array" "end of object" -#line 1092 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::divide, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 3648 "pipeline_parser_gen.cpp" - break; - - case 262: // exponent: "object" EXPONENT expression "end of object" -#line 1098 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::exponent, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3656 "pipeline_parser_gen.cpp" - break; - - case 263: // floor: "object" FLOOR expression "end of object" -#line 1103 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::floor, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3664 "pipeline_parser_gen.cpp" - break; - - case 264: // ln: "object" LN expression "end of object" -#line 1108 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::ln, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3672 "pipeline_parser_gen.cpp" - break; - - case 265: // log: "object" LOG "array" expression expression "end of array" - // "end of object" -#line 1113 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::log, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 3681 "pipeline_parser_gen.cpp" - break; - - case 266: // logten: "object" LOGTEN expression "end of object" -#line 1119 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::logten, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3689 "pipeline_parser_gen.cpp" - break; - - case 267: // mod: "object" MOD "array" expression expression "end of array" - // "end of object" -#line 1124 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::mod, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 3698 "pipeline_parser_gen.cpp" - break; - - case 268: // multiply: "object" MULTIPLY "array" expression expression - // expressions "end of array" "end of object" -#line 1130 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::multiply, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), - YY_MOVE(yystack_[3].value.as<CNode>())}}}}}; - auto&& others = YY_MOVE(yystack_[2].value.as<std::vector<CNode>>()); - auto&& array = - yylhs.value.as<CNode>().objectChildren()[0].second.arrayChildren(); - array.insert(array.end(), others.begin(), others.end()); - } -#line 3710 "pipeline_parser_gen.cpp" - break; - - case 269: // pow: "object" POW "array" expression expression "end of array" - // "end of object" -#line 1139 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::pow, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 3719 "pipeline_parser_gen.cpp" - break; - - case 270: // round: "object" ROUND "array" expression expression "end of array" - // "end of object" -#line 1145 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::round, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 3728 "pipeline_parser_gen.cpp" - break; - - case 271: // sqrt: "object" SQRT expression "end of object" -#line 1151 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::sqrt, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3736 "pipeline_parser_gen.cpp" - break; - - case 272: // subtract: "object" SUBTRACT "array" expression expression "end of - // array" "end of object" -#line 1156 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::subtract, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 3745 "pipeline_parser_gen.cpp" - break; - - case 273: // trunc: "object" TRUNC "array" expression expression "end of array" - // "end of object" -#line 1162 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::trunc, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 3754 "pipeline_parser_gen.cpp" - break; - - case 274: // boolExps: and -#line 1168 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3760 "pipeline_parser_gen.cpp" - break; - - case 275: // boolExps: or -#line 1168 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3766 "pipeline_parser_gen.cpp" - break; - - case 276: // boolExps: not -#line 1168 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3772 "pipeline_parser_gen.cpp" - break; - - case 277: // and: "object" AND expressionArray "end of object" -#line 1172 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::andExpr, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3781 "pipeline_parser_gen.cpp" - break; - - case 278: // or: "object" OR expressionArray "end of object" -#line 1179 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::orExpr, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 3790 "pipeline_parser_gen.cpp" - break; - - case 279: // not: "object" NOT "array" expression "end of array" "end of - // object" -#line 1186 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::notExpr, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 3799 "pipeline_parser_gen.cpp" - break; - - case 280: // stringExps: concat -#line 1193 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3805 "pipeline_parser_gen.cpp" - break; - - case 281: // stringExps: dateFromString -#line 1193 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3811 "pipeline_parser_gen.cpp" - break; - - case 282: // stringExps: dateToString -#line 1193 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3817 "pipeline_parser_gen.cpp" - break; - - case 283: // stringExps: indexOfBytes -#line 1193 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3823 "pipeline_parser_gen.cpp" - break; - - case 284: // stringExps: indexOfCP -#line 1193 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3829 "pipeline_parser_gen.cpp" - break; - - case 285: // stringExps: ltrim -#line 1193 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3835 "pipeline_parser_gen.cpp" - break; - - case 286: // stringExps: regexFind -#line 1193 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3841 "pipeline_parser_gen.cpp" - break; - - case 287: // stringExps: regexFindAll -#line 1194 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3847 "pipeline_parser_gen.cpp" - break; - - case 288: // stringExps: regexMatch -#line 1194 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3853 "pipeline_parser_gen.cpp" - break; - - case 289: // stringExps: replaceOne -#line 1194 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3859 "pipeline_parser_gen.cpp" - break; - - case 290: // stringExps: replaceAll -#line 1194 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3865 "pipeline_parser_gen.cpp" - break; - - case 291: // stringExps: rtrim -#line 1194 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3871 "pipeline_parser_gen.cpp" - break; - - case 292: // stringExps: split -#line 1194 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3877 "pipeline_parser_gen.cpp" - break; - - case 293: // stringExps: strLenBytes -#line 1194 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3883 "pipeline_parser_gen.cpp" - break; - - case 294: // stringExps: strLenCP -#line 1194 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3889 "pipeline_parser_gen.cpp" - break; - - case 295: // stringExps: strcasecmp -#line 1195 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3895 "pipeline_parser_gen.cpp" - break; - - case 296: // stringExps: substr -#line 1195 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3901 "pipeline_parser_gen.cpp" - break; - - case 297: // stringExps: substrBytes -#line 1195 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3907 "pipeline_parser_gen.cpp" - break; - - case 298: // stringExps: substrCP -#line 1195 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3913 "pipeline_parser_gen.cpp" - break; - - case 299: // stringExps: toLower -#line 1195 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3919 "pipeline_parser_gen.cpp" - break; - - case 300: // stringExps: trim -#line 1195 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3925 "pipeline_parser_gen.cpp" - break; - - case 301: // stringExps: toUpper -#line 1195 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 3931 "pipeline_parser_gen.cpp" - break; - - case 302: // concat: "object" CONCAT "array" expressions "end of array" "end of - // object" -#line 1199 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::concat, CNode{CNode::ArrayChildren{}}}}}; - auto&& others = YY_MOVE(yystack_[2].value.as<std::vector<CNode>>()); - auto&& array = - yylhs.value.as<CNode>().objectChildren()[0].second.arrayChildren(); - array.insert(array.end(), others.begin(), others.end()); - } -#line 3943 "pipeline_parser_gen.cpp" - break; - - case 303: // formatArg: %empty -#line 1209 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = - std::pair{KeyFieldname::formatArg, CNode{KeyValue::absentKey}}; - } -#line 3951 "pipeline_parser_gen.cpp" - break; - - case 304: // formatArg: "format argument" expression -#line 1212 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ - KeyFieldname::formatArg, YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 3959 "pipeline_parser_gen.cpp" - break; - - case 305: // timezoneArg: %empty -#line 1218 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = - std::pair{KeyFieldname::timezoneArg, CNode{KeyValue::absentKey}}; - } -#line 3967 "pipeline_parser_gen.cpp" - break; - - case 306: // timezoneArg: "timezone argument" expression -#line 1221 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ - KeyFieldname::timezoneArg, YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 3975 "pipeline_parser_gen.cpp" - break; - - case 307: // dateFromString: "object" DATE_FROM_STRING START_ORDERED_OBJECT - // "dateString argument" expression formatArg timezoneArg onErrorArg - // onNullArg "end of object" "end of object" -#line 1228 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::dateFromString, - CNode{CNode::ObjectChildren{ - {KeyFieldname::dateStringArg, - YY_MOVE(yystack_[6].value.as<CNode>())}, - YY_MOVE( - yystack_[5].value.as<std::pair<CNode::Fieldname, CNode>>()), - YY_MOVE( - yystack_[4].value.as<std::pair<CNode::Fieldname, CNode>>()), - YY_MOVE( - yystack_[3].value.as<std::pair<CNode::Fieldname, CNode>>()), - YY_MOVE(yystack_[2] - .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; - } -#line 3985 "pipeline_parser_gen.cpp" - break; - - case 308: // dateToString: "object" DATE_TO_STRING START_ORDERED_OBJECT "date - // argument" expression formatArg timezoneArg onNullArg "end of - // object" "end of object" -#line 1237 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::dateToString, - CNode{CNode::ObjectChildren{ - {KeyFieldname::dateArg, YY_MOVE(yystack_[5].value.as<CNode>())}, - YY_MOVE( - yystack_[4].value.as<std::pair<CNode::Fieldname, CNode>>()), - YY_MOVE( - yystack_[3].value.as<std::pair<CNode::Fieldname, CNode>>()), - YY_MOVE(yystack_[2] - .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; - } -#line 3995 "pipeline_parser_gen.cpp" - break; - - case 309: // exprZeroToTwo: %empty -#line 1245 "pipeline_grammar.yy" - { - yylhs.value.as<std::vector<CNode>>() = CNode::ArrayChildren{}; - } -#line 4003 "pipeline_parser_gen.cpp" - break; - - case 310: // exprZeroToTwo: expression -#line 1248 "pipeline_grammar.yy" - { - yylhs.value.as<std::vector<CNode>>() = - CNode::ArrayChildren{YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4011 "pipeline_parser_gen.cpp" - break; - - case 311: // exprZeroToTwo: expression expression -#line 1251 "pipeline_grammar.yy" - { - yylhs.value.as<std::vector<CNode>>() = - CNode::ArrayChildren{YY_MOVE(yystack_[1].value.as<CNode>()), - YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4019 "pipeline_parser_gen.cpp" - break; - - case 312: // indexOfBytes: "object" INDEX_OF_BYTES "array" expression - // expression exprZeroToTwo "end of array" "end of object" -#line 1258 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::indexOfBytes, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), - YY_MOVE(yystack_[3].value.as<CNode>())}}}}}; - auto&& others = YY_MOVE(yystack_[2].value.as<std::vector<CNode>>()); - auto&& array = - yylhs.value.as<CNode>().objectChildren()[0].second.arrayChildren(); - array.insert(array.end(), others.begin(), others.end()); - } -#line 4031 "pipeline_parser_gen.cpp" - break; - - case 313: // indexOfCP: "object" INDEX_OF_CP "array" expression expression - // exprZeroToTwo "end of array" "end of object" -#line 1269 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::indexOfCP, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), - YY_MOVE(yystack_[3].value.as<CNode>())}}}}}; - auto&& others = YY_MOVE(yystack_[2].value.as<std::vector<CNode>>()); - auto&& array = - yylhs.value.as<CNode>().objectChildren()[0].second.arrayChildren(); - array.insert(array.end(), others.begin(), others.end()); - } -#line 4043 "pipeline_parser_gen.cpp" - break; - - case 314: // charsArg: %empty -#line 1279 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = - std::pair{KeyFieldname::charsArg, CNode{KeyValue::absentKey}}; - } -#line 4051 "pipeline_parser_gen.cpp" - break; - - case 315: // charsArg: "chars argument" expression -#line 1282 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ - KeyFieldname::charsArg, YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4059 "pipeline_parser_gen.cpp" - break; - - case 316: // ltrim: "object" LTRIM START_ORDERED_OBJECT charsArg "input - // argument" expression "end of object" "end of object" -#line 1288 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::ltrim, - CNode{CNode::ObjectChildren{ - {KeyFieldname::inputArg, YY_MOVE(yystack_[2].value.as<CNode>())}, - YY_MOVE(yystack_[4] - .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; - } -#line 4069 "pipeline_parser_gen.cpp" - break; - - case 317: // rtrim: "object" RTRIM START_ORDERED_OBJECT charsArg "input - // argument" expression "end of object" "end of object" -#line 1296 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::rtrim, - CNode{CNode::ObjectChildren{ - {KeyFieldname::inputArg, YY_MOVE(yystack_[2].value.as<CNode>())}, - YY_MOVE(yystack_[4] - .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; - } -#line 4079 "pipeline_parser_gen.cpp" - break; - - case 318: // trim: "object" TRIM START_ORDERED_OBJECT charsArg "input argument" - // expression "end of object" "end of object" -#line 1304 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::trim, - CNode{CNode::ObjectChildren{ - {KeyFieldname::inputArg, YY_MOVE(yystack_[2].value.as<CNode>())}, - YY_MOVE(yystack_[4] - .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; - } -#line 4089 "pipeline_parser_gen.cpp" - break; - - case 319: // optionsArg: %empty -#line 1312 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = - std::pair{KeyFieldname::optionsArg, CNode{KeyValue::absentKey}}; - } -#line 4097 "pipeline_parser_gen.cpp" - break; - - case 320: // optionsArg: "options argument" expression -#line 1315 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ - KeyFieldname::optionsArg, YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4105 "pipeline_parser_gen.cpp" - break; - - case 321: // regexArgs: START_ORDERED_OBJECT "input argument" expression - // optionsArg "regex argument" expression "end of object" -#line 1320 "pipeline_grammar.yy" - { - // Note that the order of these arguments must match the constructor for the - // regex expression. - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::inputArg, YY_MOVE(yystack_[4].value.as<CNode>())}, - {KeyFieldname::regexArg, YY_MOVE(yystack_[1].value.as<CNode>())}, - YY_MOVE(yystack_[3].value.as<std::pair<CNode::Fieldname, CNode>>())}}; - } -#line 4117 "pipeline_parser_gen.cpp" - break; - - case 322: // regexFind: "object" REGEX_FIND regexArgs "end of object" -#line 1329 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::regexFind, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4125 "pipeline_parser_gen.cpp" - break; - - case 323: // regexFindAll: "object" REGEX_FIND_ALL regexArgs "end of object" -#line 1335 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::regexFindAll, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4133 "pipeline_parser_gen.cpp" - break; - - case 324: // regexMatch: "object" REGEX_MATCH regexArgs "end of object" -#line 1341 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::regexMatch, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4141 "pipeline_parser_gen.cpp" - break; - - case 325: // replaceOne: "object" REPLACE_ONE START_ORDERED_OBJECT "find - // argument" expression "input argument" expression "replacement - // argument" expression "end of object" "end of object" -#line 1348 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::replaceOne, - CNode{CNode::ObjectChildren{ - {KeyFieldname::inputArg, YY_MOVE(yystack_[4].value.as<CNode>())}, - {KeyFieldname::findArg, YY_MOVE(yystack_[6].value.as<CNode>())}, - {KeyFieldname::replacementArg, - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}}; - } -#line 4152 "pipeline_parser_gen.cpp" - break; - - case 326: // replaceAll: "object" REPLACE_ALL START_ORDERED_OBJECT "find - // argument" expression "input argument" expression "replacement - // argument" expression "end of object" "end of object" -#line 1358 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::replaceAll, - CNode{CNode::ObjectChildren{ - {KeyFieldname::inputArg, YY_MOVE(yystack_[4].value.as<CNode>())}, - {KeyFieldname::findArg, YY_MOVE(yystack_[6].value.as<CNode>())}, - {KeyFieldname::replacementArg, - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}}; - } -#line 4163 "pipeline_parser_gen.cpp" - break; - - case 327: // split: "object" SPLIT "array" expression expression "end of array" - // "end of object" -#line 1367 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::split, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 4172 "pipeline_parser_gen.cpp" - break; - - case 328: // strLenBytes: "object" STR_LEN_BYTES expression "end of object" -#line 1374 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::strLenBytes, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4181 "pipeline_parser_gen.cpp" - break; - - case 329: // strLenCP: "object" STR_LEN_CP expression "end of object" -#line 1381 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::strLenCP, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4190 "pipeline_parser_gen.cpp" - break; - - case 330: // strcasecmp: "object" STR_CASE_CMP "array" expression expression - // "end of array" "end of object" -#line 1389 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::strcasecmp, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 4199 "pipeline_parser_gen.cpp" - break; - - case 331: // substr: "object" SUBSTR "array" expression expression expression - // "end of array" "end of object" -#line 1397 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::substr, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), - YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 4208 "pipeline_parser_gen.cpp" - break; - - case 332: // substrBytes: "object" SUBSTR_BYTES "array" expression expression - // expression "end of array" "end of object" -#line 1405 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::substrBytes, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), - YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 4217 "pipeline_parser_gen.cpp" - break; - - case 333: // substrCP: "object" SUBSTR_CP "array" expression expression - // expression "end of array" "end of object" -#line 1413 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::substrCP, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[4].value.as<CNode>()), - YY_MOVE(yystack_[3].value.as<CNode>()), - YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 4226 "pipeline_parser_gen.cpp" - break; - - case 334: // toLower: "object" TO_LOWER expression "end of object" -#line 1420 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toLower, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4234 "pipeline_parser_gen.cpp" - break; - - case 335: // toUpper: "object" TO_UPPER expression "end of object" -#line 1426 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toUpper, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4242 "pipeline_parser_gen.cpp" - break; - - case 336: // metaSortKeyword: "randVal" -#line 1432 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::randVal}; - } -#line 4250 "pipeline_parser_gen.cpp" - break; - - case 337: // metaSortKeyword: "textScore" -#line 1435 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::textScore}; - } -#line 4258 "pipeline_parser_gen.cpp" - break; - - case 338: // metaSort: "object" META metaSortKeyword "end of object" -#line 1441 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::meta, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4266 "pipeline_parser_gen.cpp" - break; - - case 339: // sortSpecs: "object" specList "end of object" -#line 1447 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - } -#line 4274 "pipeline_parser_gen.cpp" - break; - - case 340: // specList: %empty -#line 1452 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode::noopLeaf(); - } -#line 4282 "pipeline_parser_gen.cpp" - break; - - case 341: // specList: specList sortSpec -#line 1455 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - yylhs.value.as<CNode>().objectChildren().emplace_back( - YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); - } -#line 4291 "pipeline_parser_gen.cpp" - break; - - case 342: // oneOrNegOne: "1 (int)" -#line 1462 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::intOneKey}; - } -#line 4299 "pipeline_parser_gen.cpp" - break; - - case 343: // oneOrNegOne: "-1 (int)" -#line 1465 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::intNegOneKey}; - } -#line 4307 "pipeline_parser_gen.cpp" - break; - - case 344: // oneOrNegOne: "1 (long)" -#line 1468 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::longOneKey}; - } -#line 4315 "pipeline_parser_gen.cpp" - break; - - case 345: // oneOrNegOne: "-1 (long)" -#line 1471 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::longNegOneKey}; - } -#line 4323 "pipeline_parser_gen.cpp" - break; - - case 346: // oneOrNegOne: "1 (double)" -#line 1474 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::doubleOneKey}; - } -#line 4331 "pipeline_parser_gen.cpp" - break; - - case 347: // oneOrNegOne: "-1 (double)" -#line 1477 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::doubleNegOneKey}; - } -#line 4339 "pipeline_parser_gen.cpp" - break; - - case 348: // oneOrNegOne: "1 (decimal)" -#line 1480 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::decimalOneKey}; - } -#line 4347 "pipeline_parser_gen.cpp" - break; - - case 349: // oneOrNegOne: "-1 (decimal)" -#line 1483 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{KeyValue::decimalNegOneKey}; - } -#line 4355 "pipeline_parser_gen.cpp" - break; - - case 350: // sortSpec: valueFieldname metaSort -#line 1488 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { - YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), - YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4363 "pipeline_parser_gen.cpp" - break; - - case 351: // sortSpec: valueFieldname oneOrNegOne -#line 1490 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { - YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), - YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4371 "pipeline_parser_gen.cpp" - break; - - case 352: // literalEscapes: const -#line 1496 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4377 "pipeline_parser_gen.cpp" - break; - - case 353: // literalEscapes: literal -#line 1496 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4383 "pipeline_parser_gen.cpp" - break; - - case 354: // const: "object" CONST_EXPR "array" value "end of array" "end of - // object" -#line 1500 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::constExpr, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 4392 "pipeline_parser_gen.cpp" - break; - - case 355: // literal: "object" LITERAL "array" value "end of array" "end of - // object" -#line 1507 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::literal, - CNode{CNode::ArrayChildren{YY_MOVE(yystack_[2].value.as<CNode>())}}}}}; - } -#line 4401 "pipeline_parser_gen.cpp" - break; - - case 356: // value: simpleValue -#line 1514 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4407 "pipeline_parser_gen.cpp" - break; - - case 357: // value: compoundValue -#line 1514 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4413 "pipeline_parser_gen.cpp" - break; - - case 358: // compoundValue: valueArray -#line 1518 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4419 "pipeline_parser_gen.cpp" - break; - - case 359: // compoundValue: valueObject -#line 1518 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4425 "pipeline_parser_gen.cpp" - break; - - case 360: // valueArray: "array" values "end of array" -#line 1522 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = - CNode{YY_MOVE(yystack_[1].value.as<std::vector<CNode>>())}; - } -#line 4433 "pipeline_parser_gen.cpp" - break; - - case 361: // values: %empty -#line 1528 "pipeline_grammar.yy" - { - } -#line 4439 "pipeline_parser_gen.cpp" - break; - - case 362: // values: value values -#line 1529 "pipeline_grammar.yy" - { - yylhs.value.as<std::vector<CNode>>() = - YY_MOVE(yystack_[0].value.as<std::vector<CNode>>()); - yylhs.value.as<std::vector<CNode>>().emplace_back( - YY_MOVE(yystack_[1].value.as<CNode>())); - } -#line 4448 "pipeline_parser_gen.cpp" - break; - - case 363: // valueObject: "object" valueFields "end of object" -#line 1536 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - } -#line 4456 "pipeline_parser_gen.cpp" - break; - - case 364: // valueFields: %empty -#line 1542 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode::noopLeaf(); - } -#line 4464 "pipeline_parser_gen.cpp" - break; - - case 365: // valueFields: valueFields valueField -#line 1545 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[1].value.as<CNode>()); - yylhs.value.as<CNode>().objectChildren().emplace_back( - YY_MOVE(yystack_[0].value.as<std::pair<CNode::Fieldname, CNode>>())); - } -#line 4473 "pipeline_parser_gen.cpp" - break; - - case 366: // valueField: valueFieldname value -#line 1552 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = { - YY_MOVE(yystack_[1].value.as<CNode::Fieldname>()), - YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4481 "pipeline_parser_gen.cpp" - break; - - case 367: // valueFieldname: invariableUserFieldname -#line 1559 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 4487 "pipeline_parser_gen.cpp" - break; - - case 368: // valueFieldname: stageAsUserFieldname -#line 1560 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 4493 "pipeline_parser_gen.cpp" - break; - - case 369: // valueFieldname: argAsUserFieldname -#line 1561 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 4499 "pipeline_parser_gen.cpp" - break; - - case 370: // valueFieldname: aggExprAsUserFieldname -#line 1562 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 4505 "pipeline_parser_gen.cpp" - break; - - case 371: // valueFieldname: idAsUserFieldname -#line 1563 "pipeline_grammar.yy" - { - yylhs.value.as<CNode::Fieldname>() = - YY_MOVE(yystack_[0].value.as<CNode::Fieldname>()); - } -#line 4511 "pipeline_parser_gen.cpp" - break; - - case 372: // compExprs: cmp -#line 1566 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4517 "pipeline_parser_gen.cpp" - break; - - case 373: // compExprs: eq -#line 1566 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4523 "pipeline_parser_gen.cpp" - break; - - case 374: // compExprs: gt -#line 1566 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4529 "pipeline_parser_gen.cpp" - break; - - case 375: // compExprs: gte -#line 1566 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4535 "pipeline_parser_gen.cpp" - break; - - case 376: // compExprs: lt -#line 1566 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4541 "pipeline_parser_gen.cpp" - break; - - case 377: // compExprs: lte -#line 1566 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4547 "pipeline_parser_gen.cpp" - break; - - case 378: // compExprs: ne -#line 1566 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4553 "pipeline_parser_gen.cpp" - break; - - case 379: // cmp: "object" CMP exprFixedTwoArg "end of object" -#line 1568 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::cmp, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4562 "pipeline_parser_gen.cpp" - break; - - case 380: // eq: "object" EQ exprFixedTwoArg "end of object" -#line 1573 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::eq, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4571 "pipeline_parser_gen.cpp" - break; - - case 381: // gt: "object" GT exprFixedTwoArg "end of object" -#line 1578 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::gt, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4580 "pipeline_parser_gen.cpp" - break; - - case 382: // gte: "object" GTE exprFixedTwoArg "end of object" -#line 1583 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::gte, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4589 "pipeline_parser_gen.cpp" - break; - - case 383: // lt: "object" LT exprFixedTwoArg "end of object" -#line 1588 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::lt, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4598 "pipeline_parser_gen.cpp" - break; - - case 384: // lte: "object" LTE exprFixedTwoArg "end of object" -#line 1593 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::lte, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4607 "pipeline_parser_gen.cpp" - break; - - case 385: // ne: "object" NE exprFixedTwoArg "end of object" -#line 1598 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::ne, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4616 "pipeline_parser_gen.cpp" - break; - - case 386: // typeExpression: convert -#line 1604 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4622 "pipeline_parser_gen.cpp" - break; - - case 387: // typeExpression: toBool -#line 1605 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4628 "pipeline_parser_gen.cpp" - break; - - case 388: // typeExpression: toDate -#line 1606 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4634 "pipeline_parser_gen.cpp" - break; - - case 389: // typeExpression: toDecimal -#line 1607 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4640 "pipeline_parser_gen.cpp" - break; - - case 390: // typeExpression: toDouble -#line 1608 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4646 "pipeline_parser_gen.cpp" - break; - - case 391: // typeExpression: toInt -#line 1609 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4652 "pipeline_parser_gen.cpp" - break; - - case 392: // typeExpression: toLong -#line 1610 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4658 "pipeline_parser_gen.cpp" - break; - - case 393: // typeExpression: toObjectId -#line 1611 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4664 "pipeline_parser_gen.cpp" - break; - - case 394: // typeExpression: toString -#line 1612 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4670 "pipeline_parser_gen.cpp" - break; - - case 395: // typeExpression: type -#line 1613 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = YY_MOVE(yystack_[0].value.as<CNode>()); - } -#line 4676 "pipeline_parser_gen.cpp" - break; - - case 396: // onErrorArg: %empty -#line 1618 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = - std::pair{KeyFieldname::onErrorArg, CNode{KeyValue::absentKey}}; - } -#line 4684 "pipeline_parser_gen.cpp" - break; - - case 397: // onErrorArg: "onError argument" expression -#line 1621 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ - KeyFieldname::onErrorArg, YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4692 "pipeline_parser_gen.cpp" - break; - - case 398: // onNullArg: %empty -#line 1628 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = - std::pair{KeyFieldname::onNullArg, CNode{KeyValue::absentKey}}; - } -#line 4700 "pipeline_parser_gen.cpp" - break; - - case 399: // onNullArg: "onNull argument" expression -#line 1631 "pipeline_grammar.yy" - { - yylhs.value.as<std::pair<CNode::Fieldname, CNode>>() = std::pair{ - KeyFieldname::onNullArg, YY_MOVE(yystack_[0].value.as<CNode>())}; - } -#line 4708 "pipeline_parser_gen.cpp" - break; - - case 400: // convert: "object" CONVERT START_ORDERED_OBJECT "input argument" - // expression onErrorArg onNullArg "to argument" expression "end of - // object" "end of object" -#line 1638 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::convert, - CNode{CNode::ObjectChildren{ - {KeyFieldname::inputArg, YY_MOVE(yystack_[6].value.as<CNode>())}, - {KeyFieldname::toArg, YY_MOVE(yystack_[2].value.as<CNode>())}, - YY_MOVE( - yystack_[5].value.as<std::pair<CNode::Fieldname, CNode>>()), - YY_MOVE(yystack_[4] - .value.as<std::pair<CNode::Fieldname, CNode>>())}}}}}; - } -#line 4719 "pipeline_parser_gen.cpp" - break; - - case 401: // toBool: "object" TO_BOOL expression "end of object" -#line 1647 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toBool, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4727 "pipeline_parser_gen.cpp" - break; - - case 402: // toDate: "object" TO_DATE expression "end of object" -#line 1652 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toDate, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4735 "pipeline_parser_gen.cpp" - break; - - case 403: // toDecimal: "object" TO_DECIMAL expression "end of object" -#line 1657 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toDecimal, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4743 "pipeline_parser_gen.cpp" - break; - - case 404: // toDouble: "object" TO_DOUBLE expression "end of object" -#line 1662 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toDouble, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4751 "pipeline_parser_gen.cpp" - break; - - case 405: // toInt: "object" TO_INT expression "end of object" -#line 1667 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toInt, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4759 "pipeline_parser_gen.cpp" - break; - - case 406: // toLong: "object" TO_LONG expression "end of object" -#line 1672 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toLong, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4767 "pipeline_parser_gen.cpp" - break; - - case 407: // toObjectId: "object" TO_OBJECT_ID expression "end of object" -#line 1677 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toObjectId, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4775 "pipeline_parser_gen.cpp" - break; - - case 408: // toString: "object" TO_STRING expression "end of object" -#line 1682 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::toString, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4783 "pipeline_parser_gen.cpp" - break; - - case 409: // type: "object" TYPE expression "end of object" -#line 1687 "pipeline_grammar.yy" - { - yylhs.value.as<CNode>() = CNode{CNode::ObjectChildren{ - {KeyFieldname::type, YY_MOVE(yystack_[1].value.as<CNode>())}}}; - } -#line 4791 "pipeline_parser_gen.cpp" - break; - - -#line 4795 "pipeline_parser_gen.cpp" - - default: - break; - } - } -#if YY_EXCEPTIONS - catch (const syntax_error& yyexc) { - YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; - error(yyexc); - YYERROR; - } -#endif // YY_EXCEPTIONS - YY_SYMBOL_PRINT("-> $$ =", yylhs); - yypop_(yylen); - yylen = 0; - - // Shift the result of the reduction. - yypush_(YY_NULLPTR, YY_MOVE(yylhs)); - } - goto yynewstate; - - - /*--------------------------------------. - | yyerrlab -- here on detecting error. | - `--------------------------------------*/ - yyerrlab: - // If not already recovering from an error, report this error. - if (!yyerrstatus_) { - ++yynerrs_; - context yyctx(*this, yyla); - std::string msg = yysyntax_error_(yyctx); - error(yyla.location, YY_MOVE(msg)); - } - - - yyerror_range[1].location = yyla.location; - if (yyerrstatus_ == 3) { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - // Return failure if at end of input. - if (yyla.kind() == symbol_kind::S_YYEOF) - YYABORT; - else if (!yyla.empty()) { - yy_destroy_("Error: discarding", yyla); - yyla.clear(); - } - } - - // 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 (false) - YYERROR; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - yypop_(yylen); - yylen = 0; - YY_STACK_PRINT(); - 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_[+yystack_[0].state]; - if (!yy_pact_value_is_default_(yyn)) { - yyn += symbol_kind::S_YYerror; - if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == symbol_kind::S_YYerror) { - yyn = yytable_[yyn]; - if (0 < yyn) - break; - } - } - - // Pop the current state because it cannot handle the error token. - if (yystack_.size() == 1) - YYABORT; - - yyerror_range[1].location = yystack_[0].location; - yy_destroy_("Error: popping", yystack_[0]); - yypop_(); - YY_STACK_PRINT(); - } - { - stack_symbol_type error_token; - - yyerror_range[2].location = yyla.location; - YYLLOC_DEFAULT(error_token.location, yyerror_range, 2); - - // Shift the error token. - error_token.state = state_type(yyn); - yypush_("Shifting", YY_MOVE(error_token)); - } - goto yynewstate; - - - /*-------------------------------------. - | yyacceptlab -- YYACCEPT comes here. | - `-------------------------------------*/ - yyacceptlab: - yyresult = 0; - goto yyreturn; - - - /*-----------------------------------. - | yyabortlab -- YYABORT comes here. | - `-----------------------------------*/ - yyabortlab: - yyresult = 1; - goto yyreturn; - - - /*-----------------------------------------------------. - | yyreturn -- parsing is finished, return the result. | - `-----------------------------------------------------*/ - yyreturn: - if (!yyla.empty()) - yy_destroy_("Cleanup: discarding lookahead", yyla); - - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - yypop_(yylen); - YY_STACK_PRINT(); - while (1 < yystack_.size()) { - yy_destroy_("Cleanup: popping", yystack_[0]); - yypop_(); - } - - return yyresult; - } -#if YY_EXCEPTIONS - catch (...) { - YYCDEBUG << "Exception caught: cleaning lookahead and stack\n"; - // Do not try to display the values of the reclaimed symbols, - // as their printers might throw an exception. - if (!yyla.empty()) - yy_destroy_(YY_NULLPTR, yyla); - - while (1 < yystack_.size()) { - yy_destroy_(YY_NULLPTR, yystack_[0]); - yypop_(); - } - throw; - } -#endif // YY_EXCEPTIONS -} - -void PipelineParserGen::error(const syntax_error& yyexc) { - error(yyexc.location, yyexc.what()); -} - -/* Return 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. */ -std::string PipelineParserGen::yytnamerr_(const char* yystr) { - if (*yystr == '"') { - std::string yyr; - 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: - yyr += *yyp; - break; - - case '"': - return yyr; - } - do_not_strip_quotes:; - } - - return yystr; -} - -std::string PipelineParserGen::symbol_name(symbol_kind_type yysymbol) { - return yytnamerr_(yytname_[yysymbol]); -} - - -// PipelineParserGen::context. -PipelineParserGen::context::context(const PipelineParserGen& yyparser, const symbol_type& yyla) - : yyparser_(yyparser), yyla_(yyla) {} - -int PipelineParserGen::context::expected_tokens(symbol_kind_type yyarg[], int yyargn) const { - // Actual number of expected tokens - int yycount = 0; - - int yyn = yypact_[+yyparser_.yystack_[0].state]; - if (!yy_pact_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; - for (int yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::S_YYerror && - !yy_table_value_is_error_(yytable_[yyx + yyn])) { - if (!yyarg) - ++yycount; - else if (yycount == yyargn) - return 0; - else - yyarg[yycount++] = YY_CAST(symbol_kind_type, yyx); - } - } - - if (yyarg && yycount == 0 && 0 < yyargn) - yyarg[0] = symbol_kind::S_YYEMPTY; - return yycount; -} - - -int PipelineParserGen::yy_syntax_error_arguments_(const context& yyctx, - symbol_kind_type yyarg[], - int yyargn) const { - /* 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 yyla) 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 - yyla. (However, yyla is currently not documented for users.) - - 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.lookahead().empty()) { - if (yyarg) - yyarg[0] = yyctx.token(); - int yyn = yyctx.expected_tokens(yyarg ? yyarg + 1 : yyarg, yyargn - 1); - return yyn + 1; - } - return 0; -} - -// Generate an error message. -std::string PipelineParserGen::yysyntax_error_(const context& yyctx) const { - // Its maximum. - enum { YYARGS_MAX = 5 }; - // Arguments of yyformat. - symbol_kind_type yyarg[YYARGS_MAX]; - int yycount = yy_syntax_error_arguments_(yyctx, yyarg, YYARGS_MAX); - - char const* yyformat = YY_NULLPTR; - 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_ - } - - std::string yyres; - // Argument number. - std::ptrdiff_t yyi = 0; - for (char const* yyp = yyformat; *yyp; ++yyp) - if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) { - yyres += symbol_name(yyarg[yyi++]); - ++yyp; - } else - yyres += *yyp; - return yyres; -} - - -const short PipelineParserGen::yypact_ninf_ = -550; - -const signed char PipelineParserGen::yytable_ninf_ = -1; - -const short PipelineParserGen::yypact_[] = { - -108, -65, -69, -61, 57, -27, -550, -550, -550, -550, -550, -550, 56, 53, 135, 23, - -24, 136, 81, 85, 136, -550, 142, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, 760, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - 127, -550, 169, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, 196, -550, 237, 166, -27, -550, -550, - -550, 760, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, 207, -550, -550, -550, 220, 136, -48, -550, -550, - 760, 238, 674, 40, -550, 1077, 1077, -550, -550, -550, -550, -550, 236, 262, -550, -550, - -550, 760, -550, -550, -550, 249, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, 866, 992, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, 36, -550, -550, -550, 866, -550, 266, 866, 221, 221, 229, 866, 229, 244, 246, - -550, -550, -550, 247, 229, 866, 866, 229, 229, 248, 250, 251, 866, 253, 866, 229, - 229, -550, 254, 257, 229, 259, 221, 260, -550, -550, -550, -550, -550, 261, -550, 269, - 866, 270, 866, 866, 271, 272, 273, 274, 866, 866, 866, 866, 866, 866, 866, 866, - 866, 866, -550, 275, 866, 1198, 294, -550, -550, 307, 321, 322, 866, 323, 324, 325, - 866, 760, 354, 359, 361, 866, 330, 332, 333, 334, 336, 866, 866, 760, 339, 866, - 341, 342, 343, 380, 866, 866, 347, 866, 348, 866, 352, 382, 355, 356, 387, 388, - 866, 380, 866, 363, 866, 364, 365, 866, 866, 866, 866, 366, 370, 372, 375, 376, - 377, 378, 389, 390, 392, 380, 866, 393, -550, 866, -550, -550, -550, -550, -550, -550, - -550, -550, -550, 866, -550, -550, -550, 360, 395, 866, 866, 866, 866, -550, -550, -550, - -550, -550, 866, 866, 396, -550, 866, -550, -550, -550, 866, 424, 866, 866, -550, 398, - -550, 866, -550, 866, -550, -550, 866, 866, 866, 426, 866, -550, 866, -550, -550, 866, - 866, 866, 866, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, 428, 866, -550, - -550, 402, 403, 404, 429, 434, 434, 407, 866, 866, 409, 408, -550, 866, 411, 866, - 412, 414, 436, 444, 445, 420, 866, 421, 422, 866, 866, 866, 423, 866, 430, -550, - -550, -550, 866, 451, 866, 447, 447, 431, 866, 433, 435, -550, 438, 440, 441, 437, - -550, 446, 866, 453, 866, 866, 448, 449, 450, 452, 454, 455, 456, 458, 459, 461, - -550, 866, 466, -550, 866, 429, 451, -550, -550, 462, 463, -550, 464, -550, 465, -550, - -550, 866, 473, 478, -550, 467, -550, -550, 468, 469, 471, -550, 472, -550, -550, 866, - -550, 451, 474, -550, -550, -550, -550, 475, 866, 866, -550, -550, -550, -550, -550, 480, - 481, 482, -550, 483, 484, 487, 488, -550, 490, 491, -550, -550, -550, -550}; - -const short PipelineParserGen::yydefact_[] = { - 0, 0, 0, 0, 0, 6, 2, 68, 3, 340, 4, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8, 0, 10, 11, 12, 13, 14, 15, 5, 93, 82, 92, 89, 96, 90, 85, 87, - 88, 95, 83, 94, 97, 84, 91, 86, 67, 239, 75, 0, 74, 73, 72, 69, 122, 98, 100, - 99, 123, 105, 137, 101, 112, 138, 139, 124, 339, 106, 125, 126, 107, 108, 140, 141, 102, 127, - 128, 129, 109, 110, 142, 143, 130, 131, 111, 104, 103, 132, 144, 145, 146, 148, 147, 133, 149, - 150, 134, 76, 79, 80, 81, 78, 77, 153, 151, 152, 154, 155, 156, 135, 113, 114, 115, 116, - 117, 118, 157, 119, 120, 159, 158, 136, 121, 368, 369, 370, 367, 371, 0, 341, 0, 193, 192, - 191, 189, 188, 187, 181, 180, 179, 185, 184, 183, 178, 182, 186, 190, 19, 20, 21, 22, 24, - 26, 0, 23, 0, 0, 6, 195, 194, 161, 361, 364, 162, 160, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 163, 164, 205, 206, 207, 208, 209, 214, 210, 211, 212, 215, - 216, 71, 196, 197, 199, 200, 201, 213, 202, 203, 204, 356, 357, 358, 359, 198, 70, 349, 348, - 347, 346, 343, 342, 345, 344, 0, 350, 351, 17, 0, 0, 0, 9, 7, 361, 0, 0, 0, - 25, 0, 0, 64, 65, 66, 63, 27, 0, 0, 362, 360, 363, 0, 365, 336, 337, 0, 58, - 57, 54, 53, 56, 50, 49, 52, 42, 41, 44, 46, 45, 48, 217, 232, 43, 47, 51, 55, - 37, 38, 39, 40, 59, 60, 61, 30, 31, 32, 33, 34, 35, 36, 28, 62, 222, 223, 224, - 240, 241, 225, 274, 275, 276, 226, 352, 353, 229, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 301, 300, 227, 372, 373, 374, 375, 376, - 377, 378, 228, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 29, 16, 0, 366, 338, 219, 217, 220, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 0, 8, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8, 0, 0, 0, 0, 218, 230, 0, 0, 0, 0, 0, 0, 0, 217, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 314, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 314, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 314, 0, 0, 231, 0, 236, 237, 235, 238, - 233, 18, 259, 257, 277, 0, 258, 260, 379, 0, 0, 0, 0, 0, 0, 380, 262, 263, 381, - 382, 0, 0, 0, 264, 0, 266, 383, 384, 0, 0, 0, 0, 385, 0, 278, 0, 322, 0, - 323, 324, 0, 0, 0, 0, 0, 271, 0, 328, 329, 0, 0, 0, 0, 401, 402, 403, 404, - 405, 406, 334, 407, 408, 335, 0, 0, 409, 234, 0, 0, 0, 396, 303, 303, 0, 309, 309, - 0, 0, 315, 0, 0, 217, 0, 0, 319, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 221, 302, 354, 0, 398, 0, 305, 305, 0, 310, 0, 0, 355, 0, 0, 0, 0, - 279, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 397, 0, 0, - 304, 0, 396, 398, 261, 311, 0, 0, 265, 0, 267, 0, 269, 320, 0, 0, 0, 270, 0, - 327, 330, 0, 0, 0, 272, 0, 273, 399, 0, 306, 398, 0, 312, 313, 316, 268, 0, 0, - 0, 317, 331, 332, 333, 318, 0, 0, 0, 321, 0, 0, 0, 0, 308, 0, 0, 400, 307, - 326, 325}; - -const short PipelineParserGen::yypgoto_[] = { - -550, -550, -550, -204, -550, -14, 287, -13, -12, 306, -550, -550, -550, -550, -174, - -97, -68, -51, -9, -41, -8, -10, -4, -39, -34, -43, -64, -550, -30, -28, - -26, -550, -22, -11, 24, -44, -550, -550, -550, -550, -550, -550, 316, -550, -550, - -550, -550, -550, -550, -550, -550, 283, -6, 11, 41, -35, -343, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -173, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, - -550, -550, -550, -550, -550, -550, -550, -95, -549, -29, -60, -405, -550, -353, 315, - -25, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -18, -550}; - -const short PipelineParserGen::yydefgoto_[] = { - -1, 230, 489, 123, 49, 124, 125, 126, 127, 128, 235, 494, 242, 53, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 224, 192, 193, 194, 195, 196, 197, 198, 199, 200, 356, 202, 203, - 204, 226, 205, 6, 13, 22, 23, 24, 25, 26, 27, 28, 219, 280, 151, 357, 358, 429, 282, - 283, 421, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 458, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 595, 626, 597, 629, 523, 611, - 359, 225, 601, 8, 14, 206, 10, 15, 216, 217, 245, 129, 4, 459, 156}; - -const short PipelineParserGen::yytable_[] = { - 50, 51, 52, 155, 423, 201, 191, 149, 147, 148, 149, 147, 148, 150, 154, 231, 150, 7, 426, - 427, 5, 160, 1, 2, 3, 9, 54, 55, 56, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 57, 163, 456, 58, 59, 60, 61, 62, 63, 64, 266, 266, - 11, 65, 12, 537, 164, 130, 66, 67, 68, 69, 70, 71, 47, 72, 73, 134, 135, 136, 74, - 75, 76, 77, 503, 557, 658, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 29, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 672, 243, 103, 104, 105, 106, - 107, 108, 109, 201, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 267, - 267, 244, 16, 17, 18, 19, 20, 21, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 237, 145, 207, 208, 268, 268, 209, 210, 273, 273, 152, 131, 132, 133, - 153, 134, 135, 136, 46, 211, 212, 269, 269, 201, 47, 157, 213, 214, 137, 138, 139, 270, 270, - 271, 271, 140, 141, 142, 272, 272, 201, 354, 274, 274, 275, 275, 276, 276, 232, 234, 277, 277, - 218, 149, 147, 148, 215, 236, 220, 150, 490, 278, 278, 460, 461, 607, 54, 55, 56, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 57, 48, 221, 58, 59, - 60, 61, 62, 63, 64, 222, 279, 279, 65, 143, 144, 145, 146, 228, 67, 68, 69, 70, 71, - 229, 72, 73, 227, 281, 281, 74, 75, 76, 77, 352, 239, 353, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 355, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 424, 260, 103, 104, 105, 106, 107, 108, 109, 428, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 48, 432, 431, 433, 437, 443, 495, 444, 445, 438, 447, 452, 441, 442, - 453, 422, 455, 457, 464, 496, 449, 450, 434, 435, 436, 454, 466, 468, 471, 472, 473, 474, 486, - 497, 498, 500, 501, 502, 505, 451, 506, 507, 509, 425, 510, 511, 512, 430, 513, 462, 463, 517, - 465, 519, 520, 521, 439, 440, 522, 526, 528, 201, 504, 446, 530, 448, 531, 532, 533, 534, 535, - 562, 485, 201, 516, 539, 541, 542, 547, 491, 492, 493, 548, 467, 549, 469, 470, 550, 551, 552, - 553, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 554, 555, 487, 556, 559, 563, 570, 573, - 576, 582, 499, 589, 591, 594, 592, 593, 596, 599, 604, 508, 603, 606, 610, 608, 609, 514, 515, - 612, 613, 518, 614, 616, 617, 621, 524, 525, 625, 527, 628, 529, 623, 641, 631, 633, 223, 634, - 536, 638, 538, 635, 540, 636, 637, 543, 544, 545, 546, 639, 655, 644, 645, 646, 664, 647, 648, - 649, 650, 665, 558, 651, 652, 560, 653, 659, 660, 661, 662, 233, 666, 667, 668, 561, 669, 670, - 351, 673, 674, 564, 565, 566, 567, 677, 678, 679, 680, 681, 568, 569, 682, 683, 571, 684, 685, - 241, 572, 657, 574, 575, 598, 630, 238, 577, 0, 578, 0, 602, 579, 580, 581, 0, 583, 0, - 584, 0, 0, 585, 586, 587, 588, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 590, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 600, 600, 0, 0, 0, 605, 0, 0, 0, 0, - 0, 0, 0, 0, 615, 0, 0, 618, 619, 620, 0, 622, 0, 0, 0, 0, 624, 0, 627, - 0, 0, 0, 632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 640, 0, 642, 643, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 654, 0, 0, 656, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 671, 0, 0, 0, 0, 0, 0, 0, 0, 675, 676, 54, 55, 56, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 57, 0, 0, 58, 59, 60, 61, - 62, 63, 64, 0, 0, 0, 65, 0, 0, 0, 0, 240, 67, 68, 69, 70, 71, 47, 72, - 73, 0, 0, 0, 74, 75, 76, 77, 0, 0, 0, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 0, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, - 0, 103, 104, 105, 106, 107, 108, 109, 0, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 48, 158, 159, 0, 0, 0, 0, 0, 0, 0, 131, 132, 133, 0, 134, 135, - 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 137, 138, 139, 0, 0, 0, 0, 140, - 141, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, 162, 0, 0, 0, 0, 0, 0, 0, 163, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 143, 144, 145, 146, 175, 176, 177, 178, 179, 158, 159, 0, 0, - 0, 0, 0, 0, 0, 131, 132, 133, 0, 134, 135, 136, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 137, 138, 139, 0, 0, 0, 0, 140, 141, 142, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 260, 261, 0, 0, 0, 0, 0, 0, 0, 163, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 143, 144, - 145, 146, 175, 176, 177, 178, 179, 360, 361, 362, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 363, 0, 0, 364, 365, 366, 367, 368, 369, 370, 0, 0, - 0, 371, 0, 0, 0, 0, 0, 372, 373, 374, 375, 376, 0, 377, 378, 0, 0, 0, 379, - 380, 381, 382, 0, 0, 0, 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, 0, 392, 393, - 394, 395, 396, 397, 398, 399, 400, 0, 0, 0, 0, 0, 0, 0, 0, 401, 402, 403, 404, - 405, 406, 407, 0, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 246, 247, - 0, 0, 0, 0, 0, 0, 0, 248, 249, 250, 0, 251, 252, 253, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 254, 255, 256, 0, 0, 0, 0, 257, 258, 259, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 260, 261, 0, 0, 0, 0, 0, 0, 0, 163, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 262, 263, 264, 265, 175, 176, 177, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 488, 0, 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 97, 98, 99, 100, 101, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48}; - -const short PipelineParserGen::yycheck_[] = { - 14, 14, 14, 21, 357, 49, 49, 17, 17, 17, 20, 20, 20, 17, 20, 219, 20, 86, 361, - 362, 85, 69, 130, 131, 132, 86, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 94, 390, 25, 26, 27, 28, 29, 30, 31, 229, 230, - 0, 35, 86, 465, 109, 86, 40, 41, 42, 43, 44, 45, 46, 47, 48, 36, 37, 38, 52, - 53, 54, 55, 432, 485, 630, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 39, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 657, 69, 87, 88, 89, 90, - 91, 92, 93, 161, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 229, - 230, 94, 79, 80, 81, 82, 83, 84, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 221, 122, 32, 33, 229, 230, 36, 37, 229, 230, 86, 32, 33, 34, - 86, 36, 37, 38, 40, 49, 50, 229, 230, 224, 46, 40, 56, 57, 49, 50, 51, 229, 230, - 229, 230, 56, 57, 58, 229, 230, 241, 241, 229, 230, 229, 230, 229, 230, 219, 219, 229, 230, - 40, 220, 220, 220, 86, 220, 19, 220, 421, 229, 230, 393, 394, 575, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 108, 7, 25, 26, - 27, 28, 29, 30, 31, 86, 229, 230, 35, 120, 121, 122, 123, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 62, 229, 230, 52, 53, 54, 55, 40, 39, 16, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 40, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 39, 85, 87, 88, 89, 90, 91, 92, 93, 85, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 85, 365, 85, 85, 85, 40, 85, 85, 372, 85, 85, 375, 376, - 85, 353, 85, 85, 85, 40, 383, 384, 368, 369, 370, 388, 85, 85, 85, 85, 85, 85, 85, - 40, 40, 40, 40, 40, 12, 385, 9, 8, 40, 360, 40, 40, 40, 364, 40, 395, 396, 40, - 398, 40, 40, 40, 373, 374, 6, 40, 40, 433, 433, 380, 40, 382, 12, 40, 40, 10, 10, - 39, 418, 445, 445, 40, 40, 40, 40, 421, 421, 421, 40, 400, 40, 402, 403, 40, 40, 40, - 40, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 40, 40, 420, 40, 40, 39, 39, 12, - 39, 12, 428, 12, 39, 13, 40, 40, 11, 39, 39, 437, 40, 39, 15, 40, 39, 443, 444, - 12, 12, 447, 39, 39, 39, 39, 452, 453, 14, 455, 20, 457, 39, 17, 40, 39, 157, 39, - 464, 39, 466, 40, 468, 40, 40, 471, 472, 473, 474, 40, 21, 40, 40, 40, 18, 40, 39, - 39, 39, 18, 486, 40, 40, 489, 40, 40, 40, 40, 40, 219, 40, 40, 40, 499, 40, 40, - 230, 40, 40, 505, 506, 507, 508, 40, 40, 40, 40, 40, 514, 515, 40, 40, 518, 40, 40, - 226, 522, 629, 524, 525, 566, 598, 224, 529, -1, 531, -1, 569, 534, 535, 536, -1, 538, -1, - 540, -1, -1, 543, 544, 545, 546, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 558, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 568, 569, -1, -1, -1, 573, -1, -1, -1, -1, - -1, -1, -1, -1, 582, -1, -1, 585, 586, 587, -1, 589, -1, -1, -1, -1, 594, -1, 596, - -1, -1, -1, 600, -1, -1, -1, -1, -1, -1, -1, -1, -1, 610, -1, 612, 613, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 625, -1, -1, 628, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 641, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 655, -1, -1, -1, -1, -1, -1, -1, -1, 664, 665, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, 25, 26, 27, 28, - 29, 30, 31, -1, -1, -1, 35, -1, -1, -1, -1, 40, 41, 42, 43, 44, 45, 46, 47, - 48, -1, -1, -1, 52, 53, 54, 55, -1, -1, -1, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, -1, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, -1, - -1, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 23, 24, -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, -1, 36, 37, - 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, 50, 51, -1, -1, -1, -1, 56, - 57, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, 86, -1, -1, -1, -1, -1, -1, -1, 94, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 23, 24, -1, -1, - -1, -1, -1, -1, -1, 32, 33, 34, -1, 36, 37, 38, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 49, 50, 51, -1, -1, -1, -1, 56, 57, 58, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 85, 86, -1, -1, -1, -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, 25, 26, 27, 28, 29, 30, 31, -1, -1, - -1, 35, -1, -1, -1, -1, -1, 41, 42, 43, 44, 45, -1, 47, 48, -1, -1, -1, 52, - 53, 54, 55, -1, -1, -1, 59, 60, 61, -1, 63, 64, 65, 66, 67, 68, -1, 70, 71, - 72, 73, 74, 75, 76, 77, 78, -1, -1, -1, -1, -1, -1, -1, -1, 87, 88, 89, 90, - 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 23, 24, - -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, -1, 36, 37, 38, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 49, 50, 51, -1, -1, -1, -1, 56, 57, 58, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 85, 86, -1, -1, -1, -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 40, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 79, 80, 81, 82, 83, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108}; - -const short PipelineParserGen::yystos_[] = { - 0, 130, 131, 132, 278, 85, 174, 86, 269, 86, 272, 0, 86, 175, 270, 273, 79, 80, 81, - 82, 83, 84, 176, 177, 178, 179, 180, 181, 182, 39, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 40, 46, 108, 137, 138, 140, 141, 146, 3, 4, 5, - 22, 25, 26, 27, 28, 29, 30, 31, 35, 40, 41, 42, 43, 44, 45, 47, 48, 52, 53, - 54, 55, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 136, 138, 139, 140, 141, 142, 277, 86, 32, 33, - 34, 36, 37, 38, 49, 50, 51, 56, 57, 58, 120, 121, 122, 123, 151, 153, 154, 155, 185, - 86, 86, 185, 279, 280, 40, 23, 24, 69, 85, 86, 94, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 124, 125, 126, 127, 128, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 173, 271, 32, 33, - 36, 37, 49, 50, 56, 57, 86, 274, 275, 40, 183, 19, 7, 86, 175, 158, 267, 172, 62, - 40, 46, 134, 136, 138, 139, 140, 143, 185, 159, 267, 39, 40, 142, 145, 69, 94, 276, 23, - 24, 32, 33, 34, 36, 37, 38, 49, 50, 51, 56, 57, 58, 85, 86, 120, 121, 122, 123, - 147, 148, 149, 150, 152, 156, 157, 159, 161, 162, 163, 165, 166, 167, 184, 187, 189, 190, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 184, 40, 16, 158, 40, 168, 186, 187, 266, 3, - 4, 5, 22, 25, 26, 27, 28, 29, 30, 31, 35, 41, 42, 43, 44, 45, 47, 48, 52, - 53, 54, 55, 59, 60, 61, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 191, 154, 266, 39, 186, 189, 189, 85, 188, 186, 188, 85, 85, 279, 279, 279, - 85, 188, 186, 186, 188, 188, 85, 85, 85, 186, 85, 186, 188, 188, 279, 85, 85, 188, 85, - 189, 85, 212, 279, 212, 212, 279, 279, 85, 279, 85, 186, 85, 186, 186, 85, 85, 85, 85, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 279, 85, 186, 40, 135, 136, 138, 140, 141, - 144, 40, 40, 40, 40, 186, 40, 40, 40, 266, 158, 12, 9, 8, 186, 40, 40, 40, 40, - 40, 186, 186, 158, 40, 186, 40, 40, 40, 6, 264, 186, 186, 40, 186, 40, 186, 40, 12, - 40, 40, 10, 10, 186, 264, 186, 40, 186, 40, 40, 186, 186, 186, 186, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 264, 186, 40, 186, 186, 39, 39, 186, 186, 186, 186, 186, 186, - 39, 186, 186, 12, 186, 186, 39, 186, 186, 186, 186, 186, 12, 186, 186, 186, 186, 186, 186, - 12, 186, 39, 40, 40, 13, 260, 11, 262, 262, 39, 186, 268, 268, 40, 39, 186, 39, 266, - 40, 39, 15, 265, 12, 12, 39, 186, 39, 39, 186, 186, 186, 39, 186, 39, 186, 14, 261, - 186, 20, 263, 263, 40, 186, 39, 39, 40, 40, 40, 39, 40, 186, 17, 186, 186, 40, 40, - 40, 40, 39, 39, 39, 40, 40, 40, 186, 21, 186, 260, 261, 40, 40, 40, 40, 186, 18, - 18, 40, 40, 40, 40, 40, 186, 261, 40, 40, 186, 186, 40, 40, 40, 40, 40, 40, 40, - 40, 40}; - -const short PipelineParserGen::yyr1_[] = { - 0, 133, 278, 278, 278, 174, 175, 175, 280, 279, 176, 176, 176, 176, 176, 176, 182, 177, 178, - 185, 185, 185, 185, 179, 180, 181, 183, 183, 143, 143, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 134, 134, 134, 134, 269, 270, 270, 146, 271, 137, 137, 137, 140, - 136, 136, 136, 136, 136, 136, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, - 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 159, 159, 159, 160, 173, 161, 162, 163, 165, 166, 167, - 147, 148, 149, 150, 152, 156, 157, 151, 151, 151, 151, 153, 153, 153, 153, 154, 154, 154, 154, - 155, 155, 155, 155, 164, 164, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, - 168, 168, 168, 168, 168, 168, 168, 168, 266, 266, 186, 186, 188, 187, 187, 187, 187, 187, 187, - 187, 187, 189, 190, 191, 191, 144, 135, 135, 135, 135, 141, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 193, 194, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 195, 195, 195, 196, 197, 198, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 203, 262, - 262, 263, 263, 204, 205, 268, 268, 268, 206, 207, 264, 264, 208, 215, 225, 265, 265, 212, 209, - 210, 211, 213, 214, 216, 217, 218, 219, 220, 221, 222, 223, 224, 276, 276, 274, 272, 273, 273, - 275, 275, 275, 275, 275, 275, 275, 275, 277, 277, 199, 199, 200, 201, 158, 158, 169, 169, 170, - 267, 267, 171, 172, 172, 145, 142, 142, 142, 142, 142, 226, 226, 226, 226, 226, 226, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 260, 260, 261, - 261, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244}; - -const signed char PipelineParserGen::yyr2_[] = { - 0, 2, 2, 2, 2, 3, 0, 4, 0, 2, 1, 1, 1, 1, 1, 1, 5, 3, 7, 1, 1, 1, 1, 2, 2, 4, 0, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 0, 2, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 7, 4, 4, 4, 7, 4, 7, 8, 7, - 7, 4, 7, 7, 1, 1, 1, 4, 4, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 6, 0, 2, 0, 2, 11, 10, 0, 1, 2, 8, 8, 0, 2, 8, 8, 8, 0, 2, 7, 4, 4, 4, 11, 11, 7, 4, 4, - 7, 8, 8, 8, 4, 4, 1, 1, 4, 3, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 6, 6, 1, 1, 1, 1, - 3, 0, 2, 3, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 2, 0, 2, 11, 4, 4, 4, 4, 4, 4, 4, 4, 4}; - - -#if YYDEBUG || 1 -// YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. -// First, the terminals, then, starting at \a YYNTOKENS, nonterminals. -const char* const PipelineParserGen::yytname_[] = {"\"EOF\"", - "error", - "\"invalid token\"", - "ABS", - "ADD", - "AND", - "\"chars argument\"", - "\"coll argument\"", - "\"date argument\"", - "\"dateString argument\"", - "\"find argument\"", - "\"format argument\"", - "\"input argument\"", - "\"onError argument\"", - "\"onNull argument\"", - "\"options argument\"", - "\"pipeline argument\"", - "\"regex argument\"", - "\"replacement argument\"", - "\"size argument\"", - "\"timezone argument\"", - "\"to argument\"", - "ATAN2", - "\"false\"", - "\"true\"", - "CEIL", - "CMP", - "CONCAT", - "CONST_EXPR", - "CONVERT", - "DATE_FROM_STRING", - "DATE_TO_STRING", - "\"-1 (decimal)\"", - "\"1 (decimal)\"", - "\"zero (decimal)\"", - "DIVIDE", - "\"-1 (double)\"", - "\"1 (double)\"", - "\"zero (double)\"", - "\"end of array\"", - "\"end of object\"", - "EQ", - "EXPONENT", - "FLOOR", - "GT", - "GTE", - "ID", - "INDEX_OF_BYTES", - "INDEX_OF_CP", - "\"-1 (int)\"", - "\"1 (int)\"", - "\"zero (int)\"", - "LITERAL", - "LN", - "LOG", - "LOGTEN", - "\"-1 (long)\"", - "\"1 (long)\"", - "\"zero (long)\"", - "LT", - "LTE", - "LTRIM", - "META", - "MOD", - "MULTIPLY", - "NE", - "NOT", - "OR", - "POW", - "\"randVal\"", - "REGEX_FIND", - "REGEX_FIND_ALL", - "REGEX_MATCH", - "REPLACE_ALL", - "REPLACE_ONE", - "ROUND", - "RTRIM", - "SPLIT", - "SQRT", - "STAGE_INHIBIT_OPTIMIZATION", - "STAGE_LIMIT", - "STAGE_PROJECT", - "STAGE_SAMPLE", - "STAGE_SKIP", - "STAGE_UNION_WITH", - "\"array\"", - "\"object\"", - "STR_CASE_CMP", - "STR_LEN_BYTES", - "STR_LEN_CP", - "SUBSTR", - "SUBSTR_BYTES", - "SUBSTR_CP", - "SUBTRACT", - "\"textScore\"", - "TO_BOOL", - "TO_DATE", - "TO_DECIMAL", - "TO_DOUBLE", - "TO_INT", - "TO_LONG", - "TO_LOWER", - "TO_OBJECT_ID", - "TO_STRING", - "TO_UPPER", - "TRIM", - "TRUNC", - "TYPE", - "\"fieldname\"", - "\"string\"", - "\"BinData\"", - "\"undefined\"", - "\"ObjectID\"", - "\"Date\"", - "\"null\"", - "\"regex\"", - "\"dbPointer\"", - "\"Code\"", - "\"Symbol\"", - "\"CodeWScope\"", - "\"arbitrary integer\"", - "\"arbitrary long\"", - "\"arbitrary double\"", - "\"arbitrary decimal\"", - "\"Timestamp\"", - "\"minKey\"", - "\"maxKey\"", - "\"$-prefixed string\"", - "\"$$-prefixed string\"", - "\"$-prefixed fieldname\"", - "START_PIPELINE", - "START_MATCH", - "START_SORT", - "$accept", - "projectionFieldname", - "expressionFieldname", - "stageAsUserFieldname", - "filterFieldname", - "argAsUserFieldname", - "aggExprAsUserFieldname", - "invariableUserFieldname", - "idAsUserFieldname", - "valueFieldname", - "projectField", - "expressionField", - "valueField", - "filterField", - "dbPointer", - "javascript", - "symbol", - "javascriptWScope", - "int", - "timestamp", - "long", - "double", - "decimal", - "minKey", - "maxKey", - "value", - "string", - "fieldPath", - "binary", - "undefined", - "objectId", - "bool", - "date", - "null", - "regex", - "simpleValue", - "compoundValue", - "valueArray", - "valueObject", - "valueFields", - "variable", - "pipeline", - "stageList", - "stage", - "inhibitOptimization", - "unionWith", - "skip", - "limit", - "project", - "sample", - "projectFields", - "projection", - "num", - "expression", - "compoundExpression", - "exprFixedTwoArg", - "expressionArray", - "expressionObject", - "expressionFields", - "maths", - "add", - "atan2", - "boolExps", - "and", - "or", - "not", - "literalEscapes", - "const", - "literal", - "stringExps", - "concat", - "dateFromString", - "dateToString", - "indexOfBytes", - "indexOfCP", - "ltrim", - "regexFind", - "regexFindAll", - "regexMatch", - "regexArgs", - "replaceOne", - "replaceAll", - "rtrim", - "split", - "strLenBytes", - "strLenCP", - "strcasecmp", - "substr", - "substrBytes", - "substrCP", - "toLower", - "toUpper", - "trim", - "compExprs", - "cmp", - "eq", - "gt", - "gte", - "lt", - "lte", - "ne", - "typeExpression", - "convert", - "toBool", - "toDate", - "toDecimal", - "toDouble", - "toInt", - "toLong", - "toObjectId", - "toString", - "type", - "abs", - "ceil", - "divide", - "exponent", - "floor", - "ln", - "log", - "logten", - "mod", - "multiply", - "pow", - "round", - "sqrt", - "subtract", - "trunc", - "onErrorArg", - "onNullArg", - "formatArg", - "timezoneArg", - "charsArg", - "optionsArg", - "expressions", - "values", - "exprZeroToTwo", - "matchExpression", - "filterFields", - "filterVal", - "sortSpecs", - "specList", - "metaSort", - "oneOrNegOne", - "metaSortKeyword", - "sortSpec", - "start", - "START_ORDERED_OBJECT", - "$@1", - YY_NULLPTR}; -#endif - - -#if YYDEBUG -const short PipelineParserGen::yyrline_[] = { - 0, 297, 297, 301, 305, 312, 318, 319, 327, 327, 330, 330, 330, 330, 330, 330, - 333, 343, 349, 359, 359, 359, 359, 363, 368, 373, 389, 392, 399, 402, 408, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 422, 425, 428, 431, 434, 437, - 440, 443, 446, 449, 452, 455, 458, 461, 464, 467, 470, 473, 474, 475, 476, 485, - 485, 485, 485, 489, 495, 498, 504, 510, 515, 515, 515, 519, 527, 530, 533, 536, - 539, 542, 551, 554, 557, 560, 563, 566, 569, 572, 575, 578, 581, 584, 587, 590, - 593, 596, 604, 607, 610, 613, 616, 619, 622, 625, 628, 631, 634, 637, 640, 643, - 646, 649, 652, 655, 658, 661, 664, 667, 670, 673, 676, 679, 682, 685, 688, 691, - 694, 697, 700, 703, 706, 709, 712, 715, 718, 721, 724, 727, 730, 733, 736, 739, - 742, 745, 748, 751, 754, 757, 760, 763, 766, 769, 772, 775, 778, 781, 784, 787, - 794, 799, 802, 808, 816, 825, 831, 837, 843, 849, 855, 861, 867, 873, 879, 885, - 891, 897, 903, 906, 909, 912, 918, 921, 924, 927, 933, 936, 939, 942, 948, 951, - 954, 957, 963, 966, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, - 984, 985, 986, 987, 988, 989, 990, 991, 992, 999, 1000, 1007, 1007, 1011, 1016, 1016, - 1016, 1016, 1016, 1016, 1017, 1017, 1023, 1031, 1037, 1040, 1047, 1054, 1054, 1054, 1054, 1058, - 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1065, 1065, 1065, - 1065, 1069, 1076, 1082, 1087, 1092, 1098, 1103, 1108, 1113, 1119, 1124, 1130, 1139, 1145, 1151, - 1156, 1162, 1168, 1168, 1168, 1172, 1179, 1186, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1194, - 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1199, 1209, - 1212, 1218, 1221, 1227, 1236, 1245, 1248, 1251, 1257, 1268, 1279, 1282, 1288, 1296, 1304, 1312, - 1315, 1320, 1329, 1335, 1341, 1347, 1357, 1367, 1374, 1381, 1388, 1396, 1404, 1412, 1420, 1426, - 1432, 1435, 1441, 1447, 1452, 1455, 1462, 1465, 1468, 1471, 1474, 1477, 1480, 1483, 1488, 1490, - 1496, 1496, 1500, 1507, 1514, 1514, 1518, 1518, 1522, 1528, 1529, 1536, 1542, 1545, 1552, 1559, - 1560, 1561, 1562, 1563, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1568, 1573, 1578, 1583, 1588, - 1593, 1598, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1618, 1621, 1628, 1631, - 1637, 1647, 1652, 1657, 1662, 1667, 1672, 1677, 1682, 1687}; - -void PipelineParserGen::yy_stack_print_() const { - *yycdebug_ << "Stack now"; - for (stack_type::const_iterator i = yystack_.begin(), i_end = yystack_.end(); i != i_end; ++i) - *yycdebug_ << ' ' << int(i->state); - *yycdebug_ << '\n'; -} - -void PipelineParserGen::yy_reduce_print_(int yyrule) const { - int yylno = yyrline_[yyrule]; - int yynrhs = yyr2_[yyrule]; - // Print the symbols being reduced, and their result. - *yycdebug_ << "Reducing stack by rule " << yyrule - 1 << " (line " << yylno << "):\n"; - // The symbols being reduced. - for (int yyi = 0; yyi < yynrhs; yyi++) - YY_SYMBOL_PRINT(" $" << yyi + 1 << " =", yystack_[(yynrhs) - (yyi + 1)]); -} -#endif // YYDEBUG - - -#line 58 "pipeline_grammar.yy" -} // namespace mongo -#line 5920 "pipeline_parser_gen.cpp" - -#line 1691 "pipeline_grammar.yy" |