From 26d37e2c9bd7f1db055255dbb79fc44ed4b3a93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Edelbo?= Date: Mon, 19 Jun 2023 12:40:56 +0200 Subject: [PATCH] Support query on nested collections This includes supporting using index in query on list of primitives --- CHANGELOG.md | 2 + src/realm/collection.cpp | 44 + src/realm/collection.hpp | 11 +- src/realm/collection_parent.cpp | 25 +- src/realm/collection_parent.hpp | 11 +- src/realm/dictionary.cpp | 1 + src/realm/list.cpp | 3 + src/realm/parser/driver.cpp | 41 +- src/realm/parser/driver.hpp | 8 - src/realm/parser/generated/query_bison.cpp | 565 +++++---- src/realm/parser/generated/query_bison.hpp | 363 +++--- src/realm/parser/generated/query_flex.cpp | 1269 ++++++++++---------- src/realm/parser/query_bison.yy | 10 +- src/realm/parser/query_flex.ll | 4 +- src/realm/query_expression.cpp | 53 +- src/realm/query_expression.hpp | 166 ++- test/test_parser.cpp | 201 +++- 17 files changed, 1669 insertions(+), 1108 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8c0f61eb48..01fe4a15c97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ### Enhancements * (PR [#????](https://github.com/realm/realm-core/pull/????)) * Storage of Decimal128 properties has been optimised so that the individual values will take up 0 bits (if all nulls), 32 bits, 64 bits or 128 bits depending on what is needed. (PR [#6111]https://github.com/realm/realm-core/pull/6111)) +* You can have a collection embedded in any Mixed property (except Set). +* Querying a specific entry in a list-of-primitives (in particular 'first and 'last') is supported. (PR [#4269](https://github.com/realm/realm-core/issues/4269)) ### Fixed * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) diff --git a/src/realm/collection.cpp b/src/realm/collection.cpp index 636c89f6838..326fb3c3a87 100644 --- a/src/realm/collection.cpp +++ b/src/realm/collection.cpp @@ -1,6 +1,8 @@ #include #include #include +#include +#include namespace realm { @@ -91,6 +93,48 @@ void check_for_last_unresolved(BPlusTree* tree) Collection::~Collection() {} +Mixed Collection::get_any(Mixed val, Path::const_iterator begin, Path::const_iterator end, Allocator& alloc) +{ + auto path_size = end - begin; + if (val.is_type(type_Dictionary) && begin->is_key()) { + Array top(alloc); + top.init_from_ref(val.get_ref()); + + BPlusTree keys(alloc); + keys.set_parent(&top, 0); + keys.init_from_parent(); + size_t ndx = keys.find_first(StringData(begin->get_key())); + if (ndx != realm::not_found) { + BPlusTree values(alloc); + values.set_parent(&top, 1); + values.init_from_parent(); + val = values.get(ndx); + if (path_size > 1) { + val = Collection::get_any(val, begin + 1, end, alloc); + } + return val; + } + } + if (val.is_type(type_List) && begin->is_ndx()) { + ArrayMixed list(alloc); + list.init_from_ref(val.get_ref()); + if (size_t sz = list.size()) { + auto idx = begin->get_ndx(); + if (idx == size_t(-1)) { + idx = sz - 1; + } + if (idx < sz) { + val = list.get(idx); + } + if (path_size > 1) { + val = Collection::get_any(val, begin + 1, end, alloc); + } + return val; + } + } + return {}; +} + std::pair CollectionBase::get_open_close_strings(size_t link_depth, JSONOutputMode output_mode) const { diff --git a/src/realm/collection.hpp b/src/realm/collection.hpp index 73b7fe38f7d..0d8913b1452 100644 --- a/src/realm/collection.hpp +++ b/src/realm/collection.hpp @@ -94,6 +94,8 @@ class Collection { virtual Path get_short_path() const = 0; // Return a path based on keys instead of indices virtual StablePath get_stable_path() const = 0; + + static Mixed get_any(Mixed, Path::const_iterator, Path::const_iterator, Allocator&); }; using CollectionPtr = std::shared_ptr; @@ -585,14 +587,9 @@ class CollectionBaseImpl : public Interface, protected ArrayParent { return *this; } - ref_type get_collection_ref() const noexcept + ref_type get_collection_ref() const { - try { - return m_parent->get_collection_ref(m_index, Interface::s_collection_type); - } - catch (...) { - return ref_type(0); - } + return m_parent->get_collection_ref(m_index, Interface::s_collection_type); } void set_collection_ref(ref_type ref) diff --git a/src/realm/collection_parent.cpp b/src/realm/collection_parent.cpp index 86f9cdd51cb..265708eda4c 100644 --- a/src/realm/collection_parent.cpp +++ b/src/realm/collection_parent.cpp @@ -33,7 +33,16 @@ namespace realm { std::ostream& operator<<(std::ostream& ostr, const PathElement& elem) { if (elem.is_ndx()) { - ostr << elem.get_ndx(); + size_t ndx = elem.get_ndx(); + if (ndx == 0) { + ostr << "FIRST"; + } + else if (ndx == size_t(-1)) { + ostr << "LAST"; + } + else { + ostr << elem.get_ndx(); + } } else if (elem.is_col_key()) { ostr << elem.get_col_key(); @@ -45,10 +54,24 @@ std::ostream& operator<<(std::ostream& ostr, const PathElement& elem) return ostr; } +std::ostream& operator<<(std::ostream& ostr, const Path& path) +{ + for (auto& elem : path) { + ostr << '[' << elem << ']'; + } + return ostr; +} + /***************************** CollectionParent ******************************/ CollectionParent::~CollectionParent() {} +void CollectionParent::check_level() const +{ + if (m_level + 1 > s_max_level) { + throw LogicError(ErrorCodes::LimitExceeded, "Max nesting level reached"); + } +} void CollectionParent::set_backlink(ColKey col_key, ObjLink new_link) const { if (new_link && new_link.get_obj_key()) { diff --git a/src/realm/collection_parent.hpp b/src/realm/collection_parent.hpp index 4ccf855b5cd..8a5009a8b39 100644 --- a/src/realm/collection_parent.hpp +++ b/src/realm/collection_parent.hpp @@ -199,10 +199,11 @@ struct PathElement { } }; -std::ostream& operator<<(std::ostream& ostr, const PathElement& elem); - using Path = std::vector; +std::ostream& operator<<(std::ostream& ostr, const PathElement& elem); +std::ostream& operator<<(std::ostream& ostr, const Path& path); + // Path from the group level. struct FullPath { TableKey top_table; @@ -222,6 +223,7 @@ class CollectionParent : public std::enable_shared_from_this { { return m_level; } + void check_level() const; // Return the path to this object. The path is calculated from // the topmost Obj - which must be an Obj with a primary key. virtual FullPath get_path() const = 0; @@ -240,6 +242,11 @@ class CollectionParent : public std::enable_shared_from_this { friend class CollectionBaseImpl; friend class CollectionList; +#ifdef REALM_DEBUG + static constexpr size_t s_max_level = 4; +#else + static constexpr size_t s_max_level = 100; +#endif size_t m_level = 0; constexpr CollectionParent(size_t level = 0) diff --git a/src/realm/dictionary.cpp b/src/realm/dictionary.cpp index 3b1e3687320..dd0d9c47394 100644 --- a/src/realm/dictionary.cpp +++ b/src/realm/dictionary.cpp @@ -428,6 +428,7 @@ Obj Dictionary::create_and_insert_linked_object(Mixed key) void Dictionary::insert_collection(const PathElement& path_elem, CollectionType dict_or_list) { + check_level(); insert(path_elem.get_key(), Mixed(0, dict_or_list)); } diff --git a/src/realm/list.cpp b/src/realm/list.cpp index 221354c8c9c..c0db1bff55e 100644 --- a/src/realm/list.cpp +++ b/src/realm/list.cpp @@ -418,6 +418,7 @@ void Lst::swap(size_t ndx1, size_t ndx2) void Lst::insert_collection(const PathElement& path_elem, CollectionType dict_or_list) { ensure_created(); + check_level(); m_tree->ensure_keys(); insert(path_elem.get_ndx(), Mixed(0, dict_or_list)); int64_t key = generate_key(size()); @@ -435,6 +436,8 @@ void Lst::set_collection(const PathElement& path_elem, CollectionType typ Mixed old_val = do_get(ndx, "set()"); Mixed new_val(0, type); + check_level(); + if (old_val != new_val) { m_tree->ensure_keys(); set(ndx, Mixed(0, type)); diff --git a/src/realm/parser/driver.cpp b/src/realm/parser/driver.cpp index 1aed0ad4b9c..ca6b52ae5b5 100644 --- a/src/realm/parser/driver.cpp +++ b/src/realm/parser/driver.cpp @@ -537,7 +537,7 @@ Query EqualityNode::visit(ParserDriver* drv) else if (right->has_single_value() && (left_type == right_type || left_type == type_Mixed)) { Mixed val = right->get_mixed(); const ObjPropertyBase* prop = dynamic_cast(left.get()); - if (prop && !prop->links_exist()) { + if (prop && !prop->links_exist() && !prop->has_path()) { auto col_key = prop->column_key(); if (val.is_null()) { switch (op) { @@ -848,9 +848,21 @@ std::unique_ptr PropertyNode::visit(ParserDriver* drv, DataType) } std::unique_ptr subexpr{drv->column(m_link_chain, path)}; - if (!path->at_end()) { - if (path->is_identifier()) { - auto trailing = path->next_identifier(); + Path indexes; + while (!path->at_end()) { + indexes.emplace_back(std::move(*(path->current_path_elem++))); + } + + if (!indexes.empty()) { + const PathElement& first_index = indexes.front(); + if (indexes.size() > 1 && subexpr->get_type() != type_Mixed) { + throw InvalidQueryError("Only Property of type 'any' can have nested collections"); + } + if (auto mixed = dynamic_cast*>(subexpr.get())) { + mixed->path(indexes); + } + else if (first_index.is_key()) { + auto trailing = first_index.get_key(); if (auto dict = dynamic_cast*>(subexpr.get())) { if (trailing == "@values") { } @@ -858,7 +870,7 @@ std::unique_ptr PropertyNode::visit(ParserDriver* drv, DataType) subexpr = std::make_unique(*dict); } else { - dict->key(trailing); + dict->key(indexes); } } else { @@ -879,7 +891,24 @@ std::unique_ptr PropertyNode::visit(ParserDriver* drv, DataType) } } else { - throw InvalidQueryError("Index not supported"); + // This must be an integer index + REALM_ASSERT(first_index.is_ndx()); + auto ok = false; + if (indexes.size() == 1) { + if (auto coll = dynamic_cast(subexpr.get())) { + ok = coll->index(first_index); + } + } + else { + if (auto coll = dynamic_cast>*>(subexpr.get())) { + ok = coll->indexes(indexes); + } + } + if (!ok) { + throw InvalidQueryError(util::format("Property '%1.%2' does not support index '%3'", + m_link_chain.get_current_table()->get_class_name(), identifier, + first_index)); + } } } if (post_op) { diff --git a/src/realm/parser/driver.hpp b/src/realm/parser/driver.hpp index 98db936d9f6..331a28124d5 100644 --- a/src/realm/parser/driver.hpp +++ b/src/realm/parser/driver.hpp @@ -284,18 +284,10 @@ class PathNode : public ParserNode { { return current_path_elem == path_elems.end(); } - bool is_identifier() const - { - return current_path_elem->is_key(); - } const std::string& next_identifier() { return (current_path_elem++)->get_key(); } - size_t next_index() - { - return (current_path_elem++)->get_ndx(); - } const std::string& last_identifier() { return path_elems.back().get_key(); diff --git a/src/realm/parser/generated/query_bison.cpp b/src/realm/parser/generated/query_bison.cpp index 0a8dbbd1ecf..3b52852f141 100644 --- a/src/realm/parser/generated/query_bison.cpp +++ b/src/realm/parser/generated/query_bison.cpp @@ -309,9 +309,12 @@ namespace yy { case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value)); break; @@ -446,9 +449,12 @@ namespace yy { case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id value.move< std::string > (YY_MOVE (that.value)); break; @@ -583,9 +589,12 @@ namespace yy { case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id value.copy< std::string > (that.value); break; @@ -718,9 +727,12 @@ namespace yy { case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id value.move< std::string > (that.value); break; @@ -827,10 +839,6 @@ namespace yy { { yyo << "<>"; } break; - case symbol_kind::SYM_BACKLINK: // "@links" - { yyo << "<>"; } - break; - case symbol_kind::SYM_MAX: // "@max" { yyo << "<>"; } break; @@ -839,7 +847,7 @@ namespace yy { { yyo << "<>"; } break; - case symbol_kind::SYM_SUM: // "@sun" + case symbol_kind::SYM_SUM: // "@sum" { yyo << "<>"; } break; @@ -983,6 +991,14 @@ namespace yy { { yyo << yysym.value.template as < std::string > (); } break; + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + { yyo << yysym.value.template as < std::string > (); } + break; + + case symbol_kind::SYM_INDEX_LAST: // "LAST" + { yyo << yysym.value.template as < std::string > (); } + break; + case symbol_kind::SYM_SIZE: // "@size" { yyo << yysym.value.template as < std::string > (); } break; @@ -995,51 +1011,55 @@ namespace yy { { yyo << yysym.value.template as < std::string > (); } break; - case symbol_kind::SYM_61_: // '+' + case symbol_kind::SYM_BACKLINK: // "@links" + { yyo << yysym.value.template as < std::string > (); } + break; + + case symbol_kind::SYM_63_: // '+' { yyo << "<>"; } break; - case symbol_kind::SYM_62_: // '-' + case symbol_kind::SYM_64_: // '-' { yyo << "<>"; } break; - case symbol_kind::SYM_63_: // '*' + case symbol_kind::SYM_65_: // '*' { yyo << "<>"; } break; - case symbol_kind::SYM_64_: // '/' + case symbol_kind::SYM_66_: // '/' { yyo << "<>"; } break; - case symbol_kind::SYM_65_: // '(' + case symbol_kind::SYM_67_: // '(' { yyo << "<>"; } break; - case symbol_kind::SYM_66_: // ')' + case symbol_kind::SYM_68_: // ')' { yyo << "<>"; } break; - case symbol_kind::SYM_67_: // '.' + case symbol_kind::SYM_69_: // '.' { yyo << "<>"; } break; - case symbol_kind::SYM_68_: // ',' + case symbol_kind::SYM_70_: // ',' { yyo << "<>"; } break; - case symbol_kind::SYM_69_: // '[' + case symbol_kind::SYM_71_: // '[' { yyo << "<>"; } break; - case symbol_kind::SYM_70_: // ']' + case symbol_kind::SYM_72_: // ']' { yyo << "<>"; } break; - case symbol_kind::SYM_71_: // '{' + case symbol_kind::SYM_73_: // '{' { yyo << "<>"; } break; - case symbol_kind::SYM_72_: // '}' + case symbol_kind::SYM_74_: // '}' { yyo << "<>"; } break; @@ -1529,9 +1549,12 @@ namespace yy { case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id yylhs.value.emplace< std::string > (); break; @@ -1940,7 +1963,7 @@ namespace yy { { yylhs.value.as < int > () = int(AggrNode::MIN);} break; - case 95: // aggr_op: '.' "@sun" + case 95: // aggr_op: '.' "@sum" { yylhs.value.as < int > () = int(AggrNode::SUM);} break; @@ -2004,71 +2027,87 @@ namespace yy { { yystack_[3].value.as < PathNode* > ()->add_element(size_t(strtoll(yystack_[1].value.as < std::string > ().c_str(), nullptr, 0))); yylhs.value.as < PathNode* > () = yystack_[3].value.as < PathNode* > (); } break; - case 111: // path: path '[' "string" ']' + case 111: // path: path '[' "FIRST" ']' + { yystack_[3].value.as < PathNode* > ()->add_element(size_t(0)); yylhs.value.as < PathNode* > () = yystack_[3].value.as < PathNode* > (); } + break; + + case 112: // path: path '[' "LAST" ']' + { yystack_[3].value.as < PathNode* > ()->add_element(size_t(-1)); yylhs.value.as < PathNode* > () = yystack_[3].value.as < PathNode* > (); } + break; + + case 113: // path: path '[' "string" ']' { yystack_[3].value.as < PathNode* > ()->add_element(yystack_[1].value.as < std::string > ().substr(1, yystack_[1].value.as < std::string > ().size() - 2)); yylhs.value.as < PathNode* > () = yystack_[3].value.as < PathNode* > (); } break; - case 112: // path: path '[' "argument" ']' + case 114: // path: path '[' "argument" ']' { yystack_[3].value.as < PathNode* > ()->add_element(drv.get_arg_for_index(yystack_[1].value.as < std::string > ())); yylhs.value.as < PathNode* > () = yystack_[3].value.as < PathNode* > (); } break; - case 113: // id: "identifier" + case 115: // id: "identifier" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 114: // id: "@links" + case 116: // id: "@links" { yylhs.value.as < std::string > () = std::string("@links"); } break; - case 115: // id: "beginswith" + case 117: // id: "beginswith" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } + break; + + case 118: // id: "endswith" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } + break; + + case 119: // id: "contains" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 116: // id: "endswith" + case 120: // id: "like" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 117: // id: "contains" + case 121: // id: "between" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 118: // id: "like" + case 122: // id: "key or value" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 119: // id: "between" + case 123: // id: "sort" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 120: // id: "key or value" + case 124: // id: "distinct" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 121: // id: "sort" + case 125: // id: "limit" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 122: // id: "distinct" + case 126: // id: "ascending" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 123: // id: "limit" + case 127: // id: "descending" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 124: // id: "ascending" + case 128: // id: "in" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 125: // id: "descending" + case 129: // id: "fulltext" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 126: // id: "in" + case 130: // id: "FIRST" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; - case 127: // id: "fulltext" + case 131: // id: "LAST" { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } break; @@ -2420,247 +2459,257 @@ namespace yy { } - const short parser::yypact_ninf_ = -166; + const short parser::yypact_ninf_ = -150; const signed char parser::yytable_ninf_ = -1; const short parser::yypact_[] = { - 105, -166, -166, -50, -166, -166, -166, -166, -166, -166, - -166, 105, -166, -166, -166, -166, -166, -166, -166, -166, - -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, - -166, -166, -166, -31, -166, -166, -166, -166, -166, -166, - 105, 427, 5, 144, -166, 233, 70, -13, -166, -166, - -166, -166, -166, -166, 371, -6, -166, 494, -166, 18, - -8, 10, -60, -166, 12, -166, 105, 105, 73, -166, - -166, -166, -166, -166, -166, -166, 222, 222, 222, 222, - 166, 222, -166, -166, -166, 339, -166, 9, 283, 54, - -166, 427, 63, 452, 61, -166, -3, 7, 97, 16, - -166, -166, 427, -166, -166, 81, 13, 22, 55, -166, - -166, -166, 222, 161, -166, -166, 161, -166, -166, 222, - 131, 131, -166, -166, 62, 339, -166, 91, 98, 110, - -166, -166, -58, 473, -166, -166, -166, -166, -166, -166, - -166, -166, 120, 147, 162, 494, 494, 494, 67, -166, - 494, 494, 214, 125, 131, -166, 182, 202, 182, -166, - -166, -166, -166, -166, 212, 215, 112, -28, 167, 97, - 218, 58, 217, 182, -166, 168, 224, 105, -166, -166, - 494, -166, -166, -166, -166, 494, -166, -166, -166, -166, - 235, 182, -166, -36, -166, 202, 58, 28, -28, 97, - 58, 220, 182, -166, -166, 238, 239, -166, 180, -166, - -166, -166, 247, 270, -166, -166, 240, -166 + 114, -150, -150, -59, -150, -150, -150, -150, -150, -150, + 114, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -51, -150, -150, -150, -150, -150, -150, -150, + -150, -150, 114, 420, 30, 38, -150, 252, 149, -25, + -150, -150, -150, -150, -150, -150, 434, -28, -150, 521, + -150, 26, 8, 9, -63, -150, 51, -150, 114, 114, + 57, -150, -150, -150, -150, -150, -150, -150, 241, 241, + 241, 241, 183, 241, -150, -150, -150, 362, -150, 10, + 304, -13, -150, 420, 15, 479, 55, -150, -2, 28, + 25, 59, -150, -150, 420, -150, -150, 118, 97, 106, + 115, -150, -150, -150, 241, 50, -150, -150, 50, -150, + -150, 241, 71, 71, -150, -150, 129, 362, -150, 136, + 137, 138, -150, -150, -35, 500, -150, -150, -150, -150, + -150, -150, -150, -150, 134, 135, 139, 161, 170, 521, + 521, 521, 65, -150, 521, 521, 174, 60, 71, -150, + 172, 178, 172, -150, -150, -150, -150, -150, -150, -150, + 140, 141, 109, 36, 110, 25, 184, 72, 185, 172, + -150, 116, 190, 114, -150, -150, 521, -150, -150, -150, + -150, 521, -150, -150, -150, -150, 197, 172, -150, -34, + -150, 178, 72, 14, 36, 25, 72, 186, 172, -150, + -150, 200, 222, -150, 70, -150, -150, -150, 194, 233, + -150, -150, 228, -150 }; - const signed char + const unsigned char parser::yydefact_[] = { 0, 85, 86, 0, 74, 75, 76, 87, 88, 89, - 114, 0, 113, 82, 69, 67, 68, 80, 81, 70, - 71, 83, 84, 72, 73, 77, 115, 116, 117, 127, - 118, 119, 126, 0, 121, 122, 123, 124, 125, 120, - 0, 64, 0, 48, 3, 0, 18, 25, 27, 28, - 26, 24, 66, 8, 0, 90, 108, 0, 6, 0, - 0, 0, 0, 63, 0, 1, 0, 0, 2, 97, - 98, 100, 102, 103, 101, 99, 0, 0, 0, 0, - 0, 0, 104, 105, 106, 0, 107, 0, 0, 0, - 78, 64, 90, 0, 0, 29, 32, 0, 33, 0, - 7, 19, 0, 61, 5, 4, 0, 0, 0, 50, - 49, 51, 0, 22, 18, 25, 23, 20, 21, 0, - 9, 11, 13, 15, 0, 0, 12, 0, 0, 0, - 17, 16, 0, 0, 30, 93, 94, 95, 96, 91, - 92, 109, 0, 0, 0, 0, 0, 0, 0, 65, - 0, 0, 0, 0, 10, 14, 0, 0, 0, 62, - 111, 110, 112, 31, 0, 0, 0, 0, 0, 53, - 0, 0, 0, 0, 43, 0, 0, 0, 79, 55, - 0, 59, 60, 56, 52, 0, 58, 36, 35, 37, - 0, 0, 40, 0, 47, 0, 0, 0, 0, 54, - 0, 0, 0, 42, 44, 0, 0, 57, 0, 45, - 41, 46, 0, 0, 38, 34, 0, 39 + 0, 115, 82, 69, 67, 68, 80, 81, 70, 71, + 83, 84, 72, 73, 77, 117, 118, 119, 129, 120, + 121, 128, 0, 123, 124, 125, 126, 127, 130, 131, + 122, 116, 0, 64, 0, 48, 3, 0, 18, 25, + 27, 28, 26, 24, 66, 8, 0, 90, 108, 0, + 6, 0, 0, 0, 0, 63, 0, 1, 0, 0, + 2, 97, 98, 100, 102, 103, 101, 99, 0, 0, + 0, 0, 0, 0, 104, 105, 106, 0, 107, 0, + 0, 0, 78, 64, 90, 0, 0, 29, 32, 0, + 33, 0, 7, 19, 0, 61, 5, 4, 0, 0, + 0, 50, 49, 51, 0, 22, 18, 25, 23, 20, + 21, 0, 9, 11, 13, 15, 0, 0, 12, 0, + 0, 0, 17, 16, 0, 0, 30, 93, 94, 95, + 96, 91, 92, 109, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 0, 0, 0, 0, 10, 14, + 0, 0, 0, 62, 113, 110, 114, 111, 112, 31, + 0, 0, 0, 0, 0, 53, 0, 0, 0, 0, + 43, 0, 0, 0, 79, 55, 0, 59, 60, 56, + 52, 0, 58, 36, 35, 37, 0, 0, 40, 0, + 47, 0, 0, 0, 0, 54, 0, 0, 0, 42, + 44, 0, 0, 57, 0, 45, 41, 46, 0, 0, + 38, 34, 0, 39 }; const short parser::yypgoto_[] = { - -166, -166, -10, -166, -33, 0, 2, -166, -166, -166, - -165, -140, -166, 113, -166, -166, -166, -166, -166, -166, - -166, -166, 111, 225, 243, -32, 163, -166, -37, 249, - -166, -166, -166, -166, -51, -56 + -150, -150, -9, -150, -33, 0, 2, -150, -150, -150, + -149, -145, -150, 103, -150, -150, -150, -150, -150, -150, + -150, -150, 101, 217, 214, -39, 171, -150, -38, 219, + -150, -150, -150, -150, -53, -71 }; const unsigned char parser::yydefgoto_[] = { - 0, 42, 43, 44, 45, 114, 115, 48, 97, 49, - 190, 172, 193, 174, 175, 131, 68, 109, 168, 110, - 166, 111, 183, 50, 62, 51, 52, 53, 54, 95, - 96, 80, 81, 88, 55, 56 + 0, 44, 45, 46, 47, 116, 117, 50, 99, 51, + 196, 178, 199, 180, 181, 133, 70, 111, 174, 112, + 172, 113, 189, 52, 64, 53, 54, 55, 56, 97, + 98, 82, 83, 90, 57, 58 }; const unsigned char parser::yytable_[] = { - 46, 58, 47, 92, 64, 65, 98, 61, 102, 63, - 102, 46, 103, 47, 159, 57, 66, 67, 176, 69, - 70, 71, 72, 73, 74, 7, 8, 9, 181, 182, - 60, 205, 202, 192, 59, 208, 203, 141, 89, 147, - 46, 94, 47, 113, 116, 117, 118, 120, 121, 99, - 124, 201, 66, 67, 64, 90, 104, 105, 100, 63, - 75, 93, 210, 94, 145, 64, 46, 46, 47, 47, - 149, 76, 77, 78, 79, 146, 101, 141, 150, 153, - 41, 127, 128, 129, 148, 122, 154, 151, 126, 163, - 164, 141, 142, 187, 206, 188, 143, 130, 13, 167, - 169, 189, 17, 18, 144, 66, 21, 22, 1, 2, - 3, 4, 5, 6, 82, 83, 84, 85, 86, 87, - 152, 7, 8, 9, 10, 155, 106, 107, 108, 198, - 133, 11, 94, 91, 199, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 156, 33, 34, 35, - 36, 37, 38, 157, 147, 39, 94, 197, 66, 67, - 40, 3, 4, 5, 6, 158, 41, 46, 179, 47, - 180, 119, 7, 8, 9, 10, 76, 77, 78, 79, - 160, 101, 76, 77, 78, 79, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 161, 33, 34, - 35, 36, 37, 38, 78, 79, 39, 3, 4, 5, - 6, 112, 162, 184, 194, 185, 195, 41, 7, 8, - 9, 10, 69, 70, 71, 72, 73, 74, 213, 170, - 214, 171, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 173, 33, 34, 35, 36, 37, 38, - 177, 178, 39, 75, 186, 191, 209, 112, 3, 4, - 5, 6, 196, 41, 76, 77, 78, 79, 125, 7, - 8, 9, 10, 200, 211, 215, 212, 216, 204, 207, - 217, 165, 123, 12, 13, 14, 15, 16, 17, 18, + 48, 60, 49, 94, 65, 66, 100, 104, 59, 63, + 48, 105, 49, 129, 130, 131, 61, 182, 71, 72, + 73, 74, 75, 76, 143, 91, 7, 8, 9, 132, + 67, 68, 69, 62, 198, 104, 208, 68, 69, 163, + 209, 95, 48, 96, 49, 115, 118, 119, 120, 122, + 123, 126, 207, 211, 65, 66, 101, 214, 77, 106, + 107, 68, 69, 216, 143, 153, 66, 149, 48, 48, + 49, 49, 78, 79, 80, 81, 102, 103, 169, 170, + 143, 157, 212, 43, 135, 144, 96, 124, 158, 145, + 128, 187, 188, 92, 151, 12, 96, 146, 150, 16, + 17, 173, 175, 20, 21, 151, 193, 96, 194, 108, + 109, 110, 147, 148, 195, 80, 81, 1, 2, 3, + 4, 5, 6, 78, 79, 80, 81, 159, 103, 152, + 7, 8, 9, 204, 78, 79, 80, 81, 205, 10, + 219, 68, 220, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 154, 32, 33, 34, 35, 36, + 37, 38, 39, 155, 203, 40, 41, 185, 190, 186, + 191, 42, 156, 48, 200, 49, 201, 43, 3, 4, + 5, 6, 84, 85, 86, 87, 88, 89, 121, 7, + 8, 9, 93, 160, 161, 162, 164, 165, 176, 184, + 183, 166, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 132, 33, 34, 35, 36, 37, - 38, 134, 0, 39, 3, 4, 5, 6, 0, 0, - 0, 0, 0, 0, 41, 7, 8, 9, 10, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 10, 33, 34, 35, 36, 37, 38, 0, 0, 39, - 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, - 41, 0, 0, 0, 90, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 34, 35, 36, 37, 38, 0, - 0, 39, 0, 4, 5, 6, 0, 0, 0, 0, - 0, 0, 91, 7, 8, 9, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 10, 135, 136, 137, 138, 0, 0, 0, 33, - 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 10, 0, 0, 0, 26, 27, 28, 29, - 30, 31, 32, 12, 0, 34, 35, 36, 37, 38, - 139, 140, 39, 10, 0, 0, 0, 26, 27, 28, - 29, 30, 31, 32, 12, 0, 34, 35, 36, 37, - 38, 139, 140, 39, 0, 0, 0, 0, 26, 27, - 28, 29, 30, 31, 32, 0, 0, 34, 35, 36, - 37, 38, 0, 0, 39 + 29, 30, 31, 167, 32, 33, 34, 35, 36, 37, + 38, 39, 168, 177, 40, 41, 3, 4, 5, 6, + 114, 179, 192, 221, 215, 197, 43, 7, 8, 9, + 202, 71, 72, 73, 74, 75, 76, 206, 217, 222, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 218, 32, 33, 34, 35, 36, 37, 38, 39, + 223, 77, 40, 41, 210, 213, 125, 134, 114, 3, + 4, 5, 6, 136, 43, 78, 79, 80, 81, 127, + 7, 8, 9, 171, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 0, 32, 33, 34, 35, 36, + 37, 38, 39, 0, 0, 40, 41, 3, 4, 5, + 6, 0, 0, 0, 0, 0, 0, 43, 7, 8, + 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 0, 32, 33, 34, 35, 36, 37, 38, + 39, 0, 0, 40, 41, 0, 4, 5, 6, 0, + 0, 0, 0, 0, 0, 43, 7, 8, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 11, 0, 0, 0, 0, 0, 0, + 0, 32, 0, 0, 0, 0, 92, 25, 26, 27, + 28, 29, 30, 31, 0, 0, 33, 34, 35, 36, + 37, 38, 39, 0, 0, 40, 41, 0, 137, 138, + 139, 140, 0, 0, 0, 0, 0, 93, 11, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 25, 26, 27, 28, 29, 30, 31, 11, + 0, 33, 34, 35, 36, 37, 38, 39, 141, 142, + 40, 41, 0, 25, 26, 27, 28, 29, 30, 31, + 11, 0, 33, 34, 35, 36, 37, 38, 39, 141, + 142, 40, 41, 0, 25, 26, 27, 28, 29, 30, + 31, 0, 0, 33, 34, 35, 36, 37, 38, 39, + 0, 0, 40, 41 }; const short parser::yycheck_[] = { - 0, 11, 0, 54, 41, 0, 57, 40, 68, 41, - 68, 11, 72, 11, 72, 65, 24, 25, 158, 9, - 10, 11, 12, 13, 14, 16, 17, 18, 56, 57, - 40, 196, 68, 173, 65, 200, 72, 93, 51, 67, - 40, 69, 40, 76, 77, 78, 79, 80, 81, 31, - 87, 191, 24, 25, 91, 43, 66, 67, 66, 91, - 50, 67, 202, 69, 67, 102, 66, 67, 66, 67, - 102, 61, 62, 63, 64, 68, 66, 133, 65, 112, - 71, 27, 28, 29, 68, 85, 119, 65, 88, 145, - 146, 147, 31, 35, 66, 37, 35, 43, 31, 150, - 151, 43, 35, 36, 43, 24, 39, 40, 3, 4, - 5, 6, 7, 8, 44, 45, 46, 47, 48, 49, - 65, 16, 17, 18, 19, 125, 53, 54, 55, 180, - 67, 26, 69, 71, 185, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 65, 52, 53, 54, - 55, 56, 57, 65, 67, 60, 69, 177, 24, 25, - 65, 5, 6, 7, 8, 65, 71, 177, 66, 177, - 68, 15, 16, 17, 18, 19, 61, 62, 63, 64, - 70, 66, 61, 62, 63, 64, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 70, 52, 53, - 54, 55, 56, 57, 63, 64, 60, 5, 6, 7, - 8, 65, 70, 66, 66, 68, 68, 71, 16, 17, - 18, 19, 9, 10, 11, 12, 13, 14, 68, 35, - 70, 69, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 71, 52, 53, 54, 55, 56, 57, - 68, 66, 60, 50, 66, 68, 66, 65, 5, 6, - 7, 8, 68, 71, 61, 62, 63, 64, 15, 16, - 17, 18, 19, 68, 66, 58, 67, 37, 195, 198, - 70, 148, 87, 30, 31, 32, 33, 34, 35, 36, + 0, 10, 0, 56, 43, 43, 59, 70, 67, 42, + 10, 74, 10, 26, 27, 28, 67, 162, 9, 10, + 11, 12, 13, 14, 95, 50, 16, 17, 18, 42, + 0, 23, 24, 42, 179, 70, 70, 23, 24, 74, + 74, 69, 42, 71, 42, 78, 79, 80, 81, 82, + 83, 89, 197, 202, 93, 93, 30, 206, 49, 68, + 69, 23, 24, 208, 135, 104, 104, 69, 68, 69, + 68, 69, 63, 64, 65, 66, 68, 68, 149, 150, + 151, 114, 68, 73, 69, 30, 71, 87, 121, 34, + 90, 55, 56, 42, 69, 30, 71, 42, 70, 34, + 35, 154, 155, 38, 39, 69, 34, 71, 36, 52, + 53, 54, 57, 58, 42, 65, 66, 3, 4, 5, + 6, 7, 8, 63, 64, 65, 66, 127, 68, 70, + 16, 17, 18, 186, 63, 64, 65, 66, 191, 25, + 70, 23, 72, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 67, 51, 52, 53, 54, 55, + 56, 57, 58, 67, 183, 61, 62, 68, 68, 70, + 70, 67, 67, 183, 68, 183, 70, 73, 5, 6, + 7, 8, 43, 44, 45, 46, 47, 48, 15, 16, + 17, 18, 73, 67, 67, 67, 72, 72, 34, 68, + 70, 72, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 91, 52, 53, 54, 55, 56, - 57, 92, -1, 60, 5, 6, 7, 8, -1, -1, - -1, -1, -1, -1, 71, 16, 17, 18, 19, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 19, 52, 53, 54, 55, 56, 57, -1, -1, 60, - -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, - 71, -1, -1, -1, 43, 44, 45, 46, 47, 48, - 49, 50, -1, -1, 53, 54, 55, 56, 57, -1, - -1, 60, -1, 6, 7, 8, -1, -1, -1, -1, - -1, -1, 71, 16, 17, 18, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 19, 20, 21, 22, 23, -1, -1, -1, 52, - -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 19, -1, -1, -1, 44, 45, 46, 47, - 48, 49, 50, 30, -1, 53, 54, 55, 56, 57, - 58, 59, 60, 19, -1, -1, -1, 44, 45, 46, - 47, 48, 49, 50, 30, -1, 53, 54, 55, 56, - 57, 58, 59, 60, -1, -1, -1, -1, 44, 45, - 46, 47, 48, 49, 50, -1, -1, 53, 54, 55, - 56, 57, -1, -1, 60 + 47, 48, 49, 72, 51, 52, 53, 54, 55, 56, + 57, 58, 72, 71, 61, 62, 5, 6, 7, 8, + 67, 73, 68, 59, 68, 70, 73, 16, 17, 18, + 70, 9, 10, 11, 12, 13, 14, 70, 68, 36, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 69, 51, 52, 53, 54, 55, 56, 57, 58, + 72, 49, 61, 62, 201, 204, 89, 93, 67, 5, + 6, 7, 8, 94, 73, 63, 64, 65, 66, 15, + 16, 17, 18, 152, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, -1, 51, 52, 53, 54, 55, + 56, 57, 58, -1, -1, 61, 62, 5, 6, 7, + 8, -1, -1, -1, -1, -1, -1, 73, 16, 17, + 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, -1, 51, 52, 53, 54, 55, 56, 57, + 58, -1, -1, 61, 62, -1, 6, 7, 8, -1, + -1, -1, -1, -1, -1, 73, 16, 17, 18, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 29, -1, -1, -1, -1, -1, -1, + -1, 51, -1, -1, -1, -1, 42, 43, 44, 45, + 46, 47, 48, 49, -1, -1, 52, 53, 54, 55, + 56, 57, 58, -1, -1, 61, 62, -1, 19, 20, + 21, 22, -1, -1, -1, -1, -1, 73, 29, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 43, 44, 45, 46, 47, 48, 49, 29, + -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, -1, 43, 44, 45, 46, 47, 48, 49, + 29, -1, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, -1, 43, 44, 45, 46, 47, 48, + 49, -1, -1, 52, 53, 54, 55, 56, 57, 58, + -1, -1, 61, 62 }; const signed char parser::yystos_[] = { 0, 3, 4, 5, 6, 7, 8, 16, 17, 18, - 19, 26, 30, 31, 32, 33, 34, 35, 36, 37, + 25, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 52, 53, 54, 55, 56, 57, 60, - 65, 71, 74, 75, 76, 77, 78, 79, 80, 82, - 96, 98, 99, 100, 101, 107, 108, 65, 75, 65, - 75, 77, 97, 98, 101, 0, 24, 25, 89, 9, - 10, 11, 12, 13, 14, 50, 61, 62, 63, 64, - 104, 105, 44, 45, 46, 47, 48, 49, 106, 51, - 43, 71, 107, 67, 69, 102, 103, 81, 107, 31, - 66, 66, 68, 72, 75, 75, 53, 54, 55, 90, - 92, 94, 65, 77, 78, 79, 77, 77, 77, 15, - 77, 77, 78, 96, 101, 15, 78, 27, 28, 29, - 43, 88, 97, 67, 102, 20, 21, 22, 23, 58, - 59, 108, 31, 35, 43, 67, 68, 67, 68, 98, - 65, 65, 65, 77, 77, 78, 65, 65, 65, 72, - 70, 70, 70, 108, 108, 99, 93, 107, 91, 107, - 35, 69, 84, 71, 86, 87, 84, 68, 66, 66, - 68, 56, 57, 95, 66, 68, 66, 35, 37, 43, - 83, 68, 84, 85, 66, 68, 68, 75, 107, 107, - 68, 84, 68, 72, 86, 83, 66, 95, 83, 66, - 84, 66, 67, 68, 70, 58, 37, 70 + 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, + 61, 62, 67, 73, 76, 77, 78, 79, 80, 81, + 82, 84, 98, 100, 101, 102, 103, 109, 110, 67, + 77, 67, 77, 79, 99, 100, 103, 0, 23, 24, + 91, 9, 10, 11, 12, 13, 14, 49, 63, 64, + 65, 66, 106, 107, 43, 44, 45, 46, 47, 48, + 108, 50, 42, 73, 109, 69, 71, 104, 105, 83, + 109, 30, 68, 68, 70, 74, 77, 77, 52, 53, + 54, 92, 94, 96, 67, 79, 80, 81, 79, 79, + 79, 15, 79, 79, 80, 98, 103, 15, 80, 26, + 27, 28, 42, 90, 99, 69, 104, 19, 20, 21, + 22, 59, 60, 110, 30, 34, 42, 57, 58, 69, + 70, 69, 70, 100, 67, 67, 67, 79, 79, 80, + 67, 67, 67, 74, 72, 72, 72, 72, 72, 110, + 110, 101, 95, 109, 93, 109, 34, 71, 86, 73, + 88, 89, 86, 70, 68, 68, 70, 55, 56, 97, + 68, 70, 68, 34, 36, 42, 85, 70, 86, 87, + 68, 70, 70, 77, 109, 109, 70, 86, 70, 74, + 88, 85, 68, 97, 85, 68, 86, 68, 69, 70, + 72, 59, 36, 72 }; const signed char parser::yyr1_[] = { - 0, 73, 74, 75, 75, 75, 75, 75, 75, 76, - 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, - 77, 77, 77, 77, 78, 78, 78, 78, 78, 79, - 79, 80, 80, 81, 82, 83, 83, 83, 84, 84, - 85, 85, 86, 87, 87, 88, 88, 88, 89, 89, - 89, 89, 90, 91, 91, 92, 93, 93, 94, 95, - 95, 96, 96, 97, 97, 97, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 99, 99, 99, 99, 99, 100, 100, 101, 101, 101, - 102, 102, 102, 103, 103, 103, 103, 104, 104, 104, - 105, 105, 105, 105, 106, 106, 106, 106, 107, 107, - 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, - 108, 108, 108, 108, 108, 108, 108, 108 + 0, 75, 76, 77, 77, 77, 77, 77, 77, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, + 79, 79, 79, 79, 80, 80, 80, 80, 80, 81, + 81, 82, 82, 83, 84, 85, 85, 85, 86, 86, + 87, 87, 88, 89, 89, 90, 90, 90, 91, 91, + 91, 91, 92, 93, 93, 94, 95, 95, 96, 97, + 97, 98, 98, 99, 99, 99, 100, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 101, 101, 101, 101, 101, 102, 102, 103, 103, 103, + 104, 104, 104, 105, 105, 105, 105, 106, 106, 106, + 107, 107, 107, 107, 108, 108, 108, 108, 109, 109, + 109, 109, 109, 109, 109, 110, 110, 110, 110, 110, + 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, + 110, 110 }; const signed char @@ -2677,8 +2726,9 @@ namespace yy { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1 + 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1 }; @@ -2691,17 +2741,17 @@ namespace yy { "\"end of file\"", "error", "\"invalid token\"", "\"truepredicate\"", "\"falsepredicate\"", "\"subquery\"", "\"true\"", "\"false\"", "\"null\"", "\"==\"", "\"!=\"", "\"<\"", "\">\"", "\">=\"", "\"<=\"", - "\"[c]\"", "\"any\"", "\"all\"", "\"none\"", "\"@links\"", "\"@max\"", - "\"@min\"", "\"@sun\"", "\"@average\"", "\"&&\"", "\"||\"", "\"!\"", - "\"geobox\"", "\"geopolygon\"", "\"geocircle\"", "\"identifier\"", - "\"string\"", "\"base64\"", "\"infinity\"", "\"NaN\"", "\"natural0\"", - "\"number\"", "\"float\"", "\"date\"", "\"UUID\"", "\"ObjectId\"", - "\"link\"", "\"typed link\"", "\"argument\"", "\"beginswith\"", - "\"endswith\"", "\"contains\"", "\"fulltext\"", "\"like\"", - "\"between\"", "\"in\"", "\"geowithin\"", "\"obj\"", "\"sort\"", - "\"distinct\"", "\"limit\"", "\"ascending\"", "\"descending\"", - "\"@size\"", "\"@type\"", "\"key or value\"", "'+'", "'-'", "'*'", "'/'", - "'('", "')'", "'.'", "','", "'['", "']'", "'{'", "'}'", "$accept", + "\"[c]\"", "\"any\"", "\"all\"", "\"none\"", "\"@max\"", "\"@min\"", + "\"@sum\"", "\"@average\"", "\"&&\"", "\"||\"", "\"!\"", "\"geobox\"", + "\"geopolygon\"", "\"geocircle\"", "\"identifier\"", "\"string\"", + "\"base64\"", "\"infinity\"", "\"NaN\"", "\"natural0\"", "\"number\"", + "\"float\"", "\"date\"", "\"UUID\"", "\"ObjectId\"", "\"link\"", + "\"typed link\"", "\"argument\"", "\"beginswith\"", "\"endswith\"", + "\"contains\"", "\"fulltext\"", "\"like\"", "\"between\"", "\"in\"", + "\"geowithin\"", "\"obj\"", "\"sort\"", "\"distinct\"", "\"limit\"", + "\"ascending\"", "\"descending\"", "\"FIRST\"", "\"LAST\"", "\"@size\"", + "\"@type\"", "\"key or value\"", "\"@links\"", "'+'", "'-'", "'*'", + "'/'", "'('", "')'", "'.'", "','", "'['", "']'", "'{'", "'}'", "$accept", "final", "query", "compare", "expr", "value", "prop", "aggregate", "simple_prop", "subquery", "coordinate", "geopoint", "geoloop_content", "geoloop", "geopoly_content", "geospatial", "post_query", "distinct", @@ -2716,19 +2766,20 @@ namespace yy { const short parser::yyrline_[] = { - 0, 174, 174, 177, 178, 179, 180, 181, 182, 185, - 186, 191, 192, 193, 194, 199, 200, 201, 204, 205, - 206, 207, 208, 209, 212, 213, 214, 215, 216, 219, - 220, 223, 227, 233, 236, 239, 240, 241, 244, 245, - 248, 249, 251, 254, 255, 258, 259, 260, 263, 264, - 265, 266, 268, 271, 272, 274, 277, 278, 280, 283, - 284, 286, 287, 290, 291, 292, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 316, 317, 318, 319, 320, 323, 324, 327, 328, 329, - 332, 333, 334, 337, 338, 339, 340, 343, 344, 345, - 348, 349, 350, 351, 354, 355, 356, 357, 360, 361, - 362, 363, 364, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 379, 380, 381 + 0, 176, 176, 179, 180, 181, 182, 183, 184, 187, + 188, 193, 194, 195, 196, 201, 202, 203, 206, 207, + 208, 209, 210, 211, 214, 215, 216, 217, 218, 221, + 222, 225, 229, 235, 238, 241, 242, 243, 246, 247, + 250, 251, 253, 256, 257, 260, 261, 262, 265, 266, + 267, 268, 270, 273, 274, 276, 279, 280, 282, 285, + 286, 288, 289, 292, 293, 294, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 318, 319, 320, 321, 322, 325, 326, 329, 330, 331, + 334, 335, 336, 339, 340, 341, 342, 345, 346, 347, + 350, 351, 352, 353, 356, 357, 358, 359, 362, 363, + 364, 365, 366, 367, 368, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387 }; void diff --git a/src/realm/parser/generated/query_bison.hpp b/src/realm/parser/generated/query_bison.hpp index 360dabd1656..b9f6ba42301 100644 --- a/src/realm/parser/generated/query_bison.hpp +++ b/src/realm/parser/generated/query_bison.hpp @@ -530,9 +530,12 @@ namespace yy { // "limit" // "ascending" // "descending" + // "FIRST" + // "LAST" // "@size" // "@type" // "key or value" + // "@links" // id char dummy19[sizeof (std::string)]; }; @@ -597,48 +600,50 @@ namespace yy { TOK_ANY = 271, // "any" TOK_ALL = 272, // "all" TOK_NONE = 273, // "none" - TOK_BACKLINK = 274, // "@links" - TOK_MAX = 275, // "@max" - TOK_MIN = 276, // "@min" - TOK_SUM = 277, // "@sun" - TOK_AVG = 278, // "@average" - TOK_AND = 279, // "&&" - TOK_OR = 280, // "||" - TOK_NOT = 281, // "!" - TOK_GEOBOX = 282, // "geobox" - TOK_GEOPOLYGON = 283, // "geopolygon" - TOK_GEOCIRCLE = 284, // "geocircle" - TOK_ID = 285, // "identifier" - TOK_STRING = 286, // "string" - TOK_BASE64 = 287, // "base64" - TOK_INFINITY = 288, // "infinity" - TOK_NAN = 289, // "NaN" - TOK_NATURAL0 = 290, // "natural0" - TOK_NUMBER = 291, // "number" - TOK_FLOAT = 292, // "float" - TOK_TIMESTAMP = 293, // "date" - TOK_UUID = 294, // "UUID" - TOK_OID = 295, // "ObjectId" - TOK_LINK = 296, // "link" - TOK_TYPED_LINK = 297, // "typed link" - TOK_ARG = 298, // "argument" - TOK_BEGINSWITH = 299, // "beginswith" - TOK_ENDSWITH = 300, // "endswith" - TOK_CONTAINS = 301, // "contains" - TOK_TEXT = 302, // "fulltext" - TOK_LIKE = 303, // "like" - TOK_BETWEEN = 304, // "between" - TOK_IN = 305, // "in" - TOK_GEOWITHIN = 306, // "geowithin" - TOK_OBJ = 307, // "obj" - TOK_SORT = 308, // "sort" - TOK_DISTINCT = 309, // "distinct" - TOK_LIMIT = 310, // "limit" - TOK_ASCENDING = 311, // "ascending" - TOK_DESCENDING = 312, // "descending" - TOK_SIZE = 313, // "@size" - TOK_TYPE = 314, // "@type" - TOK_KEY_VAL = 315 // "key or value" + TOK_MAX = 274, // "@max" + TOK_MIN = 275, // "@min" + TOK_SUM = 276, // "@sum" + TOK_AVG = 277, // "@average" + TOK_AND = 278, // "&&" + TOK_OR = 279, // "||" + TOK_NOT = 280, // "!" + TOK_GEOBOX = 281, // "geobox" + TOK_GEOPOLYGON = 282, // "geopolygon" + TOK_GEOCIRCLE = 283, // "geocircle" + TOK_ID = 284, // "identifier" + TOK_STRING = 285, // "string" + TOK_BASE64 = 286, // "base64" + TOK_INFINITY = 287, // "infinity" + TOK_NAN = 288, // "NaN" + TOK_NATURAL0 = 289, // "natural0" + TOK_NUMBER = 290, // "number" + TOK_FLOAT = 291, // "float" + TOK_TIMESTAMP = 292, // "date" + TOK_UUID = 293, // "UUID" + TOK_OID = 294, // "ObjectId" + TOK_LINK = 295, // "link" + TOK_TYPED_LINK = 296, // "typed link" + TOK_ARG = 297, // "argument" + TOK_BEGINSWITH = 298, // "beginswith" + TOK_ENDSWITH = 299, // "endswith" + TOK_CONTAINS = 300, // "contains" + TOK_TEXT = 301, // "fulltext" + TOK_LIKE = 302, // "like" + TOK_BETWEEN = 303, // "between" + TOK_IN = 304, // "in" + TOK_GEOWITHIN = 305, // "geowithin" + TOK_OBJ = 306, // "obj" + TOK_SORT = 307, // "sort" + TOK_DISTINCT = 308, // "distinct" + TOK_LIMIT = 309, // "limit" + TOK_ASCENDING = 310, // "ascending" + TOK_DESCENDING = 311, // "descending" + TOK_INDEX_FIRST = 312, // "FIRST" + TOK_INDEX_LAST = 313, // "LAST" + TOK_SIZE = 314, // "@size" + TOK_TYPE = 315, // "@type" + TOK_KEY_VAL = 316, // "key or value" + TOK_BACKLINK = 317 // "@links" }; /// Backward compatibility alias (Bison 3.6). typedef token_kind_type yytokentype; @@ -655,7 +660,7 @@ namespace yy { { enum symbol_kind_type { - YYNTOKENS = 73, ///< Number of tokens. + YYNTOKENS = 75, ///< Number of tokens. SYM_YYEMPTY = -2, SYM_YYEOF = 0, // "end of file" SYM_YYerror = 1, // error @@ -676,96 +681,98 @@ namespace yy { SYM_ANY = 16, // "any" SYM_ALL = 17, // "all" SYM_NONE = 18, // "none" - SYM_BACKLINK = 19, // "@links" - SYM_MAX = 20, // "@max" - SYM_MIN = 21, // "@min" - SYM_SUM = 22, // "@sun" - SYM_AVG = 23, // "@average" - SYM_AND = 24, // "&&" - SYM_OR = 25, // "||" - SYM_NOT = 26, // "!" - SYM_GEOBOX = 27, // "geobox" - SYM_GEOPOLYGON = 28, // "geopolygon" - SYM_GEOCIRCLE = 29, // "geocircle" - SYM_ID = 30, // "identifier" - SYM_STRING = 31, // "string" - SYM_BASE64 = 32, // "base64" - SYM_INFINITY = 33, // "infinity" - SYM_NAN = 34, // "NaN" - SYM_NATURAL0 = 35, // "natural0" - SYM_NUMBER = 36, // "number" - SYM_FLOAT = 37, // "float" - SYM_TIMESTAMP = 38, // "date" - SYM_UUID = 39, // "UUID" - SYM_OID = 40, // "ObjectId" - SYM_LINK = 41, // "link" - SYM_TYPED_LINK = 42, // "typed link" - SYM_ARG = 43, // "argument" - SYM_BEGINSWITH = 44, // "beginswith" - SYM_ENDSWITH = 45, // "endswith" - SYM_CONTAINS = 46, // "contains" - SYM_TEXT = 47, // "fulltext" - SYM_LIKE = 48, // "like" - SYM_BETWEEN = 49, // "between" - SYM_IN = 50, // "in" - SYM_GEOWITHIN = 51, // "geowithin" - SYM_OBJ = 52, // "obj" - SYM_SORT = 53, // "sort" - SYM_DISTINCT = 54, // "distinct" - SYM_LIMIT = 55, // "limit" - SYM_ASCENDING = 56, // "ascending" - SYM_DESCENDING = 57, // "descending" - SYM_SIZE = 58, // "@size" - SYM_TYPE = 59, // "@type" - SYM_KEY_VAL = 60, // "key or value" - SYM_61_ = 61, // '+' - SYM_62_ = 62, // '-' - SYM_63_ = 63, // '*' - SYM_64_ = 64, // '/' - SYM_65_ = 65, // '(' - SYM_66_ = 66, // ')' - SYM_67_ = 67, // '.' - SYM_68_ = 68, // ',' - SYM_69_ = 69, // '[' - SYM_70_ = 70, // ']' - SYM_71_ = 71, // '{' - SYM_72_ = 72, // '}' - SYM_YYACCEPT = 73, // $accept - SYM_final = 74, // final - SYM_query = 75, // query - SYM_compare = 76, // compare - SYM_expr = 77, // expr - SYM_value = 78, // value - SYM_prop = 79, // prop - SYM_aggregate = 80, // aggregate - SYM_simple_prop = 81, // simple_prop - SYM_subquery = 82, // subquery - SYM_coordinate = 83, // coordinate - SYM_geopoint = 84, // geopoint - SYM_geoloop_content = 85, // geoloop_content - SYM_geoloop = 86, // geoloop - SYM_geopoly_content = 87, // geopoly_content - SYM_geospatial = 88, // geospatial - SYM_post_query = 89, // post_query - SYM_distinct = 90, // distinct - SYM_distinct_param = 91, // distinct_param - SYM_sort = 92, // sort - SYM_sort_param = 93, // sort_param - SYM_limit = 94, // limit - SYM_direction = 95, // direction - SYM_list = 96, // list - SYM_list_content = 97, // list_content - SYM_constant = 98, // constant - SYM_primary_key = 99, // primary_key - SYM_boolexpr = 100, // boolexpr - SYM_comp_type = 101, // comp_type - SYM_post_op = 102, // post_op - SYM_aggr_op = 103, // aggr_op - SYM_equality = 104, // equality - SYM_relational = 105, // relational - SYM_stringop = 106, // stringop - SYM_path = 107, // path - SYM_id = 108 // id + SYM_MAX = 19, // "@max" + SYM_MIN = 20, // "@min" + SYM_SUM = 21, // "@sum" + SYM_AVG = 22, // "@average" + SYM_AND = 23, // "&&" + SYM_OR = 24, // "||" + SYM_NOT = 25, // "!" + SYM_GEOBOX = 26, // "geobox" + SYM_GEOPOLYGON = 27, // "geopolygon" + SYM_GEOCIRCLE = 28, // "geocircle" + SYM_ID = 29, // "identifier" + SYM_STRING = 30, // "string" + SYM_BASE64 = 31, // "base64" + SYM_INFINITY = 32, // "infinity" + SYM_NAN = 33, // "NaN" + SYM_NATURAL0 = 34, // "natural0" + SYM_NUMBER = 35, // "number" + SYM_FLOAT = 36, // "float" + SYM_TIMESTAMP = 37, // "date" + SYM_UUID = 38, // "UUID" + SYM_OID = 39, // "ObjectId" + SYM_LINK = 40, // "link" + SYM_TYPED_LINK = 41, // "typed link" + SYM_ARG = 42, // "argument" + SYM_BEGINSWITH = 43, // "beginswith" + SYM_ENDSWITH = 44, // "endswith" + SYM_CONTAINS = 45, // "contains" + SYM_TEXT = 46, // "fulltext" + SYM_LIKE = 47, // "like" + SYM_BETWEEN = 48, // "between" + SYM_IN = 49, // "in" + SYM_GEOWITHIN = 50, // "geowithin" + SYM_OBJ = 51, // "obj" + SYM_SORT = 52, // "sort" + SYM_DISTINCT = 53, // "distinct" + SYM_LIMIT = 54, // "limit" + SYM_ASCENDING = 55, // "ascending" + SYM_DESCENDING = 56, // "descending" + SYM_INDEX_FIRST = 57, // "FIRST" + SYM_INDEX_LAST = 58, // "LAST" + SYM_SIZE = 59, // "@size" + SYM_TYPE = 60, // "@type" + SYM_KEY_VAL = 61, // "key or value" + SYM_BACKLINK = 62, // "@links" + SYM_63_ = 63, // '+' + SYM_64_ = 64, // '-' + SYM_65_ = 65, // '*' + SYM_66_ = 66, // '/' + SYM_67_ = 67, // '(' + SYM_68_ = 68, // ')' + SYM_69_ = 69, // '.' + SYM_70_ = 70, // ',' + SYM_71_ = 71, // '[' + SYM_72_ = 72, // ']' + SYM_73_ = 73, // '{' + SYM_74_ = 74, // '}' + SYM_YYACCEPT = 75, // $accept + SYM_final = 76, // final + SYM_query = 77, // query + SYM_compare = 78, // compare + SYM_expr = 79, // expr + SYM_value = 80, // value + SYM_prop = 81, // prop + SYM_aggregate = 82, // aggregate + SYM_simple_prop = 83, // simple_prop + SYM_subquery = 84, // subquery + SYM_coordinate = 85, // coordinate + SYM_geopoint = 86, // geopoint + SYM_geoloop_content = 87, // geoloop_content + SYM_geoloop = 88, // geoloop + SYM_geopoly_content = 89, // geopoly_content + SYM_geospatial = 90, // geospatial + SYM_post_query = 91, // post_query + SYM_distinct = 92, // distinct + SYM_distinct_param = 93, // distinct_param + SYM_sort = 94, // sort + SYM_sort_param = 95, // sort_param + SYM_limit = 96, // limit + SYM_direction = 97, // direction + SYM_list = 98, // list + SYM_list_content = 99, // list_content + SYM_constant = 100, // constant + SYM_primary_key = 101, // primary_key + SYM_boolexpr = 102, // boolexpr + SYM_comp_type = 103, // comp_type + SYM_post_op = 104, // post_op + SYM_aggr_op = 105, // aggr_op + SYM_equality = 106, // equality + SYM_relational = 107, // relational + SYM_stringop = 108, // stringop + SYM_path = 109, // path + SYM_id = 110 // id }; }; @@ -915,9 +922,12 @@ namespace yy { case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id value.move< std::string > (std::move (that.value)); break; @@ -1330,9 +1340,12 @@ switch (yykind) case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id value.template destroy< std::string > (); break; @@ -1455,7 +1468,7 @@ switch (yykind) #endif { #if !defined _MSC_VER || defined __clang__ - YY_ASSERT ((token::TOK_ID <= tok && tok <= token::TOK_KEY_VAL)); + YY_ASSERT ((token::TOK_ID <= tok && tok <= token::TOK_BACKLINK)); #endif } }; @@ -1790,21 +1803,6 @@ switch (yykind) return symbol_type (token::TOK_NONE); } #endif -#if 201103L <= YY_CPLUSPLUS - static - symbol_type - make_BACKLINK () - { - return symbol_type (token::TOK_BACKLINK); - } -#else - static - symbol_type - make_BACKLINK () - { - return symbol_type (token::TOK_BACKLINK); - } -#endif #if 201103L <= YY_CPLUSPLUS static symbol_type @@ -2375,6 +2373,36 @@ switch (yykind) return symbol_type (token::TOK_DESCENDING, v); } #endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_INDEX_FIRST (std::string v) + { + return symbol_type (token::TOK_INDEX_FIRST, std::move (v)); + } +#else + static + symbol_type + make_INDEX_FIRST (const std::string& v) + { + return symbol_type (token::TOK_INDEX_FIRST, v); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_INDEX_LAST (std::string v) + { + return symbol_type (token::TOK_INDEX_LAST, std::move (v)); + } +#else + static + symbol_type + make_INDEX_LAST (const std::string& v) + { + return symbol_type (token::TOK_INDEX_LAST, v); + } +#endif #if 201103L <= YY_CPLUSPLUS static symbol_type @@ -2420,6 +2448,21 @@ switch (yykind) return symbol_type (token::TOK_KEY_VAL, v); } #endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_BACKLINK (std::string v) + { + return symbol_type (token::TOK_BACKLINK, std::move (v)); + } +#else + static + symbol_type + make_BACKLINK (const std::string& v) + { + return symbol_type (token::TOK_BACKLINK, v); + } +#endif class context @@ -2493,7 +2536,7 @@ switch (yykind) // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. // Performed when YYTABLE does not specify something else to do. Zero // means the default is an error. - static const signed char yydefact_[]; + static const unsigned char yydefact_[]; // YYPGOTO[NTERM-NUM]. static const short yypgoto_[]; @@ -2748,9 +2791,9 @@ switch (yykind) /// Constants. enum { - yylast_ = 554, ///< Last index in yytable_. + yylast_ = 583, ///< Last index in yytable_. yynnts_ = 36, ///< Number of nonterminal symbols. - yyfinal_ = 65 ///< Termination state number. + yyfinal_ = 67 ///< Termination state number. }; @@ -2774,15 +2817,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, - 65, 66, 63, 61, 68, 62, 67, 64, 2, 2, + 67, 68, 65, 63, 70, 64, 69, 66, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 69, 2, 70, 2, 2, 2, 2, 2, 2, + 2, 71, 2, 72, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 71, 2, 72, 2, 2, 2, 2, + 2, 2, 2, 73, 2, 74, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -2801,10 +2844,10 @@ switch (yykind) 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60 + 55, 56, 57, 58, 59, 60, 61, 62 }; // Last valid token kind. - const int code_max = 315; + const int code_max = 317; if (t <= 0) return symbol_kind::SYM_YYEOF; @@ -2937,9 +2980,12 @@ switch (yykind) case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id value.copy< std::string > (YY_MOVE (that.value)); break; @@ -3090,9 +3136,12 @@ switch (yykind) case symbol_kind::SYM_LIMIT: // "limit" case symbol_kind::SYM_ASCENDING: // "ascending" case symbol_kind::SYM_DESCENDING: // "descending" + case symbol_kind::SYM_INDEX_FIRST: // "FIRST" + case symbol_kind::SYM_INDEX_LAST: // "LAST" case symbol_kind::SYM_SIZE: // "@size" case symbol_kind::SYM_TYPE: // "@type" case symbol_kind::SYM_KEY_VAL: // "key or value" + case symbol_kind::SYM_BACKLINK: // "@links" case symbol_kind::SYM_id: // id value.move< std::string > (YY_MOVE (s.value)); break; diff --git a/src/realm/parser/generated/query_flex.cpp b/src/realm/parser/generated/query_flex.cpp index a00bb565312..70818aa2a94 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 68 -#define YY_END_OF_BUFFER 69 +#define YY_NUM_RULES 70 +#define YY_END_OF_BUFFER 71 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -510,54 +510,55 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[418] = +static const flex_int16_t yy_accept[430] = { 0, - 0, 0, 69, 67, 1, 2, 14, 67, 66, 67, - 67, 9, 3, 3, 9, 57, 57, 7, 4, 8, - 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 9, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, - 1, 2, 6, 0, 64, 0, 66, 58, 0, 0, - 0, 0, 12, 0, 65, 0, 0, 59, 0, 0, - 62, 0, 62, 57, 0, 0, 61, 10, 4, 11, - 0, 0, 0, 0, 0, 0, 0, 0, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, - - 66, 5, 66, 66, 66, 66, 66, 66, 66, 55, - 66, 13, 66, 66, 66, 0, 66, 66, 66, 66, - 66, 0, 66, 66, 66, 66, 66, 66, 66, 66, - 13, 66, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 62, 0, 62, 0, 61, 60, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 16, 12, 15, - 31, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 66, 49, 0, 66, 66, 50, 51, 66, 14, 66, - 30, 66, 66, 66, 0, 0, 66, 66, 66, 46, - 66, 66, 66, 66, 66, 66, 0, 0, 0, 0, - - 49, 50, 0, 62, 0, 41, 0, 0, 0, 38, - 39, 0, 40, 0, 0, 66, 0, 66, 66, 66, - 32, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 56, 22, 66, 17, 51, 27, 66, 0, 54, 21, - 47, 66, 66, 0, 66, 0, 0, 0, 0, 0, - 44, 0, 37, 43, 0, 66, 63, 0, 66, 66, - 66, 66, 66, 66, 48, 66, 66, 66, 66, 66, - 66, 29, 66, 66, 0, 0, 0, 0, 0, 0, - 42, 0, 66, 66, 66, 66, 66, 66, 66, 66, - 34, 66, 66, 66, 66, 66, 66, 0, 0, 0, - - 0, 45, 66, 66, 23, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 0, 0, 0, 0, - 66, 66, 20, 66, 28, 19, 66, 66, 66, 66, - 49, 33, 66, 0, 0, 49, 0, 31, 66, 66, - 66, 36, 66, 24, 66, 0, 0, 0, 18, 32, - 66, 35, 66, 0, 0, 54, 66, 66, 0, 0, - 0, 66, 66, 0, 0, 54, 66, 25, 0, 0, - 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 71, 69, 1, 2, 14, 69, 68, 69, + 69, 9, 3, 3, 9, 59, 59, 7, 4, 8, + 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 9, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, + 1, 2, 6, 0, 66, 0, 68, 60, 0, 0, + 0, 0, 12, 0, 67, 0, 0, 61, 0, 0, + 64, 0, 64, 59, 0, 0, 63, 10, 4, 11, + 0, 0, 0, 0, 0, 0, 0, 0, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + + 68, 68, 5, 68, 68, 68, 68, 68, 68, 68, + 68, 57, 68, 13, 68, 68, 68, 0, 68, 68, + 68, 68, 68, 0, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 13, 68, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 64, 0, 64, 0, 63, + 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 16, 12, 15, 31, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 51, 0, 68, 68, + 68, 52, 53, 68, 14, 68, 30, 68, 68, 68, + 0, 0, 68, 68, 68, 48, 68, 68, 68, 68, + + 68, 68, 68, 68, 0, 0, 0, 0, 51, 52, + 0, 64, 0, 41, 0, 0, 0, 38, 39, 0, + 40, 0, 0, 68, 0, 68, 68, 68, 32, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 58, + 47, 22, 68, 17, 53, 27, 68, 0, 56, 21, + 49, 68, 68, 68, 0, 68, 0, 0, 0, 0, + 0, 44, 0, 37, 43, 0, 68, 65, 0, 68, + 68, 68, 68, 68, 68, 50, 68, 46, 68, 68, + 68, 68, 68, 29, 68, 68, 0, 0, 0, 0, + 0, 0, 42, 0, 68, 68, 68, 68, 68, 68, + + 68, 68, 34, 68, 68, 68, 68, 68, 68, 0, + 0, 0, 0, 45, 68, 68, 23, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 0, 0, + 0, 0, 68, 68, 20, 68, 28, 19, 68, 68, + 68, 68, 51, 33, 68, 0, 0, 51, 0, 31, + 68, 68, 68, 36, 68, 24, 68, 0, 0, 0, + 18, 32, 68, 35, 68, 0, 0, 56, 68, 68, + 0, 0, 0, 68, 68, 0, 0, 56, 68, 25, + 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 52, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 54, 0 } ; static const YY_CHAR yy_ec[256] = @@ -605,121 +606,125 @@ static const YY_CHAR yy_meta[87] = 5, 1, 1, 3, 3, 3 } ; -static const flex_int16_t yy_base[487] = +static const flex_int16_t yy_base[499] = { 0, - 0, 0, 798, 1933, 85, 781, 758, 82, 72, 764, - 85, 1933, 1933, 79, 83, 90, 111, 88, 92, 740, - 78, 109, 139, 120, 149, 134, 112, 154, 126, 168, - 208, 195, 245, 215, 319, 705, 237, 257, 230, 267, - 260, 330, 305, 323, 357, 342, 679, 677, 674, 673, - 116, 751, 1933, 122, 1933, 414, 275, 415, 172, 670, - 660, 655, 1933, 113, 1933, 441, 419, 435, 119, 159, - 443, 458, 487, 504, 513, 0, 1933, 1933, 1933, 1933, - 660, 664, 668, 650, 77, 113, 624, 647, 360, 485, - 492, 427, 477, 506, 489, 282, 407, 513, 529, 541, - - 547, 551, 557, 601, 591, 576, 586, 500, 596, 646, - 637, 621, 640, 655, 625, 536, 702, 705, 666, 682, - 695, 647, 702, 717, 706, 724, 730, 751, 747, 721, - 1933, 743, 617, 609, 0, 605, 585, 0, 185, 191, - 676, 1933, 823, 827, 831, 835, 0, 596, 580, 575, - 583, 572, 581, 567, 579, 575, 573, 777, 781, 786, - 826, 806, 829, 820, 832, 866, 848, 855, 875, 882, - 916, 911, 856, 894, 928, 900, 904, 924, 919, 953, - 940, 945, 965, 974, 1014, 1048, 969, 988, 992, 1933, - 1011, 1022, 1018, 1026, 1031, 1034, 555, 0, 528, 0, - - 214, 1933, 1080, 1103, 1107, 1933, 540, 533, 540, 1933, - 1933, 545, 1933, 543, 526, 1089, 595, 1092, 1083, 1103, - 1100, 1117, 1113, 1140, 1151, 1110, 1155, 1164, 1174, 1178, - 1119, 1004, 1167, 1130, 1159, 1170, 1214, 1128, 1250, 1193, - 1223, 1230, 1235, 0, 1220, 0, 0, 215, 1266, 520, - 1933, 519, 1933, 1933, 527, 1244, 1933, 574, 1257, 1265, - 1282, 1271, 1292, 1299, 1311, 1316, 1286, 1335, 1306, 1328, - 1340, 1345, 1358, 1362, 0, 0, 0, 0, 223, 1418, - 1933, 486, 1370, 1379, 1400, 1405, 1419, 1422, 1413, 1397, - 1408, 1442, 1458, 1462, 1466, 1476, 1470, 0, 0, 221, - - 1513, 1933, 1484, 1510, 1487, 1513, 1522, 1530, 1525, 1559, - 1551, 1567, 1578, 1570, 1581, 1587, 0, 0, 223, 1561, - 1595, 1622, 1540, 1607, 1616, 1625, 1629, 1643, 1646, 1664, - 1636, 1652, 1659, 0, 0, 1933, 1733, 1672, 1706, 1709, - 1712, 1682, 1720, 1693, 1754, 0, 0, 1665, 1717, 1729, - 1758, 1733, 1772, 0, 0, 1802, 1781, 1795, 0, 0, - 1811, 1799, 1802, 0, 0, 1857, 1829, 1806, 0, 536, - 1810, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 534, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 526, 0, 0, 0, 0, 0, 0, 0, 0, 526, - - 512, 1933, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 498, 1933, 1933, 1915, 1918, 1923, - 484, 481, 480, 478, 469, 1927, 468, 466, 465, 461, - 445, 444, 425, 421, 420, 418, 417, 415, 408, 407, - 398, 393, 392, 383, 381, 380, 378, 377, 376, 371, - 370, 369, 367, 351, 350, 344, 343, 322, 321, 315, - 308, 305, 304, 301, 293, 272, 271, 266, 265, 246, - 240, 228, 212, 197, 196, 187, 178, 177, 163, 160, - 159, 133, 120, 119, 103, 92 + 0, 0, 763, 2060, 85, 758, 735, 82, 72, 741, + 85, 2060, 2060, 79, 83, 90, 111, 88, 92, 724, + 78, 109, 139, 120, 149, 134, 154, 169, 80, 158, + 229, 210, 259, 205, 333, 685, 252, 271, 277, 289, + 312, 352, 356, 374, 370, 183, 654, 652, 649, 644, + 116, 723, 2060, 122, 2060, 455, 223, 413, 297, 627, + 626, 625, 2060, 114, 2060, 465, 196, 449, 99, 132, + 472, 252, 486, 533, 370, 0, 2060, 2060, 2060, 2060, + 628, 633, 627, 620, 121, 115, 601, 624, 296, 484, + 492, 506, 392, 527, 502, 521, 530, 566, 570, 514, + + 579, 556, 586, 592, 609, 604, 630, 633, 644, 639, + 653, 615, 410, 318, 668, 694, 660, 466, 727, 742, + 681, 709, 721, 621, 724, 739, 746, 697, 743, 751, + 759, 789, 793, 786, 2060, 763, 591, 583, 0, 565, + 561, 0, 165, 161, 840, 2060, 865, 845, 640, 869, + 0, 581, 562, 542, 552, 541, 541, 522, 533, 514, + 517, 814, 828, 838, 851, 848, 857, 866, 863, 873, + 893, 900, 909, 916, 919, 968, 928, 875, 934, 975, + 963, 923, 938, 958, 946, 998, 984, 1002, 988, 1013, + 1057, 1087, 1043, 1050, 1059, 2060, 1056, 1039, 1062, 1073, + + 1085, 1079, 1100, 1096, 499, 0, 498, 0, 177, 2060, + 1154, 1158, 1169, 2060, 510, 498, 497, 2060, 2060, 502, + 2060, 501, 481, 1114, 550, 1151, 1161, 1141, 1164, 1158, + 1154, 1170, 1181, 1205, 1211, 1218, 1222, 1234, 1230, 1241, + 1225, 1240, 1248, 1252, 1259, 1264, 1275, 1321, 1334, 1278, + 1304, 1314, 1327, 1317, 0, 1320, 0, 0, 191, 1389, + 469, 2060, 465, 2060, 2060, 469, 1338, 2060, 521, 1372, + 1383, 1386, 1376, 1379, 1391, 1431, 1436, 1367, 1440, 1450, + 1428, 1453, 1445, 1401, 1480, 1474, 0, 0, 0, 0, + 197, 1358, 2060, 451, 1497, 1492, 1502, 1516, 1521, 1538, + + 1544, 1531, 1509, 1550, 1558, 1578, 1572, 1593, 1567, 0, + 0, 242, 1649, 2060, 1619, 1597, 1601, 1639, 1645, 1653, + 1657, 1662, 1673, 1683, 1697, 1700, 1709, 1719, 0, 0, + 247, 1363, 1737, 1745, 1649, 1723, 1726, 1748, 1766, 1775, + 1783, 1786, 1760, 1763, 1821, 0, 0, 2060, 1844, 1804, + 1824, 1840, 1847, 1828, 1851, 1831, 1865, 0, 0, 1375, + 1843, 1868, 1890, 1877, 1911, 0, 0, 1937, 1915, 1894, + 0, 0, 1655, 1919, 1929, 0, 0, 1676, 1956, 1933, + 0, 508, 1937, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 505, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 504, 0, 0, 0, 0, 0, 0, 0, + 0, 504, 498, 2060, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 500, 2060, 2060, 2042, + 2045, 2050, 498, 497, 496, 485, 484, 2054, 477, 475, + 458, 453, 449, 448, 447, 445, 444, 443, 435, 431, + 422, 421, 420, 407, 406, 403, 391, 390, 388, 374, + 365, 363, 356, 355, 346, 336, 335, 331, 324, 321, + 319, 318, 316, 314, 307, 306, 302, 296, 295, 281, + 280, 279, 261, 258, 224, 217, 204, 192, 182, 178, + 172, 159, 137, 133, 120, 118, 103, 92 + } ; -static const flex_int16_t yy_def[487] = +static const flex_int16_t yy_def[499] = { 0, - 417, 1, 417, 417, 417, 417, 417, 418, 419, 417, - 420, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 419, 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 417, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 417, 417, 417, 417, - 417, 417, 417, 418, 417, 417, 419, 419, 417, 417, - 417, 417, 417, 420, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 421, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, - - 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 417, 35, 35, 419, 419, - 419, 417, 419, 419, 419, 419, 419, 419, 419, 419, - 417, 419, 417, 417, 422, 417, 417, 423, 417, 417, - 417, 417, 417, 417, 417, 417, 421, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 417, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 417, 417, 419, 419, 419, 417, - 419, 419, 419, 419, 419, 419, 417, 424, 417, 425, - - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 419, 426, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, - 417, 419, 419, 419, 419, 419, 419, 417, 417, 419, - 419, 419, 419, 427, 419, 428, 429, 417, 417, 417, - 417, 417, 417, 417, 417, 419, 417, 426, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 430, 431, 432, 433, 417, 417, - 417, 417, 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 434, 435, 417, - - 417, 417, 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 436, 437, 417, 417, - 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 438, 439, 417, 417, 419, 419, 419, - 419, 419, 419, 419, 419, 440, 441, 417, 419, 419, - 419, 419, 419, 442, 443, 417, 419, 419, 444, 445, - 417, 419, 419, 446, 447, 417, 419, 419, 448, 417, - 419, 449, 450, 451, 452, 453, 454, 455, 456, 457, - 417, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 417, 467, 468, 469, 470, 471, 472, 473, 474, 417, - - 417, 417, 475, 476, 477, 478, 479, 480, 481, 482, - 483, 484, 485, 486, 417, 417, 0, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417 + 429, 1, 429, 429, 429, 429, 429, 430, 431, 429, + 432, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 431, 431, 431, 431, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 429, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 431, 429, 429, 429, 429, + 429, 429, 429, 430, 429, 429, 431, 431, 429, 429, + 429, 429, 429, 432, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 433, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 431, 431, + 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, + + 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 431, 431, 429, 35, 35, + 431, 431, 431, 429, 431, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 429, 431, 429, 429, 434, 429, + 429, 435, 429, 429, 429, 429, 429, 429, 429, 429, + 433, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 431, 431, 431, 431, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 431, 431, 429, 431, 431, + 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, + 429, 429, 431, 431, 431, 429, 431, 431, 431, 431, + + 431, 431, 431, 431, 429, 436, 429, 437, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 431, 438, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 431, 431, 431, 431, 429, + 431, 431, 431, 431, 431, 431, 431, 429, 429, 431, + 431, 431, 431, 431, 439, 431, 440, 441, 429, 429, + 429, 429, 429, 429, 429, 429, 431, 429, 438, 431, + 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 431, 442, 443, 444, 445, + 429, 429, 429, 429, 431, 431, 431, 431, 431, 431, + + 431, 431, 431, 431, 431, 431, 431, 431, 431, 446, + 447, 429, 429, 429, 431, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 431, 431, 431, 448, 449, + 429, 429, 431, 431, 431, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 450, 451, 429, 429, 431, + 431, 431, 431, 431, 431, 431, 431, 452, 453, 429, + 431, 431, 431, 431, 431, 454, 455, 429, 431, 431, + 456, 457, 429, 431, 431, 458, 459, 429, 431, 431, + 460, 429, 431, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 429, 470, 471, 472, 473, 474, 475, 476, + + 477, 478, 429, 479, 480, 481, 482, 483, 484, 485, + 486, 429, 429, 429, 487, 488, 489, 490, 491, 492, + 493, 494, 495, 496, 497, 498, 429, 429, 0, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429 + } ; -static const flex_int16_t yy_nxt[2020] = +static const flex_int16_t yy_nxt[2147] = { 0, 4, 5, 6, 5, 7, 8, 9, 10, 11, 12, 12, 13, 14, 12, 14, 15, 13, 16, 17, 17, @@ -730,222 +735,236 @@ static const flex_int16_t yy_nxt[2020] = 39, 28, 29, 40, 29, 29, 41, 29, 42, 43, 29, 29, 29, 44, 45, 46, 29, 29, 29, 29, 29, 47, 4, 48, 49, 50, 51, 55, 51, 58, - 58, 58, 58, 65, 67, 415, 68, 68, 68, 68, + 58, 58, 58, 65, 67, 427, 68, 68, 68, 68, - 71, 71, 71, 71, 72, 73, 414, 74, 74, 74, + 71, 71, 71, 71, 72, 73, 426, 74, 74, 74, 74, 78, 53, 69, 78, 79, 80, 51, 70, 51, - 75, 65, 413, 412, 59, 72, 73, 55, 74, 74, - 74, 74, 152, 81, 56, 82, 411, 66, 99, 76, - 153, 75, 69, 83, 84, 85, 89, 70, 90, 75, - 77, 86, 87, 91, 88, 60, 61, 62, 139, 93, - 95, 59, 410, 409, 59, 66, 408, 100, 76, 94, - 75, 77, 59, 98, 56, 57, 154, 92, 59, 96, - 407, 406, 91, 97, 101, 140, 59, 139, 155, 95, - 405, 59, 60, 61, 62, 60, 61, 62, 94, 404, - - 401, 59, 98, 60, 61, 62, 59, 102, 96, 60, - 61, 62, 97, 101, 140, 400, 201, 60, 61, 62, - 59, 106, 60, 61, 62, 104, 104, 104, 104, 107, - 202, 399, 60, 61, 62, 108, 103, 60, 61, 62, - 57, 109, 105, 398, 57, 201, 57, 59, 248, 397, - 106, 60, 61, 62, 279, 113, 100, 300, 107, 202, - 59, 114, 110, 110, 110, 110, 319, 59, 396, 395, - 109, 105, 111, 336, 394, 392, 92, 248, 60, 61, - 62, 91, 59, 279, 115, 125, 300, 94, 112, 59, - 114, 60, 61, 62, 105, 319, 391, 59, 60, 61, - - 62, 111, 336, 123, 390, 124, 103, 389, 388, 59, - 91, 387, 59, 60, 61, 62, 94, 112, 386, 59, - 60, 61, 62, 105, 385, 384, 166, 59, 60, 61, - 62, 116, 111, 117, 59, 102, 118, 118, 118, 118, - 60, 61, 62, 60, 61, 62, 382, 381, 112, 119, - 60, 61, 62, 380, 379, 166, 106, 59, 60, 61, - 62, 111, 120, 115, 107, 60, 61, 62, 127, 114, - 378, 59, 377, 376, 375, 59, 109, 112, 119, 374, - 372, 370, 59, 369, 365, 106, 364, 119, 60, 61, - 62, 121, 128, 107, 59, 360, 359, 158, 114, 126, - - 121, 355, 60, 61, 62, 109, 60, 61, 62, 59, - 354, 347, 59, 60, 61, 62, 119, 130, 346, 54, - 335, 334, 54, 318, 317, 60, 61, 62, 64, 129, - 54, 54, 58, 58, 58, 58, 71, 71, 71, 71, - 60, 61, 62, 60, 61, 62, 64, 54, 299, 64, - 73, 167, 68, 68, 68, 68, 159, 64, 64, 59, - 71, 71, 71, 71, 298, 75, 54, 59, 278, 277, - 54, 275, 247, 141, 54, 143, 143, 143, 143, 59, - 167, 246, 54, 200, 198, 159, 54, 147, 54, 135, - 60, 61, 62, 64, 75, 77, 162, 64, 60, 61, - - 62, 64, 141, 142, 144, 144, 144, 144, 416, 64, - 60, 61, 62, 64, 159, 64, 138, 141, 72, 73, - 161, 74, 74, 74, 74, 145, 403, 145, 165, 59, - 146, 146, 146, 146, 75, 160, 402, 59, 163, 178, - 393, 59, 168, 159, 59, 179, 141, 142, 383, 161, - 373, 164, 59, 185, 185, 185, 185, 165, 59, 302, - 60, 61, 62, 75, 77, 59, 169, 163, 60, 61, - 62, 168, 60, 61, 62, 60, 61, 62, 170, 257, - 164, 59, 172, 60, 61, 62, 282, 171, 172, 60, - 61, 62, 281, 59, 253, 170, 60, 61, 62, 59, - - 257, 255, 254, 59, 253, 252, 251, 170, 250, 59, - 57, 172, 60, 61, 62, 176, 171, 172, 104, 104, - 104, 104, 173, 177, 60, 61, 62, 174, 59, 175, - 60, 61, 62, 180, 60, 61, 62, 132, 59, 215, - 60, 61, 62, 59, 176, 214, 213, 212, 59, 211, - 210, 209, 177, 59, 208, 207, 174, 206, 175, 60, - 61, 62, 180, 110, 110, 110, 110, 199, 183, 60, - 61, 62, 181, 59, 60, 61, 62, 59, 182, 60, - 61, 62, 184, 183, 60, 61, 62, 57, 203, 59, - 203, 197, 59, 204, 204, 204, 204, 183, 59, 132, - - 190, 181, 157, 156, 60, 61, 62, 59, 60, 61, - 62, 184, 183, 151, 417, 187, 57, 417, 59, 57, - 60, 61, 62, 60, 61, 62, 186, 150, 188, 60, - 61, 62, 57, 149, 59, 57, 148, 137, 60, 61, - 62, 189, 136, 170, 187, 57, 159, 59, 57, 60, - 61, 62, 57, 52, 59, 134, 133, 189, 59, 132, - 131, 57, 122, 80, 57, 60, 61, 62, 158, 59, - 189, 63, 191, 59, 57, 159, 59, 57, 60, 61, - 62, 53, 59, 52, 196, 60, 61, 62, 193, 60, - 61, 62, 192, 189, 183, 59, 160, 417, 179, 59, - - 60, 61, 62, 59, 60, 61, 62, 60, 61, 62, - 417, 217, 417, 60, 61, 62, 417, 417, 194, 417, - 417, 417, 195, 183, 417, 417, 60, 61, 62, 59, - 60, 61, 62, 59, 60, 61, 62, 205, 59, 417, - 143, 143, 143, 143, 144, 144, 144, 144, 146, 146, - 146, 146, 146, 146, 146, 146, 216, 141, 59, 417, - 60, 61, 62, 218, 60, 61, 62, 417, 219, 60, - 61, 62, 59, 231, 231, 231, 231, 220, 59, 417, - 417, 59, 417, 417, 59, 216, 141, 142, 417, 60, - 61, 62, 218, 222, 221, 77, 417, 219, 417, 223, - - 59, 417, 417, 60, 61, 62, 220, 59, 417, 60, - 61, 62, 60, 61, 62, 60, 61, 62, 59, 224, - 417, 417, 222, 221, 232, 417, 225, 59, 223, 417, - 417, 60, 61, 62, 59, 417, 417, 417, 60, 61, - 62, 417, 417, 226, 227, 230, 59, 417, 225, 60, - 61, 62, 59, 232, 234, 225, 59, 228, 60, 61, - 62, 417, 233, 59, 229, 60, 61, 62, 59, 417, - 417, 59, 226, 227, 230, 160, 59, 60, 61, 62, - 59, 417, 417, 60, 61, 62, 228, 60, 61, 62, - 235, 233, 59, 229, 60, 61, 62, 59, 417, 60, - - 61, 62, 60, 61, 62, 59, 417, 60, 61, 62, - 236, 60, 61, 62, 240, 417, 237, 59, 241, 235, - 417, 59, 242, 60, 61, 62, 59, 244, 60, 61, - 62, 185, 185, 185, 185, 186, 60, 61, 62, 236, - 59, 417, 417, 240, 59, 237, 417, 242, 60, 61, - 62, 242, 60, 61, 62, 225, 59, 60, 61, 62, - 238, 242, 238, 59, 417, 239, 239, 239, 239, 417, - 59, 60, 61, 62, 59, 60, 61, 62, 59, 417, - 417, 234, 417, 59, 243, 160, 59, 60, 61, 62, - 241, 417, 245, 417, 60, 61, 62, 204, 204, 204, - - 204, 60, 61, 62, 417, 60, 61, 62, 417, 60, - 61, 62, 417, 260, 60, 61, 62, 60, 61, 62, - 204, 204, 204, 204, 249, 249, 249, 249, 256, 261, - 262, 259, 417, 417, 417, 59, 231, 231, 231, 231, - 417, 59, 260, 417, 59, 239, 239, 239, 239, 417, - 267, 263, 59, 417, 417, 59, 417, 256, 261, 262, - 259, 264, 59, 142, 417, 59, 60, 61, 62, 59, - 265, 417, 60, 61, 62, 60, 61, 62, 417, 267, - 263, 266, 59, 60, 61, 62, 60, 61, 62, 268, - 264, 417, 59, 60, 61, 62, 60, 61, 62, 266, - - 60, 61, 62, 59, 269, 417, 417, 59, 270, 417, - 266, 59, 272, 60, 61, 62, 59, 271, 268, 59, - 417, 417, 59, 60, 61, 62, 59, 417, 417, 276, - 59, 417, 417, 269, 60, 61, 62, 270, 60, 61, - 62, 272, 60, 61, 62, 59, 271, 60, 61, 62, - 60, 61, 62, 60, 61, 62, 417, 60, 61, 62, - 273, 60, 61, 62, 274, 266, 59, 239, 239, 239, - 239, 274, 59, 283, 417, 59, 60, 61, 62, 417, - 417, 417, 59, 249, 249, 249, 249, 59, 417, 273, - 417, 280, 417, 274, 265, 285, 59, 60, 61, 62, - - 274, 284, 283, 60, 61, 62, 60, 61, 62, 59, - 287, 280, 417, 60, 61, 62, 286, 59, 60, 61, - 62, 417, 417, 59, 285, 417, 417, 60, 61, 62, - 284, 288, 417, 289, 59, 291, 417, 417, 59, 287, - 60, 61, 62, 293, 59, 286, 417, 417, 60, 61, - 62, 59, 290, 417, 60, 61, 62, 290, 59, 417, - 288, 417, 289, 59, 291, 60, 61, 62, 59, 60, - 61, 62, 293, 294, 295, 60, 61, 62, 292, 417, - 59, 290, 60, 61, 62, 417, 290, 59, 296, 60, - 61, 62, 59, 417, 60, 61, 62, 59, 417, 60, - - 61, 62, 294, 295, 303, 297, 417, 292, 417, 417, - 59, 60, 61, 62, 59, 417, 417, 296, 60, 61, - 62, 417, 59, 60, 61, 62, 417, 304, 60, 61, - 62, 59, 417, 303, 297, 301, 301, 301, 301, 305, - 310, 60, 61, 62, 306, 60, 61, 62, 307, 59, - 308, 417, 59, 60, 61, 62, 304, 59, 309, 417, - 59, 417, 60, 61, 62, 59, 417, 417, 305, 310, - 311, 59, 417, 306, 59, 417, 417, 307, 417, 308, - 60, 61, 62, 60, 61, 62, 417, 309, 60, 61, - 62, 60, 61, 62, 59, 313, 60, 61, 62, 311, - - 316, 417, 60, 61, 62, 60, 61, 62, 312, 417, - 59, 314, 417, 417, 59, 417, 417, 417, 59, 315, - 417, 417, 59, 321, 313, 60, 61, 62, 59, 316, - 301, 301, 301, 301, 320, 417, 59, 312, 417, 59, - 314, 60, 61, 62, 322, 60, 61, 62, 315, 60, - 61, 62, 321, 60, 61, 62, 324, 323, 326, 60, - 61, 62, 59, 417, 417, 59, 417, 60, 61, 62, - 60, 61, 62, 322, 59, 325, 417, 59, 337, 337, - 337, 337, 59, 417, 417, 324, 323, 326, 328, 327, - 417, 417, 59, 60, 61, 62, 60, 61, 62, 329, - - 417, 417, 417, 59, 325, 60, 61, 62, 60, 61, - 62, 59, 330, 60, 61, 62, 333, 328, 327, 59, - 331, 417, 59, 60, 61, 62, 417, 338, 329, 417, - 59, 332, 417, 59, 60, 61, 62, 417, 417, 59, - 417, 330, 60, 61, 62, 333, 340, 59, 417, 331, - 60, 61, 62, 60, 61, 62, 338, 417, 341, 59, - 332, 60, 61, 62, 60, 61, 62, 339, 59, 417, - 60, 61, 62, 342, 59, 340, 417, 59, 60, 61, - 62, 59, 356, 356, 356, 356, 343, 341, 59, 417, - 60, 61, 62, 345, 417, 59, 339, 417, 59, 60, - - 61, 62, 342, 344, 59, 60, 61, 62, 60, 61, - 62, 59, 60, 61, 62, 343, 59, 417, 417, 60, - 61, 62, 345, 417, 59, 417, 60, 61, 62, 60, - 61, 62, 344, 417, 59, 60, 61, 62, 417, 349, - 417, 350, 60, 61, 62, 59, 351, 60, 61, 62, - 337, 337, 337, 337, 348, 60, 61, 62, 59, 352, - 417, 59, 417, 417, 59, 60, 61, 62, 349, 59, - 350, 417, 59, 417, 417, 351, 60, 61, 62, 417, - 417, 59, 353, 417, 417, 59, 357, 417, 352, 60, - 61, 62, 60, 61, 62, 60, 61, 62, 358, 417, - - 60, 61, 62, 60, 61, 62, 59, 362, 417, 417, - 59, 353, 60, 61, 62, 357, 60, 61, 62, 356, - 356, 356, 356, 361, 59, 417, 417, 358, 366, 366, - 366, 366, 368, 59, 417, 417, 362, 60, 61, 62, - 363, 60, 61, 62, 367, 417, 417, 59, 417, 417, - 417, 59, 417, 417, 59, 60, 61, 62, 59, 371, - 417, 368, 59, 417, 60, 61, 62, 417, 417, 363, - 417, 417, 417, 367, 366, 366, 366, 366, 60, 61, - 62, 59, 60, 61, 62, 60, 61, 62, 371, 60, - 61, 62, 417, 60, 61, 62, 417, 417, 417, 417, - - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 60, 61, 62, 54, 54, 54, 54, 54, - 57, 57, 57, 64, 64, 64, 64, 64, 258, 417, - 258, 258, 3, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417 + 75, 425, 65, 424, 59, 72, 73, 55, 74, 74, + 74, 74, 59, 81, 56, 82, 423, 66, 143, 76, + 422, 75, 69, 83, 84, 85, 89, 70, 90, 75, + 77, 86, 87, 91, 88, 60, 61, 62, 144, 93, + 95, 59, 421, 60, 61, 62, 66, 143, 76, 94, + 75, 77, 59, 98, 56, 420, 156, 92, 158, 96, + 99, 419, 91, 97, 157, 418, 59, 144, 100, 95, + 159, 59, 60, 61, 62, 417, 209, 103, 94, 102, + + 210, 59, 98, 60, 61, 62, 59, 416, 96, 101, + 59, 259, 97, 71, 71, 71, 71, 60, 61, 62, + 413, 59, 60, 61, 62, 209, 104, 412, 102, 210, + 291, 312, 60, 61, 62, 59, 108, 60, 61, 62, + 259, 60, 61, 62, 109, 115, 105, 105, 105, 105, + 110, 116, 60, 61, 62, 106, 111, 59, 134, 291, + 312, 411, 59, 107, 410, 108, 60, 61, 62, 147, + 147, 147, 147, 109, 117, 59, 112, 112, 112, 112, + 116, 59, 409, 408, 407, 111, 113, 331, 60, 61, + 62, 92, 107, 60, 61, 62, 91, 348, 406, 404, + + 57, 94, 114, 101, 59, 403, 60, 61, 62, 402, + 401, 59, 60, 61, 62, 113, 331, 400, 125, 399, + 126, 398, 397, 59, 396, 91, 348, 394, 104, 59, + 94, 114, 127, 162, 393, 60, 61, 62, 392, 391, + 128, 59, 60, 61, 62, 118, 107, 119, 59, 390, + 120, 120, 120, 120, 60, 61, 62, 103, 389, 388, + 60, 61, 62, 121, 59, 57, 387, 129, 386, 57, + 59, 57, 60, 61, 62, 107, 122, 384, 108, 60, + 61, 62, 149, 113, 149, 59, 109, 150, 150, 150, + 150, 382, 121, 381, 377, 60, 61, 62, 111, 114, + + 121, 60, 61, 62, 59, 123, 376, 108, 59, 372, + 371, 166, 113, 123, 117, 109, 60, 61, 62, 131, + 116, 130, 59, 367, 366, 359, 59, 111, 114, 121, + 58, 58, 58, 58, 358, 60, 61, 62, 347, 60, + 61, 62, 133, 132, 59, 187, 346, 330, 329, 116, + 64, 54, 311, 60, 61, 62, 310, 60, 61, 62, + 54, 290, 59, 54, 73, 59, 68, 68, 68, 68, + 64, 54, 54, 64, 187, 60, 61, 62, 289, 75, + 287, 64, 64, 191, 191, 191, 191, 258, 257, 71, + 71, 71, 71, 60, 61, 62, 60, 61, 62, 208, + + 206, 151, 145, 148, 148, 148, 148, 54, 75, 77, + 428, 54, 415, 163, 414, 54, 145, 64, 405, 395, + 165, 64, 385, 54, 314, 64, 268, 54, 294, 54, + 139, 145, 146, 64, 164, 163, 59, 64, 293, 64, + 142, 169, 163, 264, 59, 145, 146, 72, 73, 165, + 74, 74, 74, 74, 59, 268, 266, 175, 59, 167, + 265, 264, 263, 75, 163, 170, 59, 60, 61, 62, + 169, 262, 168, 59, 171, 60, 61, 62, 261, 59, + 57, 136, 59, 223, 222, 60, 61, 62, 167, 60, + 61, 62, 75, 77, 170, 172, 176, 60, 61, 62, + + 221, 168, 220, 171, 60, 61, 62, 173, 59, 219, + 60, 61, 62, 60, 61, 62, 174, 177, 59, 218, + 217, 216, 59, 177, 172, 176, 105, 105, 105, 105, + 178, 59, 112, 112, 112, 112, 174, 215, 59, 60, + 61, 62, 214, 207, 59, 174, 177, 57, 179, 60, + 61, 62, 177, 60, 61, 62, 59, 150, 150, 150, + 150, 59, 60, 61, 62, 205, 180, 59, 181, 60, + 61, 62, 182, 136, 196, 60, 61, 62, 184, 161, + 160, 183, 59, 155, 185, 59, 154, 60, 61, 62, + 186, 59, 60, 61, 62, 180, 59, 181, 60, 61, + + 62, 182, 153, 189, 152, 59, 188, 141, 140, 57, + 183, 189, 59, 60, 61, 62, 60, 61, 62, 186, + 59, 190, 60, 61, 62, 52, 138, 60, 61, 62, + 193, 137, 189, 59, 136, 135, 60, 61, 62, 429, + 189, 57, 124, 60, 61, 62, 59, 80, 63, 59, + 190, 60, 61, 62, 429, 194, 57, 57, 53, 193, + 52, 59, 429, 192, 60, 61, 62, 195, 163, 198, + 57, 429, 57, 59, 429, 429, 59, 60, 61, 62, + 60, 61, 62, 174, 195, 57, 57, 429, 429, 429, + 162, 59, 60, 61, 62, 59, 195, 163, 59, 57, + + 429, 57, 429, 59, 60, 61, 62, 60, 61, 62, + 429, 59, 197, 429, 57, 59, 199, 201, 164, 200, + 429, 429, 60, 61, 62, 185, 60, 61, 62, 60, + 61, 62, 189, 429, 60, 61, 62, 429, 59, 195, + 429, 59, 60, 61, 62, 59, 60, 61, 62, 204, + 429, 429, 211, 225, 211, 429, 202, 212, 212, 212, + 212, 189, 148, 148, 148, 148, 59, 429, 203, 60, + 61, 62, 60, 61, 62, 145, 60, 61, 62, 213, + 59, 224, 147, 147, 147, 147, 150, 150, 150, 150, + 59, 226, 240, 240, 240, 240, 429, 60, 61, 62, + + 59, 229, 429, 59, 145, 146, 429, 429, 228, 59, + 224, 60, 61, 62, 227, 59, 429, 429, 59, 429, + 226, 60, 61, 62, 429, 59, 429, 429, 429, 77, + 229, 60, 61, 62, 60, 61, 62, 228, 230, 429, + 60, 61, 62, 227, 231, 59, 60, 61, 62, 60, + 61, 62, 59, 232, 429, 429, 60, 61, 62, 429, + 233, 59, 239, 234, 429, 429, 429, 230, 59, 429, + 429, 59, 429, 231, 429, 59, 60, 61, 62, 241, + 59, 429, 233, 60, 61, 62, 59, 429, 244, 233, + 59, 239, 60, 61, 62, 235, 236, 243, 59, 60, + + 61, 62, 60, 61, 62, 242, 60, 61, 62, 237, + 59, 60, 61, 62, 429, 59, 238, 60, 61, 62, + 59, 60, 61, 62, 235, 236, 243, 59, 429, 60, + 61, 62, 164, 246, 242, 245, 59, 429, 237, 429, + 59, 60, 61, 62, 429, 238, 60, 61, 62, 429, + 59, 60, 61, 62, 59, 247, 429, 429, 60, 61, + 62, 429, 246, 429, 245, 59, 429, 60, 61, 62, + 429, 60, 61, 62, 191, 191, 191, 191, 192, 429, + 251, 60, 61, 62, 247, 60, 61, 62, 250, 252, + 429, 59, 429, 429, 255, 59, 60, 61, 62, 248, + + 233, 248, 59, 429, 249, 249, 249, 249, 59, 252, + 429, 59, 254, 429, 59, 429, 429, 250, 252, 429, + 429, 429, 60, 61, 62, 59, 60, 61, 62, 253, + 252, 59, 244, 60, 61, 62, 241, 59, 164, 60, + 61, 62, 60, 61, 62, 60, 61, 62, 59, 429, + 429, 429, 59, 267, 256, 429, 60, 61, 62, 251, + 429, 429, 60, 61, 62, 429, 59, 272, 60, 61, + 62, 212, 212, 212, 212, 212, 212, 212, 212, 60, + 61, 62, 267, 60, 61, 62, 260, 260, 260, 260, + 270, 271, 274, 59, 273, 429, 272, 60, 61, 62, + + 276, 429, 275, 59, 429, 429, 59, 429, 429, 429, + 59, 277, 429, 59, 429, 429, 59, 429, 146, 270, + 271, 274, 59, 273, 60, 61, 62, 429, 429, 277, + 429, 275, 429, 59, 60, 61, 62, 60, 61, 62, + 277, 60, 61, 62, 60, 61, 62, 60, 61, 62, + 278, 279, 280, 60, 61, 62, 429, 59, 240, 240, + 240, 240, 281, 59, 60, 61, 62, 429, 282, 283, + 59, 429, 429, 429, 59, 429, 429, 59, 429, 429, + 279, 280, 59, 429, 429, 429, 59, 429, 60, 61, + 62, 281, 59, 284, 60, 61, 62, 282, 283, 429, + + 59, 60, 61, 62, 59, 60, 61, 62, 60, 61, + 62, 59, 429, 60, 61, 62, 59, 60, 61, 62, + 429, 285, 284, 60, 61, 62, 429, 59, 429, 288, + 59, 60, 61, 62, 429, 60, 61, 62, 249, 249, + 249, 249, 60, 61, 62, 286, 429, 60, 61, 62, + 285, 249, 249, 249, 249, 286, 59, 277, 60, 61, + 62, 60, 61, 62, 429, 429, 59, 295, 429, 59, + 429, 429, 59, 429, 286, 313, 313, 313, 313, 59, + 349, 349, 349, 349, 286, 429, 276, 60, 61, 62, + 59, 278, 368, 368, 368, 368, 295, 60, 61, 62, + + 60, 61, 62, 60, 61, 62, 260, 260, 260, 260, + 60, 61, 62, 297, 292, 299, 296, 429, 300, 59, + 298, 60, 61, 62, 59, 301, 429, 429, 59, 429, + 429, 59, 429, 429, 292, 59, 429, 429, 59, 429, + 429, 429, 297, 59, 299, 296, 429, 300, 429, 298, + 60, 61, 62, 59, 301, 60, 61, 62, 429, 60, + 61, 62, 60, 61, 62, 305, 60, 61, 62, 60, + 61, 62, 302, 429, 60, 61, 62, 302, 429, 307, + 59, 429, 429, 59, 60, 61, 62, 429, 59, 303, + 429, 429, 59, 304, 305, 429, 429, 59, 306, 429, + + 429, 302, 59, 429, 429, 59, 302, 429, 307, 429, + 308, 60, 61, 62, 60, 61, 62, 309, 303, 60, + 61, 62, 304, 60, 61, 62, 59, 306, 60, 61, + 62, 315, 59, 60, 61, 62, 60, 61, 62, 308, + 316, 317, 429, 429, 59, 429, 309, 429, 429, 59, + 319, 429, 429, 429, 59, 318, 429, 60, 61, 62, + 315, 59, 429, 60, 61, 62, 320, 429, 59, 316, + 317, 429, 429, 59, 322, 60, 61, 62, 323, 319, + 60, 61, 62, 59, 318, 60, 61, 62, 429, 321, + 59, 429, 60, 61, 62, 320, 59, 328, 429, 60, + + 61, 62, 59, 322, 60, 61, 62, 323, 324, 429, + 59, 325, 429, 429, 60, 61, 62, 326, 321, 59, + 429, 60, 61, 62, 59, 429, 328, 60, 61, 62, + 59, 334, 429, 60, 61, 62, 327, 324, 429, 429, + 325, 60, 61, 62, 429, 59, 326, 429, 429, 59, + 60, 61, 62, 59, 429, 60, 61, 62, 333, 429, + 334, 60, 61, 62, 429, 327, 313, 313, 313, 313, + 332, 59, 378, 378, 378, 378, 60, 61, 62, 336, + 60, 61, 62, 335, 60, 61, 62, 333, 429, 429, + 338, 59, 339, 378, 378, 378, 378, 59, 337, 429, + + 429, 59, 60, 61, 62, 59, 429, 429, 336, 59, + 340, 429, 335, 429, 59, 341, 429, 429, 429, 338, + 429, 339, 60, 61, 62, 59, 429, 337, 60, 61, + 62, 342, 60, 61, 62, 59, 60, 61, 62, 340, + 60, 61, 62, 429, 341, 60, 61, 62, 345, 59, + 343, 429, 59, 429, 429, 429, 60, 61, 62, 344, + 342, 59, 352, 429, 429, 429, 60, 61, 62, 350, + 429, 59, 429, 429, 429, 59, 429, 345, 59, 343, + 60, 61, 62, 60, 61, 62, 429, 429, 344, 59, + 351, 352, 60, 61, 62, 353, 429, 59, 350, 429, + + 59, 429, 60, 61, 62, 354, 60, 61, 62, 60, + 61, 62, 59, 429, 429, 59, 429, 429, 59, 351, + 60, 61, 62, 355, 353, 356, 429, 59, 60, 61, + 62, 60, 61, 62, 354, 59, 429, 429, 59, 429, + 429, 429, 429, 60, 61, 62, 60, 61, 62, 60, + 61, 62, 355, 429, 356, 357, 59, 361, 60, 61, + 62, 349, 349, 349, 349, 360, 60, 61, 62, 60, + 61, 62, 362, 59, 429, 429, 59, 429, 429, 429, + 59, 363, 429, 59, 357, 429, 361, 60, 61, 62, + 364, 429, 59, 365, 429, 59, 429, 429, 429, 59, + + 429, 362, 429, 59, 60, 61, 62, 60, 61, 62, + 363, 60, 61, 62, 60, 61, 62, 59, 369, 364, + 59, 429, 365, 60, 61, 62, 60, 61, 62, 59, + 60, 61, 62, 429, 60, 61, 62, 370, 429, 375, + 429, 374, 59, 429, 429, 429, 59, 369, 60, 61, + 62, 60, 61, 62, 368, 368, 368, 368, 373, 380, + 60, 61, 62, 59, 379, 429, 370, 59, 375, 429, + 374, 59, 429, 60, 61, 62, 429, 60, 61, 62, + 429, 59, 429, 429, 429, 59, 383, 429, 380, 59, + 429, 429, 429, 379, 60, 61, 62, 429, 60, 61, + + 62, 429, 60, 61, 62, 429, 429, 429, 59, 429, + 429, 429, 60, 61, 62, 383, 60, 61, 62, 429, + 60, 61, 62, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 60, + 61, 62, 54, 54, 54, 54, 54, 57, 57, 57, + 64, 64, 64, 64, 64, 269, 429, 269, 269, 3, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429 } ; -static const flex_int16_t yy_chk[2020] = +static const flex_int16_t yy_chk[2147] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -956,222 +975,236 @@ static const flex_int16_t yy_chk[2020] = 1, 1, 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, 486, 14, 14, 14, 14, + 9, 9, 9, 11, 14, 498, 14, 14, 14, 14, - 15, 15, 15, 15, 16, 16, 485, 16, 16, 16, + 15, 15, 15, 15, 16, 16, 497, 16, 16, 16, 16, 18, 18, 14, 19, 19, 19, 51, 14, 51, - 16, 64, 484, 483, 9, 17, 17, 54, 17, 17, - 17, 17, 85, 21, 8, 21, 482, 11, 27, 16, - 85, 17, 14, 21, 21, 21, 22, 14, 22, 16, - 16, 21, 21, 22, 21, 9, 9, 9, 69, 23, - 24, 22, 481, 480, 27, 64, 479, 27, 16, 23, - 17, 17, 24, 26, 54, 59, 86, 22, 29, 25, - 478, 477, 22, 25, 28, 70, 26, 69, 86, 24, - 476, 23, 22, 22, 22, 27, 27, 27, 23, 475, - - 474, 25, 26, 24, 24, 24, 28, 30, 25, 29, - 29, 29, 25, 28, 70, 473, 139, 26, 26, 26, - 30, 32, 23, 23, 23, 31, 31, 31, 31, 32, - 140, 472, 25, 25, 25, 32, 30, 28, 28, 28, - 59, 32, 31, 471, 59, 139, 59, 32, 201, 470, - 32, 30, 30, 30, 248, 34, 39, 279, 32, 140, - 31, 34, 33, 33, 33, 33, 300, 34, 469, 468, - 32, 31, 33, 319, 467, 466, 37, 201, 32, 32, - 32, 37, 39, 248, 34, 39, 279, 38, 33, 37, - 34, 31, 31, 31, 41, 300, 465, 33, 34, 34, - - 34, 33, 319, 37, 464, 37, 40, 463, 462, 38, - 37, 461, 41, 39, 39, 39, 38, 33, 460, 40, - 37, 37, 37, 41, 459, 458, 96, 57, 33, 33, - 33, 35, 43, 35, 96, 40, 35, 35, 35, 35, - 38, 38, 38, 41, 41, 41, 457, 456, 43, 35, - 40, 40, 40, 455, 454, 96, 42, 43, 57, 57, - 57, 43, 35, 44, 42, 96, 96, 96, 43, 44, - 453, 35, 452, 451, 450, 44, 42, 43, 35, 449, - 448, 447, 42, 446, 445, 42, 444, 45, 43, 43, - 43, 35, 44, 42, 46, 443, 442, 89, 44, 42, - - 45, 441, 35, 35, 35, 42, 44, 44, 44, 45, - 440, 439, 89, 42, 42, 42, 45, 46, 438, 56, - 437, 436, 56, 435, 434, 46, 46, 46, 433, 45, - 56, 56, 58, 58, 58, 58, 67, 67, 67, 67, - 45, 45, 45, 89, 89, 89, 66, 432, 431, 66, - 68, 97, 68, 68, 68, 68, 92, 66, 66, 97, - 71, 71, 71, 71, 430, 68, 56, 58, 429, 428, - 56, 427, 425, 71, 56, 72, 72, 72, 72, 92, - 97, 424, 56, 423, 422, 92, 56, 421, 56, 56, - 97, 97, 97, 66, 68, 68, 93, 66, 58, 58, - - 58, 66, 71, 71, 73, 73, 73, 73, 415, 66, - 92, 92, 92, 66, 90, 66, 66, 73, 74, 74, - 91, 74, 74, 74, 74, 75, 401, 75, 95, 93, - 75, 75, 75, 75, 74, 90, 400, 90, 94, 108, - 391, 95, 98, 90, 91, 108, 73, 73, 381, 91, - 370, 94, 108, 116, 116, 116, 116, 95, 94, 282, - 93, 93, 93, 74, 74, 98, 99, 94, 90, 90, - 90, 98, 95, 95, 95, 91, 91, 91, 100, 258, - 94, 99, 102, 108, 108, 108, 255, 101, 103, 94, - 94, 94, 252, 100, 250, 99, 98, 98, 98, 101, - - 217, 215, 214, 102, 212, 209, 208, 100, 207, 103, - 199, 102, 99, 99, 99, 106, 101, 103, 104, 104, - 104, 104, 104, 107, 100, 100, 100, 105, 106, 105, - 101, 101, 101, 109, 102, 102, 102, 197, 107, 157, - 103, 103, 103, 105, 106, 156, 155, 154, 109, 153, - 152, 151, 107, 104, 150, 149, 105, 148, 105, 106, - 106, 106, 109, 110, 110, 110, 110, 137, 115, 107, - 107, 107, 111, 112, 105, 105, 105, 115, 113, 109, - 109, 109, 114, 113, 104, 104, 104, 136, 141, 111, - 141, 134, 113, 141, 141, 141, 141, 115, 110, 133, - - 122, 111, 88, 87, 112, 112, 112, 114, 115, 115, - 115, 114, 113, 84, 117, 119, 117, 118, 119, 118, - 111, 111, 111, 113, 113, 113, 118, 83, 120, 110, - 110, 110, 117, 82, 120, 118, 81, 62, 114, 114, - 114, 121, 61, 125, 119, 117, 124, 121, 118, 119, - 119, 119, 60, 52, 123, 50, 49, 120, 125, 48, - 47, 117, 36, 20, 118, 120, 120, 120, 123, 124, - 121, 10, 125, 130, 117, 124, 126, 118, 121, 121, - 121, 7, 127, 6, 130, 123, 123, 123, 127, 125, - 125, 125, 126, 129, 128, 132, 124, 3, 126, 129, - - 124, 124, 124, 128, 130, 130, 130, 126, 126, 126, - 0, 162, 0, 127, 127, 127, 0, 0, 128, 0, - 0, 0, 129, 128, 0, 0, 132, 132, 132, 158, - 129, 129, 129, 159, 128, 128, 128, 143, 160, 0, - 143, 143, 143, 143, 144, 144, 144, 144, 145, 145, - 145, 145, 146, 146, 146, 146, 161, 144, 162, 0, - 158, 158, 158, 163, 159, 159, 159, 0, 164, 160, - 160, 160, 164, 173, 173, 173, 173, 165, 161, 0, - 0, 163, 0, 0, 165, 161, 144, 144, 0, 162, - 162, 162, 163, 167, 166, 146, 0, 164, 0, 168, - - 167, 0, 0, 164, 164, 164, 165, 168, 0, 161, - 161, 161, 163, 163, 163, 165, 165, 165, 166, 169, - 0, 0, 167, 166, 174, 0, 170, 169, 168, 0, - 0, 167, 167, 167, 170, 0, 0, 0, 168, 168, - 168, 0, 0, 171, 171, 172, 174, 0, 169, 166, - 166, 166, 176, 174, 178, 170, 177, 171, 169, 169, - 169, 0, 175, 172, 171, 170, 170, 170, 171, 0, - 0, 179, 171, 171, 172, 182, 178, 174, 174, 174, - 175, 0, 0, 176, 176, 176, 171, 177, 177, 177, - 180, 175, 181, 171, 172, 172, 172, 182, 0, 171, - - 171, 171, 179, 179, 179, 180, 0, 178, 178, 178, - 183, 175, 175, 175, 187, 0, 184, 183, 188, 180, - 0, 187, 189, 181, 181, 181, 184, 193, 182, 182, - 182, 185, 185, 185, 185, 185, 180, 180, 180, 183, - 188, 0, 0, 187, 189, 184, 0, 188, 183, 183, - 183, 189, 187, 187, 187, 191, 232, 184, 184, 184, - 186, 195, 186, 191, 0, 186, 186, 186, 186, 0, - 193, 188, 188, 188, 192, 189, 189, 189, 194, 0, - 0, 192, 0, 195, 191, 194, 196, 232, 232, 232, - 195, 0, 196, 0, 191, 191, 191, 203, 203, 203, - - 203, 193, 193, 193, 0, 192, 192, 192, 0, 194, - 194, 194, 0, 219, 195, 195, 195, 196, 196, 196, - 204, 204, 204, 204, 205, 205, 205, 205, 216, 220, - 221, 218, 0, 0, 0, 219, 231, 231, 231, 231, - 0, 216, 219, 0, 218, 238, 238, 238, 238, 0, - 226, 222, 221, 0, 0, 220, 0, 216, 220, 221, - 218, 223, 226, 204, 0, 223, 219, 219, 219, 222, - 224, 0, 216, 216, 216, 218, 218, 218, 0, 226, - 222, 225, 234, 221, 221, 221, 220, 220, 220, 227, - 223, 0, 224, 226, 226, 226, 223, 223, 223, 224, - - 222, 222, 222, 225, 228, 0, 0, 227, 229, 0, - 225, 235, 233, 234, 234, 234, 228, 230, 227, 233, - 0, 0, 236, 224, 224, 224, 229, 0, 0, 245, - 230, 0, 0, 228, 225, 225, 225, 229, 227, 227, - 227, 233, 235, 235, 235, 240, 230, 228, 228, 228, - 233, 233, 233, 236, 236, 236, 0, 229, 229, 229, - 237, 230, 230, 230, 241, 243, 237, 239, 239, 239, - 239, 242, 245, 256, 0, 241, 240, 240, 240, 0, - 0, 0, 242, 249, 249, 249, 249, 243, 0, 237, - 0, 249, 0, 241, 243, 260, 256, 237, 237, 237, - - 242, 259, 256, 245, 245, 245, 241, 241, 241, 259, - 262, 249, 0, 242, 242, 242, 261, 260, 243, 243, - 243, 0, 0, 262, 260, 0, 0, 256, 256, 256, - 259, 263, 0, 264, 261, 267, 0, 0, 267, 262, - 259, 259, 259, 269, 263, 261, 0, 0, 260, 260, - 260, 264, 265, 0, 262, 262, 262, 266, 269, 0, - 263, 0, 264, 265, 267, 261, 261, 261, 266, 267, - 267, 267, 269, 270, 271, 263, 263, 263, 268, 0, - 270, 265, 264, 264, 264, 0, 266, 268, 273, 269, - 269, 269, 271, 0, 265, 265, 265, 272, 0, 266, - - 266, 266, 270, 271, 283, 274, 0, 268, 0, 0, - 273, 270, 270, 270, 274, 0, 0, 273, 268, 268, - 268, 0, 283, 271, 271, 271, 0, 284, 272, 272, - 272, 284, 0, 283, 274, 280, 280, 280, 280, 285, - 290, 273, 273, 273, 286, 274, 274, 274, 287, 290, - 288, 0, 285, 283, 283, 283, 284, 286, 289, 0, - 291, 0, 284, 284, 284, 289, 0, 0, 285, 290, - 292, 287, 0, 286, 288, 0, 0, 287, 0, 288, - 290, 290, 290, 285, 285, 285, 0, 289, 286, 286, - 286, 291, 291, 291, 292, 294, 289, 289, 289, 292, - - 297, 0, 287, 287, 287, 288, 288, 288, 293, 0, - 293, 295, 0, 0, 294, 0, 0, 0, 295, 296, - 0, 0, 297, 303, 294, 292, 292, 292, 296, 297, - 301, 301, 301, 301, 301, 0, 303, 293, 0, 305, - 295, 293, 293, 293, 304, 294, 294, 294, 296, 295, - 295, 295, 303, 297, 297, 297, 307, 306, 309, 296, - 296, 296, 304, 0, 0, 306, 0, 303, 303, 303, - 305, 305, 305, 304, 307, 308, 0, 309, 320, 320, - 320, 320, 308, 0, 0, 307, 306, 309, 311, 310, - 0, 0, 323, 304, 304, 304, 306, 306, 306, 312, - - 0, 0, 0, 311, 308, 307, 307, 307, 309, 309, - 309, 310, 313, 308, 308, 308, 316, 311, 310, 312, - 314, 0, 314, 323, 323, 323, 0, 321, 312, 0, - 313, 315, 0, 315, 311, 311, 311, 0, 0, 316, - 0, 313, 310, 310, 310, 316, 324, 321, 0, 314, - 312, 312, 312, 314, 314, 314, 321, 0, 327, 324, - 315, 313, 313, 313, 315, 315, 315, 322, 325, 0, - 316, 316, 316, 328, 322, 324, 0, 326, 321, 321, - 321, 327, 348, 348, 348, 348, 329, 327, 331, 0, - 324, 324, 324, 333, 0, 328, 322, 0, 329, 325, - - 325, 325, 328, 330, 332, 322, 322, 322, 326, 326, - 326, 333, 327, 327, 327, 329, 330, 0, 0, 331, - 331, 331, 333, 0, 338, 0, 328, 328, 328, 329, - 329, 329, 330, 0, 342, 332, 332, 332, 0, 339, - 0, 340, 333, 333, 333, 344, 341, 330, 330, 330, - 337, 337, 337, 337, 337, 338, 338, 338, 339, 343, - 0, 340, 0, 0, 341, 342, 342, 342, 339, 349, - 340, 0, 343, 0, 0, 341, 344, 344, 344, 0, - 0, 350, 345, 0, 0, 352, 351, 0, 343, 339, - 339, 339, 340, 340, 340, 341, 341, 341, 353, 0, - - 349, 349, 349, 343, 343, 343, 345, 357, 0, 0, - 351, 345, 350, 350, 350, 351, 352, 352, 352, 356, - 356, 356, 356, 356, 353, 0, 0, 353, 361, 361, - 361, 361, 363, 357, 0, 0, 357, 345, 345, 345, - 358, 351, 351, 351, 362, 0, 0, 358, 0, 0, - 0, 362, 0, 0, 363, 353, 353, 353, 368, 367, - 0, 363, 371, 0, 357, 357, 357, 0, 0, 358, - 0, 0, 0, 362, 366, 366, 366, 366, 358, 358, - 358, 367, 362, 362, 362, 363, 363, 363, 367, 368, - 368, 368, 0, 371, 371, 371, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 367, 367, 367, 418, 418, 418, 418, 418, - 419, 419, 419, 420, 420, 420, 420, 420, 426, 0, - 426, 426, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417 + 16, 496, 64, 495, 9, 17, 17, 54, 17, 17, + 17, 17, 29, 21, 8, 21, 494, 11, 69, 16, + 493, 17, 14, 21, 21, 21, 22, 14, 22, 16, + 16, 21, 21, 22, 21, 9, 9, 9, 70, 23, + 24, 22, 492, 29, 29, 29, 64, 69, 16, 23, + 17, 17, 24, 26, 54, 491, 85, 22, 86, 25, + 27, 490, 22, 25, 85, 489, 26, 70, 27, 24, + 86, 23, 22, 22, 22, 488, 143, 30, 23, 28, + + 144, 25, 26, 24, 24, 24, 27, 487, 25, 27, + 30, 209, 25, 67, 67, 67, 67, 26, 26, 26, + 486, 28, 23, 23, 23, 143, 30, 485, 28, 144, + 259, 291, 25, 25, 25, 46, 32, 27, 27, 27, + 209, 30, 30, 30, 32, 34, 31, 31, 31, 31, + 32, 34, 28, 28, 28, 31, 32, 34, 46, 259, + 291, 484, 32, 31, 483, 32, 46, 46, 46, 72, + 72, 72, 72, 32, 34, 57, 33, 33, 33, 33, + 34, 31, 482, 481, 480, 32, 33, 312, 34, 34, + 34, 37, 31, 32, 32, 32, 37, 331, 479, 478, + + 59, 38, 33, 39, 37, 477, 57, 57, 57, 476, + 475, 33, 31, 31, 31, 33, 312, 474, 37, 473, + 37, 472, 471, 38, 470, 37, 331, 469, 40, 39, + 38, 33, 39, 89, 468, 37, 37, 37, 467, 466, + 39, 40, 33, 33, 33, 35, 41, 35, 89, 465, + 35, 35, 35, 35, 38, 38, 38, 40, 464, 463, + 39, 39, 39, 35, 41, 59, 462, 41, 461, 59, + 114, 59, 40, 40, 40, 41, 35, 460, 42, 89, + 89, 89, 75, 43, 75, 35, 42, 75, 75, 75, + 75, 459, 35, 458, 457, 41, 41, 41, 42, 43, + + 45, 114, 114, 114, 42, 35, 456, 42, 43, 455, + 454, 93, 43, 45, 44, 42, 35, 35, 35, 43, + 44, 42, 45, 453, 452, 451, 44, 42, 43, 45, + 58, 58, 58, 58, 450, 42, 42, 42, 449, 43, + 43, 43, 45, 44, 93, 113, 448, 447, 446, 44, + 445, 444, 443, 45, 45, 45, 442, 44, 44, 44, + 56, 441, 113, 56, 68, 58, 68, 68, 68, 68, + 66, 56, 56, 66, 113, 93, 93, 93, 440, 68, + 439, 66, 66, 118, 118, 118, 118, 437, 436, 71, + 71, 71, 71, 113, 113, 113, 58, 58, 58, 435, + + 434, 433, 71, 73, 73, 73, 73, 56, 68, 68, + 427, 56, 413, 90, 412, 56, 73, 66, 403, 393, + 91, 66, 382, 56, 294, 66, 269, 56, 266, 56, + 56, 71, 71, 66, 90, 92, 90, 66, 263, 66, + 66, 95, 90, 261, 91, 73, 73, 74, 74, 91, + 74, 74, 74, 74, 95, 225, 223, 100, 92, 94, + 222, 220, 217, 74, 92, 96, 100, 90, 90, 90, + 95, 216, 94, 96, 97, 91, 91, 91, 215, 94, + 207, 205, 97, 161, 160, 95, 95, 95, 94, 92, + 92, 92, 74, 74, 96, 98, 102, 100, 100, 100, + + 159, 94, 158, 97, 96, 96, 96, 99, 102, 157, + 94, 94, 94, 97, 97, 97, 101, 103, 98, 156, + 155, 154, 99, 104, 98, 102, 105, 105, 105, 105, + 105, 101, 112, 112, 112, 112, 99, 153, 103, 102, + 102, 102, 152, 141, 104, 101, 103, 140, 106, 98, + 98, 98, 104, 99, 99, 99, 106, 149, 149, 149, + 149, 105, 101, 101, 101, 138, 107, 112, 107, 103, + 103, 103, 108, 137, 124, 104, 104, 104, 110, 88, + 87, 109, 107, 84, 110, 108, 83, 106, 106, 106, + 111, 110, 105, 105, 105, 107, 109, 107, 112, 112, + + 112, 108, 82, 117, 81, 111, 115, 62, 61, 60, + 109, 115, 117, 107, 107, 107, 108, 108, 108, 111, + 115, 116, 110, 110, 110, 52, 50, 109, 109, 109, + 121, 49, 117, 121, 48, 47, 111, 111, 111, 119, + 115, 119, 36, 117, 117, 117, 116, 20, 10, 128, + 116, 115, 115, 115, 120, 122, 120, 119, 7, 121, + 6, 122, 3, 120, 121, 121, 121, 123, 126, 128, + 119, 0, 120, 123, 0, 0, 125, 116, 116, 116, + 128, 128, 128, 127, 122, 120, 119, 0, 0, 0, + 125, 126, 122, 122, 122, 129, 123, 126, 127, 119, + + 0, 120, 0, 130, 123, 123, 123, 125, 125, 125, + 0, 131, 127, 0, 120, 136, 129, 131, 126, 130, + 0, 0, 126, 126, 126, 130, 129, 129, 129, 127, + 127, 127, 132, 0, 130, 130, 130, 0, 134, 133, + 0, 132, 131, 131, 131, 133, 136, 136, 136, 134, + 0, 0, 145, 166, 145, 0, 132, 145, 145, 145, + 145, 132, 148, 148, 148, 148, 162, 0, 133, 134, + 134, 134, 132, 132, 132, 148, 133, 133, 133, 147, + 163, 165, 147, 147, 147, 147, 150, 150, 150, 150, + 164, 167, 178, 178, 178, 178, 0, 162, 162, 162, + + 166, 170, 0, 165, 148, 148, 0, 0, 169, 167, + 165, 163, 163, 163, 168, 169, 0, 0, 168, 0, + 167, 164, 164, 164, 0, 170, 0, 0, 0, 150, + 170, 166, 166, 166, 165, 165, 165, 169, 171, 0, + 167, 167, 167, 168, 172, 171, 169, 169, 169, 168, + 168, 168, 172, 173, 0, 0, 170, 170, 170, 0, + 174, 173, 177, 175, 0, 0, 0, 171, 174, 0, + 0, 175, 0, 172, 0, 182, 171, 171, 171, 179, + 177, 0, 173, 172, 172, 172, 179, 0, 184, 174, + 183, 177, 173, 173, 173, 176, 176, 181, 185, 174, + + 174, 174, 175, 175, 175, 180, 182, 182, 182, 176, + 184, 177, 177, 177, 0, 181, 176, 179, 179, 179, + 176, 183, 183, 183, 176, 176, 181, 180, 0, 185, + 185, 185, 188, 189, 180, 186, 187, 0, 176, 0, + 189, 184, 184, 184, 0, 176, 181, 181, 181, 0, + 186, 176, 176, 176, 188, 190, 0, 0, 180, 180, + 180, 0, 189, 0, 186, 190, 0, 187, 187, 187, + 0, 189, 189, 189, 191, 191, 191, 191, 191, 0, + 194, 186, 186, 186, 190, 188, 188, 188, 193, 195, + 0, 198, 0, 0, 201, 193, 190, 190, 190, 192, + + 197, 192, 194, 0, 192, 192, 192, 192, 197, 194, + 0, 195, 198, 0, 199, 0, 0, 193, 195, 0, + 0, 0, 198, 198, 198, 200, 193, 193, 193, 197, + 203, 202, 200, 194, 194, 194, 199, 201, 202, 197, + 197, 197, 195, 195, 195, 199, 199, 199, 204, 0, + 0, 0, 203, 224, 204, 0, 200, 200, 200, 203, + 0, 0, 202, 202, 202, 0, 224, 228, 201, 201, + 201, 211, 211, 211, 211, 212, 212, 212, 212, 204, + 204, 204, 224, 203, 203, 203, 213, 213, 213, 213, + 226, 227, 230, 228, 229, 0, 228, 224, 224, 224, + + 232, 0, 231, 226, 0, 0, 231, 0, 0, 0, + 230, 233, 0, 227, 0, 0, 229, 0, 212, 226, + 227, 230, 232, 229, 228, 228, 228, 0, 0, 232, + 0, 231, 0, 233, 226, 226, 226, 231, 231, 231, + 233, 230, 230, 230, 227, 227, 227, 229, 229, 229, + 234, 235, 236, 232, 232, 232, 0, 234, 240, 240, + 240, 240, 237, 235, 233, 233, 233, 0, 238, 239, + 236, 0, 0, 0, 237, 0, 0, 241, 0, 0, + 235, 236, 239, 0, 0, 0, 238, 0, 234, 234, + 234, 237, 242, 243, 235, 235, 235, 238, 239, 0, + + 243, 236, 236, 236, 244, 237, 237, 237, 241, 241, + 241, 245, 0, 239, 239, 239, 246, 238, 238, 238, + 0, 247, 243, 242, 242, 242, 0, 247, 0, 256, + 250, 243, 243, 243, 0, 244, 244, 244, 248, 248, + 248, 248, 245, 245, 245, 251, 0, 246, 246, 246, + 247, 249, 249, 249, 249, 252, 251, 253, 247, 247, + 247, 250, 250, 250, 0, 0, 252, 267, 0, 254, + 0, 0, 256, 0, 251, 292, 292, 292, 292, 253, + 332, 332, 332, 332, 252, 0, 253, 251, 251, 251, + 267, 254, 360, 360, 360, 360, 267, 252, 252, 252, + + 254, 254, 254, 256, 256, 256, 260, 260, 260, 260, + 253, 253, 253, 271, 260, 273, 270, 0, 274, 278, + 272, 267, 267, 267, 270, 275, 0, 0, 273, 0, + 0, 274, 0, 0, 260, 271, 0, 0, 272, 0, + 0, 0, 271, 275, 273, 270, 0, 274, 0, 272, + 278, 278, 278, 284, 275, 270, 270, 270, 0, 273, + 273, 273, 274, 274, 274, 281, 271, 271, 271, 272, + 272, 272, 276, 0, 275, 275, 275, 277, 0, 283, + 281, 0, 0, 276, 284, 284, 284, 0, 277, 279, + 0, 0, 279, 280, 281, 0, 0, 283, 282, 0, + + 0, 276, 280, 0, 0, 282, 277, 0, 283, 0, + 285, 281, 281, 281, 276, 276, 276, 286, 279, 277, + 277, 277, 280, 279, 279, 279, 286, 282, 283, 283, + 283, 295, 285, 280, 280, 280, 282, 282, 282, 285, + 296, 297, 0, 0, 296, 0, 286, 0, 0, 295, + 299, 0, 0, 0, 297, 298, 0, 286, 286, 286, + 295, 303, 0, 285, 285, 285, 300, 0, 298, 296, + 297, 0, 0, 299, 302, 296, 296, 296, 304, 299, + 295, 295, 295, 302, 298, 297, 297, 297, 0, 301, + 300, 0, 303, 303, 303, 300, 301, 309, 0, 298, + + 298, 298, 304, 302, 299, 299, 299, 304, 305, 0, + 305, 306, 0, 0, 302, 302, 302, 307, 301, 309, + 0, 300, 300, 300, 307, 0, 309, 301, 301, 301, + 306, 316, 0, 304, 304, 304, 308, 305, 0, 0, + 306, 305, 305, 305, 0, 308, 307, 0, 0, 316, + 309, 309, 309, 317, 0, 307, 307, 307, 315, 0, + 316, 306, 306, 306, 0, 308, 313, 313, 313, 313, + 313, 315, 373, 373, 373, 373, 308, 308, 308, 319, + 316, 316, 316, 318, 317, 317, 317, 315, 0, 0, + 321, 318, 322, 378, 378, 378, 378, 319, 320, 0, + + 0, 335, 315, 315, 315, 320, 0, 0, 319, 321, + 323, 0, 318, 0, 322, 324, 0, 0, 0, 321, + 0, 322, 318, 318, 318, 323, 0, 320, 319, 319, + 319, 325, 335, 335, 335, 324, 320, 320, 320, 323, + 321, 321, 321, 0, 324, 322, 322, 322, 328, 325, + 326, 0, 326, 0, 0, 0, 323, 323, 323, 327, + 325, 327, 336, 0, 0, 0, 324, 324, 324, 333, + 0, 328, 0, 0, 0, 336, 0, 328, 337, 326, + 325, 325, 325, 326, 326, 326, 0, 0, 327, 333, + 334, 336, 327, 327, 327, 339, 0, 334, 333, 0, + + 338, 0, 328, 328, 328, 340, 336, 336, 336, 337, + 337, 337, 343, 0, 0, 344, 0, 0, 339, 334, + 333, 333, 333, 341, 339, 342, 0, 340, 334, 334, + 334, 338, 338, 338, 340, 341, 0, 0, 342, 0, + 0, 0, 0, 343, 343, 343, 344, 344, 344, 339, + 339, 339, 341, 0, 342, 345, 350, 351, 340, 340, + 340, 349, 349, 349, 349, 349, 341, 341, 341, 342, + 342, 342, 352, 345, 0, 0, 351, 0, 0, 0, + 354, 353, 0, 356, 345, 0, 351, 350, 350, 350, + 355, 0, 352, 357, 0, 361, 0, 0, 0, 353, + + 0, 352, 0, 355, 345, 345, 345, 351, 351, 351, + 353, 354, 354, 354, 356, 356, 356, 357, 363, 355, + 362, 0, 357, 352, 352, 352, 361, 361, 361, 364, + 353, 353, 353, 0, 355, 355, 355, 365, 0, 370, + 0, 369, 363, 0, 0, 0, 370, 363, 357, 357, + 357, 362, 362, 362, 368, 368, 368, 368, 368, 375, + 364, 364, 364, 365, 374, 0, 365, 369, 370, 0, + 369, 374, 0, 363, 363, 363, 0, 370, 370, 370, + 0, 375, 0, 0, 0, 380, 379, 0, 375, 383, + 0, 0, 0, 374, 365, 365, 365, 0, 369, 369, + + 369, 0, 374, 374, 374, 0, 0, 0, 379, 0, + 0, 0, 375, 375, 375, 379, 380, 380, 380, 0, + 383, 383, 383, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 379, + 379, 379, 430, 430, 430, 430, 430, 431, 431, 431, + 432, 432, 432, 432, 432, 438, 0, 438, 438, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429 } ; -static const flex_int16_t yy_rule_linenum[68] = +static const flex_int16_t yy_rule_linenum[70] = { 0, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, @@ -1179,7 +1212,7 @@ static const flex_int16_t yy_rule_linenum[68] = 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, - 93, 94, 95, 96, 97, 98, 100 + 93, 94, 95, 96, 97, 98, 99, 100, 102 } ; /* The intent behind this definition is that it'll catch @@ -1647,13 +1680,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 >= 418 ) + if ( yy_current_state >= 430 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_current_state != 417 ); + while ( yy_current_state != 429 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1673,13 +1706,13 @@ YY_DECL { if ( yy_act == 0 ) fprintf( stderr, "--scanner backing up\n" ); - else if ( yy_act < 68 ) + else if ( yy_act < 70 ) fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], yytext ); - else if ( yy_act == 68 ) + else if ( yy_act == 70 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", yytext ); - else if ( yy_act == 69 ) + else if ( yy_act == 71 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); @@ -1862,7 +1895,7 @@ return yy::parser::make_AVG (); YY_BREAK case 42: YY_RULE_SETUP -return yy::parser::make_BACKLINK(); +return yy::parser::make_BACKLINK(yytext); YY_BREAK case 43: YY_RULE_SETUP @@ -1878,91 +1911,99 @@ return yy::parser::make_KEY_VAL (yytext); YY_BREAK case 46: YY_RULE_SETUP -return yy::parser::make_CASE (); +return yy::parser::make_INDEX_FIRST (yytext); YY_BREAK case 47: YY_RULE_SETUP -return yy::parser::make_TRUE (); +return yy::parser::make_INDEX_LAST (yytext); YY_BREAK case 48: YY_RULE_SETUP -return yy::parser::make_FALSE (); +return yy::parser::make_CASE (); YY_BREAK case 49: YY_RULE_SETUP -return yy::parser::make_INFINITY(yytext); +return yy::parser::make_TRUE (); YY_BREAK case 50: YY_RULE_SETUP -return yy::parser::make_NAN(yytext); +return yy::parser::make_FALSE (); YY_BREAK case 51: YY_RULE_SETUP -return yy::parser::make_NULL_VAL (); +return yy::parser::make_INFINITY(yytext); YY_BREAK case 52: YY_RULE_SETUP -return yy::parser::make_UUID(yytext); +return yy::parser::make_NAN(yytext); YY_BREAK case 53: YY_RULE_SETUP -return yy::parser::make_OID(yytext); +return yy::parser::make_NULL_VAL (); YY_BREAK case 54: YY_RULE_SETUP -return yy::parser::make_TIMESTAMP(yytext); +return yy::parser::make_UUID(yytext); YY_BREAK case 55: YY_RULE_SETUP -return yy::parser::make_LINK (yytext); +return yy::parser::make_OID(yytext); YY_BREAK case 56: YY_RULE_SETUP -return yy::parser::make_TYPED_LINK (yytext); +return yy::parser::make_TIMESTAMP(yytext); YY_BREAK case 57: YY_RULE_SETUP -return yy::parser::make_NATURAL0 (yytext); +return yy::parser::make_LINK (yytext); YY_BREAK case 58: YY_RULE_SETUP -return yy::parser::make_ARG(yytext); +return yy::parser::make_TYPED_LINK (yytext); YY_BREAK case 59: YY_RULE_SETUP -return yy::parser::make_NUMBER (yytext); +return yy::parser::make_NATURAL0 (yytext); YY_BREAK case 60: YY_RULE_SETUP -return yy::parser::make_NUMBER (yytext); +return yy::parser::make_ARG(yytext); YY_BREAK case 61: YY_RULE_SETUP -return yy::parser::make_FLOAT (yytext); +return yy::parser::make_NUMBER (yytext); YY_BREAK case 62: YY_RULE_SETUP -return yy::parser::make_FLOAT (yytext); +return yy::parser::make_NUMBER (yytext); YY_BREAK case 63: YY_RULE_SETUP -return yy::parser::make_BASE64(yytext); +return yy::parser::make_FLOAT (yytext); YY_BREAK case 64: -/* rule 64 can match eol */ YY_RULE_SETUP -return yy::parser::make_STRING (yytext); +return yy::parser::make_FLOAT (yytext); YY_BREAK case 65: -/* rule 65 can match eol */ YY_RULE_SETUP -return yy::parser::make_STRING (yytext); +return yy::parser::make_BASE64(yytext); YY_BREAK case 66: +/* rule 66 can match eol */ YY_RULE_SETUP -return yy::parser::make_ID (check_escapes(yytext)); +return yy::parser::make_STRING (yytext); YY_BREAK case 67: +/* rule 67 can match eol */ +YY_RULE_SETUP +return yy::parser::make_STRING (yytext); + YY_BREAK +case 68: +YY_RULE_SETUP +return yy::parser::make_ID (check_escapes(yytext)); + YY_BREAK +case 69: YY_RULE_SETUP { throw yy::parser::syntax_error @@ -1972,7 +2013,7 @@ YY_RULE_SETUP case YY_STATE_EOF(INITIAL): return yy::parser::make_END (); YY_BREAK -case 68: +case 70: YY_RULE_SETUP ECHO; YY_BREAK @@ -2299,7 +2340,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 >= 418 ) + if ( yy_current_state >= 430 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -2334,11 +2375,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 >= 418 ) + if ( yy_current_state >= 430 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 417); + yy_is_jam = (yy_current_state == 429); (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 16d51514b4b..8d96d7a3248 100644 --- a/src/realm/parser/query_bison.yy +++ b/src/realm/parser/query_bison.yy @@ -80,10 +80,9 @@ using namespace realm::query_parser; ANY "any" ALL "all" NONE "none" - BACKLINK "@links" MAX "@max" MIN "@min" - SUM "@sun" + SUM "@sum" AVG "@average" AND "&&" OR "||" @@ -121,9 +120,12 @@ using namespace realm::query_parser; %token LIMIT "limit" %token ASCENDING "ascending" %token DESCENDING "descending" +%token INDEX_FIRST "FIRST" +%token INDEX_LAST "LAST" %token SIZE "@size" %token TYPE "@type" %token KEY_VAL "key or value" +%token BACKLINK "@links" %type direction %type equality relational stringop aggr_op %type coordinate @@ -360,6 +362,8 @@ path : id { $$ = drv.m_parse_nodes.create($1); } | path '.' id { $1->add_element($3); $$ = $1; } | path '[' NATURAL0 ']' { $1->add_element(size_t(strtoll($3.c_str(), nullptr, 0))); $$ = $1; } + | path '[' INDEX_FIRST ']' { $1->add_element(size_t(0)); $$ = $1; } + | path '[' INDEX_LAST ']' { $1->add_element(size_t(-1)); $$ = $1; } | path '[' STRING ']' { $1->add_element($3.substr(1, $3.size() - 2)); $$ = $1; } | path '[' ARG ']' { $1->add_element(drv.get_arg_for_index($3)); $$ = $1; } @@ -379,6 +383,8 @@ id | DESCENDING { $$ = $1; } | IN { $$ = $1; } | TEXT { $$ = $1; } + | INDEX_FIRST { $$ = $1; } + | INDEX_LAST { $$ = $1; } %% void diff --git a/src/realm/parser/query_flex.ll b/src/realm/parser/query_flex.ll index 313d0c10ae0..927a1969f7e 100644 --- a/src/realm/parser/query_flex.ll +++ b/src/realm/parser/query_flex.ll @@ -71,10 +71,12 @@ blank [ \t\r] "@min" return yy::parser::make_MIN (); "@sum" return yy::parser::make_SUM (); "@avg" return yy::parser::make_AVG (); -"@links" return yy::parser::make_BACKLINK(); +"@links" return yy::parser::make_BACKLINK(yytext); "@type" return yy::parser::make_TYPE (yytext); "@keys" return yy::parser::make_KEY_VAL (yytext); "@values" return yy::parser::make_KEY_VAL (yytext); +("FIRST"|"first") return yy::parser::make_INDEX_FIRST (yytext); +("LAST"|"last") return yy::parser::make_INDEX_LAST (yytext); "[c]" return yy::parser::make_CASE (); (true|TRUE) return yy::parser::make_TRUE (); (false|FALSE) return yy::parser::make_FALSE (); diff --git a/src/realm/query_expression.cpp b/src/realm/query_expression.cpp index 8c8c228a41f..e0099bc0cea 100644 --- a/src/realm/query_expression.cpp +++ b/src/realm/query_expression.cpp @@ -221,10 +221,9 @@ ColumnDictionaryKeys Columns::keys() return ColumnDictionaryKeys(*this); } -void Columns::init_key(Mixed key_value) +void Columns::init_path(const PathElement* begin, const PathElement* end) { - REALM_ASSERT(key_value.is_type(type_String)); - m_key = key_value.get_string(); + std::move(begin, end, std::back_inserter(m_path)); } void ColumnDictionaryKeys::set_cluster(const Cluster* cluster) @@ -328,19 +327,19 @@ void Columns::evaluate(size_t index, ValueBase& destination) for (size_t t = 0; t < sz; t++) { const Obj obj = m_link_map.get_target_table()->get_object(links[t]); auto dict = obj.get_dictionary(m_column_key); - if (m_key) { - Mixed val; - if (auto opt_val = dict.try_get(*m_key)) { - val = *opt_val; - } - values.emplace_back(val); - } - else { + if (m_path.empty()) { // Insert all values dict.for_all_values([&values](const Mixed& value) { values.emplace_back(value); }); } + else { + Mixed val; + if (auto opt_val = dict.try_get(m_path.front().get_key())) { + val = *opt_val; + } + values.emplace_back(val); + } } // Copy values over @@ -352,26 +351,13 @@ void Columns::evaluate(size_t index, ValueBase& destination) Allocator& alloc = get_base_table()->get_alloc(); REALM_ASSERT(m_leaf); - if (m_leaf->get(index)) { - Array top(alloc); - top.set_parent(&*m_leaf, index); - top.init_from_parent(); - BPlusTree values(alloc); - values.set_parent(&top, 1); - values.init_from_parent(); - - if (m_key) { - BPlusTree keys(alloc); - keys.set_parent(&top, 0); - keys.init_from_parent(); - Mixed val; - size_t ndx = keys.find_first(StringData(m_key)); - if (ndx != realm::not_found) { - val = values.get(ndx); - } - destination.set(0, val); - } - else { + if (ref_type ref = to_ref(m_leaf->get(index))) { + if (m_path.empty()) { + Array top(alloc); + top.init_from_ref(ref); + BPlusTree values(alloc); + values.set_parent(&top, 1); + values.init_from_parent(); destination.init(true, values.size()); size_t n = 0; // Iterate through BPlusTreee and insert all values @@ -380,6 +366,11 @@ void Columns::evaluate(size_t index, ValueBase& destination) n++; }); } + else { + auto val = + Collection::get_any({ref, CollectionType::Dictionary}, m_path.begin(), m_path.end(), alloc); + destination.set(0, val); + } } } } diff --git a/src/realm/query_expression.hpp b/src/realm/query_expression.hpp index 0c0225c2a76..eb4d5b3f200 100644 --- a/src/realm/query_expression.hpp +++ b/src/realm/query_expression.hpp @@ -1714,6 +1714,11 @@ class ObjPropertyBase { return m_column_key; } + virtual bool has_path() const noexcept + { + return false; + } + protected: LinkMap m_link_map; // Column index of payload column of m_table @@ -1986,7 +1991,38 @@ class Columns : public SimpleQuerySupport { template <> class Columns : public SimpleQuerySupport { +public: using SimpleQuerySupport::SimpleQuerySupport; + void evaluate(size_t index, ValueBase& destination) override + { + SimpleQuerySupport::evaluate(index, destination); + if (m_path.size() > 0) { + if (auto sz = destination.size()) { + for (size_t i = 0; i < sz; i++) { + Mixed val = Collection::get_any(destination.get(i), m_path.begin(), m_path.end(), + get_base_table()->get_alloc()); + destination.set(i, val); + } + } + } + } + std::string description(util::serializer::SerialisationState& state) const override + { + return ObjPropertyExpr::description(state) + util::to_string(m_path); + } + void path(const Path& path) + { + for (auto& elem : path) { + m_path.emplace_back(elem); + } + } + bool has_path() const noexcept override + { + return !m_path.empty(); + } + +private: + Path m_path; }; template <> @@ -2823,6 +2859,8 @@ class ColumnListBase { virtual std::unique_ptr sum_of() = 0; virtual std::unique_ptr avg_of() = 0; + virtual bool index(const PathElement&) = 0; + mutable ColKey m_column_key; LinkMap m_link_map; std::optional m_leaf; @@ -2849,6 +2887,7 @@ class ColumnsCollection : public Subexpr2, public ColumnListBase { : Subexpr2(other) , ColumnListBase(other) , m_is_nullable_storage(this->m_column_key.get_attrs().test(col_attr_Nullable)) + , m_index(other.m_index) { } @@ -2899,7 +2938,12 @@ class ColumnsCollection : public Subexpr2, public ColumnListBase { std::string description(util::serializer::SerialisationState& state) const override { - return ColumnListBase::description(state); + std::string index_string; + if (m_index) { + PathElement p(*m_index); + index_string = "[" + util::to_string(p) + "]"; + } + return ColumnListBase::description(state) + index_string; } util::Optional get_comparison_type() const final @@ -2990,9 +3034,16 @@ class ColumnsCollection : public Subexpr2, public ColumnListBase { { return std::unique_ptr(new ColumnsCollection(*this)); } + + bool index(const PathElement& ndx) override + { + m_index = ndx.get_ndx(); + return true; + } const bool m_is_nullable_storage; + std::optional m_index; -private: +protected: template void evaluate(size_t index, ValueBase& destination) { @@ -3007,9 +3058,20 @@ class ColumnsCollection : public Subexpr2, public ColumnListBase { if (list_ref) { BPlusTree list(alloc); list.init_from_ref(list_ref); - size_t s = list.size(); - for (size_t j = 0; j < s; j++) { - values.push_back(list.get(j)); + if (size_t s = list.size()) { + if (m_index) { + if (*m_index < s) { + values.push_back(list.get(*m_index)); + } + else if (*m_index == size_t(-1)) { + values.push_back(list.get(s - 1)); + } + } + else { + for (size_t j = 0; j < s; j++) { + values.push_back(list.get(j)); + } + } } } } @@ -3038,6 +3100,10 @@ class Columns> : public ColumnsCollection { { return make_subexpr>>(*this); } + bool index(const PathElement&) override + { + return false; + } }; @@ -3063,6 +3129,49 @@ class Columns : public Columns> { } }; +template <> +class Columns> : public ColumnsCollection { +public: + using ColumnsCollection::ColumnsCollection; + std::unique_ptr clone() const override + { + return make_subexpr>>(*this); + } + friend class Table; + friend class LinkChain; + bool indexes(const Path& path) + { + REALM_ASSERT(!path.empty()); + ColumnsCollection::index(path[0]); + for (auto& elem : path) { + m_path.emplace_back(elem); + } + return true; + } + std::string description(util::serializer::SerialisationState& state) const override + { + return ColumnListBase::description(state) + util::to_string(m_path); + } + + void evaluate(size_t index, ValueBase& destination) override + { + // Base class will handle path[0] and return result in destination + ColumnsCollection::evaluate(index, destination); + if (m_path.size() > 1) { + if (auto sz = destination.size()) { + for (size_t i = 0; i < sz; i++) { + Mixed val = + Collection::get_any(destination.get(i), m_path.begin() + 1, m_path.end(), get_alloc()); + destination.set(i, val); + } + } + } + } + +private: + Path m_path; +}; + // Returns the keys class ColumnDictionaryKeys; @@ -3074,13 +3183,35 @@ class Columns : public ColumnsCollection { util::Optional type = util::none) : ColumnsCollection(column, table, std::move(links), type) { - m_key_type = m_link_map.get_target_table()->get_dictionary_key_type(column); + m_key_type = m_link_map.get_target_table()->get_dictionary_key_type(m_column_key); + } + + Columns(const Path& path, ConstTableRef table, std::vector links = {}, + util::Optional type = util::none) + : ColumnsCollection(path[0].get_col_key(), table, std::move(links), type) + { + if (path.size() == 1) { + m_key_type = m_link_map.get_target_table()->get_dictionary_key_type(m_column_key); + } + if (path.size() > 1) { + init_path(&path[1], &*path.end()); + } + } + + // Change the node to handle a specific key value only + Columns& key(StringData key) + { + PathElement p(key); + init_path(&p, &p + 1); + return *this; } // Change the node to handle a specific key value only - Columns& key(const Mixed& key_value) + Columns& key(const Path& path) { - init_key(key_value); + auto sz = path.size(); + const PathElement* first = &path[0]; + init_path(first, first + sz); return *this; } @@ -3102,11 +3233,7 @@ class Columns : public ColumnsCollection { std::string description(util::serializer::SerialisationState& state) const override { - std::string key_string; - if (m_key) { - key_string = "['" + *m_key + "']"; - } - return ColumnListBase::description(state) + key_string; + return ColumnListBase::description(state) + util::to_string(m_path); } std::unique_ptr clone() const override @@ -3114,18 +3241,23 @@ class Columns : public ColumnsCollection { return make_subexpr>(*this); } + bool index(const PathElement&) override + { + return false; + } + Columns(Columns const& other) : ColumnsCollection(other) , m_key_type(other.m_key_type) - , m_key(other.m_key) + , m_path(other.m_path) { } protected: - DataType m_key_type; - util::Optional m_key; + DataType m_key_type = type_String; + Path m_path; - void init_key(Mixed key_value); + void init_path(const PathElement* begin, const PathElement* end); }; // Returns the keys diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 0e46b35be3d..e6e0f2a19ae 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -2392,7 +2392,7 @@ TEST_TYPES(Parser_list_of_primitive_types, Prop, Nullable, Prop, auto col_link = t->add_column(*t, "link"); auto obj1 = t->create_object(); - std::vector values = gen.values_from_int({0, 9, 4, 2, 7, 4, 1, 8, 11, 3, 4, 5, 22}); + std::vector values = gen.values_from_int({2, 9, 4, 0, 7, 4, 1, 8, 11, 3, 4, 5, 22}); obj1.set_list_values(col, values); t->create_object(); // empty list auto obj3 = t->create_object(); // {1} @@ -2403,10 +2403,12 @@ TEST_TYPES(Parser_list_of_primitive_types, Prop, Nullable, Prop, obj4.get_list(col).add(value_1); auto obj5 = t->create_object(); // {null} or {0} obj5.get_list(col).add(TEST_TYPE::default_value()); - for (auto it = t->begin(); it != t->end(); ++it) { it->set(col_link, it->get_key()); // self links } + auto value_first = gen.convert_for_test(2); + auto value_4 = gen.convert_for_test(7); + auto value_last = gen.convert_for_test(22); // repeat the same tests but over links, the tests are only the same because the links are self cycles std::vector column_prefix = {"", "link.", "link.link."}; @@ -2419,8 +2421,8 @@ TEST_TYPES(Parser_list_of_primitive_types, Prop, Nullable, Prop, verify_query(test_context, t, util::format("%1values.@count == 13", path), 1); // obj1 verify_query(test_context, t, util::format("%1values == NULL", path), (is_nullable ? 1 : 0)); // obj5 - std::any args[] = {value_1}; - size_t num_args = 1; + std::any args[] = {value_1, value_first, value_4, value_last}; + size_t num_args = 4; size_t num_matching_value_1 = 3; // obj1, obj3, obj4 size_t num_not_matching_value_1 = 2; // obj1, obj5 size_t num_all_matching_value_1 = 3; // obj2, obj3, obj4 @@ -2435,6 +2437,9 @@ TEST_TYPES(Parser_list_of_primitive_types, Prop, Nullable, Prop, num_none_matching_value_1 = is_nullable ? 2 : 1; num_none_not_matching_value_1 = is_nullable ? 3 : 4; } + verify_query_sub(test_context, t, util::format("%1values[first] == $1", path), args, num_args, 1); + verify_query_sub(test_context, t, util::format("%1values[4] == $2", path), args, num_args, 1); + verify_query_sub(test_context, t, util::format("%1values[last] == $3", path), args, num_args, 1); verify_query_sub(test_context, t, util::format("%1values == $0", path), args, num_args, num_matching_value_1); verify_query_sub(test_context, t, util::format("%1values != $0", path), args, num_args, num_not_matching_value_1); @@ -4977,8 +4982,9 @@ TEST(Parser_Dictionary) verify_query(test_context, foo, "dict.@values > 50", 50); verify_query(test_context, foo, "dict['Value'] > 50", expected); - verify_query_sub(test_context, foo, "dict[$0] > 50", args, num_args, expected); verify_query(test_context, foo, "dict.Value > 50", expected); + verify_query_sub(test_context, foo, "dict[$0] > 50", args, num_args, expected); + verify_query(test_context, foo, "dict['Value'] > 50", expected); verify_query(test_context, foo, "ANY dict.@keys == 'Foo'", 20); verify_query(test_context, foo, "NONE dict.@keys == 'Value'", 23); verify_query(test_context, foo, "dict.@keys == {'Bar'}", 20); @@ -4991,8 +4997,12 @@ TEST(Parser_Dictionary) verify_query(test_context, foo, "ALL dict.@type == 'int'", 100); // all dictionaries have ints verify_query(test_context, foo, "NONE dict.@type == 'int'", 0); // each object has Bar:i verify_query(test_context, foo, "ANY dict.@type == 'string'", 0); // no strings present + // Dictionaries are not ordered + CHECK_THROW_ANY(verify_query(test_context, foo, "dict[FIRST] > 50", expected)); + CHECK_THROW_ANY(verify_query(test_context, foo, "dict[LAST] > 50", expected)); verify_query(test_context, origin, "link.dict['Value'] > 50", 3); + verify_query(test_context, origin, "link.dict.Value > 50", 3); verify_query(test_context, origin, "links.dict['Value'] > 50", 5); verify_query(test_context, origin, "links.dict > 50", 6); verify_query(test_context, origin, "links.dict['Value'] == NULL", 10); @@ -5104,6 +5114,185 @@ TEST(Parser_DictionarySorting) CHECK_EQUAL(results.get_object(3).get_key(), astro.get_key()); } +TEST(Parser_NestedDictionaryList) +{ + Group g; + auto persons = g.add_table_with_primary_key("table", type_String, "name"); + auto col = persons->add_column_dictionary(type_Mixed, "properties"); + + Obj paul = persons->create_object_with_primary_key("Paul"); + auto dict_paul = paul.get_dictionary(col); + dict_paul.insert_collection("tickets", CollectionType::List); + auto list1 = dict_paul.get_list("tickets"); + list1->add(0); + list1->add(1); + list1->add(4); + + Obj john = persons->create_object_with_primary_key("John"); + auto dict_john = john.get_dictionary(col); + dict_john.insert_collection("tickets", CollectionType::List); + auto list2 = dict_john.get_list("tickets"); + list2->add(2); + list2->add(3); + list2->add(4); + + verify_query(test_context, persons, "properties.tickets[0] == 0", 1); + verify_query(test_context, persons, "properties.tickets[last] == 4", 2); +} + +TEST(Parser_NestedListDictionary) +{ + Group g; + auto persons = g.add_table_with_primary_key("table", type_String, "name"); + auto col = persons->add_column_list(type_Mixed, "properties"); + + Obj paul = persons->create_object_with_primary_key("Paul"); + auto list_paul = paul.get_list(col); + list_paul.insert_collection(0, CollectionType::Dictionary); + auto dict1 = list_paul.get_dictionary(0); + dict1->insert("one", 1); + dict1->insert("two", 2); + dict1->insert("three", 3); + + Obj john = persons->create_object_with_primary_key("John"); + auto list_john = john.get_list(col); + list_john.insert_collection(0, CollectionType::Dictionary); + auto dict2 = list_john.get_dictionary(0); + dict2->insert("two", 2); + dict2->insert("four", 4); + + verify_query(test_context, persons, "properties[0].one == 1", 1); + verify_query(test_context, persons, "properties[first].two == 2", 2); +} + +TEST(Parser_NestedMixedDictionaryList) +{ + Group g; + auto persons = g.add_table_with_primary_key("table", type_String, "name"); + // Be aware - this is not a dictionary property + auto col = persons->add_column(type_Mixed, "properties"); + auto col_self = persons->add_column(*persons, "self"); + + Obj paul = persons->create_object_with_primary_key("Paul"); + paul.set(col_self, paul.get_key()); + paul.set_collection(col, CollectionType::Dictionary); + auto dict_paul = paul.get_dictionary(col); + dict_paul.insert_collection("tickets", CollectionType::List); + auto list1 = dict_paul.get_list("tickets"); + list1->add(0); + list1->add(1); + list1->add(4); + + Obj john = persons->create_object_with_primary_key("John"); + john.set(col_self, john.get_key()); + john.set_collection(col, CollectionType::Dictionary); + auto dict_john = john.get_dictionary(col); + dict_john.insert_collection("tickets", CollectionType::List); + auto list2 = dict_john.get_list("tickets"); + list2->add(2); + list2->add(3); + list2->add(4); + + verify_query(test_context, persons, "properties.tickets[0] == 0", 1); + verify_query(test_context, persons, "properties.tickets[last] == 4", 2); + verify_query(test_context, persons, "self.properties.tickets[last] == 4", 2); +} + +TEST(Parser_NestedDictionaryDeep) +{ + Group g; + auto persons = g.add_table_with_primary_key("table", type_String, "name"); + auto col = persons->add_column(type_Mixed, "properties"); + auto col_self = persons->add_column(*persons, "self"); + + Obj paul = persons->create_object_with_primary_key("Paul"); + paul.set(col_self, paul.get_key()); + paul.set_collection(col, CollectionType::Dictionary); + auto dict1 = paul.get_dictionary(col); + dict1.insert("one", 1); + dict1.insert_collection("two", CollectionType::List); + dict1.insert_collection("three", CollectionType::List); + + auto list1 = dict1.get_list("two"); + list1->add(5); + list1->add(6); + + auto list2 = dict1.get_list("three"); + list2->add(5); + list2->insert_collection(1, CollectionType::Dictionary); + auto dict2 = list2->get_dictionary(1); + dict2->insert("Hello", 5); + bool thrown = false; + try { + for (int i = 0; i < 100; i++) { + dict2->insert_collection("deeper", CollectionType::Dictionary); + dict2 = dict2->get_dictionary("deeper"); + } + } + catch (const Exception& e) { + CHECK(e.code() == ErrorCodes::LimitExceeded); + thrown = true; + } + CHECK(thrown); + + /* + "properties": { + "one": 1, + "two": [ + 5, + 6 + ] + "three": [ + 5, + { + "Hello": 5 + } + ], + } + */ + + verify_query(test_context, persons, "self.properties == 1", 0); + verify_query(test_context, persons, "properties[0] == 1", 0); + verify_query(test_context, persons, "properties['one'] == 1", 1); + verify_query(test_context, persons, "properties.two[1].Hello == 5", 0); + verify_query(test_context, persons, "properties.three[0].Hello == 5", 0); + verify_query(test_context, persons, "properties.three[1].Hello == 5", 1); +} + +TEST(Parser_NestedDictionaryMultipleLinks) +{ + // Check that we will follow every link before descending down by path + Group g; + auto persons = g.add_table_with_primary_key("table", type_String, "name"); + auto col = persons->add_column(type_Mixed, "properties"); + auto col_friends = persons->add_column_list(*persons, "friends"); + + Obj paul = persons->create_object_with_primary_key("Paul"); + Obj john = persons->create_object_with_primary_key("John"); + Obj george = persons->create_object_with_primary_key("George"); + Obj ringo = persons->create_object_with_primary_key("Ringo"); + Obj eric = persons->create_object_with_primary_key("Eric"); + + paul.set_collection(col, CollectionType::Dictionary); + john.set_collection(col, CollectionType::Dictionary); + george.set_collection(col, CollectionType::Dictionary); + ringo.set_collection(col, CollectionType::Dictionary); + paul.get_dictionary(col).insert("plays", "bass"); + john.get_dictionary(col).insert("plays", "guitar"); + george.get_dictionary(col).insert("plays", "guitar"); + ringo.get_dictionary(col).insert("plays", "drums"); + + paul.get_linklist(col_friends).add(john.get_key()); + auto erics_friends = eric.get_linklist(col_friends); + erics_friends.add(paul.get_key()); + erics_friends.add(john.get_key()); + erics_friends.add(george.get_key()); + erics_friends.add(ringo.get_key()); + + verify_query(test_context, persons, "friends.properties.plays == 'bass'", 1); + verify_query(test_context, persons, "friends.properties.plays == 'guitar'", 2); +} + TEST_TYPES(Parser_DictionaryAggregates, Prop, Prop, Prop) { using type = typename TEST_TYPE::type; @@ -5216,6 +5405,8 @@ TEST_TYPES(Parser_Set, Prop, Prop, Prop, Prop 100", 1));