From b9909f81b7ae30f9641185e10fdd7dc21996e73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Edelbo?= Date: Tue, 19 Apr 2022 11:24:02 +0200 Subject: [PATCH 1/6] Possible solution to RCORE-1046 --- src/realm/parser/driver.cpp | 18 +- src/realm/parser/driver.hpp | 5 + src/realm/parser/generated/query_bison.cpp | 538 +++++---- src/realm/parser/generated/query_bison.hpp | 161 +-- src/realm/parser/generated/query_flex.cpp | 1202 ++++++++++---------- src/realm/parser/query_bison.yy | 17 +- src/realm/parser/query_flex.ll | 1 + src/realm/query_engine.hpp | 10 + src/realm/query_expression.hpp | 31 + src/realm/table.cpp | 4 +- test/test_parser.cpp | 20 +- 11 files changed, 1075 insertions(+), 932 deletions(-) diff --git a/src/realm/parser/driver.cpp b/src/realm/parser/driver.cpp index 651901dab7f..e76d16571f3 100644 --- a/src/realm/parser/driver.cpp +++ b/src/realm/parser/driver.cpp @@ -490,8 +490,9 @@ Query EqualityNode::visit(ParserDriver* drv) } else if (left_type == type_Link) { auto link_column = dynamic_cast*>(left.get()); - if (link_column && link_column->link_map().get_nb_hops() == 1 && link_column->get_comparison_type() && - *link_column->get_comparison_type() == ExpressionComparisonType::Any) { + if (link_column && link_column->link_map().get_nb_hops() == 1 && + link_column->get_comparison_type().value_or(ExpressionComparisonType::Any) == + ExpressionComparisonType::Any) { // We can use equal/not_equal and get a LinksToNode based query if (op == CompareNode::EQUAL) { return drv->m_base_table->where().equal(link_column->link_map().get_first_column_key(), val); @@ -939,6 +940,19 @@ std::unique_ptr ConstantNode::visit(ParserDriver* drv, DataType hint) { std::unique_ptr ret; std::string explain_value_message = text; + if (target_table.length()) { + const Group* g = drv->m_base_table->get_parent_group(); + TableKey table_key; + ObjKey obj_key; + if (auto table = g->get_table(target_table)) { + table_key = table->get_key(); + target_table = ""; + auto pk_val_node = visit(drv, hint); // call recursively + auto pk_val = pk_val_node->get_mixed(); + obj_key = table->find_primary_key(pk_val); + } + return std::make_unique>(ObjLink(table_key, ObjKey(obj_key))); + } switch (type) { case Type::NUMBER: { if (hint == type_Decimal) { diff --git a/src/realm/parser/driver.hpp b/src/realm/parser/driver.hpp index 5f57c693b63..d48e8a4c1dd 100644 --- a/src/realm/parser/driver.hpp +++ b/src/realm/parser/driver.hpp @@ -146,8 +146,13 @@ class ConstantNode : public ParserNode { , m_comp_type(comp_type) { } + void add_table(std::string table_name) + { + target_table = table_name.substr(1, table_name.size() - 2); + } std::unique_ptr visit(ParserDriver*, DataType); util::Optional m_comp_type; + std::string target_table; }; class ListNode : public ParserNode { diff --git a/src/realm/parser/generated/query_bison.cpp b/src/realm/parser/generated/query_bison.cpp index 87af555fba2..61b4d21bccc 100644 --- a/src/realm/parser/generated/query_bison.cpp +++ b/src/realm/parser/generated/query_bison.cpp @@ -199,6 +199,7 @@ namespace yy { break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key value.YY_MOVE_OR_COPY< ConstantNode* > (YY_MOVE (that.value)); break; @@ -287,6 +288,7 @@ namespace yy { case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" @@ -320,6 +322,7 @@ namespace yy { break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key value.move< ConstantNode* > (YY_MOVE (that.value)); break; @@ -408,6 +411,7 @@ namespace yy { case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" @@ -441,6 +445,7 @@ namespace yy { break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key value.copy< ConstantNode* > (that.value); break; @@ -529,6 +534,7 @@ namespace yy { case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" @@ -560,6 +566,7 @@ namespace yy { break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key value.move< ConstantNode* > (that.value); break; @@ -648,6 +655,7 @@ namespace yy { case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" @@ -875,6 +883,10 @@ namespace yy { { yyo << yysym.value.template as < std::string > (); } break; + case symbol_kind::SYM_OBJ: // "obj" + { yyo << yysym.value.template as < std::string > (); } + break; + case symbol_kind::SYM_SORT: // "sort" { yyo << yysym.value.template as < std::string > (); } break; @@ -907,51 +919,51 @@ namespace yy { { yyo << yysym.value.template as < std::string > (); } break; - case symbol_kind::SYM_55_: // '+' + case symbol_kind::SYM_56_: // '+' { yyo << "<>"; } break; - case symbol_kind::SYM_56_: // '-' + case symbol_kind::SYM_57_: // '-' { yyo << "<>"; } break; - case symbol_kind::SYM_57_: // '*' + case symbol_kind::SYM_58_: // '*' { yyo << "<>"; } break; - case symbol_kind::SYM_58_: // '/' + case symbol_kind::SYM_59_: // '/' { yyo << "<>"; } break; - case symbol_kind::SYM_59_: // '(' + case symbol_kind::SYM_60_: // '(' { yyo << "<>"; } break; - case symbol_kind::SYM_60_: // ')' + case symbol_kind::SYM_61_: // ')' { yyo << "<>"; } break; - case symbol_kind::SYM_61_: // '[' + case symbol_kind::SYM_62_: // '[' { yyo << "<>"; } break; - case symbol_kind::SYM_62_: // ']' + case symbol_kind::SYM_63_: // ']' { yyo << "<>"; } break; - case symbol_kind::SYM_63_: // '.' + case symbol_kind::SYM_64_: // '.' { yyo << "<>"; } break; - case symbol_kind::SYM_64_: // ',' + case symbol_kind::SYM_65_: // ',' { yyo << "<>"; } break; - case symbol_kind::SYM_65_: // '{' + case symbol_kind::SYM_66_: // '{' { yyo << "<>"; } break; - case symbol_kind::SYM_66_: // '}' + case symbol_kind::SYM_67_: // '}' { yyo << "<>"; } break; @@ -1027,6 +1039,10 @@ namespace yy { { yyo << yysym.value.template as < ConstantNode* > (); } break; + case symbol_kind::SYM_primary_key: // primary_key + { yyo << yysym.value.template as < ConstantNode* > (); } + break; + case symbol_kind::SYM_boolexpr: // boolexpr { yyo << yysym.value.template as < TrueOrFalseNode* > (); } break; @@ -1296,6 +1312,7 @@ namespace yy { break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key yylhs.value.emplace< ConstantNode* > (); break; @@ -1384,6 +1401,7 @@ namespace yy { case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" @@ -1619,8 +1637,8 @@ namespace yy { { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } break; - case 52: // constant: "number" - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } + case 52: // constant: primary_key + { yylhs.value.as < ConstantNode* > () = yystack_[0].value.as < ConstantNode* > (); } break; case 53: // constant: "infinity" @@ -1631,215 +1649,226 @@ namespace yy { { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NAN_VAL, yystack_[0].value.as < std::string > ()); } break; - case 55: // constant: "string" - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::STRING, yystack_[0].value.as < std::string > ()); } - break; - - case 56: // constant: "base64" + case 55: // constant: "base64" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::BASE64, yystack_[0].value.as < std::string > ()); } break; - case 57: // constant: "float" + case 56: // constant: "float" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::FLOAT, yystack_[0].value.as < std::string > ()); } break; - case 58: // constant: "date" + case 57: // constant: "date" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::TIMESTAMP, yystack_[0].value.as < std::string > ()); } break; - case 59: // constant: "UUID" - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::UUID_T, yystack_[0].value.as < std::string > ()); } - break; - - case 60: // constant: "ObjectId" - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::OID, yystack_[0].value.as < std::string > ()); } - break; - - case 61: // constant: "link" + case 58: // constant: "link" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::LINK, yystack_[0].value.as < std::string > ()); } break; - case 62: // constant: "typed link" + case 59: // constant: "typed link" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::TYPED_LINK, yystack_[0].value.as < std::string > ()); } break; - case 63: // constant: "true" + case 60: // constant: "true" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::TRUE, ""); } break; - case 64: // constant: "false" + case 61: // constant: "false" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::FALSE, ""); } break; - case 65: // constant: "null" + case 62: // constant: "null" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NULL_VAL, ""); } break; - case 66: // constant: "argument" + case 63: // constant: "argument" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::ARG, yystack_[0].value.as < std::string > ()); } break; - case 67: // constant: comp_type "argument" + case 64: // constant: comp_type "argument" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ExpressionComparisonType(yystack_[1].value.as < int > ()), yystack_[0].value.as < std::string > ()); } break; - case 68: // boolexpr: "truepredicate" + case 65: // constant: "obj" '(' "string" ',' primary_key ')' + { + auto tmp = yystack_[1].value.as < ConstantNode* > (); + tmp->add_table(yystack_[3].value.as < std::string > ()); + yylhs.value.as < ConstantNode* > () = tmp; } + break; + + case 66: // primary_key: "number" + { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } + break; + + case 67: // primary_key: "string" + { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::STRING, yystack_[0].value.as < std::string > ()); } + break; + + case 68: // primary_key: "UUID" + { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::UUID_T, yystack_[0].value.as < std::string > ()); } + break; + + case 69: // primary_key: "ObjectId" + { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::OID, yystack_[0].value.as < std::string > ()); } + break; + + case 70: // boolexpr: "truepredicate" { yylhs.value.as < TrueOrFalseNode* > () = drv.m_parse_nodes.create(true); } break; - case 69: // boolexpr: "falsepredicate" + case 71: // boolexpr: "falsepredicate" { yylhs.value.as < TrueOrFalseNode* > () = drv.m_parse_nodes.create(false); } break; - case 70: // comp_type: "any" + case 72: // comp_type: "any" { yylhs.value.as < int > () = int(ExpressionComparisonType::Any); } break; - case 71: // comp_type: "all" + case 73: // comp_type: "all" { yylhs.value.as < int > () = int(ExpressionComparisonType::All); } break; - case 72: // comp_type: "none" + case 74: // comp_type: "none" { yylhs.value.as < int > () = int(ExpressionComparisonType::None); } break; - case 73: // post_op: %empty + case 75: // post_op: %empty { yylhs.value.as < PostOpNode* > () = nullptr; } break; - case 74: // post_op: '.' "@size" + case 76: // post_op: '.' "@size" { yylhs.value.as < PostOpNode* > () = drv.m_parse_nodes.create(yystack_[0].value.as < std::string > (), PostOpNode::SIZE);} break; - case 75: // post_op: '.' "@type" + case 77: // post_op: '.' "@type" { yylhs.value.as < PostOpNode* > () = drv.m_parse_nodes.create(yystack_[0].value.as < std::string > (), PostOpNode::TYPE);} break; - case 76: // aggr_op: "@max" + case 78: // aggr_op: "@max" { yylhs.value.as < AggrNode* > () = drv.m_parse_nodes.create(AggrNode::MAX);} break; - case 77: // aggr_op: "@min" + case 79: // aggr_op: "@min" { yylhs.value.as < AggrNode* > () = drv.m_parse_nodes.create(AggrNode::MIN);} break; - case 78: // aggr_op: "@sun" + case 80: // aggr_op: "@sun" { yylhs.value.as < AggrNode* > () = drv.m_parse_nodes.create(AggrNode::SUM);} break; - case 79: // aggr_op: "@average" + case 81: // aggr_op: "@average" { yylhs.value.as < AggrNode* > () = drv.m_parse_nodes.create(AggrNode::AVG);} break; - case 80: // equality: "==" + case 82: // equality: "==" { yylhs.value.as < int > () = CompareNode::EQUAL; } break; - case 81: // equality: "!=" + case 83: // equality: "!=" { yylhs.value.as < int > () = CompareNode::NOT_EQUAL; } break; - case 82: // equality: "in" + case 84: // equality: "in" { yylhs.value.as < int > () = CompareNode::IN; } break; - case 83: // relational: "<" + case 85: // relational: "<" { yylhs.value.as < int > () = CompareNode::LESS; } break; - case 84: // relational: "<=" + case 86: // relational: "<=" { yylhs.value.as < int > () = CompareNode::LESS_EQUAL; } break; - case 85: // relational: ">" + case 87: // relational: ">" { yylhs.value.as < int > () = CompareNode::GREATER; } break; - case 86: // relational: ">=" + case 88: // relational: ">=" { yylhs.value.as < int > () = CompareNode::GREATER_EQUAL; } break; - case 87: // stringop: "beginswith" + case 89: // stringop: "beginswith" { yylhs.value.as < int > () = CompareNode::BEGINSWITH; } break; - case 88: // stringop: "endswith" + case 90: // stringop: "endswith" { yylhs.value.as < int > () = CompareNode::ENDSWITH; } break; - case 89: // stringop: "contains" + case 91: // stringop: "contains" { yylhs.value.as < int > () = CompareNode::CONTAINS; } break; - case 90: // stringop: "like" + case 92: // stringop: "like" { yylhs.value.as < int > () = CompareNode::LIKE; } break; - case 91: // path: %empty + case 93: // path: %empty { yylhs.value.as < PathNode* > () = drv.m_parse_nodes.create(); } break; - case 92: // path: path path_elem + case 94: // path: path path_elem { yystack_[1].value.as < PathNode* > ()->add_element(yystack_[0].value.as < std::string > ()); yylhs.value.as < PathNode* > () = yystack_[1].value.as < PathNode* > (); } break; - case 93: // path_elem: id '.' + case 95: // path_elem: id '.' { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > (); } break; - case 94: // id: "identifier" + case 96: // id: "identifier" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 95: // id: "@links" '.' "identifier" '.' "identifier" + case 97: // id: "@links" '.' "identifier" '.' "identifier" { yylhs.value.as < std::string > () = std::string("@links.") + yystack_[2].value.as < std::string > () + "." + yystack_[0].value.as < std::string > (); } break; - case 96: // id: "beginswith" + case 98: // id: "beginswith" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 97: // id: "endswith" + case 99: // id: "endswith" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 98: // id: "contains" + case 100: // id: "contains" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 99: // id: "like" + case 101: // id: "like" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 100: // id: "between" + case 102: // id: "between" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 101: // id: "key or value" + case 103: // id: "key or value" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 102: // id: "sort" + case 104: // id: "sort" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 103: // id: "distinct" + case 105: // id: "distinct" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 104: // id: "limit" + case 106: // id: "limit" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 105: // id: "ascending" + case 107: // id: "ascending" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 106: // id: "descending" + case 108: // id: "descending" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 107: // id: "in" + case 109: // id: "in" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; @@ -2191,166 +2220,174 @@ namespace yy { } - const signed char parser::yypact_ninf_ = -81; + const signed char parser::yypact_ninf_ = -83; const signed char parser::yytable_ninf_ = -1; const short parser::yypact_[] = { - 130, -81, -81, -39, -81, -81, -81, -81, -81, -81, - 130, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, 130, 389, 27, -13, -81, 84, - 136, -81, -81, -81, -81, -81, 5, 307, -81, -81, - -16, 19, -10, -81, 2, -81, 130, 130, 36, -81, - -81, -81, -81, -81, -81, -81, 206, 206, 206, 206, - 168, 206, -81, -81, -81, -81, 23, 244, -81, 389, - 340, 15, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, 3, -14, 340, -81, - -81, 389, -81, -81, 29, 4, 22, 28, -81, -81, - -81, 206, -23, -81, -23, -81, -81, 206, 58, 58, - -81, 41, 282, -81, 39, 44, 46, 16, -81, 389, - 97, -81, 340, 47, -81, -81, -81, 79, 71, 58, - -81, -81, 94, 37, -81, 60, -81, -81, 62, -81, - -81, -81, -81, 69, 80, -81, -42, 340, -41, 340, - 83, 124, 89, 340, 130, -81, -81, -37, -81, -81, - 47, -81, -81, 37, -81, -81, -8, 340, -81, -81, - -81, 340, 90, -37, 47, 103, -81, -81 + 136, -83, -83, -24, -83, -83, -83, -83, -83, -83, + 136, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -13, 136, 358, 24, -12, -83, + 194, 76, -83, -83, -83, -83, -83, -83, -29, 380, + -83, -83, 11, -16, 21, 19, -83, 14, -83, 136, + 136, 23, -83, -83, -83, -83, -83, -83, -83, 227, + 227, 227, 227, 182, 227, -83, -83, -83, -83, 2, + 273, -83, 358, 400, -6, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, 45, + 4, 400, 16, -83, -83, 358, -83, -83, 31, 6, + 51, 55, -83, -83, -83, 227, -30, -83, -30, -83, + -83, 227, 75, 75, -83, 56, 316, -83, 61, 36, + 65, -10, -83, 358, 70, -83, 400, 71, 77, -83, + -83, -83, 93, 40, 75, -83, -83, 109, 34, -83, + 73, -83, -83, 82, -83, -83, -83, -83, 74, 81, + -83, 86, -19, 400, -8, 400, 87, 122, 91, 400, + 136, -83, -83, -83, -37, -83, -83, 71, -83, -83, + 34, -83, -83, -2, 400, -83, -83, -83, 400, 92, + -37, 71, 97, -83, -83 }; const signed char parser::yydefact_[] = { - 91, 68, 69, 0, 63, 64, 65, 70, 71, 72, - 91, 55, 56, 53, 54, 51, 52, 57, 58, 59, - 60, 61, 62, 66, 91, 49, 0, 33, 3, 0, - 15, 22, 30, 23, 21, 8, 91, 0, 91, 6, - 0, 0, 0, 48, 0, 1, 91, 91, 2, 80, - 81, 83, 85, 86, 84, 82, 91, 91, 91, 91, - 91, 91, 87, 88, 89, 90, 0, 91, 67, 49, - 0, 73, 94, 96, 97, 98, 99, 100, 107, 102, - 103, 104, 105, 106, 101, 92, 73, 0, 0, 7, - 16, 0, 46, 5, 4, 0, 0, 0, 35, 34, - 36, 91, 19, 15, 20, 17, 18, 91, 9, 11, - 14, 0, 91, 12, 0, 0, 73, 0, 27, 0, - 93, 24, 0, 31, 50, 91, 91, 0, 0, 10, - 13, 47, 0, 93, 26, 0, 74, 75, 0, 76, - 77, 78, 79, 29, 0, 93, 0, 0, 0, 0, - 0, 0, 73, 0, 91, 40, 91, 0, 37, 91, - 38, 43, 95, 0, 25, 28, 0, 0, 44, 45, - 41, 0, 0, 0, 39, 0, 42, 32 + 93, 70, 71, 0, 60, 61, 62, 72, 73, 74, + 93, 67, 55, 53, 54, 51, 66, 56, 57, 68, + 69, 58, 59, 63, 0, 93, 49, 0, 33, 3, + 0, 15, 22, 30, 23, 21, 52, 8, 93, 0, + 93, 6, 0, 0, 0, 0, 48, 0, 1, 93, + 93, 2, 82, 83, 85, 87, 88, 86, 84, 93, + 93, 93, 93, 93, 93, 89, 90, 91, 92, 0, + 93, 64, 49, 0, 75, 96, 98, 99, 100, 101, + 102, 109, 104, 105, 106, 107, 108, 103, 94, 75, + 0, 0, 0, 7, 16, 0, 46, 5, 4, 0, + 0, 0, 35, 34, 36, 93, 19, 15, 20, 17, + 18, 93, 9, 11, 14, 0, 93, 12, 0, 0, + 75, 0, 27, 0, 95, 24, 0, 31, 0, 50, + 93, 93, 0, 0, 10, 13, 47, 0, 95, 26, + 0, 76, 77, 0, 78, 79, 80, 81, 29, 0, + 95, 0, 0, 0, 0, 0, 0, 0, 75, 0, + 93, 65, 40, 93, 0, 37, 93, 38, 43, 97, + 0, 25, 28, 0, 0, 44, 45, 41, 0, 0, + 0, 39, 0, 42, 32 }; const signed char parser::yypgoto_[] = { - -81, -81, -9, -81, 1, 0, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -2, 91, 113, -20, -81, - -18, -80, -81, -81, -81, -81, -34, -81, -67 + -83, -83, -9, -83, 1, 0, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -23, 89, 105, -20, 33, + -83, -21, -82, -83, -83, -83, -83, -36, -83, -70 }; const unsigned char parser::yydefgoto_[] = { - 0, 26, 27, 28, 29, 103, 31, 87, 32, 48, - 98, 148, 99, 146, 100, 170, 33, 42, 34, 35, - 36, 118, 143, 60, 61, 67, 37, 85, 86 + 0, 27, 28, 29, 30, 107, 32, 90, 33, 51, + 102, 154, 103, 152, 104, 177, 34, 45, 35, 36, + 37, 38, 122, 148, 63, 64, 70, 39, 88, 89 }; const unsigned char parser::yytable_[] = { - 30, 39, 70, 116, 88, 43, 121, 44, 46, 47, - 30, 46, 47, 168, 169, 40, 46, 47, 155, 158, - 38, 123, 156, 159, 30, 41, 145, 45, 49, 50, - 51, 52, 53, 54, 58, 59, 134, 93, 94, 7, - 8, 9, 68, 135, 89, 68, 30, 30, 111, 43, - 122, 44, 172, 46, 91, 144, 92, 102, 104, 105, - 106, 108, 109, 125, 119, 55, 120, 113, 136, 137, - 69, 124, 164, 44, 56, 57, 58, 59, 117, 90, - 157, 126, 160, 95, 96, 97, 165, 127, 25, 136, - 137, 147, 149, 49, 50, 51, 52, 53, 54, 138, - 173, 44, 128, 91, 174, 131, 69, 132, 129, 133, - 145, 150, 130, 56, 57, 58, 59, 139, 140, 141, - 142, 135, 167, 151, 152, 171, 56, 57, 58, 59, - 55, 90, 153, 1, 2, 3, 4, 5, 6, 56, - 57, 58, 59, 161, 154, 166, 7, 8, 9, 136, - 137, 162, 163, 175, 30, 177, 10, 110, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 176, 0, 3, 4, 5, 6, 62, 63, 64, - 65, 66, 114, 107, 7, 8, 9, 0, 0, 24, - 0, 0, 0, 0, 0, 25, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, - 0, 3, 4, 5, 6, 0, 0, 0, 0, 0, - 0, 0, 7, 8, 9, 0, 0, 101, 0, 0, - 0, 0, 0, 25, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 0, 0, 3, - 4, 5, 6, 0, 0, 0, 0, 0, 0, 112, - 7, 8, 9, 0, 0, 101, 0, 0, 0, 0, - 0, 25, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 0, 0, 3, 4, 5, - 6, 0, 0, 0, 0, 0, 0, 0, 7, 8, - 9, 0, 0, 0, 0, 0, 0, 0, 0, 25, + 31, 41, 73, 120, 91, 47, 46, 125, 49, 50, + 31, 71, 49, 50, 175, 176, 43, 140, 7, 8, + 9, 127, 49, 50, 48, 31, 44, 150, 61, 62, + 52, 53, 54, 55, 56, 57, 40, 72, 139, 92, + 97, 98, 162, 141, 142, 93, 163, 42, 115, 31, + 31, 47, 46, 165, 71, 49, 149, 166, 121, 179, + 106, 108, 109, 110, 112, 113, 130, 58, 26, 126, + 117, 99, 100, 101, 47, 129, 171, 59, 60, 61, + 62, 128, 94, 164, 95, 167, 96, 141, 142, 172, + 144, 145, 146, 147, 153, 155, 59, 60, 61, 62, + 137, 94, 47, 143, 180, 11, 133, 123, 181, 124, + 16, 131, 134, 19, 20, 132, 135, 65, 66, 67, + 68, 69, 72, 141, 142, 156, 95, 174, 136, 138, + 178, 59, 60, 61, 62, 150, 140, 157, 159, 1, + 2, 3, 4, 5, 6, 158, 160, 161, 168, 169, + 184, 173, 7, 8, 9, 170, 182, 183, 114, 0, + 31, 151, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 118, 0, 0, + 0, 0, 0, 24, 0, 0, 0, 3, 4, 5, + 6, 0, 0, 0, 0, 0, 25, 111, 7, 8, + 9, 0, 26, 52, 53, 54, 55, 56, 57, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 0, 0, 0, 71, 0, 0, 0, - 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 25, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 115, - 0, 84, 0, 0, 0, 0, 0, 72, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 0, 0, 84, 4, 5, 6, 0, 0, - 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 + 21, 22, 23, 0, 0, 0, 0, 0, 0, 24, + 0, 0, 3, 4, 5, 6, 0, 0, 0, 0, + 58, 0, 105, 7, 8, 9, 0, 0, 26, 0, + 59, 60, 61, 62, 0, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 0, 0, + 0, 0, 0, 0, 24, 0, 0, 0, 3, 4, + 5, 6, 0, 0, 0, 0, 0, 105, 116, 7, + 8, 9, 0, 26, 0, 0, 0, 0, 0, 0, + 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, + 24, 3, 4, 5, 6, 0, 0, 0, 0, 0, + 0, 0, 7, 8, 9, 0, 0, 0, 0, 26, + 0, 0, 0, 0, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 0, 0, 0, + 0, 0, 0, 24, 4, 5, 6, 0, 0, 0, + 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, + 0, 0, 26, 0, 0, 0, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 74, + 0, 0, 0, 0, 0, 24, 0, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 119, + 0, 76, 77, 78, 79, 80, 81, 75, 82, 83, + 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, + 0, 76, 77, 78, 79, 80, 81, 0, 82, 83, + 84, 85, 86, 0, 0, 87 }; const short parser::yycheck_[] = { - 0, 10, 36, 70, 38, 25, 86, 25, 24, 25, - 10, 24, 25, 50, 51, 24, 24, 25, 60, 60, - 59, 88, 64, 64, 24, 24, 63, 0, 9, 10, - 11, 12, 13, 14, 57, 58, 116, 46, 47, 16, - 17, 18, 40, 27, 60, 40, 46, 47, 66, 69, - 64, 69, 60, 24, 64, 122, 66, 56, 57, 58, - 59, 60, 61, 59, 61, 46, 63, 67, 52, 53, - 65, 91, 152, 91, 55, 56, 57, 58, 63, 60, - 147, 59, 149, 47, 48, 49, 153, 59, 65, 52, - 53, 125, 126, 9, 10, 11, 12, 13, 14, 119, - 167, 119, 101, 64, 171, 66, 65, 63, 107, 63, - 63, 32, 112, 55, 56, 57, 58, 20, 21, 22, - 23, 27, 156, 63, 62, 159, 55, 56, 57, 58, - 46, 60, 63, 3, 4, 5, 6, 7, 8, 55, - 56, 57, 58, 60, 64, 154, 16, 17, 18, 52, - 53, 27, 63, 63, 154, 52, 26, 66, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 173, -1, 5, 6, 7, 8, 41, 42, 43, - 44, 45, 69, 15, 16, 17, 18, -1, -1, 59, - -1, -1, -1, -1, -1, 65, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, - -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, - -1, -1, 16, 17, 18, -1, -1, 59, -1, -1, - -1, -1, -1, 65, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, -1, -1, 5, - 6, 7, 8, -1, -1, -1, -1, -1, -1, 15, - 16, 17, 18, -1, -1, 59, -1, -1, -1, -1, - -1, 65, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, -1, -1, 5, 6, 7, - 8, -1, -1, -1, -1, -1, -1, -1, 16, 17, - 18, -1, -1, -1, -1, -1, -1, -1, -1, 65, + 0, 10, 38, 73, 40, 26, 26, 89, 24, 25, + 10, 40, 24, 25, 51, 52, 25, 27, 16, 17, + 18, 91, 24, 25, 0, 25, 25, 64, 58, 59, + 9, 10, 11, 12, 13, 14, 60, 66, 120, 28, + 49, 50, 61, 53, 54, 61, 65, 60, 69, 49, + 50, 72, 72, 61, 40, 24, 126, 65, 64, 61, + 59, 60, 61, 62, 63, 64, 60, 46, 66, 65, + 70, 48, 49, 50, 95, 95, 158, 56, 57, 58, + 59, 65, 61, 153, 65, 155, 67, 53, 54, 159, + 20, 21, 22, 23, 130, 131, 56, 57, 58, 59, + 64, 61, 123, 123, 174, 28, 105, 62, 178, 64, + 33, 60, 111, 36, 37, 60, 116, 41, 42, 43, + 44, 45, 66, 53, 54, 32, 65, 163, 67, 64, + 166, 56, 57, 58, 59, 64, 27, 64, 64, 3, + 4, 5, 6, 7, 8, 63, 65, 61, 61, 27, + 53, 160, 16, 17, 18, 64, 64, 180, 69, -1, + 160, 128, 26, -1, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 72, -1, -1, + -1, -1, -1, 47, -1, -1, -1, 5, 6, 7, + 8, -1, -1, -1, -1, -1, 60, 15, 16, 17, + 18, -1, 66, 9, 10, 11, 12, 13, 14, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, -1, -1, -1, 19, -1, -1, -1, - -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 19, - -1, 54, -1, -1, -1, -1, -1, 27, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, -1, -1, 54, 6, 7, 8, -1, -1, - -1, -1, -1, -1, -1, 16, 17, 18, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 + 38, 39, 40, -1, -1, -1, -1, -1, -1, 47, + -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, + 46, -1, 60, 16, 17, 18, -1, -1, 66, -1, + 56, 57, 58, 59, -1, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, + -1, -1, -1, -1, 47, -1, -1, -1, 5, 6, + 7, 8, -1, -1, -1, -1, -1, 60, 15, 16, + 17, 18, -1, 66, -1, -1, -1, -1, -1, -1, + -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, + 47, 5, 6, 7, 8, -1, -1, -1, -1, -1, + -1, -1, 16, 17, 18, -1, -1, -1, -1, 66, + -1, -1, -1, -1, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, + -1, -1, -1, 47, 6, 7, 8, -1, -1, -1, + -1, -1, -1, -1, 16, 17, 18, -1, -1, -1, + -1, -1, 66, -1, -1, -1, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 19, + -1, -1, -1, -1, -1, 47, -1, 27, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, + -1, 41, 42, 43, 44, 45, 46, 27, 48, 49, + 50, 51, 52, -1, -1, 55, -1, -1, -1, -1, + -1, 41, 42, 43, 44, 45, 46, -1, 48, 49, + 50, 51, 52, -1, -1, 55 }; const signed char @@ -2358,38 +2395,39 @@ namespace yy { { 0, 3, 4, 5, 6, 7, 8, 16, 17, 18, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 59, 65, 68, 69, 70, 71, - 72, 73, 75, 83, 85, 86, 87, 93, 59, 69, - 69, 71, 84, 85, 87, 0, 24, 25, 76, 9, - 10, 11, 12, 13, 14, 46, 55, 56, 57, 58, - 90, 91, 41, 42, 43, 44, 45, 92, 40, 65, - 93, 19, 27, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 54, 94, 95, 74, 93, 60, - 60, 64, 66, 69, 69, 47, 48, 49, 77, 79, - 81, 59, 71, 72, 71, 71, 71, 15, 71, 71, - 83, 87, 15, 72, 84, 19, 95, 63, 88, 61, - 63, 88, 64, 95, 85, 59, 59, 59, 71, 71, - 72, 66, 63, 63, 88, 27, 52, 53, 85, 20, - 21, 22, 23, 89, 95, 63, 80, 93, 78, 93, - 32, 63, 62, 63, 64, 60, 64, 95, 60, 64, - 95, 60, 27, 63, 88, 95, 69, 93, 50, 51, - 82, 93, 60, 95, 95, 63, 82, 52 + 37, 38, 39, 40, 47, 60, 66, 69, 70, 71, + 72, 73, 74, 76, 84, 86, 87, 88, 89, 95, + 60, 70, 60, 70, 72, 85, 86, 89, 0, 24, + 25, 77, 9, 10, 11, 12, 13, 14, 46, 56, + 57, 58, 59, 92, 93, 41, 42, 43, 44, 45, + 94, 40, 66, 95, 19, 27, 41, 42, 43, 44, + 45, 46, 48, 49, 50, 51, 52, 55, 96, 97, + 75, 95, 28, 61, 61, 65, 67, 70, 70, 48, + 49, 50, 78, 80, 82, 60, 72, 73, 72, 72, + 72, 15, 72, 72, 84, 89, 15, 73, 85, 19, + 97, 64, 90, 62, 64, 90, 65, 97, 65, 86, + 60, 60, 60, 72, 72, 73, 67, 64, 64, 90, + 27, 53, 54, 86, 20, 21, 22, 23, 91, 97, + 64, 87, 81, 95, 79, 95, 32, 64, 63, 64, + 65, 61, 61, 65, 97, 61, 65, 97, 61, 27, + 64, 90, 97, 70, 95, 51, 52, 83, 95, 61, + 97, 97, 64, 83, 53 }; const signed char parser::yyr1_[] = { - 0, 67, 68, 69, 69, 69, 69, 69, 69, 70, - 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, - 71, 72, 72, 72, 73, 73, 73, 73, 73, 73, - 73, 74, 75, 76, 76, 76, 76, 77, 78, 78, - 79, 80, 80, 81, 82, 82, 83, 83, 84, 84, - 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, - 87, 87, 87, 88, 88, 88, 89, 89, 89, 89, - 90, 90, 90, 91, 91, 91, 91, 92, 92, 92, - 92, 93, 93, 94, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95 + 0, 68, 69, 70, 70, 70, 70, 70, 70, 71, + 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, + 72, 73, 73, 73, 74, 74, 74, 74, 74, 74, + 74, 75, 76, 77, 77, 77, 77, 78, 79, 79, + 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, + 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, + 88, 88, 89, 89, 89, 90, 90, 90, 91, 91, + 91, 91, 92, 92, 92, 93, 93, 93, 93, 94, + 94, 94, 94, 95, 95, 96, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97 }; const signed char @@ -2401,11 +2439,11 @@ namespace yy { 1, 2, 10, 0, 2, 2, 2, 4, 2, 4, 4, 3, 5, 4, 1, 1, 3, 4, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, - 1, 1, 1, 0, 2, 2, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 6, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 2, 2, 1, 5, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1 + 1, 1, 1, 0, 2, 2, 1, 5, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; @@ -2424,15 +2462,15 @@ namespace yy { "\"natural0\"", "\"number\"", "\"float\"", "\"date\"", "\"UUID\"", "\"ObjectId\"", "\"link\"", "\"typed link\"", "\"argument\"", "\"beginswith\"", "\"endswith\"", "\"contains\"", "\"like\"", - "\"between\"", "\"in\"", "\"sort\"", "\"distinct\"", "\"limit\"", - "\"ascending\"", "\"descending\"", "\"@size\"", "\"@type\"", + "\"between\"", "\"in\"", "\"obj\"", "\"sort\"", "\"distinct\"", + "\"limit\"", "\"ascending\"", "\"descending\"", "\"@size\"", "\"@type\"", "\"key or value\"", "'+'", "'-'", "'*'", "'/'", "'('", "')'", "'['", "']'", "'.'", "','", "'{'", "'}'", "$accept", "final", "query", "compare", "expr", "value", "prop", "simple_prop", "subquery", "post_query", "distinct", "distinct_param", "sort", "sort_param", - "limit", "direction", "list", "list_content", "constant", "boolexpr", - "comp_type", "post_op", "aggr_op", "equality", "relational", "stringop", - "path", "path_elem", "id", YY_NULLPTR + "limit", "direction", "list", "list_content", "constant", "primary_key", + "boolexpr", "comp_type", "post_op", "aggr_op", "equality", "relational", + "stringop", "path", "path_elem", "id", YY_NULLPTR }; #endif @@ -2441,17 +2479,17 @@ namespace yy { const short parser::yyrline_[] = { - 0, 148, 148, 151, 152, 153, 154, 155, 156, 159, - 160, 165, 166, 167, 172, 175, 176, 177, 178, 179, - 180, 183, 184, 185, 188, 189, 190, 191, 192, 193, - 194, 197, 200, 203, 204, 205, 206, 208, 211, 212, - 214, 217, 218, 220, 223, 224, 226, 227, 230, 231, - 232, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 255, 256, - 259, 260, 261, 264, 265, 266, 269, 270, 271, 272, - 275, 276, 277, 280, 281, 282, 283, 286, 287, 288, - 289, 292, 293, 296, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312 + 0, 149, 149, 152, 153, 154, 155, 156, 157, 160, + 161, 166, 167, 168, 173, 176, 177, 178, 179, 180, + 181, 184, 185, 186, 189, 190, 191, 192, 193, 194, + 195, 198, 201, 204, 205, 206, 207, 209, 212, 213, + 215, 218, 219, 221, 224, 225, 227, 228, 231, 232, + 233, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 256, 257, 258, 259, + 262, 263, 266, 267, 268, 271, 272, 273, 276, 277, + 278, 279, 282, 283, 284, 287, 288, 289, 290, 293, + 294, 295, 296, 299, 300, 303, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319 }; void diff --git a/src/realm/parser/generated/query_bison.hpp b/src/realm/parser/generated/query_bison.hpp index b4e92210336..6889e429434 100644 --- a/src/realm/parser/generated/query_bison.hpp +++ b/src/realm/parser/generated/query_bison.hpp @@ -430,6 +430,7 @@ namespace yy { char dummy1[sizeof (AggrNode*)]; // constant + // primary_key char dummy2[sizeof (ConstantNode*)]; // distinct @@ -503,6 +504,7 @@ namespace yy { // "like" // "between" // "in" + // "obj" // "sort" // "distinct" // "limit" @@ -604,14 +606,15 @@ namespace yy { TOK_LIKE = 299, // "like" TOK_BETWEEN = 300, // "between" TOK_IN = 301, // "in" - TOK_SORT = 302, // "sort" - TOK_DISTINCT = 303, // "distinct" - TOK_LIMIT = 304, // "limit" - TOK_ASCENDING = 305, // "ascending" - TOK_DESCENDING = 306, // "descending" - TOK_SIZE = 307, // "@size" - TOK_TYPE = 308, // "@type" - TOK_KEY_VAL = 309 // "key or value" + TOK_OBJ = 302, // "obj" + TOK_SORT = 303, // "sort" + TOK_DISTINCT = 304, // "distinct" + TOK_LIMIT = 305, // "limit" + TOK_ASCENDING = 306, // "ascending" + TOK_DESCENDING = 307, // "descending" + TOK_SIZE = 308, // "@size" + TOK_TYPE = 309, // "@type" + TOK_KEY_VAL = 310 // "key or value" }; /// Backward compatibility alias (Bison 3.6). typedef token_kind_type yytokentype; @@ -628,7 +631,7 @@ namespace yy { { enum symbol_kind_type { - YYNTOKENS = 67, ///< Number of tokens. + YYNTOKENS = 68, ///< Number of tokens. SYM_YYEMPTY = -2, SYM_YYEOF = 0, // "end of file" SYM_YYerror = 1, // error @@ -677,55 +680,57 @@ namespace yy { SYM_LIKE = 44, // "like" SYM_BETWEEN = 45, // "between" SYM_IN = 46, // "in" - SYM_SORT = 47, // "sort" - SYM_DISTINCT = 48, // "distinct" - SYM_LIMIT = 49, // "limit" - SYM_ASCENDING = 50, // "ascending" - SYM_DESCENDING = 51, // "descending" - SYM_SIZE = 52, // "@size" - SYM_TYPE = 53, // "@type" - SYM_KEY_VAL = 54, // "key or value" - SYM_55_ = 55, // '+' - SYM_56_ = 56, // '-' - SYM_57_ = 57, // '*' - SYM_58_ = 58, // '/' - SYM_59_ = 59, // '(' - SYM_60_ = 60, // ')' - SYM_61_ = 61, // '[' - SYM_62_ = 62, // ']' - SYM_63_ = 63, // '.' - SYM_64_ = 64, // ',' - SYM_65_ = 65, // '{' - SYM_66_ = 66, // '}' - SYM_YYACCEPT = 67, // $accept - SYM_final = 68, // final - SYM_query = 69, // query - SYM_compare = 70, // compare - SYM_expr = 71, // expr - SYM_value = 72, // value - SYM_prop = 73, // prop - SYM_simple_prop = 74, // simple_prop - SYM_subquery = 75, // subquery - SYM_post_query = 76, // post_query - SYM_distinct = 77, // distinct - SYM_distinct_param = 78, // distinct_param - SYM_sort = 79, // sort - SYM_sort_param = 80, // sort_param - SYM_limit = 81, // limit - SYM_direction = 82, // direction - SYM_list = 83, // list - SYM_list_content = 84, // list_content - SYM_constant = 85, // constant - SYM_boolexpr = 86, // boolexpr - SYM_comp_type = 87, // comp_type - SYM_post_op = 88, // post_op - SYM_aggr_op = 89, // aggr_op - SYM_equality = 90, // equality - SYM_relational = 91, // relational - SYM_stringop = 92, // stringop - SYM_path = 93, // path - SYM_path_elem = 94, // path_elem - SYM_id = 95 // id + SYM_OBJ = 47, // "obj" + SYM_SORT = 48, // "sort" + SYM_DISTINCT = 49, // "distinct" + SYM_LIMIT = 50, // "limit" + SYM_ASCENDING = 51, // "ascending" + SYM_DESCENDING = 52, // "descending" + SYM_SIZE = 53, // "@size" + SYM_TYPE = 54, // "@type" + SYM_KEY_VAL = 55, // "key or value" + SYM_56_ = 56, // '+' + SYM_57_ = 57, // '-' + SYM_58_ = 58, // '*' + SYM_59_ = 59, // '/' + SYM_60_ = 60, // '(' + SYM_61_ = 61, // ')' + SYM_62_ = 62, // '[' + SYM_63_ = 63, // ']' + SYM_64_ = 64, // '.' + SYM_65_ = 65, // ',' + SYM_66_ = 66, // '{' + SYM_67_ = 67, // '}' + SYM_YYACCEPT = 68, // $accept + SYM_final = 69, // final + SYM_query = 70, // query + SYM_compare = 71, // compare + SYM_expr = 72, // expr + SYM_value = 73, // value + SYM_prop = 74, // prop + SYM_simple_prop = 75, // simple_prop + SYM_subquery = 76, // subquery + SYM_post_query = 77, // post_query + SYM_distinct = 78, // distinct + SYM_distinct_param = 79, // distinct_param + SYM_sort = 80, // sort + SYM_sort_param = 81, // sort_param + SYM_limit = 82, // limit + SYM_direction = 83, // direction + SYM_list = 84, // list + SYM_list_content = 85, // list_content + SYM_constant = 86, // constant + SYM_primary_key = 87, // primary_key + SYM_boolexpr = 88, // boolexpr + SYM_comp_type = 89, // comp_type + SYM_post_op = 90, // post_op + SYM_aggr_op = 91, // aggr_op + SYM_equality = 92, // equality + SYM_relational = 93, // relational + SYM_stringop = 94, // stringop + SYM_path = 95, // path + SYM_path_elem = 96, // path_elem + SYM_id = 97 // id }; }; @@ -765,6 +770,7 @@ namespace yy { break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key value.move< ConstantNode* > (std::move (that.value)); break; @@ -853,6 +859,7 @@ namespace yy { case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" @@ -1136,6 +1143,7 @@ switch (yykind) break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key value.template destroy< ConstantNode* > (); break; @@ -1224,6 +1232,7 @@ switch (yykind) case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" @@ -2110,6 +2119,21 @@ switch (yykind) return symbol_type (token::TOK_IN, v); } #endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_OBJ (std::string v) + { + return symbol_type (token::TOK_OBJ, std::move (v)); + } +#else + static + symbol_type + make_OBJ (const std::string& v) + { + return symbol_type (token::TOK_OBJ, v); + } +#endif #if 201103L <= YY_CPLUSPLUS static symbol_type @@ -2558,9 +2582,9 @@ switch (yykind) /// Constants. enum { - yylast_ = 429, ///< Last index in yytable_. - yynnts_ = 29, ///< Number of nonterminal symbols. - yyfinal_ = 45 ///< Termination state number. + yylast_ = 455, ///< Last index in yytable_. + yynnts_ = 30, ///< Number of nonterminal symbols. + yyfinal_ = 48 ///< Termination state number. }; @@ -2584,15 +2608,15 @@ switch (yykind) 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 59, 60, 57, 55, 64, 56, 63, 58, 2, 2, + 60, 61, 58, 56, 65, 57, 64, 59, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 61, 2, 62, 2, 2, 2, 2, 2, 2, + 2, 62, 2, 63, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 65, 2, 66, 2, 2, 2, 2, + 2, 2, 2, 66, 2, 67, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -2610,10 +2634,11 @@ switch (yykind) 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54 + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55 }; // Last valid token kind. - const int code_max = 309; + const int code_max = 310; if (t <= 0) return symbol_kind::SYM_YYEOF; @@ -2636,6 +2661,7 @@ switch (yykind) break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key value.copy< ConstantNode* > (YY_MOVE (that.value)); break; @@ -2724,6 +2750,7 @@ switch (yykind) case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" @@ -2773,6 +2800,7 @@ switch (yykind) break; case symbol_kind::SYM_constant: // constant + case symbol_kind::SYM_primary_key: // primary_key value.move< ConstantNode* > (YY_MOVE (s.value)); break; @@ -2861,6 +2889,7 @@ switch (yykind) case symbol_kind::SYM_LIKE: // "like" case symbol_kind::SYM_BETWEEN: // "between" case symbol_kind::SYM_IN: // "in" + case symbol_kind::SYM_OBJ: // "obj" case symbol_kind::SYM_SORT: // "sort" case symbol_kind::SYM_DISTINCT: // "distinct" case symbol_kind::SYM_LIMIT: // "limit" diff --git a/src/realm/parser/generated/query_flex.cpp b/src/realm/parser/generated/query_flex.cpp index 7cdb47554ae..62f55567f24 100644 --- a/src/realm/parser/generated/query_flex.cpp +++ b/src/realm/parser/generated/query_flex.cpp @@ -501,8 +501,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ yyg->yy_c_buf_p = yy_cp; /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ -#define YY_NUM_RULES 62 -#define YY_END_OF_BUFFER 63 +#define YY_NUM_RULES 63 +#define YY_END_OF_BUFFER 64 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -510,50 +510,50 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[388] = +static const flex_int16_t yy_accept[390] = { 0, - 0, 0, 63, 61, 1, 2, 14, 61, 60, 61, - 61, 9, 3, 3, 9, 51, 51, 7, 4, 8, - 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 9, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 61, 61, 61, 61, 1, - 2, 6, 0, 58, 0, 60, 52, 0, 0, 0, - 0, 12, 0, 59, 0, 0, 53, 0, 0, 56, - 0, 56, 51, 0, 0, 55, 10, 4, 11, 0, - 0, 0, 0, 0, 0, 0, 0, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 5, - - 60, 60, 60, 60, 60, 60, 60, 49, 13, 60, - 60, 60, 0, 60, 60, 60, 60, 0, 60, 60, - 60, 60, 60, 60, 60, 60, 13, 60, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 56, 0, 56, - 0, 55, 54, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 16, 12, 15, 28, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 43, 0, 60, 60, - 44, 45, 60, 14, 60, 60, 60, 60, 0, 0, - 60, 60, 40, 60, 60, 60, 60, 60, 60, 0, - 0, 0, 0, 43, 44, 0, 56, 0, 35, 0, - - 0, 0, 32, 33, 0, 34, 0, 0, 60, 0, - 60, 60, 60, 29, 60, 60, 60, 60, 60, 50, - 21, 60, 17, 45, 25, 60, 0, 48, 41, 60, - 60, 0, 60, 0, 0, 0, 0, 0, 38, 0, - 31, 37, 0, 60, 57, 0, 60, 60, 60, 60, - 60, 60, 42, 60, 60, 27, 60, 60, 0, 0, - 0, 0, 0, 0, 36, 0, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 0, 0, 0, - 0, 39, 60, 60, 22, 60, 60, 60, 60, 60, - 60, 60, 60, 0, 0, 0, 0, 60, 60, 20, - - 60, 26, 19, 60, 43, 30, 60, 0, 0, 43, - 0, 28, 60, 60, 60, 60, 0, 0, 0, 18, - 29, 60, 60, 0, 0, 48, 60, 60, 0, 0, - 0, 60, 60, 0, 0, 48, 60, 23, 0, 0, - 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 62, 1, 2, 14, 62, 61, 62, + 62, 9, 3, 3, 9, 52, 52, 7, 4, 8, + 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 9, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 62, 62, 62, 62, 1, + 2, 6, 0, 59, 0, 61, 53, 0, 0, 0, + 0, 12, 0, 60, 0, 0, 54, 0, 0, 57, + 0, 57, 52, 0, 0, 56, 10, 4, 11, 0, + 0, 0, 0, 0, 0, 0, 0, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 5, + + 61, 61, 61, 61, 61, 61, 61, 50, 61, 13, + 61, 61, 61, 0, 61, 61, 61, 61, 0, 61, + 61, 61, 61, 61, 61, 61, 61, 13, 61, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, + 57, 0, 56, 55, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 16, 12, 15, 29, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 44, 0, 61, + 61, 45, 46, 61, 14, 61, 28, 61, 61, 61, + 0, 0, 61, 61, 41, 61, 61, 61, 61, 61, + 61, 0, 0, 0, 0, 44, 45, 0, 57, 0, + + 36, 0, 0, 0, 33, 34, 0, 35, 0, 0, + 61, 0, 61, 61, 61, 30, 61, 61, 61, 61, + 61, 51, 21, 61, 17, 46, 25, 61, 0, 49, + 42, 61, 61, 0, 61, 0, 0, 0, 0, 0, + 39, 0, 32, 38, 0, 61, 58, 0, 61, 61, + 61, 61, 61, 61, 43, 61, 61, 27, 61, 61, + 0, 0, 0, 0, 0, 0, 37, 0, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 0, + 0, 0, 0, 40, 61, 61, 22, 61, 61, 61, + 61, 61, 61, 61, 61, 0, 0, 0, 0, 61, + + 61, 20, 61, 26, 19, 61, 44, 31, 61, 0, + 0, 44, 0, 29, 61, 61, 61, 61, 0, 0, + 0, 18, 30, 61, 61, 0, 0, 49, 61, 61, + 0, 0, 0, 61, 61, 0, 0, 49, 61, 23, + 0, 0, 24, 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, 47, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 46, 0 + 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 47, 0 } ; static const YY_CHAR yy_ec[256] = @@ -566,147 +566,147 @@ static const YY_CHAR yy_ec[256] = 19, 20, 19, 21, 19, 19, 19, 22, 1, 23, 24, 25, 1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 36, 48, 49, 50, 36, - 51, 52, 53, 1, 54, 1, 55, 56, 57, 58, - - 59, 60, 61, 62, 63, 36, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 14, 80, 14, 1, 1, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 1, 1, 82, 82, 82, 82, 82, 82, 82, - - 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 84, - 84, 84, 84, 84, 84, 84, 84, 1, 1, 1, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 48, + 52, 53, 54, 1, 55, 1, 56, 57, 58, 59, + + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 14, 82, 14, 1, 1, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 1, 1, 84, 84, 84, 84, 84, 84, 84, + + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, + 86, 86, 86, 86, 86, 86, 86, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[85] = +static const YY_CHAR yy_meta[87] = { 0, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 2, 1, 3, 1, 2, 4, 4, 4, 4, 1, 1, 2, 1, 1, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 1, 3, 1, 3, 4, 4, 4, 4, 4, 4, + 5, 1, 3, 1, 3, 4, 4, 4, 4, 4, + 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, - 1, 3, 3, 3 + 5, 1, 1, 3, 3, 3 } ; -static const flex_int16_t yy_base[457] = +static const flex_int16_t yy_base[459] = { 0, - 0, 0, 668, 1764, 83, 663, 641, 80, 70, 655, - 83, 1764, 1764, 77, 81, 88, 108, 86, 90, 638, - 105, 121, 99, 133, 155, 139, 145, 73, 158, 212, - 208, 232, 215, 287, 604, 273, 227, 277, 281, 284, - 327, 331, 344, 337, 260, 579, 575, 574, 570, 114, - 627, 1764, 132, 1764, 416, 112, 379, 207, 548, 544, - 543, 1764, 124, 1764, 426, 331, 420, 54, 165, 386, - 429, 435, 486, 495, 0, 1764, 1764, 1764, 1764, 548, - 551, 558, 551, 79, 139, 535, 553, 436, 473, 469, - 481, 476, 489, 502, 495, 516, 544, 528, 538, 549, - - 555, 622, 552, 605, 608, 612, 615, 629, 294, 632, - 626, 649, 439, 703, 707, 683, 687, 553, 691, 710, - 698, 731, 694, 751, 754, 747, 1764, 665, 524, 516, - 0, 514, 513, 0, 176, 96, 805, 1764, 824, 828, - 832, 836, 0, 531, 509, 504, 508, 493, 482, 469, - 478, 474, 473, 780, 788, 808, 827, 815, 830, 852, - 843, 849, 856, 870, 878, 892, 906, 855, 914, 920, - 865, 911, 925, 928, 940, 934, 954, 976, 1011, 1029, - 982, 1004, 1764, 1000, 1009, 991, 1017, 1026, 1037, 456, - 0, 455, 0, 191, 1764, 900, 1084, 1093, 1764, 467, - - 460, 466, 1764, 1764, 470, 1764, 468, 450, 1066, 506, - 1075, 1086, 1070, 1103, 1108, 1099, 1115, 1125, 1121, 1110, - 1111, 1150, 1128, 1137, 1154, 1166, 1196, 1206, 1187, 1193, - 1199, 0, 1190, 0, 0, 179, 1234, 436, 1764, 420, - 1764, 1764, 432, 1227, 1764, 479, 1214, 1232, 1243, 1250, - 1253, 1266, 1261, 1270, 1288, 1276, 1310, 1294, 0, 0, - 0, 0, 209, 1361, 1764, 412, 1321, 1315, 1334, 1343, - 1338, 1356, 1360, 1363, 1377, 1380, 1397, 0, 0, 188, - 1447, 1764, 1418, 1436, 1305, 1431, 1442, 1458, 1455, 1464, - 1477, 1480, 1491, 0, 0, 195, 1434, 1517, 1499, 1470, - - 1504, 1483, 1524, 1527, 1532, 1537, 1542, 0, 0, 1764, - 1609, 1550, 1561, 1585, 1600, 1607, 0, 0, 1454, 1565, - 1588, 1621, 1624, 0, 0, 1635, 1633, 1628, 0, 0, - 1472, 1640, 1650, 0, 0, 1572, 1662, 1613, 0, 466, - 1646, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 462, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 460, 0, 0, 0, 0, 0, 0, 0, 0, 462, - 456, 1764, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 459, 1764, 1764, 1746, 1749, 1754, - 465, 463, 461, 460, 448, 1758, 438, 433, 426, 425, - - 420, 419, 412, 399, 389, 388, 384, 383, 382, 380, - 376, 369, 368, 349, 337, 333, 331, 326, 324, 323, - 322, 320, 319, 318, 316, 313, 297, 289, 284, 283, - 281, 277, 273, 266, 265, 264, 262, 261, 255, 253, - 244, 220, 208, 205, 195, 185, 183, 171, 146, 145, - 142, 141, 139, 137, 127, 101 + 0, 0, 691, 1762, 85, 686, 653, 82, 72, 662, + 85, 1762, 1762, 79, 83, 90, 111, 88, 92, 643, + 78, 109, 139, 120, 149, 134, 112, 126, 161, 208, + 213, 231, 226, 288, 605, 260, 283, 268, 278, 295, + 330, 338, 343, 348, 179, 579, 577, 575, 567, 116, + 646, 1762, 122, 1762, 429, 303, 389, 212, 564, 559, + 556, 1762, 113, 1762, 434, 218, 439, 119, 159, 458, + 319, 493, 507, 448, 0, 1762, 1762, 1762, 1762, 561, + 566, 557, 552, 77, 100, 512, 534, 455, 491, 477, + 499, 463, 518, 448, 512, 521, 529, 534, 541, 538, + + 568, 612, 598, 588, 602, 622, 618, 625, 640, 364, + 674, 664, 646, 591, 715, 719, 667, 708, 535, 689, + 727, 724, 712, 730, 773, 776, 595, 1762, 735, 498, + 495, 0, 490, 486, 0, 209, 202, 812, 1762, 819, + 824, 829, 845, 0, 498, 480, 475, 477, 466, 474, + 456, 468, 460, 453, 783, 803, 817, 823, 829, 840, + 843, 859, 865, 884, 887, 893, 902, 921, 853, 905, + 928, 909, 913, 949, 931, 958, 955, 969, 973, 977, + 859, 1051, 992, 1007, 1762, 1020, 1015, 1026, 1029, 1043, + 1049, 432, 0, 414, 0, 218, 1762, 879, 1065, 1098, + + 1762, 427, 420, 426, 1762, 1762, 425, 1762, 424, 405, + 1067, 474, 1085, 1090, 1103, 1108, 1096, 1113, 1124, 1142, + 1132, 1126, 1056, 1137, 1079, 1147, 1150, 1166, 1186, 1219, + 1172, 1188, 1193, 0, 1176, 0, 0, 217, 1245, 397, + 1762, 397, 1762, 1762, 405, 1217, 1762, 458, 1222, 1237, + 1234, 1240, 1246, 1275, 1258, 1263, 1282, 1228, 1302, 1292, + 0, 0, 0, 0, 227, 1264, 1762, 388, 1305, 1321, + 1310, 1331, 1345, 1327, 1357, 1349, 1372, 1375, 1392, 0, + 0, 244, 1418, 1762, 1410, 1416, 1400, 1419, 1435, 1422, + 1428, 1456, 1464, 1471, 1480, 0, 0, 269, 1333, 1485, + + 1477, 1474, 1514, 1490, 1493, 1538, 1500, 1519, 1553, 0, + 0, 1762, 1574, 1527, 1556, 1548, 1567, 1592, 0, 0, + 1516, 1562, 1572, 1601, 1608, 0, 0, 1647, 1617, 1629, + 0, 0, 1608, 1635, 1652, 0, 0, 1677, 1658, 1638, + 0, 441, 1646, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 439, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 438, 0, 0, 0, 0, 0, 0, 0, + 0, 434, 429, 1762, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 430, 1762, 1762, 1744, + 1747, 1752, 435, 433, 432, 427, 426, 1756, 422, 421, + + 416, 414, 408, 401, 400, 399, 395, 394, 393, 389, + 381, 374, 372, 371, 367, 366, 356, 354, 351, 347, + 346, 338, 331, 329, 324, 322, 321, 319, 318, 279, + 276, 274, 272, 270, 264, 254, 252, 240, 227, 218, + 217, 213, 204, 203, 196, 187, 185, 181, 178, 177, + 173, 163, 159, 133, 120, 119, 103, 92 } ; -static const flex_int16_t yy_def[457] = +static const flex_int16_t yy_def[459] = { 0, - 387, 1, 387, 387, 387, 387, 387, 388, 389, 387, - 390, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 389, 389, 389, 389, 389, 389, 389, 389, 389, - 389, 389, 389, 389, 387, 389, 389, 389, 389, 389, - 389, 389, 389, 389, 389, 387, 387, 387, 387, 387, - 387, 387, 388, 387, 387, 389, 389, 387, 387, 387, - 387, 387, 390, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 391, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 389, 389, 389, + 389, 1, 389, 389, 389, 389, 389, 390, 391, 389, + 392, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 391, 391, 391, 391, 391, 391, 391, 391, 391, + 391, 391, 391, 391, 389, 391, 391, 391, 391, 391, + 391, 391, 391, 391, 391, 389, 389, 389, 389, 389, + 389, 389, 390, 389, 389, 391, 391, 389, 389, 389, + 389, 389, 392, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 393, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 391, 391, 391, + 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, + + 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, + 391, 391, 391, 389, 391, 391, 391, 391, 389, 391, + 391, 391, 391, 391, 391, 391, 391, 389, 391, 389, + 389, 394, 389, 389, 395, 389, 389, 389, 389, 389, + 389, 389, 389, 393, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 391, 391, 391, 391, 391, 391, + 391, 391, 391, 391, 391, 391, 391, 391, 389, 391, + 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, + 389, 389, 391, 391, 389, 391, 391, 391, 391, 391, + 391, 389, 396, 389, 397, 389, 389, 389, 389, 389, + + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 391, 398, 391, 391, 391, 391, 391, 391, 391, 391, + 391, 389, 391, 391, 391, 391, 391, 391, 389, 389, + 391, 391, 391, 399, 391, 400, 401, 389, 389, 389, + 389, 389, 389, 389, 389, 391, 389, 398, 391, 391, + 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, + 402, 403, 404, 405, 389, 389, 389, 389, 391, 391, + 391, 391, 391, 391, 391, 391, 391, 391, 391, 406, + 407, 389, 389, 389, 391, 391, 391, 391, 391, 391, + 391, 391, 391, 391, 391, 408, 409, 389, 389, 391, + + 391, 391, 391, 391, 391, 391, 391, 391, 391, 410, + 411, 389, 389, 391, 391, 391, 391, 391, 412, 413, + 389, 391, 391, 391, 391, 414, 415, 389, 391, 391, + 416, 417, 389, 391, 391, 418, 419, 389, 391, 391, + 420, 389, 391, 421, 422, 423, 424, 425, 426, 427, + 428, 429, 389, 430, 431, 432, 433, 434, 435, 436, + 437, 438, 389, 439, 440, 441, 442, 443, 444, 445, + 446, 389, 389, 389, 447, 448, 449, 450, 451, 452, + 453, 454, 455, 456, 457, 458, 389, 389, 0, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - 389, 389, 387, 389, 389, 389, 389, 387, 389, 389, - 389, 389, 389, 389, 389, 389, 387, 389, 387, 387, - 392, 387, 387, 393, 387, 387, 387, 387, 387, 387, - 387, 387, 391, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 389, 389, 389, 389, 389, 389, 389, - 389, 389, 389, 389, 389, 389, 389, 387, 389, 389, - 389, 389, 389, 389, 389, 389, 389, 389, 387, 387, - 389, 389, 387, 389, 389, 389, 389, 389, 389, 387, - 394, 387, 395, 387, 387, 387, 387, 387, 387, 387, - - 387, 387, 387, 387, 387, 387, 387, 387, 389, 396, - 389, 389, 389, 389, 389, 389, 389, 389, 389, 387, - 389, 389, 389, 389, 389, 389, 387, 387, 389, 389, - 389, 397, 389, 398, 399, 387, 387, 387, 387, 387, - 387, 387, 387, 389, 387, 396, 389, 389, 389, 389, - 389, 389, 389, 389, 389, 389, 389, 389, 400, 401, - 402, 403, 387, 387, 387, 387, 389, 389, 389, 389, - 389, 389, 389, 389, 389, 389, 389, 404, 405, 387, - 387, 387, 389, 389, 389, 389, 389, 389, 389, 389, - 389, 389, 389, 406, 407, 387, 387, 389, 389, 389, - - 389, 389, 389, 389, 389, 389, 389, 408, 409, 387, - 387, 389, 389, 389, 389, 389, 410, 411, 387, 389, - 389, 389, 389, 412, 413, 387, 389, 389, 414, 415, - 387, 389, 389, 416, 417, 387, 389, 389, 418, 387, - 389, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 387, 428, 429, 430, 431, 432, 433, 434, 435, 436, - 387, 437, 438, 439, 440, 441, 442, 443, 444, 387, - 387, 387, 445, 446, 447, 448, 449, 450, 451, 452, - 453, 454, 455, 456, 387, 387, 0, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387 + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389 } ; static const flex_int16_t yy_nxt[1849] = @@ -716,204 +716,204 @@ static const flex_int16_t yy_nxt[1849] = 17, 4, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 28, 28, 30, 28, 31, 32, 28, 28, 28, 33, 34, 28, 28, 28, 28, - 35, 4, 12, 28, 36, 37, 24, 25, 26, 38, - 28, 28, 39, 28, 40, 28, 41, 42, 28, 28, - 28, 43, 44, 45, 28, 28, 28, 28, 28, 46, - 4, 47, 48, 49, 50, 54, 50, 57, 57, 57, - 57, 64, 66, 135, 67, 67, 67, 67, 70, 70, - - 70, 70, 71, 72, 385, 73, 73, 73, 73, 77, - 52, 68, 77, 78, 79, 50, 69, 50, 74, 92, - 135, 58, 71, 72, 58, 73, 73, 73, 73, 93, - 384, 55, 64, 148, 65, 195, 75, 54, 74, 68, - 383, 149, 382, 69, 381, 380, 74, 76, 379, 378, - 58, 59, 60, 61, 59, 60, 61, 93, 88, 80, - 89, 81, 195, 58, 75, 90, 74, 76, 82, 83, - 84, 98, 58, 94, 377, 65, 85, 86, 97, 87, - 59, 60, 61, 55, 58, 95, 376, 91, 375, 96, - 58, 136, 90, 59, 60, 61, 58, 100, 374, 99, - - 94, 150, 59, 60, 61, 97, 58, 194, 371, 58, - 56, 370, 151, 95, 59, 60, 61, 96, 263, 136, - 59, 60, 61, 369, 101, 236, 59, 60, 61, 102, - 102, 102, 102, 296, 104, 194, 59, 60, 61, 59, - 60, 61, 105, 280, 310, 263, 103, 368, 106, 108, - 108, 108, 108, 236, 107, 110, 367, 93, 366, 58, - 296, 111, 104, 58, 365, 364, 58, 362, 361, 360, - 105, 280, 310, 56, 103, 109, 359, 56, 58, 56, - 358, 107, 112, 58, 357, 93, 356, 355, 111, 59, - 60, 61, 354, 59, 60, 61, 59, 60, 61, 113, - - 352, 114, 109, 99, 115, 115, 115, 115, 59, 60, - 61, 58, 91, 59, 60, 61, 351, 90, 103, 350, - 101, 349, 348, 347, 58, 346, 345, 344, 58, 342, - 116, 121, 58, 126, 340, 58, 339, 119, 58, 120, - 335, 59, 60, 61, 90, 58, 103, 100, 70, 70, - 70, 70, 334, 104, 59, 60, 61, 117, 59, 60, - 61, 105, 59, 60, 61, 59, 60, 61, 59, 60, - 61, 330, 329, 107, 109, 59, 60, 61, 58, 325, - 117, 104, 58, 324, 112, 318, 317, 309, 58, 105, - 111, 308, 295, 123, 122, 58, 57, 57, 57, 57, - - 107, 109, 294, 70, 70, 70, 70, 125, 59, 60, - 61, 124, 59, 60, 61, 63, 137, 111, 59, 60, - 61, 53, 53, 279, 53, 59, 60, 61, 278, 262, - 58, 63, 53, 53, 63, 72, 261, 67, 67, 67, - 67, 259, 63, 63, 137, 138, 139, 139, 139, 139, - 74, 235, 140, 140, 140, 140, 179, 179, 179, 179, - 59, 60, 61, 234, 193, 137, 191, 53, 143, 386, - 373, 53, 372, 154, 363, 53, 353, 63, 74, 76, - 343, 63, 53, 282, 245, 63, 53, 58, 53, 131, - 266, 265, 63, 137, 138, 158, 63, 157, 63, 134, - - 71, 72, 155, 73, 73, 73, 73, 141, 241, 141, - 155, 245, 142, 142, 142, 142, 74, 59, 60, 61, - 58, 159, 156, 243, 58, 157, 242, 58, 241, 240, - 155, 239, 58, 238, 160, 56, 128, 208, 155, 162, - 58, 161, 207, 206, 74, 76, 58, 205, 204, 159, - 59, 60, 61, 58, 59, 60, 61, 59, 60, 61, - 163, 160, 59, 60, 61, 165, 162, 58, 161, 203, - 59, 60, 61, 164, 202, 166, 59, 60, 61, 58, - 167, 201, 200, 59, 60, 61, 167, 163, 169, 58, - 170, 199, 166, 192, 56, 58, 190, 59, 60, 61, - - 58, 164, 166, 58, 128, 183, 58, 153, 167, 59, - 60, 61, 152, 147, 167, 169, 146, 170, 145, 59, - 60, 61, 144, 133, 132, 59, 60, 61, 56, 51, - 59, 60, 61, 59, 60, 61, 59, 60, 61, 102, - 102, 102, 102, 168, 171, 172, 108, 108, 108, 108, - 130, 173, 175, 178, 129, 128, 58, 174, 127, 58, - 118, 79, 62, 58, 52, 51, 58, 387, 387, 387, - 176, 171, 172, 58, 387, 177, 387, 58, 387, 175, - 58, 178, 387, 58, 387, 387, 59, 60, 61, 59, - 60, 61, 177, 59, 60, 61, 59, 60, 61, 387, - - 58, 387, 177, 59, 60, 61, 387, 59, 60, 61, - 59, 60, 61, 59, 60, 61, 58, 387, 387, 177, - 115, 115, 115, 115, 115, 115, 115, 115, 180, 181, - 59, 60, 61, 182, 58, 166, 387, 387, 58, 155, - 387, 387, 58, 387, 387, 58, 59, 60, 61, 58, - 387, 186, 387, 387, 58, 154, 182, 387, 58, 387, - 182, 58, 184, 387, 59, 60, 61, 155, 59, 60, - 61, 387, 59, 60, 61, 59, 60, 61, 387, 59, - 60, 61, 58, 387, 59, 60, 61, 156, 59, 60, - 61, 59, 60, 61, 177, 387, 387, 185, 58, 387, - - 182, 387, 58, 174, 387, 58, 387, 387, 387, 189, - 387, 387, 59, 60, 61, 387, 187, 196, 387, 196, - 210, 177, 197, 197, 197, 197, 387, 188, 59, 60, - 61, 58, 59, 60, 61, 59, 60, 61, 198, 58, - 387, 139, 139, 139, 139, 140, 140, 140, 140, 142, - 142, 142, 142, 142, 142, 142, 142, 209, 137, 58, - 387, 59, 60, 61, 211, 387, 58, 387, 387, 59, - 60, 61, 220, 220, 220, 220, 387, 214, 58, 387, - 387, 58, 387, 387, 387, 209, 137, 138, 213, 59, - 60, 61, 211, 387, 58, 76, 59, 60, 61, 212, - - 58, 215, 387, 58, 387, 214, 387, 58, 59, 60, - 61, 59, 60, 61, 216, 213, 58, 197, 197, 197, - 197, 58, 217, 387, 59, 60, 61, 212, 215, 58, - 59, 60, 61, 59, 60, 61, 218, 59, 60, 61, - 219, 216, 387, 58, 221, 387, 59, 60, 61, 218, - 387, 59, 60, 61, 222, 223, 387, 58, 387, 59, - 60, 61, 58, 218, 156, 58, 387, 387, 219, 387, - 387, 58, 221, 59, 60, 61, 58, 224, 387, 58, - 387, 387, 222, 387, 387, 58, 387, 59, 60, 61, - 387, 58, 59, 60, 61, 59, 60, 61, 387, 225, - - 232, 59, 60, 61, 224, 58, 59, 60, 61, 59, - 60, 61, 229, 387, 387, 59, 60, 61, 226, 387, - 387, 59, 60, 61, 387, 387, 225, 58, 179, 179, - 179, 179, 180, 58, 230, 59, 60, 61, 387, 387, - 230, 227, 58, 227, 218, 226, 228, 228, 228, 228, - 387, 58, 387, 387, 387, 58, 230, 59, 60, 61, - 58, 387, 230, 59, 60, 61, 387, 223, 58, 387, - 387, 231, 59, 60, 61, 156, 387, 58, 387, 387, - 387, 59, 60, 61, 229, 59, 60, 61, 58, 387, - 59, 60, 61, 387, 233, 387, 249, 387, 59, 60, - - 61, 197, 197, 197, 197, 244, 387, 59, 60, 61, - 237, 237, 237, 237, 247, 387, 248, 58, 59, 60, - 61, 58, 387, 387, 249, 387, 58, 220, 220, 220, - 220, 387, 244, 250, 387, 387, 387, 58, 387, 387, - 387, 247, 251, 138, 248, 253, 252, 59, 60, 61, - 58, 59, 60, 61, 58, 254, 59, 60, 61, 58, - 255, 250, 58, 387, 387, 387, 58, 59, 60, 61, - 251, 387, 58, 254, 252, 387, 58, 387, 387, 58, - 59, 60, 61, 254, 59, 60, 61, 255, 58, 59, - 60, 61, 59, 60, 61, 256, 59, 60, 61, 260, - - 387, 58, 59, 60, 61, 58, 59, 60, 61, 59, - 60, 61, 257, 228, 228, 228, 228, 58, 59, 60, - 61, 387, 256, 228, 228, 228, 228, 387, 258, 254, - 387, 59, 60, 61, 258, 59, 60, 61, 58, 257, - 387, 58, 387, 387, 58, 387, 387, 59, 60, 61, - 58, 237, 237, 237, 237, 258, 267, 253, 268, 264, - 387, 258, 269, 387, 387, 58, 387, 387, 59, 60, - 61, 59, 60, 61, 59, 60, 61, 270, 58, 264, - 59, 60, 61, 58, 267, 268, 387, 387, 387, 271, - 269, 387, 272, 387, 58, 59, 60, 61, 387, 387, - - 273, 58, 274, 387, 58, 270, 387, 387, 59, 60, - 61, 274, 58, 59, 60, 61, 271, 58, 387, 272, - 387, 58, 275, 387, 59, 60, 61, 58, 273, 274, - 387, 59, 60, 61, 59, 60, 61, 277, 274, 58, - 276, 387, 59, 60, 61, 58, 387, 59, 60, 61, - 275, 59, 60, 61, 387, 283, 58, 59, 60, 61, - 387, 58, 284, 387, 277, 387, 58, 287, 276, 59, - 60, 61, 58, 285, 387, 59, 60, 61, 281, 281, - 281, 281, 286, 283, 288, 58, 59, 60, 61, 58, - 284, 59, 60, 61, 58, 287, 59, 60, 61, 387, - - 285, 387, 59, 60, 61, 289, 290, 58, 387, 286, - 387, 58, 288, 387, 58, 59, 60, 61, 387, 59, - 60, 61, 291, 292, 59, 60, 61, 293, 58, 387, - 387, 58, 289, 290, 387, 387, 387, 59, 60, 61, - 387, 59, 60, 61, 59, 60, 61, 387, 58, 291, - 292, 311, 311, 311, 311, 293, 387, 298, 59, 60, - 61, 59, 60, 61, 281, 281, 281, 281, 297, 58, - 299, 326, 326, 326, 326, 300, 301, 387, 59, 60, - 61, 387, 58, 387, 298, 387, 387, 58, 303, 336, - 336, 336, 336, 58, 304, 387, 387, 387, 299, 59, - - 60, 61, 300, 302, 301, 387, 58, 387, 387, 58, - 387, 387, 59, 60, 61, 58, 303, 59, 60, 61, - 307, 58, 304, 59, 60, 61, 305, 387, 58, 306, - 302, 58, 387, 387, 58, 387, 59, 60, 61, 59, - 60, 61, 58, 314, 313, 59, 60, 61, 307, 312, - 58, 59, 60, 61, 305, 58, 315, 306, 59, 60, - 61, 59, 60, 61, 59, 60, 61, 387, 58, 387, - 314, 313, 59, 60, 61, 58, 316, 312, 58, 387, - 59, 60, 61, 58, 315, 59, 60, 61, 58, 336, - 336, 336, 336, 58, 320, 387, 387, 387, 59, 60, - - 61, 58, 387, 387, 316, 59, 60, 61, 59, 60, - 61, 387, 58, 59, 60, 61, 58, 321, 59, 60, - 61, 387, 320, 59, 60, 61, 311, 311, 311, 311, - 319, 59, 60, 61, 322, 323, 58, 387, 387, 58, - 387, 387, 59, 60, 61, 321, 59, 60, 61, 327, - 328, 58, 326, 326, 326, 326, 331, 387, 58, 332, - 387, 387, 322, 323, 58, 387, 59, 60, 61, 59, - 60, 61, 58, 333, 387, 58, 387, 327, 328, 58, - 338, 59, 60, 61, 58, 337, 387, 332, 59, 60, - 61, 58, 341, 387, 59, 60, 61, 58, 387, 387, - - 333, 58, 59, 60, 61, 59, 60, 61, 338, 59, - 60, 61, 337, 58, 59, 60, 61, 387, 387, 387, - 341, 59, 60, 61, 387, 387, 387, 59, 60, 61, - 387, 59, 60, 61, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 59, 60, 61, 53, 53, 53, 53, - 53, 56, 56, 56, 63, 63, 63, 63, 63, 246, - 387, 246, 246, 3, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387 + 28, 35, 4, 12, 28, 36, 37, 24, 25, 26, + 38, 28, 28, 39, 28, 28, 40, 28, 41, 42, + 28, 28, 28, 43, 44, 45, 28, 28, 28, 28, + 28, 46, 4, 47, 48, 49, 50, 54, 50, 57, + 57, 57, 57, 64, 66, 387, 67, 67, 67, 67, + + 70, 70, 70, 70, 71, 72, 386, 73, 73, 73, + 73, 77, 52, 68, 77, 78, 79, 50, 69, 50, + 74, 64, 385, 384, 58, 71, 72, 54, 73, 73, + 73, 73, 149, 80, 55, 81, 383, 65, 98, 75, + 150, 74, 68, 82, 83, 84, 88, 69, 89, 74, + 76, 85, 86, 90, 87, 59, 60, 61, 136, 92, + 94, 58, 382, 151, 58, 65, 381, 99, 75, 93, + 74, 76, 58, 97, 55, 152, 380, 91, 58, 95, + 379, 378, 90, 96, 377, 137, 58, 136, 376, 94, + 373, 58, 59, 60, 61, 59, 60, 61, 93, 372, + + 100, 58, 97, 59, 60, 61, 371, 370, 95, 59, + 60, 61, 96, 58, 137, 56, 369, 59, 60, 61, + 368, 367, 59, 60, 61, 102, 102, 102, 102, 101, + 366, 58, 59, 60, 61, 70, 70, 70, 70, 104, + 196, 197, 103, 364, 59, 60, 61, 105, 108, 108, + 108, 108, 238, 106, 127, 363, 265, 362, 109, 107, + 58, 282, 59, 60, 61, 58, 111, 361, 104, 196, + 197, 103, 112, 360, 110, 359, 105, 358, 58, 357, + 56, 238, 356, 58, 56, 265, 56, 109, 107, 298, + 282, 59, 60, 61, 99, 113, 59, 60, 61, 91, + + 114, 112, 115, 110, 90, 116, 116, 116, 116, 59, + 60, 61, 58, 93, 59, 60, 61, 101, 298, 312, + 58, 354, 353, 122, 352, 351, 120, 350, 121, 103, + 58, 117, 349, 90, 348, 58, 140, 140, 140, 140, + 58, 347, 93, 59, 60, 61, 100, 58, 312, 346, + 344, 59, 60, 61, 342, 58, 104, 341, 103, 337, + 118, 59, 60, 61, 105, 109, 59, 60, 61, 336, + 332, 59, 60, 61, 331, 327, 107, 326, 59, 60, + 61, 110, 58, 113, 320, 104, 59, 60, 61, 112, + 58, 118, 319, 105, 109, 58, 311, 310, 297, 123, + + 58, 124, 296, 63, 53, 107, 57, 57, 57, 57, + 110, 281, 125, 59, 60, 61, 58, 280, 112, 264, + 126, 59, 60, 61, 263, 261, 59, 60, 61, 237, + 236, 59, 60, 61, 53, 195, 193, 53, 144, 63, + 388, 58, 63, 375, 374, 53, 53, 59, 60, 61, + 63, 63, 365, 355, 72, 345, 67, 67, 67, 67, + 142, 284, 142, 247, 268, 143, 143, 143, 143, 74, + 267, 243, 59, 60, 61, 70, 70, 70, 70, 247, + 245, 53, 159, 244, 243, 53, 63, 162, 138, 53, + 63, 242, 155, 241, 63, 240, 56, 53, 74, 76, + + 58, 53, 63, 53, 132, 158, 63, 58, 63, 135, + 141, 141, 141, 141, 129, 58, 162, 138, 139, 210, + 156, 71, 72, 138, 73, 73, 73, 73, 156, 58, + 209, 59, 60, 61, 158, 208, 207, 74, 59, 60, + 61, 157, 206, 58, 205, 204, 59, 60, 61, 156, + 160, 58, 138, 139, 203, 202, 163, 156, 165, 201, + 59, 60, 61, 161, 58, 164, 74, 76, 194, 168, + 58, 166, 56, 58, 59, 60, 61, 192, 167, 160, + 129, 58, 59, 60, 61, 163, 58, 165, 185, 154, + 58, 153, 161, 58, 164, 59, 60, 61, 168, 168, + + 167, 59, 60, 61, 59, 60, 61, 167, 181, 181, + 181, 181, 59, 60, 61, 148, 147, 59, 60, 61, + 58, 59, 60, 61, 59, 60, 61, 172, 168, 102, + 102, 102, 102, 169, 170, 146, 171, 145, 134, 173, + 58, 133, 108, 108, 108, 108, 56, 58, 51, 131, + 58, 59, 60, 61, 58, 176, 172, 130, 191, 129, + 128, 174, 119, 170, 58, 171, 79, 175, 173, 62, + 58, 59, 60, 61, 58, 177, 52, 58, 59, 60, + 61, 59, 60, 61, 176, 59, 60, 61, 51, 179, + 389, 180, 58, 389, 389, 59, 60, 61, 58, 389, + + 389, 59, 60, 61, 177, 59, 60, 61, 59, 60, + 61, 389, 178, 183, 389, 389, 58, 179, 179, 58, + 180, 389, 389, 59, 60, 61, 58, 389, 389, 59, + 60, 61, 116, 116, 116, 116, 116, 116, 116, 116, + 182, 58, 184, 389, 389, 389, 179, 59, 60, 61, + 59, 60, 61, 389, 184, 155, 156, 59, 60, 61, + 58, 167, 389, 389, 58, 389, 389, 58, 389, 389, + 389, 58, 59, 60, 61, 389, 58, 389, 389, 58, + 187, 389, 58, 184, 389, 156, 175, 58, 188, 389, + 186, 59, 60, 61, 389, 59, 60, 61, 59, 60, + + 61, 389, 59, 60, 61, 389, 157, 59, 60, 61, + 59, 60, 61, 59, 60, 61, 179, 389, 59, 60, + 61, 389, 184, 389, 198, 58, 198, 389, 58, 199, + 199, 199, 199, 200, 212, 58, 140, 140, 140, 140, + 189, 141, 141, 141, 141, 179, 143, 143, 143, 143, + 389, 190, 389, 211, 138, 58, 59, 60, 61, 59, + 60, 61, 143, 143, 143, 143, 59, 60, 61, 58, + 222, 222, 222, 222, 213, 58, 181, 181, 181, 181, + 182, 58, 211, 138, 139, 389, 59, 60, 61, 389, + 389, 214, 58, 216, 389, 58, 199, 199, 199, 199, + + 59, 60, 61, 213, 215, 76, 59, 60, 61, 389, + 389, 58, 59, 60, 61, 389, 389, 58, 389, 389, + 214, 389, 216, 59, 60, 61, 59, 60, 61, 217, + 389, 218, 389, 215, 389, 223, 58, 219, 389, 58, + 389, 389, 59, 60, 61, 58, 220, 389, 59, 60, + 61, 389, 389, 389, 58, 221, 389, 58, 217, 389, + 218, 58, 224, 389, 223, 58, 220, 59, 60, 61, + 59, 60, 61, 58, 389, 220, 59, 60, 61, 225, + 58, 389, 389, 58, 221, 59, 60, 61, 59, 60, + 61, 224, 59, 60, 61, 226, 59, 60, 61, 157, + + 389, 58, 389, 389, 59, 60, 61, 58, 389, 389, + 58, 59, 60, 61, 59, 60, 61, 389, 227, 228, + 389, 58, 231, 389, 226, 58, 389, 389, 389, 58, + 389, 389, 59, 60, 61, 234, 389, 232, 59, 60, + 61, 59, 60, 61, 58, 389, 389, 227, 228, 389, + 389, 232, 59, 60, 61, 389, 59, 60, 61, 58, + 59, 60, 61, 229, 220, 229, 232, 58, 230, 230, + 230, 230, 58, 232, 225, 59, 60, 61, 58, 389, + 389, 58, 199, 199, 199, 199, 389, 389, 157, 389, + 59, 60, 61, 233, 389, 58, 389, 389, 59, 60, + + 61, 58, 231, 59, 60, 61, 246, 235, 58, 59, + 60, 61, 59, 60, 61, 239, 239, 239, 239, 58, + 250, 389, 389, 389, 249, 139, 59, 60, 61, 251, + 253, 58, 59, 60, 61, 246, 389, 58, 252, 59, + 60, 61, 58, 222, 222, 222, 222, 389, 58, 250, + 59, 60, 61, 249, 255, 58, 389, 389, 251, 253, + 58, 254, 59, 60, 61, 58, 389, 252, 59, 60, + 61, 257, 256, 59, 60, 61, 58, 389, 389, 59, + 60, 61, 258, 256, 58, 262, 59, 60, 61, 58, + 254, 59, 60, 61, 58, 389, 59, 60, 61, 58, + + 257, 256, 58, 230, 230, 230, 230, 59, 60, 61, + 389, 258, 259, 260, 389, 59, 60, 61, 58, 389, + 59, 60, 61, 256, 58, 59, 60, 61, 58, 260, + 59, 60, 61, 59, 60, 61, 230, 230, 230, 230, + 58, 259, 260, 389, 389, 58, 269, 389, 389, 59, + 60, 61, 255, 389, 389, 59, 60, 61, 260, 59, + 60, 61, 239, 239, 239, 239, 270, 271, 272, 58, + 266, 59, 60, 61, 58, 269, 59, 60, 61, 273, + 58, 283, 283, 283, 283, 274, 58, 389, 389, 58, + 266, 389, 58, 389, 389, 270, 271, 272, 58, 276, + + 59, 60, 61, 389, 276, 59, 60, 61, 273, 275, + 58, 59, 60, 61, 274, 58, 277, 59, 60, 61, + 59, 60, 61, 59, 60, 61, 389, 58, 276, 59, + 60, 61, 278, 276, 58, 279, 389, 389, 275, 285, + 389, 59, 60, 61, 58, 277, 59, 60, 61, 287, + 313, 313, 313, 313, 58, 290, 389, 58, 59, 60, + 61, 278, 58, 389, 279, 59, 60, 61, 285, 286, + 288, 389, 389, 58, 289, 59, 60, 61, 287, 58, + 389, 389, 389, 58, 290, 59, 60, 61, 59, 60, + 61, 389, 292, 59, 60, 61, 389, 58, 286, 288, + + 389, 58, 291, 289, 59, 60, 61, 389, 389, 58, + 59, 60, 61, 389, 59, 60, 61, 293, 294, 389, + 389, 292, 295, 389, 58, 389, 389, 58, 59, 60, + 61, 291, 59, 60, 61, 283, 283, 283, 283, 299, + 59, 60, 61, 389, 58, 389, 293, 294, 389, 300, + 301, 295, 58, 389, 389, 59, 60, 61, 59, 60, + 61, 305, 58, 302, 389, 389, 389, 304, 58, 303, + 389, 58, 389, 389, 58, 59, 60, 61, 300, 301, + 58, 389, 389, 59, 60, 61, 306, 58, 389, 389, + 305, 389, 302, 59, 60, 61, 304, 389, 303, 59, + + 60, 61, 59, 60, 61, 59, 60, 61, 58, 309, + 389, 59, 60, 61, 307, 306, 58, 314, 59, 60, + 61, 308, 315, 58, 389, 389, 58, 389, 389, 58, + 389, 389, 58, 328, 328, 328, 328, 58, 309, 59, + 60, 61, 58, 307, 389, 58, 314, 59, 60, 61, + 308, 315, 58, 316, 59, 60, 61, 59, 60, 61, + 59, 60, 61, 59, 60, 61, 58, 317, 59, 60, + 61, 58, 389, 59, 60, 61, 59, 60, 61, 58, + 323, 389, 316, 59, 60, 61, 389, 318, 389, 322, + 58, 313, 313, 313, 313, 321, 317, 59, 60, 61, + + 58, 324, 59, 60, 61, 58, 389, 389, 58, 323, + 59, 60, 61, 389, 58, 389, 318, 389, 322, 58, + 325, 59, 60, 61, 58, 338, 338, 338, 338, 329, + 324, 59, 60, 61, 330, 389, 59, 60, 61, 59, + 60, 61, 389, 334, 58, 59, 60, 61, 389, 325, + 59, 60, 61, 58, 389, 59, 60, 61, 329, 389, + 58, 389, 389, 330, 328, 328, 328, 328, 333, 58, + 389, 389, 334, 389, 335, 59, 60, 61, 389, 389, + 339, 58, 340, 389, 59, 60, 61, 58, 343, 389, + 58, 59, 60, 61, 338, 338, 338, 338, 58, 389, + + 59, 60, 61, 335, 58, 389, 389, 389, 389, 339, + 58, 340, 59, 60, 61, 389, 389, 343, 59, 60, + 61, 59, 60, 61, 389, 389, 389, 389, 389, 59, + 60, 61, 389, 389, 389, 59, 60, 61, 389, 389, + 389, 59, 60, 61, 53, 53, 53, 53, 53, 56, + 56, 56, 63, 63, 63, 63, 63, 248, 389, 248, + 248, 3, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389 } ; static const flex_int16_t yy_chk[1849] = @@ -926,204 +926,204 @@ static const flex_int16_t yy_chk[1849] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 5, 8, 5, 9, 9, 9, - 9, 11, 14, 68, 14, 14, 14, 14, 15, 15, - - 15, 15, 16, 16, 456, 16, 16, 16, 16, 18, - 18, 14, 19, 19, 19, 50, 14, 50, 16, 23, - 68, 9, 17, 17, 28, 17, 17, 17, 17, 23, - 455, 8, 63, 84, 11, 136, 16, 53, 17, 14, - 454, 84, 453, 14, 452, 451, 16, 16, 450, 449, - 23, 9, 9, 9, 28, 28, 28, 23, 22, 21, - 22, 21, 136, 56, 16, 22, 17, 17, 21, 21, - 21, 27, 22, 24, 448, 63, 21, 21, 26, 21, - 23, 23, 23, 53, 24, 25, 447, 22, 446, 25, - 26, 69, 22, 56, 56, 56, 27, 29, 445, 27, - - 24, 85, 22, 22, 22, 26, 25, 135, 444, 29, - 58, 443, 85, 25, 24, 24, 24, 25, 236, 69, - 26, 26, 26, 442, 29, 194, 27, 27, 27, 30, - 30, 30, 30, 280, 31, 135, 25, 25, 25, 29, - 29, 29, 31, 263, 296, 236, 30, 441, 31, 32, - 32, 32, 32, 194, 31, 33, 440, 37, 439, 31, - 280, 33, 31, 30, 438, 437, 33, 436, 435, 434, - 31, 263, 296, 58, 30, 32, 433, 58, 37, 58, - 432, 31, 33, 32, 431, 37, 430, 429, 33, 31, - 31, 31, 428, 30, 30, 30, 33, 33, 33, 34, - - 427, 34, 32, 38, 34, 34, 34, 34, 37, 37, - 37, 45, 36, 32, 32, 32, 426, 36, 40, 425, - 39, 424, 423, 422, 36, 421, 420, 419, 38, 418, - 34, 38, 39, 45, 417, 40, 416, 36, 34, 36, - 415, 45, 45, 45, 36, 109, 40, 39, 66, 66, - 66, 66, 414, 41, 36, 36, 36, 34, 38, 38, - 38, 41, 39, 39, 39, 40, 40, 40, 34, 34, - 34, 413, 412, 41, 42, 109, 109, 109, 41, 411, - 44, 41, 42, 410, 43, 409, 408, 407, 44, 41, - 43, 406, 405, 42, 41, 43, 57, 57, 57, 57, - - 41, 42, 404, 70, 70, 70, 70, 44, 41, 41, - 41, 43, 42, 42, 42, 403, 70, 43, 44, 44, - 44, 55, 402, 401, 55, 43, 43, 43, 400, 399, - 57, 65, 55, 55, 65, 67, 398, 67, 67, 67, - 67, 397, 65, 65, 70, 70, 71, 71, 71, 71, - 67, 395, 72, 72, 72, 72, 113, 113, 113, 113, - 57, 57, 57, 394, 393, 72, 392, 55, 391, 385, - 371, 55, 370, 88, 361, 55, 351, 65, 67, 67, - 340, 65, 55, 266, 246, 65, 55, 88, 55, 55, - 243, 240, 65, 72, 72, 92, 65, 90, 65, 65, - - 73, 73, 89, 73, 73, 73, 73, 74, 238, 74, - 91, 210, 74, 74, 74, 74, 73, 88, 88, 88, - 90, 93, 89, 208, 89, 90, 207, 92, 205, 202, - 89, 201, 91, 200, 93, 192, 190, 153, 91, 95, - 93, 94, 152, 151, 73, 73, 95, 150, 149, 93, - 90, 90, 90, 94, 89, 89, 89, 92, 92, 92, - 96, 93, 91, 91, 91, 98, 95, 96, 94, 148, - 93, 93, 93, 97, 147, 99, 95, 95, 95, 98, - 100, 146, 145, 94, 94, 94, 101, 96, 103, 99, - 103, 144, 98, 133, 132, 97, 130, 96, 96, 96, - - 100, 97, 99, 103, 129, 118, 101, 87, 100, 98, - 98, 98, 86, 83, 101, 103, 82, 103, 81, 99, - 99, 99, 80, 61, 60, 97, 97, 97, 59, 51, - 100, 100, 100, 103, 103, 103, 101, 101, 101, 102, - 102, 102, 102, 102, 104, 105, 108, 108, 108, 108, - 49, 106, 107, 111, 48, 47, 104, 106, 46, 105, - 35, 20, 10, 106, 7, 6, 107, 3, 0, 0, - 110, 104, 105, 102, 0, 110, 0, 111, 0, 107, - 108, 111, 0, 110, 0, 0, 104, 104, 104, 105, - 105, 105, 112, 106, 106, 106, 107, 107, 107, 0, - - 112, 0, 110, 102, 102, 102, 0, 111, 111, 111, - 108, 108, 108, 110, 110, 110, 128, 0, 0, 112, - 114, 114, 114, 114, 115, 115, 115, 115, 115, 116, - 112, 112, 112, 117, 116, 121, 0, 0, 117, 120, - 0, 0, 119, 0, 0, 123, 128, 128, 128, 121, - 0, 123, 0, 0, 114, 119, 116, 0, 115, 0, - 117, 120, 121, 0, 116, 116, 116, 120, 117, 117, - 117, 0, 119, 119, 119, 123, 123, 123, 0, 121, - 121, 121, 122, 0, 114, 114, 114, 120, 115, 115, - 115, 120, 120, 120, 124, 0, 0, 122, 126, 0, - - 125, 0, 124, 122, 0, 125, 0, 0, 0, 126, - 0, 0, 122, 122, 122, 0, 124, 137, 0, 137, - 158, 124, 137, 137, 137, 137, 0, 125, 126, 126, - 126, 154, 124, 124, 124, 125, 125, 125, 139, 155, - 0, 139, 139, 139, 139, 140, 140, 140, 140, 141, - 141, 141, 141, 142, 142, 142, 142, 157, 140, 156, - 0, 154, 154, 154, 159, 0, 158, 0, 0, 155, - 155, 155, 168, 168, 168, 168, 0, 162, 157, 0, - 0, 159, 0, 0, 0, 157, 140, 140, 161, 156, - 156, 156, 159, 0, 161, 142, 158, 158, 158, 160, - - 162, 163, 0, 160, 0, 162, 0, 163, 157, 157, - 157, 159, 159, 159, 164, 161, 171, 196, 196, 196, - 196, 164, 165, 0, 161, 161, 161, 160, 163, 165, - 162, 162, 162, 160, 160, 160, 166, 163, 163, 163, - 167, 164, 0, 166, 169, 0, 171, 171, 171, 165, - 0, 164, 164, 164, 170, 173, 0, 167, 0, 165, - 165, 165, 172, 166, 176, 169, 0, 0, 167, 0, - 0, 170, 169, 166, 166, 166, 173, 175, 0, 174, - 0, 0, 170, 0, 0, 176, 0, 167, 167, 167, - 0, 175, 172, 172, 172, 169, 169, 169, 0, 177, - - 186, 170, 170, 170, 175, 177, 173, 173, 173, 174, - 174, 174, 181, 0, 0, 176, 176, 176, 178, 0, - 0, 175, 175, 175, 0, 0, 177, 178, 179, 179, - 179, 179, 179, 181, 182, 177, 177, 177, 0, 0, - 181, 180, 186, 180, 184, 178, 180, 180, 180, 180, - 0, 184, 0, 0, 0, 182, 188, 178, 178, 178, - 185, 0, 182, 181, 181, 181, 0, 185, 187, 0, - 0, 184, 186, 186, 186, 187, 0, 188, 0, 0, - 0, 184, 184, 184, 188, 182, 182, 182, 189, 0, - 185, 185, 185, 0, 189, 0, 213, 0, 187, 187, - - 187, 197, 197, 197, 197, 209, 0, 188, 188, 188, - 198, 198, 198, 198, 211, 0, 212, 209, 189, 189, - 189, 213, 0, 0, 213, 0, 211, 220, 220, 220, - 220, 0, 209, 214, 0, 0, 0, 212, 0, 0, - 0, 211, 215, 197, 212, 217, 216, 209, 209, 209, - 216, 213, 213, 213, 214, 218, 211, 211, 211, 215, - 219, 214, 221, 0, 0, 0, 217, 212, 212, 212, - 215, 0, 219, 217, 216, 0, 218, 0, 0, 223, - 216, 216, 216, 218, 214, 214, 214, 219, 224, 215, - 215, 215, 221, 221, 221, 222, 217, 217, 217, 233, - - 0, 222, 219, 219, 219, 225, 218, 218, 218, 223, - 223, 223, 226, 227, 227, 227, 227, 226, 224, 224, - 224, 0, 222, 228, 228, 228, 228, 0, 229, 231, - 0, 222, 222, 222, 230, 225, 225, 225, 229, 226, - 0, 233, 0, 0, 230, 0, 0, 226, 226, 226, - 231, 237, 237, 237, 237, 229, 244, 231, 247, 237, - 0, 230, 248, 0, 0, 247, 0, 0, 229, 229, - 229, 233, 233, 233, 230, 230, 230, 249, 244, 237, - 231, 231, 231, 248, 244, 247, 0, 0, 0, 250, - 248, 0, 251, 0, 249, 247, 247, 247, 0, 0, - - 252, 250, 253, 0, 251, 249, 0, 0, 244, 244, - 244, 254, 253, 248, 248, 248, 250, 252, 0, 251, - 0, 254, 255, 0, 249, 249, 249, 256, 252, 253, - 0, 250, 250, 250, 251, 251, 251, 258, 254, 255, - 257, 0, 253, 253, 253, 258, 0, 252, 252, 252, - 255, 254, 254, 254, 0, 267, 285, 256, 256, 256, - 0, 257, 268, 0, 258, 0, 268, 271, 257, 255, - 255, 255, 267, 269, 0, 258, 258, 258, 264, 264, - 264, 264, 270, 267, 272, 269, 285, 285, 285, 271, - 268, 257, 257, 257, 270, 271, 268, 268, 268, 0, - - 269, 0, 267, 267, 267, 273, 274, 272, 0, 270, - 0, 273, 272, 0, 274, 269, 269, 269, 0, 271, - 271, 271, 275, 276, 270, 270, 270, 277, 275, 0, - 0, 276, 273, 274, 0, 0, 0, 272, 272, 272, - 0, 273, 273, 273, 274, 274, 274, 0, 277, 275, - 276, 297, 297, 297, 297, 277, 0, 283, 275, 275, - 275, 276, 276, 276, 281, 281, 281, 281, 281, 283, - 284, 319, 319, 319, 319, 286, 287, 0, 277, 277, - 277, 0, 286, 0, 283, 0, 0, 284, 289, 331, - 331, 331, 331, 287, 290, 0, 0, 0, 284, 283, - - 283, 283, 286, 288, 287, 0, 289, 0, 0, 288, - 0, 0, 286, 286, 286, 290, 289, 284, 284, 284, - 293, 300, 290, 287, 287, 287, 291, 0, 291, 292, - 288, 292, 0, 0, 302, 0, 289, 289, 289, 288, - 288, 288, 293, 301, 299, 290, 290, 290, 293, 298, - 299, 300, 300, 300, 291, 301, 304, 292, 291, 291, - 291, 292, 292, 292, 302, 302, 302, 0, 298, 0, - 301, 299, 293, 293, 293, 303, 307, 298, 304, 0, - 299, 299, 299, 305, 304, 301, 301, 301, 306, 336, - 336, 336, 336, 307, 313, 0, 0, 0, 298, 298, - - 298, 312, 0, 0, 307, 303, 303, 303, 304, 304, - 304, 0, 313, 305, 305, 305, 320, 314, 306, 306, - 306, 0, 313, 307, 307, 307, 311, 311, 311, 311, - 311, 312, 312, 312, 315, 316, 314, 0, 0, 321, - 0, 0, 313, 313, 313, 314, 320, 320, 320, 322, - 323, 315, 326, 326, 326, 326, 326, 0, 316, 327, - 0, 0, 315, 316, 338, 0, 314, 314, 314, 321, - 321, 321, 322, 328, 0, 323, 0, 322, 323, 328, - 333, 315, 315, 315, 327, 332, 0, 327, 316, 316, - 316, 332, 337, 0, 338, 338, 338, 341, 0, 0, - - 328, 333, 322, 322, 322, 323, 323, 323, 333, 328, - 328, 328, 332, 337, 327, 327, 327, 0, 0, 0, - 337, 332, 332, 332, 0, 0, 0, 341, 341, 341, - 0, 333, 333, 333, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 337, 337, 337, 388, 388, 388, 388, - 388, 389, 389, 389, 390, 390, 390, 390, 390, 396, - 0, 396, 396, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, - 387, 387, 387, 387, 387, 387, 387, 387 + 1, 1, 1, 1, 1, 1, 5, 8, 5, 9, + 9, 9, 9, 11, 14, 458, 14, 14, 14, 14, + + 15, 15, 15, 15, 16, 16, 457, 16, 16, 16, + 16, 18, 18, 14, 19, 19, 19, 50, 14, 50, + 16, 63, 456, 455, 9, 17, 17, 53, 17, 17, + 17, 17, 84, 21, 8, 21, 454, 11, 27, 16, + 84, 17, 14, 21, 21, 21, 22, 14, 22, 16, + 16, 21, 21, 22, 21, 9, 9, 9, 68, 23, + 24, 22, 453, 85, 27, 63, 452, 27, 16, 23, + 17, 17, 24, 26, 53, 85, 451, 22, 28, 25, + 450, 449, 22, 25, 448, 69, 26, 68, 447, 24, + 446, 23, 22, 22, 22, 27, 27, 27, 23, 445, + + 29, 25, 26, 24, 24, 24, 444, 443, 25, 28, + 28, 28, 25, 29, 69, 58, 442, 26, 26, 26, + 441, 440, 23, 23, 23, 30, 30, 30, 30, 29, + 439, 45, 25, 25, 25, 66, 66, 66, 66, 31, + 136, 137, 30, 438, 29, 29, 29, 31, 32, 32, + 32, 32, 196, 31, 45, 437, 238, 436, 32, 31, + 30, 265, 45, 45, 45, 31, 33, 435, 31, 136, + 137, 30, 33, 434, 32, 433, 31, 432, 33, 431, + 58, 196, 430, 32, 58, 238, 58, 32, 31, 282, + 265, 30, 30, 30, 38, 33, 31, 31, 31, 36, + + 34, 33, 34, 32, 36, 34, 34, 34, 34, 33, + 33, 33, 36, 37, 32, 32, 32, 39, 282, 298, + 38, 429, 428, 38, 427, 426, 36, 425, 36, 40, + 39, 34, 424, 36, 423, 37, 71, 71, 71, 71, + 34, 422, 37, 36, 36, 36, 39, 40, 298, 421, + 420, 38, 38, 38, 419, 56, 41, 418, 40, 417, + 34, 39, 39, 39, 41, 42, 37, 37, 37, 416, + 415, 34, 34, 34, 414, 413, 41, 412, 40, 40, + 40, 42, 41, 43, 411, 41, 56, 56, 56, 43, + 42, 44, 410, 41, 42, 43, 409, 408, 407, 41, + + 44, 42, 406, 405, 404, 41, 57, 57, 57, 57, + 42, 403, 43, 41, 41, 41, 110, 402, 43, 401, + 44, 42, 42, 42, 400, 399, 43, 43, 43, 397, + 396, 44, 44, 44, 55, 395, 394, 55, 393, 65, + 387, 57, 65, 373, 372, 55, 55, 110, 110, 110, + 65, 65, 363, 353, 67, 342, 67, 67, 67, 67, + 74, 268, 74, 248, 245, 74, 74, 74, 74, 67, + 242, 240, 57, 57, 57, 70, 70, 70, 70, 212, + 210, 55, 92, 209, 207, 55, 65, 94, 70, 55, + 65, 204, 88, 203, 65, 202, 194, 55, 67, 67, + + 94, 55, 65, 55, 55, 90, 65, 88, 65, 65, + 72, 72, 72, 72, 192, 92, 94, 70, 70, 154, + 89, 73, 73, 72, 73, 73, 73, 73, 91, 90, + 153, 94, 94, 94, 90, 152, 151, 73, 88, 88, + 88, 89, 150, 89, 149, 148, 92, 92, 92, 89, + 93, 91, 72, 72, 147, 146, 95, 91, 97, 145, + 90, 90, 90, 93, 95, 96, 73, 73, 134, 100, + 93, 98, 133, 96, 89, 89, 89, 131, 99, 93, + 130, 97, 91, 91, 91, 95, 98, 97, 119, 87, + 100, 86, 93, 99, 96, 95, 95, 95, 100, 101, + + 98, 93, 93, 93, 96, 96, 96, 99, 114, 114, + 114, 114, 97, 97, 97, 83, 82, 98, 98, 98, + 101, 100, 100, 100, 99, 99, 99, 104, 101, 102, + 102, 102, 102, 102, 103, 81, 103, 80, 61, 105, + 104, 60, 108, 108, 108, 108, 59, 127, 51, 49, + 103, 101, 101, 101, 105, 107, 104, 48, 127, 47, + 46, 106, 35, 103, 102, 103, 20, 106, 105, 10, + 107, 104, 104, 104, 106, 109, 7, 108, 127, 127, + 127, 103, 103, 103, 107, 105, 105, 105, 6, 113, + 3, 112, 109, 0, 0, 102, 102, 102, 113, 0, + + 0, 107, 107, 107, 109, 106, 106, 106, 108, 108, + 108, 0, 111, 117, 0, 0, 112, 111, 113, 117, + 112, 0, 0, 109, 109, 109, 111, 0, 0, 113, + 113, 113, 115, 115, 115, 115, 116, 116, 116, 116, + 116, 120, 117, 0, 0, 0, 111, 112, 112, 112, + 117, 117, 117, 0, 118, 120, 121, 111, 111, 111, + 118, 122, 0, 0, 123, 0, 0, 115, 0, 0, + 0, 116, 120, 120, 120, 0, 122, 0, 0, 121, + 123, 0, 124, 118, 0, 121, 123, 129, 124, 0, + 122, 118, 118, 118, 0, 123, 123, 123, 115, 115, + + 115, 0, 116, 116, 116, 0, 121, 122, 122, 122, + 121, 121, 121, 124, 124, 124, 125, 0, 129, 129, + 129, 0, 126, 0, 138, 125, 138, 0, 126, 138, + 138, 138, 138, 140, 159, 155, 140, 140, 140, 140, + 125, 141, 141, 141, 141, 125, 142, 142, 142, 142, + 0, 126, 0, 158, 141, 156, 125, 125, 125, 126, + 126, 126, 143, 143, 143, 143, 155, 155, 155, 157, + 169, 169, 169, 169, 160, 158, 181, 181, 181, 181, + 181, 159, 158, 141, 141, 0, 156, 156, 156, 0, + 0, 161, 160, 163, 0, 161, 198, 198, 198, 198, + + 157, 157, 157, 160, 162, 143, 158, 158, 158, 0, + 0, 162, 159, 159, 159, 0, 0, 163, 0, 0, + 161, 0, 163, 160, 160, 160, 161, 161, 161, 164, + 0, 165, 0, 162, 0, 170, 164, 166, 0, 165, + 0, 0, 162, 162, 162, 166, 167, 0, 163, 163, + 163, 0, 0, 0, 167, 168, 0, 170, 164, 0, + 165, 172, 171, 0, 170, 173, 166, 164, 164, 164, + 165, 165, 165, 168, 0, 167, 166, 166, 166, 174, + 171, 0, 0, 175, 168, 167, 167, 167, 170, 170, + 170, 171, 172, 172, 172, 176, 173, 173, 173, 178, + + 0, 174, 0, 0, 168, 168, 168, 177, 0, 0, + 176, 171, 171, 171, 175, 175, 175, 0, 179, 180, + 0, 178, 183, 0, 176, 179, 0, 0, 0, 180, + 0, 0, 174, 174, 174, 188, 0, 184, 177, 177, + 177, 176, 176, 176, 183, 0, 0, 179, 180, 0, + 0, 183, 178, 178, 178, 0, 179, 179, 179, 184, + 180, 180, 180, 182, 186, 182, 184, 187, 182, 182, + 182, 182, 186, 190, 187, 183, 183, 183, 188, 0, + 0, 189, 199, 199, 199, 199, 0, 0, 189, 0, + 184, 184, 184, 186, 0, 190, 0, 0, 187, 187, + + 187, 191, 190, 186, 186, 186, 211, 191, 223, 188, + 188, 188, 189, 189, 189, 200, 200, 200, 200, 211, + 214, 0, 0, 0, 213, 199, 190, 190, 190, 215, + 217, 225, 191, 191, 191, 211, 0, 213, 216, 223, + 223, 223, 214, 222, 222, 222, 222, 0, 217, 214, + 211, 211, 211, 213, 219, 215, 0, 0, 215, 217, + 216, 218, 225, 225, 225, 218, 0, 216, 213, 213, + 213, 221, 220, 214, 214, 214, 219, 0, 0, 217, + 217, 217, 224, 219, 221, 235, 215, 215, 215, 224, + 218, 216, 216, 216, 220, 0, 218, 218, 218, 226, + + 221, 220, 227, 229, 229, 229, 229, 219, 219, 219, + 0, 224, 228, 231, 0, 221, 221, 221, 228, 0, + 224, 224, 224, 233, 231, 220, 220, 220, 235, 232, + 226, 226, 226, 227, 227, 227, 230, 230, 230, 230, + 232, 228, 231, 0, 0, 233, 246, 0, 0, 228, + 228, 228, 233, 0, 0, 231, 231, 231, 232, 235, + 235, 235, 239, 239, 239, 239, 249, 250, 251, 246, + 239, 232, 232, 232, 249, 246, 233, 233, 233, 252, + 258, 266, 266, 266, 266, 253, 251, 0, 0, 250, + 239, 0, 252, 0, 0, 249, 250, 251, 253, 255, + + 246, 246, 246, 0, 256, 249, 249, 249, 252, 254, + 255, 258, 258, 258, 253, 256, 257, 251, 251, 251, + 250, 250, 250, 252, 252, 252, 0, 254, 255, 253, + 253, 253, 259, 256, 257, 260, 0, 0, 254, 269, + 0, 255, 255, 255, 260, 257, 256, 256, 256, 271, + 299, 299, 299, 299, 259, 274, 0, 269, 254, 254, + 254, 259, 271, 0, 260, 257, 257, 257, 269, 270, + 272, 0, 0, 270, 273, 260, 260, 260, 271, 274, + 0, 0, 0, 272, 274, 259, 259, 259, 269, 269, + 269, 0, 276, 271, 271, 271, 0, 273, 270, 272, + + 0, 276, 275, 273, 270, 270, 270, 0, 0, 275, + 274, 274, 274, 0, 272, 272, 272, 277, 278, 0, + 0, 276, 279, 0, 277, 0, 0, 278, 273, 273, + 273, 275, 276, 276, 276, 283, 283, 283, 283, 283, + 275, 275, 275, 0, 279, 0, 277, 278, 0, 285, + 286, 279, 287, 0, 0, 277, 277, 277, 278, 278, + 278, 291, 285, 288, 0, 0, 0, 290, 286, 289, + 0, 288, 0, 0, 290, 279, 279, 279, 285, 286, + 291, 0, 0, 287, 287, 287, 292, 289, 0, 0, + 291, 0, 288, 285, 285, 285, 290, 0, 289, 286, + + 286, 286, 288, 288, 288, 290, 290, 290, 292, 295, + 0, 291, 291, 291, 293, 292, 293, 300, 289, 289, + 289, 294, 301, 294, 0, 0, 302, 0, 0, 301, + 0, 0, 295, 321, 321, 321, 321, 300, 295, 292, + 292, 292, 304, 293, 0, 305, 300, 293, 293, 293, + 294, 301, 307, 303, 294, 294, 294, 302, 302, 302, + 301, 301, 301, 295, 295, 295, 303, 306, 300, 300, + 300, 308, 0, 304, 304, 304, 305, 305, 305, 314, + 316, 0, 303, 307, 307, 307, 0, 309, 0, 315, + 306, 313, 313, 313, 313, 313, 306, 303, 303, 303, + + 316, 317, 308, 308, 308, 309, 0, 0, 315, 316, + 314, 314, 314, 0, 322, 0, 309, 0, 315, 317, + 318, 306, 306, 306, 323, 333, 333, 333, 333, 324, + 317, 316, 316, 316, 325, 0, 309, 309, 309, 315, + 315, 315, 0, 329, 318, 322, 322, 322, 0, 318, + 317, 317, 317, 324, 0, 323, 323, 323, 324, 0, + 325, 0, 0, 325, 328, 328, 328, 328, 328, 329, + 0, 0, 329, 0, 330, 318, 318, 318, 0, 0, + 334, 330, 335, 0, 324, 324, 324, 334, 339, 0, + 340, 325, 325, 325, 338, 338, 338, 338, 343, 0, + + 329, 329, 329, 330, 335, 0, 0, 0, 0, 334, + 339, 335, 330, 330, 330, 0, 0, 339, 334, 334, + 334, 340, 340, 340, 0, 0, 0, 0, 0, 343, + 343, 343, 0, 0, 0, 335, 335, 335, 0, 0, + 0, 339, 339, 339, 390, 390, 390, 390, 390, 391, + 391, 391, 392, 392, 392, 392, 392, 398, 0, 398, + 398, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389 } ; -static const flex_int16_t yy_rule_linenum[62] = +static const flex_int16_t yy_rule_linenum[63] = { 0, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, @@ -1131,7 +1131,7 @@ static const flex_int16_t yy_rule_linenum[62] = 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 94 + 93, 95 } ; /* The intent behind this definition is that it'll catch @@ -1599,13 +1599,13 @@ YY_DECL while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 388 ) + if ( yy_current_state >= 390 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_current_state != 387 ); + while ( yy_current_state != 389 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1625,13 +1625,13 @@ YY_DECL { if ( yy_act == 0 ) fprintf( stderr, "--scanner backing up\n" ); - else if ( yy_act < 62 ) + else if ( yy_act < 63 ) fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], yytext ); - else if ( yy_act == 62 ) + else if ( yy_act == 63 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", yytext ); - else if ( yy_act == 63 ) + else if ( yy_act == 64 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); @@ -1758,47 +1758,47 @@ return yy::parser::make_LIMIT(yytext); YY_BREAK case 28: YY_RULE_SETUP -return yy::parser::make_ASCENDING(yytext); +return yy::parser::make_OBJ(yytext); YY_BREAK case 29: YY_RULE_SETUP -return yy::parser::make_DESCENDING(yytext); +return yy::parser::make_ASCENDING(yytext); YY_BREAK case 30: YY_RULE_SETUP -return yy::parser::make_SUBQUERY(); +return yy::parser::make_DESCENDING(yytext); YY_BREAK case 31: YY_RULE_SETUP -return yy::parser::make_SIZE(yytext); +return yy::parser::make_SUBQUERY(); YY_BREAK case 32: YY_RULE_SETUP -return yy::parser::make_MAX (); +return yy::parser::make_SIZE(yytext); YY_BREAK case 33: YY_RULE_SETUP -return yy::parser::make_MIN (); +return yy::parser::make_MAX (); YY_BREAK case 34: YY_RULE_SETUP -return yy::parser::make_SUM (); +return yy::parser::make_MIN (); YY_BREAK case 35: YY_RULE_SETUP -return yy::parser::make_AVG (); +return yy::parser::make_SUM (); YY_BREAK case 36: YY_RULE_SETUP -return yy::parser::make_BACKLINK(); +return yy::parser::make_AVG (); YY_BREAK case 37: YY_RULE_SETUP -return yy::parser::make_TYPE (yytext); +return yy::parser::make_BACKLINK(); YY_BREAK case 38: YY_RULE_SETUP -return yy::parser::make_KEY_VAL (yytext); +return yy::parser::make_TYPE (yytext); YY_BREAK case 39: YY_RULE_SETUP @@ -1806,59 +1806,59 @@ return yy::parser::make_KEY_VAL (yytext); YY_BREAK case 40: YY_RULE_SETUP -return yy::parser::make_CASE (); +return yy::parser::make_KEY_VAL (yytext); YY_BREAK case 41: YY_RULE_SETUP -return yy::parser::make_TRUE (); +return yy::parser::make_CASE (); YY_BREAK case 42: YY_RULE_SETUP -return yy::parser::make_FALSE (); +return yy::parser::make_TRUE (); YY_BREAK case 43: YY_RULE_SETUP -return yy::parser::make_INFINITY(yytext); +return yy::parser::make_FALSE (); YY_BREAK case 44: YY_RULE_SETUP -return yy::parser::make_NAN(yytext); +return yy::parser::make_INFINITY(yytext); YY_BREAK case 45: YY_RULE_SETUP -return yy::parser::make_NULL_VAL (); +return yy::parser::make_NAN(yytext); YY_BREAK case 46: YY_RULE_SETUP -return yy::parser::make_UUID(yytext); +return yy::parser::make_NULL_VAL (); YY_BREAK case 47: YY_RULE_SETUP -return yy::parser::make_OID(yytext); +return yy::parser::make_UUID(yytext); YY_BREAK case 48: YY_RULE_SETUP -return yy::parser::make_TIMESTAMP(yytext); +return yy::parser::make_OID(yytext); YY_BREAK case 49: YY_RULE_SETUP -return yy::parser::make_LINK (yytext); +return yy::parser::make_TIMESTAMP(yytext); YY_BREAK case 50: YY_RULE_SETUP -return yy::parser::make_TYPED_LINK (yytext); +return yy::parser::make_LINK (yytext); YY_BREAK case 51: YY_RULE_SETUP -return yy::parser::make_NATURAL0 (yytext); +return yy::parser::make_TYPED_LINK (yytext); YY_BREAK case 52: YY_RULE_SETUP -return yy::parser::make_ARG(yytext); +return yy::parser::make_NATURAL0 (yytext); YY_BREAK case 53: YY_RULE_SETUP -return yy::parser::make_NUMBER (yytext); +return yy::parser::make_ARG(yytext); YY_BREAK case 54: YY_RULE_SETUP @@ -1866,7 +1866,7 @@ return yy::parser::make_NUMBER (yytext); YY_BREAK case 55: YY_RULE_SETUP -return yy::parser::make_FLOAT (yytext); +return yy::parser::make_NUMBER (yytext); YY_BREAK case 56: YY_RULE_SETUP @@ -1874,12 +1874,11 @@ return yy::parser::make_FLOAT (yytext); YY_BREAK case 57: YY_RULE_SETUP -return yy::parser::make_BASE64(yytext); +return yy::parser::make_FLOAT (yytext); YY_BREAK case 58: -/* rule 58 can match eol */ YY_RULE_SETUP -return yy::parser::make_STRING (yytext); +return yy::parser::make_BASE64(yytext); YY_BREAK case 59: /* rule 59 can match eol */ @@ -1887,11 +1886,16 @@ YY_RULE_SETUP return yy::parser::make_STRING (yytext); YY_BREAK case 60: +/* rule 60 can match eol */ YY_RULE_SETUP -return yy::parser::make_ID (check_escapes(yytext)); +return yy::parser::make_STRING (yytext); YY_BREAK case 61: YY_RULE_SETUP +return yy::parser::make_ID (check_escapes(yytext)); + YY_BREAK +case 62: +YY_RULE_SETUP { throw yy::parser::syntax_error ("invalid character: " + std::string(yytext)); @@ -1900,7 +1904,7 @@ YY_RULE_SETUP case YY_STATE_EOF(INITIAL): return yy::parser::make_END (); YY_BREAK -case 62: +case 63: YY_RULE_SETUP ECHO; YY_BREAK @@ -2227,7 +2231,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 388 ) + if ( yy_current_state >= 390 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -2262,11 +2266,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 388 ) + if ( yy_current_state >= 390 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 387); + yy_is_jam = (yy_current_state == 389); (void)yyg; return yy_is_jam ? 0 : yy_current_state; diff --git a/src/realm/parser/query_bison.yy b/src/realm/parser/query_bison.yy index 4bcdd055a96..8e4bf50c7eb 100644 --- a/src/realm/parser/query_bison.yy +++ b/src/realm/parser/query_bison.yy @@ -103,6 +103,7 @@ using namespace realm::query_parser; %token LIKE "like" %token BETWEEN "between" %token IN "in" +%token OBJ "obj" %token SORT "sort" %token DISTINCT "distinct" %token LIMIT "limit" @@ -113,7 +114,7 @@ using namespace realm::query_parser; %token KEY_VAL "key or value" %type direction %type equality relational stringop -%type constant +%type constant primary_key %type list list_content %type prop %type post_op @@ -233,15 +234,12 @@ list_content constant : NATURAL0 { $$ = drv.m_parse_nodes.create(ConstantNode::NUMBER, $1); } - | NUMBER { $$ = drv.m_parse_nodes.create(ConstantNode::NUMBER, $1); } + | primary_key { $$ = $1; } | INFINITY { $$ = drv.m_parse_nodes.create(ConstantNode::INFINITY_VAL, $1); } | NAN { $$ = drv.m_parse_nodes.create(ConstantNode::NAN_VAL, $1); } - | STRING { $$ = drv.m_parse_nodes.create(ConstantNode::STRING, $1); } | BASE64 { $$ = drv.m_parse_nodes.create(ConstantNode::BASE64, $1); } | FLOAT { $$ = drv.m_parse_nodes.create(ConstantNode::FLOAT, $1); } | TIMESTAMP { $$ = drv.m_parse_nodes.create(ConstantNode::TIMESTAMP, $1); } - | UUID { $$ = drv.m_parse_nodes.create(ConstantNode::UUID_T, $1); } - | OID { $$ = drv.m_parse_nodes.create(ConstantNode::OID, $1); } | LINK { $$ = drv.m_parse_nodes.create(ConstantNode::LINK, $1); } | TYPED_LINK { $$ = drv.m_parse_nodes.create(ConstantNode::TYPED_LINK, $1); } | TRUE { $$ = drv.m_parse_nodes.create(ConstantNode::TRUE, ""); } @@ -249,7 +247,16 @@ constant | NULL_VAL { $$ = drv.m_parse_nodes.create(ConstantNode::NULL_VAL, ""); } | ARG { $$ = drv.m_parse_nodes.create(ConstantNode::ARG, $1); } | comp_type ARG { $$ = drv.m_parse_nodes.create(ExpressionComparisonType($1), $2); } + | OBJ '(' STRING ',' primary_key ')' { + auto tmp = $5; + tmp->add_table($3); + $$ = tmp; } +primary_key + : NUMBER { $$ = drv.m_parse_nodes.create(ConstantNode::NUMBER, $1); } + | STRING { $$ = drv.m_parse_nodes.create(ConstantNode::STRING, $1); } + | UUID { $$ = drv.m_parse_nodes.create(ConstantNode::UUID_T, $1); } + | OID { $$ = drv.m_parse_nodes.create(ConstantNode::OID, $1); } boolexpr : "truepredicate" { $$ = drv.m_parse_nodes.create(true); } diff --git a/src/realm/parser/query_flex.ll b/src/realm/parser/query_flex.ll index 01284915935..cb73f089f55 100644 --- a/src/realm/parser/query_flex.ll +++ b/src/realm/parser/query_flex.ll @@ -57,6 +57,7 @@ blank [ \t\r] (?i:sort) return yy::parser::make_SORT(yytext); (?i:distinct) return yy::parser::make_DISTINCT(yytext); (?i:limit) return yy::parser::make_LIMIT(yytext); +(?i:obj) return yy::parser::make_OBJ(yytext); (?i:ascending)|(?i:asc) return yy::parser::make_ASCENDING(yytext); (?i:descending)|(?i:desc) return yy::parser::make_DESCENDING(yytext); (?i:subquery) return yy::parser::make_SUBQUERY(); diff --git a/src/realm/query_engine.hpp b/src/realm/query_engine.hpp index 9a854e82367..8719ac39629 100644 --- a/src/realm/query_engine.hpp +++ b/src/realm/query_engine.hpp @@ -2417,6 +2417,16 @@ class LinksToNodeBase : public ParentNode { REALM_ASSERT(m_condition_column_key); if (m_target_keys.size() > 1) throw SerialisationError("Serializing a query which links to multiple objects is currently unsupported."); + auto target_table = m_table->get_opposite_table(m_condition_column_key); + if (ColKey pk_col = target_table ? target_table->get_primary_key_column() : ColKey{}) { + if (auto obj = target_table->try_get_object(m_target_keys[0])) { + auto pk_val = obj.get_any(pk_col); + std::ostringstream ostr; + ostr << "obj('" << target_table->get_name() << "'," << pk_val << ')'; + return state.describe_column(ParentNode::m_table, m_condition_column_key) + " " + + describe_condition() + ostr.str(); + } + } return state.describe_column(ParentNode::m_table, m_condition_column_key) + " " + describe_condition() + " " + util::serializer::print_value(m_target_keys[0]); } diff --git a/src/realm/query_expression.hpp b/src/realm/query_expression.hpp index b4f490ab573..30ce2b8a430 100644 --- a/src/realm/query_expression.hpp +++ b/src/realm/query_expression.hpp @@ -727,6 +727,11 @@ class Subexpr { return {}; } + virtual ConstTableRef get_target_table() const + { + return {}; + } + virtual DataType get_type() const = 0; virtual void evaluate(size_t index, ValueBase& destination) = 0; @@ -2589,6 +2594,11 @@ class Columns : public Subexpr2 { return type_Link; } + ConstTableRef get_target_table() const override + { + return link_map().get_target_table(); + } + bool has_multiple_values() const override { return m_is_list || !m_link_map.only_unary_links(); @@ -2736,6 +2746,10 @@ class ColumnsCollection : public Subexpr2, public ColumnListBase { { return m_link_map.get_base_table(); } + ConstTableRef get_target_table() const override + { + return m_link_map.get_target_table()->get_opposite_table(m_column_key); + } Allocator& get_alloc() const { @@ -4201,6 +4215,23 @@ class Compare : public Expression { m_left->description(state)); } else { + if constexpr (std::is_same_v) { + if (m_right->has_single_value()) { + auto val = m_right->get_mixed(); + if (val.is_type(type_Link, type_TypedLink)) { + auto target_table = m_left->get_target_table(); + if (ColKey pk_col = target_table ? target_table->get_primary_key_column() : ColKey{}) { + if (auto obj = target_table->try_get_object(val.get())) { + auto pk_val = obj.get_any(pk_col); + std::ostringstream ostr; + ostr << "obj('" << target_table->get_name() << "'," << pk_val << ')'; + return util::serializer::print_value(m_left->description(state) + + " == " + ostr.str()); + } + } + } + } + } return util::serializer::print_value(m_left->description(state) + " " + TCond::description() + " " + m_right->description(state)); } diff --git a/src/realm/table.cpp b/src/realm/table.cpp index 665dcde4954..0329ad5dce2 100644 --- a/src/realm/table.cpp +++ b/src/realm/table.cpp @@ -3164,8 +3164,8 @@ Obj Table::get_object_with_primary_key(Mixed primary_key) const DataType type = DataType(primary_key_col.get_type()); REALM_ASSERT((primary_key.is_null() && primary_key_col.get_attrs().test(col_attr_Nullable)) || primary_key.get_type() == type); - - return m_clusters.get(m_index_accessors[primary_key_col.get_index().val]->find_first(primary_key)); + auto obj_key = m_index_accessors[primary_key_col.get_index().val]->find_first(primary_key); + return obj_key ? m_clusters.get(obj_key) : Obj{}; } Mixed Table::get_primary_key(ObjKey key) const diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 0c149a8b922..3321bc9357f 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -737,18 +737,17 @@ TEST(Parser_LinksToDifferentTable) obj.set(discount_active_col, discount_info[i].second); } - TableRef items = g.add_table("class_Items"); - ColKey item_name_col = items->add_column(type_String, "name"); + TableRef items = g.add_table_with_primary_key("class_Items", type_String, "name"); ColKey item_price_col = items->add_column(type_Double, "price"); ColKey item_discount_col = items->add_column(*discounts, "discount"); using item_t = std::pair; - std::vector item_info = {{"milk", 5.5}, {"oranges", 4.0}, {"pizza", 9.5}, {"cereal", 6.5}}; + std::vector item_info = { + {"milk", 5.5}, {"oranges", 4.0}, {"pizza", 9.5}, {"cereal", 6.5}, {"coffee", 17.5}}; std::vector item_keys; - items->create_objects(item_info.size(), item_keys); - for (size_t i = 0; i < item_keys.size(); ++i) { - Obj obj = items->get_object(item_keys[i]); - obj.set(item_name_col, StringData(item_info[i].first)); - obj.set(item_price_col, item_info[i].second); + for (auto& item : item_info) { + Obj obj = items->create_object_with_primary_key(item.first); + obj.set(item_price_col, item.second); + item_keys.push_back(obj.get_key()); } items->get_object(item_keys[0]).set(item_discount_col, discount_keys[2]); // milk -0.50 items->get_object(item_keys[2]).set(item_discount_col, discount_keys[1]); // pizza -2.5 @@ -781,6 +780,9 @@ TEST(Parser_LinksToDifferentTable) list_2.add(item_keys[2]); list_2.add(item_keys[3]); + verify_query(test_context, t, "items = obj('class_Items', 'coffee')", 0); // nobody buys coffee + verify_query(test_context, t, "items = obj('class_Items', 'milk')", 2); // but milk + verify_query(test_context, t, "items = O0", 2); // how many people bought milk? verify_query(test_context, t, "items.@count > 2", 3); // how many people bought more than two items? verify_query(test_context, t, "items.price > 3.0", 3); // how many people buy items over $3.0? verify_query(test_context, t, "items.name ==[c] 'milk'", 2); // how many people buy milk? @@ -4994,6 +4996,8 @@ TEST(Parser_DictionaryObjects) CHECK_EQUAL(q.count(), 1); verify_query(test_context, persons, "pets.@values.age > 4", 1); + verify_query(test_context, persons, "pets.@values == obj('dog', 'pluto')", 1); + verify_query(test_context, persons, "pets.@values == ANY { obj('dog', 'pluto'), obj('dog', 'astro') }", 2); } TEST_TYPES(Parser_DictionaryAggregates, Prop, Prop, Prop) From fe7713842403ea02bedce6b34533f31a008e6ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Edelbo?= Date: Thu, 8 Sep 2022 11:29:47 +0200 Subject: [PATCH 2/6] Add test --- src/realm/parser/generated/query_bison.cpp | 119 +++++++++++---------- src/realm/parser/query_bison.yy | 12 ++- src/realm/query_engine.hpp | 8 +- src/realm/query_expression.hpp | 10 +- test/test_parser.cpp | 69 ++++++++++++ 5 files changed, 145 insertions(+), 73 deletions(-) diff --git a/src/realm/parser/generated/query_bison.cpp b/src/realm/parser/generated/query_bison.cpp index 61b4d21bccc..f873ffccb1f 100644 --- a/src/realm/parser/generated/query_bison.cpp +++ b/src/realm/parser/generated/query_bison.cpp @@ -1633,67 +1633,68 @@ namespace yy { { yystack_[2].value.as < ListNode* > ()->add_element(yystack_[0].value.as < ConstantNode* > ()); yylhs.value.as < ListNode* > () = yystack_[2].value.as < ListNode* > (); } break; - case 51: // constant: "natural0" - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } - break; - - case 52: // constant: primary_key + case 51: // constant: primary_key { yylhs.value.as < ConstantNode* > () = yystack_[0].value.as < ConstantNode* > (); } break; - case 53: // constant: "infinity" + case 52: // constant: "infinity" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::INFINITY_VAL, yystack_[0].value.as < std::string > ()); } break; - case 54: // constant: "NaN" + case 53: // constant: "NaN" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NAN_VAL, yystack_[0].value.as < std::string > ()); } break; - case 55: // constant: "base64" + case 54: // constant: "base64" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::BASE64, yystack_[0].value.as < std::string > ()); } break; - case 56: // constant: "float" + case 55: // constant: "float" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::FLOAT, yystack_[0].value.as < std::string > ()); } break; - case 57: // constant: "date" + case 56: // constant: "date" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::TIMESTAMP, yystack_[0].value.as < std::string > ()); } break; - case 58: // constant: "link" + case 57: // constant: "link" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::LINK, yystack_[0].value.as < std::string > ()); } break; - case 59: // constant: "typed link" + case 58: // constant: "typed link" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::TYPED_LINK, yystack_[0].value.as < std::string > ()); } break; - case 60: // constant: "true" + case 59: // constant: "true" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::TRUE, ""); } break; - case 61: // constant: "false" + case 60: // constant: "false" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::FALSE, ""); } break; - case 62: // constant: "null" + case 61: // constant: "null" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NULL_VAL, ""); } break; - case 63: // constant: "argument" + case 62: // constant: "argument" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::ARG, yystack_[0].value.as < std::string > ()); } break; - case 64: // constant: comp_type "argument" + case 63: // constant: comp_type "argument" { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ExpressionComparisonType(yystack_[1].value.as < int > ()), yystack_[0].value.as < std::string > ()); } break; - case 65: // constant: "obj" '(' "string" ',' primary_key ')' - { + case 64: // constant: "obj" '(' "string" ',' primary_key ')' + { auto tmp = yystack_[1].value.as < ConstantNode* > (); tmp->add_table(yystack_[3].value.as < std::string > ()); - yylhs.value.as < ConstantNode* > () = tmp; } + yylhs.value.as < ConstantNode* > () = tmp; + } + break; + + case 65: // primary_key: "natural0" + { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create(ConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } break; case 66: // primary_key: "number" @@ -2235,30 +2236,30 @@ namespace yy { 136, 23, -83, -83, -83, -83, -83, -83, -83, 227, 227, 227, 227, 182, 227, -83, -83, -83, -83, 2, 273, -83, 358, 400, -6, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, 45, + -83, -83, -83, -83, -83, -83, -83, -83, -83, 64, 4, 400, 16, -83, -83, 358, -83, -83, 31, 6, - 51, 55, -83, -83, -83, 227, -30, -83, -30, -83, - -83, 227, 75, 75, -83, 56, 316, -83, 61, 36, - 65, -10, -83, 358, 70, -83, 400, 71, 77, -83, - -83, -83, 93, 40, 75, -83, -83, 109, 34, -83, - 73, -83, -83, 82, -83, -83, -83, -83, 74, 81, - -83, 86, -19, 400, -8, 400, 87, 122, 91, 400, - 136, -83, -83, -83, -37, -83, -83, 71, -83, -83, + 47, 51, -83, -83, -83, 227, -30, -83, -30, -83, + -83, 227, 75, 75, -83, 49, 316, -83, 71, 36, + 58, -10, -83, 358, 70, -83, 400, 61, 77, -83, + -83, -83, 97, 40, 75, -83, -83, 108, 34, -83, + 73, -83, -83, 82, -83, -83, -83, -83, 83, 81, + -83, 87, -19, 400, -8, 400, 88, 123, 91, 400, + 136, -83, -83, -83, -37, -83, -83, 61, -83, -83, 34, -83, -83, -2, 400, -83, -83, -83, 400, 92, - -37, 71, 97, -83, -83 + -37, 61, 104, -83, -83 }; const signed char parser::yydefact_[] = { - 93, 70, 71, 0, 60, 61, 62, 72, 73, 74, - 93, 67, 55, 53, 54, 51, 66, 56, 57, 68, - 69, 58, 59, 63, 0, 93, 49, 0, 33, 3, - 0, 15, 22, 30, 23, 21, 52, 8, 93, 0, + 93, 70, 71, 0, 59, 60, 61, 72, 73, 74, + 93, 67, 54, 52, 53, 65, 66, 55, 56, 68, + 69, 57, 58, 62, 0, 93, 49, 0, 33, 3, + 0, 15, 22, 30, 23, 21, 51, 8, 93, 0, 93, 6, 0, 0, 0, 0, 48, 0, 1, 93, 93, 2, 82, 83, 85, 87, 88, 86, 84, 93, 93, 93, 93, 93, 93, 89, 90, 91, 92, 0, - 93, 64, 49, 0, 75, 96, 98, 99, 100, 101, + 93, 63, 49, 0, 75, 96, 98, 99, 100, 101, 102, 109, 104, 105, 106, 107, 108, 103, 94, 75, 0, 0, 0, 7, 16, 0, 46, 5, 4, 0, 0, 0, 35, 34, 36, 93, 19, 15, 20, 17, @@ -2267,7 +2268,7 @@ namespace yy { 93, 93, 0, 0, 10, 13, 47, 0, 95, 26, 0, 76, 77, 0, 78, 79, 80, 81, 29, 0, 95, 0, 0, 0, 0, 0, 0, 0, 75, 0, - 93, 65, 40, 93, 0, 37, 93, 38, 43, 97, + 93, 64, 40, 93, 0, 37, 93, 38, 43, 97, 0, 25, 28, 0, 0, 44, 45, 41, 0, 0, 0, 39, 0, 42, 32 }; @@ -2276,7 +2277,7 @@ namespace yy { parser::yypgoto_[] = { -83, -83, -9, -83, 1, 0, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -23, 89, 105, -20, 33, + -83, -83, -83, -83, -83, -22, 90, 89, -20, 35, -83, -21, -82, -83, -83, -83, -83, -36, -83, -70 }; @@ -2301,14 +2302,14 @@ namespace yy { 117, 99, 100, 101, 47, 129, 171, 59, 60, 61, 62, 128, 94, 164, 95, 167, 96, 141, 142, 172, 144, 145, 146, 147, 153, 155, 59, 60, 61, 62, - 137, 94, 47, 143, 180, 11, 133, 123, 181, 124, - 16, 131, 134, 19, 20, 132, 135, 65, 66, 67, - 68, 69, 72, 141, 142, 156, 95, 174, 136, 138, - 178, 59, 60, 61, 62, 150, 140, 157, 159, 1, - 2, 3, 4, 5, 6, 158, 160, 161, 168, 169, - 184, 173, 7, 8, 9, 170, 182, 183, 114, 0, - 31, 151, 10, 0, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 118, 0, 0, + 137, 94, 47, 143, 180, 11, 133, 131, 181, 15, + 16, 132, 134, 19, 20, 72, 135, 65, 66, 67, + 68, 69, 138, 141, 142, 150, 123, 174, 124, 156, + 178, 59, 60, 61, 62, 140, 95, 157, 136, 1, + 2, 3, 4, 5, 6, 158, 160, 159, 161, 168, + 169, 173, 7, 8, 9, 170, 182, 184, 183, 114, + 31, 118, 10, 151, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 3, 4, 5, 6, 0, 0, 0, 0, 0, 25, 111, 7, 8, 9, 0, 26, 52, 53, 54, 55, 56, 57, 0, @@ -2352,14 +2353,14 @@ namespace yy { 70, 48, 49, 50, 95, 95, 158, 56, 57, 58, 59, 65, 61, 153, 65, 155, 67, 53, 54, 159, 20, 21, 22, 23, 130, 131, 56, 57, 58, 59, - 64, 61, 123, 123, 174, 28, 105, 62, 178, 64, - 33, 60, 111, 36, 37, 60, 116, 41, 42, 43, - 44, 45, 66, 53, 54, 32, 65, 163, 67, 64, - 166, 56, 57, 58, 59, 64, 27, 64, 64, 3, - 4, 5, 6, 7, 8, 63, 65, 61, 61, 27, - 53, 160, 16, 17, 18, 64, 64, 180, 69, -1, - 160, 128, 26, -1, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 72, -1, -1, + 64, 61, 123, 123, 174, 28, 105, 60, 178, 32, + 33, 60, 111, 36, 37, 66, 116, 41, 42, 43, + 44, 45, 64, 53, 54, 64, 62, 163, 64, 32, + 166, 56, 57, 58, 59, 27, 65, 64, 67, 3, + 4, 5, 6, 7, 8, 63, 65, 64, 61, 61, + 27, 160, 16, 17, 18, 64, 64, 53, 180, 69, + 160, 72, 26, 128, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, 60, 15, 16, 17, 18, -1, 66, 9, 10, 11, 12, 13, 14, -1, @@ -2423,7 +2424,7 @@ namespace yy { 74, 75, 76, 77, 77, 77, 77, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, + 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 88, 88, 89, 89, 89, 90, 90, 90, 91, 91, 91, 91, 92, 92, 92, 93, 93, 93, 93, 94, 94, 94, 94, 95, 95, 96, 97, 97, 97, 97, @@ -2439,7 +2440,7 @@ namespace yy { 1, 2, 10, 0, 2, 2, 2, 4, 2, 4, 4, 3, 5, 4, 1, 1, 3, 4, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 6, 1, 1, 1, 1, + 1, 1, 1, 2, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 1, 5, 1, 1, @@ -2485,11 +2486,11 @@ namespace yy { 195, 198, 201, 204, 205, 206, 207, 209, 212, 213, 215, 218, 219, 221, 224, 225, 227, 228, 231, 232, 233, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 256, 257, 258, 259, - 262, 263, 266, 267, 268, 271, 272, 273, 276, 277, - 278, 279, 282, 283, 284, 287, 288, 289, 290, 293, - 294, 295, 296, 299, 300, 303, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319 + 245, 246, 247, 248, 249, 257, 258, 259, 260, 261, + 264, 265, 268, 269, 270, 273, 274, 275, 278, 279, + 280, 281, 284, 285, 286, 289, 290, 291, 292, 295, + 296, 297, 298, 301, 302, 305, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321 }; void diff --git a/src/realm/parser/query_bison.yy b/src/realm/parser/query_bison.yy index 8e4bf50c7eb..ec0a7690d83 100644 --- a/src/realm/parser/query_bison.yy +++ b/src/realm/parser/query_bison.yy @@ -233,8 +233,7 @@ list_content | list_content ',' constant { $1->add_element($3); $$ = $1; } constant - : NATURAL0 { $$ = drv.m_parse_nodes.create(ConstantNode::NUMBER, $1); } - | primary_key { $$ = $1; } + : primary_key { $$ = $1; } | INFINITY { $$ = drv.m_parse_nodes.create(ConstantNode::INFINITY_VAL, $1); } | NAN { $$ = drv.m_parse_nodes.create(ConstantNode::NAN_VAL, $1); } | BASE64 { $$ = drv.m_parse_nodes.create(ConstantNode::BASE64, $1); } @@ -247,13 +246,16 @@ constant | NULL_VAL { $$ = drv.m_parse_nodes.create(ConstantNode::NULL_VAL, ""); } | ARG { $$ = drv.m_parse_nodes.create(ConstantNode::ARG, $1); } | comp_type ARG { $$ = drv.m_parse_nodes.create(ExpressionComparisonType($1), $2); } - | OBJ '(' STRING ',' primary_key ')' { + | OBJ '(' STRING ',' primary_key ')' + { auto tmp = $5; tmp->add_table($3); - $$ = tmp; } + $$ = tmp; + } primary_key - : NUMBER { $$ = drv.m_parse_nodes.create(ConstantNode::NUMBER, $1); } + : NATURAL0 { $$ = drv.m_parse_nodes.create(ConstantNode::NUMBER, $1); } + | NUMBER { $$ = drv.m_parse_nodes.create(ConstantNode::NUMBER, $1); } | STRING { $$ = drv.m_parse_nodes.create(ConstantNode::STRING, $1); } | UUID { $$ = drv.m_parse_nodes.create(ConstantNode::UUID_T, $1); } | OID { $$ = drv.m_parse_nodes.create(ConstantNode::OID, $1); } diff --git a/src/realm/query_engine.hpp b/src/realm/query_engine.hpp index 8719ac39629..f8f65505bf2 100644 --- a/src/realm/query_engine.hpp +++ b/src/realm/query_engine.hpp @@ -2418,17 +2418,17 @@ class LinksToNodeBase : public ParentNode { if (m_target_keys.size() > 1) throw SerialisationError("Serializing a query which links to multiple objects is currently unsupported."); auto target_table = m_table->get_opposite_table(m_condition_column_key); + std::string value = util::serializer::print_value(m_target_keys[0]); if (ColKey pk_col = target_table ? target_table->get_primary_key_column() : ColKey{}) { if (auto obj = target_table->try_get_object(m_target_keys[0])) { auto pk_val = obj.get_any(pk_col); std::ostringstream ostr; - ostr << "obj('" << target_table->get_name() << "'," << pk_val << ')'; - return state.describe_column(ParentNode::m_table, m_condition_column_key) + " " + - describe_condition() + ostr.str(); + ostr << "obj(" << util::serializer::print_value(target_table->get_name()) << "," << pk_val << ')'; + value = ostr.str(); } } return state.describe_column(ParentNode::m_table, m_condition_column_key) + " " + describe_condition() + " " + - util::serializer::print_value(m_target_keys[0]); + value; } protected: diff --git a/src/realm/query_expression.hpp b/src/realm/query_expression.hpp index 30ce2b8a430..a3302459894 100644 --- a/src/realm/query_expression.hpp +++ b/src/realm/query_expression.hpp @@ -4215,6 +4215,7 @@ class Compare : public Expression { m_left->description(state)); } else { + std::string value = m_right->description(state); if constexpr (std::is_same_v) { if (m_right->has_single_value()) { auto val = m_right->get_mixed(); @@ -4224,16 +4225,15 @@ class Compare : public Expression { if (auto obj = target_table->try_get_object(val.get())) { auto pk_val = obj.get_any(pk_col); std::ostringstream ostr; - ostr << "obj('" << target_table->get_name() << "'," << pk_val << ')'; - return util::serializer::print_value(m_left->description(state) + - " == " + ostr.str()); + ostr << "obj(" << util::serializer::print_value(target_table->get_name()) << "," + << pk_val << ')'; + value = ostr.str(); } } } } } - return util::serializer::print_value(m_left->description(state) + " " + TCond::description() + " " + - m_right->description(state)); + return m_left->description(state) + " " + TCond::description() + " " + value; } } diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 3321bc9357f..876b0b9b9a7 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -5515,4 +5515,73 @@ TEST(Parser_Between) CHECK_THROW_ANY(verify_query(test_context, table, "NONE scores between {10, 12}", 1)); } +TEST(Parser_PrimaryKey) +{ + UUID u1("3b241101-e2bb-4255-8caf-4136c566a961"); + ObjectId o1 = ObjectId::gen(); + Group g; + auto table_int = g.add_table_with_primary_key("class_Int", type_Int, "_id"); + auto table_string = g.add_table_with_primary_key("class_String", type_String, "_id"); + auto table_oid = g.add_table_with_primary_key("class_Oid", type_ObjectId, "_id"); + auto table_uuid = g.add_table_with_primary_key("class_Uuid", type_UUID, "_id"); + + auto origin = g.add_table("origin"); + auto col_int = origin->add_column(*table_int, "int"); + auto col_string = origin->add_column(*table_string, "string"); + auto col_oid = origin->add_column(*table_oid, "oid"); + auto col_uuid = origin->add_column(*table_uuid, "uuid"); + + auto linking = g.add_table("linking"); + auto col_link = linking->add_column(*origin, "link"); + + origin->create_object().set(col_int, table_int->create_object_with_primary_key(1).get_key()); + origin->create_object().set(col_string, table_string->create_object_with_primary_key("first").get_key()); + origin->create_object().set(col_oid, table_oid->create_object_with_primary_key(o1).get_key()); + origin->create_object().set(col_uuid, table_uuid->create_object_with_primary_key(u1).get_key()); + + for (auto o : *origin) { + linking->create_object().set(col_link, o.get_key()); + } + + std::string query_string = "int == obj(\"class_Int\",1)"; + Query q = origin->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + + query_string = "string == obj(\"class_String\",\"first\")"; + q = origin->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + + query_string = "oid == obj(\"class_Oid\"," + util::serializer::print_value(o1) + ")"; + q = origin->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + + query_string = "uuid == obj(\"class_Uuid\"," + util::serializer::print_value(u1) + ")"; + q = origin->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + + query_string = "link.int == obj(\"class_Int\",1)"; + q = linking->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + + query_string = "link.string == obj(\"class_String\",\"first\")"; + q = linking->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + + query_string = "link.oid == obj(\"class_Oid\"," + util::serializer::print_value(o1) + ")"; + q = linking->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + + query_string = "link.uuid == obj(\"class_Uuid\"," + util::serializer::print_value(u1) + ")"; + q = linking->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); +} + #endif // TEST_PARSER From b79e166d8555a73cdebb5e2da82f8f996a5f90dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Edelbo?= Date: Thu, 8 Sep 2022 12:01:04 +0200 Subject: [PATCH 3/6] Update release note --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd9a8fa993d..8d9e73a2042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ### Fixed * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) -* None. +* If you set a subscription on a link in flexible sync, the server would not know how to handle it ([#5409](https://github.com/realm/realm-core/issues/5409)) ### Breaking changes * None. From 8e028ebbf57999103b8cbe625bd2d468b2ca5d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Edelbo?= Date: Fri, 9 Sep 2022 13:08:52 +0200 Subject: [PATCH 4/6] Update after review --- src/realm/parser/driver.cpp | 23 +++++++++++------ src/realm/query.cpp | 2 +- src/realm/query_engine.hpp | 24 ++++++++---------- src/realm/query_expression.hpp | 45 +++++++++++++++++----------------- src/realm/util/serializer.cpp | 19 ++++++++++---- src/realm/util/serializer.hpp | 11 ++++++--- test/test_parser.cpp | 34 ++++++++++++++++++------- 7 files changed, 95 insertions(+), 63 deletions(-) diff --git a/src/realm/parser/driver.cpp b/src/realm/parser/driver.cpp index e76d16571f3..eb47b12b7d1 100644 --- a/src/realm/parser/driver.cpp +++ b/src/realm/parser/driver.cpp @@ -373,7 +373,7 @@ std::unique_ptr OperationNode::visit(ParserDriver* drv, DataType type) } } if (!Mixed::is_numeric(left->get_type(), right->get_type())) { - util::serializer::SerialisationState state(""); + util::serializer::SerialisationState state("", nullptr); std::string op(&m_op, 1); throw std::invalid_argument(util::format("Cannot perform '%1' operation on '%2' and '%3'", op, left->description(state), right->description(state))); @@ -944,13 +944,20 @@ std::unique_ptr ConstantNode::visit(ParserDriver* drv, DataType hint) const Group* g = drv->m_base_table->get_parent_group(); TableKey table_key; ObjKey obj_key; - if (auto table = g->get_table(target_table)) { - table_key = table->get_key(); - target_table = ""; - auto pk_val_node = visit(drv, hint); // call recursively - auto pk_val = pk_val_node->get_mixed(); - obj_key = table->find_primary_key(pk_val); + auto table = g->get_table(target_table); + if (!table) { + // Perhaps class prefix is missing + Group::TableNameBuffer buffer; + table = g->get_table(Group::class_name_to_table_name(target_table, buffer)); + } + if (!table) { + throw InvalidQueryError(util::format("Unknown object type '%1'", target_table)); } + table_key = table->get_key(); + target_table = ""; + auto pk_val_node = visit(drv, hint); // call recursively + auto pk_val = pk_val_node->get_mixed(); + obj_key = table->find_primary_key(pk_val); return std::make_unique>(ObjLink(table_key, ObjKey(obj_key))); } switch (type) { @@ -1417,7 +1424,7 @@ static void verify_conditions(Subexpr* left, Subexpr* right, util::serializer::S } ParserDriver::ParserDriver(TableRef t, Arguments& args, const query_parser::KeyPathMapping& mapping) - : m_serializer_state(mapping.get_backlink_class_prefix()) + : m_serializer_state(mapping.get_backlink_class_prefix(), nullptr) , m_base_table(t) , m_args(args) , m_mapping(mapping) diff --git a/src/realm/query.cpp b/src/realm/query.cpp index dd88c46eb97..f89c3e786c0 100644 --- a/src/realm/query.cpp +++ b/src/realm/query.cpp @@ -1874,7 +1874,7 @@ util::bind_ptr Query::get_ordering() std::string Query::get_description(const std::string& class_prefix) const { - util::serializer::SerialisationState state(class_prefix); + util::serializer::SerialisationState state(class_prefix, m_table->get_parent_group()); return get_description(state); } diff --git a/src/realm/query_engine.hpp b/src/realm/query_engine.hpp index f8f65505bf2..8ca5f42d65c 100644 --- a/src/realm/query_engine.hpp +++ b/src/realm/query_engine.hpp @@ -1346,10 +1346,15 @@ class MixedNodeBase : public ParentNode { std::string describe(util::serializer::SerialisationState& state) const override { REALM_ASSERT(m_condition_column_key); + std::string value; + if (m_value.is_type(type_TypedLink)) { + value = util::serializer::print_value(m_value.get(), state.group); + } + else { + value = util::serializer::print_value(m_value); + } return state.describe_column(ParentNode::m_table, m_condition_column_key) + " " + this->describe_condition() + - " " + - (m_value_is_null ? util::serializer::print_value(realm::null()) - : util::serializer::print_value(m_value)); + " " + value; } protected: @@ -2417,18 +2422,9 @@ class LinksToNodeBase : public ParentNode { REALM_ASSERT(m_condition_column_key); if (m_target_keys.size() > 1) throw SerialisationError("Serializing a query which links to multiple objects is currently unsupported."); - auto target_table = m_table->get_opposite_table(m_condition_column_key); - std::string value = util::serializer::print_value(m_target_keys[0]); - if (ColKey pk_col = target_table ? target_table->get_primary_key_column() : ColKey{}) { - if (auto obj = target_table->try_get_object(m_target_keys[0])) { - auto pk_val = obj.get_any(pk_col); - std::ostringstream ostr; - ostr << "obj(" << util::serializer::print_value(target_table->get_name()) << "," << pk_val << ')'; - value = ostr.str(); - } - } + ObjLink link(m_table->get_opposite_table(m_condition_column_key)->get_key(), m_target_keys[0]); return state.describe_column(ParentNode::m_table, m_condition_column_key) + " " + describe_condition() + " " + - value; + util::serializer::print_value(link, m_table->get_parent_group()); } protected: diff --git a/src/realm/query_expression.hpp b/src/realm/query_expression.hpp index a3302459894..31b8b075800 100644 --- a/src/realm/query_expression.hpp +++ b/src/realm/query_expression.hpp @@ -1222,15 +1222,31 @@ class Value : public ValueBase, public Subexpr2 { { } - std::string value_to_string(size_t ndx) const + std::string value_to_string(size_t ndx, util::serializer::SerialisationState& state) const { auto val = get(ndx); if (val.is_null()) return "NULL"; else { + static_cast(state); if constexpr (std::is_same_v) { return util::serializer::print_value(val.get_type_of_value()); } + else if constexpr (std::is_same_v) { + ObjLink link(state.taget_table->get_key(), val.template get()); + return util::serializer::print_value(link, state.group); + } + else if constexpr (std::is_same_v) { + return util::serializer::print_value(val.template get(), state.group); + } + else if constexpr (std::is_same_v) { + if (val.is_type(type_TypedLink)) { + return util::serializer::print_value(val.template get(), state.group); + } + else { + return util::serializer::print_value(val); + } + } else { return util::serializer::print_value(val.template get()); } @@ -1246,13 +1262,13 @@ class Value : public ValueBase, public Subexpr2 { if (i != 0) { desc += ", "; } - desc += value_to_string(i); + desc += value_to_string(i, state); } desc += "}"; return desc; } else if (sz == 1) { - return value_to_string(0); + return value_to_string(0, state); } return ""; } @@ -3800,7 +3816,7 @@ class SubColumnAggregate : public Subexpr2 { virtual std::string description(util::serializer::SerialisationState& state) const override { - util::serializer::SerialisationState empty_state(state.class_prefix); + util::serializer::SerialisationState empty_state(state.class_prefix, state.group); return state.describe_columns(m_link_map, ColKey()) + util::serializer::value_separator + Operation::description() + util::serializer::value_separator + m_column.description(empty_state); } @@ -4215,25 +4231,8 @@ class Compare : public Expression { m_left->description(state)); } else { - std::string value = m_right->description(state); - if constexpr (std::is_same_v) { - if (m_right->has_single_value()) { - auto val = m_right->get_mixed(); - if (val.is_type(type_Link, type_TypedLink)) { - auto target_table = m_left->get_target_table(); - if (ColKey pk_col = target_table ? target_table->get_primary_key_column() : ColKey{}) { - if (auto obj = target_table->try_get_object(val.get())) { - auto pk_val = obj.get_any(pk_col); - std::ostringstream ostr; - ostr << "obj(" << util::serializer::print_value(target_table->get_name()) << "," - << pk_val << ')'; - value = ostr.str(); - } - } - } - } - } - return m_left->description(state) + " " + TCond::description() + " " + value; + state.taget_table = m_left->get_target_table(); + return m_left->description(state) + " " + TCond::description() + " " + m_right->description(state); } } diff --git a/src/realm/util/serializer.cpp b/src/realm/util/serializer.cpp index 4c849d83967..d04de4914e0 100644 --- a/src/realm/util/serializer.cpp +++ b/src/realm/util/serializer.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -164,16 +165,24 @@ std::string print_value<>(realm::ObjKey k) return ss.str(); } -template <> -std::string print_value<>(realm::ObjLink link) +std::string print_value(realm::ObjLink link, Group* g) { - std::stringstream ss; if (!link) { - ss << "NULL"; + return "NULL"; } else { - ss << "L" << link.get_table_key().value << ":" << link.get_obj_key().value; + TableRef target_table = g->get_table(link.get_table_key()); + if (ColKey pk_col = target_table ? target_table->get_primary_key_column() : ColKey{}) { + if (auto obj = target_table->try_get_object(link.get_obj_key())) { + auto pk_val = obj.get_any(pk_col); + std::ostringstream ostr; + ostr << "obj(" << util::serializer::print_value(target_table->get_name()) << "," << pk_val << ')'; + return ostr.str(); + } + } } + std::stringstream ss; + ss << "L" << link.get_table_key().value << ":" << link.get_obj_key().value; return ss.str(); } diff --git a/src/realm/util/serializer.hpp b/src/realm/util/serializer.hpp index cd18654750f..02b44caf6a5 100644 --- a/src/realm/util/serializer.hpp +++ b/src/realm/util/serializer.hpp @@ -39,6 +39,7 @@ class Timestamp; class LinkMap; class UUID; class TypeOfValue; +class Group; enum class ExpressionComparisonType : unsigned char; namespace util { @@ -68,8 +69,9 @@ template <> std::string print_value<>(realm::ObjectId); template <> std::string print_value<>(realm::ObjKey); -template <> -std::string print_value<>(realm::ObjLink); + +std::string print_value(realm::ObjLink, Group*); + template <> std::string print_value<>(realm::UUID); template <> @@ -97,8 +99,9 @@ std::string print_value(Optional value) StringData get_printable_table_name(StringData name, const std::string& prefix); struct SerialisationState { - SerialisationState(const std::string& prefix) + SerialisationState(const std::string& prefix, Group* g) : class_prefix(prefix) + , group(g) { } std::string describe_column(ConstTableRef table, ColKey col_key); @@ -109,6 +112,8 @@ struct SerialisationState { std::string get_variable_name(ConstTableRef table); std::vector subquery_prefix_list; std::string class_prefix; + Group* group; + ConstTableRef taget_table; }; } // namespace serializer diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 876b0b9b9a7..6732289ccbf 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -780,9 +780,9 @@ TEST(Parser_LinksToDifferentTable) list_2.add(item_keys[2]); list_2.add(item_keys[3]); - verify_query(test_context, t, "items = obj('class_Items', 'coffee')", 0); // nobody buys coffee - verify_query(test_context, t, "items = obj('class_Items', 'milk')", 2); // but milk - verify_query(test_context, t, "items = O0", 2); // how many people bought milk? + verify_query(test_context, t, "items = obj('Items', 'coffee')", 0); // nobody buys coffee + verify_query(test_context, t, "items = obj('Items', 'milk')", 2); // but milk + verify_query(test_context, t, "items = O0", 2); // how many people bought milk? verify_query(test_context, t, "items.@count > 2", 3); // how many people bought more than two items? verify_query(test_context, t, "items.price > 3.0", 3); // how many people buy items over $3.0? verify_query(test_context, t, "items.name ==[c] 'milk'", 2); // how many people buy milk? @@ -3364,7 +3364,7 @@ TEST(Parser_BacklinksIndex) TEST(Parser_SubqueryVariableNames) { Group g; - util::serializer::SerialisationState test_state(""); + util::serializer::SerialisationState test_state("", nullptr); TableRef test_table = g.add_table("test"); @@ -4104,7 +4104,7 @@ TEST(Parser_Object) Query q0 = table->where().and_query(table->column(link_col) == tv.get_object(0)); std::string description = q0.get_description(); // shouldn't throw - CHECK(description.find("O0") != std::string::npos); + CHECK(description.find("L0:0") != std::string::npos); Query q1 = table->column(link_col) == realm::null(); description = q1.get_description(); // shouldn't throw @@ -5530,14 +5530,20 @@ TEST(Parser_PrimaryKey) auto col_string = origin->add_column(*table_string, "string"); auto col_oid = origin->add_column(*table_oid, "oid"); auto col_uuid = origin->add_column(*table_uuid, "uuid"); + auto col_any = origin->add_column(type_Mixed, "mixed"); + auto linking = g.add_table("linking"); auto col_link = linking->add_column(*origin, "link"); - origin->create_object().set(col_int, table_int->create_object_with_primary_key(1).get_key()); - origin->create_object().set(col_string, table_string->create_object_with_primary_key("first").get_key()); - origin->create_object().set(col_oid, table_oid->create_object_with_primary_key(o1).get_key()); - origin->create_object().set(col_uuid, table_uuid->create_object_with_primary_key(u1).get_key()); + auto target = table_int->create_object_with_primary_key(1); + origin->create_object().set(col_int, target.get_key()).set(col_any, Mixed(target.get_link())); + target = table_string->create_object_with_primary_key("first"); + origin->create_object().set(col_string, target.get_key()).set(col_any, Mixed(target.get_link())); + target = table_oid->create_object_with_primary_key(o1); + origin->create_object().set(col_oid, target.get_key()).set(col_any, Mixed(target.get_link())); + target = table_uuid->create_object_with_primary_key(u1); + origin->create_object().set(col_uuid, target.get_key()).set(col_any, Mixed(target.get_link())); for (auto o : *origin) { linking->create_object().set(col_link, o.get_key()); @@ -5548,6 +5554,11 @@ TEST(Parser_PrimaryKey) CHECK_EQUAL(q.count(), 1); CHECK_EQUAL(q.get_description(), query_string); + query_string = "mixed == obj(\"class_Int\",1)"; + q = origin->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + query_string = "string == obj(\"class_String\",\"first\")"; q = origin->query(query_string); CHECK_EQUAL(q.count(), 1); @@ -5568,6 +5579,11 @@ TEST(Parser_PrimaryKey) CHECK_EQUAL(q.count(), 1); CHECK_EQUAL(q.get_description(), query_string); + query_string = "link.mixed == obj(\"class_Int\",1)"; + q = linking->query(query_string); + CHECK_EQUAL(q.count(), 1); + CHECK_EQUAL(q.get_description(), query_string); + query_string = "link.string == obj(\"class_String\",\"first\")"; q = linking->query(query_string); CHECK_EQUAL(q.count(), 1); From e2a46ad30746ee6f68c3464cd8124eb8f216ae27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Edelbo?= Date: Fri, 9 Sep 2022 15:58:30 +0200 Subject: [PATCH 5/6] Fix tests --- src/realm/table.cpp | 3 +-- test/test_metrics.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/realm/table.cpp b/src/realm/table.cpp index 0329ad5dce2..a83999894c0 100644 --- a/src/realm/table.cpp +++ b/src/realm/table.cpp @@ -3164,8 +3164,7 @@ Obj Table::get_object_with_primary_key(Mixed primary_key) const DataType type = DataType(primary_key_col.get_type()); REALM_ASSERT((primary_key.is_null() && primary_key_col.get_attrs().test(col_attr_Nullable)) || primary_key.get_type() == type); - auto obj_key = m_index_accessors[primary_key_col.get_index().val]->find_first(primary_key); - return obj_key ? m_clusters.get(obj_key) : Obj{}; + return m_clusters.get(m_index_accessors[primary_key_col.get_index().val]->find_first(primary_key)); } Mixed Table::get_primary_key(ObjKey key) const diff --git a/test/test_metrics.cpp b/test/test_metrics.cpp index 9eee090bb07..95dd3ab13a9 100644 --- a/test/test_metrics.cpp +++ b/test/test_metrics.cpp @@ -613,7 +613,7 @@ TEST(Metrics_LinkListQueries) CHECK_EQUAL(find_count(count_link_description, "=="), 1); std::string links_description = queries->at(3).get_description(); - CHECK_EQUAL(find_count(links_description, "O0"), 1); + CHECK_EQUAL(find_count(links_description, "L0:0"), 1); CHECK_EQUAL(find_count(links_description, column_names[ll_col_key]), 1); CHECK_EQUAL(find_count(links_description, "=="), 1); From 9d61506365a3dfea2b66a6d6275f4fbcda124cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Edelbo?= Date: Mon, 12 Sep 2022 11:47:35 +0200 Subject: [PATCH 6/6] Update after review (2) --- src/realm/query.cpp | 4 ++-- src/realm/query_expression.hpp | 12 +++++++++--- src/realm/util/serializer.cpp | 2 +- src/realm/util/serializer.hpp | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/realm/query.cpp b/src/realm/query.cpp index f89c3e786c0..cc038c638cd 100644 --- a/src/realm/query.cpp +++ b/src/realm/query.cpp @@ -1844,11 +1844,11 @@ std::string Query::validate() const std::string Query::get_description(util::serializer::SerialisationState& state) const { std::string description; - if (root_node()) { + if (auto root = root_node()) { if (m_view) { throw SerialisationError("Serialisation of a query constrained by a view is not currently supported"); } - description = root_node()->describe_expression(state); + description = root->describe_expression(state); } else { // An empty query returns all results and one way to indicate this diff --git a/src/realm/query_expression.hpp b/src/realm/query_expression.hpp index 31b8b075800..e543c7c31b5 100644 --- a/src/realm/query_expression.hpp +++ b/src/realm/query_expression.hpp @@ -1233,8 +1233,14 @@ class Value : public ValueBase, public Subexpr2 { return util::serializer::print_value(val.get_type_of_value()); } else if constexpr (std::is_same_v) { - ObjLink link(state.taget_table->get_key(), val.template get()); - return util::serializer::print_value(link, state.group); + ObjKey obj_key = val.template get(); + if (state.target_table) { + ObjLink link(state.target_table->get_key(), obj_key); + return util::serializer::print_value(link, state.group); + } + else { + return util::serializer::print_value(obj_key); + } } else if constexpr (std::is_same_v) { return util::serializer::print_value(val.template get(), state.group); @@ -4231,7 +4237,7 @@ class Compare : public Expression { m_left->description(state)); } else { - state.taget_table = m_left->get_target_table(); + state.target_table = m_left->get_target_table(); return m_left->description(state) + " " + TCond::description() + " " + m_right->description(state); } } diff --git a/src/realm/util/serializer.cpp b/src/realm/util/serializer.cpp index d04de4914e0..385ec167cae 100644 --- a/src/realm/util/serializer.cpp +++ b/src/realm/util/serializer.cpp @@ -171,7 +171,7 @@ std::string print_value(realm::ObjLink link, Group* g) return "NULL"; } else { - TableRef target_table = g->get_table(link.get_table_key()); + TableRef target_table = g ? g->get_table(link.get_table_key()) : TableRef(); if (ColKey pk_col = target_table ? target_table->get_primary_key_column() : ColKey{}) { if (auto obj = target_table->try_get_object(link.get_obj_key())) { auto pk_val = obj.get_any(pk_col); diff --git a/src/realm/util/serializer.hpp b/src/realm/util/serializer.hpp index 02b44caf6a5..441a41e0bc8 100644 --- a/src/realm/util/serializer.hpp +++ b/src/realm/util/serializer.hpp @@ -113,7 +113,7 @@ struct SerialisationState { std::vector subquery_prefix_list; std::string class_prefix; Group* group; - ConstTableRef taget_table; + ConstTableRef target_table; }; } // namespace serializer