From 298f3896562eef5ada34e30d401b0c8e6525b2fd Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Mon, 22 Jun 2020 15:16:20 -0400 Subject: [PATCH 01/42] VDB-4293: added KNSManagerMakeTimedClientRequest, use it in CloudMgr to detect cloud location --- interfaces/kns/http.h | 4 ++++ libs/cloud/cloud-cmn.c | 5 +---- libs/kns/http-request.c | 28 ++++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/interfaces/kns/http.h b/interfaces/kns/http.h index 018842fad..79c3e21c9 100644 --- a/interfaces/kns/http.h +++ b/interfaces/kns/http.h @@ -220,6 +220,10 @@ KNS_EXTERN rc_t CC KClientHttpMakeRequest ( const KClientHttp *self, KNS_EXTERN rc_t CC KNSManagerMakeClientRequest ( struct KNSManager const *self, KClientHttpRequest **req, ver_t version, struct KStream *conn, const char *url, ... ); +KNS_EXTERN rc_t CC KNSManagerMakeTimedClientRequest ( + struct KNSManager const *self, KClientHttpRequest **req, ver_t version, + int32_t writeMsec, struct KStream *conn, const char *url, ... ); + /* AddRef * Release diff --git a/libs/cloud/cloud-cmn.c b/libs/cloud/cloud-cmn.c index c4eabfa78..195534d24 100644 --- a/libs/cloud/cloud-cmn.c +++ b/libs/cloud/cloud-cmn.c @@ -48,18 +48,16 @@ rc_t KNSManager_Read(const struct KNSManager *cself, char *buffer, size_t bsize, KClientHttpRequest *req = NULL; int32_t cmsec; - int32_t wmsec; assert(self); /* save existing timeouts */ cmsec = self->conn_timeout; - wmsec = self->http_write_timeout; /* minimize timeouts to check cloudy URLs */ self->conn_timeout = self->http_write_timeout = 500; - rc = KNSManagerMakeRequest(self, &req, 0x01010000, NULL, url); + rc = KNSManagerMakeTimedClientRequest(self, &req, 0x01010000, 500, NULL, url); if (rc == 0 && hdrName != NULL) rc = KClientHttpRequestAddHeader(req, hdrName, hdrValue); @@ -90,7 +88,6 @@ rc_t KNSManager_Read(const struct KNSManager *cself, char *buffer, size_t bsize, /* restore timeouts in KNSManager */ self->conn_timeout = cmsec; - self->http_write_timeout = wmsec; RELEASE(KClientHttpRequest, req); diff --git a/libs/kns/http-request.c b/libs/kns/http-request.c index 1cf261954..37f305c04 100644 --- a/libs/kns/http-request.c +++ b/libs/kns/http-request.c @@ -278,7 +278,8 @@ LIB_EXPORT rc_t CC KClientHttpMakeRequest ( const KClientHttp *self, */ static rc_t CC KNSManagerMakeClientRequestInt ( const KNSManager *self, - KClientHttpRequest **req, ver_t vers, KStream *conn, bool reliable, const char *url, va_list args ) + KClientHttpRequest **req, ver_t vers, int32_t writeMsec, KStream *conn, + bool reliable, const char *url, va_list args ) { rc_t rc; @@ -314,7 +315,9 @@ rc_t CC KNSManagerMakeClientRequestInt ( const KNSManager *self, KClientHttp * http; rc = KNSManagerMakeClientHttpInt ( self, & http, & buf, conn, vers, - self -> http_read_timeout, self -> http_write_timeout, & block . host, block . port, reliable, block . tls ); + self -> http_read_timeout, writeMsec, + & block . host, block . port, + reliable, block . tls ); if ( rc == 0 ) { rc = KClientHttpMakeRequestInt ( http, req, & block, & buf ); @@ -332,10 +335,12 @@ rc_t CC KNSManagerMakeClientRequestInt ( const KNSManager *self, LIB_EXPORT rc_t CC KNSManagerMakeClientRequest ( const KNSManager *self, KClientHttpRequest **req, ver_t vers, KStream *conn, const char *url, ... ) { + int32_t writeMsec = self == NULL ? 0 : self->http_write_timeout; rc_t rc; va_list args; va_start ( args, url ); - rc = KNSManagerMakeClientRequestInt ( self, req, vers, conn, false, url, args ); + rc = KNSManagerMakeClientRequestInt ( self, req, vers, writeMsec, conn, + false, url, args ); va_end ( args ); return rc; } @@ -343,14 +348,29 @@ LIB_EXPORT rc_t CC KNSManagerMakeClientRequest ( const KNSManager *self, LIB_EXPORT rc_t CC KNSManagerMakeReliableClientRequest ( const KNSManager *self, KClientHttpRequest **req, ver_t vers, KStream *conn, const char *url, ... ) { + int32_t writeMsec = self == NULL ? 0 : self->http_write_timeout; rc_t rc; va_list args; va_start ( args, url ); - rc = KNSManagerMakeClientRequestInt ( self, req, vers, conn, true, url, args ); + rc = KNSManagerMakeClientRequestInt ( self, req, vers, writeMsec, conn, + true, url, args ); va_end ( args ); return rc; } +LIB_EXPORT rc_t CC KNSManagerMakeTimedClientRequest(const KNSManager *self, + KClientHttpRequest **req, ver_t vers, int32_t writeMsec, KStream *conn, + const char *url, ...) +{ + rc_t rc; + va_list args; + va_start(args, url); + rc = KNSManagerMakeClientRequestInt(self, req, vers, writeMsec, conn, + true, url, args); + va_end(args); + return rc; +} + /* AddRef * Release From 7745955161ff02a130a2dbec022ff7cd3f8870ab Mon Sep 17 00:00:00 2001 From: aboshkin Date: Wed, 15 Nov 2023 16:15:36 -0500 Subject: [PATCH 02/42] VDB-5394 saving work --- interfaces/kdb/manager.h | 7 +- libs/CMakeLists.txt | 1 + libs/kdb/column-base.c | 2 +- libs/kdb/columnblob-base.c | 2 +- libs/kdb/database-base.c | 4 +- libs/kdb/index-base.c | 2 +- libs/kdb/manager-base.c | 2 +- libs/kdb/manager-base.h | 11 - libs/kdb/meta-base.c | 2 +- libs/kdb/metanode-base.c | 2 +- libs/kdb/table-base.c | 2 +- libs/kdb/wtable.c | 2 +- libs/kdbtext/CMakeLists.txt | 49 + libs/kdbtext/KDBTextScanner.hpp | 53 + libs/kdbtext/Makefile | 28 + libs/kdbtext/Token.hpp | 71 + libs/kdbtext/kdbtext-grammar.hpp | 4 + libs/kdbtext/kdbtext-grammar.y | 1121 ++++ libs/kdbtext/kdbtext-lex.h | 44 + libs/kdbtext/kdbtext-lex.l | 56 + libs/kdbtext/manager.cpp | 152 + libs/kdbtext/zz_kdbtext-grammar.cpp | 7228 ++++++++++++++++++++++++ libs/kdbtext/zz_kdbtext-grammar.hpp | 224 + libs/kdbtext/zz_kdbtext-grammar.output | 7134 +++++++++++++++++++++++ libs/kdbtext/zz_kdbtext-lex.c | 2356 ++++++++ test/CMakeLists.txt | 1 + test/kdbtext/CMakeLists.txt | 37 + test/kdbtext/Makefile | 30 + test/kdbtext/test-manager.cpp | 339 ++ test/kdbtext/wb-test-kdbtext-lex.cpp | 324 ++ 30 files changed, 19266 insertions(+), 24 deletions(-) create mode 100644 libs/kdbtext/CMakeLists.txt create mode 100644 libs/kdbtext/KDBTextScanner.hpp create mode 100644 libs/kdbtext/Makefile create mode 100644 libs/kdbtext/Token.hpp create mode 100644 libs/kdbtext/kdbtext-grammar.hpp create mode 100644 libs/kdbtext/kdbtext-grammar.y create mode 100644 libs/kdbtext/kdbtext-lex.h create mode 100644 libs/kdbtext/kdbtext-lex.l create mode 100644 libs/kdbtext/manager.cpp create mode 100644 libs/kdbtext/zz_kdbtext-grammar.cpp create mode 100644 libs/kdbtext/zz_kdbtext-grammar.hpp create mode 100644 libs/kdbtext/zz_kdbtext-grammar.output create mode 100644 libs/kdbtext/zz_kdbtext-lex.c create mode 100644 test/kdbtext/CMakeLists.txt create mode 100644 test/kdbtext/Makefile create mode 100644 test/kdbtext/test-manager.cpp create mode 100644 test/kdbtext/wb-test-kdbtext-lex.cpp diff --git a/interfaces/kdb/manager.h b/interfaces/kdb/manager.h index c924376d4..c9f356059 100644 --- a/interfaces/kdb/manager.h +++ b/interfaces/kdb/manager.h @@ -51,7 +51,7 @@ struct KDirectory; */ enum { - /* must be handled carefully and can not go back to KDirectory + /* must be handled carefully and can not go back to KDirectory * as this value has a different meaning in KDirectory */ kptAny = 0, kptDatabase = kptLastDefined, @@ -83,15 +83,16 @@ KDB_EXTERN rc_t CC KDBManagerRelease ( const KDBManager *self ); /* MakeRead * MakeUpdate + * MakeText (reads data from a character string) + * * create library handle for specific use - * NB - only one of the functions will be implemented * * "wd" [ IN, NULL OKAY ] - optional working directory for * accessing the file system. mgr will attach its own reference. */ KDB_EXTERN rc_t CC KDBManagerMakeRead ( const KDBManager **mgr, struct KDirectory const *wd ); KDB_EXTERN rc_t CC KDBManagerMakeUpdate ( KDBManager **mgr, struct KDirectory *wd ); - +KDB_EXTERN rc_t CC KDBManagerMakeText ( const KDBManager **mgr, const char * data ); /* Version * returns the library version diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index a5acba545..f3af4e5a1 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -33,6 +33,7 @@ add_subdirectory(cloud) add_subdirectory(ext) add_subdirectory(kapp) add_subdirectory(kdb) +add_subdirectory(kdbtext) add_subdirectory(kfc) add_subdirectory(kfg) add_subdirectory(kfs) diff --git a/libs/kdb/column-base.c b/libs/kdb/column-base.c index 1998f2c52..9f513a865 100644 --- a/libs/kdb/column-base.c +++ b/libs/kdb/column-base.c @@ -105,7 +105,7 @@ rc_t KColumnSever ( const KColumn *self ) if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ else \ - return RC ( rcVDB, rcColumn, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull ); #define DISPATCH_BOOL(call) \ if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ diff --git a/libs/kdb/columnblob-base.c b/libs/kdb/columnblob-base.c index 81f8d6871..12d4e9f0a 100644 --- a/libs/kdb/columnblob-base.c +++ b/libs/kdb/columnblob-base.c @@ -71,7 +71,7 @@ rc_t CC KColumnBlobBaseRelease ( const KColumnBlob *cself ) if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ else \ - return RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcCursor, rcAccessing, rcSelf, rcNull ); LIB_EXPORT rc_t CC KColumnBlobAddRef ( const KColumnBlob *self ) { diff --git a/libs/kdb/database-base.c b/libs/kdb/database-base.c index 4373bd49b..cb6702eb3 100644 --- a/libs/kdb/database-base.c +++ b/libs/kdb/database-base.c @@ -108,7 +108,7 @@ rc_t KDatabaseSever ( const KDatabase *self ) if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ else \ - return RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull ); #define DISPATCH_BOOL(call) \ if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ @@ -202,7 +202,7 @@ LIB_EXPORT rc_t CC KDatabaseOpenTableRead ( const KDatabase *self, const struct KTable **tbl, const char *name, ... ) { if ( self == NULL && self -> vt == NULL ) - return RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull ); rc_t rc; va_list args; diff --git a/libs/kdb/index-base.c b/libs/kdb/index-base.c index ce995bd58..3b1f89f13 100644 --- a/libs/kdb/index-base.c +++ b/libs/kdb/index-base.c @@ -72,7 +72,7 @@ rc_t CC KIndexBaseRelease ( const KIndex *self ) if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ else \ - return RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull ); #define DISPATCH_BOOL(call) \ if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ diff --git a/libs/kdb/manager-base.c b/libs/kdb/manager-base.c index 1184af740..c0a6bfc7d 100644 --- a/libs/kdb/manager-base.c +++ b/libs/kdb/manager-base.c @@ -109,7 +109,7 @@ rc_t KDBManagerSever ( const KDBManager *self ) if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ else \ - return RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull ); #define DISPATCH_BOOL(call) \ if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ diff --git a/libs/kdb/manager-base.h b/libs/kdb/manager-base.h index 67f4f5575..99023aee7 100644 --- a/libs/kdb/manager-base.h +++ b/libs/kdb/manager-base.h @@ -76,17 +76,6 @@ struct KDBManager_vt rc_t ( CC * vPathOpenRemoteDBRead ) ( struct KDBMGR_IMPL const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ); }; -// Public write side-only API - -// KDB_EXTERN rc_t CC KDBManagerLock ( KDBManager *self, const char *path, ... ); -// KDB_EXTERN rc_t CC KDBManagerVLock ( KDBManager *self, const char *path, va_list args ); - -// KDB_EXTERN rc_t CC KDBManagerUnlock ( KDBManager *self, const char *path, ... ); -// KDB_EXTERN rc_t CC KDBManagerVUnlock ( KDBManager *self, const char *path, va_list args ); - -// KDB_EXTERN rc_t CC KDBManagerDrop ( KDBManager *self, uint32_t obj_type, const char *path, ... ); -// KDB_EXTERN rc_t CC KDBManagerVDrop ( KDBManager *self, uint32_t obj_type, const char *path, va_list args ); - struct KDBManagerBase { KDBManager_vt * vt; diff --git a/libs/kdb/meta-base.c b/libs/kdb/meta-base.c index a1fe88f7c..68056a255 100644 --- a/libs/kdb/meta-base.c +++ b/libs/kdb/meta-base.c @@ -104,7 +104,7 @@ rc_t KMetadataSever ( const KMetadata *self ) if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ else \ - return RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull ); #define DISPATCH_BOOL(call) \ if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ diff --git a/libs/kdb/metanode-base.c b/libs/kdb/metanode-base.c index 4d4738fe8..6d90f0f28 100644 --- a/libs/kdb/metanode-base.c +++ b/libs/kdb/metanode-base.c @@ -93,7 +93,7 @@ rc_t KMDataNodeSever ( const KMDataNode *self ) if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ else \ - return RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull ); #define DISPATCH_BOOL(call) \ if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ diff --git a/libs/kdb/table-base.c b/libs/kdb/table-base.c index a7e65be87..af655768f 100644 --- a/libs/kdb/table-base.c +++ b/libs/kdb/table-base.c @@ -105,7 +105,7 @@ rc_t KTableSever ( const KTable *self ) if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ else \ - return RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull ); + return RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull ); #define DISPATCH_BOOL(call) \ if ( self != NULL && self -> vt != NULL ) \ return self -> vt -> call; \ diff --git a/libs/kdb/wtable.c b/libs/kdb/wtable.c index c27eeb1ff..cfe6cda14 100644 --- a/libs/kdb/wtable.c +++ b/libs/kdb/wtable.c @@ -699,7 +699,7 @@ LIB_EXPORT rc_t CC KTableOpenParentUpdate ( KTable *bself, KDatabase **db ) if ( self == NULL ) rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull ); else if ( self -> db != NULL && self -> db -> read_only ) - rc = RC ( rcVDB, rcTable, rcAccessing, rcDatabase, rcReadonly ); + rc = RC ( rcDB, rcTable, rcAccessing, rcDatabase, rcReadonly ); else { rc = KDatabaseAddRef ( self -> db ); diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt new file mode 100644 index 000000000..5eec2eec9 --- /dev/null +++ b/libs/kdbtext/CMakeLists.txt @@ -0,0 +1,49 @@ +# =========================================================================== +# +# PUBLIC DOMAIN NOTICE +# National Center for Biotechnology Information +# +# This software/database is a "United States Government Work" under the +# terms of the United States Copyright Act. It was written as part of +# the author's official duties as a United States Government employee and +# thus cannot be copyrighted. This software/database is freely available +# to the public for use. The National Library of Medicine and the U.S. +# Government have not placed any restriction on its use or reproduction. +# +# Although all reasonable efforts have been taken to ensure the accuracy +# and reliability of the software and data, the NLM and the U.S. +# Government do not and cannot warrant the performance or results that +# may be obtained by using this software or data. The NLM and the U.S. +# Government disclaim all warranties, express or implied, including +# warranties of performance, merchantability or fitness for any particular +# purpose. +# +# Please cite the author in any work or product based on this material. +# +# =========================================================================== + +if( FLEX_FOUND AND BISON_FOUND ) + FLEX_TARGET( KDBTextFlex kdbtext-lex.l ${CMAKE_CURRENT_SOURCE_DIR}/zz_kdbtext-lex.c + COMPILE_FLAGS "--debug --noline" ) + set( KDBTextScanner ${FLEX_KDBTextFlex_OUTPUTS} ) + BISON_TARGET( KDBTextGrammar kdbtext-grammar.y ${CMAKE_CURRENT_SOURCE_DIR}/zz_kdbtext-grammar.cpp + COMPILE_FLAGS "-Wno-other --no-lines -r state -v" + DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zz_kdbtext-grammar.hpp + ) + set( KDBTextParser ${BISON_KDBTextGrammar_OUTPUT_SOURCE} ) + ADD_FLEX_BISON_DEPENDENCY(KDBTextFlex KDBTextGrammar) + SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM 1) +else() + set( KDBTextScanner zz_kdbtext-lex.c ) + set( KDBTextParser zz_kdbtext-grammar.cpp ) +endif() + +set( KDBTEXT_SRC + manager.cpp + ${KDBTextScanner} +# ${KDBTextParser} +) + +GenerateStaticLibs( kdbtext "${KDBTEXT_SRC}" ) + +add_compile_definitions (__mod__="libs/kdbtext") \ No newline at end of file diff --git a/libs/kdbtext/KDBTextScanner.hpp b/libs/kdbtext/KDBTextScanner.hpp new file mode 100644 index 000000000..c17319deb --- /dev/null +++ b/libs/kdbtext/KDBTextScanner.hpp @@ -0,0 +1,53 @@ +/*=========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + */ + +#pragme once + +#include "Token.hpp" + +namespace ncbi +{ + namespace KDBTextParser + { + class Scanner + { + public: + Scanner ( const char * source, bool p_debug = false ); // NUL-terminated + Scanner ( const char * source, size_t p_size, bool p_debug ); + ~Scanner (); + + :: KDBTextScanBlock & GetScanBlock () { return m_scanBlock; } + + public: /* this is for testing only; bison-generated parser calls KDBTextScan_yylex directly */ + Token NextToken (); + + private: + void Init ( const char * p_source, size_t p_size, bool p_debug ); + + :: KDBTextScanBlock m_scanBlock; + }; + } +} diff --git a/libs/kdbtext/Makefile b/libs/kdbtext/Makefile new file mode 100644 index 000000000..d2e2e1cba --- /dev/null +++ b/libs/kdbtext/Makefile @@ -0,0 +1,28 @@ +# =========================================================================== +# +# PUBLIC DOMAIN NOTICE +# National Center for Biotechnology Information +# +# This software/database is a "United States Government Work" under the +# terms of the United States Copyright Act. It was written as part of +# the author's official duties as a United States Government employee and +# thus cannot be copyrighted. This software/database is freely available +# to the public for use. The National Library of Medicine and the U.S. +# Government have not placed any restriction on its use or reproduction. +# +# Although all reasonable efforts have been taken to ensure the accuracy +# and reliability of the software and data, the NLM and the U.S. +# Government do not and cannot warrant the performance or results that +# may be obtained by using this software or data. The NLM and the U.S. +# Government disclaim all warranties, express or implied, including +# warranties of performance, merchantability or fitness for any particular +# purpose. +# +# Please cite the author in any work or product based on this material. +# +# =========================================================================== + +TOP ?= $(abspath ../..) +MODULE = libs/kdbtext + +include $(TOP)/build/Makefile.env diff --git a/libs/kdbtext/Token.hpp b/libs/kdbtext/Token.hpp new file mode 100644 index 000000000..fa1aa5670 --- /dev/null +++ b/libs/kdbtext/Token.hpp @@ -0,0 +1,71 @@ +/*=========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + */ + +#pragma once + +#include "kdbtext-lex.h" + +namespace ncbi +{ + namespace KDBTextParser + { + class Token + { + public: + typedef int TokenType; + static const TokenType EndSource = 0; // bison convention + + struct Location + { + const char * m_file; // empty string if not known + uint32_t m_line; // 1 - based + uint32_t m_column; // 1 - based + + Location ( const char * p_file, uint32_t p_line, uint32_t p_column ); + }; + + public: + Token ( const SchemaToken & st ); // takes ownership of st.leading_ws + Token ( TokenType, const char * value = 0 ); + Token ( TokenType, const char * value, const Location & loc ); + Token ( const Token & ); + ~Token (); + + TokenType GetType () const { return m_type; } + const char * GetValue () const { return m_value == 0 ? "" : m_value; } + const Location & GetLocation () const { return m_location; } + const char * GetLeadingWhitespace () const { return m_ws == 0 ? "" : m_ws; } + + private: + TokenType m_type; + char * m_value; + Location m_location; + char * m_ws; + }; + } +} + +#endif diff --git a/libs/kdbtext/kdbtext-grammar.hpp b/libs/kdbtext/kdbtext-grammar.hpp new file mode 100644 index 000000000..790851c4e --- /dev/null +++ b/libs/kdbtext/kdbtext-grammar.hpp @@ -0,0 +1,4 @@ +// The Flex- and Bison-generated files are named this way (zz_*) to hit the disk last on checkout, +// thus making sure the generated files' timestamps are not older than the corresponding sources'. +// This avoids triggering unnecessary re-runs of flex/bison. +#include "zz_kdbtext-grammar.hpp" diff --git a/libs/kdbtext/kdbtext-grammar.y b/libs/kdbtext/kdbtext-grammar.y new file mode 100644 index 000000000..6853708b8 --- /dev/null +++ b/libs/kdbtext/kdbtext-grammar.y @@ -0,0 +1,1121 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +%{ + #define YYDEBUG 1 + + #include + +// #include "ParseTree.hpp" +// #include "ErrorReport.hpp" + + using namespace ncbi::KDBTextParser; + + #include "kdbtext-grammar.hpp" + #include "kdbtext-lex.h" + #define KDBText_lex KDBTextScan_yylex + + void KDBText_error ( YYLTYPE * p_llocp, + ctx_t ctx, + ParseTree ** p_root, + ErrorReport * p_errors, + struct KDBTextScanBlock * p_sb, + const char * p_msg ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); + /* send message to the C++ parser for proper display and recovery */ + Token :: Location loc ( p_sb -> file_name, p_llocp -> first_line, p_llocp -> first_column ); + p_errors -> ReportError ( ctx, loc, "%s", p_msg); + } + + extern "C" + { + extern enum KDBText_tokentype KDBTextScan_yylex ( SCHEMA_STYPE *lvalp, SCHEMA_LTYPE *llocp, KDBTextScanBlock* sb ); + } + + static + ParseTree* + P ( KDBTextToken & p_prod ) + { + assert ( p_prod . subtree ); + return ( ParseTree * ) p_prod . subtree; + } + + static + ParseTree* + T ( ctx_t ctx, KDBTextToken & p_term ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing );//TODO: catch + assert ( p_term . subtree == 0 ); + return ParseTree::Make ( ctx, p_term ); + } + + /* Create production node */ + static + ParseTree * + MakeTree ( ctx_t ctx, + int p_token, + ParseTree * p_ch1 = 0, + ParseTree * p_ch2 = 0, + ParseTree * p_ch3 = 0, + ParseTree * p_ch4 = 0, + ParseTree * p_ch5 = 0, + ParseTree * p_ch6 = 0, + ParseTree * p_ch7 = 0, + ParseTree * p_ch8 = 0, + ParseTree * p_ch9 = 0 + ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); + ParseTree * ret = ParseTree :: Make ( ctx, Token ( p_token ) ); + if ( p_ch1 != 0 ) ret -> AddChild ( ctx, p_ch1 ); + if ( p_ch2 != 0 ) ret -> AddChild ( ctx, p_ch2 ); + if ( p_ch3 != 0 ) ret -> AddChild ( ctx, p_ch3 ); + if ( p_ch4 != 0 ) ret -> AddChild ( ctx, p_ch4 ); + if ( p_ch5 != 0 ) ret -> AddChild ( ctx, p_ch5 ); + if ( p_ch6 != 0 ) ret -> AddChild ( ctx, p_ch6 ); + if ( p_ch7 != 0 ) ret -> AddChild ( ctx, p_ch7 ); + if ( p_ch8 != 0 ) ret -> AddChild ( ctx, p_ch8 ); + if ( p_ch9 != 0 ) ret -> AddChild ( ctx, p_ch9 ); + return ret; + } + + /* Create a flat list */ + static + ParseTree * + MakeList ( ctx_t ctx, KDBTextToken & p_prod ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); + ParseTree * ret = ParseTree :: Make ( ctx, Token ( PT_ASTLIST ) ); + ret -> AddChild ( ctx, P ( p_prod ) ); + return ret; + } + + /* Add to a flat list node */ + static + ParseTree * + AddToList ( ctx_t ctx, ParseTree * p_root, ParseTree * p_br1, ParseTree * p_br2 = 0 ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); + assert ( p_br1 != 0 ); + p_root -> AddChild ( ctx, p_br1 ); + if ( p_br2 != 0 ) + { + p_root -> AddChild ( ctx, p_br2 ); + } + return p_root; + } + +%} + +%define api.prefix "KDBText_" + /*%name-prefix "KDBText_"*/ +%parse-param { ctx_t ctx } +%parse-param { ParseTree** root } +%parse-param { ErrorReport * errors } +%param { struct KDBTextScanBlock* sb } + +%define api.value.type {KDBTextToken} + +%define parse.error verbose +%locations + +%define api.pure full +%destructor { + if ( $$ . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( $$ . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( $$ . leading_ws ); + } +} <> + + /* !!! Keep token declarations in synch with kdbtext-ast.y */ + +%token END_SOURCE 0 "end of source" + +%token UNRECOGNIZED + +%token ELLIPSIS +%token INCREMENT + +%token DECIMAL +%token OCTAL +%token HEX +%token FLOAT_ +%token EXP_FLOAT +%token STRING +%token ESCAPED_STRING + +%token IDENTIFIER_1_0 +%token PHYSICAL_IDENTIFIER_1_0 +%token VERSION + +/* unterminated strings are dealt with by flex */ +%token UNTERM_STRING +%token UNTERM_ESCAPED_STRING + +/* version numbers recognized under special flex state */ +%token VERS_1_0 +%token VERS_2_0 + +%token KW___no_header +%token KW___row_length +%token KW___untyped +%token KW_alias +%token KW_column +%token KW_const +%token KW_control +%token KW_database +%token KW_decode +%token KW_default +%token KW_encode +%token KW_extern +%token KW_false +%token KW_fmtdef +%token KW_function +%token KW_include +%token KW_limit +%token KW_physical +%token KW_read +%token KW_readonly +%token KW_return +%token KW_kdbtext +%token KW_static +%token KW_table +%token KW_template +%token KW_trigger +%token KW_true +%token KW_type +%token KW_typedef +%token KW_typeset +%token KW_validate +%token KW_version +%token KW_view +%token KW_virtual +%token KW_void +%token KW_write + + /* Parse tree nodes */ +%token PT_ASTLIST +%token PT_PARSE +%token PT_SOURCE +%token PT_VERSION_1_0 +%token PT_VERSION_2 +%token PT_SCHEMA_1_0 +%token PT_SCHEMA_2_0 +%token PT_INCLUDE +%token PT_TYPEDEF +%token PT_FQN +%token PT_IDENT +%token PT_PHYSIDENT +%token PT_UINT +%token PT_TYPESET +%token PT_TYPESETDEF +%token PT_FORMAT +%token PT_CONST +%token PT_ALIAS +%token PT_EXTERN +%token PT_FUNCTION +%token PT_UNTYPED +%token PT_ROWLENGTH +%token PT_FUNCDECL +%token PT_EMPTY +%token PT_SCHEMASIG +%token PT_SCHEMAFORMAL +%token PT_RETURNTYPE +%token PT_FACTSIG +%token PT_FUNCSIG +%token PT_FUNCPARAMS +%token PT_FORMALPARAM +%token PT_ELLIPSIS +%token PT_FUNCPROLOGUE +%token PT_RETURN +%token PT_PRODSTMT +%token PT_PRODTRIGGER +%token PT_SCHEMA +%token PT_VALIDATE +%token PT_PHYSICAL +%token PT_PHYSPROLOGUE +%token PT_PHYSSTMT +%token PT_PHYSBODYSTMT +%token PT_TABLE +%token PT_TABLEPARENTS +%token PT_TABLEBODY +%token PT_FUNCEXPR +%token PT_FACTPARMS +%token PT_COLUMN +%token PT_COLUMNEXPR +%token PT_COLDECL +%token PT_TYPEDCOL +%token PT_COLSTMT +%token PT_DFLTVIEW +%token PT_PHYSMBR +%token PT_PHYSCOL +%token PT_PHYSCOLDEF +%token PT_COLSCHEMAPARMS +%token PT_COLSCHEMAPARAM +%token PT_COLUNTYPED +%token PT_DATABASE +%token PT_TYPEEXPR +%token PT_DBBODY +%token PT_DBDAD +%token PT_DBMEMBER +%token PT_TBLMEMBER +%token PT_NOHEADER +%token PT_CASTEXPR +%token PT_CONSTVECT +%token PT_NEGATE +%token PT_UNARYPLUS +%token PT_VERSNAME +%token PT_ARRAY +%token PT_PHYSENCREF +%token PT_TYPEDCOLEXPR +%token PT_VIEW +%token PT_VIEWPARAM +%token PT_VIEWPARENTS +%token PT_VIEWPARENT +%token PT_MEMBEREXPR +%token PT_JOINEXPR +%token PT_ALIASMEMBER +%token PT_VIEWSPEC + + /* !!! Keep token declarations above in synch with kdbtext-ast.y */ + + +%start parse + +%% + +parse + : END_SOURCE { *root = MakeTree ( ctx, PT_PARSE, T ( ctx, $1 ) ); $$ . subtree = 0; $$ . leading_ws = 0; } + | source END_SOURCE { *root = MakeTree ( ctx, PT_PARSE, P ( $1 ), T ( ctx, $2 ) ); $$ . subtree = 0; $$ . leading_ws = 0; } + ; + +source + : kdbtext_1_0 { $$ . subtree = MakeTree ( ctx, PT_SOURCE, P ( $1 ) ); } + | version_1_0 kdbtext_1_0_opt { $$ . subtree = MakeTree ( ctx, PT_SOURCE, P ( $1 ), P ( $2 ) ); } + | version_2_0 kdbtext_2_0_opt { $$ . subtree = MakeTree ( ctx, PT_SOURCE, P ( $1 ), P ( $2 ) ); } + ; + +/* kdbtext-1.0 + */ +version_1_0 + : KW_version VERS_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_VERSION_1_0, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ) ); } + ; + +kdbtext_1_0_opt + : kdbtext_1_0 { $$ . subtree = P ( $1 ); } + | empty { $$ = $1; } + ; + +kdbtext_1_0 + : kdbtext_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_SCHEMA_1_0, P ( $1 ) ); } + | kdbtext_1_0 kdbtext_1_0_decl { $$ . subtree = AddToList ( ctx, P ( $1 ) , P ( $2 ) ); } + ; + +kdbtext_1_0_decl + : typedef_1_0_decl { $$ = $1; } + | typeset_1_0_decl { $$ = $1; } + | format_1_0_decl { $$ = $1; } + | const_1_0_decl { $$ = $1; } + | alias_1_0_decl { $$ = $1; } + | function_1_0_decl { $$ = $1; } + | extern_1_0_decl { $$ = $1; } + | script_1_0_decl { $$ = $1; } + | validate_1_0_decl { $$ = $1; } + | physical_1_0_decl { $$ = $1; } + | table_1_0_decl { $$ = $1; } + | database_1_0_decl { $$ = $1; } + | include_directive { $$ = $1; } + | ';' { $$ . subtree = T ( ctx, $1 ); } /* for lots of reasons, we tolerate stray semicolons */ + ; + +/* typedef-1.0 + */ +typedef_1_0_decl + : KW_typedef + fqn_1_0 /* must be from 'typedef' or kdbtext template */ + typedef_1_0_new_name_list + ';' + { $$ . subtree = MakeTree ( ctx, PT_TYPEDEF, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } + ; + +typedef_1_0_new_name_list + : typespec_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | typedef_1_0_new_name_list ',' typespec_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +/* typeset-1.0 + */ +typeset_1_0_decl + : KW_typeset typeset_1_0_new_name typeset_1_0_def ';' + { $$ . subtree = MakeTree ( ctx, PT_TYPESET, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } + ; + +typeset_1_0_new_name + : fqn_1_0 { $$ = $1; } /* we allow duplicate redefinition here... */ + ; + +typeset_1_0_def + : '{' typespec_1_0_list '}' /* ...obviously, the set contents must match */ + { $$ . subtree = MakeTree ( ctx, PT_TYPESETDEF, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +/* typespec-1.0 + */ +typespec_1_0_list + : typespec_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | typespec_1_0_list ',' typespec_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +typespec_1_0 + : fqn_1_0 { $$ = $1; } + | fqn_1_0 '[' dim_1_0 ']' { $$ . subtree = MakeTree ( ctx, PT_ARRAY, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + ; + +dim_1_0 + : expression_1_0 { $$ = $1; } /* expects unsigned integer constant expression */ + | '*' { $$ . subtree = T ( ctx, $1 ); } + ; + +/* format-1.0 + */ +format_1_0_decl + : KW_fmtdef format_1_0_new_name ';' + { $$ . subtree = MakeTree ( ctx, PT_FORMAT, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + | KW_fmtdef format_1_0_name format_1_0_new_name ';' /* creates a derived format */ + { $$ . subtree = MakeTree ( ctx, PT_FORMAT, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } + ; + +format_1_0_new_name + : fqn_1_0 { $$ = $1; } /* allow for redefinition - current code seems to be wrong */ + ; + +format_1_0_name + : fqn_1_0 { $$ = $1; } /* must name a format */ + ; + + +/* const-1.0 + */ +const_1_0_decl + : KW_const typespec_1_0 fqn_1_0 '=' expression_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_CONST, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ), P ( $5 ), T ( ctx, $6 ) ); } + ; + +/* alias-1.0 + */ +alias_1_0_decl + : KW_alias fqn_1_0 alias_1_0_new_name ';' + { $$ . subtree = MakeTree ( ctx, PT_ALIAS, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } + ; + +alias_1_0_new_name + : fqn_1_0 { $$ = $1; } /* for some reason, does not allow duplicate redefinition */ + ; + +/* function-1.0 + */ +function_1_0_decl + : KW_function func_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_FUNCTION, T ( ctx, $1 ), P ( $2 ) ); } + ; + +func_1_0_decl + : untyped_func_1_0_decl { $$ = $1; } /* cannot be inline or a validation function */ + | row_length_func_1_0_decl { $$ = $1; } /* cannot be inline or a validation function */ + | opt_func_1_0_kdbtext_sig + func_1_0_return_type + fqn_opt_vers + opt_func_1_0_fact_sig + func_1_0_param_sig + func_1_0_prologue + { $$ . subtree = MakeTree ( ctx, PT_FUNCDECL, P ( $1 ), P ( $2 ), P ( $3 ), P ( $4 ), P ( $5 ), P ( $6 ) ); } + ; + +untyped_func_1_0_decl + : KW___untyped fqn_1_0 '(' ')' + { $$ . subtree = MakeTree ( ctx, PT_UNTYPED, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), T ( ctx, $4 ) ); } + ; + +row_length_func_1_0_decl + : KW___row_length fqn_1_0 '(' ')' + { $$ . subtree = MakeTree ( ctx, PT_ROWLENGTH, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), T ( ctx, $4 ) ); } + ; + +opt_func_1_0_kdbtext_sig + : empty { $$ = $1; } + | func_1_0_kdbtext_sig { $$ = $1; } + ; + +func_1_0_kdbtext_sig + : '<' func_1_0_kdbtext_formals '>' { $$ . subtree = MakeTree ( ctx, PT_SCHEMASIG, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +func_1_0_kdbtext_formals + : func_1_0_kdbtext_formal { $$ . subtree = MakeList ( ctx, $1 ); } + | func_1_0_kdbtext_formals ',' func_1_0_kdbtext_formal { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +func_1_0_kdbtext_formal + : KW_type ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_SCHEMAFORMAL, T ( ctx, $1 ), P ( $2 ) ); } + | type_expr_1_0 ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_SCHEMAFORMAL, P ( $1 ), P ( $2 ) ); } /* type-expr must be uint */ + ; + +func_1_0_return_type + : KW_void { $$ . subtree = MakeTree ( ctx, PT_RETURNTYPE, T ( ctx, $1 ) ); } + | type_expr_1_0 { $$ . subtree = MakeTree ( ctx, PT_RETURNTYPE, P ( $1 ) ); } + ; + +opt_func_1_0_fact_sig + : empty { $$ = $1; } + | func_1_0_fact_sig { $$ = $1; } + ; + +func_1_0_fact_sig + : '<' func_1_0_fact_signature '>' { $$ . subtree = MakeTree ( ctx, PT_FACTSIG, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +func_1_0_fact_signature + : empty { $$ = $1; } + | func_1_0_fact_params func_1_0_vararg_formals + { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), P ( $2 ) ); } + | '*' func_1_0_fact_params func_1_0_vararg_formals + { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, T ( ctx, $1 ), P ( $2 ), P ( $3 ) ); } + | func_1_0_fact_params '*' func_1_0_fact_params func_1_0_vararg_formals + { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), T ( ctx, $2 ), P ( $3 ), P ( $4 ) ); } + | func_1_0_fact_params ',' '*' func_1_0_fact_params func_1_0_vararg_formals + { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), T ( ctx, $2 ), T ( ctx, $3 ), P ( $4 ), P ( $5 ) ); } + ; + +func_1_0_fact_params + : fact_param_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | func_1_0_fact_params ',' fact_param_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +fact_param_1_0 + : typespec_1_0 IDENTIFIER_1_0 { $$ . subtree = MakeTree ( ctx, PT_FORMALPARAM, P ( $1 ), T ( ctx, $2 ) ); } + ; + +func_1_0_param_sig + : '(' func_1_0_param_signature ')' { $$ . subtree = MakeTree ( ctx, PT_FUNCSIG, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +func_1_0_param_signature + : empty { $$ = $1; } + | func_1_0_formal_params func_1_0_vararg_formals + { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), P ( $2 ) ); } + | '*' func_1_0_formal_params func_1_0_vararg_formals + { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, T ( ctx, $1 ), P ( $2 ), P ( $3 ) ); } + | func_1_0_formal_params '*' func_1_0_formal_params func_1_0_vararg_formals + { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), T ( ctx, $2 ), P ( $3 ), P ( $4 ) ); } + | func_1_0_formal_params ',' '*' func_1_0_formal_params func_1_0_vararg_formals + { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), T ( ctx, $2 ), T ( ctx, $3 ), P ( $4 ), P ( $5 ) ); } + ; + +func_1_0_formal_params + : formal_param_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | func_1_0_formal_params ',' formal_param_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +formal_param_1_0 + : typespec_1_0 IDENTIFIER_1_0 { $$ . subtree = MakeTree ( ctx, PT_FORMALPARAM, P ( $1 ), T ( ctx, $2 ) ); } + | KW_control typespec_1_0 IDENTIFIER_1_0 + { $$ . subtree = MakeTree ( ctx, PT_FORMALPARAM, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +func_1_0_vararg_formals + : empty { $$ = $1; } + | ',' ELLIPSIS { $$ . subtree = MakeTree ( ctx, PT_ELLIPSIS, T ( ctx, $1 ), T ( ctx, $2 ) ); } + ; + +func_1_0_prologue + : ';' /* this is a simple external function declaration */ + { $$ . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, $1 ) ); } + | '=' fqn_1_0 ';' /* rename the function declaration with fqn */ + { $$ . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + | '{' script_1_0_stmt_seq '}' /* this is a "script" function - cannot be extern! */ + { $$ . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +script_1_0_stmt_seq + : script_1_0_stmt { $$ . subtree = MakeList ( ctx, $1 ); } + | script_1_0_stmt_seq script_1_0_stmt { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } + ; + +script_1_0_stmt + : KW_return cond_expr_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_RETURN, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + | type_expr_1_0 ident_1_0 '=' cond_expr_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } + ; + +/* extern-1.0 + */ +extern_1_0_decl + : KW_extern ext_func_1_0_decl /* supposed to be an extern C function */ + { $$ . subtree = MakeTree ( ctx, PT_EXTERN, T ( ctx, $1 ), P ( $2 ) ); } + ; + +ext_func_1_0_decl + : function_1_0_decl { $$ = $1; } /* there are restrictions and potentially additions */ + ; + +/* script + */ + +script_1_0_decl + : KW_kdbtext func_1_0_decl /* MUST have a function body */ + { $$ . subtree = MakeTree ( ctx, PT_SCHEMA, T ( ctx, $1 ), P ( $2 ) ); } + | KW_kdbtext KW_function func_1_0_decl /* "function" keyword is optional */ + { $$ . subtree = MakeTree ( ctx, PT_SCHEMA, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +/* validate + */ + +validate_1_0_decl + : KW_validate function_1_0_decl /* has exactly 2 parameters and is not inline */ + { $$ . subtree = MakeTree ( ctx, PT_VALIDATE, T ( ctx, $1 ), P ( $2 ) ); } + ; + +/* physical encoding + */ +physical_1_0_decl + : KW_physical + opt_func_1_0_kdbtext_sig + phys_1_0_return_type + fqn_vers + opt_func_1_0_fact_sig + phys_1_0_prologue + { $$ . subtree = MakeTree ( ctx, PT_PHYSICAL, T ( ctx, $1 ), P ( $2 ), P ( $3 ), P ( $4 ), P ( $5 ), P ( $6 ) ); } + ; + +phys_1_0_return_type + : func_1_0_return_type { $$ = $1; } + | KW___no_header func_1_0_return_type { $$ . subtree = MakeTree ( ctx, PT_NOHEADER, T ( ctx, $1 ), P ( $2 ) ); } /* not supported with kdbtext signature */ + ; + +phys_1_0_prologue + : '=' phys_1_0_stmt /* shorthand for decode-only rules */ + { $$ . subtree = MakeTree ( ctx, PT_PHYSPROLOGUE, T ( ctx, $1 ), P ( $2 ) ); } + | '{' phys_1_0_body '}' + { $$ . subtree = MakeTree ( ctx, PT_PHYSPROLOGUE, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +phys_1_0_body + : phys_1_0_body_stmt { $$ . subtree = MakeList ( ctx, $1 ); } + | phys_1_0_body phys_1_0_body_stmt { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } + ; + +phys_1_0_body_stmt + : ';' + { $$ . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, $1 ) ); } + | KW_decode phys_1_0_stmt + { $$ . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, $1 ), P ( $2 ) ); } + | KW_encode phys_1_0_stmt + { $$ . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, $1 ), P ( $2 ) ); } + | KW___row_length '=' fqn_1_0 '(' ')' + { $$ . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ), T ( ctx, $5 ) ); } + ; + +phys_1_0_stmt + : '{' script_1_0_stmt_seq '}' /* with caveat that magic parameter "@" is defined */ + { $$ . subtree = MakeTree ( ctx, PT_PHYSSTMT, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +/* table + */ +table_1_0_decl + : KW_table + fqn_vers + opt_tbl_1_0_parents + tbl_1_0_body + { $$ . subtree = MakeTree ( ctx, PT_TABLE, T ( ctx, $1 ), P ( $2 ), P ( $3 ), P ( $4 ) ); } + ; + +opt_tbl_1_0_parents + : empty { $$ = $1; } + | '=' tbl_1_0_parents { $$ . subtree = MakeTree ( ctx, PT_TABLEPARENTS, T ( ctx, $1 ), P ( $2 ) ); } + ; + +tbl_1_0_parents + : fqn_opt_vers { $$ . subtree = MakeList ( ctx, $1 ); } + | tbl_1_0_parents ',' fqn_opt_vers { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +tbl_1_0_body + : '{' tbl_1_0_stmt_seq '}' + { $$ . subtree = MakeTree ( ctx, PT_TABLEBODY, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + | '{' '}' + { $$ . subtree = MakeTree ( ctx, PT_TABLEBODY, T ( ctx, $1 ), T ( ctx, $2 ) ); } + ; + +tbl_1_0_stmt_seq + : tbl_1_0_stmt { $$ . subtree = MakeList ( ctx, $1 ); } + | tbl_1_0_stmt_seq tbl_1_0_stmt { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } + ; + +tbl_1_0_stmt + : production_1_0_stmt { $$ = $1; } + | col_1_0_modifiers col_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_COLUMN, P ( $1 ), P ( $2 ) ); } + | KW_column KW_limit '=' expression_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_COLUMNEXPR, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } + | KW_column KW_default KW_limit '=' expression_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_COLUMNEXPR, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ), T ( ctx, $4 ), P ( $5 ), T ( ctx, $6 ) ); } + | KW_static physmbr_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, $1 ), P ( $2 ) ); } + | KW_physical physmbr_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, $1 ), P ( $2 ) ); } + | KW_static KW_physical physmbr_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ) ); } + | default_view_1_0_decl { $$ = $1; } + | KW___untyped '=' fqn_1_0 '(' ')' ';' + { $$ . subtree = MakeTree ( ctx, PT_COLUNTYPED, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ), T ( ctx, $5 ), T ( ctx, $6 ) ); } + | ';' { $$ . subtree = T ( ctx, $1 ); } + ; + +production_1_0_stmt + : typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' /* cannot have format */ + { $$ . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } + | KW_trigger ident_1_0 '=' cond_expr_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_PRODTRIGGER, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } + ; + +col_1_0_modifiers + : KW_column { $$ . subtree = T ( ctx, $1 ); } + | col_1_0_modifier_seq KW_column { $$ = $1; AddToList ( ctx, P ( $1 ), T ( ctx, $2 ) ); } + ; + +col_1_0_modifier_seq + : col_1_0_modifier { $$ . subtree = MakeList ( ctx, $1 ); } + | col_1_0_modifier_seq col_1_0_modifier { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } + ; + +col_1_0_modifier + : KW_default { $$ . subtree = T ( ctx, $1 ); } + | KW_extern { $$ . subtree = T ( ctx, $1 ); } + | KW_readonly { $$ . subtree = T ( ctx, $1 ); } + ; + +col_1_0_decl + : typespec_1_0 typed_column_decl_1_0 + { $$ . subtree = MakeTree ( ctx, PT_COLDECL, P ( $1 ), P ( $2 ) ); } + | phys_enc_ref typed_column_decl_1_0 + { $$ . subtree = MakeTree ( ctx, PT_COLDECL, P ( $1 ), P ( $2 ) ); } + ; + +phys_enc_ref + : '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 + { $$ . subtree = MakeTree ( ctx, PT_PHYSENCREF, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), P ( $5 ) ); } + | fqn_vers opt_factory_parms_1_0 + { $$ . subtree = MakeTree ( ctx, PT_PHYSENCREF, P ( $1 ), P ( $2 ) ); } + | fqn_1_0 factory_parms_1_0 + { $$ . subtree = MakeTree ( ctx, PT_PHYSENCREF, P ( $1 ), P ( $2 ) ); } + ; + +typed_column_decl_1_0 + : col_ident '{' opt_column_body_1_0 '}' + { $$ . subtree = MakeTree ( ctx, PT_TYPEDCOL, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + | col_ident '=' cond_expr_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_TYPEDCOLEXPR, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + | col_ident ';' + { $$ . subtree = MakeTree ( ctx, PT_TYPEDCOL, P ( $1 ), T ( ctx, $2 ) ); } + ; + +col_ident + : ident_1_0 { $$ = $1; } + | phys_ident { $$ = $1; } + ; + +phys_ident + : PHYSICAL_IDENTIFIER_1_0 { $$ . subtree = T ( ctx, $1 ); } /* starts with a '.' */ + ; + +opt_column_body_1_0 + : empty { $$ = $1; } + | column_body_1_0 { $$ = $1; } + ; + +column_body_1_0 + : column_stmt_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | column_body_1_0 column_stmt_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } + ; + +column_stmt_1_0 + : KW_read '=' cond_expr_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + | KW_validate '=' cond_expr_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + | KW_limit '=' uint_expr_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + | ';' { $$ . subtree = T ( ctx, $1 ); } + ; + +default_view_1_0_decl + : KW_default KW_view STRING ';' + { $$ . subtree = MakeTree ( ctx, PT_DFLTVIEW, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ), T ( ctx, $4 ) ); } + ; + +physmbr_1_0_decl + : phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_PHYSMBR, P ( $1 ), T ( ctx, $2 ), T ( ctx, $3 ) ); } + | phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_PHYSMBR, P ( $1 ), T ( ctx, $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } + | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_PHYSMBR, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), T ( ctx, $4 ) ); } + | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_PHYSMBR, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), T ( ctx, $4 ), P ( $5 ), T ( ctx, $6 ) ); } + ; + +phys_coldef_1_0 + : opt_col_kdbtext_parms_1_0 fqn_opt_vers opt_factory_parms_1_0 + { $$ . subtree = MakeTree ( ctx, PT_PHYSCOLDEF, P ( $1 ), P ( $2 ), P ( $3 ) ); } + ; + +opt_col_kdbtext_parms_1_0 + : empty { $$ = $1; } + | '<' col_kdbtext_parms_1_0 '>' { $$ . subtree = MakeTree ( ctx, PT_COLSCHEMAPARMS, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +col_kdbtext_parms_1_0 + : col_kdbtext_parm_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | col_kdbtext_parms_1_0 ',' col_kdbtext_parm_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +col_kdbtext_parm_1_0 + : fqn_1_0 '=' col_kdbtext_value_1_0 { $$ . subtree = MakeTree ( ctx, PT_COLSCHEMAPARAM, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + | col_kdbtext_value_1_0 { $$ = $1; } + ; + +col_kdbtext_value_1_0 + : fqn_1_0 { $$ = $1; } + | uint_expr_1_0 { $$ = $1; } + ; + +/* expression + */ + +cond_expr_1_0 + : expression_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | cond_expr_1_0 '|' expression_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +expression_1_0 + : primary_expr_1_0 { $$ = $1; } + | '(' type_expr_1_0 ')' expression_1_0 { $$ . subtree = MakeTree ( ctx, PT_CASTEXPR, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ) ); } + ; + +primary_expr_1_0 + : fqn_1_0 { $$ = $1; } + | phys_ident { $$ = $1; } + | '@' { $$ . subtree = T ( ctx, $1 ); } + | func_expr_1_0 { $$ = $1; } + | uint_expr_1_0 { $$ = $1; } + | float_expr_1_0 { $$ = $1; } + | string_expr_1_0 { $$ = $1; } + | const_vect_expr_1_0 { $$ = $1; } + | bool_expr_1_0 { $$ = $1; } + | '-' expression_1_0 { $$ . subtree = MakeTree ( ctx, PT_NEGATE, T ( ctx, $1 ), P ( $2 ) ); } + | '+' expression_1_0 { $$ . subtree = MakeTree ( ctx, PT_UNARYPLUS, T ( ctx, $1 ), P ( $2 ) ); } + | member_expr_2_0 { $$ = $1; } + | join_expr_2_0 { $$ = $1; } + ; + +func_expr_1_0 + : '<' kdbtext_parms_1_0 '>' + fqn_opt_vers + opt_factory_parms_1_0 + '(' + opt_func_1_0_parms + ')' + { $$ . subtree = MakeTree ( ctx, PT_FUNCEXPR, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), P ( $5 ), T ( ctx, $6 ), P ( $7 ), T ( ctx, $8 ) ); } + | fqn_opt_vers + opt_factory_parms_1_0 + '(' + opt_func_1_0_parms + ')' + { $$ . subtree = MakeTree ( ctx, PT_FUNCEXPR, P ( $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } + ; + +kdbtext_parms_1_0 + : kdbtext_parm_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | kdbtext_parms_1_0 ',' kdbtext_parm_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +kdbtext_parm_1_0 + : fqn_1_0 { $$ = $1; } + | fqn_1_0 '[' dim_1_0 ']' { $$ . subtree = MakeTree ( ctx, PT_ARRAY, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + | uint_expr_1_0 { $$ = $1; } + ; + +opt_factory_parms_1_0 + : empty { $$ = $1; } + | factory_parms_1_0 { $$ = $1; } + ; + +factory_parms_1_0 + : '<' factory_parms '>' { $$ . subtree = MakeTree ( ctx, PT_FACTPARMS, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +factory_parms + : expression_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | factory_parms ',' expression_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +opt_func_1_0_parms + : empty { $$ = $1; } + | func_1_0_parms { $$ = $1; } + ; + +func_1_0_parms + : expression_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | func_1_0_parms ',' expression_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +uint_expr_1_0 + : DECIMAL { $$ . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, $1 ) ); } + | HEX { $$ . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, $1 ) ); } + | OCTAL { $$ . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, $1 ) ); } + ; + +float_expr_1_0 + : FLOAT_ { $$ . subtree = T ( ctx, $1 ); } + | EXP_FLOAT { $$ . subtree = T ( ctx, $1 ); } + ; + +string_expr_1_0 + : STRING { $$ . subtree = T ( ctx, $1 ); } + | ESCAPED_STRING { $$ . subtree = T ( ctx, $1 ); } + ; + +const_vect_expr_1_0 + : '[' opt_const_vect_exprlist_1_0 ']' { $$ . subtree = MakeTree ( ctx, PT_CONSTVECT, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +opt_const_vect_exprlist_1_0 + : empty { $$ = $1; } + | const_vect_exprlist_1_0 { $$ = $1; } + ; + +const_vect_exprlist_1_0 + : expression_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | const_vect_exprlist_1_0 ',' expression_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +bool_expr_1_0 + : KW_true { $$ . subtree = T ( ctx, $1 ); } + | KW_false { $$ . subtree = T ( ctx, $1 ); } + ; + +type_expr_1_0 + : typespec_1_0 { $$ = $1; } /* datatype, typeset, kdbtexttype */ + | fqn_1_0 '/' fqn_1_0 { $$ . subtree = MakeTree ( ctx, PT_TYPEEXPR, P ( $1 ), T ( ctx, $2), P ( $3 ) ); } /* format / type */ + ; + +member_expr_2_0 + : ident_1_0 '.' ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_MEMBEREXPR, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + | ident_1_0 PHYSICAL_IDENTIFIER_1_0 { $$ . subtree = MakeTree ( ctx, PT_MEMBEREXPR, P ( $1 ), T ( ctx, $2 ) ); } + ; + +join_expr_2_0 + : ident_1_0 '[' cond_expr_1_0 ']' '.' ident_1_0 + { $$ . subtree = MakeTree ( ctx, PT_JOINEXPR, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ), T ( ctx, $5 ), P ($6 ) ); } + | ident_1_0 '[' cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 + { $$ . subtree = MakeTree ( ctx, PT_JOINEXPR, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ), T ( ctx, $5 ) ); } + ; + + /* database */ + +database_1_0_decl + : KW_database + fqn_vers + opt_database_dad_1_0 + database_body_1_0 + { $$ . subtree = MakeTree ( ctx, PT_DATABASE, T ( ctx, $1 ), P ( $2), P ( $3 ), P ( $4 ) ); } + ; + +opt_database_dad_1_0 + : empty { $$ = $1; } + | '=' fqn_opt_vers { $$ . subtree = MakeTree ( ctx, PT_DBDAD, T ( ctx, $1 ), P ( $2 ) ); } + ; + +database_body_1_0 + : '{' '}' { $$ . subtree = MakeTree ( ctx, PT_DBBODY, T ( ctx, $1 ), T ( ctx, $2 ) ); } + | '{' database_members_1_0 '}' { $$ . subtree = MakeTree ( ctx, PT_DBBODY, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } + ; + +database_members_1_0 + : database_member_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | database_members_1_0 database_member_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } + ; + +database_member_1_0 + : db_member_1_0 { $$ = $1; } + | table_member_1_0 { $$ = $1; } + | alias_member_1_0 { $$ = $1; } + | ';' { $$ . subtree = T ( ctx, $1 ); } + ; + +opt_template_1_0 + : empty { $$ = $1; } + | KW_template { $$ . subtree = T ( ctx, $1 ); } + ; + +db_member_1_0 + : opt_template_1_0 KW_database fqn_opt_vers ident_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_DBMEMBER, P ( $1 ), T ( ctx, $2 ), P ( $3 ), P ( $4 ), T ( ctx, $5 ) ); } + ; + +table_member_1_0 + : opt_template_1_0 KW_table fqn_opt_vers ident_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_TBLMEMBER, P ( $1 ), T ( ctx, $2 ), P ( $3 ), P ( $4 ), T ( ctx, $5 ) ); } + ; + +alias_member_1_0 + : KW_alias view_spec ident_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_ALIASMEMBER, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } + ; + +view_spec + : fqn_opt_vers '<' view_parms '>' + { $$ . subtree = MakeTree ( ctx, PT_VIEWSPEC, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + ; + +view_parms + : ident_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | view_parms ',' ident_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +/* include + */ + +include_directive + : KW_include STRING { $$ . subtree = MakeTree ( ctx, PT_INCLUDE, T ( ctx, $1 ), T ( ctx, $2 ) ); } + ; + + + +/* other stuff + */ +fqn_1_0 + : ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_FQN, P ( $1 ) ); } + | fqn_1_0 ':' ident_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + /* a hack to handle keywords used as namespace identifiers in existing 1.0 kdbtexts */ + | fqn_1_0 ':' KW_database { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } + | fqn_1_0 ':' KW_decode { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } + | fqn_1_0 ':' KW_encode { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } + | fqn_1_0 ':' KW_read { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } + | fqn_1_0 ':' KW_table { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } + | fqn_1_0 ':' KW_type { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } + | fqn_1_0 ':' KW_view { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } + | fqn_1_0 ':' KW_write { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } + ; + +ident_1_0 + : IDENTIFIER_1_0 { $$ . subtree = MakeTree ( ctx, PT_IDENT, T ( ctx, $1 ) ); } /* this is just a C identifier */ + ; + +empty + : %empty { $$ . subtree = MakeTree ( ctx, PT_EMPTY ); } + ; + +fqn_vers + : fqn_1_0 VERSION { $$ . subtree = MakeTree ( ctx, PT_VERSNAME, P ( $1 ), T ( ctx, $2 ) ); } + ; + +fqn_opt_vers + : fqn_1_0 { $$ = $1; } + | fqn_vers { $$ = $1; } + ; + +/*************************** V 2.0 ******************************/ + +version_2_0 + : KW_version VERS_2_0 ';' { $$ . subtree = MakeTree ( ctx, PT_VERSION_2, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ) ); } + ; + +kdbtext_2_0_opt + : kdbtext_2_0 { $$ . subtree = P ( $1 ); } + | empty { $$ = $1; } + ; + +kdbtext_2_0 + : kdbtext_2_0_decl { $$ . subtree = MakeTree ( ctx, PT_SCHEMA_2_0, P ( $1 ) ); } + | kdbtext_2_0 kdbtext_2_0_decl { $$ . subtree = AddToList ( ctx, P ( $1 ) , P ( $2 ) ); } + ; + +kdbtext_2_0_decl + : kdbtext_1_0_decl { $$ = $1; } + | view_2_0_decl { $$ = $1; } + ; + +view_2_0_decl + : KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body '}' + { $$ . subtree = MakeTree ( ctx, PT_VIEW, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ), P ( $6 ), T ( ctx, $7 ), P ( $8 ), T ( ctx, $9 ) ); } + ; + +view_parms + : view_parm { $$ . subtree = MakeList ( ctx, $1 ); } + | view_parms ',' view_parm { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +view_parm + : fqn_opt_vers ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_VIEWPARAM, P ( $1 ), P ( $2 ) ); } + ; + +opt_view_body + : empty { $$ = $1; } + | view_body { $$ = $1; } + ; + +view_body + : view_member { $$ . subtree = MakeList ( ctx, $1 ); } + | view_body view_member { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } + ; + +view_member + : typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } + | KW_column typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' + { $$ . subtree = MakeTree ( ctx, PT_COLUMN, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ), P ( $5 ), T ( ctx, $6 ) ); } + | ';' { $$ . subtree = T ( ctx, $1 ); } + ; + +opt_view_parents + : empty { $$ = $1; } + | '=' view_parents { $$ . subtree = MakeTree ( ctx, PT_VIEWPARENTS, T ( ctx, $1 ), P ( $2 ) ); } + ; + +view_parents + : view_parent { $$ . subtree = MakeList ( ctx, $1 ); } + | view_parents ',' view_parent { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; + +view_parent + : fqn_opt_vers '<' view_parent_parms'>' + { $$ . subtree = MakeTree ( ctx, PT_VIEWPARENT, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } + ; + +view_parent_parms + : ident_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } + | view_parent_parms ',' ident_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } + ; diff --git a/libs/kdbtext/kdbtext-lex.h b/libs/kdbtext/kdbtext-lex.h new file mode 100644 index 000000000..da0dd877c --- /dev/null +++ b/libs/kdbtext/kdbtext-lex.h @@ -0,0 +1,44 @@ +/*=========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum +{ + UNRECOGNIZED, + IDENTIFIER, + KW_database +} KDBText_tokentype; + +extern KDBText_tokentype KDBText_lex ( SCHEMA_STYPE *lvalp, SCHEMA_LTYPE *llocp, KDBTextScanBlock* sb ); + +#ifdef __cplusplus +} +#endif diff --git a/libs/kdbtext/kdbtext-lex.l b/libs/kdbtext/kdbtext-lex.l new file mode 100644 index 000000000..8cc844c58 --- /dev/null +++ b/libs/kdbtext/kdbtext-lex.l @@ -0,0 +1,56 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +%{ +#include "kdbtext-lex.h" +%} + +%option prefix="KDBText_" + + /* let parser handle EOF */ +%option noyywrap + +alpha [a-zA-Z_] +alphanum [a-zA-Z_0-9] + +%% + + /* literals */ + +"{" { return yytext [ 0 ]; } +"}" { return yytext [ 0 ]; } + + /* keywords */ +"database" { return KW_database; } + +{alpha}{alphanum}* { return IDENTIFIER; } + + /* ignored tokens */ +<*>[ \t\f\v\r\n] + + /* unrecognized input */ +<*>. { return UNRECOGNIZED; } + diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp new file mode 100644 index 000000000..8c75898bd --- /dev/null +++ b/libs/kdbtext/manager.cpp @@ -0,0 +1,152 @@ + +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include + +#include + +typedef struct KDBManager KDBManager; +#define KDBMGR_IMPL KDBManager +#include "../libs/kdb/manager-base.h" + +struct KDBManager +{ + KDBManagerBase dad; +}; + +const uint32_t LIBKDBTEXT_VERS = 0; + +static rc_t CC KDBTextManagerWhack ( KDBManager *self ); +static rc_t CC KDBTextManagerVersion ( const KDBManager *self, uint32_t *version ); +static bool CC KDBTextManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args ); + +// static rc_t CC KDBTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ); +// static rc_t CC KDBTextManagerRunPeriodicTasks ( const KDBManager *self ); +// static int CC KDBTextManagerPathTypeVP( const KDBManager * self, const VPath * path ); +// static int CC KDBTextManagerVPathType ( const KDBManager * self, const char *path, va_list args ); +// static int CC KDBTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ); +// static rc_t CC KDBTextManagerVOpenDBRead ( const KDBManager *self, const KDatabase **db, const char *path, va_list args ); +// static rc_t CC KDBTextManagerVOpenTableRead ( const KDBManager *self, const KTable **tbl, const char *path, va_list args ); +// static rc_t CC KDBTextManagerOpenTableReadVPath(const KDBManager *self, const KTable **tbl, const struct VPath *path); +// static rc_t CC KDBTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ); +// static rc_t CC KDBTextManagerVPathOpenLocalDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * vpath ); +// static rc_t CC KDBTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ); + +static KDBManager_vt KDBTextManager_vt = +{ + KDBTextManagerWhack, + KDBManagerBaseAddRef, + KDBManagerBaseRelease, + KDBTextManagerVersion, + KDBTextManagerVExists, + // KDBTextManagerVWritable, + // KDBTextManagerRunPeriodicTasks, + // KDBTextManagerPathTypeVP, + // KDBTextManagerVPathType, + // KDBTextManagerVPathTypeUnreliable, + // KDBTextManagerVOpenDBRead, + // KDBTextManagerVOpenTableRead, + // KDBTextManagerOpenTableReadVPath, + // KDBTextManagerVOpenColumnRead, + // KDBTextManagerVPathOpenLocalDBRead, + // KDBTextManagerVPathOpenRemoteDBRead +}; + +class Manager : public KDBManager +{ +public: + Manager() + { + dad . vt = & KDBTextManager_vt; + KRefcountInit ( & dad . refcount, 1, "KDBManager", "make-read-text", "kmgr" ); + } + ~Manager() + { + KRefcountWhack ( & dad . refcount, "KDBManager" ); + } +}; + +static +rc_t CC +KDBTextManagerWhack ( KDBManager *self ) +{ + assert( self -> dad . vt == & KDBTextManager_vt ); + delete reinterpret_cast( self ); + return 0; +} + +static +rc_t CC +KDBTextManagerVersion ( const KDBManager *self, uint32_t * version ) +{ + if ( version == nullptr ) + { + return SILENT_RC ( rcDB, rcMgr, rcAccessing, rcParam, rcNull ); + } + + * version = LIBKDBTEXT_VERS; + return 0; +} + +static +bool CC +KDBTextManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args ) +{ + return false; + // int type; + + // type = KDBManagerVPathType (self, name, args); + // switch ( type ) + // { + // case kptDatabase: + // case kptTable: + // case kptIndex: + // case kptColumn: + // case kptMetadata: + // break; + // case kptPrereleaseTbl: + // type = kptTable; + // break; + // default: + // return false; + // } + // return requested == ( uint32_t ) type; +} + +LIB_EXPORT +rc_t CC +KDBManagerMakeText ( const KDBManager ** p_mgr, const char * data ) +{ + if ( p_mgr == nullptr ) + { + return SILENT_RC ( rcDB, rcMgr, rcCreating, rcSelf, rcNull ); + } + + *p_mgr = new Manager(); + return 0; +} + diff --git a/libs/kdbtext/zz_kdbtext-grammar.cpp b/libs/kdbtext/zz_kdbtext-grammar.cpp new file mode 100644 index 000000000..27bb2120a --- /dev/null +++ b/libs/kdbtext/zz_kdbtext-grammar.cpp @@ -0,0 +1,7228 @@ +/* A Bison parser, made by GNU Bison 3.5.1. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.5.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 2 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Substitute the type names. */ +#define YYSTYPE KDBTEXT_STYPE +#define YYLTYPE KDBTEXT_LTYPE +/* Substitute the variable and function names. */ +#define yyparse KDBText_parse +#define yylex KDBText_lex +#define yyerror KDBText_error +#define yydebug KDBText_debug +#define yynerrs KDBText_nerrs + +/* First part of user prologue. */ + + #define YYDEBUG 1 + + #include + +// #include "ParseTree.hpp" +// #include "ErrorReport.hpp" + + using namespace ncbi::KDBTextParser; + + #include "kdbtext-grammar.hpp" + #include "kdbtext-lex.h" + #define KDBText_lex KDBTextScan_yylex + + void KDBText_error ( YYLTYPE * p_llocp, + ctx_t ctx, + ParseTree ** p_root, + ErrorReport * p_errors, + struct KDBTextScanBlock * p_sb, + const char * p_msg ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); + /* send message to the C++ parser for proper display and recovery */ + Token :: Location loc ( p_sb -> file_name, p_llocp -> first_line, p_llocp -> first_column ); + p_errors -> ReportError ( ctx, loc, "%s", p_msg); + } + + extern "C" + { + extern enum KDBText_tokentype KDBTextScan_yylex ( SCHEMA_STYPE *lvalp, SCHEMA_LTYPE *llocp, KDBTextScanBlock* sb ); + } + + static + ParseTree* + P ( KDBTextToken & p_prod ) + { + assert ( p_prod . subtree ); + return ( ParseTree * ) p_prod . subtree; + } + + static + ParseTree* + T ( ctx_t ctx, KDBTextToken & p_term ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing );//TODO: catch + assert ( p_term . subtree == 0 ); + return ParseTree::Make ( ctx, p_term ); + } + + /* Create production node */ + static + ParseTree * + MakeTree ( ctx_t ctx, + int p_token, + ParseTree * p_ch1 = 0, + ParseTree * p_ch2 = 0, + ParseTree * p_ch3 = 0, + ParseTree * p_ch4 = 0, + ParseTree * p_ch5 = 0, + ParseTree * p_ch6 = 0, + ParseTree * p_ch7 = 0, + ParseTree * p_ch8 = 0, + ParseTree * p_ch9 = 0 + ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); + ParseTree * ret = ParseTree :: Make ( ctx, Token ( p_token ) ); + if ( p_ch1 != 0 ) ret -> AddChild ( ctx, p_ch1 ); + if ( p_ch2 != 0 ) ret -> AddChild ( ctx, p_ch2 ); + if ( p_ch3 != 0 ) ret -> AddChild ( ctx, p_ch3 ); + if ( p_ch4 != 0 ) ret -> AddChild ( ctx, p_ch4 ); + if ( p_ch5 != 0 ) ret -> AddChild ( ctx, p_ch5 ); + if ( p_ch6 != 0 ) ret -> AddChild ( ctx, p_ch6 ); + if ( p_ch7 != 0 ) ret -> AddChild ( ctx, p_ch7 ); + if ( p_ch8 != 0 ) ret -> AddChild ( ctx, p_ch8 ); + if ( p_ch9 != 0 ) ret -> AddChild ( ctx, p_ch9 ); + return ret; + } + + /* Create a flat list */ + static + ParseTree * + MakeList ( ctx_t ctx, KDBTextToken & p_prod ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); + ParseTree * ret = ParseTree :: Make ( ctx, Token ( PT_ASTLIST ) ); + ret -> AddChild ( ctx, P ( p_prod ) ); + return ret; + } + + /* Add to a flat list node */ + static + ParseTree * + AddToList ( ctx_t ctx, ParseTree * p_root, ParseTree * p_br1, ParseTree * p_br2 = 0 ) + { + FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); + assert ( p_br1 != 0 ); + p_root -> AddChild ( ctx, p_br1 ); + if ( p_br2 != 0 ) + { + p_root -> AddChild ( ctx, p_br2 ); + } + return p_root; + } + + + +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* Use api.header.include to #include this header + instead of duplicating it here. */ +#ifndef YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED +# define YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED +/* Debug traces. */ +#ifndef KDBTEXT_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define KDBTEXT_DEBUG 1 +# else +# define KDBTEXT_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define KDBTEXT_DEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined KDBTEXT_DEBUG */ +#if KDBTEXT_DEBUG +extern int KDBText_debug; +#endif + +/* Token type. */ +#ifndef KDBTEXT_TOKENTYPE +# define KDBTEXT_TOKENTYPE + enum KDBText_tokentype + { + END_SOURCE = 0, + UNRECOGNIZED = 258, + ELLIPSIS = 259, + INCREMENT = 260, + DECIMAL = 261, + OCTAL = 262, + HEX = 263, + FLOAT_ = 264, + EXP_FLOAT = 265, + STRING = 266, + ESCAPED_STRING = 267, + IDENTIFIER_1_0 = 268, + PHYSICAL_IDENTIFIER_1_0 = 269, + VERSION = 270, + UNTERM_STRING = 271, + UNTERM_ESCAPED_STRING = 272, + VERS_1_0 = 273, + VERS_2_0 = 274, + KW___no_header = 275, + KW___row_length = 276, + KW___untyped = 277, + KW_alias = 278, + KW_column = 279, + KW_const = 280, + KW_control = 281, + KW_database = 282, + KW_decode = 283, + KW_default = 284, + KW_encode = 285, + KW_extern = 286, + KW_false = 287, + KW_fmtdef = 288, + KW_function = 289, + KW_include = 290, + KW_limit = 291, + KW_physical = 292, + KW_read = 293, + KW_readonly = 294, + KW_return = 295, + KW_kdbtext = 296, + KW_static = 297, + KW_table = 298, + KW_template = 299, + KW_trigger = 300, + KW_true = 301, + KW_type = 302, + KW_typedef = 303, + KW_typeset = 304, + KW_validate = 305, + KW_version = 306, + KW_view = 307, + KW_virtual = 308, + KW_void = 309, + KW_write = 310, + PT_ASTLIST = 311, + PT_PARSE = 312, + PT_SOURCE = 313, + PT_VERSION_1_0 = 314, + PT_VERSION_2 = 315, + PT_SCHEMA_1_0 = 316, + PT_SCHEMA_2_0 = 317, + PT_INCLUDE = 318, + PT_TYPEDEF = 319, + PT_FQN = 320, + PT_IDENT = 321, + PT_PHYSIDENT = 322, + PT_UINT = 323, + PT_TYPESET = 324, + PT_TYPESETDEF = 325, + PT_FORMAT = 326, + PT_CONST = 327, + PT_ALIAS = 328, + PT_EXTERN = 329, + PT_FUNCTION = 330, + PT_UNTYPED = 331, + PT_ROWLENGTH = 332, + PT_FUNCDECL = 333, + PT_EMPTY = 334, + PT_SCHEMASIG = 335, + PT_SCHEMAFORMAL = 336, + PT_RETURNTYPE = 337, + PT_FACTSIG = 338, + PT_FUNCSIG = 339, + PT_FUNCPARAMS = 340, + PT_FORMALPARAM = 341, + PT_ELLIPSIS = 342, + PT_FUNCPROLOGUE = 343, + PT_RETURN = 344, + PT_PRODSTMT = 345, + PT_PRODTRIGGER = 346, + PT_SCHEMA = 347, + PT_VALIDATE = 348, + PT_PHYSICAL = 349, + PT_PHYSPROLOGUE = 350, + PT_PHYSSTMT = 351, + PT_PHYSBODYSTMT = 352, + PT_TABLE = 353, + PT_TABLEPARENTS = 354, + PT_TABLEBODY = 355, + PT_FUNCEXPR = 356, + PT_FACTPARMS = 357, + PT_COLUMN = 358, + PT_COLUMNEXPR = 359, + PT_COLDECL = 360, + PT_TYPEDCOL = 361, + PT_COLSTMT = 362, + PT_DFLTVIEW = 363, + PT_PHYSMBR = 364, + PT_PHYSCOL = 365, + PT_PHYSCOLDEF = 366, + PT_COLSCHEMAPARMS = 367, + PT_COLSCHEMAPARAM = 368, + PT_COLUNTYPED = 369, + PT_DATABASE = 370, + PT_TYPEEXPR = 371, + PT_DBBODY = 372, + PT_DBDAD = 373, + PT_DBMEMBER = 374, + PT_TBLMEMBER = 375, + PT_NOHEADER = 376, + PT_CASTEXPR = 377, + PT_CONSTVECT = 378, + PT_NEGATE = 379, + PT_UNARYPLUS = 380, + PT_VERSNAME = 381, + PT_ARRAY = 382, + PT_PHYSENCREF = 383, + PT_TYPEDCOLEXPR = 384, + PT_VIEW = 385, + PT_VIEWPARAM = 386, + PT_VIEWPARENTS = 387, + PT_VIEWPARENT = 388, + PT_MEMBEREXPR = 389, + PT_JOINEXPR = 390, + PT_ALIASMEMBER = 391, + PT_VIEWSPEC = 392 + }; +#endif + +/* Value type. */ +#if ! defined KDBTEXT_STYPE && ! defined KDBTEXT_STYPE_IS_DECLARED +typedef KDBTextToken KDBTEXT_STYPE; +# define KDBTEXT_STYPE_IS_TRIVIAL 1 +# define KDBTEXT_STYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined KDBTEXT_LTYPE && ! defined KDBTEXT_LTYPE_IS_DECLARED +typedef struct KDBTEXT_LTYPE KDBTEXT_LTYPE; +struct KDBTEXT_LTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define KDBTEXT_LTYPE_IS_DECLARED 1 +# define KDBTEXT_LTYPE_IS_TRIVIAL 1 +#endif + + + +int KDBText_parse (ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb); + +#endif /* !YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED */ + + + +#ifdef short +# undef short +#endif + +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif +#endif + +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; +#else +typedef short yytype_int16; +#endif + +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; +#else +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned +# endif +#endif + +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_int16 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined KDBTEXT_LTYPE_IS_TRIVIAL && KDBTEXT_LTYPE_IS_TRIVIAL \ + && defined KDBTEXT_STYPE_IS_TRIVIAL && KDBTEXT_STYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yy_state_t yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \ + + YYSIZEOF (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYPTRDIFF_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYPTRDIFF_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 68 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 837 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 157 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 129 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 280 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 540 + +#define YYUNDEFTOK 2 +#define YYMAXUTOK 392 + + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 146, 147, 144, 153, 139, 152, 155, 154, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 156, 138, + 148, 145, 149, 2, 151, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 142, 2, 143, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 140, 150, 141, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137 +}; + +#if KDBTEXT_DEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int16 yyrline[] = +{ + 0, 316, 316, 317, 321, 322, 323, 329, 333, 334, + 338, 339, 343, 344, 345, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, 362, 370, 371, 377, + 382, 386, 393, 394, 398, 399, 403, 404, 410, 412, + 417, 421, 428, 435, 440, 446, 450, 451, 452, 462, + 467, 472, 473, 477, 481, 482, 486, 487, 491, 492, + 496, 497, 501, 505, 506, 508, 510, 512, 517, 518, + 522, 526, 530, 531, 533, 535, 537, 542, 543, 547, + 548, 553, 554, 558, 560, 562, 567, 568, 572, 573, + 580, 585, 592, 594, 602, 609, 619, 620, 624, 626, + 631, 632, 636, 638, 640, 642, 647, 654, 662, 663, + 667, 668, 672, 674, 679, 680, 684, 685, 686, 688, + 690, 691, 692, 693, 694, 696, 700, 702, 707, 708, + 712, 713, 717, 718, 719, 723, 725, 730, 732, 734, + 739, 741, 743, 748, 749, 753, 757, 758, 762, 763, + 767, 768, 769, 770, 774, 779, 781, 783, 785, 790, + 795, 796, 800, 801, 805, 806, 810, 811, 818, 819, + 823, 824, 828, 829, 830, 831, 832, 833, 834, 835, + 836, 837, 838, 839, 840, 844, 851, 860, 861, 865, + 866, 867, 871, 872, 876, 880, 881, 885, 886, 890, + 891, 895, 896, 897, 901, 902, 906, 907, 911, 915, + 916, 920, 921, 925, 926, 930, 931, 935, 936, 940, + 942, 949, 957, 958, 962, 963, 967, 968, 972, 973, + 974, 975, 979, 980, 984, 989, 994, 999, 1004, 1005, + 1012, 1020, 1021, 1023, 1024, 1025, 1026, 1027, 1028, 1029, + 1030, 1034, 1038, 1042, 1046, 1047, 1053, 1057, 1058, 1062, + 1063, 1067, 1068, 1072, 1077, 1078, 1082, 1086, 1087, 1091, + 1092, 1096, 1098, 1100, 1104, 1105, 1109, 1110, 1114, 1119, + 1120 +}; +#endif + +#if KDBTEXT_DEBUG || YYERROR_VERBOSE || 1 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "\"end of source\"", "error", "$undefined", "UNRECOGNIZED", "ELLIPSIS", + "INCREMENT", "DECIMAL", "OCTAL", "HEX", "FLOAT_", "EXP_FLOAT", "STRING", + "ESCAPED_STRING", "IDENTIFIER_1_0", "PHYSICAL_IDENTIFIER_1_0", "VERSION", + "UNTERM_STRING", "UNTERM_ESCAPED_STRING", "VERS_1_0", "VERS_2_0", + "KW___no_header", "KW___row_length", "KW___untyped", "KW_alias", + "KW_column", "KW_const", "KW_control", "KW_database", "KW_decode", + "KW_default", "KW_encode", "KW_extern", "KW_false", "KW_fmtdef", + "KW_function", "KW_include", "KW_limit", "KW_physical", "KW_read", + "KW_readonly", "KW_return", "KW_kdbtext", "KW_static", "KW_table", + "KW_template", "KW_trigger", "KW_true", "KW_type", "KW_typedef", + "KW_typeset", "KW_validate", "KW_version", "KW_view", "KW_virtual", + "KW_void", "KW_write", "PT_ASTLIST", "PT_PARSE", "PT_SOURCE", + "PT_VERSION_1_0", "PT_VERSION_2", "PT_SCHEMA_1_0", "PT_SCHEMA_2_0", + "PT_INCLUDE", "PT_TYPEDEF", "PT_FQN", "PT_IDENT", "PT_PHYSIDENT", + "PT_UINT", "PT_TYPESET", "PT_TYPESETDEF", "PT_FORMAT", "PT_CONST", + "PT_ALIAS", "PT_EXTERN", "PT_FUNCTION", "PT_UNTYPED", "PT_ROWLENGTH", + "PT_FUNCDECL", "PT_EMPTY", "PT_SCHEMASIG", "PT_SCHEMAFORMAL", + "PT_RETURNTYPE", "PT_FACTSIG", "PT_FUNCSIG", "PT_FUNCPARAMS", + "PT_FORMALPARAM", "PT_ELLIPSIS", "PT_FUNCPROLOGUE", "PT_RETURN", + "PT_PRODSTMT", "PT_PRODTRIGGER", "PT_SCHEMA", "PT_VALIDATE", + "PT_PHYSICAL", "PT_PHYSPROLOGUE", "PT_PHYSSTMT", "PT_PHYSBODYSTMT", + "PT_TABLE", "PT_TABLEPARENTS", "PT_TABLEBODY", "PT_FUNCEXPR", + "PT_FACTPARMS", "PT_COLUMN", "PT_COLUMNEXPR", "PT_COLDECL", + "PT_TYPEDCOL", "PT_COLSTMT", "PT_DFLTVIEW", "PT_PHYSMBR", "PT_PHYSCOL", + "PT_PHYSCOLDEF", "PT_COLSCHEMAPARMS", "PT_COLSCHEMAPARAM", + "PT_COLUNTYPED", "PT_DATABASE", "PT_TYPEEXPR", "PT_DBBODY", "PT_DBDAD", + "PT_DBMEMBER", "PT_TBLMEMBER", "PT_NOHEADER", "PT_CASTEXPR", + "PT_CONSTVECT", "PT_NEGATE", "PT_UNARYPLUS", "PT_VERSNAME", "PT_ARRAY", + "PT_PHYSENCREF", "PT_TYPEDCOLEXPR", "PT_VIEW", "PT_VIEWPARAM", + "PT_VIEWPARENTS", "PT_VIEWPARENT", "PT_MEMBEREXPR", "PT_JOINEXPR", + "PT_ALIASMEMBER", "PT_VIEWSPEC", "';'", "','", "'{'", "'}'", "'['", + "']'", "'*'", "'='", "'('", "')'", "'<'", "'>'", "'|'", "'@'", "'-'", + "'+'", "'/'", "'.'", "':'", "$accept", "parse", "source", "version_1_0", + "kdbtext_1_0_opt", "kdbtext_1_0", "kdbtext_1_0_decl", "typedef_1_0_decl", + "typedef_1_0_new_name_list", "typeset_1_0_decl", "typeset_1_0_new_name", + "typeset_1_0_def", "typespec_1_0_list", "typespec_1_0", "dim_1_0", + "format_1_0_decl", "format_1_0_new_name", "format_1_0_name", + "const_1_0_decl", "alias_1_0_decl", "alias_1_0_new_name", + "function_1_0_decl", "func_1_0_decl", "untyped_func_1_0_decl", + "row_length_func_1_0_decl", "opt_func_1_0_kdbtext_sig", + "func_1_0_kdbtext_sig", "func_1_0_kdbtext_formals", + "func_1_0_kdbtext_formal", "func_1_0_return_type", + "opt_func_1_0_fact_sig", "func_1_0_fact_sig", "func_1_0_fact_signature", + "func_1_0_fact_params", "fact_param_1_0", "func_1_0_param_sig", + "func_1_0_param_signature", "func_1_0_formal_params", "formal_param_1_0", + "func_1_0_vararg_formals", "func_1_0_prologue", "script_1_0_stmt_seq", + "script_1_0_stmt", "extern_1_0_decl", "ext_func_1_0_decl", + "script_1_0_decl", "validate_1_0_decl", "physical_1_0_decl", + "phys_1_0_return_type", "phys_1_0_prologue", "phys_1_0_body", + "phys_1_0_body_stmt", "phys_1_0_stmt", "table_1_0_decl", + "opt_tbl_1_0_parents", "tbl_1_0_parents", "tbl_1_0_body", + "tbl_1_0_stmt_seq", "tbl_1_0_stmt", "production_1_0_stmt", + "col_1_0_modifiers", "col_1_0_modifier_seq", "col_1_0_modifier", + "col_1_0_decl", "phys_enc_ref", "typed_column_decl_1_0", "col_ident", + "phys_ident", "opt_column_body_1_0", "column_body_1_0", + "column_stmt_1_0", "default_view_1_0_decl", "physmbr_1_0_decl", + "phys_coldef_1_0", "opt_col_kdbtext_parms_1_0", "col_kdbtext_parms_1_0", + "col_kdbtext_parm_1_0", "col_kdbtext_value_1_0", "cond_expr_1_0", + "expression_1_0", "primary_expr_1_0", "func_expr_1_0", + "kdbtext_parms_1_0", "kdbtext_parm_1_0", "opt_factory_parms_1_0", + "factory_parms_1_0", "factory_parms", "opt_func_1_0_parms", + "func_1_0_parms", "uint_expr_1_0", "float_expr_1_0", "string_expr_1_0", + "const_vect_expr_1_0", "opt_const_vect_exprlist_1_0", + "const_vect_exprlist_1_0", "bool_expr_1_0", "type_expr_1_0", + "member_expr_2_0", "join_expr_2_0", "database_1_0_decl", + "opt_database_dad_1_0", "database_body_1_0", "database_members_1_0", + "database_member_1_0", "opt_template_1_0", "db_member_1_0", + "table_member_1_0", "alias_member_1_0", "view_spec", "view_parms", + "include_directive", "fqn_1_0", "ident_1_0", "empty", "fqn_vers", + "fqn_opt_vers", "version_2_0", "kdbtext_2_0_opt", "kdbtext_2_0", + "kdbtext_2_0_decl", "view_2_0_decl", "view_parm", "opt_view_body", + "view_body", "view_member", "opt_view_parents", "view_parents", + "view_parent", "view_parent_parms", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_int16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 59, 44, + 123, 125, 91, 93, 42, 61, 40, 41, 60, 62, + 124, 64, 45, 43, 47, 46, 58 +}; +# endif + +#define YYPACT_NINF (-369) + +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) + +#define YYTABLE_NINF (-255) + +#define yytable_value_is_error(Yyn) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 521, -369, 8, 8, 8, 98, 8, 59, 168, 57, + 52, 8, 8, 8, 98, 392, -369, 244, 248, 699, + 699, -369, -369, -369, -369, -369, -369, -369, -369, -369, + -369, -369, -369, -369, -369, 635, -369, -8, -369, 8, + -49, -9, 118, -369, -369, 114, 8, -6, 8, 8, + 12, -369, -369, -369, 76, -369, -369, -369, 200, 59, + -369, 120, -8, 149, 125, -369, 173, 220, -369, -369, + -369, 699, -369, -369, 8, -369, -369, -369, 635, -369, + -369, 597, 232, 125, -14, 107, -369, 8, 187, -369, + -369, 278, 125, 42, 89, 8, -369, 189, -369, 8, + 80, -369, 8, -369, 76, -369, 8, -369, 8, 195, + -369, -40, -369, 8, 281, -369, -369, 193, -369, -369, + -369, -369, -369, -369, -369, -369, -369, -369, -369, 486, + -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, + 486, -369, 8, 386, -369, 486, 486, 212, -369, -369, + -369, -369, -369, -369, -369, -369, -369, -369, -369, 34, + 2, -369, 277, -9, -369, 61, -369, -369, 280, 299, + -369, 12, -369, -369, 8, 282, -369, 282, 313, -369, + 279, -369, -369, 8, -98, -369, -369, 8, 318, -369, + 323, 328, -369, 321, 203, -369, -369, -33, -369, -369, + -369, -369, 486, 8, 486, 325, -369, -369, 8, -369, + -369, -369, 78, -369, 36, -369, -369, -369, -369, -369, + -369, -369, 125, 29, 326, -369, -369, -12, 8, 324, + 378, 421, -369, 27, -369, 38, 8, -369, -369, 8, + 578, -369, -369, 19, 291, -369, -369, -369, 8, -369, + 217, 218, 8, -369, -369, -369, 486, 486, 386, 8, + 107, 272, -369, -369, -369, 222, 486, 8, 329, -369, + -369, 8, 8, 8, 461, 327, 141, -369, -369, 45, + 295, 66, 338, -369, -369, 8, 443, 335, 470, 334, + 386, -369, 474, 8, -369, 27, -369, 345, 357, -369, + -369, 386, 430, -369, 430, 18, 277, -369, -369, -369, + -369, 8, 359, -369, -369, -369, -369, 277, 363, -1, + 486, 486, -369, -369, 360, 369, -369, 371, 8, 8, + 8, 372, -369, -369, 53, 8, -369, -369, 8, 182, + 499, 366, 257, -369, -369, -369, 84, 8, -369, 370, + 338, 338, -369, -4, -369, 84, -369, 216, 375, 486, + 376, 502, 230, -369, -369, -369, 86, 300, 277, -369, + 486, 486, 234, -369, 296, -369, -369, -369, -369, -369, + 237, -369, 8, -369, 377, 380, -369, -369, 8, -369, + -369, -369, 486, -369, 242, 385, 389, 122, -369, -369, + 8, -369, 372, 511, 390, -369, -369, 14, 182, -369, + 486, 21, -369, 8, 87, 8, -369, -369, -369, -369, + 51, 381, 486, 393, -369, 317, 386, -369, 386, -369, + 486, -369, 112, 128, 8, -369, 0, 486, 382, 394, + -369, 7, 486, -369, -369, -369, -369, -369, 372, -369, + -369, 211, -369, 182, -369, 390, 134, -369, -369, 397, + -369, 241, -369, 396, 399, -369, -369, 486, -369, -369, + 125, 136, -369, -369, 277, 400, 402, 406, -369, 412, + 0, -369, -369, 156, 8, 8, 8, -369, 8, -369, + 416, 7, -369, 391, -369, 390, -369, -369, 486, 413, + -369, -369, 162, -369, -369, 457, 486, 486, -369, -369, + -369, -369, 251, -369, 8, 414, -369, -369, -369, -369, + 175, -369, -369, 423, 196, 209, 8, -369, 418, 486, + -369, -369, -369, -369, -369, 486, 210, 213, -369, -369 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int16 yydefact[] = +{ + 0, 2, 0, 0, 0, 0, 0, 252, 0, 252, + 252, 0, 0, 0, 0, 0, 25, 0, 0, 252, + 4, 10, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 252, 251, 0, 241, 0, + 34, 0, 252, 91, 90, 0, 0, 40, 0, 0, + 0, 45, 46, 47, 0, 52, 51, 240, 0, 252, + 92, 252, 0, 0, 30, 94, 0, 0, 1, 3, + 5, 8, 9, 11, 0, 261, 258, 6, 257, 259, + 262, 0, 0, 44, 0, 0, 253, 0, 0, 222, + 38, 0, 40, 0, 0, 0, 215, 0, 54, 0, + 34, 58, 0, 59, 0, 96, 0, 93, 0, 0, + 108, 0, 27, 0, 0, 7, 256, 0, 260, 243, + 244, 245, 246, 247, 248, 249, 250, 242, 43, 0, + 201, 203, 202, 204, 205, 206, 207, 145, 214, 213, + 252, 37, 0, 0, 174, 0, 0, 0, 173, 36, + 170, 175, 176, 177, 178, 179, 180, 183, 184, 172, + 241, 255, 252, 254, 223, 252, 221, 39, 0, 0, + 56, 0, 53, 57, 0, 252, 97, 252, 109, 110, + 0, 107, 26, 0, 0, 32, 29, 0, 0, 211, + 0, 210, 209, 0, 0, 187, 191, 189, 181, 182, + 35, 218, 0, 0, 0, 0, 193, 192, 0, 233, + 231, 224, 252, 226, 0, 228, 229, 230, 232, 50, + 49, 55, 216, 252, 0, 61, 60, 0, 0, 0, + 128, 132, 133, 252, 134, 252, 0, 125, 113, 0, + 0, 114, 116, 0, 0, 130, 123, 28, 0, 31, + 0, 241, 0, 264, 42, 208, 0, 0, 0, 0, + 0, 0, 168, 217, 195, 0, 252, 0, 0, 225, + 227, 0, 0, 0, 0, 0, 252, 68, 63, 252, + 0, 0, 0, 95, 111, 0, 0, 0, 0, 252, + 0, 121, 0, 0, 160, 252, 120, 0, 0, 112, + 115, 0, 0, 117, 0, 34, 252, 129, 132, 131, + 33, 0, 252, 266, 212, 171, 188, 252, 0, 0, + 0, 0, 194, 199, 0, 198, 197, 0, 0, 0, + 0, 252, 70, 62, 0, 0, 64, 81, 0, 0, + 0, 0, 252, 77, 72, 83, 0, 0, 48, 0, + 0, 0, 102, 0, 100, 0, 98, 0, 0, 0, + 0, 0, 0, 162, 165, 167, 166, 0, 252, 122, + 0, 0, 0, 135, 0, 144, 143, 136, 139, 138, + 241, 265, 0, 274, 0, 0, 190, 220, 0, 169, + 196, 186, 0, 236, 0, 0, 0, 0, 65, 82, + 0, 69, 252, 0, 252, 79, 71, 0, 0, 73, + 0, 0, 86, 0, 0, 0, 103, 104, 99, 101, + 0, 0, 0, 0, 154, 0, 0, 161, 0, 155, + 0, 159, 0, 0, 0, 142, 252, 0, 0, 275, + 276, 252, 252, 219, 200, 237, 234, 235, 252, 66, + 80, 0, 74, 0, 78, 252, 0, 85, 87, 0, + 84, 0, 106, 0, 0, 118, 157, 0, 163, 164, + 166, 0, 127, 126, 252, 0, 0, 0, 153, 0, + 147, 148, 146, 0, 0, 0, 0, 273, 0, 267, + 0, 268, 269, 0, 67, 252, 75, 88, 0, 0, + 124, 119, 0, 156, 137, 0, 0, 0, 140, 149, + 141, 279, 0, 277, 0, 0, 263, 270, 185, 76, + 0, 105, 158, 0, 0, 0, 0, 278, 0, 0, + 89, 152, 150, 151, 280, 0, 0, 0, 271, 272 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -369, -369, -369, -369, -369, 546, 197, -369, -369, -369, + -369, -369, -369, 50, 306, -369, 522, -369, -369, -369, + -369, 262, 44, -369, -369, 558, -369, -369, 403, -35, + 398, -369, -369, -206, -289, -369, -369, -262, -368, -312, + -369, 221, -106, -369, -369, -369, -369, -369, -369, -369, + -369, 224, 110, -369, -369, -369, -369, -369, 333, -369, + -369, -369, 336, -369, -369, 275, -369, -93, -369, -369, + 101, -369, -213, 293, -369, -369, 163, 158, -342, 83, + -369, -369, 287, 332, -303, 288, -369, 150, -369, -131, + -369, -369, -369, -369, -369, -369, 160, -369, -369, -369, + -369, -369, -369, 383, -369, -369, -369, -369, -369, 268, + -369, -2, 283, 142, 4, -32, -369, -369, -369, 519, + -369, 290, -369, -369, 108, -369, -369, 113, -369 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 17, 18, 19, 70, 20, 21, 22, 111, 23, + 63, 114, 184, 96, 147, 24, 45, 46, 25, 26, + 82, 27, 51, 52, 53, 54, 55, 97, 98, 102, + 224, 225, 275, 276, 277, 280, 341, 342, 343, 336, + 348, 411, 412, 28, 44, 29, 30, 31, 106, 283, + 353, 354, 356, 32, 109, 178, 181, 240, 241, 242, + 243, 244, 245, 303, 304, 373, 374, 148, 479, 480, + 481, 246, 291, 292, 293, 362, 363, 364, 261, 262, + 150, 151, 194, 195, 205, 206, 265, 324, 325, 152, + 153, 154, 155, 190, 191, 156, 413, 157, 158, 33, + 88, 166, 212, 213, 214, 215, 216, 217, 267, 250, + 34, 159, 38, 337, 161, 162, 35, 77, 78, 79, + 80, 253, 490, 491, 492, 384, 439, 440, 512 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 37, 40, 41, 379, 47, 36, 86, -41, 42, 41, + 62, 64, 196, 387, 385, 61, 201, 349, 399, 398, + 36, 36, 296, 105, 350, 36, 351, 36, 432, 433, + 409, 486, 36, 86, 36, 83, 475, 84, 476, 454, + 338, 248, 36, 249, 92, 401, 93, 94, 100, 86, + 477, 289, 100, 39, 60, 164, 100, 399, 36, 95, + 40, 410, 289, 271, 36, 431, 36, 331, 456, 176, + 175, 338, 41, 48, 49, 295, 179, 404, 117, 272, + 48, 49, 369, 454, 208, 163, 59, 349, 471, 36, + 449, 410, 452, 85, 350, 483, 351, 36, 182, 183, + 163, 208, 100, 107, 41, 209, 163, 81, 401, 260, + 177, 40, 112, 130, 131, 132, 133, 134, 135, 136, + 36, 137, 209, 81, 410, 502, 399, 196, 281, 402, + 101, 129, 7, 282, 352, 36, 494, 418, 478, 138, + 100, 197, 81, 496, 202, 487, 455, 81, 81, 56, + 81, 56, 56, 139, 388, 252, 520, 203, 453, 365, + 85, 72, 457, 185, 524, 525, 204, 301, 149, 100, + 196, 504, 222, 273, 81, 290, 268, 76, 40, 57, + -254, 40, -254, 519, 89, 163, 290, 536, 168, 339, + 81, 495, 462, 537, 448, 36, 284, 400, 81, 210, + 50, 56, 211, 110, 352, 50, 163, 50, 338, 375, + 99, 375, 188, 36, 103, 399, 210, 73, 103, 269, + 104, 40, 85, 189, 36, 460, 163, 317, 198, 199, + 239, 428, 75, 247, 174, 169, 81, 338, 40, 329, + 330, 305, 81, 81, 68, 81, 40, 306, 69, 140, + 472, 141, 90, 142, 101, 143, 197, 163, 144, 145, + 146, 368, 320, 87, 103, 108, 473, 43, 73, 163, + 163, 40, 497, 274, 503, 75, 65, 40, 320, 252, + 334, 81, 192, 357, 320, 335, 320, 264, 366, 113, + 239, 163, 36, 302, 510, 365, 252, 365, 310, 197, + 522, 229, 193, 230, 207, 458, 320, 218, 231, 163, + 232, 115, 320, 530, 458, 307, 233, 226, 234, 226, + 308, 235, 232, 274, 236, 320, 163, 165, 171, 340, + 234, 99, 40, 40, 532, 180, 40, 40, 172, 314, + 315, 187, 258, 149, 100, 414, 320, 533, 538, 323, + 438, 539, 259, 100, 218, 200, 311, -238, 116, 320, + 320, 321, 421, 320, 127, 278, 312, -238, 160, 426, + 128, 322, 81, 258, 523, 294, -239, 294, 170, 427, + 163, 311, 173, 434, 274, 274, -239, 499, 403, 340, + 526, 445, 130, 131, 132, 40, 407, 81, 40, 36, + 527, 408, 474, 389, 390, 40, 40, 286, 326, 100, + 66, 67, 160, 461, 287, 319, 167, 237, 100, 186, + 238, 344, 320, 160, 366, 204, 470, 219, 160, 160, + 223, 294, 163, 345, 435, 346, 436, 294, 429, 40, + 347, 437, 423, 36, 137, 430, 220, 274, 207, 40, + 274, 40, 228, 438, 383, 466, 254, 340, 340, 207, + 416, 417, 467, 130, 131, 132, 255, 256, 257, 285, + 251, 266, 279, 288, 332, 444, 333, 328, 355, 358, + 359, 360, 290, 163, 40, 160, 263, 160, 367, 40, + 370, 488, 130, 131, 132, 133, 134, 135, 136, 36, + 137, 340, 371, 340, 382, 464, 386, 391, 392, 393, + 207, 397, 405, 406, 424, 415, 425, 441, 138, 297, + 422, 1, 298, 446, 450, 323, 442, 447, 463, 451, + 484, 465, 139, 485, 500, 313, 514, 501, 518, 160, + 160, 488, 498, 160, 2, 505, 3, 506, 4, 160, + 327, 507, 5, 508, 6, 7, 8, 516, 9, 529, + 521, 531, 10, 535, 11, 71, 318, 58, 91, 12, + 13, 14, 15, 300, 221, 227, 420, 419, 482, 377, + 309, 509, 361, 489, 326, 376, 469, 376, 372, 468, + 316, 36, 493, 378, 380, 270, 394, 118, 513, 517, + 229, 381, 230, 160, 160, 0, 0, 231, 0, 232, + 36, 251, 395, 396, 0, 233, 207, 234, 0, 0, + 235, 0, 0, 236, 119, 120, 0, 121, 140, 0, + 0, 0, 142, 0, 143, 122, 0, 144, 145, 146, + 123, 0, 160, 0, 124, 0, 0, 0, 0, 125, + 0, 0, 126, 160, 160, 0, 0, 0, 2, 16, + 3, 0, 4, 0, 0, 0, 5, 0, 6, 7, + 8, 443, 9, 0, 0, 160, 10, 0, 11, 0, + 0, 0, 0, 12, 13, 14, 0, 74, 0, 0, + 0, 0, 0, 160, 0, 0, 459, 0, 0, 0, + 0, 0, 0, 0, 0, 160, 0, 0, 0, 0, + 0, 0, 0, 160, 0, 0, 237, 0, 0, 299, + 160, 0, 2, 0, 3, 160, 4, 0, 0, 0, + 5, 0, 6, 7, 8, 0, 9, 0, 0, 0, + 10, 0, 11, 0, 0, 0, 0, 12, 13, 14, + 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 0, 0, + 0, 515, 0, 16, 0, 0, 0, 0, 0, 0, + 0, 160, 0, 0, 0, 0, 0, 0, 0, 160, + 160, 0, 0, 0, 0, 0, 0, 528, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 534, + 0, 0, 160, 0, 0, 0, 0, 0, 160, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16 +}; + +static const yytype_int16 yycheck[] = +{ + 2, 3, 4, 306, 6, 13, 15, 13, 4, 11, + 12, 13, 143, 14, 317, 11, 14, 21, 4, 331, + 13, 13, 235, 58, 28, 13, 30, 13, 370, 371, + 342, 24, 13, 15, 13, 37, 36, 39, 38, 407, + 26, 139, 13, 141, 46, 334, 48, 49, 50, 15, + 50, 24, 54, 3, 10, 87, 58, 4, 13, 47, + 62, 40, 24, 27, 13, 368, 13, 273, 410, 104, + 102, 26, 74, 21, 22, 37, 108, 339, 74, 43, + 21, 22, 295, 451, 23, 87, 34, 21, 430, 13, + 402, 40, 404, 142, 28, 437, 30, 13, 138, 139, + 102, 23, 104, 59, 106, 44, 108, 156, 397, 142, + 106, 113, 62, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 44, 156, 40, 467, 4, 258, 140, 335, + 54, 145, 34, 145, 138, 13, 448, 141, 138, 32, + 142, 143, 156, 455, 142, 138, 408, 156, 156, 7, + 156, 9, 10, 46, 155, 187, 498, 155, 144, 290, + 142, 19, 141, 113, 506, 507, 148, 148, 85, 171, + 301, 474, 174, 144, 156, 148, 208, 35, 180, 11, + 146, 183, 148, 495, 42, 187, 148, 529, 146, 144, + 156, 453, 141, 535, 400, 13, 228, 144, 156, 138, + 148, 59, 141, 61, 138, 148, 208, 148, 26, 302, + 50, 304, 129, 13, 54, 4, 138, 20, 58, 141, + 20, 223, 142, 140, 13, 138, 228, 259, 145, 146, + 180, 145, 35, 183, 154, 146, 156, 26, 240, 271, + 272, 243, 156, 156, 0, 156, 248, 243, 0, 142, + 138, 144, 138, 146, 54, 148, 258, 259, 151, 152, + 153, 293, 150, 145, 104, 145, 138, 5, 71, 271, + 272, 273, 138, 223, 138, 78, 14, 279, 150, 311, + 139, 156, 140, 285, 150, 144, 150, 204, 290, 140, + 240, 293, 13, 243, 138, 426, 328, 428, 248, 301, + 138, 22, 142, 24, 162, 411, 150, 165, 29, 311, + 31, 138, 150, 138, 420, 24, 37, 175, 39, 177, + 29, 42, 31, 273, 45, 150, 328, 140, 139, 279, + 39, 171, 334, 335, 138, 140, 338, 339, 149, 256, + 257, 148, 139, 260, 346, 347, 150, 138, 138, 266, + 382, 138, 149, 355, 212, 143, 139, 139, 138, 150, + 150, 139, 146, 150, 81, 223, 149, 149, 85, 139, + 138, 149, 156, 139, 505, 233, 139, 235, 95, 149, + 382, 139, 99, 149, 334, 335, 149, 146, 338, 339, + 139, 149, 6, 7, 8, 397, 139, 156, 400, 13, + 149, 144, 434, 320, 321, 407, 408, 29, 266, 411, + 18, 19, 129, 415, 36, 143, 138, 138, 420, 138, + 141, 279, 150, 140, 426, 148, 428, 147, 145, 146, + 148, 289, 434, 138, 138, 140, 140, 295, 138, 441, + 145, 145, 359, 13, 14, 145, 147, 397, 306, 451, + 400, 453, 139, 485, 312, 138, 138, 407, 408, 317, + 350, 351, 145, 6, 7, 8, 143, 139, 147, 145, + 187, 146, 146, 52, 13, 392, 149, 148, 140, 36, + 145, 11, 148, 485, 486, 202, 203, 204, 14, 491, + 145, 441, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 451, 145, 453, 145, 422, 143, 147, 139, 138, + 368, 139, 13, 147, 138, 145, 14, 140, 32, 236, + 145, 0, 239, 138, 13, 442, 146, 138, 147, 139, + 148, 138, 46, 139, 138, 252, 486, 138, 147, 256, + 257, 491, 145, 260, 23, 145, 25, 145, 27, 266, + 267, 145, 31, 141, 33, 34, 35, 141, 37, 145, + 147, 138, 41, 145, 43, 19, 260, 9, 46, 48, + 49, 50, 51, 240, 171, 177, 355, 353, 436, 304, + 244, 480, 289, 441, 442, 302, 428, 304, 301, 426, + 258, 13, 442, 305, 311, 212, 328, 78, 485, 491, + 22, 311, 24, 320, 321, -1, -1, 29, -1, 31, + 13, 328, 329, 330, -1, 37, 474, 39, -1, -1, + 42, -1, -1, 45, 27, 28, -1, 30, 142, -1, + -1, -1, 146, -1, 148, 38, -1, 151, 152, 153, + 43, -1, 359, -1, 47, -1, -1, -1, -1, 52, + -1, -1, 55, 370, 371, -1, -1, -1, 23, 138, + 25, -1, 27, -1, -1, -1, 31, -1, 33, 34, + 35, 388, 37, -1, -1, 392, 41, -1, 43, -1, + -1, -1, -1, 48, 49, 50, -1, 52, -1, -1, + -1, -1, -1, 410, -1, -1, 413, -1, -1, -1, + -1, -1, -1, -1, -1, 422, -1, -1, -1, -1, + -1, -1, -1, 430, -1, -1, 138, -1, -1, 141, + 437, -1, 23, -1, 25, 442, 27, -1, -1, -1, + 31, -1, 33, 34, 35, -1, 37, -1, -1, -1, + 41, -1, 43, -1, -1, -1, -1, 48, 49, 50, + 467, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 484, -1, -1, + -1, 488, -1, 138, -1, -1, -1, -1, -1, -1, + -1, 498, -1, -1, -1, -1, -1, -1, -1, 506, + 507, -1, -1, -1, -1, -1, -1, 514, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 526, + -1, -1, 529, -1, -1, -1, -1, -1, 535, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 138 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_int16 yystos[] = +{ + 0, 0, 23, 25, 27, 31, 33, 34, 35, 37, + 41, 43, 48, 49, 50, 51, 138, 158, 159, 160, + 162, 163, 164, 166, 172, 175, 176, 178, 200, 202, + 203, 204, 210, 256, 267, 273, 13, 268, 269, 170, + 268, 268, 271, 178, 201, 173, 174, 268, 21, 22, + 148, 179, 180, 181, 182, 183, 270, 11, 182, 34, + 179, 271, 268, 167, 268, 178, 18, 19, 0, 0, + 161, 162, 270, 163, 52, 163, 270, 274, 275, 276, + 277, 156, 177, 268, 268, 142, 15, 145, 257, 270, + 138, 173, 268, 268, 268, 47, 170, 184, 185, 253, + 268, 54, 186, 253, 20, 186, 205, 179, 145, 211, + 270, 165, 170, 140, 168, 138, 138, 271, 276, 27, + 28, 30, 38, 43, 47, 52, 55, 269, 138, 145, + 6, 7, 8, 9, 10, 11, 12, 14, 32, 46, + 142, 144, 146, 148, 151, 152, 153, 171, 224, 236, + 237, 238, 246, 247, 248, 249, 252, 254, 255, 268, + 269, 271, 272, 268, 272, 140, 258, 138, 146, 146, + 269, 139, 149, 269, 154, 272, 186, 271, 212, 272, + 140, 213, 138, 139, 169, 170, 138, 148, 236, 236, + 250, 251, 270, 253, 239, 240, 246, 268, 236, 236, + 143, 14, 142, 155, 148, 241, 242, 270, 23, 44, + 138, 141, 259, 260, 261, 262, 263, 264, 270, 147, + 147, 185, 268, 148, 187, 188, 270, 187, 139, 22, + 24, 29, 31, 37, 39, 42, 45, 138, 141, 170, + 214, 215, 216, 217, 218, 219, 228, 170, 139, 141, + 266, 269, 272, 278, 138, 143, 139, 147, 139, 149, + 142, 235, 236, 269, 236, 243, 146, 265, 272, 141, + 260, 27, 43, 144, 170, 189, 190, 191, 270, 146, + 192, 140, 145, 206, 272, 145, 29, 36, 52, 24, + 148, 229, 230, 231, 270, 37, 229, 269, 269, 141, + 215, 148, 170, 220, 221, 268, 271, 24, 29, 219, + 170, 139, 149, 269, 236, 236, 240, 272, 171, 143, + 150, 139, 149, 236, 244, 245, 270, 269, 148, 272, + 272, 190, 13, 149, 139, 144, 196, 270, 26, 144, + 170, 193, 194, 195, 270, 138, 140, 145, 197, 21, + 28, 30, 138, 207, 208, 140, 209, 268, 36, 145, + 11, 230, 232, 233, 234, 246, 268, 14, 272, 229, + 145, 145, 239, 222, 223, 224, 269, 222, 242, 241, + 269, 278, 145, 270, 282, 241, 143, 14, 155, 236, + 236, 147, 139, 138, 266, 269, 269, 139, 196, 4, + 144, 191, 190, 170, 194, 13, 147, 139, 144, 196, + 40, 198, 199, 253, 268, 145, 209, 209, 141, 208, + 198, 146, 145, 236, 138, 14, 139, 149, 145, 138, + 145, 241, 235, 235, 149, 138, 140, 145, 272, 283, + 284, 140, 146, 269, 236, 149, 138, 138, 190, 196, + 13, 139, 196, 144, 195, 194, 235, 141, 199, 269, + 138, 268, 141, 147, 236, 138, 138, 145, 233, 234, + 268, 235, 138, 138, 272, 36, 38, 50, 138, 225, + 226, 227, 270, 235, 148, 139, 24, 138, 170, 270, + 279, 280, 281, 244, 196, 194, 196, 138, 145, 146, + 138, 138, 235, 138, 241, 145, 145, 145, 141, 227, + 138, 269, 285, 284, 170, 269, 141, 281, 147, 196, + 235, 147, 138, 246, 235, 235, 139, 149, 269, 145, + 138, 138, 138, 138, 269, 145, 235, 235, 138, 138 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_int16 yyr1[] = +{ + 0, 157, 158, 158, 159, 159, 159, 160, 161, 161, + 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, + 163, 163, 163, 163, 163, 163, 164, 165, 165, 166, + 167, 168, 169, 169, 170, 170, 171, 171, 172, 172, + 173, 174, 175, 176, 177, 178, 179, 179, 179, 180, + 181, 182, 182, 183, 184, 184, 185, 185, 186, 186, + 187, 187, 188, 189, 189, 189, 189, 189, 190, 190, + 191, 192, 193, 193, 193, 193, 193, 194, 194, 195, + 195, 196, 196, 197, 197, 197, 198, 198, 199, 199, + 200, 201, 202, 202, 203, 204, 205, 205, 206, 206, + 207, 207, 208, 208, 208, 208, 209, 210, 211, 211, + 212, 212, 213, 213, 214, 214, 215, 215, 215, 215, + 215, 215, 215, 215, 215, 215, 216, 216, 217, 217, + 218, 218, 219, 219, 219, 220, 220, 221, 221, 221, + 222, 222, 222, 223, 223, 224, 225, 225, 226, 226, + 227, 227, 227, 227, 228, 229, 229, 229, 229, 230, + 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, + 236, 236, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 238, 238, 239, 239, 240, + 240, 240, 241, 241, 242, 243, 243, 244, 244, 245, + 245, 246, 246, 246, 247, 247, 248, 248, 249, 250, + 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, + 255, 256, 257, 257, 258, 258, 259, 259, 260, 260, + 260, 260, 261, 261, 262, 263, 264, 265, 266, 266, + 267, 268, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 269, 270, 271, 272, 272, 273, 274, 274, 275, + 275, 276, 276, 277, 266, 266, 278, 279, 279, 280, + 280, 281, 281, 281, 282, 282, 283, 283, 284, 285, + 285 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_int8 yyr2[] = +{ + 0, 2, 1, 2, 1, 2, 2, 3, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 4, 1, 3, 4, + 1, 3, 1, 3, 1, 4, 1, 1, 3, 4, + 1, 1, 6, 4, 1, 2, 1, 1, 6, 4, + 4, 1, 1, 3, 1, 3, 2, 2, 1, 1, + 1, 1, 3, 1, 2, 3, 4, 5, 1, 3, + 2, 3, 1, 2, 3, 4, 5, 1, 3, 2, + 3, 1, 2, 1, 3, 3, 1, 2, 3, 5, + 2, 1, 2, 3, 2, 6, 1, 2, 2, 3, + 1, 2, 1, 2, 2, 5, 3, 4, 1, 2, + 1, 3, 3, 2, 1, 2, 1, 2, 5, 6, + 2, 2, 3, 1, 6, 1, 5, 5, 1, 2, + 1, 2, 1, 1, 1, 2, 2, 5, 2, 2, + 4, 4, 2, 1, 1, 1, 1, 1, 1, 2, + 4, 4, 4, 1, 4, 3, 5, 4, 6, 3, + 1, 3, 1, 3, 3, 1, 1, 1, 1, 3, + 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 1, 1, 8, 5, 1, 3, 1, + 4, 1, 1, 1, 3, 1, 3, 1, 1, 1, + 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 3, 1, 1, 1, 3, 3, 2, 6, + 5, 4, 1, 2, 2, 3, 1, 2, 1, 1, + 1, 1, 1, 1, 5, 5, 4, 4, 1, 3, + 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 0, 2, 1, 1, 3, 1, 1, 1, + 2, 1, 1, 9, 1, 3, 2, 1, 1, 1, + 2, 5, 6, 1, 1, 2, 1, 3, 4, 1, + 3 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, ctx, root, errors, sb, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) + + +/* Enable debugging if requested. */ +#if KDBTEXT_DEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined KDBTEXT_LTYPE_IS_TRIVIAL && KDBTEXT_LTYPE_IS_TRIVIAL + +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ + +YY_ATTRIBUTE_UNUSED +static int +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) +{ + int res = 0; + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; + if (0 <= yylocp->first_line) + { + res += YYFPRINTF (yyo, "%d", yylocp->first_line); + if (0 <= yylocp->first_column) + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); + } + if (0 <= yylocp->last_line) + { + if (yylocp->first_line < yylocp->last_line) + { + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); + if (0 <= end_col) + res += YYFPRINTF (yyo, ".%d", end_col); + } + else if (0 <= end_col && yylocp->first_column < end_col) + res += YYFPRINTF (yyo, "-%d", end_col); + } + return res; + } + +# define YY_LOCATION_PRINT(File, Loc) \ + yy_location_print_ (File, &(Loc)) + +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, ctx, root, errors, sb); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) +{ + FILE *yyoutput = yyo; + YYUSE (yyoutput); + YYUSE (yylocationp); + YYUSE (ctx); + YYUSE (root); + YYUSE (errors); + YYUSE (sb); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); +# endif + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ + +static void +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) +{ + YYFPRINTF (yyo, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + YY_LOCATION_PRINT (yyo, *yylocationp); + YYFPRINTF (yyo, ": "); + yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, ctx, root, errors, sb); + YYFPRINTF (yyo, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) +{ + int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[+yyssp[yyi + 1 - yynrhs]], + &yyvsp[(yyi + 1) - (yynrhs)] + , &(yylsp[(yyi + 1) - (yynrhs)]) , ctx, root, errors, sb); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule, ctx, root, errors, sb); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !KDBTEXT_DEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !KDBTEXT_DEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) +# else +/* Return the length of YYSTR. */ +static YYPTRDIFF_T +yystrlen (const char *yystr) +{ + YYPTRDIFF_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYPTRDIFF_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYPTRDIFF_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + else + goto append; + + append: + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else + return yystrlen (yystr); +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int yytoken) +{ + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Actual size of YYARG. */ + int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[+*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return 2; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + default: /* Avoid compiler warnings. */ + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return 2; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + ++yyp; + ++yyformat; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (ctx); + YYUSE (root); + YYUSE (errors); + YYUSE (sb); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + switch (yytype) + { + case 0: /* "end of source" */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 3: /* UNRECOGNIZED */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 4: /* ELLIPSIS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 5: /* INCREMENT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 6: /* DECIMAL */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 7: /* OCTAL */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 8: /* HEX */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 9: /* FLOAT_ */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 10: /* EXP_FLOAT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 11: /* STRING */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 12: /* ESCAPED_STRING */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 13: /* IDENTIFIER_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 14: /* PHYSICAL_IDENTIFIER_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 15: /* VERSION */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 16: /* UNTERM_STRING */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 17: /* UNTERM_ESCAPED_STRING */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 18: /* VERS_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 19: /* VERS_2_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 20: /* KW___no_header */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 21: /* KW___row_length */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 22: /* KW___untyped */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 23: /* KW_alias */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 24: /* KW_column */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 25: /* KW_const */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 26: /* KW_control */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 27: /* KW_database */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 28: /* KW_decode */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 29: /* KW_default */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 30: /* KW_encode */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 31: /* KW_extern */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 32: /* KW_false */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 33: /* KW_fmtdef */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 34: /* KW_function */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 35: /* KW_include */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 36: /* KW_limit */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 37: /* KW_physical */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 38: /* KW_read */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 39: /* KW_readonly */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 40: /* KW_return */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 41: /* KW_kdbtext */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 42: /* KW_static */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 43: /* KW_table */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 44: /* KW_template */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 45: /* KW_trigger */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 46: /* KW_true */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 47: /* KW_type */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 48: /* KW_typedef */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 49: /* KW_typeset */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 50: /* KW_validate */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 51: /* KW_version */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 52: /* KW_view */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 53: /* KW_virtual */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 54: /* KW_void */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 55: /* KW_write */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 56: /* PT_ASTLIST */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 57: /* PT_PARSE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 58: /* PT_SOURCE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 59: /* PT_VERSION_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 60: /* PT_VERSION_2 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 61: /* PT_SCHEMA_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 62: /* PT_SCHEMA_2_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 63: /* PT_INCLUDE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 64: /* PT_TYPEDEF */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 65: /* PT_FQN */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 66: /* PT_IDENT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 67: /* PT_PHYSIDENT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 68: /* PT_UINT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 69: /* PT_TYPESET */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 70: /* PT_TYPESETDEF */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 71: /* PT_FORMAT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 72: /* PT_CONST */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 73: /* PT_ALIAS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 74: /* PT_EXTERN */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 75: /* PT_FUNCTION */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 76: /* PT_UNTYPED */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 77: /* PT_ROWLENGTH */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 78: /* PT_FUNCDECL */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 79: /* PT_EMPTY */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 80: /* PT_SCHEMASIG */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 81: /* PT_SCHEMAFORMAL */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 82: /* PT_RETURNTYPE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 83: /* PT_FACTSIG */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 84: /* PT_FUNCSIG */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 85: /* PT_FUNCPARAMS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 86: /* PT_FORMALPARAM */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 87: /* PT_ELLIPSIS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 88: /* PT_FUNCPROLOGUE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 89: /* PT_RETURN */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 90: /* PT_PRODSTMT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 91: /* PT_PRODTRIGGER */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 92: /* PT_SCHEMA */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 93: /* PT_VALIDATE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 94: /* PT_PHYSICAL */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 95: /* PT_PHYSPROLOGUE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 96: /* PT_PHYSSTMT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 97: /* PT_PHYSBODYSTMT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 98: /* PT_TABLE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 99: /* PT_TABLEPARENTS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 100: /* PT_TABLEBODY */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 101: /* PT_FUNCEXPR */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 102: /* PT_FACTPARMS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 103: /* PT_COLUMN */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 104: /* PT_COLUMNEXPR */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 105: /* PT_COLDECL */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 106: /* PT_TYPEDCOL */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 107: /* PT_COLSTMT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 108: /* PT_DFLTVIEW */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 109: /* PT_PHYSMBR */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 110: /* PT_PHYSCOL */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 111: /* PT_PHYSCOLDEF */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 112: /* PT_COLSCHEMAPARMS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 113: /* PT_COLSCHEMAPARAM */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 114: /* PT_COLUNTYPED */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 115: /* PT_DATABASE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 116: /* PT_TYPEEXPR */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 117: /* PT_DBBODY */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 118: /* PT_DBDAD */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 119: /* PT_DBMEMBER */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 120: /* PT_TBLMEMBER */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 121: /* PT_NOHEADER */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 122: /* PT_CASTEXPR */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 123: /* PT_CONSTVECT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 124: /* PT_NEGATE */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 125: /* PT_UNARYPLUS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 126: /* PT_VERSNAME */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 127: /* PT_ARRAY */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 128: /* PT_PHYSENCREF */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 129: /* PT_TYPEDCOLEXPR */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 130: /* PT_VIEW */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 131: /* PT_VIEWPARAM */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 132: /* PT_VIEWPARENTS */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 133: /* PT_VIEWPARENT */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 134: /* PT_MEMBEREXPR */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 135: /* PT_JOINEXPR */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 136: /* PT_ALIASMEMBER */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 137: /* PT_VIEWSPEC */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 138: /* ';' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 139: /* ',' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 140: /* '{' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 141: /* '}' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 142: /* '[' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 143: /* ']' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 144: /* '*' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 145: /* '=' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 146: /* '(' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 147: /* ')' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 148: /* '<' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 149: /* '>' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 150: /* '|' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 151: /* '@' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 152: /* '-' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 153: /* '+' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 154: /* '/' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 155: /* '.' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 156: /* ':' */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 158: /* parse */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 159: /* source */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 160: /* version_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 161: /* kdbtext_1_0_opt */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 162: /* kdbtext_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 163: /* kdbtext_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 164: /* typedef_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 165: /* typedef_1_0_new_name_list */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 166: /* typeset_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 167: /* typeset_1_0_new_name */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 168: /* typeset_1_0_def */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 169: /* typespec_1_0_list */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 170: /* typespec_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 171: /* dim_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 172: /* format_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 173: /* format_1_0_new_name */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 174: /* format_1_0_name */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 175: /* const_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 176: /* alias_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 177: /* alias_1_0_new_name */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 178: /* function_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 179: /* func_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 180: /* untyped_func_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 181: /* row_length_func_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 182: /* opt_func_1_0_kdbtext_sig */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 183: /* func_1_0_kdbtext_sig */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 184: /* func_1_0_kdbtext_formals */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 185: /* func_1_0_kdbtext_formal */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 186: /* func_1_0_return_type */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 187: /* opt_func_1_0_fact_sig */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 188: /* func_1_0_fact_sig */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 189: /* func_1_0_fact_signature */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 190: /* func_1_0_fact_params */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 191: /* fact_param_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 192: /* func_1_0_param_sig */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 193: /* func_1_0_param_signature */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 194: /* func_1_0_formal_params */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 195: /* formal_param_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 196: /* func_1_0_vararg_formals */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 197: /* func_1_0_prologue */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 198: /* script_1_0_stmt_seq */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 199: /* script_1_0_stmt */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 200: /* extern_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 201: /* ext_func_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 202: /* script_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 203: /* validate_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 204: /* physical_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 205: /* phys_1_0_return_type */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 206: /* phys_1_0_prologue */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 207: /* phys_1_0_body */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 208: /* phys_1_0_body_stmt */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 209: /* phys_1_0_stmt */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 210: /* table_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 211: /* opt_tbl_1_0_parents */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 212: /* tbl_1_0_parents */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 213: /* tbl_1_0_body */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 214: /* tbl_1_0_stmt_seq */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 215: /* tbl_1_0_stmt */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 216: /* production_1_0_stmt */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 217: /* col_1_0_modifiers */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 218: /* col_1_0_modifier_seq */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 219: /* col_1_0_modifier */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 220: /* col_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 221: /* phys_enc_ref */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 222: /* typed_column_decl_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 223: /* col_ident */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 224: /* phys_ident */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 225: /* opt_column_body_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 226: /* column_body_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 227: /* column_stmt_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 228: /* default_view_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 229: /* physmbr_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 230: /* phys_coldef_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 231: /* opt_col_kdbtext_parms_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 232: /* col_kdbtext_parms_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 233: /* col_kdbtext_parm_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 234: /* col_kdbtext_value_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 235: /* cond_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 236: /* expression_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 237: /* primary_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 238: /* func_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 239: /* kdbtext_parms_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 240: /* kdbtext_parm_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 241: /* opt_factory_parms_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 242: /* factory_parms_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 243: /* factory_parms */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 244: /* opt_func_1_0_parms */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 245: /* func_1_0_parms */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 246: /* uint_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 247: /* float_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 248: /* string_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 249: /* const_vect_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 250: /* opt_const_vect_exprlist_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 251: /* const_vect_exprlist_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 252: /* bool_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 253: /* type_expr_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 254: /* member_expr_2_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 255: /* join_expr_2_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 256: /* database_1_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 257: /* opt_database_dad_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 258: /* database_body_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 259: /* database_members_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 260: /* database_member_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 261: /* opt_template_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 262: /* db_member_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 263: /* table_member_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 264: /* alias_member_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 265: /* view_spec */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 266: /* view_parms */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 267: /* include_directive */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 268: /* fqn_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 269: /* ident_1_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 270: /* empty */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 271: /* fqn_vers */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 272: /* fqn_opt_vers */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 273: /* version_2_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 274: /* kdbtext_2_0_opt */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 275: /* kdbtext_2_0 */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 276: /* kdbtext_2_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 277: /* view_2_0_decl */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 278: /* view_parm */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 279: /* opt_view_body */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 280: /* view_body */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 281: /* view_member */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 282: /* opt_view_parents */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 283: /* view_parents */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 284: /* view_parent */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + case 285: /* view_parent_parms */ + { + if ( (*yyvaluep) . subtree != NULL ) + { + ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); + } + else + { /* terminal; release associated whitespace */ + free ( (*yyvaluep) . leading_ws ); + } +} + break; + + default: + break; + } + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) +{ +/* The lookahead symbol. */ +int yychar; + + +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + +/* Location data for the lookahead symbol. */ +static YYLTYPE yyloc_default +# if defined KDBTEXT_LTYPE_IS_TRIVIAL && KDBTEXT_LTYPE_IS_TRIVIAL + = { 1, 1, 1, 1 } +# endif +; +YYLTYPE yylloc = yyloc_default; + + /* Number of syntax errors so far. */ + int yynerrs; + + yy_state_fast_t yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + 'yyls': related to locations. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + YYPTRDIFF_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yylsp = yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + yylsp[0] = yylloc; + goto yysetstate; + + +/*------------------------------------------------------------. +| yynewstate -- push a new state, which is found in yystate. | +`------------------------------------------------------------*/ +yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + + if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else + { + /* Get the current used size of the three stacks, in elements. */ + YYPTRDIFF_T yysize = yyssp - yyss + 1; + +# if defined yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + yy_state_t *yyss1 = yyss; + YYSTYPE *yyvs1 = yyvs; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yyls1, yysize * YYSIZEOF (*yylsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; + yyls = yyls1; + } +# else /* defined YYSTACK_RELOCATE */ + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, &yylloc, sb); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + *++yylsp = yylloc; + + /* Discard the shifted token. */ + yychar = YYEMPTY; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + yyerror_range[1] = yyloc; + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + { *root = MakeTree ( ctx, PT_PARSE, T ( ctx, yyvsp[0] ) ); yyval . subtree = 0; yyval . leading_ws = 0; } + break; + + case 3: + { *root = MakeTree ( ctx, PT_PARSE, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); yyval . subtree = 0; yyval . leading_ws = 0; } + break; + + case 4: + { yyval . subtree = MakeTree ( ctx, PT_SOURCE, P ( yyvsp[0] ) ); } + break; + + case 5: + { yyval . subtree = MakeTree ( ctx, PT_SOURCE, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 6: + { yyval . subtree = MakeTree ( ctx, PT_SOURCE, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 7: + { yyval . subtree = MakeTree ( ctx, PT_VERSION_1_0, T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 8: + { yyval . subtree = P ( yyvsp[0] ); } + break; + + case 9: + { yyval = yyvsp[0]; } + break; + + case 10: + { yyval . subtree = MakeTree ( ctx, PT_SCHEMA_1_0, P ( yyvsp[0] ) ); } + break; + + case 11: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ) , P ( yyvsp[0] ) ); } + break; + + case 12: + { yyval = yyvsp[0]; } + break; + + case 13: + { yyval = yyvsp[0]; } + break; + + case 14: + { yyval = yyvsp[0]; } + break; + + case 15: + { yyval = yyvsp[0]; } + break; + + case 16: + { yyval = yyvsp[0]; } + break; + + case 17: + { yyval = yyvsp[0]; } + break; + + case 18: + { yyval = yyvsp[0]; } + break; + + case 19: + { yyval = yyvsp[0]; } + break; + + case 20: + { yyval = yyvsp[0]; } + break; + + case 21: + { yyval = yyvsp[0]; } + break; + + case 22: + { yyval = yyvsp[0]; } + break; + + case 23: + { yyval = yyvsp[0]; } + break; + + case 24: + { yyval = yyvsp[0]; } + break; + + case 25: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 26: + { yyval . subtree = MakeTree ( ctx, PT_TYPEDEF, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 27: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 28: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 29: + { yyval . subtree = MakeTree ( ctx, PT_TYPESET, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 30: + { yyval = yyvsp[0]; } + break; + + case 31: + { yyval . subtree = MakeTree ( ctx, PT_TYPESETDEF, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 32: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 33: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 34: + { yyval = yyvsp[0]; } + break; + + case 35: + { yyval . subtree = MakeTree ( ctx, PT_ARRAY, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 36: + { yyval = yyvsp[0]; } + break; + + case 37: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 38: + { yyval . subtree = MakeTree ( ctx, PT_FORMAT, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 39: + { yyval . subtree = MakeTree ( ctx, PT_FORMAT, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 40: + { yyval = yyvsp[0]; } + break; + + case 41: + { yyval = yyvsp[0]; } + break; + + case 42: + { yyval . subtree = MakeTree ( ctx, PT_CONST, T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 43: + { yyval . subtree = MakeTree ( ctx, PT_ALIAS, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 44: + { yyval = yyvsp[0]; } + break; + + case 45: + { yyval . subtree = MakeTree ( ctx, PT_FUNCTION, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 46: + { yyval = yyvsp[0]; } + break; + + case 47: + { yyval = yyvsp[0]; } + break; + + case 48: + { yyval . subtree = MakeTree ( ctx, PT_FUNCDECL, P ( yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 49: + { yyval . subtree = MakeTree ( ctx, PT_UNTYPED, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 50: + { yyval . subtree = MakeTree ( ctx, PT_ROWLENGTH, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 51: + { yyval = yyvsp[0]; } + break; + + case 52: + { yyval = yyvsp[0]; } + break; + + case 53: + { yyval . subtree = MakeTree ( ctx, PT_SCHEMASIG, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 54: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 55: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 56: + { yyval . subtree = MakeTree ( ctx, PT_SCHEMAFORMAL, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 57: + { yyval . subtree = MakeTree ( ctx, PT_SCHEMAFORMAL, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 58: + { yyval . subtree = MakeTree ( ctx, PT_RETURNTYPE, T ( ctx, yyvsp[0] ) ); } + break; + + case 59: + { yyval . subtree = MakeTree ( ctx, PT_RETURNTYPE, P ( yyvsp[0] ) ); } + break; + + case 60: + { yyval = yyvsp[0]; } + break; + + case 61: + { yyval = yyvsp[0]; } + break; + + case 62: + { yyval . subtree = MakeTree ( ctx, PT_FACTSIG, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 63: + { yyval = yyvsp[0]; } + break; + + case 64: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 65: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 66: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 67: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 68: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 69: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 70: + { yyval . subtree = MakeTree ( ctx, PT_FORMALPARAM, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 71: + { yyval . subtree = MakeTree ( ctx, PT_FUNCSIG, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 72: + { yyval = yyvsp[0]; } + break; + + case 73: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 74: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 75: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 76: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 77: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 78: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 79: + { yyval . subtree = MakeTree ( ctx, PT_FORMALPARAM, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 80: + { yyval . subtree = MakeTree ( ctx, PT_FORMALPARAM, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 81: + { yyval = yyvsp[0]; } + break; + + case 82: + { yyval . subtree = MakeTree ( ctx, PT_ELLIPSIS, T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 83: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, yyvsp[0] ) ); } + break; + + case 84: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 85: + { yyval . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 86: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 87: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 88: + { yyval . subtree = MakeTree ( ctx, PT_RETURN, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 89: + { yyval . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 90: + { yyval . subtree = MakeTree ( ctx, PT_EXTERN, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 91: + { yyval = yyvsp[0]; } + break; + + case 92: + { yyval . subtree = MakeTree ( ctx, PT_SCHEMA, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 93: + { yyval . subtree = MakeTree ( ctx, PT_SCHEMA, T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 94: + { yyval . subtree = MakeTree ( ctx, PT_VALIDATE, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 95: + { yyval . subtree = MakeTree ( ctx, PT_PHYSICAL, T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 96: + { yyval = yyvsp[0]; } + break; + + case 97: + { yyval . subtree = MakeTree ( ctx, PT_NOHEADER, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 98: + { yyval . subtree = MakeTree ( ctx, PT_PHYSPROLOGUE, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 99: + { yyval . subtree = MakeTree ( ctx, PT_PHYSPROLOGUE, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 100: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 101: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 102: + { yyval . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, yyvsp[0] ) ); } + break; + + case 103: + { yyval . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 104: + { yyval . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 105: + { yyval . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, yyvsp[-4] ), T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 106: + { yyval . subtree = MakeTree ( ctx, PT_PHYSSTMT, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 107: + { yyval . subtree = MakeTree ( ctx, PT_TABLE, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 108: + { yyval = yyvsp[0]; } + break; + + case 109: + { yyval . subtree = MakeTree ( ctx, PT_TABLEPARENTS, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 110: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 111: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 112: + { yyval . subtree = MakeTree ( ctx, PT_TABLEBODY, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 113: + { yyval . subtree = MakeTree ( ctx, PT_TABLEBODY, T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 114: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 115: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 116: + { yyval = yyvsp[0]; } + break; + + case 117: + { yyval . subtree = MakeTree ( ctx, PT_COLUMN, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 118: + { yyval . subtree = MakeTree ( ctx, PT_COLUMNEXPR, T ( ctx, yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 119: + { yyval . subtree = MakeTree ( ctx, PT_COLUMNEXPR, T ( ctx, yyvsp[-5] ), T ( ctx, yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 120: + { yyval . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 121: + { yyval . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 122: + { yyval . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 123: + { yyval = yyvsp[0]; } + break; + + case 124: + { yyval . subtree = MakeTree ( ctx, PT_COLUNTYPED, T ( ctx, yyvsp[-5] ), T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 125: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 126: + { yyval . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 127: + { yyval . subtree = MakeTree ( ctx, PT_PRODTRIGGER, T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 128: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 129: + { yyval = yyvsp[-1]; AddToList ( ctx, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 130: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 131: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 132: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 133: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 134: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 135: + { yyval . subtree = MakeTree ( ctx, PT_COLDECL, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 136: + { yyval . subtree = MakeTree ( ctx, PT_COLDECL, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 137: + { yyval . subtree = MakeTree ( ctx, PT_PHYSENCREF, T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 138: + { yyval . subtree = MakeTree ( ctx, PT_PHYSENCREF, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 139: + { yyval . subtree = MakeTree ( ctx, PT_PHYSENCREF, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 140: + { yyval . subtree = MakeTree ( ctx, PT_TYPEDCOL, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 141: + { yyval . subtree = MakeTree ( ctx, PT_TYPEDCOLEXPR, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 142: + { yyval . subtree = MakeTree ( ctx, PT_TYPEDCOL, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 143: + { yyval = yyvsp[0]; } + break; + + case 144: + { yyval = yyvsp[0]; } + break; + + case 145: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 146: + { yyval = yyvsp[0]; } + break; + + case 147: + { yyval = yyvsp[0]; } + break; + + case 148: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 149: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 150: + { yyval . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 151: + { yyval . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 152: + { yyval . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 153: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 154: + { yyval . subtree = MakeTree ( ctx, PT_DFLTVIEW, T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 155: + { yyval . subtree = MakeTree ( ctx, PT_PHYSMBR, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 156: + { yyval . subtree = MakeTree ( ctx, PT_PHYSMBR, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 157: + { yyval . subtree = MakeTree ( ctx, PT_PHYSMBR, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 158: + { yyval . subtree = MakeTree ( ctx, PT_PHYSMBR, T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 159: + { yyval . subtree = MakeTree ( ctx, PT_PHYSCOLDEF, P ( yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 160: + { yyval = yyvsp[0]; } + break; + + case 161: + { yyval . subtree = MakeTree ( ctx, PT_COLSCHEMAPARMS, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 162: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 163: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 164: + { yyval . subtree = MakeTree ( ctx, PT_COLSCHEMAPARAM, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 165: + { yyval = yyvsp[0]; } + break; + + case 166: + { yyval = yyvsp[0]; } + break; + + case 167: + { yyval = yyvsp[0]; } + break; + + case 168: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 169: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 170: + { yyval = yyvsp[0]; } + break; + + case 171: + { yyval . subtree = MakeTree ( ctx, PT_CASTEXPR, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 172: + { yyval = yyvsp[0]; } + break; + + case 173: + { yyval = yyvsp[0]; } + break; + + case 174: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 175: + { yyval = yyvsp[0]; } + break; + + case 176: + { yyval = yyvsp[0]; } + break; + + case 177: + { yyval = yyvsp[0]; } + break; + + case 178: + { yyval = yyvsp[0]; } + break; + + case 179: + { yyval = yyvsp[0]; } + break; + + case 180: + { yyval = yyvsp[0]; } + break; + + case 181: + { yyval . subtree = MakeTree ( ctx, PT_NEGATE, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 182: + { yyval . subtree = MakeTree ( ctx, PT_UNARYPLUS, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 183: + { yyval = yyvsp[0]; } + break; + + case 184: + { yyval = yyvsp[0]; } + break; + + case 185: + { yyval . subtree = MakeTree ( ctx, PT_FUNCEXPR, T ( ctx, yyvsp[-7] ), P ( yyvsp[-6] ), T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 186: + { yyval . subtree = MakeTree ( ctx, PT_FUNCEXPR, P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 187: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 188: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 189: + { yyval = yyvsp[0]; } + break; + + case 190: + { yyval . subtree = MakeTree ( ctx, PT_ARRAY, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 191: + { yyval = yyvsp[0]; } + break; + + case 192: + { yyval = yyvsp[0]; } + break; + + case 193: + { yyval = yyvsp[0]; } + break; + + case 194: + { yyval . subtree = MakeTree ( ctx, PT_FACTPARMS, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 195: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 196: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 197: + { yyval = yyvsp[0]; } + break; + + case 198: + { yyval = yyvsp[0]; } + break; + + case 199: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 200: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 201: + { yyval . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, yyvsp[0] ) ); } + break; + + case 202: + { yyval . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, yyvsp[0] ) ); } + break; + + case 203: + { yyval . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, yyvsp[0] ) ); } + break; + + case 204: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 205: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 206: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 207: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 208: + { yyval . subtree = MakeTree ( ctx, PT_CONSTVECT, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 209: + { yyval = yyvsp[0]; } + break; + + case 210: + { yyval = yyvsp[0]; } + break; + + case 211: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 212: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 213: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 214: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 215: + { yyval = yyvsp[0]; } + break; + + case 216: + { yyval . subtree = MakeTree ( ctx, PT_TYPEEXPR, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1]), P ( yyvsp[0] ) ); } + break; + + case 217: + { yyval . subtree = MakeTree ( ctx, PT_MEMBEREXPR, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 218: + { yyval . subtree = MakeTree ( ctx, PT_MEMBEREXPR, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 219: + { yyval . subtree = MakeTree ( ctx, PT_JOINEXPR, P ( yyvsp[-5] ), T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P (yyvsp[0] ) ); } + break; + + case 220: + { yyval . subtree = MakeTree ( ctx, PT_JOINEXPR, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 221: + { yyval . subtree = MakeTree ( ctx, PT_DATABASE, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2]), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 222: + { yyval = yyvsp[0]; } + break; + + case 223: + { yyval . subtree = MakeTree ( ctx, PT_DBDAD, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 224: + { yyval . subtree = MakeTree ( ctx, PT_DBBODY, T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 225: + { yyval . subtree = MakeTree ( ctx, PT_DBBODY, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 226: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 227: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 228: + { yyval = yyvsp[0]; } + break; + + case 229: + { yyval = yyvsp[0]; } + break; + + case 230: + { yyval = yyvsp[0]; } + break; + + case 231: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 232: + { yyval = yyvsp[0]; } + break; + + case 233: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 234: + { yyval . subtree = MakeTree ( ctx, PT_DBMEMBER, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 235: + { yyval . subtree = MakeTree ( ctx, PT_TBLMEMBER, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 236: + { yyval . subtree = MakeTree ( ctx, PT_ALIASMEMBER, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 237: + { yyval . subtree = MakeTree ( ctx, PT_VIEWSPEC, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 238: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 239: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 240: + { yyval . subtree = MakeTree ( ctx, PT_INCLUDE, T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 241: + { yyval . subtree = MakeTree ( ctx, PT_FQN, P ( yyvsp[0] ) ); } + break; + + case 242: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 243: + { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } + break; + + case 244: + { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } + break; + + case 245: + { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } + break; + + case 246: + { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } + break; + + case 247: + { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } + break; + + case 248: + { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } + break; + + case 249: + { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } + break; + + case 250: + { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } + break; + + case 251: + { yyval . subtree = MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ); } + break; + + case 252: + { yyval . subtree = MakeTree ( ctx, PT_EMPTY ); } + break; + + case 253: + { yyval . subtree = MakeTree ( ctx, PT_VERSNAME, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 254: + { yyval = yyvsp[0]; } + break; + + case 255: + { yyval = yyvsp[0]; } + break; + + case 256: + { yyval . subtree = MakeTree ( ctx, PT_VERSION_2, T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 257: + { yyval . subtree = P ( yyvsp[0] ); } + break; + + case 258: + { yyval = yyvsp[0]; } + break; + + case 259: + { yyval . subtree = MakeTree ( ctx, PT_SCHEMA_2_0, P ( yyvsp[0] ) ); } + break; + + case 260: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ) , P ( yyvsp[0] ) ); } + break; + + case 261: + { yyval = yyvsp[0]; } + break; + + case 262: + { yyval = yyvsp[0]; } + break; + + case 263: + { yyval . subtree = MakeTree ( ctx, PT_VIEW, T ( ctx, yyvsp[-8] ), P ( yyvsp[-7] ), T ( ctx, yyvsp[-6] ), P ( yyvsp[-5] ), T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 264: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 265: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 266: + { yyval . subtree = MakeTree ( ctx, PT_VIEWPARAM, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 267: + { yyval = yyvsp[0]; } + break; + + case 268: + { yyval = yyvsp[0]; } + break; + + case 269: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 270: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 271: + { yyval . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 272: + { yyval . subtree = MakeTree ( ctx, PT_COLUMN, T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 273: + { yyval . subtree = T ( ctx, yyvsp[0] ); } + break; + + case 274: + { yyval = yyvsp[0]; } + break; + + case 275: + { yyval . subtree = MakeTree ( ctx, PT_VIEWPARENTS, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 276: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 277: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + case 278: + { yyval . subtree = MakeTree ( ctx, PT_VIEWPARENT, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } + break; + + case 279: + { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } + break; + + case 280: + { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } + break; + + + + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, ctx, root, errors, sb, YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (&yylloc, ctx, root, errors, sb, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + yyerror_range[1] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, ctx, root, errors, sb); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[1] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, ctx, root, errors, sb); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + yyerror_range[2] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, ctx, root, errors, sb, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, ctx, root, errors, sb); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[+*yyssp], yyvsp, yylsp, ctx, root, errors, sb); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} diff --git a/libs/kdbtext/zz_kdbtext-grammar.hpp b/libs/kdbtext/zz_kdbtext-grammar.hpp new file mode 100644 index 000000000..0a13e81a0 --- /dev/null +++ b/libs/kdbtext/zz_kdbtext-grammar.hpp @@ -0,0 +1,224 @@ +/* A Bison parser, made by GNU Bison 3.5.1. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + +#ifndef YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED +# define YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED +/* Debug traces. */ +#ifndef KDBTEXT_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define KDBTEXT_DEBUG 1 +# else +# define KDBTEXT_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define KDBTEXT_DEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined KDBTEXT_DEBUG */ +#if KDBTEXT_DEBUG +extern int KDBText_debug; +#endif + +/* Token type. */ +#ifndef KDBTEXT_TOKENTYPE +# define KDBTEXT_TOKENTYPE + enum KDBText_tokentype + { + END_SOURCE = 0, + UNRECOGNIZED = 258, + ELLIPSIS = 259, + INCREMENT = 260, + DECIMAL = 261, + OCTAL = 262, + HEX = 263, + FLOAT_ = 264, + EXP_FLOAT = 265, + STRING = 266, + ESCAPED_STRING = 267, + IDENTIFIER_1_0 = 268, + PHYSICAL_IDENTIFIER_1_0 = 269, + VERSION = 270, + UNTERM_STRING = 271, + UNTERM_ESCAPED_STRING = 272, + VERS_1_0 = 273, + VERS_2_0 = 274, + KW___no_header = 275, + KW___row_length = 276, + KW___untyped = 277, + KW_alias = 278, + KW_column = 279, + KW_const = 280, + KW_control = 281, + KW_database = 282, + KW_decode = 283, + KW_default = 284, + KW_encode = 285, + KW_extern = 286, + KW_false = 287, + KW_fmtdef = 288, + KW_function = 289, + KW_include = 290, + KW_limit = 291, + KW_physical = 292, + KW_read = 293, + KW_readonly = 294, + KW_return = 295, + KW_kdbtext = 296, + KW_static = 297, + KW_table = 298, + KW_template = 299, + KW_trigger = 300, + KW_true = 301, + KW_type = 302, + KW_typedef = 303, + KW_typeset = 304, + KW_validate = 305, + KW_version = 306, + KW_view = 307, + KW_virtual = 308, + KW_void = 309, + KW_write = 310, + PT_ASTLIST = 311, + PT_PARSE = 312, + PT_SOURCE = 313, + PT_VERSION_1_0 = 314, + PT_VERSION_2 = 315, + PT_SCHEMA_1_0 = 316, + PT_SCHEMA_2_0 = 317, + PT_INCLUDE = 318, + PT_TYPEDEF = 319, + PT_FQN = 320, + PT_IDENT = 321, + PT_PHYSIDENT = 322, + PT_UINT = 323, + PT_TYPESET = 324, + PT_TYPESETDEF = 325, + PT_FORMAT = 326, + PT_CONST = 327, + PT_ALIAS = 328, + PT_EXTERN = 329, + PT_FUNCTION = 330, + PT_UNTYPED = 331, + PT_ROWLENGTH = 332, + PT_FUNCDECL = 333, + PT_EMPTY = 334, + PT_SCHEMASIG = 335, + PT_SCHEMAFORMAL = 336, + PT_RETURNTYPE = 337, + PT_FACTSIG = 338, + PT_FUNCSIG = 339, + PT_FUNCPARAMS = 340, + PT_FORMALPARAM = 341, + PT_ELLIPSIS = 342, + PT_FUNCPROLOGUE = 343, + PT_RETURN = 344, + PT_PRODSTMT = 345, + PT_PRODTRIGGER = 346, + PT_SCHEMA = 347, + PT_VALIDATE = 348, + PT_PHYSICAL = 349, + PT_PHYSPROLOGUE = 350, + PT_PHYSSTMT = 351, + PT_PHYSBODYSTMT = 352, + PT_TABLE = 353, + PT_TABLEPARENTS = 354, + PT_TABLEBODY = 355, + PT_FUNCEXPR = 356, + PT_FACTPARMS = 357, + PT_COLUMN = 358, + PT_COLUMNEXPR = 359, + PT_COLDECL = 360, + PT_TYPEDCOL = 361, + PT_COLSTMT = 362, + PT_DFLTVIEW = 363, + PT_PHYSMBR = 364, + PT_PHYSCOL = 365, + PT_PHYSCOLDEF = 366, + PT_COLSCHEMAPARMS = 367, + PT_COLSCHEMAPARAM = 368, + PT_COLUNTYPED = 369, + PT_DATABASE = 370, + PT_TYPEEXPR = 371, + PT_DBBODY = 372, + PT_DBDAD = 373, + PT_DBMEMBER = 374, + PT_TBLMEMBER = 375, + PT_NOHEADER = 376, + PT_CASTEXPR = 377, + PT_CONSTVECT = 378, + PT_NEGATE = 379, + PT_UNARYPLUS = 380, + PT_VERSNAME = 381, + PT_ARRAY = 382, + PT_PHYSENCREF = 383, + PT_TYPEDCOLEXPR = 384, + PT_VIEW = 385, + PT_VIEWPARAM = 386, + PT_VIEWPARENTS = 387, + PT_VIEWPARENT = 388, + PT_MEMBEREXPR = 389, + PT_JOINEXPR = 390, + PT_ALIASMEMBER = 391, + PT_VIEWSPEC = 392 + }; +#endif + +/* Value type. */ +#if ! defined KDBTEXT_STYPE && ! defined KDBTEXT_STYPE_IS_DECLARED +typedef KDBTextToken KDBTEXT_STYPE; +# define KDBTEXT_STYPE_IS_TRIVIAL 1 +# define KDBTEXT_STYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined KDBTEXT_LTYPE && ! defined KDBTEXT_LTYPE_IS_DECLARED +typedef struct KDBTEXT_LTYPE KDBTEXT_LTYPE; +struct KDBTEXT_LTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define KDBTEXT_LTYPE_IS_DECLARED 1 +# define KDBTEXT_LTYPE_IS_TRIVIAL 1 +#endif + + + +int KDBText_parse (ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb); + +#endif /* !YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED */ diff --git a/libs/kdbtext/zz_kdbtext-grammar.output b/libs/kdbtext/zz_kdbtext-grammar.output new file mode 100644 index 000000000..6c046f168 --- /dev/null +++ b/libs/kdbtext/zz_kdbtext-grammar.output @@ -0,0 +1,7134 @@ +Terminals unused in grammar + + UNRECOGNIZED + INCREMENT + UNTERM_STRING + UNTERM_ESCAPED_STRING + KW_virtual + PT_ASTLIST + PT_PARSE + PT_SOURCE + PT_VERSION_1_0 + PT_VERSION_2 + PT_SCHEMA_1_0 + PT_SCHEMA_2_0 + PT_INCLUDE + PT_TYPEDEF + PT_FQN + PT_IDENT + PT_PHYSIDENT + PT_UINT + PT_TYPESET + PT_TYPESETDEF + PT_FORMAT + PT_CONST + PT_ALIAS + PT_EXTERN + PT_FUNCTION + PT_UNTYPED + PT_ROWLENGTH + PT_FUNCDECL + PT_EMPTY + PT_SCHEMASIG + PT_SCHEMAFORMAL + PT_RETURNTYPE + PT_FACTSIG + PT_FUNCSIG + PT_FUNCPARAMS + PT_FORMALPARAM + PT_ELLIPSIS + PT_FUNCPROLOGUE + PT_RETURN + PT_PRODSTMT + PT_PRODTRIGGER + PT_SCHEMA + PT_VALIDATE + PT_PHYSICAL + PT_PHYSPROLOGUE + PT_PHYSSTMT + PT_PHYSBODYSTMT + PT_TABLE + PT_TABLEPARENTS + PT_TABLEBODY + PT_FUNCEXPR + PT_FACTPARMS + PT_COLUMN + PT_COLUMNEXPR + PT_COLDECL + PT_TYPEDCOL + PT_COLSTMT + PT_DFLTVIEW + PT_PHYSMBR + PT_PHYSCOL + PT_PHYSCOLDEF + PT_COLSCHEMAPARMS + PT_COLSCHEMAPARAM + PT_COLUNTYPED + PT_DATABASE + PT_TYPEEXPR + PT_DBBODY + PT_DBDAD + PT_DBMEMBER + PT_TBLMEMBER + PT_NOHEADER + PT_CASTEXPR + PT_CONSTVECT + PT_NEGATE + PT_UNARYPLUS + PT_VERSNAME + PT_ARRAY + PT_PHYSENCREF + PT_TYPEDCOLEXPR + PT_VIEW + PT_VIEWPARAM + PT_VIEWPARENTS + PT_VIEWPARENT + PT_MEMBEREXPR + PT_JOINEXPR + PT_ALIASMEMBER + PT_VIEWSPEC + + +Grammar + + 0 $accept: parse "end of source" + + 1 parse: "end of source" + 2 | source "end of source" + + 3 source: kdbtext_1_0 + 4 | version_1_0 kdbtext_1_0_opt + 5 | version_2_0 kdbtext_2_0_opt + + 6 version_1_0: KW_version VERS_1_0 ';' + + 7 kdbtext_1_0_opt: kdbtext_1_0 + 8 | empty + + 9 kdbtext_1_0: kdbtext_1_0_decl + 10 | kdbtext_1_0 kdbtext_1_0_decl + + 11 kdbtext_1_0_decl: typedef_1_0_decl + 12 | typeset_1_0_decl + 13 | format_1_0_decl + 14 | const_1_0_decl + 15 | alias_1_0_decl + 16 | function_1_0_decl + 17 | extern_1_0_decl + 18 | script_1_0_decl + 19 | validate_1_0_decl + 20 | physical_1_0_decl + 21 | table_1_0_decl + 22 | database_1_0_decl + 23 | include_directive + 24 | ';' + + 25 typedef_1_0_decl: KW_typedef fqn_1_0 typedef_1_0_new_name_list ';' + + 26 typedef_1_0_new_name_list: typespec_1_0 + 27 | typedef_1_0_new_name_list ',' typespec_1_0 + + 28 typeset_1_0_decl: KW_typeset typeset_1_0_new_name typeset_1_0_def ';' + + 29 typeset_1_0_new_name: fqn_1_0 + + 30 typeset_1_0_def: '{' typespec_1_0_list '}' + + 31 typespec_1_0_list: typespec_1_0 + 32 | typespec_1_0_list ',' typespec_1_0 + + 33 typespec_1_0: fqn_1_0 + 34 | fqn_1_0 '[' dim_1_0 ']' + + 35 dim_1_0: expression_1_0 + 36 | '*' + + 37 format_1_0_decl: KW_fmtdef format_1_0_new_name ';' + 38 | KW_fmtdef format_1_0_name format_1_0_new_name ';' + + 39 format_1_0_new_name: fqn_1_0 + + 40 format_1_0_name: fqn_1_0 + + 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 '=' expression_1_0 ';' + + 42 alias_1_0_decl: KW_alias fqn_1_0 alias_1_0_new_name ';' + + 43 alias_1_0_new_name: fqn_1_0 + + 44 function_1_0_decl: KW_function func_1_0_decl + + 45 func_1_0_decl: untyped_func_1_0_decl + 46 | row_length_func_1_0_decl + 47 | opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue + + 48 untyped_func_1_0_decl: KW___untyped fqn_1_0 '(' ')' + + 49 row_length_func_1_0_decl: KW___row_length fqn_1_0 '(' ')' + + 50 opt_func_1_0_kdbtext_sig: empty + 51 | func_1_0_kdbtext_sig + + 52 func_1_0_kdbtext_sig: '<' func_1_0_kdbtext_formals '>' + + 53 func_1_0_kdbtext_formals: func_1_0_kdbtext_formal + 54 | func_1_0_kdbtext_formals ',' func_1_0_kdbtext_formal + + 55 func_1_0_kdbtext_formal: KW_type ident_1_0 + 56 | type_expr_1_0 ident_1_0 + + 57 func_1_0_return_type: KW_void + 58 | type_expr_1_0 + + 59 opt_func_1_0_fact_sig: empty + 60 | func_1_0_fact_sig + + 61 func_1_0_fact_sig: '<' func_1_0_fact_signature '>' + + 62 func_1_0_fact_signature: empty + 63 | func_1_0_fact_params func_1_0_vararg_formals + 64 | '*' func_1_0_fact_params func_1_0_vararg_formals + 65 | func_1_0_fact_params '*' func_1_0_fact_params func_1_0_vararg_formals + 66 | func_1_0_fact_params ',' '*' func_1_0_fact_params func_1_0_vararg_formals + + 67 func_1_0_fact_params: fact_param_1_0 + 68 | func_1_0_fact_params ',' fact_param_1_0 + + 69 fact_param_1_0: typespec_1_0 IDENTIFIER_1_0 + + 70 func_1_0_param_sig: '(' func_1_0_param_signature ')' + + 71 func_1_0_param_signature: empty + 72 | func_1_0_formal_params func_1_0_vararg_formals + 73 | '*' func_1_0_formal_params func_1_0_vararg_formals + 74 | func_1_0_formal_params '*' func_1_0_formal_params func_1_0_vararg_formals + 75 | func_1_0_formal_params ',' '*' func_1_0_formal_params func_1_0_vararg_formals + + 76 func_1_0_formal_params: formal_param_1_0 + 77 | func_1_0_formal_params ',' formal_param_1_0 + + 78 formal_param_1_0: typespec_1_0 IDENTIFIER_1_0 + 79 | KW_control typespec_1_0 IDENTIFIER_1_0 + + 80 func_1_0_vararg_formals: empty + 81 | ',' ELLIPSIS + + 82 func_1_0_prologue: ';' + 83 | '=' fqn_1_0 ';' + 84 | '{' script_1_0_stmt_seq '}' + + 85 script_1_0_stmt_seq: script_1_0_stmt + 86 | script_1_0_stmt_seq script_1_0_stmt + + 87 script_1_0_stmt: KW_return cond_expr_1_0 ';' + 88 | type_expr_1_0 ident_1_0 '=' cond_expr_1_0 ';' + + 89 extern_1_0_decl: KW_extern ext_func_1_0_decl + + 90 ext_func_1_0_decl: function_1_0_decl + + 91 script_1_0_decl: KW_kdbtext func_1_0_decl + 92 | KW_kdbtext KW_function func_1_0_decl + + 93 validate_1_0_decl: KW_validate function_1_0_decl + + 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue + + 95 phys_1_0_return_type: func_1_0_return_type + 96 | KW___no_header func_1_0_return_type + + 97 phys_1_0_prologue: '=' phys_1_0_stmt + 98 | '{' phys_1_0_body '}' + + 99 phys_1_0_body: phys_1_0_body_stmt + 100 | phys_1_0_body phys_1_0_body_stmt + + 101 phys_1_0_body_stmt: ';' + 102 | KW_decode phys_1_0_stmt + 103 | KW_encode phys_1_0_stmt + 104 | KW___row_length '=' fqn_1_0 '(' ')' + + 105 phys_1_0_stmt: '{' script_1_0_stmt_seq '}' + + 106 table_1_0_decl: KW_table fqn_vers opt_tbl_1_0_parents tbl_1_0_body + + 107 opt_tbl_1_0_parents: empty + 108 | '=' tbl_1_0_parents + + 109 tbl_1_0_parents: fqn_opt_vers + 110 | tbl_1_0_parents ',' fqn_opt_vers + + 111 tbl_1_0_body: '{' tbl_1_0_stmt_seq '}' + 112 | '{' '}' + + 113 tbl_1_0_stmt_seq: tbl_1_0_stmt + 114 | tbl_1_0_stmt_seq tbl_1_0_stmt + + 115 tbl_1_0_stmt: production_1_0_stmt + 116 | col_1_0_modifiers col_1_0_decl + 117 | KW_column KW_limit '=' expression_1_0 ';' + 118 | KW_column KW_default KW_limit '=' expression_1_0 ';' + 119 | KW_static physmbr_1_0_decl + 120 | KW_physical physmbr_1_0_decl + 121 | KW_static KW_physical physmbr_1_0_decl + 122 | default_view_1_0_decl + 123 | KW___untyped '=' fqn_1_0 '(' ')' ';' + 124 | ';' + + 125 production_1_0_stmt: typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' + 126 | KW_trigger ident_1_0 '=' cond_expr_1_0 ';' + + 127 col_1_0_modifiers: KW_column + 128 | col_1_0_modifier_seq KW_column + + 129 col_1_0_modifier_seq: col_1_0_modifier + 130 | col_1_0_modifier_seq col_1_0_modifier + + 131 col_1_0_modifier: KW_default + 132 | KW_extern + 133 | KW_readonly + + 134 col_1_0_decl: typespec_1_0 typed_column_decl_1_0 + 135 | phys_enc_ref typed_column_decl_1_0 + + 136 phys_enc_ref: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 + 137 | fqn_vers opt_factory_parms_1_0 + 138 | fqn_1_0 factory_parms_1_0 + + 139 typed_column_decl_1_0: col_ident '{' opt_column_body_1_0 '}' + 140 | col_ident '=' cond_expr_1_0 ';' + 141 | col_ident ';' + + 142 col_ident: ident_1_0 + 143 | phys_ident + + 144 phys_ident: PHYSICAL_IDENTIFIER_1_0 + + 145 opt_column_body_1_0: empty + 146 | column_body_1_0 + + 147 column_body_1_0: column_stmt_1_0 + 148 | column_body_1_0 column_stmt_1_0 + + 149 column_stmt_1_0: KW_read '=' cond_expr_1_0 ';' + 150 | KW_validate '=' cond_expr_1_0 ';' + 151 | KW_limit '=' uint_expr_1_0 ';' + 152 | ';' + + 153 default_view_1_0_decl: KW_default KW_view STRING ';' + + 154 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' + 155 | phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' + 156 | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' + 157 | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' + + 158 phys_coldef_1_0: opt_col_kdbtext_parms_1_0 fqn_opt_vers opt_factory_parms_1_0 + + 159 opt_col_kdbtext_parms_1_0: empty + 160 | '<' col_kdbtext_parms_1_0 '>' + + 161 col_kdbtext_parms_1_0: col_kdbtext_parm_1_0 + 162 | col_kdbtext_parms_1_0 ',' col_kdbtext_parm_1_0 + + 163 col_kdbtext_parm_1_0: fqn_1_0 '=' col_kdbtext_value_1_0 + 164 | col_kdbtext_value_1_0 + + 165 col_kdbtext_value_1_0: fqn_1_0 + 166 | uint_expr_1_0 + + 167 cond_expr_1_0: expression_1_0 + 168 | cond_expr_1_0 '|' expression_1_0 + + 169 expression_1_0: primary_expr_1_0 + 170 | '(' type_expr_1_0 ')' expression_1_0 + + 171 primary_expr_1_0: fqn_1_0 + 172 | phys_ident + 173 | '@' + 174 | func_expr_1_0 + 175 | uint_expr_1_0 + 176 | float_expr_1_0 + 177 | string_expr_1_0 + 178 | const_vect_expr_1_0 + 179 | bool_expr_1_0 + 180 | '-' expression_1_0 + 181 | '+' expression_1_0 + 182 | member_expr_2_0 + 183 | join_expr_2_0 + + 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' + 185 | fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' + + 186 kdbtext_parms_1_0: kdbtext_parm_1_0 + 187 | kdbtext_parms_1_0 ',' kdbtext_parm_1_0 + + 188 kdbtext_parm_1_0: fqn_1_0 + 189 | fqn_1_0 '[' dim_1_0 ']' + 190 | uint_expr_1_0 + + 191 opt_factory_parms_1_0: empty + 192 | factory_parms_1_0 + + 193 factory_parms_1_0: '<' factory_parms '>' + + 194 factory_parms: expression_1_0 + 195 | factory_parms ',' expression_1_0 + + 196 opt_func_1_0_parms: empty + 197 | func_1_0_parms + + 198 func_1_0_parms: expression_1_0 + 199 | func_1_0_parms ',' expression_1_0 + + 200 uint_expr_1_0: DECIMAL + 201 | HEX + 202 | OCTAL + + 203 float_expr_1_0: FLOAT_ + 204 | EXP_FLOAT + + 205 string_expr_1_0: STRING + 206 | ESCAPED_STRING + + 207 const_vect_expr_1_0: '[' opt_const_vect_exprlist_1_0 ']' + + 208 opt_const_vect_exprlist_1_0: empty + 209 | const_vect_exprlist_1_0 + + 210 const_vect_exprlist_1_0: expression_1_0 + 211 | const_vect_exprlist_1_0 ',' expression_1_0 + + 212 bool_expr_1_0: KW_true + 213 | KW_false + + 214 type_expr_1_0: typespec_1_0 + 215 | fqn_1_0 '/' fqn_1_0 + + 216 member_expr_2_0: ident_1_0 '.' ident_1_0 + 217 | ident_1_0 PHYSICAL_IDENTIFIER_1_0 + + 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' '.' ident_1_0 + 219 | ident_1_0 '[' cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 + + 220 database_1_0_decl: KW_database fqn_vers opt_database_dad_1_0 database_body_1_0 + + 221 opt_database_dad_1_0: empty + 222 | '=' fqn_opt_vers + + 223 database_body_1_0: '{' '}' + 224 | '{' database_members_1_0 '}' + + 225 database_members_1_0: database_member_1_0 + 226 | database_members_1_0 database_member_1_0 + + 227 database_member_1_0: db_member_1_0 + 228 | table_member_1_0 + 229 | alias_member_1_0 + 230 | ';' + + 231 opt_template_1_0: empty + 232 | KW_template + + 233 db_member_1_0: opt_template_1_0 KW_database fqn_opt_vers ident_1_0 ';' + + 234 table_member_1_0: opt_template_1_0 KW_table fqn_opt_vers ident_1_0 ';' + + 235 alias_member_1_0: KW_alias view_spec ident_1_0 ';' + + 236 view_spec: fqn_opt_vers '<' view_parms '>' + + 237 view_parms: ident_1_0 + 238 | view_parms ',' ident_1_0 + + 239 include_directive: KW_include STRING + + 240 fqn_1_0: ident_1_0 + 241 | fqn_1_0 ':' ident_1_0 + 242 | fqn_1_0 ':' KW_database + 243 | fqn_1_0 ':' KW_decode + 244 | fqn_1_0 ':' KW_encode + 245 | fqn_1_0 ':' KW_read + 246 | fqn_1_0 ':' KW_table + 247 | fqn_1_0 ':' KW_type + 248 | fqn_1_0 ':' KW_view + 249 | fqn_1_0 ':' KW_write + + 250 ident_1_0: IDENTIFIER_1_0 + + 251 empty: %empty + + 252 fqn_vers: fqn_1_0 VERSION + + 253 fqn_opt_vers: fqn_1_0 + 254 | fqn_vers + + 255 version_2_0: KW_version VERS_2_0 ';' + + 256 kdbtext_2_0_opt: kdbtext_2_0 + 257 | empty + + 258 kdbtext_2_0: kdbtext_2_0_decl + 259 | kdbtext_2_0 kdbtext_2_0_decl + + 260 kdbtext_2_0_decl: kdbtext_1_0_decl + 261 | view_2_0_decl + + 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body '}' + + 263 view_parms: view_parm + 264 | view_parms ',' view_parm + + 265 view_parm: fqn_opt_vers ident_1_0 + + 266 opt_view_body: empty + 267 | view_body + + 268 view_body: view_member + 269 | view_body view_member + + 270 view_member: typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' + 271 | KW_column typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' + 272 | ';' + + 273 opt_view_parents: empty + 274 | '=' view_parents + + 275 view_parents: view_parent + 276 | view_parents ',' view_parent + + 277 view_parent: fqn_opt_vers '<' view_parent_parms '>' + + 278 view_parent_parms: ident_1_0 + 279 | view_parent_parms ',' ident_1_0 + + +Terminals, with rules where they appear + + "end of source" (0) 0 1 2 + '(' (40) 48 49 70 104 123 170 184 185 + ')' (41) 48 49 70 104 123 170 184 185 + '*' (42) 36 64 65 66 73 74 75 + '+' (43) 181 + ',' (44) 27 32 54 66 68 75 77 81 110 162 187 195 199 211 238 264 276 279 + '-' (45) 180 + '.' (46) 216 218 + '/' (47) 215 + ':' (58) 241 242 243 244 245 246 247 248 249 + ';' (59) 6 24 25 28 37 38 41 42 82 83 87 88 101 117 118 123 124 125 126 140 141 149 150 151 152 153 154 155 156 157 230 233 234 235 255 270 271 272 + '<' (60) 52 61 136 160 184 193 236 262 277 + '=' (61) 41 83 88 97 104 108 117 118 123 125 126 140 149 150 151 155 157 163 222 270 271 274 + '>' (62) 52 61 136 160 184 193 236 262 277 + '@' (64) 173 + '[' (91) 34 189 207 218 219 + ']' (93) 34 189 207 218 219 + '{' (123) 30 84 98 105 111 112 139 223 224 262 + '|' (124) 168 + '}' (125) 30 84 98 105 111 112 139 223 224 262 + error (256) + UNRECOGNIZED (258) + ELLIPSIS (259) 81 + INCREMENT (260) + DECIMAL (261) 200 + OCTAL (262) 202 + HEX (263) 201 + FLOAT_ (264) 203 + EXP_FLOAT (265) 204 + STRING (266) 153 205 239 + ESCAPED_STRING (267) 206 + IDENTIFIER_1_0 (268) 69 78 79 250 + PHYSICAL_IDENTIFIER_1_0 (269) 144 154 155 156 157 217 219 + VERSION (270) 252 + UNTERM_STRING (271) + UNTERM_ESCAPED_STRING (272) + VERS_1_0 (273) 6 + VERS_2_0 (274) 255 + KW___no_header (275) 96 + KW___row_length (276) 49 104 + KW___untyped (277) 48 123 + KW_alias (278) 42 235 + KW_column (279) 117 118 127 128 156 157 271 + KW_const (280) 41 + KW_control (281) 79 + KW_database (282) 220 233 242 + KW_decode (283) 102 243 + KW_default (284) 118 131 153 + KW_encode (285) 103 244 + KW_extern (286) 89 132 + KW_false (287) 213 + KW_fmtdef (288) 37 38 + KW_function (289) 44 92 + KW_include (290) 239 + KW_limit (291) 117 118 151 + KW_physical (292) 94 120 121 + KW_read (293) 149 245 + KW_readonly (294) 133 + KW_return (295) 87 + KW_kdbtext (296) 91 92 + KW_static (297) 119 121 + KW_table (298) 106 234 246 + KW_template (299) 232 + KW_trigger (300) 126 + KW_true (301) 212 + KW_type (302) 55 247 + KW_typedef (303) 25 + KW_typeset (304) 28 + KW_validate (305) 93 150 + KW_version (306) 6 255 + KW_view (307) 153 248 262 + KW_virtual (308) + KW_void (309) 57 + KW_write (310) 249 + PT_ASTLIST (311) + PT_PARSE (312) + PT_SOURCE (313) + PT_VERSION_1_0 (314) + PT_VERSION_2 (315) + PT_SCHEMA_1_0 (316) + PT_SCHEMA_2_0 (317) + PT_INCLUDE (318) + PT_TYPEDEF (319) + PT_FQN (320) + PT_IDENT (321) + PT_PHYSIDENT (322) + PT_UINT (323) + PT_TYPESET (324) + PT_TYPESETDEF (325) + PT_FORMAT (326) + PT_CONST (327) + PT_ALIAS (328) + PT_EXTERN (329) + PT_FUNCTION (330) + PT_UNTYPED (331) + PT_ROWLENGTH (332) + PT_FUNCDECL (333) + PT_EMPTY (334) + PT_SCHEMASIG (335) + PT_SCHEMAFORMAL (336) + PT_RETURNTYPE (337) + PT_FACTSIG (338) + PT_FUNCSIG (339) + PT_FUNCPARAMS (340) + PT_FORMALPARAM (341) + PT_ELLIPSIS (342) + PT_FUNCPROLOGUE (343) + PT_RETURN (344) + PT_PRODSTMT (345) + PT_PRODTRIGGER (346) + PT_SCHEMA (347) + PT_VALIDATE (348) + PT_PHYSICAL (349) + PT_PHYSPROLOGUE (350) + PT_PHYSSTMT (351) + PT_PHYSBODYSTMT (352) + PT_TABLE (353) + PT_TABLEPARENTS (354) + PT_TABLEBODY (355) + PT_FUNCEXPR (356) + PT_FACTPARMS (357) + PT_COLUMN (358) + PT_COLUMNEXPR (359) + PT_COLDECL (360) + PT_TYPEDCOL (361) + PT_COLSTMT (362) + PT_DFLTVIEW (363) + PT_PHYSMBR (364) + PT_PHYSCOL (365) + PT_PHYSCOLDEF (366) + PT_COLSCHEMAPARMS (367) + PT_COLSCHEMAPARAM (368) + PT_COLUNTYPED (369) + PT_DATABASE (370) + PT_TYPEEXPR (371) + PT_DBBODY (372) + PT_DBDAD (373) + PT_DBMEMBER (374) + PT_TBLMEMBER (375) + PT_NOHEADER (376) + PT_CASTEXPR (377) + PT_CONSTVECT (378) + PT_NEGATE (379) + PT_UNARYPLUS (380) + PT_VERSNAME (381) + PT_ARRAY (382) + PT_PHYSENCREF (383) + PT_TYPEDCOLEXPR (384) + PT_VIEW (385) + PT_VIEWPARAM (386) + PT_VIEWPARENTS (387) + PT_VIEWPARENT (388) + PT_MEMBEREXPR (389) + PT_JOINEXPR (390) + PT_ALIASMEMBER (391) + PT_VIEWSPEC (392) + + +Nonterminals, with rules where they appear + + $accept (157) + on left: 0 + parse (158) + on left: 1 2 + on right: 0 + source (159) + on left: 3 4 5 + on right: 2 + version_1_0 (160) + on left: 6 + on right: 4 + kdbtext_1_0_opt (161) + on left: 7 8 + on right: 4 + kdbtext_1_0 (162) + on left: 9 10 + on right: 3 7 10 + kdbtext_1_0_decl (163) + on left: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 + on right: 9 10 260 + typedef_1_0_decl (164) + on left: 25 + on right: 11 + typedef_1_0_new_name_list (165) + on left: 26 27 + on right: 25 27 + typeset_1_0_decl (166) + on left: 28 + on right: 12 + typeset_1_0_new_name (167) + on left: 29 + on right: 28 + typeset_1_0_def (168) + on left: 30 + on right: 28 + typespec_1_0_list (169) + on left: 31 32 + on right: 30 32 + typespec_1_0 (170) + on left: 33 34 + on right: 26 27 31 32 41 69 78 79 125 134 214 270 271 + dim_1_0 (171) + on left: 35 36 + on right: 34 189 + format_1_0_decl (172) + on left: 37 38 + on right: 13 + format_1_0_new_name (173) + on left: 39 + on right: 37 38 + format_1_0_name (174) + on left: 40 + on right: 38 + const_1_0_decl (175) + on left: 41 + on right: 14 + alias_1_0_decl (176) + on left: 42 + on right: 15 + alias_1_0_new_name (177) + on left: 43 + on right: 42 + function_1_0_decl (178) + on left: 44 + on right: 16 90 93 + func_1_0_decl (179) + on left: 45 46 47 + on right: 44 91 92 + untyped_func_1_0_decl (180) + on left: 48 + on right: 45 + row_length_func_1_0_decl (181) + on left: 49 + on right: 46 + opt_func_1_0_kdbtext_sig (182) + on left: 50 51 + on right: 47 94 + func_1_0_kdbtext_sig (183) + on left: 52 + on right: 51 + func_1_0_kdbtext_formals (184) + on left: 53 54 + on right: 52 54 + func_1_0_kdbtext_formal (185) + on left: 55 56 + on right: 53 54 + func_1_0_return_type (186) + on left: 57 58 + on right: 47 95 96 + opt_func_1_0_fact_sig (187) + on left: 59 60 + on right: 47 94 + func_1_0_fact_sig (188) + on left: 61 + on right: 60 + func_1_0_fact_signature (189) + on left: 62 63 64 65 66 + on right: 61 + func_1_0_fact_params (190) + on left: 67 68 + on right: 63 64 65 66 68 + fact_param_1_0 (191) + on left: 69 + on right: 67 68 + func_1_0_param_sig (192) + on left: 70 + on right: 47 + func_1_0_param_signature (193) + on left: 71 72 73 74 75 + on right: 70 + func_1_0_formal_params (194) + on left: 76 77 + on right: 72 73 74 75 77 + formal_param_1_0 (195) + on left: 78 79 + on right: 76 77 + func_1_0_vararg_formals (196) + on left: 80 81 + on right: 63 64 65 66 72 73 74 75 + func_1_0_prologue (197) + on left: 82 83 84 + on right: 47 + script_1_0_stmt_seq (198) + on left: 85 86 + on right: 84 86 105 + script_1_0_stmt (199) + on left: 87 88 + on right: 85 86 + extern_1_0_decl (200) + on left: 89 + on right: 17 + ext_func_1_0_decl (201) + on left: 90 + on right: 89 + script_1_0_decl (202) + on left: 91 92 + on right: 18 + validate_1_0_decl (203) + on left: 93 + on right: 19 + physical_1_0_decl (204) + on left: 94 + on right: 20 + phys_1_0_return_type (205) + on left: 95 96 + on right: 94 + phys_1_0_prologue (206) + on left: 97 98 + on right: 94 + phys_1_0_body (207) + on left: 99 100 + on right: 98 100 + phys_1_0_body_stmt (208) + on left: 101 102 103 104 + on right: 99 100 + phys_1_0_stmt (209) + on left: 105 + on right: 97 102 103 + table_1_0_decl (210) + on left: 106 + on right: 21 + opt_tbl_1_0_parents (211) + on left: 107 108 + on right: 106 + tbl_1_0_parents (212) + on left: 109 110 + on right: 108 110 + tbl_1_0_body (213) + on left: 111 112 + on right: 106 + tbl_1_0_stmt_seq (214) + on left: 113 114 + on right: 111 114 + tbl_1_0_stmt (215) + on left: 115 116 117 118 119 120 121 122 123 124 + on right: 113 114 + production_1_0_stmt (216) + on left: 125 126 + on right: 115 + col_1_0_modifiers (217) + on left: 127 128 + on right: 116 + col_1_0_modifier_seq (218) + on left: 129 130 + on right: 128 130 + col_1_0_modifier (219) + on left: 131 132 133 + on right: 129 130 + col_1_0_decl (220) + on left: 134 135 + on right: 116 + phys_enc_ref (221) + on left: 136 137 138 + on right: 135 + typed_column_decl_1_0 (222) + on left: 139 140 141 + on right: 134 135 + col_ident (223) + on left: 142 143 + on right: 139 140 141 + phys_ident (224) + on left: 144 + on right: 143 172 + opt_column_body_1_0 (225) + on left: 145 146 + on right: 139 + column_body_1_0 (226) + on left: 147 148 + on right: 146 148 + column_stmt_1_0 (227) + on left: 149 150 151 152 + on right: 147 148 + default_view_1_0_decl (228) + on left: 153 + on right: 122 + physmbr_1_0_decl (229) + on left: 154 155 156 157 + on right: 119 120 121 + phys_coldef_1_0 (230) + on left: 158 + on right: 154 155 156 157 + opt_col_kdbtext_parms_1_0 (231) + on left: 159 160 + on right: 158 + col_kdbtext_parms_1_0 (232) + on left: 161 162 + on right: 160 162 + col_kdbtext_parm_1_0 (233) + on left: 163 164 + on right: 161 162 + col_kdbtext_value_1_0 (234) + on left: 165 166 + on right: 163 164 + cond_expr_1_0 (235) + on left: 167 168 + on right: 87 88 125 126 140 149 150 155 157 168 218 219 270 271 + expression_1_0 (236) + on left: 169 170 + on right: 35 41 117 118 167 168 170 180 181 194 195 198 199 210 211 + primary_expr_1_0 (237) + on left: 171 172 173 174 175 176 177 178 179 180 181 182 183 + on right: 169 + func_expr_1_0 (238) + on left: 184 185 + on right: 174 + kdbtext_parms_1_0 (239) + on left: 186 187 + on right: 136 184 187 + kdbtext_parm_1_0 (240) + on left: 188 189 190 + on right: 186 187 + opt_factory_parms_1_0 (241) + on left: 191 192 + on right: 136 137 158 184 185 + factory_parms_1_0 (242) + on left: 193 + on right: 138 192 + factory_parms (243) + on left: 194 195 + on right: 193 195 + opt_func_1_0_parms (244) + on left: 196 197 + on right: 184 185 + func_1_0_parms (245) + on left: 198 199 + on right: 197 199 + uint_expr_1_0 (246) + on left: 200 201 202 + on right: 151 166 175 190 + float_expr_1_0 (247) + on left: 203 204 + on right: 176 + string_expr_1_0 (248) + on left: 205 206 + on right: 177 + const_vect_expr_1_0 (249) + on left: 207 + on right: 178 + opt_const_vect_exprlist_1_0 (250) + on left: 208 209 + on right: 207 + const_vect_exprlist_1_0 (251) + on left: 210 211 + on right: 209 211 + bool_expr_1_0 (252) + on left: 212 213 + on right: 179 + type_expr_1_0 (253) + on left: 214 215 + on right: 56 58 88 170 + member_expr_2_0 (254) + on left: 216 217 + on right: 182 + join_expr_2_0 (255) + on left: 218 219 + on right: 183 + database_1_0_decl (256) + on left: 220 + on right: 22 + opt_database_dad_1_0 (257) + on left: 221 222 + on right: 220 + database_body_1_0 (258) + on left: 223 224 + on right: 220 + database_members_1_0 (259) + on left: 225 226 + on right: 224 226 + database_member_1_0 (260) + on left: 227 228 229 230 + on right: 225 226 + opt_template_1_0 (261) + on left: 231 232 + on right: 233 234 + db_member_1_0 (262) + on left: 233 + on right: 227 + table_member_1_0 (263) + on left: 234 + on right: 228 + alias_member_1_0 (264) + on left: 235 + on right: 229 + view_spec (265) + on left: 236 + on right: 235 + view_parms (266) + on left: 237 238 263 264 + on right: 236 238 262 264 + include_directive (267) + on left: 239 + on right: 23 + fqn_1_0 (268) + on left: 240 241 242 243 244 245 246 247 248 249 + on right: 25 29 33 34 39 40 41 42 43 48 49 83 104 123 138 163 165 171 188 189 215 241 242 243 244 245 246 247 248 249 252 253 + ident_1_0 (269) + on left: 250 + on right: 55 56 88 125 126 142 216 217 218 219 233 234 235 237 238 240 241 265 270 271 278 279 + empty (270) + on left: 251 + on right: 8 50 59 62 71 80 107 145 159 191 196 208 221 231 257 266 273 + fqn_vers (271) + on left: 252 + on right: 94 106 137 220 254 262 + fqn_opt_vers (272) + on left: 253 254 + on right: 47 109 110 136 158 184 185 222 233 234 236 265 277 + version_2_0 (273) + on left: 255 + on right: 5 + kdbtext_2_0_opt (274) + on left: 256 257 + on right: 5 + kdbtext_2_0 (275) + on left: 258 259 + on right: 256 259 + kdbtext_2_0_decl (276) + on left: 260 261 + on right: 258 259 + view_2_0_decl (277) + on left: 262 + on right: 261 + view_parm (278) + on left: 265 + on right: 263 264 + opt_view_body (279) + on left: 266 267 + on right: 262 + view_body (280) + on left: 268 269 + on right: 267 269 + view_member (281) + on left: 270 271 272 + on right: 268 269 + opt_view_parents (282) + on left: 273 274 + on right: 262 + view_parents (283) + on left: 275 276 + on right: 274 276 + view_parent (284) + on left: 277 + on right: 275 276 + view_parent_parms (285) + on left: 278 279 + on right: 277 279 + + +State 0 + + 0 $accept: . parse "end of source" + + "end of source" shift, and go to state 1 + KW_alias shift, and go to state 2 + KW_const shift, and go to state 3 + KW_database shift, and go to state 4 + KW_extern shift, and go to state 5 + KW_fmtdef shift, and go to state 6 + KW_function shift, and go to state 7 + KW_include shift, and go to state 8 + KW_physical shift, and go to state 9 + KW_kdbtext shift, and go to state 10 + KW_table shift, and go to state 11 + KW_typedef shift, and go to state 12 + KW_typeset shift, and go to state 13 + KW_validate shift, and go to state 14 + KW_version shift, and go to state 15 + ';' shift, and go to state 16 + + parse go to state 17 + source go to state 18 + version_1_0 go to state 19 + kdbtext_1_0 go to state 20 + kdbtext_1_0_decl go to state 21 + typedef_1_0_decl go to state 22 + typeset_1_0_decl go to state 23 + format_1_0_decl go to state 24 + const_1_0_decl go to state 25 + alias_1_0_decl go to state 26 + function_1_0_decl go to state 27 + extern_1_0_decl go to state 28 + script_1_0_decl go to state 29 + validate_1_0_decl go to state 30 + physical_1_0_decl go to state 31 + table_1_0_decl go to state 32 + database_1_0_decl go to state 33 + include_directive go to state 34 + version_2_0 go to state 35 + + +State 1 + + 1 parse: "end of source" . + + $default reduce using rule 1 (parse) + + +State 2 + + 42 alias_1_0_decl: KW_alias . fqn_1_0 alias_1_0_new_name ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 37 + ident_1_0 go to state 38 + + +State 3 + + 41 const_1_0_decl: KW_const . typespec_1_0 fqn_1_0 '=' expression_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 39 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 4 + + 220 database_1_0_decl: KW_database . fqn_vers opt_database_dad_1_0 database_body_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 41 + ident_1_0 go to state 38 + fqn_vers go to state 42 + + +State 5 + + 89 extern_1_0_decl: KW_extern . ext_func_1_0_decl + + KW_function shift, and go to state 7 + + function_1_0_decl go to state 43 + ext_func_1_0_decl go to state 44 + + +State 6 + + 37 format_1_0_decl: KW_fmtdef . format_1_0_new_name ';' + 38 | KW_fmtdef . format_1_0_name format_1_0_new_name ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + format_1_0_new_name go to state 45 + format_1_0_name go to state 46 + fqn_1_0 go to state 47 + ident_1_0 go to state 38 + + +State 7 + + 44 function_1_0_decl: KW_function . func_1_0_decl + + KW___row_length shift, and go to state 48 + KW___untyped shift, and go to state 49 + '<' shift, and go to state 50 + + $default reduce using rule 251 (empty) + + func_1_0_decl go to state 51 + untyped_func_1_0_decl go to state 52 + row_length_func_1_0_decl go to state 53 + opt_func_1_0_kdbtext_sig go to state 54 + func_1_0_kdbtext_sig go to state 55 + empty go to state 56 + + +State 8 + + 239 include_directive: KW_include . STRING + + STRING shift, and go to state 57 + + +State 9 + + 94 physical_1_0_decl: KW_physical . opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue + + '<' shift, and go to state 50 + + $default reduce using rule 251 (empty) + + opt_func_1_0_kdbtext_sig go to state 58 + func_1_0_kdbtext_sig go to state 55 + empty go to state 56 + + +State 10 + + 91 script_1_0_decl: KW_kdbtext . func_1_0_decl + 92 | KW_kdbtext . KW_function func_1_0_decl + + KW___row_length shift, and go to state 48 + KW___untyped shift, and go to state 49 + KW_function shift, and go to state 59 + '<' shift, and go to state 50 + + $default reduce using rule 251 (empty) + + func_1_0_decl go to state 60 + untyped_func_1_0_decl go to state 52 + row_length_func_1_0_decl go to state 53 + opt_func_1_0_kdbtext_sig go to state 54 + func_1_0_kdbtext_sig go to state 55 + empty go to state 56 + + +State 11 + + 106 table_1_0_decl: KW_table . fqn_vers opt_tbl_1_0_parents tbl_1_0_body + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 41 + ident_1_0 go to state 38 + fqn_vers go to state 61 + + +State 12 + + 25 typedef_1_0_decl: KW_typedef . fqn_1_0 typedef_1_0_new_name_list ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 62 + ident_1_0 go to state 38 + + +State 13 + + 28 typeset_1_0_decl: KW_typeset . typeset_1_0_new_name typeset_1_0_def ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + typeset_1_0_new_name go to state 63 + fqn_1_0 go to state 64 + ident_1_0 go to state 38 + + +State 14 + + 93 validate_1_0_decl: KW_validate . function_1_0_decl + + KW_function shift, and go to state 7 + + function_1_0_decl go to state 65 + + +State 15 + + 6 version_1_0: KW_version . VERS_1_0 ';' + 255 version_2_0: KW_version . VERS_2_0 ';' + + VERS_1_0 shift, and go to state 66 + VERS_2_0 shift, and go to state 67 + + +State 16 + + 24 kdbtext_1_0_decl: ';' . + + $default reduce using rule 24 (kdbtext_1_0_decl) + + +State 17 + + 0 $accept: parse . "end of source" + + "end of source" shift, and go to state 68 + + +State 18 + + 2 parse: source . "end of source" + + "end of source" shift, and go to state 69 + + +State 19 + + 4 source: version_1_0 . kdbtext_1_0_opt + + KW_alias shift, and go to state 2 + KW_const shift, and go to state 3 + KW_database shift, and go to state 4 + KW_extern shift, and go to state 5 + KW_fmtdef shift, and go to state 6 + KW_function shift, and go to state 7 + KW_include shift, and go to state 8 + KW_physical shift, and go to state 9 + KW_kdbtext shift, and go to state 10 + KW_table shift, and go to state 11 + KW_typedef shift, and go to state 12 + KW_typeset shift, and go to state 13 + KW_validate shift, and go to state 14 + ';' shift, and go to state 16 + + $default reduce using rule 251 (empty) + + kdbtext_1_0_opt go to state 70 + kdbtext_1_0 go to state 71 + kdbtext_1_0_decl go to state 21 + typedef_1_0_decl go to state 22 + typeset_1_0_decl go to state 23 + format_1_0_decl go to state 24 + const_1_0_decl go to state 25 + alias_1_0_decl go to state 26 + function_1_0_decl go to state 27 + extern_1_0_decl go to state 28 + script_1_0_decl go to state 29 + validate_1_0_decl go to state 30 + physical_1_0_decl go to state 31 + table_1_0_decl go to state 32 + database_1_0_decl go to state 33 + include_directive go to state 34 + empty go to state 72 + + +State 20 + + 3 source: kdbtext_1_0 . + 10 kdbtext_1_0: kdbtext_1_0 . kdbtext_1_0_decl + + KW_alias shift, and go to state 2 + KW_const shift, and go to state 3 + KW_database shift, and go to state 4 + KW_extern shift, and go to state 5 + KW_fmtdef shift, and go to state 6 + KW_function shift, and go to state 7 + KW_include shift, and go to state 8 + KW_physical shift, and go to state 9 + KW_kdbtext shift, and go to state 10 + KW_table shift, and go to state 11 + KW_typedef shift, and go to state 12 + KW_typeset shift, and go to state 13 + KW_validate shift, and go to state 14 + ';' shift, and go to state 16 + + $default reduce using rule 3 (source) + + kdbtext_1_0_decl go to state 73 + typedef_1_0_decl go to state 22 + typeset_1_0_decl go to state 23 + format_1_0_decl go to state 24 + const_1_0_decl go to state 25 + alias_1_0_decl go to state 26 + function_1_0_decl go to state 27 + extern_1_0_decl go to state 28 + script_1_0_decl go to state 29 + validate_1_0_decl go to state 30 + physical_1_0_decl go to state 31 + table_1_0_decl go to state 32 + database_1_0_decl go to state 33 + include_directive go to state 34 + + +State 21 + + 9 kdbtext_1_0: kdbtext_1_0_decl . + + $default reduce using rule 9 (kdbtext_1_0) + + +State 22 + + 11 kdbtext_1_0_decl: typedef_1_0_decl . + + $default reduce using rule 11 (kdbtext_1_0_decl) + + +State 23 + + 12 kdbtext_1_0_decl: typeset_1_0_decl . + + $default reduce using rule 12 (kdbtext_1_0_decl) + + +State 24 + + 13 kdbtext_1_0_decl: format_1_0_decl . + + $default reduce using rule 13 (kdbtext_1_0_decl) + + +State 25 + + 14 kdbtext_1_0_decl: const_1_0_decl . + + $default reduce using rule 14 (kdbtext_1_0_decl) + + +State 26 + + 15 kdbtext_1_0_decl: alias_1_0_decl . + + $default reduce using rule 15 (kdbtext_1_0_decl) + + +State 27 + + 16 kdbtext_1_0_decl: function_1_0_decl . + + $default reduce using rule 16 (kdbtext_1_0_decl) + + +State 28 + + 17 kdbtext_1_0_decl: extern_1_0_decl . + + $default reduce using rule 17 (kdbtext_1_0_decl) + + +State 29 + + 18 kdbtext_1_0_decl: script_1_0_decl . + + $default reduce using rule 18 (kdbtext_1_0_decl) + + +State 30 + + 19 kdbtext_1_0_decl: validate_1_0_decl . + + $default reduce using rule 19 (kdbtext_1_0_decl) + + +State 31 + + 20 kdbtext_1_0_decl: physical_1_0_decl . + + $default reduce using rule 20 (kdbtext_1_0_decl) + + +State 32 + + 21 kdbtext_1_0_decl: table_1_0_decl . + + $default reduce using rule 21 (kdbtext_1_0_decl) + + +State 33 + + 22 kdbtext_1_0_decl: database_1_0_decl . + + $default reduce using rule 22 (kdbtext_1_0_decl) + + +State 34 + + 23 kdbtext_1_0_decl: include_directive . + + $default reduce using rule 23 (kdbtext_1_0_decl) + + +State 35 + + 5 source: version_2_0 . kdbtext_2_0_opt + + KW_alias shift, and go to state 2 + KW_const shift, and go to state 3 + KW_database shift, and go to state 4 + KW_extern shift, and go to state 5 + KW_fmtdef shift, and go to state 6 + KW_function shift, and go to state 7 + KW_include shift, and go to state 8 + KW_physical shift, and go to state 9 + KW_kdbtext shift, and go to state 10 + KW_table shift, and go to state 11 + KW_typedef shift, and go to state 12 + KW_typeset shift, and go to state 13 + KW_validate shift, and go to state 14 + KW_view shift, and go to state 74 + ';' shift, and go to state 16 + + $default reduce using rule 251 (empty) + + kdbtext_1_0_decl go to state 75 + typedef_1_0_decl go to state 22 + typeset_1_0_decl go to state 23 + format_1_0_decl go to state 24 + const_1_0_decl go to state 25 + alias_1_0_decl go to state 26 + function_1_0_decl go to state 27 + extern_1_0_decl go to state 28 + script_1_0_decl go to state 29 + validate_1_0_decl go to state 30 + physical_1_0_decl go to state 31 + table_1_0_decl go to state 32 + database_1_0_decl go to state 33 + include_directive go to state 34 + empty go to state 76 + kdbtext_2_0_opt go to state 77 + kdbtext_2_0 go to state 78 + kdbtext_2_0_decl go to state 79 + view_2_0_decl go to state 80 + + +State 36 + + 250 ident_1_0: IDENTIFIER_1_0 . + + $default reduce using rule 250 (ident_1_0) + + +State 37 + + 42 alias_1_0_decl: KW_alias fqn_1_0 . alias_1_0_new_name ';' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + IDENTIFIER_1_0 shift, and go to state 36 + ':' shift, and go to state 81 + + alias_1_0_new_name go to state 82 + fqn_1_0 go to state 83 + ident_1_0 go to state 38 + + +State 38 + + 240 fqn_1_0: ident_1_0 . + + $default reduce using rule 240 (fqn_1_0) + + +State 39 + + 41 const_1_0_decl: KW_const typespec_1_0 . fqn_1_0 '=' expression_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 84 + ident_1_0 go to state 38 + + +State 40 + + 33 typespec_1_0: fqn_1_0 . + 34 | fqn_1_0 . '[' dim_1_0 ']' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '[' shift, and go to state 85 + ':' shift, and go to state 81 + + $default reduce using rule 33 (typespec_1_0) + + +State 41 + + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + 252 fqn_vers: fqn_1_0 . VERSION + + VERSION shift, and go to state 86 + ':' shift, and go to state 81 + + +State 42 + + 220 database_1_0_decl: KW_database fqn_vers . opt_database_dad_1_0 database_body_1_0 + + '=' shift, and go to state 87 + + $default reduce using rule 251 (empty) + + opt_database_dad_1_0 go to state 88 + empty go to state 89 + + +State 43 + + 90 ext_func_1_0_decl: function_1_0_decl . + + $default reduce using rule 90 (ext_func_1_0_decl) + + +State 44 + + 89 extern_1_0_decl: KW_extern ext_func_1_0_decl . + + $default reduce using rule 89 (extern_1_0_decl) + + +State 45 + + 37 format_1_0_decl: KW_fmtdef format_1_0_new_name . ';' + + ';' shift, and go to state 90 + + +State 46 + + 38 format_1_0_decl: KW_fmtdef format_1_0_name . format_1_0_new_name ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + format_1_0_new_name go to state 91 + fqn_1_0 go to state 92 + ident_1_0 go to state 38 + + +State 47 + + 39 format_1_0_new_name: fqn_1_0 . + 40 format_1_0_name: fqn_1_0 . + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + ':' shift, and go to state 81 + + IDENTIFIER_1_0 reduce using rule 40 (format_1_0_name) + $default reduce using rule 39 (format_1_0_new_name) + + +State 48 + + 49 row_length_func_1_0_decl: KW___row_length . fqn_1_0 '(' ')' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 93 + ident_1_0 go to state 38 + + +State 49 + + 48 untyped_func_1_0_decl: KW___untyped . fqn_1_0 '(' ')' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 94 + ident_1_0 go to state 38 + + +State 50 + + 52 func_1_0_kdbtext_sig: '<' . func_1_0_kdbtext_formals '>' + + IDENTIFIER_1_0 shift, and go to state 36 + KW_type shift, and go to state 95 + + typespec_1_0 go to state 96 + func_1_0_kdbtext_formals go to state 97 + func_1_0_kdbtext_formal go to state 98 + type_expr_1_0 go to state 99 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 51 + + 44 function_1_0_decl: KW_function func_1_0_decl . + + $default reduce using rule 44 (function_1_0_decl) + + +State 52 + + 45 func_1_0_decl: untyped_func_1_0_decl . + + $default reduce using rule 45 (func_1_0_decl) + + +State 53 + + 46 func_1_0_decl: row_length_func_1_0_decl . + + $default reduce using rule 46 (func_1_0_decl) + + +State 54 + + 47 func_1_0_decl: opt_func_1_0_kdbtext_sig . func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue + + IDENTIFIER_1_0 shift, and go to state 36 + KW_void shift, and go to state 101 + + typespec_1_0 go to state 96 + func_1_0_return_type go to state 102 + type_expr_1_0 go to state 103 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 55 + + 51 opt_func_1_0_kdbtext_sig: func_1_0_kdbtext_sig . + + $default reduce using rule 51 (opt_func_1_0_kdbtext_sig) + + +State 56 + + 50 opt_func_1_0_kdbtext_sig: empty . + + $default reduce using rule 50 (opt_func_1_0_kdbtext_sig) + + +State 57 + + 239 include_directive: KW_include STRING . + + $default reduce using rule 239 (include_directive) + + +State 58 + + 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig . phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue + + IDENTIFIER_1_0 shift, and go to state 36 + KW___no_header shift, and go to state 104 + KW_void shift, and go to state 101 + + typespec_1_0 go to state 96 + func_1_0_return_type go to state 105 + phys_1_0_return_type go to state 106 + type_expr_1_0 go to state 103 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 59 + + 92 script_1_0_decl: KW_kdbtext KW_function . func_1_0_decl + + KW___row_length shift, and go to state 48 + KW___untyped shift, and go to state 49 + '<' shift, and go to state 50 + + $default reduce using rule 251 (empty) + + func_1_0_decl go to state 107 + untyped_func_1_0_decl go to state 52 + row_length_func_1_0_decl go to state 53 + opt_func_1_0_kdbtext_sig go to state 54 + func_1_0_kdbtext_sig go to state 55 + empty go to state 56 + + +State 60 + + 91 script_1_0_decl: KW_kdbtext func_1_0_decl . + + $default reduce using rule 91 (script_1_0_decl) + + +State 61 + + 106 table_1_0_decl: KW_table fqn_vers . opt_tbl_1_0_parents tbl_1_0_body + + '=' shift, and go to state 108 + + $default reduce using rule 251 (empty) + + opt_tbl_1_0_parents go to state 109 + empty go to state 110 + + +State 62 + + 25 typedef_1_0_decl: KW_typedef fqn_1_0 . typedef_1_0_new_name_list ';' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + IDENTIFIER_1_0 shift, and go to state 36 + ':' shift, and go to state 81 + + typedef_1_0_new_name_list go to state 111 + typespec_1_0 go to state 112 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 63 + + 28 typeset_1_0_decl: KW_typeset typeset_1_0_new_name . typeset_1_0_def ';' + + '{' shift, and go to state 113 + + typeset_1_0_def go to state 114 + + +State 64 + + 29 typeset_1_0_new_name: fqn_1_0 . + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + ':' shift, and go to state 81 + + $default reduce using rule 29 (typeset_1_0_new_name) + + +State 65 + + 93 validate_1_0_decl: KW_validate function_1_0_decl . + + $default reduce using rule 93 (validate_1_0_decl) + + +State 66 + + 6 version_1_0: KW_version VERS_1_0 . ';' + + ';' shift, and go to state 115 + + +State 67 + + 255 version_2_0: KW_version VERS_2_0 . ';' + + ';' shift, and go to state 116 + + +State 68 + + 0 $accept: parse "end of source" . + + $default accept + + +State 69 + + 2 parse: source "end of source" . + + $default reduce using rule 2 (parse) + + +State 70 + + 4 source: version_1_0 kdbtext_1_0_opt . + + $default reduce using rule 4 (source) + + +State 71 + + 7 kdbtext_1_0_opt: kdbtext_1_0 . + 10 kdbtext_1_0: kdbtext_1_0 . kdbtext_1_0_decl + + KW_alias shift, and go to state 2 + KW_const shift, and go to state 3 + KW_database shift, and go to state 4 + KW_extern shift, and go to state 5 + KW_fmtdef shift, and go to state 6 + KW_function shift, and go to state 7 + KW_include shift, and go to state 8 + KW_physical shift, and go to state 9 + KW_kdbtext shift, and go to state 10 + KW_table shift, and go to state 11 + KW_typedef shift, and go to state 12 + KW_typeset shift, and go to state 13 + KW_validate shift, and go to state 14 + ';' shift, and go to state 16 + + $default reduce using rule 7 (kdbtext_1_0_opt) + + kdbtext_1_0_decl go to state 73 + typedef_1_0_decl go to state 22 + typeset_1_0_decl go to state 23 + format_1_0_decl go to state 24 + const_1_0_decl go to state 25 + alias_1_0_decl go to state 26 + function_1_0_decl go to state 27 + extern_1_0_decl go to state 28 + script_1_0_decl go to state 29 + validate_1_0_decl go to state 30 + physical_1_0_decl go to state 31 + table_1_0_decl go to state 32 + database_1_0_decl go to state 33 + include_directive go to state 34 + + +State 72 + + 8 kdbtext_1_0_opt: empty . + + $default reduce using rule 8 (kdbtext_1_0_opt) + + +State 73 + + 10 kdbtext_1_0: kdbtext_1_0 kdbtext_1_0_decl . + + $default reduce using rule 10 (kdbtext_1_0) + + +State 74 + + 262 view_2_0_decl: KW_view . fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body '}' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 41 + ident_1_0 go to state 38 + fqn_vers go to state 117 + + +State 75 + + 260 kdbtext_2_0_decl: kdbtext_1_0_decl . + + $default reduce using rule 260 (kdbtext_2_0_decl) + + +State 76 + + 257 kdbtext_2_0_opt: empty . + + $default reduce using rule 257 (kdbtext_2_0_opt) + + +State 77 + + 5 source: version_2_0 kdbtext_2_0_opt . + + $default reduce using rule 5 (source) + + +State 78 + + 256 kdbtext_2_0_opt: kdbtext_2_0 . + 259 kdbtext_2_0: kdbtext_2_0 . kdbtext_2_0_decl + + KW_alias shift, and go to state 2 + KW_const shift, and go to state 3 + KW_database shift, and go to state 4 + KW_extern shift, and go to state 5 + KW_fmtdef shift, and go to state 6 + KW_function shift, and go to state 7 + KW_include shift, and go to state 8 + KW_physical shift, and go to state 9 + KW_kdbtext shift, and go to state 10 + KW_table shift, and go to state 11 + KW_typedef shift, and go to state 12 + KW_typeset shift, and go to state 13 + KW_validate shift, and go to state 14 + KW_view shift, and go to state 74 + ';' shift, and go to state 16 + + $default reduce using rule 256 (kdbtext_2_0_opt) + + kdbtext_1_0_decl go to state 75 + typedef_1_0_decl go to state 22 + typeset_1_0_decl go to state 23 + format_1_0_decl go to state 24 + const_1_0_decl go to state 25 + alias_1_0_decl go to state 26 + function_1_0_decl go to state 27 + extern_1_0_decl go to state 28 + script_1_0_decl go to state 29 + validate_1_0_decl go to state 30 + physical_1_0_decl go to state 31 + table_1_0_decl go to state 32 + database_1_0_decl go to state 33 + include_directive go to state 34 + kdbtext_2_0_decl go to state 118 + view_2_0_decl go to state 80 + + +State 79 + + 258 kdbtext_2_0: kdbtext_2_0_decl . + + $default reduce using rule 258 (kdbtext_2_0) + + +State 80 + + 261 kdbtext_2_0_decl: view_2_0_decl . + + $default reduce using rule 261 (kdbtext_2_0_decl) + + +State 81 + + 241 fqn_1_0: fqn_1_0 ':' . ident_1_0 + 242 | fqn_1_0 ':' . KW_database + 243 | fqn_1_0 ':' . KW_decode + 244 | fqn_1_0 ':' . KW_encode + 245 | fqn_1_0 ':' . KW_read + 246 | fqn_1_0 ':' . KW_table + 247 | fqn_1_0 ':' . KW_type + 248 | fqn_1_0 ':' . KW_view + 249 | fqn_1_0 ':' . KW_write + + IDENTIFIER_1_0 shift, and go to state 36 + KW_database shift, and go to state 119 + KW_decode shift, and go to state 120 + KW_encode shift, and go to state 121 + KW_read shift, and go to state 122 + KW_table shift, and go to state 123 + KW_type shift, and go to state 124 + KW_view shift, and go to state 125 + KW_write shift, and go to state 126 + + ident_1_0 go to state 127 + + +State 82 + + 42 alias_1_0_decl: KW_alias fqn_1_0 alias_1_0_new_name . ';' + + ';' shift, and go to state 128 + + +State 83 + + 43 alias_1_0_new_name: fqn_1_0 . + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + ':' shift, and go to state 81 + + $default reduce using rule 43 (alias_1_0_new_name) + + +State 84 + + 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 . '=' expression_1_0 ';' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '=' shift, and go to state 129 + ':' shift, and go to state 81 + + +State 85 + + 34 typespec_1_0: fqn_1_0 '[' . dim_1_0 ']' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '*' shift, and go to state 141 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + dim_1_0 go to state 147 + phys_ident go to state 148 + expression_1_0 go to state 149 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 86 + + 252 fqn_vers: fqn_1_0 VERSION . + + $default reduce using rule 252 (fqn_vers) + + +State 87 + + 222 opt_database_dad_1_0: '=' . fqn_opt_vers + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 164 + + +State 88 + + 220 database_1_0_decl: KW_database fqn_vers opt_database_dad_1_0 . database_body_1_0 + + '{' shift, and go to state 165 + + database_body_1_0 go to state 166 + + +State 89 + + 221 opt_database_dad_1_0: empty . + + $default reduce using rule 221 (opt_database_dad_1_0) + + +State 90 + + 37 format_1_0_decl: KW_fmtdef format_1_0_new_name ';' . + + $default reduce using rule 37 (format_1_0_decl) + + +State 91 + + 38 format_1_0_decl: KW_fmtdef format_1_0_name format_1_0_new_name . ';' + + ';' shift, and go to state 167 + + +State 92 + + 39 format_1_0_new_name: fqn_1_0 . + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + ':' shift, and go to state 81 + + $default reduce using rule 39 (format_1_0_new_name) + + +State 93 + + 49 row_length_func_1_0_decl: KW___row_length fqn_1_0 . '(' ')' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '(' shift, and go to state 168 + ':' shift, and go to state 81 + + +State 94 + + 48 untyped_func_1_0_decl: KW___untyped fqn_1_0 . '(' ')' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '(' shift, and go to state 169 + ':' shift, and go to state 81 + + +State 95 + + 55 func_1_0_kdbtext_formal: KW_type . ident_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 170 + + +State 96 + + 214 type_expr_1_0: typespec_1_0 . + + $default reduce using rule 214 (type_expr_1_0) + + +State 97 + + 52 func_1_0_kdbtext_sig: '<' func_1_0_kdbtext_formals . '>' + 54 func_1_0_kdbtext_formals: func_1_0_kdbtext_formals . ',' func_1_0_kdbtext_formal + + ',' shift, and go to state 171 + '>' shift, and go to state 172 + + +State 98 + + 53 func_1_0_kdbtext_formals: func_1_0_kdbtext_formal . + + $default reduce using rule 53 (func_1_0_kdbtext_formals) + + +State 99 + + 56 func_1_0_kdbtext_formal: type_expr_1_0 . ident_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 173 + + +State 100 + + 33 typespec_1_0: fqn_1_0 . + 34 | fqn_1_0 . '[' dim_1_0 ']' + 215 type_expr_1_0: fqn_1_0 . '/' fqn_1_0 + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '[' shift, and go to state 85 + '/' shift, and go to state 174 + ':' shift, and go to state 81 + + $default reduce using rule 33 (typespec_1_0) + + +State 101 + + 57 func_1_0_return_type: KW_void . + + $default reduce using rule 57 (func_1_0_return_type) + + +State 102 + + 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type . fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 175 + + +State 103 + + 58 func_1_0_return_type: type_expr_1_0 . + + $default reduce using rule 58 (func_1_0_return_type) + + +State 104 + + 96 phys_1_0_return_type: KW___no_header . func_1_0_return_type + + IDENTIFIER_1_0 shift, and go to state 36 + KW_void shift, and go to state 101 + + typespec_1_0 go to state 96 + func_1_0_return_type go to state 176 + type_expr_1_0 go to state 103 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 105 + + 95 phys_1_0_return_type: func_1_0_return_type . + + $default reduce using rule 95 (phys_1_0_return_type) + + +State 106 + + 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type . fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 41 + ident_1_0 go to state 38 + fqn_vers go to state 177 + + +State 107 + + 92 script_1_0_decl: KW_kdbtext KW_function func_1_0_decl . + + $default reduce using rule 92 (script_1_0_decl) + + +State 108 + + 108 opt_tbl_1_0_parents: '=' . tbl_1_0_parents + + IDENTIFIER_1_0 shift, and go to state 36 + + tbl_1_0_parents go to state 178 + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 179 + + +State 109 + + 106 table_1_0_decl: KW_table fqn_vers opt_tbl_1_0_parents . tbl_1_0_body + + '{' shift, and go to state 180 + + tbl_1_0_body go to state 181 + + +State 110 + + 107 opt_tbl_1_0_parents: empty . + + $default reduce using rule 107 (opt_tbl_1_0_parents) + + +State 111 + + 25 typedef_1_0_decl: KW_typedef fqn_1_0 typedef_1_0_new_name_list . ';' + 27 typedef_1_0_new_name_list: typedef_1_0_new_name_list . ',' typespec_1_0 + + ';' shift, and go to state 182 + ',' shift, and go to state 183 + + +State 112 + + 26 typedef_1_0_new_name_list: typespec_1_0 . + + $default reduce using rule 26 (typedef_1_0_new_name_list) + + +State 113 + + 30 typeset_1_0_def: '{' . typespec_1_0_list '}' + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0_list go to state 184 + typespec_1_0 go to state 185 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 114 + + 28 typeset_1_0_decl: KW_typeset typeset_1_0_new_name typeset_1_0_def . ';' + + ';' shift, and go to state 186 + + +State 115 + + 6 version_1_0: KW_version VERS_1_0 ';' . + + $default reduce using rule 6 (version_1_0) + + +State 116 + + 255 version_2_0: KW_version VERS_2_0 ';' . + + $default reduce using rule 255 (version_2_0) + + +State 117 + + 262 view_2_0_decl: KW_view fqn_vers . '<' view_parms '>' opt_view_parents '{' opt_view_body '}' + + '<' shift, and go to state 187 + + +State 118 + + 259 kdbtext_2_0: kdbtext_2_0 kdbtext_2_0_decl . + + $default reduce using rule 259 (kdbtext_2_0) + + +State 119 + + 242 fqn_1_0: fqn_1_0 ':' KW_database . + + $default reduce using rule 242 (fqn_1_0) + + +State 120 + + 243 fqn_1_0: fqn_1_0 ':' KW_decode . + + $default reduce using rule 243 (fqn_1_0) + + +State 121 + + 244 fqn_1_0: fqn_1_0 ':' KW_encode . + + $default reduce using rule 244 (fqn_1_0) + + +State 122 + + 245 fqn_1_0: fqn_1_0 ':' KW_read . + + $default reduce using rule 245 (fqn_1_0) + + +State 123 + + 246 fqn_1_0: fqn_1_0 ':' KW_table . + + $default reduce using rule 246 (fqn_1_0) + + +State 124 + + 247 fqn_1_0: fqn_1_0 ':' KW_type . + + $default reduce using rule 247 (fqn_1_0) + + +State 125 + + 248 fqn_1_0: fqn_1_0 ':' KW_view . + + $default reduce using rule 248 (fqn_1_0) + + +State 126 + + 249 fqn_1_0: fqn_1_0 ':' KW_write . + + $default reduce using rule 249 (fqn_1_0) + + +State 127 + + 241 fqn_1_0: fqn_1_0 ':' ident_1_0 . + + $default reduce using rule 241 (fqn_1_0) + + +State 128 + + 42 alias_1_0_decl: KW_alias fqn_1_0 alias_1_0_new_name ';' . + + $default reduce using rule 42 (alias_1_0_decl) + + +State 129 + + 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 '=' . expression_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 188 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 130 + + 200 uint_expr_1_0: DECIMAL . + + $default reduce using rule 200 (uint_expr_1_0) + + +State 131 + + 202 uint_expr_1_0: OCTAL . + + $default reduce using rule 202 (uint_expr_1_0) + + +State 132 + + 201 uint_expr_1_0: HEX . + + $default reduce using rule 201 (uint_expr_1_0) + + +State 133 + + 203 float_expr_1_0: FLOAT_ . + + $default reduce using rule 203 (float_expr_1_0) + + +State 134 + + 204 float_expr_1_0: EXP_FLOAT . + + $default reduce using rule 204 (float_expr_1_0) + + +State 135 + + 205 string_expr_1_0: STRING . + + $default reduce using rule 205 (string_expr_1_0) + + +State 136 + + 206 string_expr_1_0: ESCAPED_STRING . + + $default reduce using rule 206 (string_expr_1_0) + + +State 137 + + 144 phys_ident: PHYSICAL_IDENTIFIER_1_0 . + + $default reduce using rule 144 (phys_ident) + + +State 138 + + 213 bool_expr_1_0: KW_false . + + $default reduce using rule 213 (bool_expr_1_0) + + +State 139 + + 212 bool_expr_1_0: KW_true . + + $default reduce using rule 212 (bool_expr_1_0) + + +State 140 + + 207 const_vect_expr_1_0: '[' . opt_const_vect_exprlist_1_0 ']' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + $default reduce using rule 251 (empty) + + phys_ident go to state 148 + expression_1_0 go to state 189 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + opt_const_vect_exprlist_1_0 go to state 190 + const_vect_exprlist_1_0 go to state 191 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + empty go to state 192 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 141 + + 36 dim_1_0: '*' . + + $default reduce using rule 36 (dim_1_0) + + +State 142 + + 170 expression_1_0: '(' . type_expr_1_0 ')' expression_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 96 + type_expr_1_0 go to state 193 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 143 + + 184 func_expr_1_0: '<' . kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + IDENTIFIER_1_0 shift, and go to state 36 + + kdbtext_parms_1_0 go to state 194 + kdbtext_parm_1_0 go to state 195 + uint_expr_1_0 go to state 196 + fqn_1_0 go to state 197 + ident_1_0 go to state 38 + + +State 144 + + 173 primary_expr_1_0: '@' . + + $default reduce using rule 173 (primary_expr_1_0) + + +State 145 + + 180 primary_expr_1_0: '-' . expression_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 198 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 146 + + 181 primary_expr_1_0: '+' . expression_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 199 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 147 + + 34 typespec_1_0: fqn_1_0 '[' dim_1_0 . ']' + + ']' shift, and go to state 200 + + +State 148 + + 172 primary_expr_1_0: phys_ident . + + $default reduce using rule 172 (primary_expr_1_0) + + +State 149 + + 35 dim_1_0: expression_1_0 . + + $default reduce using rule 35 (dim_1_0) + + +State 150 + + 169 expression_1_0: primary_expr_1_0 . + + $default reduce using rule 169 (expression_1_0) + + +State 151 + + 174 primary_expr_1_0: func_expr_1_0 . + + $default reduce using rule 174 (primary_expr_1_0) + + +State 152 + + 175 primary_expr_1_0: uint_expr_1_0 . + + $default reduce using rule 175 (primary_expr_1_0) + + +State 153 + + 176 primary_expr_1_0: float_expr_1_0 . + + $default reduce using rule 176 (primary_expr_1_0) + + +State 154 + + 177 primary_expr_1_0: string_expr_1_0 . + + $default reduce using rule 177 (primary_expr_1_0) + + +State 155 + + 178 primary_expr_1_0: const_vect_expr_1_0 . + + $default reduce using rule 178 (primary_expr_1_0) + + +State 156 + + 179 primary_expr_1_0: bool_expr_1_0 . + + $default reduce using rule 179 (primary_expr_1_0) + + +State 157 + + 182 primary_expr_1_0: member_expr_2_0 . + + $default reduce using rule 182 (primary_expr_1_0) + + +State 158 + + 183 primary_expr_1_0: join_expr_2_0 . + + $default reduce using rule 183 (primary_expr_1_0) + + +State 159 + + 171 primary_expr_1_0: fqn_1_0 . + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + 252 fqn_vers: fqn_1_0 . VERSION + 253 fqn_opt_vers: fqn_1_0 . + + VERSION shift, and go to state 86 + ':' shift, and go to state 81 + + '(' reduce using rule 253 (fqn_opt_vers) + '<' reduce using rule 253 (fqn_opt_vers) + $default reduce using rule 171 (primary_expr_1_0) + + +State 160 + + 216 member_expr_2_0: ident_1_0 . '.' ident_1_0 + 217 | ident_1_0 . PHYSICAL_IDENTIFIER_1_0 + 218 join_expr_2_0: ident_1_0 . '[' cond_expr_1_0 ']' '.' ident_1_0 + 219 | ident_1_0 . '[' cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 + 240 fqn_1_0: ident_1_0 . + + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 201 + '[' shift, and go to state 202 + '.' shift, and go to state 203 + + $default reduce using rule 240 (fqn_1_0) + + +State 161 + + 254 fqn_opt_vers: fqn_vers . + + $default reduce using rule 254 (fqn_opt_vers) + + +State 162 + + 185 func_expr_1_0: fqn_opt_vers . opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' + + '<' shift, and go to state 204 + + $default reduce using rule 251 (empty) + + opt_factory_parms_1_0 go to state 205 + factory_parms_1_0 go to state 206 + empty go to state 207 + + +State 163 + + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + 252 fqn_vers: fqn_1_0 . VERSION + 253 fqn_opt_vers: fqn_1_0 . + + VERSION shift, and go to state 86 + ':' shift, and go to state 81 + + $default reduce using rule 253 (fqn_opt_vers) + + +State 164 + + 222 opt_database_dad_1_0: '=' fqn_opt_vers . + + $default reduce using rule 222 (opt_database_dad_1_0) + + +State 165 + + 223 database_body_1_0: '{' . '}' + 224 | '{' . database_members_1_0 '}' + + KW_alias shift, and go to state 208 + KW_template shift, and go to state 209 + ';' shift, and go to state 210 + '}' shift, and go to state 211 + + $default reduce using rule 251 (empty) + + database_members_1_0 go to state 212 + database_member_1_0 go to state 213 + opt_template_1_0 go to state 214 + db_member_1_0 go to state 215 + table_member_1_0 go to state 216 + alias_member_1_0 go to state 217 + empty go to state 218 + + +State 166 + + 220 database_1_0_decl: KW_database fqn_vers opt_database_dad_1_0 database_body_1_0 . + + $default reduce using rule 220 (database_1_0_decl) + + +State 167 + + 38 format_1_0_decl: KW_fmtdef format_1_0_name format_1_0_new_name ';' . + + $default reduce using rule 38 (format_1_0_decl) + + +State 168 + + 49 row_length_func_1_0_decl: KW___row_length fqn_1_0 '(' . ')' + + ')' shift, and go to state 219 + + +State 169 + + 48 untyped_func_1_0_decl: KW___untyped fqn_1_0 '(' . ')' + + ')' shift, and go to state 220 + + +State 170 + + 55 func_1_0_kdbtext_formal: KW_type ident_1_0 . + + $default reduce using rule 55 (func_1_0_kdbtext_formal) + + +State 171 + + 54 func_1_0_kdbtext_formals: func_1_0_kdbtext_formals ',' . func_1_0_kdbtext_formal + + IDENTIFIER_1_0 shift, and go to state 36 + KW_type shift, and go to state 95 + + typespec_1_0 go to state 96 + func_1_0_kdbtext_formal go to state 221 + type_expr_1_0 go to state 99 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 172 + + 52 func_1_0_kdbtext_sig: '<' func_1_0_kdbtext_formals '>' . + + $default reduce using rule 52 (func_1_0_kdbtext_sig) + + +State 173 + + 56 func_1_0_kdbtext_formal: type_expr_1_0 ident_1_0 . + + $default reduce using rule 56 (func_1_0_kdbtext_formal) + + +State 174 + + 215 type_expr_1_0: fqn_1_0 '/' . fqn_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 222 + ident_1_0 go to state 38 + + +State 175 + + 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers . opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue + + '<' shift, and go to state 223 + + $default reduce using rule 251 (empty) + + opt_func_1_0_fact_sig go to state 224 + func_1_0_fact_sig go to state 225 + empty go to state 226 + + +State 176 + + 96 phys_1_0_return_type: KW___no_header func_1_0_return_type . + + $default reduce using rule 96 (phys_1_0_return_type) + + +State 177 + + 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers . opt_func_1_0_fact_sig phys_1_0_prologue + + '<' shift, and go to state 223 + + $default reduce using rule 251 (empty) + + opt_func_1_0_fact_sig go to state 227 + func_1_0_fact_sig go to state 225 + empty go to state 226 + + +State 178 + + 108 opt_tbl_1_0_parents: '=' tbl_1_0_parents . + 110 tbl_1_0_parents: tbl_1_0_parents . ',' fqn_opt_vers + + ',' shift, and go to state 228 + + $default reduce using rule 108 (opt_tbl_1_0_parents) + + +State 179 + + 109 tbl_1_0_parents: fqn_opt_vers . + + $default reduce using rule 109 (tbl_1_0_parents) + + +State 180 + + 111 tbl_1_0_body: '{' . tbl_1_0_stmt_seq '}' + 112 | '{' . '}' + + IDENTIFIER_1_0 shift, and go to state 36 + KW___untyped shift, and go to state 229 + KW_column shift, and go to state 230 + KW_default shift, and go to state 231 + KW_extern shift, and go to state 232 + KW_physical shift, and go to state 233 + KW_readonly shift, and go to state 234 + KW_static shift, and go to state 235 + KW_trigger shift, and go to state 236 + ';' shift, and go to state 237 + '}' shift, and go to state 238 + + typespec_1_0 go to state 239 + tbl_1_0_stmt_seq go to state 240 + tbl_1_0_stmt go to state 241 + production_1_0_stmt go to state 242 + col_1_0_modifiers go to state 243 + col_1_0_modifier_seq go to state 244 + col_1_0_modifier go to state 245 + default_view_1_0_decl go to state 246 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 181 + + 106 table_1_0_decl: KW_table fqn_vers opt_tbl_1_0_parents tbl_1_0_body . + + $default reduce using rule 106 (table_1_0_decl) + + +State 182 + + 25 typedef_1_0_decl: KW_typedef fqn_1_0 typedef_1_0_new_name_list ';' . + + $default reduce using rule 25 (typedef_1_0_decl) + + +State 183 + + 27 typedef_1_0_new_name_list: typedef_1_0_new_name_list ',' . typespec_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 247 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 184 + + 30 typeset_1_0_def: '{' typespec_1_0_list . '}' + 32 typespec_1_0_list: typespec_1_0_list . ',' typespec_1_0 + + ',' shift, and go to state 248 + '}' shift, and go to state 249 + + +State 185 + + 31 typespec_1_0_list: typespec_1_0 . + + $default reduce using rule 31 (typespec_1_0_list) + + +State 186 + + 28 typeset_1_0_decl: KW_typeset typeset_1_0_new_name typeset_1_0_def ';' . + + $default reduce using rule 28 (typeset_1_0_decl) + + +State 187 + + 262 view_2_0_decl: KW_view fqn_vers '<' . view_parms '>' opt_view_parents '{' opt_view_body '}' + + IDENTIFIER_1_0 shift, and go to state 36 + + view_parms go to state 250 + fqn_1_0 go to state 163 + ident_1_0 go to state 251 + fqn_vers go to state 161 + fqn_opt_vers go to state 252 + view_parm go to state 253 + + +State 188 + + 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 '=' expression_1_0 . ';' + + ';' shift, and go to state 254 + + +State 189 + + 210 const_vect_exprlist_1_0: expression_1_0 . + + $default reduce using rule 210 (const_vect_exprlist_1_0) + + +State 190 + + 207 const_vect_expr_1_0: '[' opt_const_vect_exprlist_1_0 . ']' + + ']' shift, and go to state 255 + + +State 191 + + 209 opt_const_vect_exprlist_1_0: const_vect_exprlist_1_0 . + 211 const_vect_exprlist_1_0: const_vect_exprlist_1_0 . ',' expression_1_0 + + ',' shift, and go to state 256 + + $default reduce using rule 209 (opt_const_vect_exprlist_1_0) + + +State 192 + + 208 opt_const_vect_exprlist_1_0: empty . + + $default reduce using rule 208 (opt_const_vect_exprlist_1_0) + + +State 193 + + 170 expression_1_0: '(' type_expr_1_0 . ')' expression_1_0 + + ')' shift, and go to state 257 + + +State 194 + + 184 func_expr_1_0: '<' kdbtext_parms_1_0 . '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' + 187 kdbtext_parms_1_0: kdbtext_parms_1_0 . ',' kdbtext_parm_1_0 + + ',' shift, and go to state 258 + '>' shift, and go to state 259 + + +State 195 + + 186 kdbtext_parms_1_0: kdbtext_parm_1_0 . + + $default reduce using rule 186 (kdbtext_parms_1_0) + + +State 196 + + 190 kdbtext_parm_1_0: uint_expr_1_0 . + + $default reduce using rule 190 (kdbtext_parm_1_0) + + +State 197 + + 188 kdbtext_parm_1_0: fqn_1_0 . + 189 | fqn_1_0 . '[' dim_1_0 ']' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '[' shift, and go to state 260 + ':' shift, and go to state 81 + + $default reduce using rule 188 (kdbtext_parm_1_0) + + +State 198 + + 180 primary_expr_1_0: '-' expression_1_0 . + + $default reduce using rule 180 (primary_expr_1_0) + + +State 199 + + 181 primary_expr_1_0: '+' expression_1_0 . + + $default reduce using rule 181 (primary_expr_1_0) + + +State 200 + + 34 typespec_1_0: fqn_1_0 '[' dim_1_0 ']' . + + $default reduce using rule 34 (typespec_1_0) + + +State 201 + + 217 member_expr_2_0: ident_1_0 PHYSICAL_IDENTIFIER_1_0 . + + $default reduce using rule 217 (member_expr_2_0) + + +State 202 + + 218 join_expr_2_0: ident_1_0 '[' . cond_expr_1_0 ']' '.' ident_1_0 + 219 | ident_1_0 '[' . cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 261 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 203 + + 216 member_expr_2_0: ident_1_0 '.' . ident_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 263 + + +State 204 + + 193 factory_parms_1_0: '<' . factory_parms '>' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 264 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + factory_parms go to state 265 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 205 + + 185 func_expr_1_0: fqn_opt_vers opt_factory_parms_1_0 . '(' opt_func_1_0_parms ')' + + '(' shift, and go to state 266 + + +State 206 + + 192 opt_factory_parms_1_0: factory_parms_1_0 . + + $default reduce using rule 192 (opt_factory_parms_1_0) + + +State 207 + + 191 opt_factory_parms_1_0: empty . + + $default reduce using rule 191 (opt_factory_parms_1_0) + + +State 208 + + 235 alias_member_1_0: KW_alias . view_spec ident_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + view_spec go to state 267 + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 268 + + +State 209 + + 232 opt_template_1_0: KW_template . + + $default reduce using rule 232 (opt_template_1_0) + + +State 210 + + 230 database_member_1_0: ';' . + + $default reduce using rule 230 (database_member_1_0) + + +State 211 + + 223 database_body_1_0: '{' '}' . + + $default reduce using rule 223 (database_body_1_0) + + +State 212 + + 224 database_body_1_0: '{' database_members_1_0 . '}' + 226 database_members_1_0: database_members_1_0 . database_member_1_0 + + KW_alias shift, and go to state 208 + KW_template shift, and go to state 209 + ';' shift, and go to state 210 + '}' shift, and go to state 269 + + $default reduce using rule 251 (empty) + + database_member_1_0 go to state 270 + opt_template_1_0 go to state 214 + db_member_1_0 go to state 215 + table_member_1_0 go to state 216 + alias_member_1_0 go to state 217 + empty go to state 218 + + +State 213 + + 225 database_members_1_0: database_member_1_0 . + + $default reduce using rule 225 (database_members_1_0) + + +State 214 + + 233 db_member_1_0: opt_template_1_0 . KW_database fqn_opt_vers ident_1_0 ';' + 234 table_member_1_0: opt_template_1_0 . KW_table fqn_opt_vers ident_1_0 ';' + + KW_database shift, and go to state 271 + KW_table shift, and go to state 272 + + +State 215 + + 227 database_member_1_0: db_member_1_0 . + + $default reduce using rule 227 (database_member_1_0) + + +State 216 + + 228 database_member_1_0: table_member_1_0 . + + $default reduce using rule 228 (database_member_1_0) + + +State 217 + + 229 database_member_1_0: alias_member_1_0 . + + $default reduce using rule 229 (database_member_1_0) + + +State 218 + + 231 opt_template_1_0: empty . + + $default reduce using rule 231 (opt_template_1_0) + + +State 219 + + 49 row_length_func_1_0_decl: KW___row_length fqn_1_0 '(' ')' . + + $default reduce using rule 49 (row_length_func_1_0_decl) + + +State 220 + + 48 untyped_func_1_0_decl: KW___untyped fqn_1_0 '(' ')' . + + $default reduce using rule 48 (untyped_func_1_0_decl) + + +State 221 + + 54 func_1_0_kdbtext_formals: func_1_0_kdbtext_formals ',' func_1_0_kdbtext_formal . + + $default reduce using rule 54 (func_1_0_kdbtext_formals) + + +State 222 + + 215 type_expr_1_0: fqn_1_0 '/' fqn_1_0 . + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + ':' shift, and go to state 81 + + $default reduce using rule 215 (type_expr_1_0) + + +State 223 + + 61 func_1_0_fact_sig: '<' . func_1_0_fact_signature '>' + + IDENTIFIER_1_0 shift, and go to state 36 + '*' shift, and go to state 273 + + $default reduce using rule 251 (empty) + + typespec_1_0 go to state 274 + func_1_0_fact_signature go to state 275 + func_1_0_fact_params go to state 276 + fact_param_1_0 go to state 277 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + empty go to state 278 + + +State 224 + + 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig . func_1_0_param_sig func_1_0_prologue + + '(' shift, and go to state 279 + + func_1_0_param_sig go to state 280 + + +State 225 + + 60 opt_func_1_0_fact_sig: func_1_0_fact_sig . + + $default reduce using rule 60 (opt_func_1_0_fact_sig) + + +State 226 + + 59 opt_func_1_0_fact_sig: empty . + + $default reduce using rule 59 (opt_func_1_0_fact_sig) + + +State 227 + + 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig . phys_1_0_prologue + + '{' shift, and go to state 281 + '=' shift, and go to state 282 + + phys_1_0_prologue go to state 283 + + +State 228 + + 110 tbl_1_0_parents: tbl_1_0_parents ',' . fqn_opt_vers + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 284 + + +State 229 + + 123 tbl_1_0_stmt: KW___untyped . '=' fqn_1_0 '(' ')' ';' + + '=' shift, and go to state 285 + + +State 230 + + 117 tbl_1_0_stmt: KW_column . KW_limit '=' expression_1_0 ';' + 118 | KW_column . KW_default KW_limit '=' expression_1_0 ';' + 127 col_1_0_modifiers: KW_column . + + KW_default shift, and go to state 286 + KW_limit shift, and go to state 287 + + $default reduce using rule 127 (col_1_0_modifiers) + + +State 231 + + 131 col_1_0_modifier: KW_default . + 153 default_view_1_0_decl: KW_default . KW_view STRING ';' + + KW_view shift, and go to state 288 + + $default reduce using rule 131 (col_1_0_modifier) + + +State 232 + + 132 col_1_0_modifier: KW_extern . + + $default reduce using rule 132 (col_1_0_modifier) + + +State 233 + + 120 tbl_1_0_stmt: KW_physical . physmbr_1_0_decl + + KW_column shift, and go to state 289 + '<' shift, and go to state 290 + + $default reduce using rule 251 (empty) + + physmbr_1_0_decl go to state 291 + phys_coldef_1_0 go to state 292 + opt_col_kdbtext_parms_1_0 go to state 293 + empty go to state 294 + + +State 234 + + 133 col_1_0_modifier: KW_readonly . + + $default reduce using rule 133 (col_1_0_modifier) + + +State 235 + + 119 tbl_1_0_stmt: KW_static . physmbr_1_0_decl + 121 | KW_static . KW_physical physmbr_1_0_decl + + KW_column shift, and go to state 289 + KW_physical shift, and go to state 295 + '<' shift, and go to state 290 + + $default reduce using rule 251 (empty) + + physmbr_1_0_decl go to state 296 + phys_coldef_1_0 go to state 292 + opt_col_kdbtext_parms_1_0 go to state 293 + empty go to state 294 + + +State 236 + + 126 production_1_0_stmt: KW_trigger . ident_1_0 '=' cond_expr_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 297 + + +State 237 + + 124 tbl_1_0_stmt: ';' . + + $default reduce using rule 124 (tbl_1_0_stmt) + + +State 238 + + 112 tbl_1_0_body: '{' '}' . + + $default reduce using rule 112 (tbl_1_0_body) + + +State 239 + + 125 production_1_0_stmt: typespec_1_0 . ident_1_0 '=' cond_expr_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 298 + + +State 240 + + 111 tbl_1_0_body: '{' tbl_1_0_stmt_seq . '}' + 114 tbl_1_0_stmt_seq: tbl_1_0_stmt_seq . tbl_1_0_stmt + + IDENTIFIER_1_0 shift, and go to state 36 + KW___untyped shift, and go to state 229 + KW_column shift, and go to state 230 + KW_default shift, and go to state 231 + KW_extern shift, and go to state 232 + KW_physical shift, and go to state 233 + KW_readonly shift, and go to state 234 + KW_static shift, and go to state 235 + KW_trigger shift, and go to state 236 + ';' shift, and go to state 237 + '}' shift, and go to state 299 + + typespec_1_0 go to state 239 + tbl_1_0_stmt go to state 300 + production_1_0_stmt go to state 242 + col_1_0_modifiers go to state 243 + col_1_0_modifier_seq go to state 244 + col_1_0_modifier go to state 245 + default_view_1_0_decl go to state 246 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 241 + + 113 tbl_1_0_stmt_seq: tbl_1_0_stmt . + + $default reduce using rule 113 (tbl_1_0_stmt_seq) + + +State 242 + + 115 tbl_1_0_stmt: production_1_0_stmt . + + $default reduce using rule 115 (tbl_1_0_stmt) + + +State 243 + + 116 tbl_1_0_stmt: col_1_0_modifiers . col_1_0_decl + + IDENTIFIER_1_0 shift, and go to state 36 + '<' shift, and go to state 301 + + typespec_1_0 go to state 302 + col_1_0_decl go to state 303 + phys_enc_ref go to state 304 + fqn_1_0 go to state 305 + ident_1_0 go to state 38 + fqn_vers go to state 306 + + +State 244 + + 128 col_1_0_modifiers: col_1_0_modifier_seq . KW_column + 130 col_1_0_modifier_seq: col_1_0_modifier_seq . col_1_0_modifier + + KW_column shift, and go to state 307 + KW_default shift, and go to state 308 + KW_extern shift, and go to state 232 + KW_readonly shift, and go to state 234 + + col_1_0_modifier go to state 309 + + +State 245 + + 129 col_1_0_modifier_seq: col_1_0_modifier . + + $default reduce using rule 129 (col_1_0_modifier_seq) + + +State 246 + + 122 tbl_1_0_stmt: default_view_1_0_decl . + + $default reduce using rule 122 (tbl_1_0_stmt) + + +State 247 + + 27 typedef_1_0_new_name_list: typedef_1_0_new_name_list ',' typespec_1_0 . + + $default reduce using rule 27 (typedef_1_0_new_name_list) + + +State 248 + + 32 typespec_1_0_list: typespec_1_0_list ',' . typespec_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 310 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 249 + + 30 typeset_1_0_def: '{' typespec_1_0_list '}' . + + $default reduce using rule 30 (typeset_1_0_def) + + +State 250 + + 238 view_parms: view_parms . ',' ident_1_0 + 262 view_2_0_decl: KW_view fqn_vers '<' view_parms . '>' opt_view_parents '{' opt_view_body '}' + 264 view_parms: view_parms . ',' view_parm + + ',' shift, and go to state 311 + '>' shift, and go to state 312 + + +State 251 + + 237 view_parms: ident_1_0 . + 240 fqn_1_0: ident_1_0 . + + ',' reduce using rule 237 (view_parms) + '>' reduce using rule 237 (view_parms) + $default reduce using rule 240 (fqn_1_0) + + +State 252 + + 265 view_parm: fqn_opt_vers . ident_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 313 + + +State 253 + + 263 view_parms: view_parm . + + $default reduce using rule 263 (view_parms) + + +State 254 + + 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 '=' expression_1_0 ';' . + + $default reduce using rule 41 (const_1_0_decl) + + +State 255 + + 207 const_vect_expr_1_0: '[' opt_const_vect_exprlist_1_0 ']' . + + $default reduce using rule 207 (const_vect_expr_1_0) + + +State 256 + + 211 const_vect_exprlist_1_0: const_vect_exprlist_1_0 ',' . expression_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 314 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 257 + + 170 expression_1_0: '(' type_expr_1_0 ')' . expression_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 315 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 258 + + 187 kdbtext_parms_1_0: kdbtext_parms_1_0 ',' . kdbtext_parm_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + IDENTIFIER_1_0 shift, and go to state 36 + + kdbtext_parm_1_0 go to state 316 + uint_expr_1_0 go to state 196 + fqn_1_0 go to state 197 + ident_1_0 go to state 38 + + +State 259 + + 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' . fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 317 + + +State 260 + + 189 kdbtext_parm_1_0: fqn_1_0 '[' . dim_1_0 ']' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '*' shift, and go to state 141 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + dim_1_0 go to state 318 + phys_ident go to state 148 + expression_1_0 go to state 149 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 261 + + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 . ']' '.' ident_1_0 + 219 | ident_1_0 '[' cond_expr_1_0 . ']' PHYSICAL_IDENTIFIER_1_0 + + ']' shift, and go to state 319 + '|' shift, and go to state 320 + + +State 262 + + 167 cond_expr_1_0: expression_1_0 . + + $default reduce using rule 167 (cond_expr_1_0) + + +State 263 + + 216 member_expr_2_0: ident_1_0 '.' ident_1_0 . + + $default reduce using rule 216 (member_expr_2_0) + + +State 264 + + 194 factory_parms: expression_1_0 . + + $default reduce using rule 194 (factory_parms) + + +State 265 + + 193 factory_parms_1_0: '<' factory_parms . '>' + 195 factory_parms: factory_parms . ',' expression_1_0 + + ',' shift, and go to state 321 + '>' shift, and go to state 322 + + +State 266 + + 185 func_expr_1_0: fqn_opt_vers opt_factory_parms_1_0 '(' . opt_func_1_0_parms ')' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + $default reduce using rule 251 (empty) + + phys_ident go to state 148 + expression_1_0 go to state 323 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + opt_func_1_0_parms go to state 324 + func_1_0_parms go to state 325 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + empty go to state 326 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 267 + + 235 alias_member_1_0: KW_alias view_spec . ident_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 327 + + +State 268 + + 236 view_spec: fqn_opt_vers . '<' view_parms '>' + + '<' shift, and go to state 328 + + +State 269 + + 224 database_body_1_0: '{' database_members_1_0 '}' . + + $default reduce using rule 224 (database_body_1_0) + + +State 270 + + 226 database_members_1_0: database_members_1_0 database_member_1_0 . + + $default reduce using rule 226 (database_members_1_0) + + +State 271 + + 233 db_member_1_0: opt_template_1_0 KW_database . fqn_opt_vers ident_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 329 + + +State 272 + + 234 table_member_1_0: opt_template_1_0 KW_table . fqn_opt_vers ident_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 330 + + +State 273 + + 64 func_1_0_fact_signature: '*' . func_1_0_fact_params func_1_0_vararg_formals + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 274 + func_1_0_fact_params go to state 331 + fact_param_1_0 go to state 277 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 274 + + 69 fact_param_1_0: typespec_1_0 . IDENTIFIER_1_0 + + IDENTIFIER_1_0 shift, and go to state 332 + + +State 275 + + 61 func_1_0_fact_sig: '<' func_1_0_fact_signature . '>' + + '>' shift, and go to state 333 + + +State 276 + + 63 func_1_0_fact_signature: func_1_0_fact_params . func_1_0_vararg_formals + 65 | func_1_0_fact_params . '*' func_1_0_fact_params func_1_0_vararg_formals + 66 | func_1_0_fact_params . ',' '*' func_1_0_fact_params func_1_0_vararg_formals + 68 func_1_0_fact_params: func_1_0_fact_params . ',' fact_param_1_0 + + ',' shift, and go to state 334 + '*' shift, and go to state 335 + + $default reduce using rule 251 (empty) + + func_1_0_vararg_formals go to state 336 + empty go to state 337 + + +State 277 + + 67 func_1_0_fact_params: fact_param_1_0 . + + $default reduce using rule 67 (func_1_0_fact_params) + + +State 278 + + 62 func_1_0_fact_signature: empty . + + $default reduce using rule 62 (func_1_0_fact_signature) + + +State 279 + + 70 func_1_0_param_sig: '(' . func_1_0_param_signature ')' + + IDENTIFIER_1_0 shift, and go to state 36 + KW_control shift, and go to state 338 + '*' shift, and go to state 339 + + $default reduce using rule 251 (empty) + + typespec_1_0 go to state 340 + func_1_0_param_signature go to state 341 + func_1_0_formal_params go to state 342 + formal_param_1_0 go to state 343 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + empty go to state 344 + + +State 280 + + 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig . func_1_0_prologue + + ';' shift, and go to state 345 + '{' shift, and go to state 346 + '=' shift, and go to state 347 + + func_1_0_prologue go to state 348 + + +State 281 + + 98 phys_1_0_prologue: '{' . phys_1_0_body '}' + + KW___row_length shift, and go to state 349 + KW_decode shift, and go to state 350 + KW_encode shift, and go to state 351 + ';' shift, and go to state 352 + + phys_1_0_body go to state 353 + phys_1_0_body_stmt go to state 354 + + +State 282 + + 97 phys_1_0_prologue: '=' . phys_1_0_stmt + + '{' shift, and go to state 355 + + phys_1_0_stmt go to state 356 + + +State 283 + + 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue . + + $default reduce using rule 94 (physical_1_0_decl) + + +State 284 + + 110 tbl_1_0_parents: tbl_1_0_parents ',' fqn_opt_vers . + + $default reduce using rule 110 (tbl_1_0_parents) + + +State 285 + + 123 tbl_1_0_stmt: KW___untyped '=' . fqn_1_0 '(' ')' ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 357 + ident_1_0 go to state 38 + + +State 286 + + 118 tbl_1_0_stmt: KW_column KW_default . KW_limit '=' expression_1_0 ';' + + KW_limit shift, and go to state 358 + + +State 287 + + 117 tbl_1_0_stmt: KW_column KW_limit . '=' expression_1_0 ';' + + '=' shift, and go to state 359 + + +State 288 + + 153 default_view_1_0_decl: KW_default KW_view . STRING ';' + + STRING shift, and go to state 360 + + +State 289 + + 156 physmbr_1_0_decl: KW_column . phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' + 157 | KW_column . phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' + + '<' shift, and go to state 290 + + $default reduce using rule 251 (empty) + + phys_coldef_1_0 go to state 361 + opt_col_kdbtext_parms_1_0 go to state 293 + empty go to state 294 + + +State 290 + + 160 opt_col_kdbtext_parms_1_0: '<' . col_kdbtext_parms_1_0 '>' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + IDENTIFIER_1_0 shift, and go to state 36 + + col_kdbtext_parms_1_0 go to state 362 + col_kdbtext_parm_1_0 go to state 363 + col_kdbtext_value_1_0 go to state 364 + uint_expr_1_0 go to state 365 + fqn_1_0 go to state 366 + ident_1_0 go to state 38 + + +State 291 + + 120 tbl_1_0_stmt: KW_physical physmbr_1_0_decl . + + $default reduce using rule 120 (tbl_1_0_stmt) + + +State 292 + + 154 physmbr_1_0_decl: phys_coldef_1_0 . PHYSICAL_IDENTIFIER_1_0 ';' + 155 | phys_coldef_1_0 . PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' + + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 367 + + +State 293 + + 158 phys_coldef_1_0: opt_col_kdbtext_parms_1_0 . fqn_opt_vers opt_factory_parms_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 368 + + +State 294 + + 159 opt_col_kdbtext_parms_1_0: empty . + + $default reduce using rule 159 (opt_col_kdbtext_parms_1_0) + + +State 295 + + 121 tbl_1_0_stmt: KW_static KW_physical . physmbr_1_0_decl + + KW_column shift, and go to state 289 + '<' shift, and go to state 290 + + $default reduce using rule 251 (empty) + + physmbr_1_0_decl go to state 369 + phys_coldef_1_0 go to state 292 + opt_col_kdbtext_parms_1_0 go to state 293 + empty go to state 294 + + +State 296 + + 119 tbl_1_0_stmt: KW_static physmbr_1_0_decl . + + $default reduce using rule 119 (tbl_1_0_stmt) + + +State 297 + + 126 production_1_0_stmt: KW_trigger ident_1_0 . '=' cond_expr_1_0 ';' + + '=' shift, and go to state 370 + + +State 298 + + 125 production_1_0_stmt: typespec_1_0 ident_1_0 . '=' cond_expr_1_0 ';' + + '=' shift, and go to state 371 + + +State 299 + + 111 tbl_1_0_body: '{' tbl_1_0_stmt_seq '}' . + + $default reduce using rule 111 (tbl_1_0_body) + + +State 300 + + 114 tbl_1_0_stmt_seq: tbl_1_0_stmt_seq tbl_1_0_stmt . + + $default reduce using rule 114 (tbl_1_0_stmt_seq) + + +State 301 + + 136 phys_enc_ref: '<' . kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + IDENTIFIER_1_0 shift, and go to state 36 + + kdbtext_parms_1_0 go to state 372 + kdbtext_parm_1_0 go to state 195 + uint_expr_1_0 go to state 196 + fqn_1_0 go to state 197 + ident_1_0 go to state 38 + + +State 302 + + 134 col_1_0_decl: typespec_1_0 . typed_column_decl_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + + typed_column_decl_1_0 go to state 373 + col_ident go to state 374 + phys_ident go to state 375 + ident_1_0 go to state 376 + + +State 303 + + 116 tbl_1_0_stmt: col_1_0_modifiers col_1_0_decl . + + $default reduce using rule 116 (tbl_1_0_stmt) + + +State 304 + + 135 col_1_0_decl: phys_enc_ref . typed_column_decl_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + + typed_column_decl_1_0 go to state 377 + col_ident go to state 374 + phys_ident go to state 375 + ident_1_0 go to state 376 + + +State 305 + + 33 typespec_1_0: fqn_1_0 . + 34 | fqn_1_0 . '[' dim_1_0 ']' + 138 phys_enc_ref: fqn_1_0 . factory_parms_1_0 + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + 252 fqn_vers: fqn_1_0 . VERSION + + VERSION shift, and go to state 86 + '[' shift, and go to state 85 + '<' shift, and go to state 204 + ':' shift, and go to state 81 + + $default reduce using rule 33 (typespec_1_0) + + factory_parms_1_0 go to state 378 + + +State 306 + + 137 phys_enc_ref: fqn_vers . opt_factory_parms_1_0 + + '<' shift, and go to state 204 + + $default reduce using rule 251 (empty) + + opt_factory_parms_1_0 go to state 379 + factory_parms_1_0 go to state 206 + empty go to state 207 + + +State 307 + + 128 col_1_0_modifiers: col_1_0_modifier_seq KW_column . + + $default reduce using rule 128 (col_1_0_modifiers) + + +State 308 + + 131 col_1_0_modifier: KW_default . + + $default reduce using rule 131 (col_1_0_modifier) + + +State 309 + + 130 col_1_0_modifier_seq: col_1_0_modifier_seq col_1_0_modifier . + + $default reduce using rule 130 (col_1_0_modifier_seq) + + +State 310 + + 32 typespec_1_0_list: typespec_1_0_list ',' typespec_1_0 . + + $default reduce using rule 32 (typespec_1_0_list) + + +State 311 + + 238 view_parms: view_parms ',' . ident_1_0 + 264 | view_parms ',' . view_parm + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 380 + fqn_vers go to state 161 + fqn_opt_vers go to state 252 + view_parm go to state 381 + + +State 312 + + 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' . opt_view_parents '{' opt_view_body '}' + + '=' shift, and go to state 382 + + $default reduce using rule 251 (empty) + + empty go to state 383 + opt_view_parents go to state 384 + + +State 313 + + 265 view_parm: fqn_opt_vers ident_1_0 . + + $default reduce using rule 265 (view_parm) + + +State 314 + + 211 const_vect_exprlist_1_0: const_vect_exprlist_1_0 ',' expression_1_0 . + + $default reduce using rule 211 (const_vect_exprlist_1_0) + + +State 315 + + 170 expression_1_0: '(' type_expr_1_0 ')' expression_1_0 . + + $default reduce using rule 170 (expression_1_0) + + +State 316 + + 187 kdbtext_parms_1_0: kdbtext_parms_1_0 ',' kdbtext_parm_1_0 . + + $default reduce using rule 187 (kdbtext_parms_1_0) + + +State 317 + + 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers . opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' + + '<' shift, and go to state 204 + + $default reduce using rule 251 (empty) + + opt_factory_parms_1_0 go to state 385 + factory_parms_1_0 go to state 206 + empty go to state 207 + + +State 318 + + 189 kdbtext_parm_1_0: fqn_1_0 '[' dim_1_0 . ']' + + ']' shift, and go to state 386 + + +State 319 + + 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' . '.' ident_1_0 + 219 | ident_1_0 '[' cond_expr_1_0 ']' . PHYSICAL_IDENTIFIER_1_0 + + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 387 + '.' shift, and go to state 388 + + +State 320 + + 168 cond_expr_1_0: cond_expr_1_0 '|' . expression_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 389 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 321 + + 195 factory_parms: factory_parms ',' . expression_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 390 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 322 + + 193 factory_parms_1_0: '<' factory_parms '>' . + + $default reduce using rule 193 (factory_parms_1_0) + + +State 323 + + 198 func_1_0_parms: expression_1_0 . + + $default reduce using rule 198 (func_1_0_parms) + + +State 324 + + 185 func_expr_1_0: fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms . ')' + + ')' shift, and go to state 391 + + +State 325 + + 197 opt_func_1_0_parms: func_1_0_parms . + 199 func_1_0_parms: func_1_0_parms . ',' expression_1_0 + + ',' shift, and go to state 392 + + $default reduce using rule 197 (opt_func_1_0_parms) + + +State 326 + + 196 opt_func_1_0_parms: empty . + + $default reduce using rule 196 (opt_func_1_0_parms) + + +State 327 + + 235 alias_member_1_0: KW_alias view_spec ident_1_0 . ';' + + ';' shift, and go to state 393 + + +State 328 + + 236 view_spec: fqn_opt_vers '<' . view_parms '>' + + IDENTIFIER_1_0 shift, and go to state 36 + + view_parms go to state 394 + fqn_1_0 go to state 163 + ident_1_0 go to state 251 + fqn_vers go to state 161 + fqn_opt_vers go to state 252 + view_parm go to state 253 + + +State 329 + + 233 db_member_1_0: opt_template_1_0 KW_database fqn_opt_vers . ident_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 395 + + +State 330 + + 234 table_member_1_0: opt_template_1_0 KW_table fqn_opt_vers . ident_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 396 + + +State 331 + + 64 func_1_0_fact_signature: '*' func_1_0_fact_params . func_1_0_vararg_formals + 68 func_1_0_fact_params: func_1_0_fact_params . ',' fact_param_1_0 + + ',' shift, and go to state 397 + + $default reduce using rule 251 (empty) + + func_1_0_vararg_formals go to state 398 + empty go to state 337 + + +State 332 + + 69 fact_param_1_0: typespec_1_0 IDENTIFIER_1_0 . + + $default reduce using rule 69 (fact_param_1_0) + + +State 333 + + 61 func_1_0_fact_sig: '<' func_1_0_fact_signature '>' . + + $default reduce using rule 61 (func_1_0_fact_sig) + + +State 334 + + 66 func_1_0_fact_signature: func_1_0_fact_params ',' . '*' func_1_0_fact_params func_1_0_vararg_formals + 68 func_1_0_fact_params: func_1_0_fact_params ',' . fact_param_1_0 + 81 func_1_0_vararg_formals: ',' . ELLIPSIS + + ELLIPSIS shift, and go to state 399 + IDENTIFIER_1_0 shift, and go to state 36 + '*' shift, and go to state 400 + + typespec_1_0 go to state 274 + fact_param_1_0 go to state 401 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 335 + + 65 func_1_0_fact_signature: func_1_0_fact_params '*' . func_1_0_fact_params func_1_0_vararg_formals + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 274 + func_1_0_fact_params go to state 402 + fact_param_1_0 go to state 277 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 336 + + 63 func_1_0_fact_signature: func_1_0_fact_params func_1_0_vararg_formals . + + $default reduce using rule 63 (func_1_0_fact_signature) + + +State 337 + + 80 func_1_0_vararg_formals: empty . + + $default reduce using rule 80 (func_1_0_vararg_formals) + + +State 338 + + 79 formal_param_1_0: KW_control . typespec_1_0 IDENTIFIER_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 403 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 339 + + 73 func_1_0_param_signature: '*' . func_1_0_formal_params func_1_0_vararg_formals + + IDENTIFIER_1_0 shift, and go to state 36 + KW_control shift, and go to state 338 + + typespec_1_0 go to state 340 + func_1_0_formal_params go to state 404 + formal_param_1_0 go to state 343 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 340 + + 78 formal_param_1_0: typespec_1_0 . IDENTIFIER_1_0 + + IDENTIFIER_1_0 shift, and go to state 405 + + +State 341 + + 70 func_1_0_param_sig: '(' func_1_0_param_signature . ')' + + ')' shift, and go to state 406 + + +State 342 + + 72 func_1_0_param_signature: func_1_0_formal_params . func_1_0_vararg_formals + 74 | func_1_0_formal_params . '*' func_1_0_formal_params func_1_0_vararg_formals + 75 | func_1_0_formal_params . ',' '*' func_1_0_formal_params func_1_0_vararg_formals + 77 func_1_0_formal_params: func_1_0_formal_params . ',' formal_param_1_0 + + ',' shift, and go to state 407 + '*' shift, and go to state 408 + + $default reduce using rule 251 (empty) + + func_1_0_vararg_formals go to state 409 + empty go to state 337 + + +State 343 + + 76 func_1_0_formal_params: formal_param_1_0 . + + $default reduce using rule 76 (func_1_0_formal_params) + + +State 344 + + 71 func_1_0_param_signature: empty . + + $default reduce using rule 71 (func_1_0_param_signature) + + +State 345 + + 82 func_1_0_prologue: ';' . + + $default reduce using rule 82 (func_1_0_prologue) + + +State 346 + + 84 func_1_0_prologue: '{' . script_1_0_stmt_seq '}' + + IDENTIFIER_1_0 shift, and go to state 36 + KW_return shift, and go to state 410 + + typespec_1_0 go to state 96 + script_1_0_stmt_seq go to state 411 + script_1_0_stmt go to state 412 + type_expr_1_0 go to state 413 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 347 + + 83 func_1_0_prologue: '=' . fqn_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 414 + ident_1_0 go to state 38 + + +State 348 + + 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue . + + $default reduce using rule 47 (func_1_0_decl) + + +State 349 + + 104 phys_1_0_body_stmt: KW___row_length . '=' fqn_1_0 '(' ')' + + '=' shift, and go to state 415 + + +State 350 + + 102 phys_1_0_body_stmt: KW_decode . phys_1_0_stmt + + '{' shift, and go to state 355 + + phys_1_0_stmt go to state 416 + + +State 351 + + 103 phys_1_0_body_stmt: KW_encode . phys_1_0_stmt + + '{' shift, and go to state 355 + + phys_1_0_stmt go to state 417 + + +State 352 + + 101 phys_1_0_body_stmt: ';' . + + $default reduce using rule 101 (phys_1_0_body_stmt) + + +State 353 + + 98 phys_1_0_prologue: '{' phys_1_0_body . '}' + 100 phys_1_0_body: phys_1_0_body . phys_1_0_body_stmt + + KW___row_length shift, and go to state 349 + KW_decode shift, and go to state 350 + KW_encode shift, and go to state 351 + ';' shift, and go to state 352 + '}' shift, and go to state 418 + + phys_1_0_body_stmt go to state 419 + + +State 354 + + 99 phys_1_0_body: phys_1_0_body_stmt . + + $default reduce using rule 99 (phys_1_0_body) + + +State 355 + + 105 phys_1_0_stmt: '{' . script_1_0_stmt_seq '}' + + IDENTIFIER_1_0 shift, and go to state 36 + KW_return shift, and go to state 410 + + typespec_1_0 go to state 96 + script_1_0_stmt_seq go to state 420 + script_1_0_stmt go to state 412 + type_expr_1_0 go to state 413 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 356 + + 97 phys_1_0_prologue: '=' phys_1_0_stmt . + + $default reduce using rule 97 (phys_1_0_prologue) + + +State 357 + + 123 tbl_1_0_stmt: KW___untyped '=' fqn_1_0 . '(' ')' ';' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '(' shift, and go to state 421 + ':' shift, and go to state 81 + + +State 358 + + 118 tbl_1_0_stmt: KW_column KW_default KW_limit . '=' expression_1_0 ';' + + '=' shift, and go to state 422 + + +State 359 + + 117 tbl_1_0_stmt: KW_column KW_limit '=' . expression_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 423 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 360 + + 153 default_view_1_0_decl: KW_default KW_view STRING . ';' + + ';' shift, and go to state 424 + + +State 361 + + 156 physmbr_1_0_decl: KW_column phys_coldef_1_0 . PHYSICAL_IDENTIFIER_1_0 ';' + 157 | KW_column phys_coldef_1_0 . PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' + + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 425 + + +State 362 + + 160 opt_col_kdbtext_parms_1_0: '<' col_kdbtext_parms_1_0 . '>' + 162 col_kdbtext_parms_1_0: col_kdbtext_parms_1_0 . ',' col_kdbtext_parm_1_0 + + ',' shift, and go to state 426 + '>' shift, and go to state 427 + + +State 363 + + 161 col_kdbtext_parms_1_0: col_kdbtext_parm_1_0 . + + $default reduce using rule 161 (col_kdbtext_parms_1_0) + + +State 364 + + 164 col_kdbtext_parm_1_0: col_kdbtext_value_1_0 . + + $default reduce using rule 164 (col_kdbtext_parm_1_0) + + +State 365 + + 166 col_kdbtext_value_1_0: uint_expr_1_0 . + + $default reduce using rule 166 (col_kdbtext_value_1_0) + + +State 366 + + 163 col_kdbtext_parm_1_0: fqn_1_0 . '=' col_kdbtext_value_1_0 + 165 col_kdbtext_value_1_0: fqn_1_0 . + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '=' shift, and go to state 428 + ':' shift, and go to state 81 + + $default reduce using rule 165 (col_kdbtext_value_1_0) + + +State 367 + + 154 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 . ';' + 155 | phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 . '=' cond_expr_1_0 ';' + + ';' shift, and go to state 429 + '=' shift, and go to state 430 + + +State 368 + + 158 phys_coldef_1_0: opt_col_kdbtext_parms_1_0 fqn_opt_vers . opt_factory_parms_1_0 + + '<' shift, and go to state 204 + + $default reduce using rule 251 (empty) + + opt_factory_parms_1_0 go to state 431 + factory_parms_1_0 go to state 206 + empty go to state 207 + + +State 369 + + 121 tbl_1_0_stmt: KW_static KW_physical physmbr_1_0_decl . + + $default reduce using rule 121 (tbl_1_0_stmt) + + +State 370 + + 126 production_1_0_stmt: KW_trigger ident_1_0 '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 432 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 371 + + 125 production_1_0_stmt: typespec_1_0 ident_1_0 '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 433 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 372 + + 136 phys_enc_ref: '<' kdbtext_parms_1_0 . '>' fqn_opt_vers opt_factory_parms_1_0 + 187 kdbtext_parms_1_0: kdbtext_parms_1_0 . ',' kdbtext_parm_1_0 + + ',' shift, and go to state 258 + '>' shift, and go to state 434 + + +State 373 + + 134 col_1_0_decl: typespec_1_0 typed_column_decl_1_0 . + + $default reduce using rule 134 (col_1_0_decl) + + +State 374 + + 139 typed_column_decl_1_0: col_ident . '{' opt_column_body_1_0 '}' + 140 | col_ident . '=' cond_expr_1_0 ';' + 141 | col_ident . ';' + + ';' shift, and go to state 435 + '{' shift, and go to state 436 + '=' shift, and go to state 437 + + +State 375 + + 143 col_ident: phys_ident . + + $default reduce using rule 143 (col_ident) + + +State 376 + + 142 col_ident: ident_1_0 . + + $default reduce using rule 142 (col_ident) + + +State 377 + + 135 col_1_0_decl: phys_enc_ref typed_column_decl_1_0 . + + $default reduce using rule 135 (col_1_0_decl) + + +State 378 + + 138 phys_enc_ref: fqn_1_0 factory_parms_1_0 . + + $default reduce using rule 138 (phys_enc_ref) + + +State 379 + + 137 phys_enc_ref: fqn_vers opt_factory_parms_1_0 . + + $default reduce using rule 137 (phys_enc_ref) + + +State 380 + + 238 view_parms: view_parms ',' ident_1_0 . + 240 fqn_1_0: ident_1_0 . + + ',' reduce using rule 238 (view_parms) + '>' reduce using rule 238 (view_parms) + $default reduce using rule 240 (fqn_1_0) + + +State 381 + + 264 view_parms: view_parms ',' view_parm . + + $default reduce using rule 264 (view_parms) + + +State 382 + + 274 opt_view_parents: '=' . view_parents + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 438 + view_parents go to state 439 + view_parent go to state 440 + + +State 383 + + 273 opt_view_parents: empty . + + $default reduce using rule 273 (opt_view_parents) + + +State 384 + + 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents . '{' opt_view_body '}' + + '{' shift, and go to state 441 + + +State 385 + + 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 . '(' opt_func_1_0_parms ')' + + '(' shift, and go to state 442 + + +State 386 + + 189 kdbtext_parm_1_0: fqn_1_0 '[' dim_1_0 ']' . + + $default reduce using rule 189 (kdbtext_parm_1_0) + + +State 387 + + 219 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 . + + $default reduce using rule 219 (join_expr_2_0) + + +State 388 + + 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' '.' . ident_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 443 + + +State 389 + + 168 cond_expr_1_0: cond_expr_1_0 '|' expression_1_0 . + + $default reduce using rule 168 (cond_expr_1_0) + + +State 390 + + 195 factory_parms: factory_parms ',' expression_1_0 . + + $default reduce using rule 195 (factory_parms) + + +State 391 + + 185 func_expr_1_0: fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' . + + $default reduce using rule 185 (func_expr_1_0) + + +State 392 + + 199 func_1_0_parms: func_1_0_parms ',' . expression_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 444 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 393 + + 235 alias_member_1_0: KW_alias view_spec ident_1_0 ';' . + + $default reduce using rule 235 (alias_member_1_0) + + +State 394 + + 236 view_spec: fqn_opt_vers '<' view_parms . '>' + 238 view_parms: view_parms . ',' ident_1_0 + 264 | view_parms . ',' view_parm + + ',' shift, and go to state 311 + '>' shift, and go to state 445 + + +State 395 + + 233 db_member_1_0: opt_template_1_0 KW_database fqn_opt_vers ident_1_0 . ';' + + ';' shift, and go to state 446 + + +State 396 + + 234 table_member_1_0: opt_template_1_0 KW_table fqn_opt_vers ident_1_0 . ';' + + ';' shift, and go to state 447 + + +State 397 + + 68 func_1_0_fact_params: func_1_0_fact_params ',' . fact_param_1_0 + 81 func_1_0_vararg_formals: ',' . ELLIPSIS + + ELLIPSIS shift, and go to state 399 + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 274 + fact_param_1_0 go to state 401 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 398 + + 64 func_1_0_fact_signature: '*' func_1_0_fact_params func_1_0_vararg_formals . + + $default reduce using rule 64 (func_1_0_fact_signature) + + +State 399 + + 81 func_1_0_vararg_formals: ',' ELLIPSIS . + + $default reduce using rule 81 (func_1_0_vararg_formals) + + +State 400 + + 66 func_1_0_fact_signature: func_1_0_fact_params ',' '*' . func_1_0_fact_params func_1_0_vararg_formals + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 274 + func_1_0_fact_params go to state 448 + fact_param_1_0 go to state 277 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 401 + + 68 func_1_0_fact_params: func_1_0_fact_params ',' fact_param_1_0 . + + $default reduce using rule 68 (func_1_0_fact_params) + + +State 402 + + 65 func_1_0_fact_signature: func_1_0_fact_params '*' func_1_0_fact_params . func_1_0_vararg_formals + 68 func_1_0_fact_params: func_1_0_fact_params . ',' fact_param_1_0 + + ',' shift, and go to state 397 + + $default reduce using rule 251 (empty) + + func_1_0_vararg_formals go to state 449 + empty go to state 337 + + +State 403 + + 79 formal_param_1_0: KW_control typespec_1_0 . IDENTIFIER_1_0 + + IDENTIFIER_1_0 shift, and go to state 450 + + +State 404 + + 73 func_1_0_param_signature: '*' func_1_0_formal_params . func_1_0_vararg_formals + 77 func_1_0_formal_params: func_1_0_formal_params . ',' formal_param_1_0 + + ',' shift, and go to state 451 + + $default reduce using rule 251 (empty) + + func_1_0_vararg_formals go to state 452 + empty go to state 337 + + +State 405 + + 78 formal_param_1_0: typespec_1_0 IDENTIFIER_1_0 . + + $default reduce using rule 78 (formal_param_1_0) + + +State 406 + + 70 func_1_0_param_sig: '(' func_1_0_param_signature ')' . + + $default reduce using rule 70 (func_1_0_param_sig) + + +State 407 + + 75 func_1_0_param_signature: func_1_0_formal_params ',' . '*' func_1_0_formal_params func_1_0_vararg_formals + 77 func_1_0_formal_params: func_1_0_formal_params ',' . formal_param_1_0 + 81 func_1_0_vararg_formals: ',' . ELLIPSIS + + ELLIPSIS shift, and go to state 399 + IDENTIFIER_1_0 shift, and go to state 36 + KW_control shift, and go to state 338 + '*' shift, and go to state 453 + + typespec_1_0 go to state 340 + formal_param_1_0 go to state 454 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 408 + + 74 func_1_0_param_signature: func_1_0_formal_params '*' . func_1_0_formal_params func_1_0_vararg_formals + + IDENTIFIER_1_0 shift, and go to state 36 + KW_control shift, and go to state 338 + + typespec_1_0 go to state 340 + func_1_0_formal_params go to state 455 + formal_param_1_0 go to state 343 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 409 + + 72 func_1_0_param_signature: func_1_0_formal_params func_1_0_vararg_formals . + + $default reduce using rule 72 (func_1_0_param_signature) + + +State 410 + + 87 script_1_0_stmt: KW_return . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 456 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 411 + + 84 func_1_0_prologue: '{' script_1_0_stmt_seq . '}' + 86 script_1_0_stmt_seq: script_1_0_stmt_seq . script_1_0_stmt + + IDENTIFIER_1_0 shift, and go to state 36 + KW_return shift, and go to state 410 + '}' shift, and go to state 457 + + typespec_1_0 go to state 96 + script_1_0_stmt go to state 458 + type_expr_1_0 go to state 413 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 412 + + 85 script_1_0_stmt_seq: script_1_0_stmt . + + $default reduce using rule 85 (script_1_0_stmt_seq) + + +State 413 + + 88 script_1_0_stmt: type_expr_1_0 . ident_1_0 '=' cond_expr_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 459 + + +State 414 + + 83 func_1_0_prologue: '=' fqn_1_0 . ';' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + ';' shift, and go to state 460 + ':' shift, and go to state 81 + + +State 415 + + 104 phys_1_0_body_stmt: KW___row_length '=' . fqn_1_0 '(' ')' + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 461 + ident_1_0 go to state 38 + + +State 416 + + 102 phys_1_0_body_stmt: KW_decode phys_1_0_stmt . + + $default reduce using rule 102 (phys_1_0_body_stmt) + + +State 417 + + 103 phys_1_0_body_stmt: KW_encode phys_1_0_stmt . + + $default reduce using rule 103 (phys_1_0_body_stmt) + + +State 418 + + 98 phys_1_0_prologue: '{' phys_1_0_body '}' . + + $default reduce using rule 98 (phys_1_0_prologue) + + +State 419 + + 100 phys_1_0_body: phys_1_0_body phys_1_0_body_stmt . + + $default reduce using rule 100 (phys_1_0_body) + + +State 420 + + 86 script_1_0_stmt_seq: script_1_0_stmt_seq . script_1_0_stmt + 105 phys_1_0_stmt: '{' script_1_0_stmt_seq . '}' + + IDENTIFIER_1_0 shift, and go to state 36 + KW_return shift, and go to state 410 + '}' shift, and go to state 462 + + typespec_1_0 go to state 96 + script_1_0_stmt go to state 458 + type_expr_1_0 go to state 413 + fqn_1_0 go to state 100 + ident_1_0 go to state 38 + + +State 421 + + 123 tbl_1_0_stmt: KW___untyped '=' fqn_1_0 '(' . ')' ';' + + ')' shift, and go to state 463 + + +State 422 + + 118 tbl_1_0_stmt: KW_column KW_default KW_limit '=' . expression_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + expression_1_0 go to state 464 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 423 + + 117 tbl_1_0_stmt: KW_column KW_limit '=' expression_1_0 . ';' + + ';' shift, and go to state 465 + + +State 424 + + 153 default_view_1_0_decl: KW_default KW_view STRING ';' . + + $default reduce using rule 153 (default_view_1_0_decl) + + +State 425 + + 156 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 . ';' + 157 | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 . '=' cond_expr_1_0 ';' + + ';' shift, and go to state 466 + '=' shift, and go to state 467 + + +State 426 + + 162 col_kdbtext_parms_1_0: col_kdbtext_parms_1_0 ',' . col_kdbtext_parm_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + IDENTIFIER_1_0 shift, and go to state 36 + + col_kdbtext_parm_1_0 go to state 468 + col_kdbtext_value_1_0 go to state 364 + uint_expr_1_0 go to state 365 + fqn_1_0 go to state 366 + ident_1_0 go to state 38 + + +State 427 + + 160 opt_col_kdbtext_parms_1_0: '<' col_kdbtext_parms_1_0 '>' . + + $default reduce using rule 160 (opt_col_kdbtext_parms_1_0) + + +State 428 + + 163 col_kdbtext_parm_1_0: fqn_1_0 '=' . col_kdbtext_value_1_0 + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + IDENTIFIER_1_0 shift, and go to state 36 + + col_kdbtext_value_1_0 go to state 469 + uint_expr_1_0 go to state 365 + fqn_1_0 go to state 470 + ident_1_0 go to state 38 + + +State 429 + + 154 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' . + + $default reduce using rule 154 (physmbr_1_0_decl) + + +State 430 + + 155 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 471 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 431 + + 158 phys_coldef_1_0: opt_col_kdbtext_parms_1_0 fqn_opt_vers opt_factory_parms_1_0 . + + $default reduce using rule 158 (phys_coldef_1_0) + + +State 432 + + 126 production_1_0_stmt: KW_trigger ident_1_0 '=' cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 472 + '|' shift, and go to state 320 + + +State 433 + + 125 production_1_0_stmt: typespec_1_0 ident_1_0 '=' cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 473 + '|' shift, and go to state 320 + + +State 434 + + 136 phys_enc_ref: '<' kdbtext_parms_1_0 '>' . fqn_opt_vers opt_factory_parms_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 474 + + +State 435 + + 141 typed_column_decl_1_0: col_ident ';' . + + $default reduce using rule 141 (typed_column_decl_1_0) + + +State 436 + + 139 typed_column_decl_1_0: col_ident '{' . opt_column_body_1_0 '}' + + KW_limit shift, and go to state 475 + KW_read shift, and go to state 476 + KW_validate shift, and go to state 477 + ';' shift, and go to state 478 + + $default reduce using rule 251 (empty) + + opt_column_body_1_0 go to state 479 + column_body_1_0 go to state 480 + column_stmt_1_0 go to state 481 + empty go to state 482 + + +State 437 + + 140 typed_column_decl_1_0: col_ident '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 483 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 438 + + 277 view_parent: fqn_opt_vers . '<' view_parent_parms '>' + + '<' shift, and go to state 484 + + +State 439 + + 274 opt_view_parents: '=' view_parents . + 276 view_parents: view_parents . ',' view_parent + + ',' shift, and go to state 485 + + $default reduce using rule 274 (opt_view_parents) + + +State 440 + + 275 view_parents: view_parent . + + $default reduce using rule 275 (view_parents) + + +State 441 + + 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' . opt_view_body '}' + + IDENTIFIER_1_0 shift, and go to state 36 + KW_column shift, and go to state 486 + ';' shift, and go to state 487 + + $default reduce using rule 251 (empty) + + typespec_1_0 go to state 488 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + empty go to state 489 + opt_view_body go to state 490 + view_body go to state 491 + view_member go to state 492 + + +State 442 + + 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' . opt_func_1_0_parms ')' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + $default reduce using rule 251 (empty) + + phys_ident go to state 148 + expression_1_0 go to state 323 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + opt_func_1_0_parms go to state 493 + func_1_0_parms go to state 325 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + empty go to state 326 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 443 + + 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' '.' ident_1_0 . + + $default reduce using rule 218 (join_expr_2_0) + + +State 444 + + 199 func_1_0_parms: func_1_0_parms ',' expression_1_0 . + + $default reduce using rule 199 (func_1_0_parms) + + +State 445 + + 236 view_spec: fqn_opt_vers '<' view_parms '>' . + + $default reduce using rule 236 (view_spec) + + +State 446 + + 233 db_member_1_0: opt_template_1_0 KW_database fqn_opt_vers ident_1_0 ';' . + + $default reduce using rule 233 (db_member_1_0) + + +State 447 + + 234 table_member_1_0: opt_template_1_0 KW_table fqn_opt_vers ident_1_0 ';' . + + $default reduce using rule 234 (table_member_1_0) + + +State 448 + + 66 func_1_0_fact_signature: func_1_0_fact_params ',' '*' func_1_0_fact_params . func_1_0_vararg_formals + 68 func_1_0_fact_params: func_1_0_fact_params . ',' fact_param_1_0 + + ',' shift, and go to state 397 + + $default reduce using rule 251 (empty) + + func_1_0_vararg_formals go to state 494 + empty go to state 337 + + +State 449 + + 65 func_1_0_fact_signature: func_1_0_fact_params '*' func_1_0_fact_params func_1_0_vararg_formals . + + $default reduce using rule 65 (func_1_0_fact_signature) + + +State 450 + + 79 formal_param_1_0: KW_control typespec_1_0 IDENTIFIER_1_0 . + + $default reduce using rule 79 (formal_param_1_0) + + +State 451 + + 77 func_1_0_formal_params: func_1_0_formal_params ',' . formal_param_1_0 + 81 func_1_0_vararg_formals: ',' . ELLIPSIS + + ELLIPSIS shift, and go to state 399 + IDENTIFIER_1_0 shift, and go to state 36 + KW_control shift, and go to state 338 + + typespec_1_0 go to state 340 + formal_param_1_0 go to state 454 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 452 + + 73 func_1_0_param_signature: '*' func_1_0_formal_params func_1_0_vararg_formals . + + $default reduce using rule 73 (func_1_0_param_signature) + + +State 453 + + 75 func_1_0_param_signature: func_1_0_formal_params ',' '*' . func_1_0_formal_params func_1_0_vararg_formals + + IDENTIFIER_1_0 shift, and go to state 36 + KW_control shift, and go to state 338 + + typespec_1_0 go to state 340 + func_1_0_formal_params go to state 495 + formal_param_1_0 go to state 343 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 454 + + 77 func_1_0_formal_params: func_1_0_formal_params ',' formal_param_1_0 . + + $default reduce using rule 77 (func_1_0_formal_params) + + +State 455 + + 74 func_1_0_param_signature: func_1_0_formal_params '*' func_1_0_formal_params . func_1_0_vararg_formals + 77 func_1_0_formal_params: func_1_0_formal_params . ',' formal_param_1_0 + + ',' shift, and go to state 451 + + $default reduce using rule 251 (empty) + + func_1_0_vararg_formals go to state 496 + empty go to state 337 + + +State 456 + + 87 script_1_0_stmt: KW_return cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 497 + '|' shift, and go to state 320 + + +State 457 + + 84 func_1_0_prologue: '{' script_1_0_stmt_seq '}' . + + $default reduce using rule 84 (func_1_0_prologue) + + +State 458 + + 86 script_1_0_stmt_seq: script_1_0_stmt_seq script_1_0_stmt . + + $default reduce using rule 86 (script_1_0_stmt_seq) + + +State 459 + + 88 script_1_0_stmt: type_expr_1_0 ident_1_0 . '=' cond_expr_1_0 ';' + + '=' shift, and go to state 498 + + +State 460 + + 83 func_1_0_prologue: '=' fqn_1_0 ';' . + + $default reduce using rule 83 (func_1_0_prologue) + + +State 461 + + 104 phys_1_0_body_stmt: KW___row_length '=' fqn_1_0 . '(' ')' + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + '(' shift, and go to state 499 + ':' shift, and go to state 81 + + +State 462 + + 105 phys_1_0_stmt: '{' script_1_0_stmt_seq '}' . + + $default reduce using rule 105 (phys_1_0_stmt) + + +State 463 + + 123 tbl_1_0_stmt: KW___untyped '=' fqn_1_0 '(' ')' . ';' + + ';' shift, and go to state 500 + + +State 464 + + 118 tbl_1_0_stmt: KW_column KW_default KW_limit '=' expression_1_0 . ';' + + ';' shift, and go to state 501 + + +State 465 + + 117 tbl_1_0_stmt: KW_column KW_limit '=' expression_1_0 ';' . + + $default reduce using rule 117 (tbl_1_0_stmt) + + +State 466 + + 156 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' . + + $default reduce using rule 156 (physmbr_1_0_decl) + + +State 467 + + 157 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 502 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 468 + + 162 col_kdbtext_parms_1_0: col_kdbtext_parms_1_0 ',' col_kdbtext_parm_1_0 . + + $default reduce using rule 162 (col_kdbtext_parms_1_0) + + +State 469 + + 163 col_kdbtext_parm_1_0: fqn_1_0 '=' col_kdbtext_value_1_0 . + + $default reduce using rule 163 (col_kdbtext_parm_1_0) + + +State 470 + + 165 col_kdbtext_value_1_0: fqn_1_0 . + 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 + 242 | fqn_1_0 . ':' KW_database + 243 | fqn_1_0 . ':' KW_decode + 244 | fqn_1_0 . ':' KW_encode + 245 | fqn_1_0 . ':' KW_read + 246 | fqn_1_0 . ':' KW_table + 247 | fqn_1_0 . ':' KW_type + 248 | fqn_1_0 . ':' KW_view + 249 | fqn_1_0 . ':' KW_write + + ':' shift, and go to state 81 + + $default reduce using rule 165 (col_kdbtext_value_1_0) + + +State 471 + + 155 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 503 + '|' shift, and go to state 320 + + +State 472 + + 126 production_1_0_stmt: KW_trigger ident_1_0 '=' cond_expr_1_0 ';' . + + $default reduce using rule 126 (production_1_0_stmt) + + +State 473 + + 125 production_1_0_stmt: typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' . + + $default reduce using rule 125 (production_1_0_stmt) + + +State 474 + + 136 phys_enc_ref: '<' kdbtext_parms_1_0 '>' fqn_opt_vers . opt_factory_parms_1_0 + + '<' shift, and go to state 204 + + $default reduce using rule 251 (empty) + + opt_factory_parms_1_0 go to state 504 + factory_parms_1_0 go to state 206 + empty go to state 207 + + +State 475 + + 151 column_stmt_1_0: KW_limit . '=' uint_expr_1_0 ';' + + '=' shift, and go to state 505 + + +State 476 + + 149 column_stmt_1_0: KW_read . '=' cond_expr_1_0 ';' + + '=' shift, and go to state 506 + + +State 477 + + 150 column_stmt_1_0: KW_validate . '=' cond_expr_1_0 ';' + + '=' shift, and go to state 507 + + +State 478 + + 152 column_stmt_1_0: ';' . + + $default reduce using rule 152 (column_stmt_1_0) + + +State 479 + + 139 typed_column_decl_1_0: col_ident '{' opt_column_body_1_0 . '}' + + '}' shift, and go to state 508 + + +State 480 + + 146 opt_column_body_1_0: column_body_1_0 . + 148 column_body_1_0: column_body_1_0 . column_stmt_1_0 + + KW_limit shift, and go to state 475 + KW_read shift, and go to state 476 + KW_validate shift, and go to state 477 + ';' shift, and go to state 478 + + $default reduce using rule 146 (opt_column_body_1_0) + + column_stmt_1_0 go to state 509 + + +State 481 + + 147 column_body_1_0: column_stmt_1_0 . + + $default reduce using rule 147 (column_body_1_0) + + +State 482 + + 145 opt_column_body_1_0: empty . + + $default reduce using rule 145 (opt_column_body_1_0) + + +State 483 + + 140 typed_column_decl_1_0: col_ident '=' cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 510 + '|' shift, and go to state 320 + + +State 484 + + 277 view_parent: fqn_opt_vers '<' . view_parent_parms '>' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 511 + view_parent_parms go to state 512 + + +State 485 + + 276 view_parents: view_parents ',' . view_parent + + IDENTIFIER_1_0 shift, and go to state 36 + + fqn_1_0 go to state 163 + ident_1_0 go to state 38 + fqn_vers go to state 161 + fqn_opt_vers go to state 438 + view_parent go to state 513 + + +State 486 + + 271 view_member: KW_column . typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + typespec_1_0 go to state 514 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + + +State 487 + + 272 view_member: ';' . + + $default reduce using rule 272 (view_member) + + +State 488 + + 270 view_member: typespec_1_0 . ident_1_0 '=' cond_expr_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 515 + + +State 489 + + 266 opt_view_body: empty . + + $default reduce using rule 266 (opt_view_body) + + +State 490 + + 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body . '}' + + '}' shift, and go to state 516 + + +State 491 + + 267 opt_view_body: view_body . + 269 view_body: view_body . view_member + + IDENTIFIER_1_0 shift, and go to state 36 + KW_column shift, and go to state 486 + ';' shift, and go to state 487 + + $default reduce using rule 267 (opt_view_body) + + typespec_1_0 go to state 488 + fqn_1_0 go to state 40 + ident_1_0 go to state 38 + view_member go to state 517 + + +State 492 + + 268 view_body: view_member . + + $default reduce using rule 268 (view_body) + + +State 493 + + 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms . ')' + + ')' shift, and go to state 518 + + +State 494 + + 66 func_1_0_fact_signature: func_1_0_fact_params ',' '*' func_1_0_fact_params func_1_0_vararg_formals . + + $default reduce using rule 66 (func_1_0_fact_signature) + + +State 495 + + 75 func_1_0_param_signature: func_1_0_formal_params ',' '*' func_1_0_formal_params . func_1_0_vararg_formals + 77 func_1_0_formal_params: func_1_0_formal_params . ',' formal_param_1_0 + + ',' shift, and go to state 451 + + $default reduce using rule 251 (empty) + + func_1_0_vararg_formals go to state 519 + empty go to state 337 + + +State 496 + + 74 func_1_0_param_signature: func_1_0_formal_params '*' func_1_0_formal_params func_1_0_vararg_formals . + + $default reduce using rule 74 (func_1_0_param_signature) + + +State 497 + + 87 script_1_0_stmt: KW_return cond_expr_1_0 ';' . + + $default reduce using rule 87 (script_1_0_stmt) + + +State 498 + + 88 script_1_0_stmt: type_expr_1_0 ident_1_0 '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 520 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 499 + + 104 phys_1_0_body_stmt: KW___row_length '=' fqn_1_0 '(' . ')' + + ')' shift, and go to state 521 + + +State 500 + + 123 tbl_1_0_stmt: KW___untyped '=' fqn_1_0 '(' ')' ';' . + + $default reduce using rule 123 (tbl_1_0_stmt) + + +State 501 + + 118 tbl_1_0_stmt: KW_column KW_default KW_limit '=' expression_1_0 ';' . + + $default reduce using rule 118 (tbl_1_0_stmt) + + +State 502 + + 157 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 522 + '|' shift, and go to state 320 + + +State 503 + + 155 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' . + + $default reduce using rule 155 (physmbr_1_0_decl) + + +State 504 + + 136 phys_enc_ref: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 . + + $default reduce using rule 136 (phys_enc_ref) + + +State 505 + + 151 column_stmt_1_0: KW_limit '=' . uint_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + + uint_expr_1_0 go to state 523 + + +State 506 + + 149 column_stmt_1_0: KW_read '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 524 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 507 + + 150 column_stmt_1_0: KW_validate '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 525 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 508 + + 139 typed_column_decl_1_0: col_ident '{' opt_column_body_1_0 '}' . + + $default reduce using rule 139 (typed_column_decl_1_0) + + +State 509 + + 148 column_body_1_0: column_body_1_0 column_stmt_1_0 . + + $default reduce using rule 148 (column_body_1_0) + + +State 510 + + 140 typed_column_decl_1_0: col_ident '=' cond_expr_1_0 ';' . + + $default reduce using rule 140 (typed_column_decl_1_0) + + +State 511 + + 278 view_parent_parms: ident_1_0 . + + $default reduce using rule 278 (view_parent_parms) + + +State 512 + + 277 view_parent: fqn_opt_vers '<' view_parent_parms . '>' + 279 view_parent_parms: view_parent_parms . ',' ident_1_0 + + ',' shift, and go to state 526 + '>' shift, and go to state 527 + + +State 513 + + 276 view_parents: view_parents ',' view_parent . + + $default reduce using rule 276 (view_parents) + + +State 514 + + 271 view_member: KW_column typespec_1_0 . ident_1_0 '=' cond_expr_1_0 ';' + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 528 + + +State 515 + + 270 view_member: typespec_1_0 ident_1_0 . '=' cond_expr_1_0 ';' + + '=' shift, and go to state 529 + + +State 516 + + 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body '}' . + + $default reduce using rule 262 (view_2_0_decl) + + +State 517 + + 269 view_body: view_body view_member . + + $default reduce using rule 269 (view_body) + + +State 518 + + 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' . + + $default reduce using rule 184 (func_expr_1_0) + + +State 519 + + 75 func_1_0_param_signature: func_1_0_formal_params ',' '*' func_1_0_formal_params func_1_0_vararg_formals . + + $default reduce using rule 75 (func_1_0_param_signature) + + +State 520 + + 88 script_1_0_stmt: type_expr_1_0 ident_1_0 '=' cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 530 + '|' shift, and go to state 320 + + +State 521 + + 104 phys_1_0_body_stmt: KW___row_length '=' fqn_1_0 '(' ')' . + + $default reduce using rule 104 (phys_1_0_body_stmt) + + +State 522 + + 157 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' . + + $default reduce using rule 157 (physmbr_1_0_decl) + + +State 523 + + 151 column_stmt_1_0: KW_limit '=' uint_expr_1_0 . ';' + + ';' shift, and go to state 531 + + +State 524 + + 149 column_stmt_1_0: KW_read '=' cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 532 + '|' shift, and go to state 320 + + +State 525 + + 150 column_stmt_1_0: KW_validate '=' cond_expr_1_0 . ';' + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + + ';' shift, and go to state 533 + '|' shift, and go to state 320 + + +State 526 + + 279 view_parent_parms: view_parent_parms ',' . ident_1_0 + + IDENTIFIER_1_0 shift, and go to state 36 + + ident_1_0 go to state 534 + + +State 527 + + 277 view_parent: fqn_opt_vers '<' view_parent_parms '>' . + + $default reduce using rule 277 (view_parent) + + +State 528 + + 271 view_member: KW_column typespec_1_0 ident_1_0 . '=' cond_expr_1_0 ';' + + '=' shift, and go to state 535 + + +State 529 + + 270 view_member: typespec_1_0 ident_1_0 '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 536 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 530 + + 88 script_1_0_stmt: type_expr_1_0 ident_1_0 '=' cond_expr_1_0 ';' . + + $default reduce using rule 88 (script_1_0_stmt) + + +State 531 + + 151 column_stmt_1_0: KW_limit '=' uint_expr_1_0 ';' . + + $default reduce using rule 151 (column_stmt_1_0) + + +State 532 + + 149 column_stmt_1_0: KW_read '=' cond_expr_1_0 ';' . + + $default reduce using rule 149 (column_stmt_1_0) + + +State 533 + + 150 column_stmt_1_0: KW_validate '=' cond_expr_1_0 ';' . + + $default reduce using rule 150 (column_stmt_1_0) + + +State 534 + + 279 view_parent_parms: view_parent_parms ',' ident_1_0 . + + $default reduce using rule 279 (view_parent_parms) + + +State 535 + + 271 view_member: KW_column typespec_1_0 ident_1_0 '=' . cond_expr_1_0 ';' + + DECIMAL shift, and go to state 130 + OCTAL shift, and go to state 131 + HEX shift, and go to state 132 + FLOAT_ shift, and go to state 133 + EXP_FLOAT shift, and go to state 134 + STRING shift, and go to state 135 + ESCAPED_STRING shift, and go to state 136 + IDENTIFIER_1_0 shift, and go to state 36 + PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 + KW_false shift, and go to state 138 + KW_true shift, and go to state 139 + '[' shift, and go to state 140 + '(' shift, and go to state 142 + '<' shift, and go to state 143 + '@' shift, and go to state 144 + '-' shift, and go to state 145 + '+' shift, and go to state 146 + + phys_ident go to state 148 + cond_expr_1_0 go to state 537 + expression_1_0 go to state 262 + primary_expr_1_0 go to state 150 + func_expr_1_0 go to state 151 + uint_expr_1_0 go to state 152 + float_expr_1_0 go to state 153 + string_expr_1_0 go to state 154 + const_vect_expr_1_0 go to state 155 + bool_expr_1_0 go to state 156 + member_expr_2_0 go to state 157 + join_expr_2_0 go to state 158 + fqn_1_0 go to state 159 + ident_1_0 go to state 160 + fqn_vers go to state 161 + fqn_opt_vers go to state 162 + + +State 536 + + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + 270 view_member: typespec_1_0 ident_1_0 '=' cond_expr_1_0 . ';' + + ';' shift, and go to state 538 + '|' shift, and go to state 320 + + +State 537 + + 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 + 271 view_member: KW_column typespec_1_0 ident_1_0 '=' cond_expr_1_0 . ';' + + ';' shift, and go to state 539 + '|' shift, and go to state 320 + + +State 538 + + 270 view_member: typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' . + + $default reduce using rule 270 (view_member) + + +State 539 + + 271 view_member: KW_column typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' . + + $default reduce using rule 271 (view_member) diff --git a/libs/kdbtext/zz_kdbtext-lex.c b/libs/kdbtext/zz_kdbtext-lex.c new file mode 100644 index 000000000..0f40efbf5 --- /dev/null +++ b/libs/kdbtext/zz_kdbtext-lex.c @@ -0,0 +1,2356 @@ + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +/* %not-for-header */ +/* %if-c-only */ +/* %if-not-reentrant */ +#define yy_create_buffer KDBText__create_buffer +#define yy_delete_buffer KDBText__delete_buffer +#define yy_scan_buffer KDBText__scan_buffer +#define yy_scan_string KDBText__scan_string +#define yy_scan_bytes KDBText__scan_bytes +#define yy_init_buffer KDBText__init_buffer +#define yy_flush_buffer KDBText__flush_buffer +#define yy_load_buffer_state KDBText__load_buffer_state +#define yy_switch_to_buffer KDBText__switch_to_buffer +#define yypush_buffer_state KDBText_push_buffer_state +#define yypop_buffer_state KDBText_pop_buffer_state +#define yyensure_buffer_stack KDBText_ensure_buffer_stack +#define yy_flex_debug KDBText__flex_debug +#define yyin KDBText_in +#define yyleng KDBText_leng +#define yylex KDBText_lex +#define yylineno KDBText_lineno +#define yyout KDBText_out +#define yyrestart KDBText_restart +#define yytext KDBText_text +#define yywrap KDBText_wrap +#define yyalloc KDBText_alloc +#define yyrealloc KDBText_realloc +#define yyfree KDBText_free + +/* %endif */ +/* %endif */ +/* %ok-for-header */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ +#ifdef yy_create_buffer +#define KDBText__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer KDBText__create_buffer +#endif + +#ifdef yy_delete_buffer +#define KDBText__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer KDBText__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define KDBText__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer KDBText__scan_buffer +#endif + +#ifdef yy_scan_string +#define KDBText__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string KDBText__scan_string +#endif + +#ifdef yy_scan_bytes +#define KDBText__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes KDBText__scan_bytes +#endif + +#ifdef yy_init_buffer +#define KDBText__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer KDBText__init_buffer +#endif + +#ifdef yy_flush_buffer +#define KDBText__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer KDBText__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define KDBText__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state KDBText__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define KDBText__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer KDBText__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define KDBText_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state KDBText_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define KDBText_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state KDBText_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define KDBText_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack KDBText_ensure_buffer_stack +#endif + +#ifdef yylex +#define KDBText_lex_ALREADY_DEFINED +#else +#define yylex KDBText_lex +#endif + +#ifdef yyrestart +#define KDBText_restart_ALREADY_DEFINED +#else +#define yyrestart KDBText_restart +#endif + +#ifdef yylex_init +#define KDBText_lex_init_ALREADY_DEFINED +#else +#define yylex_init KDBText_lex_init +#endif + +#ifdef yylex_init_extra +#define KDBText_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra KDBText_lex_init_extra +#endif + +#ifdef yylex_destroy +#define KDBText_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy KDBText_lex_destroy +#endif + +#ifdef yyget_debug +#define KDBText_get_debug_ALREADY_DEFINED +#else +#define yyget_debug KDBText_get_debug +#endif + +#ifdef yyset_debug +#define KDBText_set_debug_ALREADY_DEFINED +#else +#define yyset_debug KDBText_set_debug +#endif + +#ifdef yyget_extra +#define KDBText_get_extra_ALREADY_DEFINED +#else +#define yyget_extra KDBText_get_extra +#endif + +#ifdef yyset_extra +#define KDBText_set_extra_ALREADY_DEFINED +#else +#define yyset_extra KDBText_set_extra +#endif + +#ifdef yyget_in +#define KDBText_get_in_ALREADY_DEFINED +#else +#define yyget_in KDBText_get_in +#endif + +#ifdef yyset_in +#define KDBText_set_in_ALREADY_DEFINED +#else +#define yyset_in KDBText_set_in +#endif + +#ifdef yyget_out +#define KDBText_get_out_ALREADY_DEFINED +#else +#define yyget_out KDBText_get_out +#endif + +#ifdef yyset_out +#define KDBText_set_out_ALREADY_DEFINED +#else +#define yyset_out KDBText_set_out +#endif + +#ifdef yyget_leng +#define KDBText_get_leng_ALREADY_DEFINED +#else +#define yyget_leng KDBText_get_leng +#endif + +#ifdef yyget_text +#define KDBText_get_text_ALREADY_DEFINED +#else +#define yyget_text KDBText_get_text +#endif + +#ifdef yyget_lineno +#define KDBText_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno KDBText_get_lineno +#endif + +#ifdef yyset_lineno +#define KDBText_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno KDBText_set_lineno +#endif + +#ifdef yywrap +#define KDBText_wrap_ALREADY_DEFINED +#else +#define yywrap KDBText_wrap +#endif + +/* %endif */ + +#ifdef yyalloc +#define KDBText_alloc_ALREADY_DEFINED +#else +#define yyalloc KDBText_alloc +#endif + +#ifdef yyrealloc +#define KDBText_realloc_ALREADY_DEFINED +#else +#define yyrealloc KDBText_realloc +#endif + +#ifdef yyfree +#define KDBText_free_ALREADY_DEFINED +#else +#define yyfree KDBText_free +#endif + +/* %if-c-only */ + +#ifdef yytext +#define KDBText_text_ALREADY_DEFINED +#else +#define yytext KDBText_text +#endif + +#ifdef yyleng +#define KDBText_leng_ALREADY_DEFINED +#else +#define yyleng KDBText_leng +#endif + +#ifdef yyin +#define KDBText_in_ALREADY_DEFINED +#else +#define yyin KDBText_in +#endif + +#ifdef yyout +#define KDBText_out_ALREADY_DEFINED +#else +#define yyout KDBText_out +#endif + +#ifdef yy_flex_debug +#define KDBText__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug KDBText__flex_debug +#endif + +#ifdef yylineno +#define KDBText_lineno_ALREADY_DEFINED +#else +#define yylineno KDBText_lineno +#endif + +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ +#include +#include +#include +#include +/* %endif */ + +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* begin standard C++ headers. */ +/* %if-c++-only */ +/* %endif */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* %not-for-header */ +/* Returned upon end-of-file. */ +#define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +/* %if-not-reentrant */ +extern int yyleng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +extern FILE *yyin, *yyout; +/* %endif */ +/* %endif */ + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { +/* %if-c-only */ + FILE *yy_input_file; +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ +/* %if-not-reentrant */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; +/* %ok-for-header */ + +/* %endif */ + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +/* %endif */ + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ + +#define KDBText_wrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG +typedef flex_uint8_t YY_CHAR; + +FILE *yyin = NULL, *yyout = NULL; + +typedef int yy_state_type; + +extern int yylineno; +int yylineno = 1; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +/* %% [1.5] DFA */ + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); + +/* %endif */ + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ + yyleng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ + (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 7 +#define YY_END_OF_BUFFER 8 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[20] = + { 0, + 0, 0, 8, 6, 5, 5, 4, 4, 1, 2, + 4, 4, 4, 4, 4, 4, 4, 3, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, + 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 1, 1, 1, 1, 5, 1, 6, 7, 5, 8, + + 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 10, 11, 5, 5, 5, 5, + 5, 5, 12, 1, 13, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[14] = + { 0, + 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 1 + } ; + +static const flex_int16_t yy_base[21] = + { 0, + 0, 0, 22, 23, 23, 23, 0, 15, 23, 23, + 0, 9, 13, 11, 11, 6, 6, 0, 23, 12 + } ; + +static const flex_int16_t yy_def[21] = + { 0, + 19, 1, 19, 19, 19, 19, 20, 20, 19, 19, + 20, 20, 20, 20, 20, 20, 20, 20, 0, 19 + } ; + +static const flex_int16_t yy_nxt[37] = + { 0, + 4, 5, 6, 4, 7, 7, 7, 8, 7, 7, + 7, 9, 10, 11, 18, 17, 16, 15, 14, 13, + 12, 19, 3, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19 + } ; + +static const flex_int16_t yy_chk[37] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 20, 17, 16, 15, 14, 13, 12, + 8, 3, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 1; + +static const flex_int16_t yy_rule_linenum[7] = + { 0, + 44, 45, 48, 50, 53, 56 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ +#include "kdbtext-lex.h" + /* let parser handle EOF */ + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +#include +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-c-only */ + +static int yy_init_globals ( void ); + +/* %endif */ +/* %if-reentrant */ +/* %endif */ +/* %endif End reentrant structures and macros. */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* %if-bison-bridge */ +/* %endif */ + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +/* %not-for-header */ +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr ); + +#endif +/* %ok-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ +#ifdef __cplusplus +static int yyinput ( void ); +#else +static int input ( void ); +#endif +/* %ok-for-header */ + +/* %endif */ +#endif + +/* %if-c-only */ + +/* %endif */ + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ +/* %if-c++-only C++ definition \ */\ +/* %endif */ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +/* %if-c-only */ +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ +/* %ok-for-header */ + +/* %not-for-header */ +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ + +extern int yylex (void); + +#define YY_DECL int yylex (void) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +/* %% [6.0] YY_RULE_SETUP definition goes here */ +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/* %not-for-header */ +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) +/* %if-c-only */ + yyin = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! yyout ) +/* %if-c-only */ + yyout = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + { +/* %% [7.0] user's declarations go here */ + + /* literals */ + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + 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 >= 20 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 23 ); + +yy_find_action: +/* %% [10.0] code to find the action number goes here */ + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +/* %% [11.0] code for yylineno update goes here */ + +do_action: /* This label is used only to access EOF actions. */ + +/* %% [12.0] debug code goes here */ + if ( yy_flex_debug ) + { + if ( yy_act == 0 ) + fprintf( stderr, "--scanner backing up\n" ); + else if ( yy_act < 7 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], yytext ); + else if ( yy_act == 7 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + yytext ); + else if ( yy_act == 8 ) + fprintf( stderr, "--(end of buffer or a NUL)\n" ); + else + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + } + + switch ( yy_act ) + { /* beginning of action switch */ +/* %% [13.0] actions go here */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +{ return yytext [ 0 ]; } + YY_BREAK +case 2: +YY_RULE_SETUP +{ return yytext [ 0 ]; } + YY_BREAK +/* keywords */ +case 3: +YY_RULE_SETUP +{ return KW_database; } + YY_BREAK +case 4: +YY_RULE_SETUP +{ return IDENTIFIER; } + YY_BREAK +/* ignored tokens */ +case 5: +/* rule 5 can match eol */ +YY_RULE_SETUP + + YY_BREAK +/* unrecognized input */ +case 6: +YY_RULE_SETUP +{ return UNRECOGNIZED; } + YY_BREAK +case 7: +YY_RULE_SETUP +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; +/* %if-c-only */ + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ +/* %ok-for-header */ + +/* %if-c++-only */ +/* %not-for-header */ +/* %ok-for-header */ + +/* %endif */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +/* %if-c-only */ +static int yy_get_next_buffer (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +/* %if-c-only */ +/* %not-for-header */ + static yy_state_type yy_get_previous_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + yy_state_type yy_current_state; + char *yy_cp; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { +/* %% [16.0] code to find the next state goes here */ + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + 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 >= 20 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +/* %if-c-only */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int yy_is_jam; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + 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 >= 20 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 19); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT +/* %if-c-only */ + + static void yyunput (int c, char * yy_bp ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + +/* %% [18.0] update yylineno here */ + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} +/* %if-c-only */ + +/* %endif */ +#endif + +/* %if-c-only */ +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + +/* %% [19.0] update BOL and yylineno */ + + return c; +} +/* %if-c-only */ +#endif /* ifndef YY_NO_INPUT */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void yyrestart (FILE * input_file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/* %if-c++-only */ +/* %endif */ + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +/* %if-c-only */ +static void yy_load_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; +/* %if-c-only */ + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/* %if-c++-only */ +/* %endif */ + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ +/* %if-c-only */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf ); + + yyfree( (void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ +/* %if-c-only */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + +/* %if-c-only */ + b->yy_input_file = file; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + +/* %if-c-only */ + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + +/* %endif */ +/* %if-c++-only */ +/* %endif */ + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +void yypop_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +static void yyensure_buffer_stack (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr ) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} +/* %endif */ + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +/* %if-c-only */ +static void yynoreturn yy_fatal_error (const char* msg ) +{ + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/* %if-reentrant */ +/* %endif */ + +/** Set the current line number. + * @param _line_number line number + * + */ +void yyset_lineno (int _line_number ) +{ + + yylineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str ) +{ + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str ) +{ + yyout = _out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int _bdebug ) +{ + yy_flex_debug = _bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif if-c-only */ + +/* %if-c-only */ +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} +/* %endif */ + +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + +/* %if-reentrant */ +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 43ae54659..bf52f1806 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -60,6 +60,7 @@ add_subdirectory(cloud) add_subdirectory(krypto) add_subdirectory(cipher) add_subdirectory(kdb) +add_subdirectory(kdbtext) add_subdirectory(kproc) add_subdirectory(vdb) add_subdirectory(search) diff --git a/test/kdbtext/CMakeLists.txt b/test/kdbtext/CMakeLists.txt new file mode 100644 index 000000000..e427023f0 --- /dev/null +++ b/test/kdbtext/CMakeLists.txt @@ -0,0 +1,37 @@ +# =========================================================================== +# +# PUBLIC DOMAIN NOTICE +# National Center for Biotechnology Information +# +# This software/database is a "United States Government Work" under the +# terms of the United States Copyright Act. It was written as part of +# the author's official duties as a United States Government employee and +# thus cannot be copyrighted. This software/database is freely available +# to the public for use. The National Library of Medicine and the U.S. +# Government have not placed any restriction on its use or reproduction. +# +# Although all reasonable efforts have been taken to ensure the accuracy +# and reliability of the software and data, the NLM and the U.S. +# Government do not and cannot warrant the performance or results that +# may be obtained by using this software or data. The NLM and the U.S. +# Government disclaim all warranties, express or implied, including +# warranties of performance, merchantability or fitness for any particular +# purpose. +# +# Please cite the author in any work or product based on this material. +# +# =========================================================================== + +if( WIN32 ) + set( ADDITIONAL_LIBS Crypt32 ) + set( TMPDIR ./data) +else() + set( ADDITIONAL_LIBS "" ) + set( TMPDIR /tmp ) +endif() + +add_compile_definitions( __mod__="test/kdbtext" ) + +AddExecutableTest( Test_KDBText_Scanner "wb-test-kdbtext-lex" "${COMMON_LIBS_READ};kdbtext" ) + +AddExecutableTest( Test_KDBText_Manager "test-manager" "${COMMON_LIBS_READ};kdbtext" ) diff --git a/test/kdbtext/Makefile b/test/kdbtext/Makefile new file mode 100644 index 000000000..d9b71f448 --- /dev/null +++ b/test/kdbtext/Makefile @@ -0,0 +1,30 @@ +# =========================================================================== +# +# PUBLIC DOMAIN NOTICE +# National Center for Biotechnology Information +# +# This software/database is a "United States Government Work" under the +# terms of the United States Copyright Act. It was written as part of +# the author's official duties as a United States Government employee and +# thus cannot be copyrighted. This software/database is freely available +# to the public for use. The National Library of Medicine and the U.S. +# Government have not placed any restriction on its use or reproduction. +# +# Although all reasonable efforts have been taken to ensure the accuracy +# and reliability of the software and data, the NLM and the U.S. +# Government do not and cannot warrant the performance or results that +# may be obtained by using this software or data. The NLM and the U.S. +# Government disclaim all warranties, express or implied, including +# warranties of performance, merchantability or fitness for any particular +# purpose. +# +# Please cite the author in any work or product based on this material. +# +# =========================================================================== + +default: runtests + +TOP ?= $(abspath ../..) +MODULE = test/kdbtext + +include $(TOP)/build/Makefile.env diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp new file mode 100644 index 000000000..6f6a99b16 --- /dev/null +++ b/test/kdbtext/test-manager.cpp @@ -0,0 +1,339 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for KDBManager for reading textual data +*/ + +#include + +#include + +using namespace std; + +TEST_SUITE(KDBTextManagerTestSuite); + +class KDBManager_Fixture +{ +public: + KDBManager_Fixture() + { + } + ~KDBManager_Fixture() + { + KDBManagerRelease( m_mgr ); + } + + const KDBManager * m_mgr = nullptr; +}; + +FIXTURE_TEST_CASE(KDBRManager_Make_Null, KDBManager_Fixture) +{ + REQUIRE_RC_FAIL( KDBManagerMakeText ( nullptr, "" ) ); +} + +FIXTURE_TEST_CASE(KDBRManager_AddRelease, KDBManager_Fixture) +{ + REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "" ) ); + + REQUIRE_NOT_NULL( m_mgr ) ; + REQUIRE_RC( KDBManagerAddRef( m_mgr ) ); + REQUIRE_RC( KDBManagerRelease( m_mgr ) ); + // use valgrind to find any leaks +} + +FIXTURE_TEST_CASE(KDBRManager_Version_Null, KDBManager_Fixture) +{ + REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "" ) ); + + REQUIRE_RC_FAIL( KDBManagerVersion( m_mgr, nullptr ) ); +} +FIXTURE_TEST_CASE(KDBRManager_Version, KDBManager_Fixture) +{ + REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "" ) ); + + uint32_t version = 0; + REQUIRE_RC( KDBManagerVersion( m_mgr, & version ) ); + REQUIRE_EQ( (uint32_t)0, version ); +} + +FIXTURE_TEST_CASE(KDBRManager_Db_Exists_Not, KDBManager_Fixture) +{ + REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "" ) ); + REQUIRE( ! KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb" ) ); +} +FIXTURE_TEST_CASE(KDBRManager_Db_Exists, KDBManager_Fixture) +{ + REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "database testdb{}" ) ); + REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb" ) ); +} + + + struct Database { + let name: String + let metadata: Metadata + + let tables: [Table] + let indices: [Index] + let databases: [Database] + } + struct Node { + struct Attribute { + let name: String + let value: [UInt8] + } + let name: String + let value: [UInt8] + let attributes: [Attribute] + let children: [Node] + } + let root: Node + } + struct Table { + let name: String + let metadata: Metadata + + let columns: [Column] + let indices: [Index] + } + struct Column { + let name: String + let metadata: Metadata + let data: [(row: Int64, value: [UInt8])] + } + struct Index { + struct Value { + let startId: Int64 + let count: UInt64 + } + enum IndexType { + case text([String: Value]) + case rowId([UInt64: Value]) + } + let name: String + let text: IndexType + } + +{ + "type": "database", + "name": "testdb", + "metadata": + { + "name":"", + "value":"blah", + "attributes":{"attr0":"value", "attr1":"attr1value"}, + "children":{ + "name":"schema", + "value":"version 1;....", + "attributes":{}, + "children":{} + } + } + "tables":[ + { + "name":"SEQUENCE", + "metadata":null, + "columns":[ + { + "name":"READ", + "metadata":null, + "data": + [ + {"row":1,"value":"AGCT"}, + {"row":2,"value":"AGCT"} + ] + } + ] + "indexes":[ + { + "name":"qwer", + "text":[ + {"key":"CG", "startId":1, "count":10}, + {"key":"AT", "startId":11, "count":2}, + ], + }, + { + "name":"rewq", + "projection":[ + {"value":"CG", "startId":1, "count":10}, + {"value":"AT", "startId":11, "count":2}, + ], + } + ] + } + ] +} + +metadata testdb.m +{ + name : +} + + +#if 0 +FIXTURE_TEST_CASE(KDBRManager_Writable, KDBManager_Fixture) +{ + REQUIRE_RC( KDBManagerWritable( m_mgr, "%s", "testdb" ) ); +} + +FIXTURE_TEST_CASE(KDBRManager_RunPeriodicTasks, KDBManager_Fixture) +{ + REQUIRE_RC( KDBManagerRunPeriodicTasks( m_mgr ) ); +} + +FIXTURE_TEST_CASE(KDBRManager_PathTypeVP, KDBManager_Fixture) +{ + VFSManager * vfs; + REQUIRE_RC( VFSManagerMake ( & vfs ) ); + + struct VPath * path; + REQUIRE_RC( VFSManagerMakePath ( vfs, & path, "%s", "testdb" ) ); + REQUIRE_EQ( (int)kptDatabase, KDBManagerPathTypeVP( m_mgr, path ) ); + + REQUIRE_RC( VPathRelease( path ) ); + REQUIRE_RC( VFSManagerRelease( vfs ) ); +} + +FIXTURE_TEST_CASE(KDBRManager_PathType, KDBManager_Fixture) +{ + REQUIRE_EQ( (int)kptDatabase, KDBManagerPathType( m_mgr, "%s", "testdb" ) ); +} + +FIXTURE_TEST_CASE(KDBManagerVPathType, KDBManager_Fixture) +{ + string path; + { // convert accession "SRR000123" into a file system path + VFSManager* vfsmgr; + REQUIRE_RC(VFSManagerMake(&vfsmgr)); + { + VPath * vpath; + const struct KFile *dummy1; + const struct VPath *dummy2; + REQUIRE_RC(VFSManagerResolveSpec ( vfsmgr, "SRR000123", &vpath, &dummy1, &dummy2, true)); + + path = ToString(vpath); + + REQUIRE_RC(KFileRelease(dummy1)); + REQUIRE_RC(VPathRelease(dummy2)); + REQUIRE_RC(VPathRelease(vpath)); + } + REQUIRE_RC(VFSManagerRelease(vfsmgr)); + } + +//cout << path << endl; + REQUIRE_EQ((int)kptTable, KDBManagerPathType(m_mgr, path.c_str())); +} + + +FIXTURE_TEST_CASE(KDBRManager_VPathTypeUnreliable, KDBManager_Fixture) +{ + auto fn = [] ( const KDBManager * self, const char *path, ... ) -> int + { + va_list args; + va_start ( args, path ); + int res = KDBManagerVPathTypeUnreliable ( self, path, args ); + va_end (args); + return res; + }; + REQUIRE_EQ( (int)kptDatabase, fn( m_mgr, "%s", "testdb" ) ); +} + +FIXTURE_TEST_CASE(KDBRManager_OpenDBRead, KDBManager_Fixture) +{ + const KDatabase * db = nullptr; + REQUIRE_RC( KDBManagerOpenDBRead( m_mgr, & db, "%s", "testdb" ) ); + REQUIRE_NOT_NULL( db ); + REQUIRE_RC( KDatabaseRelease( db ) ); +} + +FIXTURE_TEST_CASE(KDBRManager_OpenTableRead, KDBManager_Fixture) +{ + const KTable * tbl = nullptr; + REQUIRE_RC( KDBManagerOpenTableRead( m_mgr, & tbl, "%s", "SRR000123" ) ); + REQUIRE_NOT_NULL( tbl ); + REQUIRE_RC( KTableRelease( tbl ) ); +} + +FIXTURE_TEST_CASE(KDBRManager_OpenTableReadVPath, KDBManager_Fixture) +{ + VFSManager * vfs; + REQUIRE_RC( VFSManagerMake ( & vfs ) ); + + struct VPath * path; + REQUIRE_RC( VFSManagerMakePath ( vfs, & path, "%s", "SRR000123" ) ); + + const KTable * tbl = nullptr; + REQUIRE_RC( KDBManagerOpenTableReadVPath( m_mgr, & tbl, path ) ); + REQUIRE_NOT_NULL( tbl ); + REQUIRE_RC( KTableRelease( tbl ) ); + + REQUIRE_RC( VPathRelease( path ) ); + REQUIRE_RC( VFSManagerRelease( vfs ) ); +} + +FIXTURE_TEST_CASE(KDBRManager_OpenColumnRead, KDBManager_Fixture) +{ + const KColumn * col = nullptr; + rc_t rc = SILENT_RC( rcVFS,rcMgr,rcOpening,rcDirectory,rcNotFound ); + REQUIRE_EQ( rc, KDBManagerOpenColumnRead( m_mgr, & col, "%s", "testdb/tbl/SEQUENCE/col/qq" ) ); + REQUIRE_NULL( col ); +} + +//KDBManagerVPathOpenLocalDBRead: see remote_open_test.cpp/kdbtest.cpp +//KDBManagerVPathOpenRemoteDBRead +#endif + +//////////////////////////////////////////// Main +extern "C" +{ + +#include +#include + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} +rc_t CC UsageSummary (const char * progname) +{ + return 0; +} + +rc_t CC Usage ( const Args * args ) +{ + return 0; +} + +const char UsageDefaultName[] = "Test_KDBText_Manager"; + +rc_t CC KMain ( int argc, char *argv [] ) +{ + KConfigDisableUserSettings(); + rc_t rc=KDBTextManagerTestSuite(argc, argv); + return rc; +} + +} diff --git a/test/kdbtext/wb-test-kdbtext-lex.cpp b/test/kdbtext/wb-test-kdbtext-lex.cpp new file mode 100644 index 000000000..5a510078f --- /dev/null +++ b/test/kdbtext/wb-test-kdbtext-lex.cpp @@ -0,0 +1,324 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for schema tokenizer +*/ + +#include + +#include + +#include "../../libs/kdbtext/KDBTextScanner.hpp" + +#if 0 +using namespace ncbi::KdbTextParser; + +// need these fake to make schema-tokens.h compile +typedef struct ParseTree ParseTree; +typedef struct ErrorReport ErrorReport; + +#include "../../libs/schema/schema-grammar.hpp" + +using namespace std; +using namespace ncbi::NK; +#endif +TEST_SUITE ( KdbTextLexTestSuite ); +#if 0 +void +VerifyLocation ( const Token & p_token, uint32_t p_line, uint32_t p_column, const char * p_file = "" ) +{ + return;//TODO + const Token :: Location & loc = p_token . GetLocation (); + if ( string ( p_file ) != string ( loc . m_file ) ) + { + ostringstream out; + out << "VerifyLocation(): file name expected '" << p_file << "', actual '" << loc . m_file << "'" << endl; + throw std :: logic_error ( out . str () ); + } + if ( p_line != loc . m_line ) + { + ostringstream out; + out << "VerifyLocation(): line expected '" << p_line << "', actual '" << loc . m_line << "'" << endl; + throw std :: logic_error ( out . str () ); + } + if ( p_column != loc . m_column ) + { + ostringstream out; + out << "VerifyLocation(): column expected '" << p_column << "', actual '" << loc . m_column << "'" << endl; + throw std :: logic_error ( out . str () ); + } +} +#endif + +TEST_CASE ( EmptyInput ) +{ + REQUIRE_EQ ( (int)END_SOURCE, KDBTextScanner ( "" ) . NextToken () . GetType () ); +} +#if 0 +TEST_CASE ( Location ) +{ + KDBTextScanner s ( "" ); + Token t = s . NextToken (); + VerifyLocation ( t, 1, 1 ); +} + +TEST_CASE ( Whitespace ) +{ + KDBTextScanner s ( " " ); + Token t = s . NextToken (); + REQUIRE_EQ ( (int)END_SOURCE, t. GetType () ); + REQUIRE_EQ ( string ( " " ), string ( t . GetLeadingWhitespace () ) ); + VerifyLocation ( t, 1, 4 ); +} + +TEST_CASE ( NotNulTerminated ) +{ + KDBTextScanner s ( " bad", 2, false ); // only first 2 bytes looked at + Token t = s . NextToken (); + REQUIRE_EQ ( (int)END_SOURCE, t. GetType () ); + REQUIRE_EQ ( string ( " " ), string ( t . GetLeadingWhitespace () ) ); +} + +TEST_CASE ( Unrecognized ) +{ + REQUIRE_EQ ( (int)UNRECOGNIZED, KDBTextScanner ( "ÑŠ" ) . NextToken () . GetType () ); +} + +#define REQUIRE_LITERAL(name, lit) \ + TEST_CASE ( name ) { REQUIRE_EQ ( ( Token :: TokenType ) lit [ 0 ], KDBTextScanner ( lit ) . NextToken () . GetType () ); } + +REQUIRE_LITERAL ( Semicolon, ";" ) +REQUIRE_LITERAL ( Dollar, "$" ) +REQUIRE_LITERAL ( Comma, "," ) +REQUIRE_LITERAL ( LeftBrace, "{" ) +REQUIRE_LITERAL ( RightBrace, "}" ) +REQUIRE_LITERAL ( Equals, "=" ) +REQUIRE_LITERAL ( LeftParen, "(" ) +REQUIRE_LITERAL ( RightParen, ")" ) +REQUIRE_LITERAL ( Hash, "#" ) +REQUIRE_LITERAL ( LeftAngle, "<" ) +REQUIRE_LITERAL ( RightAngle, ">" ) +REQUIRE_LITERAL ( Asterisk, "*" ) +REQUIRE_LITERAL ( Slash, "/" ) +REQUIRE_LITERAL ( Colon, ":" ) +REQUIRE_LITERAL ( LeftSquare, "[" ) +REQUIRE_LITERAL ( RightSquare, "]" ) +REQUIRE_LITERAL ( Pipe, "|" ) +REQUIRE_LITERAL ( Dor, "." ) +REQUIRE_LITERAL ( Plus, "+" ) +REQUIRE_LITERAL ( Minus, "-" ) +REQUIRE_LITERAL ( At, "@" ) + +TEST_CASE ( Ellipsis ) +{ + REQUIRE_EQ ( ( Token :: TokenType ) ELLIPSIS, KDBTextScanner ( "..." ) . NextToken () . GetType () ); +} + +#define REQUIRE_TOKEN(expected, token) \ + REQUIRE_EQ ( string ( expected ), string ( token . GetValue () ) ) +#define REQUIRE_WS(expected, token) \ + REQUIRE_EQ ( string ( expected ), string ( token . GetLeadingWhitespace () ) ) + +#define REQUIRE_TERMINAL(name, token, term) \ +TEST_CASE ( name ) \ +{ \ + Token t = KDBTextScanner ( term ) . NextToken (); \ + REQUIRE_EQ ( ( Token :: TokenType ) token, t . GetType () ); \ + REQUIRE_TOKEN ( term, t ); \ +} + +REQUIRE_TERMINAL ( Decimal, DECIMAL, "123456789" ) +REQUIRE_TERMINAL ( Octal, OCTAL, "01234567" ) +REQUIRE_TERMINAL ( Hex_0x, HEX, "0x01abCDef23" ) +REQUIRE_TERMINAL ( Hex1_0X, HEX, "0X01abCDef23" ) +REQUIRE_TERMINAL ( Float, FLOAT_, ".1415" ) +REQUIRE_TERMINAL ( Float_NoLeadDigits, FLOAT_, "3.1415" ) +REQUIRE_TERMINAL ( Float_NoTrailDigits, FLOAT_, "3." ) +REQUIRE_TERMINAL ( ExpFloat_e, EXP_FLOAT, "3.14e1" ) +REQUIRE_TERMINAL ( ExpFloat_E, EXP_FLOAT, "3.14E1" ) + +REQUIRE_TERMINAL ( DoubleQuotedString, STRING, "\"qwerty\"" ) +REQUIRE_TERMINAL ( EscapedDQString, ESCAPED_STRING, "\"q\\w\\nerty\"" ) +REQUIRE_TERMINAL ( UnterminatedDQString, UNTERM_STRING, "\"qwerty" ) +REQUIRE_TERMINAL ( UnterminatedEDQString, UNTERM_ESCAPED_STRING, "\"q\\w\\nerty" ) + +REQUIRE_TERMINAL ( SingleQuotedString, STRING, "'qwerty'" ) +REQUIRE_TERMINAL ( EscapedSQString, ESCAPED_STRING, "\"q\\w\\nerty\"" ) +REQUIRE_TERMINAL ( UnterminatedSQString, UNTERM_STRING, "'qwerty" ) +REQUIRE_TERMINAL ( UnterminatedESQString, UNTERM_ESCAPED_STRING, "'q\\w\\nerty" ) + +REQUIRE_TERMINAL ( Identifier_OneChar, IDENTIFIER_1_0, "T" ) +REQUIRE_TERMINAL ( Identifier, IDENTIFIER_1_0, "abc123_" ) +REQUIRE_TERMINAL ( Identifier_StartsWithDigit, IDENTIFIER_1_0, "1abc123_" ) // "2na" is used in 1.0 schemas +REQUIRE_TERMINAL ( PhysicalIdentifier, PHYSICAL_IDENTIFIER_1_0, ".T" ) + +REQUIRE_TERMINAL ( Version_Maj, VERSION, "#1" ) +REQUIRE_TERMINAL ( Version_MajMin, VERSION, "#1.2" ) +REQUIRE_TERMINAL ( Version_MajMinRel, VERSION, "#1.2.3" ) +REQUIRE_TERMINAL ( Version_Ws_Maj, VERSION, "# 1" ) +REQUIRE_TERMINAL ( Version_Ws_MajMin, VERSION, "# 1.2" ) +REQUIRE_TERMINAL ( Version_Ws_MajMinRel, VERSION, "# 1.2.3" ) + +#define REQUIRE_KEYWORD(word) \ +TEST_CASE ( kw_##word ) \ +{ \ + Token t = KDBTextScanner ( #word ) . NextToken (); \ + REQUIRE_EQ ( ( Token :: TokenType ) KW_##word, t . GetType () ); \ + REQUIRE_TOKEN ( #word, t ); \ +} + +REQUIRE_KEYWORD(__no_header) +REQUIRE_KEYWORD(__row_length) +REQUIRE_KEYWORD(__untyped) +REQUIRE_KEYWORD(alias) +REQUIRE_KEYWORD(column) +REQUIRE_KEYWORD(const) +REQUIRE_KEYWORD(control) +REQUIRE_KEYWORD(database) +REQUIRE_KEYWORD(decode) +REQUIRE_KEYWORD(default) +REQUIRE_KEYWORD(encode) +REQUIRE_KEYWORD(extern) +REQUIRE_KEYWORD(false) +REQUIRE_KEYWORD(fmtdef) +REQUIRE_KEYWORD(function) +REQUIRE_KEYWORD(include) +REQUIRE_KEYWORD(limit) +REQUIRE_KEYWORD(physical) +REQUIRE_KEYWORD(read) +REQUIRE_KEYWORD(readonly) +REQUIRE_KEYWORD(return) +REQUIRE_KEYWORD(schema) +REQUIRE_KEYWORD(static) +REQUIRE_KEYWORD(table) +REQUIRE_KEYWORD(template) +REQUIRE_KEYWORD(trigger) +REQUIRE_KEYWORD(true) +REQUIRE_KEYWORD(type) +REQUIRE_KEYWORD(typedef) +REQUIRE_KEYWORD(typeset) +REQUIRE_KEYWORD(validate) +REQUIRE_KEYWORD(version) +REQUIRE_KEYWORD(view) +REQUIRE_KEYWORD(virtual) +REQUIRE_KEYWORD(void) +REQUIRE_KEYWORD(write) + +TEST_CASE ( Comment ) +{ + Token t = KDBTextScanner ( "/**/abc" ) . NextToken (); + REQUIRE_EQ ( ( Token :: TokenType ) IDENTIFIER_1_0, t . GetType () ); + REQUIRE_TOKEN ( "abc", t ); + REQUIRE_WS ( "/**/", t ); +} + +TEST_CASE ( LineComment ) +{ + Token t = KDBTextScanner ( "//qed\nabc" ) . NextToken (); + REQUIRE_EQ ( ( Token :: TokenType ) IDENTIFIER_1_0, t . GetType () ); + VerifyLocation ( t, 1, 4 ); + REQUIRE_TOKEN ( "abc", t ); + REQUIRE_WS ( "//qed\n", t ); +} + +TEST_CASE ( MultiLineComment ) +{ + Token t = KDBTextScanner ( "/*\n\n*/abc" ) . NextToken (); + REQUIRE_EQ ( ( Token :: TokenType ) IDENTIFIER_1_0, t . GetType () ); + REQUIRE_TOKEN ( "abc", t ); + REQUIRE_WS ( "/*\n\n*/", t ); +} + +TEST_CASE ( WhiteSpace ) +{ + Token t = KDBTextScanner ( " \t\f\v\r\nabc \t\f\v\r\n" ) . NextToken (); + REQUIRE_EQ ( ( Token :: TokenType ) IDENTIFIER_1_0, t . GetType () ); + REQUIRE_TOKEN ( "abc", t ); \ +} + +TEST_CASE ( Version_1 ) +{ + KDBTextScanner s ( "version 1;" ); + REQUIRE_EQ ( ( Token :: TokenType ) KW_version, s . NextToken () . GetType () ); + REQUIRE_EQ ( ( Token :: TokenType ) VERS_1_0, s . NextToken () . GetType () ); + REQUIRE_EQ ( ( Token :: TokenType ) ';', s . NextToken () . GetType () ); +} + +TEST_CASE ( Version_1_comment ) +{ + KDBTextScanner s ( "version /*!!*/ 1;" ); + REQUIRE_EQ ( ( Token :: TokenType ) KW_version, s . NextToken () . GetType () ); + REQUIRE_EQ ( ( Token :: TokenType ) VERS_1_0, s . NextToken () . GetType () ); + REQUIRE_EQ ( ( Token :: TokenType ) ';', s . NextToken () . GetType () ); +} + +TEST_CASE ( Version_2 ) +{ + KDBTextScanner s ( "version 2;" ); + REQUIRE_EQ ( ( Token :: TokenType ) KW_version, s . NextToken () . GetType () ); + REQUIRE_EQ ( ( Token :: TokenType ) VERS_2_0, s . NextToken () . GetType () ); +} + +TEST_CASE ( Version_2_0 ) +{ + KDBTextScanner s ( "version 2.0;" ); + REQUIRE_EQ ( ( Token :: TokenType ) KW_version, s . NextToken () . GetType () ); + REQUIRE_EQ ( ( Token :: TokenType ) VERS_2_0, s . NextToken () . GetType () ); +} +#endif +//////////////////////////////////////////// Main +#include +#include +#include + +extern "C" +{ + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} + +const char UsageDefaultName[] = "wb-test-kdbtext-lex"; + +rc_t CC UsageSummary (const char * progname) +{ + return KOutMsg ( "Usage:\n" "\t%s [options] -o path\n\n", progname ); +} + +rc_t CC Usage( const Args* args ) +{ + return 0; +} + +rc_t CC KMain ( int argc, char *argv [] ) +{ + return KdbTextLexTestSuite(argc, argv); +} + +} + From af82c06a20ad70e10b76978d707035e44eb44b6a Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 17 Nov 2023 15:23:50 -0500 Subject: [PATCH 03/42] VDB-5394 saving work --- interfaces/kdb/manager.h | 4 +- libs/kdb/database-cmn.h | 2 +- libs/kdb/rdatabase.c | 2 +- libs/kdbtext/CMakeLists.txt | 19 +- libs/kdbtext/KDBTextScanner.hpp | 53 - libs/kdbtext/Token.hpp | 71 - libs/kdbtext/database.cpp | 96 + libs/kdbtext/{kdbtext-lex.l => database.hpp} | 47 +- libs/kdbtext/kdbtext-grammar.hpp | 4 - libs/kdbtext/kdbtext-grammar.y | 1121 --- libs/kdbtext/kdbtext-lex.h | 44 - libs/kdbtext/manager.cpp | 258 +- libs/kdbtext/zz_kdbtext-grammar.cpp | 7228 ------------------ libs/kdbtext/zz_kdbtext-grammar.hpp | 224 - libs/kdbtext/zz_kdbtext-grammar.output | 7134 ----------------- libs/kdbtext/zz_kdbtext-lex.c | 2356 ------ test/kdbtext/CMakeLists.txt | 16 +- test/kdbtext/test-manager.cpp | 333 +- test/kdbtext/wb-test-kdbtext-lex.cpp | 324 - 19 files changed, 541 insertions(+), 18795 deletions(-) delete mode 100644 libs/kdbtext/KDBTextScanner.hpp delete mode 100644 libs/kdbtext/Token.hpp create mode 100644 libs/kdbtext/database.cpp rename libs/kdbtext/{kdbtext-lex.l => database.hpp} (67%) delete mode 100644 libs/kdbtext/kdbtext-grammar.hpp delete mode 100644 libs/kdbtext/kdbtext-grammar.y delete mode 100644 libs/kdbtext/kdbtext-lex.h delete mode 100644 libs/kdbtext/zz_kdbtext-grammar.cpp delete mode 100644 libs/kdbtext/zz_kdbtext-grammar.hpp delete mode 100644 libs/kdbtext/zz_kdbtext-grammar.output delete mode 100644 libs/kdbtext/zz_kdbtext-lex.c delete mode 100644 test/kdbtext/wb-test-kdbtext-lex.cpp diff --git a/interfaces/kdb/manager.h b/interfaces/kdb/manager.h index c9f356059..ed5a525e3 100644 --- a/interfaces/kdb/manager.h +++ b/interfaces/kdb/manager.h @@ -83,7 +83,7 @@ KDB_EXTERN rc_t CC KDBManagerRelease ( const KDBManager *self ); /* MakeRead * MakeUpdate - * MakeText (reads data from a character string) + * MakeText (reads data from a Json string) * * create library handle for specific use * @@ -92,7 +92,7 @@ KDB_EXTERN rc_t CC KDBManagerRelease ( const KDBManager *self ); */ KDB_EXTERN rc_t CC KDBManagerMakeRead ( const KDBManager **mgr, struct KDirectory const *wd ); KDB_EXTERN rc_t CC KDBManagerMakeUpdate ( KDBManager **mgr, struct KDirectory *wd ); -KDB_EXTERN rc_t CC KDBManagerMakeText ( const KDBManager **mgr, const char * data ); +KDB_EXTERN rc_t CC KDBManagerMakeText ( const KDBManager **mgr, const char * input, char * error, size_t error_size ); /* Version * returns the library version diff --git a/libs/kdb/database-cmn.h b/libs/kdb/database-cmn.h index 30e92afd0..5f4ebc16e 100644 --- a/libs/kdb/database-cmn.h +++ b/libs/kdb/database-cmn.h @@ -37,8 +37,8 @@ #define KDATABASE_IMPL KDatabase #include "database-base.h" -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif diff --git a/libs/kdb/rdatabase.c b/libs/kdb/rdatabase.c index 681fb372d..6c2643818 100644 --- a/libs/kdb/rdatabase.c +++ b/libs/kdb/rdatabase.c @@ -81,7 +81,7 @@ static KDatabase_vt KRDatabase_vt = KRDatabaseVOpenTableRead, KRDatabaseOpenMetadataRead, KRDatabaseVOpenIndexRead, - KRDatabaseListDB, + KRDatabaseListDB, KRDatabaseListTbl, KRDatabaseListIdx, KRDatabaseGetPath diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt index 5eec2eec9..3fb5086d8 100644 --- a/libs/kdbtext/CMakeLists.txt +++ b/libs/kdbtext/CMakeLists.txt @@ -22,26 +22,9 @@ # # =========================================================================== -if( FLEX_FOUND AND BISON_FOUND ) - FLEX_TARGET( KDBTextFlex kdbtext-lex.l ${CMAKE_CURRENT_SOURCE_DIR}/zz_kdbtext-lex.c - COMPILE_FLAGS "--debug --noline" ) - set( KDBTextScanner ${FLEX_KDBTextFlex_OUTPUTS} ) - BISON_TARGET( KDBTextGrammar kdbtext-grammar.y ${CMAKE_CURRENT_SOURCE_DIR}/zz_kdbtext-grammar.cpp - COMPILE_FLAGS "-Wno-other --no-lines -r state -v" - DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zz_kdbtext-grammar.hpp - ) - set( KDBTextParser ${BISON_KDBTextGrammar_OUTPUT_SOURCE} ) - ADD_FLEX_BISON_DEPENDENCY(KDBTextFlex KDBTextGrammar) - SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM 1) -else() - set( KDBTextScanner zz_kdbtext-lex.c ) - set( KDBTextParser zz_kdbtext-grammar.cpp ) -endif() - set( KDBTEXT_SRC manager.cpp - ${KDBTextScanner} -# ${KDBTextParser} + database.cpp ) GenerateStaticLibs( kdbtext "${KDBTEXT_SRC}" ) diff --git a/libs/kdbtext/KDBTextScanner.hpp b/libs/kdbtext/KDBTextScanner.hpp deleted file mode 100644 index c17319deb..000000000 --- a/libs/kdbtext/KDBTextScanner.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/*=========================================================================== - * - * PUBLIC DOMAIN NOTICE - * National Center for Biotechnology Information - * - * This software/database is a "United States Government Work" under the - * terms of the United States Copyright Act. It was written as part of - * the author's official duties as a United States Government employee and - * thus cannot be copyrighted. This software/database is freely available - * to the public for use. The National Library of Medicine and the U.S. - * Government have not placed any restriction on its use or reproduction. - * - * Although all reasonable efforts have been taken to ensure the accuracy - * and reliability of the software and data, the NLM and the U.S. - * Government do not and cannot warrant the performance or results that - * may be obtained by using this software or data. The NLM and the U.S. - * Government disclaim all warranties, express or implied, including - * warranties of performance, merchantability or fitness for any particular - * purpose. - * - * Please cite the author in any work or product based on this material. - * - * =========================================================================== - * - */ - -#pragme once - -#include "Token.hpp" - -namespace ncbi -{ - namespace KDBTextParser - { - class Scanner - { - public: - Scanner ( const char * source, bool p_debug = false ); // NUL-terminated - Scanner ( const char * source, size_t p_size, bool p_debug ); - ~Scanner (); - - :: KDBTextScanBlock & GetScanBlock () { return m_scanBlock; } - - public: /* this is for testing only; bison-generated parser calls KDBTextScan_yylex directly */ - Token NextToken (); - - private: - void Init ( const char * p_source, size_t p_size, bool p_debug ); - - :: KDBTextScanBlock m_scanBlock; - }; - } -} diff --git a/libs/kdbtext/Token.hpp b/libs/kdbtext/Token.hpp deleted file mode 100644 index fa1aa5670..000000000 --- a/libs/kdbtext/Token.hpp +++ /dev/null @@ -1,71 +0,0 @@ -/*=========================================================================== - * - * PUBLIC DOMAIN NOTICE - * National Center for Biotechnology Information - * - * This software/database is a "United States Government Work" under the - * terms of the United States Copyright Act. It was written as part of - * the author's official duties as a United States Government employee and - * thus cannot be copyrighted. This software/database is freely available - * to the public for use. The National Library of Medicine and the U.S. - * Government have not placed any restriction on its use or reproduction. - * - * Although all reasonable efforts have been taken to ensure the accuracy - * and reliability of the software and data, the NLM and the U.S. - * Government do not and cannot warrant the performance or results that - * may be obtained by using this software or data. The NLM and the U.S. - * Government disclaim all warranties, express or implied, including - * warranties of performance, merchantability or fitness for any particular - * purpose. - * - * Please cite the author in any work or product based on this material. - * - * =========================================================================== - * - */ - -#pragma once - -#include "kdbtext-lex.h" - -namespace ncbi -{ - namespace KDBTextParser - { - class Token - { - public: - typedef int TokenType; - static const TokenType EndSource = 0; // bison convention - - struct Location - { - const char * m_file; // empty string if not known - uint32_t m_line; // 1 - based - uint32_t m_column; // 1 - based - - Location ( const char * p_file, uint32_t p_line, uint32_t p_column ); - }; - - public: - Token ( const SchemaToken & st ); // takes ownership of st.leading_ws - Token ( TokenType, const char * value = 0 ); - Token ( TokenType, const char * value, const Location & loc ); - Token ( const Token & ); - ~Token (); - - TokenType GetType () const { return m_type; } - const char * GetValue () const { return m_value == 0 ? "" : m_value; } - const Location & GetLocation () const { return m_location; } - const char * GetLeadingWhitespace () const { return m_ws == 0 ? "" : m_ws; } - - private: - TokenType m_type; - char * m_value; - Location m_location; - char * m_ws; - }; - } -} - -#endif diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp new file mode 100644 index 000000000..104353feb --- /dev/null +++ b/libs/kdbtext/database.cpp @@ -0,0 +1,96 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "database.hpp" + +using namespace KDBText; + +// static rc_t CC KRDatabaseWhack ( KDatabase *self ); +// static bool CC KRDatabaseLocked ( const KDatabase *self ); +// static bool CC KRDatabaseVExists ( const KDatabase *self, uint32_t type, const char *name, va_list args ); +// static bool CC KRDatabaseIsAlias ( const KDatabase *self, uint32_t type, char *resolved, size_t rsize, const char *name ); +// static rc_t CC KRDatabaseVWritable ( const KDatabase *self, uint32_t type, const char *name, va_list args ); +// static rc_t CC KRDatabaseOpenManagerRead ( const KDatabase *self, const KDBManager **mgr ); +// static rc_t CC KRDatabaseOpenParentRead ( const KDatabase *self, const KDatabase **par ); +// static rc_t CC KRDatabaseOpenDirectoryRead ( const KDatabase *self, const KDirectory **dir ); +// static rc_t CC KRDatabaseVOpenDBRead ( const KDatabase *self, const KDatabase **dbp, const char *name, va_list args ); +// static rc_t CC KRDatabaseVOpenTableRead ( const KDatabase *self, const KTable **tblp, const char *name, va_list args ); +// static rc_t CC KRDatabaseOpenMetadataRead ( const KDatabase *self, const KMetadata **metap ); +// static rc_t CC KRDatabaseVOpenIndexRead ( const KDatabase *self, const KIndex **idxp, const char *name, va_list args ); +// static rc_t CC KRDatabaseListDB ( const KDatabase *self, KNamelist **names ); +// static rc_t CC KRDatabaseListTbl ( struct KDatabase const *self, KNamelist **names ); +// static rc_t CC KRDatabaseListIdx ( struct KDatabase const *self, KNamelist **names ); +// static rc_t CC KRDatabaseGetPath ( KDatabase const *self, const char **path ); + +static KDatabase_vt KRTextDatabase_vt = +{ + // KRDatabaseWhack, + // KDatabaseBaseAddRef, + // KDatabaseBaseRelease, + // KRDatabaseLocked, + // KRDatabaseVExists, + // KRDatabaseIsAlias, + // KRDatabaseVWritable, + // KRDatabaseOpenManagerRead, + // KRDatabaseOpenParentRead, + // KRDatabaseOpenDirectoryRead, + // KRDatabaseVOpenDBRead, + // KRDatabaseVOpenTableRead, + // KRDatabaseOpenMetadataRead, + // KRDatabaseVOpenIndexRead, + // KRDatabaseListDB, + // KRDatabaseListTbl, + // KRDatabaseListIdx, + // KRDatabaseGetPath +}; + +Database::Database( const KJsonObject * p_json ) : m_json ( p_json ) +{ +} + +Database::~Database() +{ +} + +rc_t +Database::inflate( char * error, size_t error_size ) +{ + rc_t rc = 0; + + const KJsonValue * name = KJsonObjectGetMember ( m_json, "name" ); + if ( name != nullptr ) + { + const char * nameStr = nullptr; + rc = KJsonGetString ( name, & nameStr ); + if ( rc == 0 ) + { + m_name = nameStr; + } + } + + return rc; +} + diff --git a/libs/kdbtext/kdbtext-lex.l b/libs/kdbtext/database.hpp similarity index 67% rename from libs/kdbtext/kdbtext-lex.l rename to libs/kdbtext/database.hpp index 8cc844c58..fa0221a55 100644 --- a/libs/kdbtext/kdbtext-lex.l +++ b/libs/kdbtext/database.hpp @@ -24,33 +24,34 @@ * */ -%{ -#include "kdbtext-lex.h" -%} +typedef struct KTextDatabase KTextDatabase; +#define KDATABASE_IMPL KTextDatabase +#include "../libs/kdb/database-base.h" -%option prefix="KDBText_" +#include +#include - /* let parser handle EOF */ -%option noyywrap +#include -alpha [a-zA-Z_] -alphanum [a-zA-Z_0-9] +struct KTextDatabase +{ + KDatabaseBase dad; +}; -%% +namespace KDBText +{ + class Database : public KTextDatabase + { + public: + Database( const KJsonObject * p_json ); + ~Database(); - /* literals */ + rc_t inflate( char * error, size_t error_size ); -"{" { return yytext [ 0 ]; } -"}" { return yytext [ 0 ]; } - - /* keywords */ -"database" { return KW_database; } - -{alpha}{alphanum}* { return IDENTIFIER; } - - /* ignored tokens */ -<*>[ \t\f\v\r\n] - - /* unrecognized input */ -<*>. { return UNRECOGNIZED; } + const std::string & getName() const { return m_name; } + private: + const KJsonObject * m_json = nullptr; + std::string m_name; + }; +} diff --git a/libs/kdbtext/kdbtext-grammar.hpp b/libs/kdbtext/kdbtext-grammar.hpp deleted file mode 100644 index 790851c4e..000000000 --- a/libs/kdbtext/kdbtext-grammar.hpp +++ /dev/null @@ -1,4 +0,0 @@ -// The Flex- and Bison-generated files are named this way (zz_*) to hit the disk last on checkout, -// thus making sure the generated files' timestamps are not older than the corresponding sources'. -// This avoids triggering unnecessary re-runs of flex/bison. -#include "zz_kdbtext-grammar.hpp" diff --git a/libs/kdbtext/kdbtext-grammar.y b/libs/kdbtext/kdbtext-grammar.y deleted file mode 100644 index 6853708b8..000000000 --- a/libs/kdbtext/kdbtext-grammar.y +++ /dev/null @@ -1,1121 +0,0 @@ -/*=========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -*/ - -%{ - #define YYDEBUG 1 - - #include - -// #include "ParseTree.hpp" -// #include "ErrorReport.hpp" - - using namespace ncbi::KDBTextParser; - - #include "kdbtext-grammar.hpp" - #include "kdbtext-lex.h" - #define KDBText_lex KDBTextScan_yylex - - void KDBText_error ( YYLTYPE * p_llocp, - ctx_t ctx, - ParseTree ** p_root, - ErrorReport * p_errors, - struct KDBTextScanBlock * p_sb, - const char * p_msg ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); - /* send message to the C++ parser for proper display and recovery */ - Token :: Location loc ( p_sb -> file_name, p_llocp -> first_line, p_llocp -> first_column ); - p_errors -> ReportError ( ctx, loc, "%s", p_msg); - } - - extern "C" - { - extern enum KDBText_tokentype KDBTextScan_yylex ( SCHEMA_STYPE *lvalp, SCHEMA_LTYPE *llocp, KDBTextScanBlock* sb ); - } - - static - ParseTree* - P ( KDBTextToken & p_prod ) - { - assert ( p_prod . subtree ); - return ( ParseTree * ) p_prod . subtree; - } - - static - ParseTree* - T ( ctx_t ctx, KDBTextToken & p_term ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing );//TODO: catch - assert ( p_term . subtree == 0 ); - return ParseTree::Make ( ctx, p_term ); - } - - /* Create production node */ - static - ParseTree * - MakeTree ( ctx_t ctx, - int p_token, - ParseTree * p_ch1 = 0, - ParseTree * p_ch2 = 0, - ParseTree * p_ch3 = 0, - ParseTree * p_ch4 = 0, - ParseTree * p_ch5 = 0, - ParseTree * p_ch6 = 0, - ParseTree * p_ch7 = 0, - ParseTree * p_ch8 = 0, - ParseTree * p_ch9 = 0 - ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); - ParseTree * ret = ParseTree :: Make ( ctx, Token ( p_token ) ); - if ( p_ch1 != 0 ) ret -> AddChild ( ctx, p_ch1 ); - if ( p_ch2 != 0 ) ret -> AddChild ( ctx, p_ch2 ); - if ( p_ch3 != 0 ) ret -> AddChild ( ctx, p_ch3 ); - if ( p_ch4 != 0 ) ret -> AddChild ( ctx, p_ch4 ); - if ( p_ch5 != 0 ) ret -> AddChild ( ctx, p_ch5 ); - if ( p_ch6 != 0 ) ret -> AddChild ( ctx, p_ch6 ); - if ( p_ch7 != 0 ) ret -> AddChild ( ctx, p_ch7 ); - if ( p_ch8 != 0 ) ret -> AddChild ( ctx, p_ch8 ); - if ( p_ch9 != 0 ) ret -> AddChild ( ctx, p_ch9 ); - return ret; - } - - /* Create a flat list */ - static - ParseTree * - MakeList ( ctx_t ctx, KDBTextToken & p_prod ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); - ParseTree * ret = ParseTree :: Make ( ctx, Token ( PT_ASTLIST ) ); - ret -> AddChild ( ctx, P ( p_prod ) ); - return ret; - } - - /* Add to a flat list node */ - static - ParseTree * - AddToList ( ctx_t ctx, ParseTree * p_root, ParseTree * p_br1, ParseTree * p_br2 = 0 ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); - assert ( p_br1 != 0 ); - p_root -> AddChild ( ctx, p_br1 ); - if ( p_br2 != 0 ) - { - p_root -> AddChild ( ctx, p_br2 ); - } - return p_root; - } - -%} - -%define api.prefix "KDBText_" - /*%name-prefix "KDBText_"*/ -%parse-param { ctx_t ctx } -%parse-param { ParseTree** root } -%parse-param { ErrorReport * errors } -%param { struct KDBTextScanBlock* sb } - -%define api.value.type {KDBTextToken} - -%define parse.error verbose -%locations - -%define api.pure full -%destructor { - if ( $$ . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( $$ . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( $$ . leading_ws ); - } -} <> - - /* !!! Keep token declarations in synch with kdbtext-ast.y */ - -%token END_SOURCE 0 "end of source" - -%token UNRECOGNIZED - -%token ELLIPSIS -%token INCREMENT - -%token DECIMAL -%token OCTAL -%token HEX -%token FLOAT_ -%token EXP_FLOAT -%token STRING -%token ESCAPED_STRING - -%token IDENTIFIER_1_0 -%token PHYSICAL_IDENTIFIER_1_0 -%token VERSION - -/* unterminated strings are dealt with by flex */ -%token UNTERM_STRING -%token UNTERM_ESCAPED_STRING - -/* version numbers recognized under special flex state */ -%token VERS_1_0 -%token VERS_2_0 - -%token KW___no_header -%token KW___row_length -%token KW___untyped -%token KW_alias -%token KW_column -%token KW_const -%token KW_control -%token KW_database -%token KW_decode -%token KW_default -%token KW_encode -%token KW_extern -%token KW_false -%token KW_fmtdef -%token KW_function -%token KW_include -%token KW_limit -%token KW_physical -%token KW_read -%token KW_readonly -%token KW_return -%token KW_kdbtext -%token KW_static -%token KW_table -%token KW_template -%token KW_trigger -%token KW_true -%token KW_type -%token KW_typedef -%token KW_typeset -%token KW_validate -%token KW_version -%token KW_view -%token KW_virtual -%token KW_void -%token KW_write - - /* Parse tree nodes */ -%token PT_ASTLIST -%token PT_PARSE -%token PT_SOURCE -%token PT_VERSION_1_0 -%token PT_VERSION_2 -%token PT_SCHEMA_1_0 -%token PT_SCHEMA_2_0 -%token PT_INCLUDE -%token PT_TYPEDEF -%token PT_FQN -%token PT_IDENT -%token PT_PHYSIDENT -%token PT_UINT -%token PT_TYPESET -%token PT_TYPESETDEF -%token PT_FORMAT -%token PT_CONST -%token PT_ALIAS -%token PT_EXTERN -%token PT_FUNCTION -%token PT_UNTYPED -%token PT_ROWLENGTH -%token PT_FUNCDECL -%token PT_EMPTY -%token PT_SCHEMASIG -%token PT_SCHEMAFORMAL -%token PT_RETURNTYPE -%token PT_FACTSIG -%token PT_FUNCSIG -%token PT_FUNCPARAMS -%token PT_FORMALPARAM -%token PT_ELLIPSIS -%token PT_FUNCPROLOGUE -%token PT_RETURN -%token PT_PRODSTMT -%token PT_PRODTRIGGER -%token PT_SCHEMA -%token PT_VALIDATE -%token PT_PHYSICAL -%token PT_PHYSPROLOGUE -%token PT_PHYSSTMT -%token PT_PHYSBODYSTMT -%token PT_TABLE -%token PT_TABLEPARENTS -%token PT_TABLEBODY -%token PT_FUNCEXPR -%token PT_FACTPARMS -%token PT_COLUMN -%token PT_COLUMNEXPR -%token PT_COLDECL -%token PT_TYPEDCOL -%token PT_COLSTMT -%token PT_DFLTVIEW -%token PT_PHYSMBR -%token PT_PHYSCOL -%token PT_PHYSCOLDEF -%token PT_COLSCHEMAPARMS -%token PT_COLSCHEMAPARAM -%token PT_COLUNTYPED -%token PT_DATABASE -%token PT_TYPEEXPR -%token PT_DBBODY -%token PT_DBDAD -%token PT_DBMEMBER -%token PT_TBLMEMBER -%token PT_NOHEADER -%token PT_CASTEXPR -%token PT_CONSTVECT -%token PT_NEGATE -%token PT_UNARYPLUS -%token PT_VERSNAME -%token PT_ARRAY -%token PT_PHYSENCREF -%token PT_TYPEDCOLEXPR -%token PT_VIEW -%token PT_VIEWPARAM -%token PT_VIEWPARENTS -%token PT_VIEWPARENT -%token PT_MEMBEREXPR -%token PT_JOINEXPR -%token PT_ALIASMEMBER -%token PT_VIEWSPEC - - /* !!! Keep token declarations above in synch with kdbtext-ast.y */ - - -%start parse - -%% - -parse - : END_SOURCE { *root = MakeTree ( ctx, PT_PARSE, T ( ctx, $1 ) ); $$ . subtree = 0; $$ . leading_ws = 0; } - | source END_SOURCE { *root = MakeTree ( ctx, PT_PARSE, P ( $1 ), T ( ctx, $2 ) ); $$ . subtree = 0; $$ . leading_ws = 0; } - ; - -source - : kdbtext_1_0 { $$ . subtree = MakeTree ( ctx, PT_SOURCE, P ( $1 ) ); } - | version_1_0 kdbtext_1_0_opt { $$ . subtree = MakeTree ( ctx, PT_SOURCE, P ( $1 ), P ( $2 ) ); } - | version_2_0 kdbtext_2_0_opt { $$ . subtree = MakeTree ( ctx, PT_SOURCE, P ( $1 ), P ( $2 ) ); } - ; - -/* kdbtext-1.0 - */ -version_1_0 - : KW_version VERS_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_VERSION_1_0, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ) ); } - ; - -kdbtext_1_0_opt - : kdbtext_1_0 { $$ . subtree = P ( $1 ); } - | empty { $$ = $1; } - ; - -kdbtext_1_0 - : kdbtext_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_SCHEMA_1_0, P ( $1 ) ); } - | kdbtext_1_0 kdbtext_1_0_decl { $$ . subtree = AddToList ( ctx, P ( $1 ) , P ( $2 ) ); } - ; - -kdbtext_1_0_decl - : typedef_1_0_decl { $$ = $1; } - | typeset_1_0_decl { $$ = $1; } - | format_1_0_decl { $$ = $1; } - | const_1_0_decl { $$ = $1; } - | alias_1_0_decl { $$ = $1; } - | function_1_0_decl { $$ = $1; } - | extern_1_0_decl { $$ = $1; } - | script_1_0_decl { $$ = $1; } - | validate_1_0_decl { $$ = $1; } - | physical_1_0_decl { $$ = $1; } - | table_1_0_decl { $$ = $1; } - | database_1_0_decl { $$ = $1; } - | include_directive { $$ = $1; } - | ';' { $$ . subtree = T ( ctx, $1 ); } /* for lots of reasons, we tolerate stray semicolons */ - ; - -/* typedef-1.0 - */ -typedef_1_0_decl - : KW_typedef - fqn_1_0 /* must be from 'typedef' or kdbtext template */ - typedef_1_0_new_name_list - ';' - { $$ . subtree = MakeTree ( ctx, PT_TYPEDEF, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } - ; - -typedef_1_0_new_name_list - : typespec_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | typedef_1_0_new_name_list ',' typespec_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -/* typeset-1.0 - */ -typeset_1_0_decl - : KW_typeset typeset_1_0_new_name typeset_1_0_def ';' - { $$ . subtree = MakeTree ( ctx, PT_TYPESET, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } - ; - -typeset_1_0_new_name - : fqn_1_0 { $$ = $1; } /* we allow duplicate redefinition here... */ - ; - -typeset_1_0_def - : '{' typespec_1_0_list '}' /* ...obviously, the set contents must match */ - { $$ . subtree = MakeTree ( ctx, PT_TYPESETDEF, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -/* typespec-1.0 - */ -typespec_1_0_list - : typespec_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | typespec_1_0_list ',' typespec_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -typespec_1_0 - : fqn_1_0 { $$ = $1; } - | fqn_1_0 '[' dim_1_0 ']' { $$ . subtree = MakeTree ( ctx, PT_ARRAY, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - ; - -dim_1_0 - : expression_1_0 { $$ = $1; } /* expects unsigned integer constant expression */ - | '*' { $$ . subtree = T ( ctx, $1 ); } - ; - -/* format-1.0 - */ -format_1_0_decl - : KW_fmtdef format_1_0_new_name ';' - { $$ . subtree = MakeTree ( ctx, PT_FORMAT, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - | KW_fmtdef format_1_0_name format_1_0_new_name ';' /* creates a derived format */ - { $$ . subtree = MakeTree ( ctx, PT_FORMAT, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } - ; - -format_1_0_new_name - : fqn_1_0 { $$ = $1; } /* allow for redefinition - current code seems to be wrong */ - ; - -format_1_0_name - : fqn_1_0 { $$ = $1; } /* must name a format */ - ; - - -/* const-1.0 - */ -const_1_0_decl - : KW_const typespec_1_0 fqn_1_0 '=' expression_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_CONST, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ), P ( $5 ), T ( ctx, $6 ) ); } - ; - -/* alias-1.0 - */ -alias_1_0_decl - : KW_alias fqn_1_0 alias_1_0_new_name ';' - { $$ . subtree = MakeTree ( ctx, PT_ALIAS, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } - ; - -alias_1_0_new_name - : fqn_1_0 { $$ = $1; } /* for some reason, does not allow duplicate redefinition */ - ; - -/* function-1.0 - */ -function_1_0_decl - : KW_function func_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_FUNCTION, T ( ctx, $1 ), P ( $2 ) ); } - ; - -func_1_0_decl - : untyped_func_1_0_decl { $$ = $1; } /* cannot be inline or a validation function */ - | row_length_func_1_0_decl { $$ = $1; } /* cannot be inline or a validation function */ - | opt_func_1_0_kdbtext_sig - func_1_0_return_type - fqn_opt_vers - opt_func_1_0_fact_sig - func_1_0_param_sig - func_1_0_prologue - { $$ . subtree = MakeTree ( ctx, PT_FUNCDECL, P ( $1 ), P ( $2 ), P ( $3 ), P ( $4 ), P ( $5 ), P ( $6 ) ); } - ; - -untyped_func_1_0_decl - : KW___untyped fqn_1_0 '(' ')' - { $$ . subtree = MakeTree ( ctx, PT_UNTYPED, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), T ( ctx, $4 ) ); } - ; - -row_length_func_1_0_decl - : KW___row_length fqn_1_0 '(' ')' - { $$ . subtree = MakeTree ( ctx, PT_ROWLENGTH, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), T ( ctx, $4 ) ); } - ; - -opt_func_1_0_kdbtext_sig - : empty { $$ = $1; } - | func_1_0_kdbtext_sig { $$ = $1; } - ; - -func_1_0_kdbtext_sig - : '<' func_1_0_kdbtext_formals '>' { $$ . subtree = MakeTree ( ctx, PT_SCHEMASIG, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -func_1_0_kdbtext_formals - : func_1_0_kdbtext_formal { $$ . subtree = MakeList ( ctx, $1 ); } - | func_1_0_kdbtext_formals ',' func_1_0_kdbtext_formal { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -func_1_0_kdbtext_formal - : KW_type ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_SCHEMAFORMAL, T ( ctx, $1 ), P ( $2 ) ); } - | type_expr_1_0 ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_SCHEMAFORMAL, P ( $1 ), P ( $2 ) ); } /* type-expr must be uint */ - ; - -func_1_0_return_type - : KW_void { $$ . subtree = MakeTree ( ctx, PT_RETURNTYPE, T ( ctx, $1 ) ); } - | type_expr_1_0 { $$ . subtree = MakeTree ( ctx, PT_RETURNTYPE, P ( $1 ) ); } - ; - -opt_func_1_0_fact_sig - : empty { $$ = $1; } - | func_1_0_fact_sig { $$ = $1; } - ; - -func_1_0_fact_sig - : '<' func_1_0_fact_signature '>' { $$ . subtree = MakeTree ( ctx, PT_FACTSIG, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -func_1_0_fact_signature - : empty { $$ = $1; } - | func_1_0_fact_params func_1_0_vararg_formals - { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), P ( $2 ) ); } - | '*' func_1_0_fact_params func_1_0_vararg_formals - { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, T ( ctx, $1 ), P ( $2 ), P ( $3 ) ); } - | func_1_0_fact_params '*' func_1_0_fact_params func_1_0_vararg_formals - { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), T ( ctx, $2 ), P ( $3 ), P ( $4 ) ); } - | func_1_0_fact_params ',' '*' func_1_0_fact_params func_1_0_vararg_formals - { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), T ( ctx, $2 ), T ( ctx, $3 ), P ( $4 ), P ( $5 ) ); } - ; - -func_1_0_fact_params - : fact_param_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | func_1_0_fact_params ',' fact_param_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -fact_param_1_0 - : typespec_1_0 IDENTIFIER_1_0 { $$ . subtree = MakeTree ( ctx, PT_FORMALPARAM, P ( $1 ), T ( ctx, $2 ) ); } - ; - -func_1_0_param_sig - : '(' func_1_0_param_signature ')' { $$ . subtree = MakeTree ( ctx, PT_FUNCSIG, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -func_1_0_param_signature - : empty { $$ = $1; } - | func_1_0_formal_params func_1_0_vararg_formals - { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), P ( $2 ) ); } - | '*' func_1_0_formal_params func_1_0_vararg_formals - { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, T ( ctx, $1 ), P ( $2 ), P ( $3 ) ); } - | func_1_0_formal_params '*' func_1_0_formal_params func_1_0_vararg_formals - { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), T ( ctx, $2 ), P ( $3 ), P ( $4 ) ); } - | func_1_0_formal_params ',' '*' func_1_0_formal_params func_1_0_vararg_formals - { $$ . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( $1 ), T ( ctx, $2 ), T ( ctx, $3 ), P ( $4 ), P ( $5 ) ); } - ; - -func_1_0_formal_params - : formal_param_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | func_1_0_formal_params ',' formal_param_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -formal_param_1_0 - : typespec_1_0 IDENTIFIER_1_0 { $$ . subtree = MakeTree ( ctx, PT_FORMALPARAM, P ( $1 ), T ( ctx, $2 ) ); } - | KW_control typespec_1_0 IDENTIFIER_1_0 - { $$ . subtree = MakeTree ( ctx, PT_FORMALPARAM, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -func_1_0_vararg_formals - : empty { $$ = $1; } - | ',' ELLIPSIS { $$ . subtree = MakeTree ( ctx, PT_ELLIPSIS, T ( ctx, $1 ), T ( ctx, $2 ) ); } - ; - -func_1_0_prologue - : ';' /* this is a simple external function declaration */ - { $$ . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, $1 ) ); } - | '=' fqn_1_0 ';' /* rename the function declaration with fqn */ - { $$ . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - | '{' script_1_0_stmt_seq '}' /* this is a "script" function - cannot be extern! */ - { $$ . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -script_1_0_stmt_seq - : script_1_0_stmt { $$ . subtree = MakeList ( ctx, $1 ); } - | script_1_0_stmt_seq script_1_0_stmt { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } - ; - -script_1_0_stmt - : KW_return cond_expr_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_RETURN, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - | type_expr_1_0 ident_1_0 '=' cond_expr_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } - ; - -/* extern-1.0 - */ -extern_1_0_decl - : KW_extern ext_func_1_0_decl /* supposed to be an extern C function */ - { $$ . subtree = MakeTree ( ctx, PT_EXTERN, T ( ctx, $1 ), P ( $2 ) ); } - ; - -ext_func_1_0_decl - : function_1_0_decl { $$ = $1; } /* there are restrictions and potentially additions */ - ; - -/* script - */ - -script_1_0_decl - : KW_kdbtext func_1_0_decl /* MUST have a function body */ - { $$ . subtree = MakeTree ( ctx, PT_SCHEMA, T ( ctx, $1 ), P ( $2 ) ); } - | KW_kdbtext KW_function func_1_0_decl /* "function" keyword is optional */ - { $$ . subtree = MakeTree ( ctx, PT_SCHEMA, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -/* validate - */ - -validate_1_0_decl - : KW_validate function_1_0_decl /* has exactly 2 parameters and is not inline */ - { $$ . subtree = MakeTree ( ctx, PT_VALIDATE, T ( ctx, $1 ), P ( $2 ) ); } - ; - -/* physical encoding - */ -physical_1_0_decl - : KW_physical - opt_func_1_0_kdbtext_sig - phys_1_0_return_type - fqn_vers - opt_func_1_0_fact_sig - phys_1_0_prologue - { $$ . subtree = MakeTree ( ctx, PT_PHYSICAL, T ( ctx, $1 ), P ( $2 ), P ( $3 ), P ( $4 ), P ( $5 ), P ( $6 ) ); } - ; - -phys_1_0_return_type - : func_1_0_return_type { $$ = $1; } - | KW___no_header func_1_0_return_type { $$ . subtree = MakeTree ( ctx, PT_NOHEADER, T ( ctx, $1 ), P ( $2 ) ); } /* not supported with kdbtext signature */ - ; - -phys_1_0_prologue - : '=' phys_1_0_stmt /* shorthand for decode-only rules */ - { $$ . subtree = MakeTree ( ctx, PT_PHYSPROLOGUE, T ( ctx, $1 ), P ( $2 ) ); } - | '{' phys_1_0_body '}' - { $$ . subtree = MakeTree ( ctx, PT_PHYSPROLOGUE, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -phys_1_0_body - : phys_1_0_body_stmt { $$ . subtree = MakeList ( ctx, $1 ); } - | phys_1_0_body phys_1_0_body_stmt { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } - ; - -phys_1_0_body_stmt - : ';' - { $$ . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, $1 ) ); } - | KW_decode phys_1_0_stmt - { $$ . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, $1 ), P ( $2 ) ); } - | KW_encode phys_1_0_stmt - { $$ . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, $1 ), P ( $2 ) ); } - | KW___row_length '=' fqn_1_0 '(' ')' - { $$ . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ), T ( ctx, $5 ) ); } - ; - -phys_1_0_stmt - : '{' script_1_0_stmt_seq '}' /* with caveat that magic parameter "@" is defined */ - { $$ . subtree = MakeTree ( ctx, PT_PHYSSTMT, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -/* table - */ -table_1_0_decl - : KW_table - fqn_vers - opt_tbl_1_0_parents - tbl_1_0_body - { $$ . subtree = MakeTree ( ctx, PT_TABLE, T ( ctx, $1 ), P ( $2 ), P ( $3 ), P ( $4 ) ); } - ; - -opt_tbl_1_0_parents - : empty { $$ = $1; } - | '=' tbl_1_0_parents { $$ . subtree = MakeTree ( ctx, PT_TABLEPARENTS, T ( ctx, $1 ), P ( $2 ) ); } - ; - -tbl_1_0_parents - : fqn_opt_vers { $$ . subtree = MakeList ( ctx, $1 ); } - | tbl_1_0_parents ',' fqn_opt_vers { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -tbl_1_0_body - : '{' tbl_1_0_stmt_seq '}' - { $$ . subtree = MakeTree ( ctx, PT_TABLEBODY, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - | '{' '}' - { $$ . subtree = MakeTree ( ctx, PT_TABLEBODY, T ( ctx, $1 ), T ( ctx, $2 ) ); } - ; - -tbl_1_0_stmt_seq - : tbl_1_0_stmt { $$ . subtree = MakeList ( ctx, $1 ); } - | tbl_1_0_stmt_seq tbl_1_0_stmt { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } - ; - -tbl_1_0_stmt - : production_1_0_stmt { $$ = $1; } - | col_1_0_modifiers col_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_COLUMN, P ( $1 ), P ( $2 ) ); } - | KW_column KW_limit '=' expression_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_COLUMNEXPR, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } - | KW_column KW_default KW_limit '=' expression_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_COLUMNEXPR, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ), T ( ctx, $4 ), P ( $5 ), T ( ctx, $6 ) ); } - | KW_static physmbr_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, $1 ), P ( $2 ) ); } - | KW_physical physmbr_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, $1 ), P ( $2 ) ); } - | KW_static KW_physical physmbr_1_0_decl { $$ . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ) ); } - | default_view_1_0_decl { $$ = $1; } - | KW___untyped '=' fqn_1_0 '(' ')' ';' - { $$ . subtree = MakeTree ( ctx, PT_COLUNTYPED, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ), T ( ctx, $5 ), T ( ctx, $6 ) ); } - | ';' { $$ . subtree = T ( ctx, $1 ); } - ; - -production_1_0_stmt - : typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' /* cannot have format */ - { $$ . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } - | KW_trigger ident_1_0 '=' cond_expr_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_PRODTRIGGER, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } - ; - -col_1_0_modifiers - : KW_column { $$ . subtree = T ( ctx, $1 ); } - | col_1_0_modifier_seq KW_column { $$ = $1; AddToList ( ctx, P ( $1 ), T ( ctx, $2 ) ); } - ; - -col_1_0_modifier_seq - : col_1_0_modifier { $$ . subtree = MakeList ( ctx, $1 ); } - | col_1_0_modifier_seq col_1_0_modifier { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } - ; - -col_1_0_modifier - : KW_default { $$ . subtree = T ( ctx, $1 ); } - | KW_extern { $$ . subtree = T ( ctx, $1 ); } - | KW_readonly { $$ . subtree = T ( ctx, $1 ); } - ; - -col_1_0_decl - : typespec_1_0 typed_column_decl_1_0 - { $$ . subtree = MakeTree ( ctx, PT_COLDECL, P ( $1 ), P ( $2 ) ); } - | phys_enc_ref typed_column_decl_1_0 - { $$ . subtree = MakeTree ( ctx, PT_COLDECL, P ( $1 ), P ( $2 ) ); } - ; - -phys_enc_ref - : '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 - { $$ . subtree = MakeTree ( ctx, PT_PHYSENCREF, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), P ( $5 ) ); } - | fqn_vers opt_factory_parms_1_0 - { $$ . subtree = MakeTree ( ctx, PT_PHYSENCREF, P ( $1 ), P ( $2 ) ); } - | fqn_1_0 factory_parms_1_0 - { $$ . subtree = MakeTree ( ctx, PT_PHYSENCREF, P ( $1 ), P ( $2 ) ); } - ; - -typed_column_decl_1_0 - : col_ident '{' opt_column_body_1_0 '}' - { $$ . subtree = MakeTree ( ctx, PT_TYPEDCOL, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - | col_ident '=' cond_expr_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_TYPEDCOLEXPR, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - | col_ident ';' - { $$ . subtree = MakeTree ( ctx, PT_TYPEDCOL, P ( $1 ), T ( ctx, $2 ) ); } - ; - -col_ident - : ident_1_0 { $$ = $1; } - | phys_ident { $$ = $1; } - ; - -phys_ident - : PHYSICAL_IDENTIFIER_1_0 { $$ . subtree = T ( ctx, $1 ); } /* starts with a '.' */ - ; - -opt_column_body_1_0 - : empty { $$ = $1; } - | column_body_1_0 { $$ = $1; } - ; - -column_body_1_0 - : column_stmt_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | column_body_1_0 column_stmt_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } - ; - -column_stmt_1_0 - : KW_read '=' cond_expr_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - | KW_validate '=' cond_expr_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - | KW_limit '=' uint_expr_1_0 ';' { $$ . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - | ';' { $$ . subtree = T ( ctx, $1 ); } - ; - -default_view_1_0_decl - : KW_default KW_view STRING ';' - { $$ . subtree = MakeTree ( ctx, PT_DFLTVIEW, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ), T ( ctx, $4 ) ); } - ; - -physmbr_1_0_decl - : phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_PHYSMBR, P ( $1 ), T ( ctx, $2 ), T ( ctx, $3 ) ); } - | phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_PHYSMBR, P ( $1 ), T ( ctx, $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } - | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_PHYSMBR, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), T ( ctx, $4 ) ); } - | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_PHYSMBR, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), T ( ctx, $4 ), P ( $5 ), T ( ctx, $6 ) ); } - ; - -phys_coldef_1_0 - : opt_col_kdbtext_parms_1_0 fqn_opt_vers opt_factory_parms_1_0 - { $$ . subtree = MakeTree ( ctx, PT_PHYSCOLDEF, P ( $1 ), P ( $2 ), P ( $3 ) ); } - ; - -opt_col_kdbtext_parms_1_0 - : empty { $$ = $1; } - | '<' col_kdbtext_parms_1_0 '>' { $$ . subtree = MakeTree ( ctx, PT_COLSCHEMAPARMS, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -col_kdbtext_parms_1_0 - : col_kdbtext_parm_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | col_kdbtext_parms_1_0 ',' col_kdbtext_parm_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -col_kdbtext_parm_1_0 - : fqn_1_0 '=' col_kdbtext_value_1_0 { $$ . subtree = MakeTree ( ctx, PT_COLSCHEMAPARAM, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - | col_kdbtext_value_1_0 { $$ = $1; } - ; - -col_kdbtext_value_1_0 - : fqn_1_0 { $$ = $1; } - | uint_expr_1_0 { $$ = $1; } - ; - -/* expression - */ - -cond_expr_1_0 - : expression_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | cond_expr_1_0 '|' expression_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -expression_1_0 - : primary_expr_1_0 { $$ = $1; } - | '(' type_expr_1_0 ')' expression_1_0 { $$ . subtree = MakeTree ( ctx, PT_CASTEXPR, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ) ); } - ; - -primary_expr_1_0 - : fqn_1_0 { $$ = $1; } - | phys_ident { $$ = $1; } - | '@' { $$ . subtree = T ( ctx, $1 ); } - | func_expr_1_0 { $$ = $1; } - | uint_expr_1_0 { $$ = $1; } - | float_expr_1_0 { $$ = $1; } - | string_expr_1_0 { $$ = $1; } - | const_vect_expr_1_0 { $$ = $1; } - | bool_expr_1_0 { $$ = $1; } - | '-' expression_1_0 { $$ . subtree = MakeTree ( ctx, PT_NEGATE, T ( ctx, $1 ), P ( $2 ) ); } - | '+' expression_1_0 { $$ . subtree = MakeTree ( ctx, PT_UNARYPLUS, T ( ctx, $1 ), P ( $2 ) ); } - | member_expr_2_0 { $$ = $1; } - | join_expr_2_0 { $$ = $1; } - ; - -func_expr_1_0 - : '<' kdbtext_parms_1_0 '>' - fqn_opt_vers - opt_factory_parms_1_0 - '(' - opt_func_1_0_parms - ')' - { $$ . subtree = MakeTree ( ctx, PT_FUNCEXPR, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), P ( $5 ), T ( ctx, $6 ), P ( $7 ), T ( ctx, $8 ) ); } - | fqn_opt_vers - opt_factory_parms_1_0 - '(' - opt_func_1_0_parms - ')' - { $$ . subtree = MakeTree ( ctx, PT_FUNCEXPR, P ( $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } - ; - -kdbtext_parms_1_0 - : kdbtext_parm_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | kdbtext_parms_1_0 ',' kdbtext_parm_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -kdbtext_parm_1_0 - : fqn_1_0 { $$ = $1; } - | fqn_1_0 '[' dim_1_0 ']' { $$ . subtree = MakeTree ( ctx, PT_ARRAY, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - | uint_expr_1_0 { $$ = $1; } - ; - -opt_factory_parms_1_0 - : empty { $$ = $1; } - | factory_parms_1_0 { $$ = $1; } - ; - -factory_parms_1_0 - : '<' factory_parms '>' { $$ . subtree = MakeTree ( ctx, PT_FACTPARMS, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -factory_parms - : expression_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | factory_parms ',' expression_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -opt_func_1_0_parms - : empty { $$ = $1; } - | func_1_0_parms { $$ = $1; } - ; - -func_1_0_parms - : expression_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | func_1_0_parms ',' expression_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -uint_expr_1_0 - : DECIMAL { $$ . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, $1 ) ); } - | HEX { $$ . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, $1 ) ); } - | OCTAL { $$ . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, $1 ) ); } - ; - -float_expr_1_0 - : FLOAT_ { $$ . subtree = T ( ctx, $1 ); } - | EXP_FLOAT { $$ . subtree = T ( ctx, $1 ); } - ; - -string_expr_1_0 - : STRING { $$ . subtree = T ( ctx, $1 ); } - | ESCAPED_STRING { $$ . subtree = T ( ctx, $1 ); } - ; - -const_vect_expr_1_0 - : '[' opt_const_vect_exprlist_1_0 ']' { $$ . subtree = MakeTree ( ctx, PT_CONSTVECT, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -opt_const_vect_exprlist_1_0 - : empty { $$ = $1; } - | const_vect_exprlist_1_0 { $$ = $1; } - ; - -const_vect_exprlist_1_0 - : expression_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | const_vect_exprlist_1_0 ',' expression_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -bool_expr_1_0 - : KW_true { $$ . subtree = T ( ctx, $1 ); } - | KW_false { $$ . subtree = T ( ctx, $1 ); } - ; - -type_expr_1_0 - : typespec_1_0 { $$ = $1; } /* datatype, typeset, kdbtexttype */ - | fqn_1_0 '/' fqn_1_0 { $$ . subtree = MakeTree ( ctx, PT_TYPEEXPR, P ( $1 ), T ( ctx, $2), P ( $3 ) ); } /* format / type */ - ; - -member_expr_2_0 - : ident_1_0 '.' ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_MEMBEREXPR, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - | ident_1_0 PHYSICAL_IDENTIFIER_1_0 { $$ . subtree = MakeTree ( ctx, PT_MEMBEREXPR, P ( $1 ), T ( ctx, $2 ) ); } - ; - -join_expr_2_0 - : ident_1_0 '[' cond_expr_1_0 ']' '.' ident_1_0 - { $$ . subtree = MakeTree ( ctx, PT_JOINEXPR, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ), T ( ctx, $5 ), P ($6 ) ); } - | ident_1_0 '[' cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 - { $$ . subtree = MakeTree ( ctx, PT_JOINEXPR, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ), T ( ctx, $5 ) ); } - ; - - /* database */ - -database_1_0_decl - : KW_database - fqn_vers - opt_database_dad_1_0 - database_body_1_0 - { $$ . subtree = MakeTree ( ctx, PT_DATABASE, T ( ctx, $1 ), P ( $2), P ( $3 ), P ( $4 ) ); } - ; - -opt_database_dad_1_0 - : empty { $$ = $1; } - | '=' fqn_opt_vers { $$ . subtree = MakeTree ( ctx, PT_DBDAD, T ( ctx, $1 ), P ( $2 ) ); } - ; - -database_body_1_0 - : '{' '}' { $$ . subtree = MakeTree ( ctx, PT_DBBODY, T ( ctx, $1 ), T ( ctx, $2 ) ); } - | '{' database_members_1_0 '}' { $$ . subtree = MakeTree ( ctx, PT_DBBODY, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ) ); } - ; - -database_members_1_0 - : database_member_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | database_members_1_0 database_member_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } - ; - -database_member_1_0 - : db_member_1_0 { $$ = $1; } - | table_member_1_0 { $$ = $1; } - | alias_member_1_0 { $$ = $1; } - | ';' { $$ . subtree = T ( ctx, $1 ); } - ; - -opt_template_1_0 - : empty { $$ = $1; } - | KW_template { $$ . subtree = T ( ctx, $1 ); } - ; - -db_member_1_0 - : opt_template_1_0 KW_database fqn_opt_vers ident_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_DBMEMBER, P ( $1 ), T ( ctx, $2 ), P ( $3 ), P ( $4 ), T ( ctx, $5 ) ); } - ; - -table_member_1_0 - : opt_template_1_0 KW_table fqn_opt_vers ident_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_TBLMEMBER, P ( $1 ), T ( ctx, $2 ), P ( $3 ), P ( $4 ), T ( ctx, $5 ) ); } - ; - -alias_member_1_0 - : KW_alias view_spec ident_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_ALIASMEMBER, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ) ); } - ; - -view_spec - : fqn_opt_vers '<' view_parms '>' - { $$ . subtree = MakeTree ( ctx, PT_VIEWSPEC, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - ; - -view_parms - : ident_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | view_parms ',' ident_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -/* include - */ - -include_directive - : KW_include STRING { $$ . subtree = MakeTree ( ctx, PT_INCLUDE, T ( ctx, $1 ), T ( ctx, $2 ) ); } - ; - - - -/* other stuff - */ -fqn_1_0 - : ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_FQN, P ( $1 ) ); } - | fqn_1_0 ':' ident_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - /* a hack to handle keywords used as namespace identifiers in existing 1.0 kdbtexts */ - | fqn_1_0 ':' KW_database { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } - | fqn_1_0 ':' KW_decode { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } - | fqn_1_0 ':' KW_encode { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } - | fqn_1_0 ':' KW_read { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } - | fqn_1_0 ':' KW_table { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } - | fqn_1_0 ':' KW_type { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } - | fqn_1_0 ':' KW_view { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } - | fqn_1_0 ':' KW_write { $3 . type = IDENTIFIER_1_0; $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), MakeTree ( ctx, PT_IDENT, T ( ctx, $3 ) ) ); } - ; - -ident_1_0 - : IDENTIFIER_1_0 { $$ . subtree = MakeTree ( ctx, PT_IDENT, T ( ctx, $1 ) ); } /* this is just a C identifier */ - ; - -empty - : %empty { $$ . subtree = MakeTree ( ctx, PT_EMPTY ); } - ; - -fqn_vers - : fqn_1_0 VERSION { $$ . subtree = MakeTree ( ctx, PT_VERSNAME, P ( $1 ), T ( ctx, $2 ) ); } - ; - -fqn_opt_vers - : fqn_1_0 { $$ = $1; } - | fqn_vers { $$ = $1; } - ; - -/*************************** V 2.0 ******************************/ - -version_2_0 - : KW_version VERS_2_0 ';' { $$ . subtree = MakeTree ( ctx, PT_VERSION_2, T ( ctx, $1 ), T ( ctx, $2 ), T ( ctx, $3 ) ); } - ; - -kdbtext_2_0_opt - : kdbtext_2_0 { $$ . subtree = P ( $1 ); } - | empty { $$ = $1; } - ; - -kdbtext_2_0 - : kdbtext_2_0_decl { $$ . subtree = MakeTree ( ctx, PT_SCHEMA_2_0, P ( $1 ) ); } - | kdbtext_2_0 kdbtext_2_0_decl { $$ . subtree = AddToList ( ctx, P ( $1 ) , P ( $2 ) ); } - ; - -kdbtext_2_0_decl - : kdbtext_1_0_decl { $$ = $1; } - | view_2_0_decl { $$ = $1; } - ; - -view_2_0_decl - : KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body '}' - { $$ . subtree = MakeTree ( ctx, PT_VIEW, T ( ctx, $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ), P ( $6 ), T ( ctx, $7 ), P ( $8 ), T ( ctx, $9 ) ); } - ; - -view_parms - : view_parm { $$ . subtree = MakeList ( ctx, $1 ); } - | view_parms ',' view_parm { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -view_parm - : fqn_opt_vers ident_1_0 { $$ . subtree = MakeTree ( ctx, PT_VIEWPARAM, P ( $1 ), P ( $2 ) ); } - ; - -opt_view_body - : empty { $$ = $1; } - | view_body { $$ = $1; } - ; - -view_body - : view_member { $$ . subtree = MakeList ( ctx, $1 ); } - | view_body view_member { $$ . subtree = AddToList ( ctx, P ( $1 ), P ( $2 ) ); } - ; - -view_member - : typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( $1 ), P ( $2 ), T ( ctx, $3 ), P ( $4 ), T ( ctx, $5 ) ); } - | KW_column typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' - { $$ . subtree = MakeTree ( ctx, PT_COLUMN, T ( ctx, $1 ), P ( $2 ), P ( $3 ), T ( ctx, $4 ), P ( $5 ), T ( ctx, $6 ) ); } - | ';' { $$ . subtree = T ( ctx, $1 ); } - ; - -opt_view_parents - : empty { $$ = $1; } - | '=' view_parents { $$ . subtree = MakeTree ( ctx, PT_VIEWPARENTS, T ( ctx, $1 ), P ( $2 ) ); } - ; - -view_parents - : view_parent { $$ . subtree = MakeList ( ctx, $1 ); } - | view_parents ',' view_parent { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; - -view_parent - : fqn_opt_vers '<' view_parent_parms'>' - { $$ . subtree = MakeTree ( ctx, PT_VIEWPARENT, P ( $1 ), T ( ctx, $2 ), P ( $3 ), T ( ctx, $4 ) ); } - ; - -view_parent_parms - : ident_1_0 { $$ . subtree = MakeList ( ctx, $1 ); } - | view_parent_parms ',' ident_1_0 { $$ . subtree = AddToList ( ctx, P ( $1 ), T ( ctx, $2 ), P ( $3 ) ); } - ; diff --git a/libs/kdbtext/kdbtext-lex.h b/libs/kdbtext/kdbtext-lex.h deleted file mode 100644 index da0dd877c..000000000 --- a/libs/kdbtext/kdbtext-lex.h +++ /dev/null @@ -1,44 +0,0 @@ -/*=========================================================================== - * - * PUBLIC DOMAIN NOTICE - * National Center for Biotechnology Information - * - * This software/database is a "United States Government Work" under the - * terms of the United States Copyright Act. It was written as part of - * the author's official duties as a United States Government employee and - * thus cannot be copyrighted. This software/database is freely available - * to the public for use. The National Library of Medicine and the U.S. - * Government have not placed any restriction on its use or reproduction. - * - * Although all reasonable efforts have been taken to ensure the accuracy - * and reliability of the software and data, the NLM and the U.S. - * Government do not and cannot warrant the performance or results that - * may be obtained by using this software or data. The NLM and the U.S. - * Government disclaim all warranties, express or implied, including - * warranties of performance, merchantability or fitness for any particular - * purpose. - * - * Please cite the author in any work or product based on this material. - * - * =========================================================================== - * - */ - -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum -{ - UNRECOGNIZED, - IDENTIFIER, - KW_database -} KDBText_tokentype; - -extern KDBText_tokentype KDBText_lex ( SCHEMA_STYPE *lvalp, SCHEMA_LTYPE *llocp, KDBTextScanBlock* sb ); - -#ifdef __cplusplus -} -#endif diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index 8c75898bd..c9a7caf09 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -1,4 +1,3 @@ - /*=========================================================================== * * PUBLIC DOMAIN NOTICE @@ -27,7 +26,19 @@ #include +#include "database.hpp" + #include +#include +#include +#include +#include + +#include + +#include + +using namespace std; typedef struct KDBManager KDBManager; #define KDBMGR_IMPL KDBManager @@ -43,13 +54,13 @@ const uint32_t LIBKDBTEXT_VERS = 0; static rc_t CC KDBTextManagerWhack ( KDBManager *self ); static rc_t CC KDBTextManagerVersion ( const KDBManager *self, uint32_t *version ); static bool CC KDBTextManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args ); +static rc_t CC KDBTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ); +static rc_t CC KDBTextManagerRunPeriodicTasks ( const KDBManager *self ); +static int CC KDBTextManagerPathTypeVP( const KDBManager * self, const VPath * path ); +static int CC KDBTextManagerVPathType ( const KDBManager * self, const char *path, va_list args ); +static int CC KDBTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ); +static rc_t CC KDBTextManagerVOpenDBRead ( const KDBManager *self, const KDatabase **db, const char *path, va_list args ); -// static rc_t CC KDBTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ); -// static rc_t CC KDBTextManagerRunPeriodicTasks ( const KDBManager *self ); -// static int CC KDBTextManagerPathTypeVP( const KDBManager * self, const VPath * path ); -// static int CC KDBTextManagerVPathType ( const KDBManager * self, const char *path, va_list args ); -// static int CC KDBTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ); -// static rc_t CC KDBTextManagerVOpenDBRead ( const KDBManager *self, const KDatabase **db, const char *path, va_list args ); // static rc_t CC KDBTextManagerVOpenTableRead ( const KDBManager *self, const KTable **tbl, const char *path, va_list args ); // static rc_t CC KDBTextManagerOpenTableReadVPath(const KDBManager *self, const KTable **tbl, const struct VPath *path); // static rc_t CC KDBTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ); @@ -63,12 +74,12 @@ static KDBManager_vt KDBTextManager_vt = KDBManagerBaseRelease, KDBTextManagerVersion, KDBTextManagerVExists, - // KDBTextManagerVWritable, - // KDBTextManagerRunPeriodicTasks, - // KDBTextManagerPathTypeVP, - // KDBTextManagerVPathType, - // KDBTextManagerVPathTypeUnreliable, - // KDBTextManagerVOpenDBRead, + KDBTextManagerVWritable, + KDBTextManagerRunPeriodicTasks, + KDBTextManagerPathTypeVP, + KDBTextManagerVPathType, + KDBTextManagerVPathTypeUnreliable, + KDBTextManagerVOpenDBRead, // KDBTextManagerVOpenTableRead, // KDBTextManagerOpenTableReadVPath, // KDBTextManagerVOpenColumnRead, @@ -76,19 +87,82 @@ static KDBManager_vt KDBTextManager_vt = // KDBTextManagerVPathOpenRemoteDBRead }; -class Manager : public KDBManager +namespace KDBText { -public: - Manager() + class Manager : public KDBManager { - dad . vt = & KDBTextManager_vt; - KRefcountInit ( & dad . refcount, 1, "KDBManager", "make-read-text", "kmgr" ); - } - ~Manager() - { - KRefcountWhack ( & dad . refcount, "KDBManager" ); - } -}; + public: + Manager() + { + dad . vt = & KDBTextManager_vt; + KRefcountInit ( & dad . refcount, 1, "KDBManager", "make-read-text", "kmgr" ); + } + ~Manager() + { + delete m_db; + KJsonValueWhack( m_root ); + KRefcountWhack ( & dad . refcount, "KDBManager" ); + } + + rc_t parse( const char * input, char * error, size_t error_size ) + { + rc_t rc = KJsonValueMake ( & m_root, input, error, error_size ); + if ( rc != 0 ) + { + return rc; + } + + if ( KJsonGetValueType ( m_root ) != jsObject ) + { + string_printf ( error, error_size, nullptr, "Json root is invalid" ); + return SILENT_RC( rcDB, rcMgr, rcCreating, rcParam, rcInvalid ); + } + + const KJsonObject * rootObj = KJsonValueToObject ( m_root ); + assert( rootObj != nullptr ); + + const KJsonValue * type = KJsonObjectGetMember ( rootObj, "type" ); + if ( type != nullptr ) + { + const char * typeStr = nullptr; + rc = KJsonGetString ( type, & typeStr ); + if ( rc == 0 ) + { + if ( strcmp( typeStr, "database") == 0 ) + { + m_db = new Database( rootObj ); + rc = m_db -> inflate( error, error_size ); + } + } + } + + return rc; + } + + const Database * getRootDatabase() const { return m_db; } + + int pathType( const string & path ) const + { + if ( m_db ) + { //TODO: implement proper parsing (allow "db/table/col" etc.) + if ( m_db -> getName () == path ) + { + return kptDatabase; + } + } + //TODO: else root table + return kptNotFound; + } + + private: + KJsonValue * m_root = nullptr; + Database * m_db = nullptr; + }; + +} + +using namespace KDBText; +#define CAST() assert( bself -> dad . vt == & KDBTextManager_vt ); const Manager *self = static_cast(bself); static rc_t CC @@ -112,11 +186,55 @@ KDBTextManagerVersion ( const KDBManager *self, uint32_t * version ) return 0; } +static +rc_t +PrintToString( const char *fmt, va_list args, string & out ) +{ + KDataBuffer buf; + rc_t rc = KDataBufferMake ( & buf, 8, 0 ); + if ( rc != 0 ) + { + return false; + } + + rc = KDataBufferVPrintf ( & buf, fmt, args ); + if ( rc != 0 ) + { + return rc; + } + + out = string((const char *) (buf . base)); // will be 0-terminated + + rc = KDataBufferWhack ( & buf ); + if ( rc != 0 ) + { + return rc; + } + + return rc; +} + + static bool CC -KDBTextManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args ) +KDBTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *fmt, va_list args ) { - return false; + CAST(); + + string path; + PrintToString( fmt, args, path ); + + // TODO: non-root dbs and other objects (incl root tables) + switch ( requested ) + { + case kptDatabase: + { + const Database * db = self -> getRootDatabase(); + return db && db -> getName() == path; + } + default: + return false; + } // int type; // type = KDBManagerVPathType (self, name, args); @@ -137,16 +255,98 @@ KDBTextManagerVExists ( const KDBManager *self, uint32_t requested, const char * // return requested == ( uint32_t ) type; } +static +rc_t CC +KDBTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ) +{ + //TODO: parse and resolve the path, if the object is valid return rcReadOnly, otherwise rcNotFound + return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); +} + +static +rc_t CC +KDBTextManagerRunPeriodicTasks ( const KDBManager *self ) +{ + return 0; +} + +static +int CC +KDBTextManagerPathTypeVP( const KDBManager * bself, const VPath * path ) +{ + CAST(); + + // parse and resolve the path + const String * p; + rc_t rc = VPathMakeString ( path, &p ); + if ( rc == 0 ) + { + int ret = self -> pathType( string ( p -> addr, p -> size ) ); + StringWhack ( p ); + return ret; + } + + return kptNotFound; +} + +static +int CC +KDBTextManagerVPathType ( const KDBManager * bself, const char *fmt, va_list args ) +{ + CAST(); + + string path; + PrintToString( fmt, args, path ); + + return self -> pathType( path ); +} + +static +int CC +KDBTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ) +{ + return KDBTextManagerVPathType( self, path, args ); +} + +static +rc_t CC +KDBTextManagerVOpenDBRead ( const KDBManager *bself, const KDatabase **p_db, const char *fmt, va_list args ) +{ + CAST(); + + string path; + PrintToString( fmt, args, path ); + + // TODO: non-root dbs + const Database * db = self -> getRootDatabase(); + if (db && db -> getName() == path ) + { + *p_db = (const KDatabase *)db; + return 0; + } + return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); +} + LIB_EXPORT rc_t CC -KDBManagerMakeText ( const KDBManager ** p_mgr, const char * data ) +KDBManagerMakeText ( const KDBManager ** p_mgr, const char * input, char * error, size_t error_size ) { if ( p_mgr == nullptr ) { return SILENT_RC ( rcDB, rcMgr, rcCreating, rcSelf, rcNull ); } - *p_mgr = new Manager(); - return 0; + Manager * mgr = new Manager(); + + rc_t rc = mgr -> parse( input, error, error_size ); + if ( rc == 0 ) + { + *p_mgr = mgr; + } + else + { + delete mgr; + } + return rc; } diff --git a/libs/kdbtext/zz_kdbtext-grammar.cpp b/libs/kdbtext/zz_kdbtext-grammar.cpp deleted file mode 100644 index 27bb2120a..000000000 --- a/libs/kdbtext/zz_kdbtext-grammar.cpp +++ /dev/null @@ -1,7228 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.5.1. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, - Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.5.1" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 2 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - -/* Substitute the type names. */ -#define YYSTYPE KDBTEXT_STYPE -#define YYLTYPE KDBTEXT_LTYPE -/* Substitute the variable and function names. */ -#define yyparse KDBText_parse -#define yylex KDBText_lex -#define yyerror KDBText_error -#define yydebug KDBText_debug -#define yynerrs KDBText_nerrs - -/* First part of user prologue. */ - - #define YYDEBUG 1 - - #include - -// #include "ParseTree.hpp" -// #include "ErrorReport.hpp" - - using namespace ncbi::KDBTextParser; - - #include "kdbtext-grammar.hpp" - #include "kdbtext-lex.h" - #define KDBText_lex KDBTextScan_yylex - - void KDBText_error ( YYLTYPE * p_llocp, - ctx_t ctx, - ParseTree ** p_root, - ErrorReport * p_errors, - struct KDBTextScanBlock * p_sb, - const char * p_msg ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); - /* send message to the C++ parser for proper display and recovery */ - Token :: Location loc ( p_sb -> file_name, p_llocp -> first_line, p_llocp -> first_column ); - p_errors -> ReportError ( ctx, loc, "%s", p_msg); - } - - extern "C" - { - extern enum KDBText_tokentype KDBTextScan_yylex ( SCHEMA_STYPE *lvalp, SCHEMA_LTYPE *llocp, KDBTextScanBlock* sb ); - } - - static - ParseTree* - P ( KDBTextToken & p_prod ) - { - assert ( p_prod . subtree ); - return ( ParseTree * ) p_prod . subtree; - } - - static - ParseTree* - T ( ctx_t ctx, KDBTextToken & p_term ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing );//TODO: catch - assert ( p_term . subtree == 0 ); - return ParseTree::Make ( ctx, p_term ); - } - - /* Create production node */ - static - ParseTree * - MakeTree ( ctx_t ctx, - int p_token, - ParseTree * p_ch1 = 0, - ParseTree * p_ch2 = 0, - ParseTree * p_ch3 = 0, - ParseTree * p_ch4 = 0, - ParseTree * p_ch5 = 0, - ParseTree * p_ch6 = 0, - ParseTree * p_ch7 = 0, - ParseTree * p_ch8 = 0, - ParseTree * p_ch9 = 0 - ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); - ParseTree * ret = ParseTree :: Make ( ctx, Token ( p_token ) ); - if ( p_ch1 != 0 ) ret -> AddChild ( ctx, p_ch1 ); - if ( p_ch2 != 0 ) ret -> AddChild ( ctx, p_ch2 ); - if ( p_ch3 != 0 ) ret -> AddChild ( ctx, p_ch3 ); - if ( p_ch4 != 0 ) ret -> AddChild ( ctx, p_ch4 ); - if ( p_ch5 != 0 ) ret -> AddChild ( ctx, p_ch5 ); - if ( p_ch6 != 0 ) ret -> AddChild ( ctx, p_ch6 ); - if ( p_ch7 != 0 ) ret -> AddChild ( ctx, p_ch7 ); - if ( p_ch8 != 0 ) ret -> AddChild ( ctx, p_ch8 ); - if ( p_ch9 != 0 ) ret -> AddChild ( ctx, p_ch9 ); - return ret; - } - - /* Create a flat list */ - static - ParseTree * - MakeList ( ctx_t ctx, KDBTextToken & p_prod ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); - ParseTree * ret = ParseTree :: Make ( ctx, Token ( PT_ASTLIST ) ); - ret -> AddChild ( ctx, P ( p_prod ) ); - return ret; - } - - /* Add to a flat list node */ - static - ParseTree * - AddToList ( ctx_t ctx, ParseTree * p_root, ParseTree * p_br1, ParseTree * p_br2 = 0 ) - { - FUNC_ENTRY( ctx, rcSRA, rcKDBText, rcParsing ); - assert ( p_br1 != 0 ); - p_root -> AddChild ( ctx, p_br1 ); - if ( p_br2 != 0 ) - { - p_root -> AddChild ( ctx, p_br2 ); - } - return p_root; - } - - - -# ifndef YY_CAST -# ifdef __cplusplus -# define YY_CAST(Type, Val) static_cast (Val) -# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) -# else -# define YY_CAST(Type, Val) ((Type) (Val)) -# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) -# endif -# endif -# ifndef YY_NULLPTR -# if defined __cplusplus -# if 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# else -# define YY_NULLPTR ((void*)0) -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 1 -#endif - -/* Use api.header.include to #include this header - instead of duplicating it here. */ -#ifndef YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED -# define YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED -/* Debug traces. */ -#ifndef KDBTEXT_DEBUG -# if defined YYDEBUG -#if YYDEBUG -# define KDBTEXT_DEBUG 1 -# else -# define KDBTEXT_DEBUG 0 -# endif -# else /* ! defined YYDEBUG */ -# define KDBTEXT_DEBUG 0 -# endif /* ! defined YYDEBUG */ -#endif /* ! defined KDBTEXT_DEBUG */ -#if KDBTEXT_DEBUG -extern int KDBText_debug; -#endif - -/* Token type. */ -#ifndef KDBTEXT_TOKENTYPE -# define KDBTEXT_TOKENTYPE - enum KDBText_tokentype - { - END_SOURCE = 0, - UNRECOGNIZED = 258, - ELLIPSIS = 259, - INCREMENT = 260, - DECIMAL = 261, - OCTAL = 262, - HEX = 263, - FLOAT_ = 264, - EXP_FLOAT = 265, - STRING = 266, - ESCAPED_STRING = 267, - IDENTIFIER_1_0 = 268, - PHYSICAL_IDENTIFIER_1_0 = 269, - VERSION = 270, - UNTERM_STRING = 271, - UNTERM_ESCAPED_STRING = 272, - VERS_1_0 = 273, - VERS_2_0 = 274, - KW___no_header = 275, - KW___row_length = 276, - KW___untyped = 277, - KW_alias = 278, - KW_column = 279, - KW_const = 280, - KW_control = 281, - KW_database = 282, - KW_decode = 283, - KW_default = 284, - KW_encode = 285, - KW_extern = 286, - KW_false = 287, - KW_fmtdef = 288, - KW_function = 289, - KW_include = 290, - KW_limit = 291, - KW_physical = 292, - KW_read = 293, - KW_readonly = 294, - KW_return = 295, - KW_kdbtext = 296, - KW_static = 297, - KW_table = 298, - KW_template = 299, - KW_trigger = 300, - KW_true = 301, - KW_type = 302, - KW_typedef = 303, - KW_typeset = 304, - KW_validate = 305, - KW_version = 306, - KW_view = 307, - KW_virtual = 308, - KW_void = 309, - KW_write = 310, - PT_ASTLIST = 311, - PT_PARSE = 312, - PT_SOURCE = 313, - PT_VERSION_1_0 = 314, - PT_VERSION_2 = 315, - PT_SCHEMA_1_0 = 316, - PT_SCHEMA_2_0 = 317, - PT_INCLUDE = 318, - PT_TYPEDEF = 319, - PT_FQN = 320, - PT_IDENT = 321, - PT_PHYSIDENT = 322, - PT_UINT = 323, - PT_TYPESET = 324, - PT_TYPESETDEF = 325, - PT_FORMAT = 326, - PT_CONST = 327, - PT_ALIAS = 328, - PT_EXTERN = 329, - PT_FUNCTION = 330, - PT_UNTYPED = 331, - PT_ROWLENGTH = 332, - PT_FUNCDECL = 333, - PT_EMPTY = 334, - PT_SCHEMASIG = 335, - PT_SCHEMAFORMAL = 336, - PT_RETURNTYPE = 337, - PT_FACTSIG = 338, - PT_FUNCSIG = 339, - PT_FUNCPARAMS = 340, - PT_FORMALPARAM = 341, - PT_ELLIPSIS = 342, - PT_FUNCPROLOGUE = 343, - PT_RETURN = 344, - PT_PRODSTMT = 345, - PT_PRODTRIGGER = 346, - PT_SCHEMA = 347, - PT_VALIDATE = 348, - PT_PHYSICAL = 349, - PT_PHYSPROLOGUE = 350, - PT_PHYSSTMT = 351, - PT_PHYSBODYSTMT = 352, - PT_TABLE = 353, - PT_TABLEPARENTS = 354, - PT_TABLEBODY = 355, - PT_FUNCEXPR = 356, - PT_FACTPARMS = 357, - PT_COLUMN = 358, - PT_COLUMNEXPR = 359, - PT_COLDECL = 360, - PT_TYPEDCOL = 361, - PT_COLSTMT = 362, - PT_DFLTVIEW = 363, - PT_PHYSMBR = 364, - PT_PHYSCOL = 365, - PT_PHYSCOLDEF = 366, - PT_COLSCHEMAPARMS = 367, - PT_COLSCHEMAPARAM = 368, - PT_COLUNTYPED = 369, - PT_DATABASE = 370, - PT_TYPEEXPR = 371, - PT_DBBODY = 372, - PT_DBDAD = 373, - PT_DBMEMBER = 374, - PT_TBLMEMBER = 375, - PT_NOHEADER = 376, - PT_CASTEXPR = 377, - PT_CONSTVECT = 378, - PT_NEGATE = 379, - PT_UNARYPLUS = 380, - PT_VERSNAME = 381, - PT_ARRAY = 382, - PT_PHYSENCREF = 383, - PT_TYPEDCOLEXPR = 384, - PT_VIEW = 385, - PT_VIEWPARAM = 386, - PT_VIEWPARENTS = 387, - PT_VIEWPARENT = 388, - PT_MEMBEREXPR = 389, - PT_JOINEXPR = 390, - PT_ALIASMEMBER = 391, - PT_VIEWSPEC = 392 - }; -#endif - -/* Value type. */ -#if ! defined KDBTEXT_STYPE && ! defined KDBTEXT_STYPE_IS_DECLARED -typedef KDBTextToken KDBTEXT_STYPE; -# define KDBTEXT_STYPE_IS_TRIVIAL 1 -# define KDBTEXT_STYPE_IS_DECLARED 1 -#endif - -/* Location type. */ -#if ! defined KDBTEXT_LTYPE && ! defined KDBTEXT_LTYPE_IS_DECLARED -typedef struct KDBTEXT_LTYPE KDBTEXT_LTYPE; -struct KDBTEXT_LTYPE -{ - int first_line; - int first_column; - int last_line; - int last_column; -}; -# define KDBTEXT_LTYPE_IS_DECLARED 1 -# define KDBTEXT_LTYPE_IS_TRIVIAL 1 -#endif - - - -int KDBText_parse (ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb); - -#endif /* !YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED */ - - - -#ifdef short -# undef short -#endif - -/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure - and (if available) are included - so that the code can choose integer types of a good width. */ - -#ifndef __PTRDIFF_MAX__ -# include /* INFRINGES ON USER NAME SPACE */ -# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_STDINT_H -# endif -#endif - -/* Narrow types that promote to a signed type and that can represent a - signed or unsigned integer of at least N bits. In tables they can - save space and decrease cache pressure. Promoting to a signed type - helps avoid bugs in integer arithmetic. */ - -#ifdef __INT_LEAST8_MAX__ -typedef __INT_LEAST8_TYPE__ yytype_int8; -#elif defined YY_STDINT_H -typedef int_least8_t yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef __INT_LEAST16_MAX__ -typedef __INT_LEAST16_TYPE__ yytype_int16; -#elif defined YY_STDINT_H -typedef int_least16_t yytype_int16; -#else -typedef short yytype_int16; -#endif - -#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST8_TYPE__ yytype_uint8; -#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST8_MAX <= INT_MAX) -typedef uint_least8_t yytype_uint8; -#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX -typedef unsigned char yytype_uint8; -#else -typedef short yytype_uint8; -#endif - -#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST16_TYPE__ yytype_uint16; -#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST16_MAX <= INT_MAX) -typedef uint_least16_t yytype_uint16; -#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX -typedef unsigned short yytype_uint16; -#else -typedef int yytype_uint16; -#endif - -#ifndef YYPTRDIFF_T -# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ -# define YYPTRDIFF_T __PTRDIFF_TYPE__ -# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ -# elif defined PTRDIFF_MAX -# ifndef ptrdiff_t -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYPTRDIFF_T ptrdiff_t -# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX -# else -# define YYPTRDIFF_T long -# define YYPTRDIFF_MAXIMUM LONG_MAX -# endif -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned -# endif -#endif - -#define YYSIZE_MAXIMUM \ - YY_CAST (YYPTRDIFF_T, \ - (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ - ? YYPTRDIFF_MAXIMUM \ - : YY_CAST (YYSIZE_T, -1))) - -#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) - -/* Stored state numbers (used for stacks). */ -typedef yytype_int16 yy_state_t; - -/* State numbers in computations. */ -typedef int yy_state_fast_t; - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) -# else -# define YY_ATTRIBUTE_PURE -# endif -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -# else -# define YY_ATTRIBUTE_UNUSED -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - -#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ -# define YY_IGNORE_USELESS_CAST_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") -# define YY_IGNORE_USELESS_CAST_END \ - _Pragma ("GCC diagnostic pop") -#endif -#ifndef YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_END -#endif - - -#define YY_ASSERT(E) ((void) (0 && (E))) - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined KDBTEXT_LTYPE_IS_TRIVIAL && KDBTEXT_LTYPE_IS_TRIVIAL \ - && defined KDBTEXT_STYPE_IS_TRIVIAL && KDBTEXT_STYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yy_state_t yyss_alloc; - YYSTYPE yyvs_alloc; - YYLTYPE yyls_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \ - + YYSIZEOF (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYPTRDIFF_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / YYSIZEOF (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYPTRDIFF_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 68 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 837 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 157 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 129 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 280 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 540 - -#define YYUNDEFTOK 2 -#define YYMAXUTOK 392 - - -/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, with out-of-bounds checking. */ -#define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 146, 147, 144, 153, 139, 152, 155, 154, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 156, 138, - 148, 145, 149, 2, 151, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 142, 2, 143, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 140, 150, 141, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137 -}; - -#if KDBTEXT_DEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_int16 yyrline[] = -{ - 0, 316, 316, 317, 321, 322, 323, 329, 333, 334, - 338, 339, 343, 344, 345, 346, 347, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 362, 370, 371, 377, - 382, 386, 393, 394, 398, 399, 403, 404, 410, 412, - 417, 421, 428, 435, 440, 446, 450, 451, 452, 462, - 467, 472, 473, 477, 481, 482, 486, 487, 491, 492, - 496, 497, 501, 505, 506, 508, 510, 512, 517, 518, - 522, 526, 530, 531, 533, 535, 537, 542, 543, 547, - 548, 553, 554, 558, 560, 562, 567, 568, 572, 573, - 580, 585, 592, 594, 602, 609, 619, 620, 624, 626, - 631, 632, 636, 638, 640, 642, 647, 654, 662, 663, - 667, 668, 672, 674, 679, 680, 684, 685, 686, 688, - 690, 691, 692, 693, 694, 696, 700, 702, 707, 708, - 712, 713, 717, 718, 719, 723, 725, 730, 732, 734, - 739, 741, 743, 748, 749, 753, 757, 758, 762, 763, - 767, 768, 769, 770, 774, 779, 781, 783, 785, 790, - 795, 796, 800, 801, 805, 806, 810, 811, 818, 819, - 823, 824, 828, 829, 830, 831, 832, 833, 834, 835, - 836, 837, 838, 839, 840, 844, 851, 860, 861, 865, - 866, 867, 871, 872, 876, 880, 881, 885, 886, 890, - 891, 895, 896, 897, 901, 902, 906, 907, 911, 915, - 916, 920, 921, 925, 926, 930, 931, 935, 936, 940, - 942, 949, 957, 958, 962, 963, 967, 968, 972, 973, - 974, 975, 979, 980, 984, 989, 994, 999, 1004, 1005, - 1012, 1020, 1021, 1023, 1024, 1025, 1026, 1027, 1028, 1029, - 1030, 1034, 1038, 1042, 1046, 1047, 1053, 1057, 1058, 1062, - 1063, 1067, 1068, 1072, 1077, 1078, 1082, 1086, 1087, 1091, - 1092, 1096, 1098, 1100, 1104, 1105, 1109, 1110, 1114, 1119, - 1120 -}; -#endif - -#if KDBTEXT_DEBUG || YYERROR_VERBOSE || 1 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "\"end of source\"", "error", "$undefined", "UNRECOGNIZED", "ELLIPSIS", - "INCREMENT", "DECIMAL", "OCTAL", "HEX", "FLOAT_", "EXP_FLOAT", "STRING", - "ESCAPED_STRING", "IDENTIFIER_1_0", "PHYSICAL_IDENTIFIER_1_0", "VERSION", - "UNTERM_STRING", "UNTERM_ESCAPED_STRING", "VERS_1_0", "VERS_2_0", - "KW___no_header", "KW___row_length", "KW___untyped", "KW_alias", - "KW_column", "KW_const", "KW_control", "KW_database", "KW_decode", - "KW_default", "KW_encode", "KW_extern", "KW_false", "KW_fmtdef", - "KW_function", "KW_include", "KW_limit", "KW_physical", "KW_read", - "KW_readonly", "KW_return", "KW_kdbtext", "KW_static", "KW_table", - "KW_template", "KW_trigger", "KW_true", "KW_type", "KW_typedef", - "KW_typeset", "KW_validate", "KW_version", "KW_view", "KW_virtual", - "KW_void", "KW_write", "PT_ASTLIST", "PT_PARSE", "PT_SOURCE", - "PT_VERSION_1_0", "PT_VERSION_2", "PT_SCHEMA_1_0", "PT_SCHEMA_2_0", - "PT_INCLUDE", "PT_TYPEDEF", "PT_FQN", "PT_IDENT", "PT_PHYSIDENT", - "PT_UINT", "PT_TYPESET", "PT_TYPESETDEF", "PT_FORMAT", "PT_CONST", - "PT_ALIAS", "PT_EXTERN", "PT_FUNCTION", "PT_UNTYPED", "PT_ROWLENGTH", - "PT_FUNCDECL", "PT_EMPTY", "PT_SCHEMASIG", "PT_SCHEMAFORMAL", - "PT_RETURNTYPE", "PT_FACTSIG", "PT_FUNCSIG", "PT_FUNCPARAMS", - "PT_FORMALPARAM", "PT_ELLIPSIS", "PT_FUNCPROLOGUE", "PT_RETURN", - "PT_PRODSTMT", "PT_PRODTRIGGER", "PT_SCHEMA", "PT_VALIDATE", - "PT_PHYSICAL", "PT_PHYSPROLOGUE", "PT_PHYSSTMT", "PT_PHYSBODYSTMT", - "PT_TABLE", "PT_TABLEPARENTS", "PT_TABLEBODY", "PT_FUNCEXPR", - "PT_FACTPARMS", "PT_COLUMN", "PT_COLUMNEXPR", "PT_COLDECL", - "PT_TYPEDCOL", "PT_COLSTMT", "PT_DFLTVIEW", "PT_PHYSMBR", "PT_PHYSCOL", - "PT_PHYSCOLDEF", "PT_COLSCHEMAPARMS", "PT_COLSCHEMAPARAM", - "PT_COLUNTYPED", "PT_DATABASE", "PT_TYPEEXPR", "PT_DBBODY", "PT_DBDAD", - "PT_DBMEMBER", "PT_TBLMEMBER", "PT_NOHEADER", "PT_CASTEXPR", - "PT_CONSTVECT", "PT_NEGATE", "PT_UNARYPLUS", "PT_VERSNAME", "PT_ARRAY", - "PT_PHYSENCREF", "PT_TYPEDCOLEXPR", "PT_VIEW", "PT_VIEWPARAM", - "PT_VIEWPARENTS", "PT_VIEWPARENT", "PT_MEMBEREXPR", "PT_JOINEXPR", - "PT_ALIASMEMBER", "PT_VIEWSPEC", "';'", "','", "'{'", "'}'", "'['", - "']'", "'*'", "'='", "'('", "')'", "'<'", "'>'", "'|'", "'@'", "'-'", - "'+'", "'/'", "'.'", "':'", "$accept", "parse", "source", "version_1_0", - "kdbtext_1_0_opt", "kdbtext_1_0", "kdbtext_1_0_decl", "typedef_1_0_decl", - "typedef_1_0_new_name_list", "typeset_1_0_decl", "typeset_1_0_new_name", - "typeset_1_0_def", "typespec_1_0_list", "typespec_1_0", "dim_1_0", - "format_1_0_decl", "format_1_0_new_name", "format_1_0_name", - "const_1_0_decl", "alias_1_0_decl", "alias_1_0_new_name", - "function_1_0_decl", "func_1_0_decl", "untyped_func_1_0_decl", - "row_length_func_1_0_decl", "opt_func_1_0_kdbtext_sig", - "func_1_0_kdbtext_sig", "func_1_0_kdbtext_formals", - "func_1_0_kdbtext_formal", "func_1_0_return_type", - "opt_func_1_0_fact_sig", "func_1_0_fact_sig", "func_1_0_fact_signature", - "func_1_0_fact_params", "fact_param_1_0", "func_1_0_param_sig", - "func_1_0_param_signature", "func_1_0_formal_params", "formal_param_1_0", - "func_1_0_vararg_formals", "func_1_0_prologue", "script_1_0_stmt_seq", - "script_1_0_stmt", "extern_1_0_decl", "ext_func_1_0_decl", - "script_1_0_decl", "validate_1_0_decl", "physical_1_0_decl", - "phys_1_0_return_type", "phys_1_0_prologue", "phys_1_0_body", - "phys_1_0_body_stmt", "phys_1_0_stmt", "table_1_0_decl", - "opt_tbl_1_0_parents", "tbl_1_0_parents", "tbl_1_0_body", - "tbl_1_0_stmt_seq", "tbl_1_0_stmt", "production_1_0_stmt", - "col_1_0_modifiers", "col_1_0_modifier_seq", "col_1_0_modifier", - "col_1_0_decl", "phys_enc_ref", "typed_column_decl_1_0", "col_ident", - "phys_ident", "opt_column_body_1_0", "column_body_1_0", - "column_stmt_1_0", "default_view_1_0_decl", "physmbr_1_0_decl", - "phys_coldef_1_0", "opt_col_kdbtext_parms_1_0", "col_kdbtext_parms_1_0", - "col_kdbtext_parm_1_0", "col_kdbtext_value_1_0", "cond_expr_1_0", - "expression_1_0", "primary_expr_1_0", "func_expr_1_0", - "kdbtext_parms_1_0", "kdbtext_parm_1_0", "opt_factory_parms_1_0", - "factory_parms_1_0", "factory_parms", "opt_func_1_0_parms", - "func_1_0_parms", "uint_expr_1_0", "float_expr_1_0", "string_expr_1_0", - "const_vect_expr_1_0", "opt_const_vect_exprlist_1_0", - "const_vect_exprlist_1_0", "bool_expr_1_0", "type_expr_1_0", - "member_expr_2_0", "join_expr_2_0", "database_1_0_decl", - "opt_database_dad_1_0", "database_body_1_0", "database_members_1_0", - "database_member_1_0", "opt_template_1_0", "db_member_1_0", - "table_member_1_0", "alias_member_1_0", "view_spec", "view_parms", - "include_directive", "fqn_1_0", "ident_1_0", "empty", "fqn_vers", - "fqn_opt_vers", "version_2_0", "kdbtext_2_0_opt", "kdbtext_2_0", - "kdbtext_2_0_decl", "view_2_0_decl", "view_parm", "opt_view_body", - "view_body", "view_member", "opt_view_parents", "view_parents", - "view_parent", "view_parent_parms", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_int16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 59, 44, - 123, 125, 91, 93, 42, 61, 40, 41, 60, 62, - 124, 64, 45, 43, 47, 46, 58 -}; -# endif - -#define YYPACT_NINF (-369) - -#define yypact_value_is_default(Yyn) \ - ((Yyn) == YYPACT_NINF) - -#define YYTABLE_NINF (-255) - -#define yytable_value_is_error(Yyn) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - 521, -369, 8, 8, 8, 98, 8, 59, 168, 57, - 52, 8, 8, 8, 98, 392, -369, 244, 248, 699, - 699, -369, -369, -369, -369, -369, -369, -369, -369, -369, - -369, -369, -369, -369, -369, 635, -369, -8, -369, 8, - -49, -9, 118, -369, -369, 114, 8, -6, 8, 8, - 12, -369, -369, -369, 76, -369, -369, -369, 200, 59, - -369, 120, -8, 149, 125, -369, 173, 220, -369, -369, - -369, 699, -369, -369, 8, -369, -369, -369, 635, -369, - -369, 597, 232, 125, -14, 107, -369, 8, 187, -369, - -369, 278, 125, 42, 89, 8, -369, 189, -369, 8, - 80, -369, 8, -369, 76, -369, 8, -369, 8, 195, - -369, -40, -369, 8, 281, -369, -369, 193, -369, -369, - -369, -369, -369, -369, -369, -369, -369, -369, -369, 486, - -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, - 486, -369, 8, 386, -369, 486, 486, 212, -369, -369, - -369, -369, -369, -369, -369, -369, -369, -369, -369, 34, - 2, -369, 277, -9, -369, 61, -369, -369, 280, 299, - -369, 12, -369, -369, 8, 282, -369, 282, 313, -369, - 279, -369, -369, 8, -98, -369, -369, 8, 318, -369, - 323, 328, -369, 321, 203, -369, -369, -33, -369, -369, - -369, -369, 486, 8, 486, 325, -369, -369, 8, -369, - -369, -369, 78, -369, 36, -369, -369, -369, -369, -369, - -369, -369, 125, 29, 326, -369, -369, -12, 8, 324, - 378, 421, -369, 27, -369, 38, 8, -369, -369, 8, - 578, -369, -369, 19, 291, -369, -369, -369, 8, -369, - 217, 218, 8, -369, -369, -369, 486, 486, 386, 8, - 107, 272, -369, -369, -369, 222, 486, 8, 329, -369, - -369, 8, 8, 8, 461, 327, 141, -369, -369, 45, - 295, 66, 338, -369, -369, 8, 443, 335, 470, 334, - 386, -369, 474, 8, -369, 27, -369, 345, 357, -369, - -369, 386, 430, -369, 430, 18, 277, -369, -369, -369, - -369, 8, 359, -369, -369, -369, -369, 277, 363, -1, - 486, 486, -369, -369, 360, 369, -369, 371, 8, 8, - 8, 372, -369, -369, 53, 8, -369, -369, 8, 182, - 499, 366, 257, -369, -369, -369, 84, 8, -369, 370, - 338, 338, -369, -4, -369, 84, -369, 216, 375, 486, - 376, 502, 230, -369, -369, -369, 86, 300, 277, -369, - 486, 486, 234, -369, 296, -369, -369, -369, -369, -369, - 237, -369, 8, -369, 377, 380, -369, -369, 8, -369, - -369, -369, 486, -369, 242, 385, 389, 122, -369, -369, - 8, -369, 372, 511, 390, -369, -369, 14, 182, -369, - 486, 21, -369, 8, 87, 8, -369, -369, -369, -369, - 51, 381, 486, 393, -369, 317, 386, -369, 386, -369, - 486, -369, 112, 128, 8, -369, 0, 486, 382, 394, - -369, 7, 486, -369, -369, -369, -369, -369, 372, -369, - -369, 211, -369, 182, -369, 390, 134, -369, -369, 397, - -369, 241, -369, 396, 399, -369, -369, 486, -369, -369, - 125, 136, -369, -369, 277, 400, 402, 406, -369, 412, - 0, -369, -369, 156, 8, 8, 8, -369, 8, -369, - 416, 7, -369, 391, -369, 390, -369, -369, 486, 413, - -369, -369, 162, -369, -369, 457, 486, 486, -369, -369, - -369, -369, 251, -369, 8, 414, -369, -369, -369, -369, - 175, -369, -369, 423, 196, 209, 8, -369, 418, 486, - -369, -369, -369, -369, -369, 486, 210, 213, -369, -369 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_int16 yydefact[] = -{ - 0, 2, 0, 0, 0, 0, 0, 252, 0, 252, - 252, 0, 0, 0, 0, 0, 25, 0, 0, 252, - 4, 10, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 252, 251, 0, 241, 0, - 34, 0, 252, 91, 90, 0, 0, 40, 0, 0, - 0, 45, 46, 47, 0, 52, 51, 240, 0, 252, - 92, 252, 0, 0, 30, 94, 0, 0, 1, 3, - 5, 8, 9, 11, 0, 261, 258, 6, 257, 259, - 262, 0, 0, 44, 0, 0, 253, 0, 0, 222, - 38, 0, 40, 0, 0, 0, 215, 0, 54, 0, - 34, 58, 0, 59, 0, 96, 0, 93, 0, 0, - 108, 0, 27, 0, 0, 7, 256, 0, 260, 243, - 244, 245, 246, 247, 248, 249, 250, 242, 43, 0, - 201, 203, 202, 204, 205, 206, 207, 145, 214, 213, - 252, 37, 0, 0, 174, 0, 0, 0, 173, 36, - 170, 175, 176, 177, 178, 179, 180, 183, 184, 172, - 241, 255, 252, 254, 223, 252, 221, 39, 0, 0, - 56, 0, 53, 57, 0, 252, 97, 252, 109, 110, - 0, 107, 26, 0, 0, 32, 29, 0, 0, 211, - 0, 210, 209, 0, 0, 187, 191, 189, 181, 182, - 35, 218, 0, 0, 0, 0, 193, 192, 0, 233, - 231, 224, 252, 226, 0, 228, 229, 230, 232, 50, - 49, 55, 216, 252, 0, 61, 60, 0, 0, 0, - 128, 132, 133, 252, 134, 252, 0, 125, 113, 0, - 0, 114, 116, 0, 0, 130, 123, 28, 0, 31, - 0, 241, 0, 264, 42, 208, 0, 0, 0, 0, - 0, 0, 168, 217, 195, 0, 252, 0, 0, 225, - 227, 0, 0, 0, 0, 0, 252, 68, 63, 252, - 0, 0, 0, 95, 111, 0, 0, 0, 0, 252, - 0, 121, 0, 0, 160, 252, 120, 0, 0, 112, - 115, 0, 0, 117, 0, 34, 252, 129, 132, 131, - 33, 0, 252, 266, 212, 171, 188, 252, 0, 0, - 0, 0, 194, 199, 0, 198, 197, 0, 0, 0, - 0, 252, 70, 62, 0, 0, 64, 81, 0, 0, - 0, 0, 252, 77, 72, 83, 0, 0, 48, 0, - 0, 0, 102, 0, 100, 0, 98, 0, 0, 0, - 0, 0, 0, 162, 165, 167, 166, 0, 252, 122, - 0, 0, 0, 135, 0, 144, 143, 136, 139, 138, - 241, 265, 0, 274, 0, 0, 190, 220, 0, 169, - 196, 186, 0, 236, 0, 0, 0, 0, 65, 82, - 0, 69, 252, 0, 252, 79, 71, 0, 0, 73, - 0, 0, 86, 0, 0, 0, 103, 104, 99, 101, - 0, 0, 0, 0, 154, 0, 0, 161, 0, 155, - 0, 159, 0, 0, 0, 142, 252, 0, 0, 275, - 276, 252, 252, 219, 200, 237, 234, 235, 252, 66, - 80, 0, 74, 0, 78, 252, 0, 85, 87, 0, - 84, 0, 106, 0, 0, 118, 157, 0, 163, 164, - 166, 0, 127, 126, 252, 0, 0, 0, 153, 0, - 147, 148, 146, 0, 0, 0, 0, 273, 0, 267, - 0, 268, 269, 0, 67, 252, 75, 88, 0, 0, - 124, 119, 0, 156, 137, 0, 0, 0, 140, 149, - 141, 279, 0, 277, 0, 0, 263, 270, 185, 76, - 0, 105, 158, 0, 0, 0, 0, 278, 0, 0, - 89, 152, 150, 151, 280, 0, 0, 0, 271, 272 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -369, -369, -369, -369, -369, 546, 197, -369, -369, -369, - -369, -369, -369, 50, 306, -369, 522, -369, -369, -369, - -369, 262, 44, -369, -369, 558, -369, -369, 403, -35, - 398, -369, -369, -206, -289, -369, -369, -262, -368, -312, - -369, 221, -106, -369, -369, -369, -369, -369, -369, -369, - -369, 224, 110, -369, -369, -369, -369, -369, 333, -369, - -369, -369, 336, -369, -369, 275, -369, -93, -369, -369, - 101, -369, -213, 293, -369, -369, 163, 158, -342, 83, - -369, -369, 287, 332, -303, 288, -369, 150, -369, -131, - -369, -369, -369, -369, -369, -369, 160, -369, -369, -369, - -369, -369, -369, 383, -369, -369, -369, -369, -369, 268, - -369, -2, 283, 142, 4, -32, -369, -369, -369, 519, - -369, 290, -369, -369, 108, -369, -369, 113, -369 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 17, 18, 19, 70, 20, 21, 22, 111, 23, - 63, 114, 184, 96, 147, 24, 45, 46, 25, 26, - 82, 27, 51, 52, 53, 54, 55, 97, 98, 102, - 224, 225, 275, 276, 277, 280, 341, 342, 343, 336, - 348, 411, 412, 28, 44, 29, 30, 31, 106, 283, - 353, 354, 356, 32, 109, 178, 181, 240, 241, 242, - 243, 244, 245, 303, 304, 373, 374, 148, 479, 480, - 481, 246, 291, 292, 293, 362, 363, 364, 261, 262, - 150, 151, 194, 195, 205, 206, 265, 324, 325, 152, - 153, 154, 155, 190, 191, 156, 413, 157, 158, 33, - 88, 166, 212, 213, 214, 215, 216, 217, 267, 250, - 34, 159, 38, 337, 161, 162, 35, 77, 78, 79, - 80, 253, 490, 491, 492, 384, 439, 440, 512 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int16 yytable[] = -{ - 37, 40, 41, 379, 47, 36, 86, -41, 42, 41, - 62, 64, 196, 387, 385, 61, 201, 349, 399, 398, - 36, 36, 296, 105, 350, 36, 351, 36, 432, 433, - 409, 486, 36, 86, 36, 83, 475, 84, 476, 454, - 338, 248, 36, 249, 92, 401, 93, 94, 100, 86, - 477, 289, 100, 39, 60, 164, 100, 399, 36, 95, - 40, 410, 289, 271, 36, 431, 36, 331, 456, 176, - 175, 338, 41, 48, 49, 295, 179, 404, 117, 272, - 48, 49, 369, 454, 208, 163, 59, 349, 471, 36, - 449, 410, 452, 85, 350, 483, 351, 36, 182, 183, - 163, 208, 100, 107, 41, 209, 163, 81, 401, 260, - 177, 40, 112, 130, 131, 132, 133, 134, 135, 136, - 36, 137, 209, 81, 410, 502, 399, 196, 281, 402, - 101, 129, 7, 282, 352, 36, 494, 418, 478, 138, - 100, 197, 81, 496, 202, 487, 455, 81, 81, 56, - 81, 56, 56, 139, 388, 252, 520, 203, 453, 365, - 85, 72, 457, 185, 524, 525, 204, 301, 149, 100, - 196, 504, 222, 273, 81, 290, 268, 76, 40, 57, - -254, 40, -254, 519, 89, 163, 290, 536, 168, 339, - 81, 495, 462, 537, 448, 36, 284, 400, 81, 210, - 50, 56, 211, 110, 352, 50, 163, 50, 338, 375, - 99, 375, 188, 36, 103, 399, 210, 73, 103, 269, - 104, 40, 85, 189, 36, 460, 163, 317, 198, 199, - 239, 428, 75, 247, 174, 169, 81, 338, 40, 329, - 330, 305, 81, 81, 68, 81, 40, 306, 69, 140, - 472, 141, 90, 142, 101, 143, 197, 163, 144, 145, - 146, 368, 320, 87, 103, 108, 473, 43, 73, 163, - 163, 40, 497, 274, 503, 75, 65, 40, 320, 252, - 334, 81, 192, 357, 320, 335, 320, 264, 366, 113, - 239, 163, 36, 302, 510, 365, 252, 365, 310, 197, - 522, 229, 193, 230, 207, 458, 320, 218, 231, 163, - 232, 115, 320, 530, 458, 307, 233, 226, 234, 226, - 308, 235, 232, 274, 236, 320, 163, 165, 171, 340, - 234, 99, 40, 40, 532, 180, 40, 40, 172, 314, - 315, 187, 258, 149, 100, 414, 320, 533, 538, 323, - 438, 539, 259, 100, 218, 200, 311, -238, 116, 320, - 320, 321, 421, 320, 127, 278, 312, -238, 160, 426, - 128, 322, 81, 258, 523, 294, -239, 294, 170, 427, - 163, 311, 173, 434, 274, 274, -239, 499, 403, 340, - 526, 445, 130, 131, 132, 40, 407, 81, 40, 36, - 527, 408, 474, 389, 390, 40, 40, 286, 326, 100, - 66, 67, 160, 461, 287, 319, 167, 237, 100, 186, - 238, 344, 320, 160, 366, 204, 470, 219, 160, 160, - 223, 294, 163, 345, 435, 346, 436, 294, 429, 40, - 347, 437, 423, 36, 137, 430, 220, 274, 207, 40, - 274, 40, 228, 438, 383, 466, 254, 340, 340, 207, - 416, 417, 467, 130, 131, 132, 255, 256, 257, 285, - 251, 266, 279, 288, 332, 444, 333, 328, 355, 358, - 359, 360, 290, 163, 40, 160, 263, 160, 367, 40, - 370, 488, 130, 131, 132, 133, 134, 135, 136, 36, - 137, 340, 371, 340, 382, 464, 386, 391, 392, 393, - 207, 397, 405, 406, 424, 415, 425, 441, 138, 297, - 422, 1, 298, 446, 450, 323, 442, 447, 463, 451, - 484, 465, 139, 485, 500, 313, 514, 501, 518, 160, - 160, 488, 498, 160, 2, 505, 3, 506, 4, 160, - 327, 507, 5, 508, 6, 7, 8, 516, 9, 529, - 521, 531, 10, 535, 11, 71, 318, 58, 91, 12, - 13, 14, 15, 300, 221, 227, 420, 419, 482, 377, - 309, 509, 361, 489, 326, 376, 469, 376, 372, 468, - 316, 36, 493, 378, 380, 270, 394, 118, 513, 517, - 229, 381, 230, 160, 160, 0, 0, 231, 0, 232, - 36, 251, 395, 396, 0, 233, 207, 234, 0, 0, - 235, 0, 0, 236, 119, 120, 0, 121, 140, 0, - 0, 0, 142, 0, 143, 122, 0, 144, 145, 146, - 123, 0, 160, 0, 124, 0, 0, 0, 0, 125, - 0, 0, 126, 160, 160, 0, 0, 0, 2, 16, - 3, 0, 4, 0, 0, 0, 5, 0, 6, 7, - 8, 443, 9, 0, 0, 160, 10, 0, 11, 0, - 0, 0, 0, 12, 13, 14, 0, 74, 0, 0, - 0, 0, 0, 160, 0, 0, 459, 0, 0, 0, - 0, 0, 0, 0, 0, 160, 0, 0, 0, 0, - 0, 0, 0, 160, 0, 0, 237, 0, 0, 299, - 160, 0, 2, 0, 3, 160, 4, 0, 0, 0, - 5, 0, 6, 7, 8, 0, 9, 0, 0, 0, - 10, 0, 11, 0, 0, 0, 0, 12, 13, 14, - 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 511, 0, 0, - 0, 515, 0, 16, 0, 0, 0, 0, 0, 0, - 0, 160, 0, 0, 0, 0, 0, 0, 0, 160, - 160, 0, 0, 0, 0, 0, 0, 528, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 534, - 0, 0, 160, 0, 0, 0, 0, 0, 160, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 16 -}; - -static const yytype_int16 yycheck[] = -{ - 2, 3, 4, 306, 6, 13, 15, 13, 4, 11, - 12, 13, 143, 14, 317, 11, 14, 21, 4, 331, - 13, 13, 235, 58, 28, 13, 30, 13, 370, 371, - 342, 24, 13, 15, 13, 37, 36, 39, 38, 407, - 26, 139, 13, 141, 46, 334, 48, 49, 50, 15, - 50, 24, 54, 3, 10, 87, 58, 4, 13, 47, - 62, 40, 24, 27, 13, 368, 13, 273, 410, 104, - 102, 26, 74, 21, 22, 37, 108, 339, 74, 43, - 21, 22, 295, 451, 23, 87, 34, 21, 430, 13, - 402, 40, 404, 142, 28, 437, 30, 13, 138, 139, - 102, 23, 104, 59, 106, 44, 108, 156, 397, 142, - 106, 113, 62, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 44, 156, 40, 467, 4, 258, 140, 335, - 54, 145, 34, 145, 138, 13, 448, 141, 138, 32, - 142, 143, 156, 455, 142, 138, 408, 156, 156, 7, - 156, 9, 10, 46, 155, 187, 498, 155, 144, 290, - 142, 19, 141, 113, 506, 507, 148, 148, 85, 171, - 301, 474, 174, 144, 156, 148, 208, 35, 180, 11, - 146, 183, 148, 495, 42, 187, 148, 529, 146, 144, - 156, 453, 141, 535, 400, 13, 228, 144, 156, 138, - 148, 59, 141, 61, 138, 148, 208, 148, 26, 302, - 50, 304, 129, 13, 54, 4, 138, 20, 58, 141, - 20, 223, 142, 140, 13, 138, 228, 259, 145, 146, - 180, 145, 35, 183, 154, 146, 156, 26, 240, 271, - 272, 243, 156, 156, 0, 156, 248, 243, 0, 142, - 138, 144, 138, 146, 54, 148, 258, 259, 151, 152, - 153, 293, 150, 145, 104, 145, 138, 5, 71, 271, - 272, 273, 138, 223, 138, 78, 14, 279, 150, 311, - 139, 156, 140, 285, 150, 144, 150, 204, 290, 140, - 240, 293, 13, 243, 138, 426, 328, 428, 248, 301, - 138, 22, 142, 24, 162, 411, 150, 165, 29, 311, - 31, 138, 150, 138, 420, 24, 37, 175, 39, 177, - 29, 42, 31, 273, 45, 150, 328, 140, 139, 279, - 39, 171, 334, 335, 138, 140, 338, 339, 149, 256, - 257, 148, 139, 260, 346, 347, 150, 138, 138, 266, - 382, 138, 149, 355, 212, 143, 139, 139, 138, 150, - 150, 139, 146, 150, 81, 223, 149, 149, 85, 139, - 138, 149, 156, 139, 505, 233, 139, 235, 95, 149, - 382, 139, 99, 149, 334, 335, 149, 146, 338, 339, - 139, 149, 6, 7, 8, 397, 139, 156, 400, 13, - 149, 144, 434, 320, 321, 407, 408, 29, 266, 411, - 18, 19, 129, 415, 36, 143, 138, 138, 420, 138, - 141, 279, 150, 140, 426, 148, 428, 147, 145, 146, - 148, 289, 434, 138, 138, 140, 140, 295, 138, 441, - 145, 145, 359, 13, 14, 145, 147, 397, 306, 451, - 400, 453, 139, 485, 312, 138, 138, 407, 408, 317, - 350, 351, 145, 6, 7, 8, 143, 139, 147, 145, - 187, 146, 146, 52, 13, 392, 149, 148, 140, 36, - 145, 11, 148, 485, 486, 202, 203, 204, 14, 491, - 145, 441, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 451, 145, 453, 145, 422, 143, 147, 139, 138, - 368, 139, 13, 147, 138, 145, 14, 140, 32, 236, - 145, 0, 239, 138, 13, 442, 146, 138, 147, 139, - 148, 138, 46, 139, 138, 252, 486, 138, 147, 256, - 257, 491, 145, 260, 23, 145, 25, 145, 27, 266, - 267, 145, 31, 141, 33, 34, 35, 141, 37, 145, - 147, 138, 41, 145, 43, 19, 260, 9, 46, 48, - 49, 50, 51, 240, 171, 177, 355, 353, 436, 304, - 244, 480, 289, 441, 442, 302, 428, 304, 301, 426, - 258, 13, 442, 305, 311, 212, 328, 78, 485, 491, - 22, 311, 24, 320, 321, -1, -1, 29, -1, 31, - 13, 328, 329, 330, -1, 37, 474, 39, -1, -1, - 42, -1, -1, 45, 27, 28, -1, 30, 142, -1, - -1, -1, 146, -1, 148, 38, -1, 151, 152, 153, - 43, -1, 359, -1, 47, -1, -1, -1, -1, 52, - -1, -1, 55, 370, 371, -1, -1, -1, 23, 138, - 25, -1, 27, -1, -1, -1, 31, -1, 33, 34, - 35, 388, 37, -1, -1, 392, 41, -1, 43, -1, - -1, -1, -1, 48, 49, 50, -1, 52, -1, -1, - -1, -1, -1, 410, -1, -1, 413, -1, -1, -1, - -1, -1, -1, -1, -1, 422, -1, -1, -1, -1, - -1, -1, -1, 430, -1, -1, 138, -1, -1, 141, - 437, -1, 23, -1, 25, 442, 27, -1, -1, -1, - 31, -1, 33, 34, 35, -1, 37, -1, -1, -1, - 41, -1, 43, -1, -1, -1, -1, 48, 49, 50, - 467, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 484, -1, -1, - -1, 488, -1, 138, -1, -1, -1, -1, -1, -1, - -1, 498, -1, -1, -1, -1, -1, -1, -1, 506, - 507, -1, -1, -1, -1, -1, -1, 514, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 526, - -1, -1, 529, -1, -1, -1, -1, -1, 535, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 138 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_int16 yystos[] = -{ - 0, 0, 23, 25, 27, 31, 33, 34, 35, 37, - 41, 43, 48, 49, 50, 51, 138, 158, 159, 160, - 162, 163, 164, 166, 172, 175, 176, 178, 200, 202, - 203, 204, 210, 256, 267, 273, 13, 268, 269, 170, - 268, 268, 271, 178, 201, 173, 174, 268, 21, 22, - 148, 179, 180, 181, 182, 183, 270, 11, 182, 34, - 179, 271, 268, 167, 268, 178, 18, 19, 0, 0, - 161, 162, 270, 163, 52, 163, 270, 274, 275, 276, - 277, 156, 177, 268, 268, 142, 15, 145, 257, 270, - 138, 173, 268, 268, 268, 47, 170, 184, 185, 253, - 268, 54, 186, 253, 20, 186, 205, 179, 145, 211, - 270, 165, 170, 140, 168, 138, 138, 271, 276, 27, - 28, 30, 38, 43, 47, 52, 55, 269, 138, 145, - 6, 7, 8, 9, 10, 11, 12, 14, 32, 46, - 142, 144, 146, 148, 151, 152, 153, 171, 224, 236, - 237, 238, 246, 247, 248, 249, 252, 254, 255, 268, - 269, 271, 272, 268, 272, 140, 258, 138, 146, 146, - 269, 139, 149, 269, 154, 272, 186, 271, 212, 272, - 140, 213, 138, 139, 169, 170, 138, 148, 236, 236, - 250, 251, 270, 253, 239, 240, 246, 268, 236, 236, - 143, 14, 142, 155, 148, 241, 242, 270, 23, 44, - 138, 141, 259, 260, 261, 262, 263, 264, 270, 147, - 147, 185, 268, 148, 187, 188, 270, 187, 139, 22, - 24, 29, 31, 37, 39, 42, 45, 138, 141, 170, - 214, 215, 216, 217, 218, 219, 228, 170, 139, 141, - 266, 269, 272, 278, 138, 143, 139, 147, 139, 149, - 142, 235, 236, 269, 236, 243, 146, 265, 272, 141, - 260, 27, 43, 144, 170, 189, 190, 191, 270, 146, - 192, 140, 145, 206, 272, 145, 29, 36, 52, 24, - 148, 229, 230, 231, 270, 37, 229, 269, 269, 141, - 215, 148, 170, 220, 221, 268, 271, 24, 29, 219, - 170, 139, 149, 269, 236, 236, 240, 272, 171, 143, - 150, 139, 149, 236, 244, 245, 270, 269, 148, 272, - 272, 190, 13, 149, 139, 144, 196, 270, 26, 144, - 170, 193, 194, 195, 270, 138, 140, 145, 197, 21, - 28, 30, 138, 207, 208, 140, 209, 268, 36, 145, - 11, 230, 232, 233, 234, 246, 268, 14, 272, 229, - 145, 145, 239, 222, 223, 224, 269, 222, 242, 241, - 269, 278, 145, 270, 282, 241, 143, 14, 155, 236, - 236, 147, 139, 138, 266, 269, 269, 139, 196, 4, - 144, 191, 190, 170, 194, 13, 147, 139, 144, 196, - 40, 198, 199, 253, 268, 145, 209, 209, 141, 208, - 198, 146, 145, 236, 138, 14, 139, 149, 145, 138, - 145, 241, 235, 235, 149, 138, 140, 145, 272, 283, - 284, 140, 146, 269, 236, 149, 138, 138, 190, 196, - 13, 139, 196, 144, 195, 194, 235, 141, 199, 269, - 138, 268, 141, 147, 236, 138, 138, 145, 233, 234, - 268, 235, 138, 138, 272, 36, 38, 50, 138, 225, - 226, 227, 270, 235, 148, 139, 24, 138, 170, 270, - 279, 280, 281, 244, 196, 194, 196, 138, 145, 146, - 138, 138, 235, 138, 241, 145, 145, 145, 141, 227, - 138, 269, 285, 284, 170, 269, 141, 281, 147, 196, - 235, 147, 138, 246, 235, 235, 139, 149, 269, 145, - 138, 138, 138, 138, 269, 145, 235, 235, 138, 138 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_int16 yyr1[] = -{ - 0, 157, 158, 158, 159, 159, 159, 160, 161, 161, - 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, - 163, 163, 163, 163, 163, 163, 164, 165, 165, 166, - 167, 168, 169, 169, 170, 170, 171, 171, 172, 172, - 173, 174, 175, 176, 177, 178, 179, 179, 179, 180, - 181, 182, 182, 183, 184, 184, 185, 185, 186, 186, - 187, 187, 188, 189, 189, 189, 189, 189, 190, 190, - 191, 192, 193, 193, 193, 193, 193, 194, 194, 195, - 195, 196, 196, 197, 197, 197, 198, 198, 199, 199, - 200, 201, 202, 202, 203, 204, 205, 205, 206, 206, - 207, 207, 208, 208, 208, 208, 209, 210, 211, 211, - 212, 212, 213, 213, 214, 214, 215, 215, 215, 215, - 215, 215, 215, 215, 215, 215, 216, 216, 217, 217, - 218, 218, 219, 219, 219, 220, 220, 221, 221, 221, - 222, 222, 222, 223, 223, 224, 225, 225, 226, 226, - 227, 227, 227, 227, 228, 229, 229, 229, 229, 230, - 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, - 236, 236, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 238, 238, 239, 239, 240, - 240, 240, 241, 241, 242, 243, 243, 244, 244, 245, - 245, 246, 246, 246, 247, 247, 248, 248, 249, 250, - 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, - 255, 256, 257, 257, 258, 258, 259, 259, 260, 260, - 260, 260, 261, 261, 262, 263, 264, 265, 266, 266, - 267, 268, 268, 268, 268, 268, 268, 268, 268, 268, - 268, 269, 270, 271, 272, 272, 273, 274, 274, 275, - 275, 276, 276, 277, 266, 266, 278, 279, 279, 280, - 280, 281, 281, 281, 282, 282, 283, 283, 284, 285, - 285 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_int8 yyr2[] = -{ - 0, 2, 1, 2, 1, 2, 2, 3, 1, 1, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 4, 1, 3, 4, - 1, 3, 1, 3, 1, 4, 1, 1, 3, 4, - 1, 1, 6, 4, 1, 2, 1, 1, 6, 4, - 4, 1, 1, 3, 1, 3, 2, 2, 1, 1, - 1, 1, 3, 1, 2, 3, 4, 5, 1, 3, - 2, 3, 1, 2, 3, 4, 5, 1, 3, 2, - 3, 1, 2, 1, 3, 3, 1, 2, 3, 5, - 2, 1, 2, 3, 2, 6, 1, 2, 2, 3, - 1, 2, 1, 2, 2, 5, 3, 4, 1, 2, - 1, 3, 3, 2, 1, 2, 1, 2, 5, 6, - 2, 2, 3, 1, 6, 1, 5, 5, 1, 2, - 1, 2, 1, 1, 1, 2, 2, 5, 2, 2, - 4, 4, 2, 1, 1, 1, 1, 1, 1, 2, - 4, 4, 4, 1, 4, 3, 5, 4, 6, 3, - 1, 3, 1, 3, 3, 1, 1, 1, 1, 3, - 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 1, 1, 8, 5, 1, 3, 1, - 4, 1, 1, 1, 3, 1, 3, 1, 1, 1, - 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 1, 1, 3, 1, 1, 1, 3, 3, 2, 6, - 5, 4, 1, 2, 2, 3, 1, 2, 1, 1, - 1, 1, 1, 1, 5, 5, 4, 4, 1, 3, - 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 1, 0, 2, 1, 1, 3, 1, 1, 1, - 2, 1, 1, 9, 1, 3, 2, 1, 1, 1, - 2, 5, 6, 1, 1, 2, 1, 3, 4, 1, - 3 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (&yylloc, ctx, root, errors, sb, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (N) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (0) -#endif - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - - -/* Enable debugging if requested. */ -#if KDBTEXT_DEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if defined KDBTEXT_LTYPE_IS_TRIVIAL && KDBTEXT_LTYPE_IS_TRIVIAL - -/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ - -YY_ATTRIBUTE_UNUSED -static int -yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) -{ - int res = 0; - int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; - if (0 <= yylocp->first_line) - { - res += YYFPRINTF (yyo, "%d", yylocp->first_line); - if (0 <= yylocp->first_column) - res += YYFPRINTF (yyo, ".%d", yylocp->first_column); - } - if (0 <= yylocp->last_line) - { - if (yylocp->first_line < yylocp->last_line) - { - res += YYFPRINTF (yyo, "-%d", yylocp->last_line); - if (0 <= end_col) - res += YYFPRINTF (yyo, ".%d", end_col); - } - else if (0 <= end_col && yylocp->first_column < end_col) - res += YYFPRINTF (yyo, "-%d", end_col); - } - return res; - } - -# define YY_LOCATION_PRINT(File, Loc) \ - yy_location_print_ (File, &(Loc)) - -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, Location, ctx, root, errors, sb); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*-----------------------------------. -| Print this symbol's value on YYO. | -`-----------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) -{ - FILE *yyoutput = yyo; - YYUSE (yyoutput); - YYUSE (yylocationp); - YYUSE (ctx); - YYUSE (root); - YYUSE (errors); - YYUSE (sb); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyo, yytoknum[yytype], *yyvaluep); -# endif - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - -/*---------------------------. -| Print this symbol on YYO. | -`---------------------------*/ - -static void -yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) -{ - YYFPRINTF (yyo, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - YY_LOCATION_PRINT (yyo, *yylocationp); - YYFPRINTF (yyo, ": "); - yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, ctx, root, errors, sb); - YYFPRINTF (yyo, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) -{ - int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[+yyssp[yyi + 1 - yynrhs]], - &yyvsp[(yyi + 1) - (yynrhs)] - , &(yylsp[(yyi + 1) - (yynrhs)]) , ctx, root, errors, sb); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, yylsp, Rule, ctx, root, errors, sb); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !KDBTEXT_DEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !KDBTEXT_DEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) -# else -/* Return the length of YYSTR. */ -static YYPTRDIFF_T -yystrlen (const char *yystr) -{ - YYPTRDIFF_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYPTRDIFF_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYPTRDIFF_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - else - goto append; - - append: - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (yyres) - return yystpcpy (yyres, yystr) - yyres; - else - return yystrlen (yystr); -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, - yy_state_t *yyssp, int yytoken) -{ - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat: reported tokens (one for the "unexpected", - one per "expected"). */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Actual size of YYARG. */ - int yycount = 0; - /* Cumulated lengths of YYARG. */ - YYPTRDIFF_T yysize = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[+*yyssp]; - YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - yysize = yysize0; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYPTRDIFF_T yysize1 - = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return 2; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - default: /* Avoid compiler warnings. */ - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - /* Don't count the "%s"s in the final size, but reserve room for - the terminator. */ - YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return 2; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - ++yyp; - ++yyformat; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) -{ - YYUSE (yyvaluep); - YYUSE (yylocationp); - YYUSE (ctx); - YYUSE (root); - YYUSE (errors); - YYUSE (sb); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - switch (yytype) - { - case 0: /* "end of source" */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 3: /* UNRECOGNIZED */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 4: /* ELLIPSIS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 5: /* INCREMENT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 6: /* DECIMAL */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 7: /* OCTAL */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 8: /* HEX */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 9: /* FLOAT_ */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 10: /* EXP_FLOAT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 11: /* STRING */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 12: /* ESCAPED_STRING */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 13: /* IDENTIFIER_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 14: /* PHYSICAL_IDENTIFIER_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 15: /* VERSION */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 16: /* UNTERM_STRING */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 17: /* UNTERM_ESCAPED_STRING */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 18: /* VERS_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 19: /* VERS_2_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 20: /* KW___no_header */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 21: /* KW___row_length */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 22: /* KW___untyped */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 23: /* KW_alias */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 24: /* KW_column */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 25: /* KW_const */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 26: /* KW_control */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 27: /* KW_database */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 28: /* KW_decode */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 29: /* KW_default */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 30: /* KW_encode */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 31: /* KW_extern */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 32: /* KW_false */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 33: /* KW_fmtdef */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 34: /* KW_function */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 35: /* KW_include */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 36: /* KW_limit */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 37: /* KW_physical */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 38: /* KW_read */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 39: /* KW_readonly */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 40: /* KW_return */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 41: /* KW_kdbtext */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 42: /* KW_static */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 43: /* KW_table */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 44: /* KW_template */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 45: /* KW_trigger */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 46: /* KW_true */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 47: /* KW_type */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 48: /* KW_typedef */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 49: /* KW_typeset */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 50: /* KW_validate */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 51: /* KW_version */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 52: /* KW_view */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 53: /* KW_virtual */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 54: /* KW_void */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 55: /* KW_write */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 56: /* PT_ASTLIST */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 57: /* PT_PARSE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 58: /* PT_SOURCE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 59: /* PT_VERSION_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 60: /* PT_VERSION_2 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 61: /* PT_SCHEMA_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 62: /* PT_SCHEMA_2_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 63: /* PT_INCLUDE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 64: /* PT_TYPEDEF */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 65: /* PT_FQN */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 66: /* PT_IDENT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 67: /* PT_PHYSIDENT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 68: /* PT_UINT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 69: /* PT_TYPESET */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 70: /* PT_TYPESETDEF */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 71: /* PT_FORMAT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 72: /* PT_CONST */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 73: /* PT_ALIAS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 74: /* PT_EXTERN */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 75: /* PT_FUNCTION */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 76: /* PT_UNTYPED */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 77: /* PT_ROWLENGTH */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 78: /* PT_FUNCDECL */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 79: /* PT_EMPTY */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 80: /* PT_SCHEMASIG */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 81: /* PT_SCHEMAFORMAL */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 82: /* PT_RETURNTYPE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 83: /* PT_FACTSIG */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 84: /* PT_FUNCSIG */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 85: /* PT_FUNCPARAMS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 86: /* PT_FORMALPARAM */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 87: /* PT_ELLIPSIS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 88: /* PT_FUNCPROLOGUE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 89: /* PT_RETURN */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 90: /* PT_PRODSTMT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 91: /* PT_PRODTRIGGER */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 92: /* PT_SCHEMA */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 93: /* PT_VALIDATE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 94: /* PT_PHYSICAL */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 95: /* PT_PHYSPROLOGUE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 96: /* PT_PHYSSTMT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 97: /* PT_PHYSBODYSTMT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 98: /* PT_TABLE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 99: /* PT_TABLEPARENTS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 100: /* PT_TABLEBODY */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 101: /* PT_FUNCEXPR */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 102: /* PT_FACTPARMS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 103: /* PT_COLUMN */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 104: /* PT_COLUMNEXPR */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 105: /* PT_COLDECL */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 106: /* PT_TYPEDCOL */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 107: /* PT_COLSTMT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 108: /* PT_DFLTVIEW */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 109: /* PT_PHYSMBR */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 110: /* PT_PHYSCOL */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 111: /* PT_PHYSCOLDEF */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 112: /* PT_COLSCHEMAPARMS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 113: /* PT_COLSCHEMAPARAM */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 114: /* PT_COLUNTYPED */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 115: /* PT_DATABASE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 116: /* PT_TYPEEXPR */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 117: /* PT_DBBODY */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 118: /* PT_DBDAD */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 119: /* PT_DBMEMBER */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 120: /* PT_TBLMEMBER */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 121: /* PT_NOHEADER */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 122: /* PT_CASTEXPR */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 123: /* PT_CONSTVECT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 124: /* PT_NEGATE */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 125: /* PT_UNARYPLUS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 126: /* PT_VERSNAME */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 127: /* PT_ARRAY */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 128: /* PT_PHYSENCREF */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 129: /* PT_TYPEDCOLEXPR */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 130: /* PT_VIEW */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 131: /* PT_VIEWPARAM */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 132: /* PT_VIEWPARENTS */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 133: /* PT_VIEWPARENT */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 134: /* PT_MEMBEREXPR */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 135: /* PT_JOINEXPR */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 136: /* PT_ALIASMEMBER */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 137: /* PT_VIEWSPEC */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 138: /* ';' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 139: /* ',' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 140: /* '{' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 141: /* '}' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 142: /* '[' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 143: /* ']' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 144: /* '*' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 145: /* '=' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 146: /* '(' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 147: /* ')' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 148: /* '<' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 149: /* '>' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 150: /* '|' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 151: /* '@' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 152: /* '-' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 153: /* '+' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 154: /* '/' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 155: /* '.' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 156: /* ':' */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 158: /* parse */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 159: /* source */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 160: /* version_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 161: /* kdbtext_1_0_opt */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 162: /* kdbtext_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 163: /* kdbtext_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 164: /* typedef_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 165: /* typedef_1_0_new_name_list */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 166: /* typeset_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 167: /* typeset_1_0_new_name */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 168: /* typeset_1_0_def */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 169: /* typespec_1_0_list */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 170: /* typespec_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 171: /* dim_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 172: /* format_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 173: /* format_1_0_new_name */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 174: /* format_1_0_name */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 175: /* const_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 176: /* alias_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 177: /* alias_1_0_new_name */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 178: /* function_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 179: /* func_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 180: /* untyped_func_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 181: /* row_length_func_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 182: /* opt_func_1_0_kdbtext_sig */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 183: /* func_1_0_kdbtext_sig */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 184: /* func_1_0_kdbtext_formals */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 185: /* func_1_0_kdbtext_formal */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 186: /* func_1_0_return_type */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 187: /* opt_func_1_0_fact_sig */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 188: /* func_1_0_fact_sig */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 189: /* func_1_0_fact_signature */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 190: /* func_1_0_fact_params */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 191: /* fact_param_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 192: /* func_1_0_param_sig */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 193: /* func_1_0_param_signature */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 194: /* func_1_0_formal_params */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 195: /* formal_param_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 196: /* func_1_0_vararg_formals */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 197: /* func_1_0_prologue */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 198: /* script_1_0_stmt_seq */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 199: /* script_1_0_stmt */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 200: /* extern_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 201: /* ext_func_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 202: /* script_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 203: /* validate_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 204: /* physical_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 205: /* phys_1_0_return_type */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 206: /* phys_1_0_prologue */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 207: /* phys_1_0_body */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 208: /* phys_1_0_body_stmt */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 209: /* phys_1_0_stmt */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 210: /* table_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 211: /* opt_tbl_1_0_parents */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 212: /* tbl_1_0_parents */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 213: /* tbl_1_0_body */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 214: /* tbl_1_0_stmt_seq */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 215: /* tbl_1_0_stmt */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 216: /* production_1_0_stmt */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 217: /* col_1_0_modifiers */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 218: /* col_1_0_modifier_seq */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 219: /* col_1_0_modifier */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 220: /* col_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 221: /* phys_enc_ref */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 222: /* typed_column_decl_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 223: /* col_ident */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 224: /* phys_ident */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 225: /* opt_column_body_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 226: /* column_body_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 227: /* column_stmt_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 228: /* default_view_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 229: /* physmbr_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 230: /* phys_coldef_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 231: /* opt_col_kdbtext_parms_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 232: /* col_kdbtext_parms_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 233: /* col_kdbtext_parm_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 234: /* col_kdbtext_value_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 235: /* cond_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 236: /* expression_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 237: /* primary_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 238: /* func_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 239: /* kdbtext_parms_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 240: /* kdbtext_parm_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 241: /* opt_factory_parms_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 242: /* factory_parms_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 243: /* factory_parms */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 244: /* opt_func_1_0_parms */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 245: /* func_1_0_parms */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 246: /* uint_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 247: /* float_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 248: /* string_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 249: /* const_vect_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 250: /* opt_const_vect_exprlist_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 251: /* const_vect_exprlist_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 252: /* bool_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 253: /* type_expr_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 254: /* member_expr_2_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 255: /* join_expr_2_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 256: /* database_1_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 257: /* opt_database_dad_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 258: /* database_body_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 259: /* database_members_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 260: /* database_member_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 261: /* opt_template_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 262: /* db_member_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 263: /* table_member_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 264: /* alias_member_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 265: /* view_spec */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 266: /* view_parms */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 267: /* include_directive */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 268: /* fqn_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 269: /* ident_1_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 270: /* empty */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 271: /* fqn_vers */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 272: /* fqn_opt_vers */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 273: /* version_2_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 274: /* kdbtext_2_0_opt */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 275: /* kdbtext_2_0 */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 276: /* kdbtext_2_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 277: /* view_2_0_decl */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 278: /* view_parm */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 279: /* opt_view_body */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 280: /* view_body */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 281: /* view_member */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 282: /* opt_view_parents */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 283: /* view_parents */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 284: /* view_parent */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - case 285: /* view_parent_parms */ - { - if ( (*yyvaluep) . subtree != NULL ) - { - ParseTree :: Destroy ( ( ParseTree * ) ( (*yyvaluep) . subtree ) ); - } - else - { /* terminal; release associated whitespace */ - free ( (*yyvaluep) . leading_ws ); - } -} - break; - - default: - break; - } - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb) -{ -/* The lookahead symbol. */ -int yychar; - - -/* The semantic value of the lookahead symbol. */ -/* Default value used for initialization, for pacifying older GCCs - or non-GCC compilers. */ -YY_INITIAL_VALUE (static YYSTYPE yyval_default;) -YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); - -/* Location data for the lookahead symbol. */ -static YYLTYPE yyloc_default -# if defined KDBTEXT_LTYPE_IS_TRIVIAL && KDBTEXT_LTYPE_IS_TRIVIAL - = { 1, 1, 1, 1 } -# endif -; -YYLTYPE yylloc = yyloc_default; - - /* Number of syntax errors so far. */ - int yynerrs; - - yy_state_fast_t yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - 'yyls': related to locations. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yy_state_t yyssa[YYINITDEPTH]; - yy_state_t *yyss; - yy_state_t *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls; - YYLTYPE *yylsp; - - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3]; - - YYPTRDIFF_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yylsp = yyls = yylsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - yylsp[0] = yylloc; - goto yysetstate; - - -/*------------------------------------------------------------. -| yynewstate -- push a new state, which is found in yystate. | -`------------------------------------------------------------*/ -yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - -/*--------------------------------------------------------------------. -| yysetstate -- set current state (the top of the stack) to yystate. | -`--------------------------------------------------------------------*/ -yysetstate: - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - YY_IGNORE_USELESS_CAST_BEGIN - *yyssp = YY_CAST (yy_state_t, yystate); - YY_IGNORE_USELESS_CAST_END - - if (yyss + yystacksize - 1 <= yyssp) -#if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; -#else - { - /* Get the current used size of the three stacks, in elements. */ - YYPTRDIFF_T yysize = yyssp - yyss + 1; - -# if defined yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - yy_state_t *yyss1 = yyss; - YYSTYPE *yyvs1 = yyvs; - YYLTYPE *yyls1 = yyls; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * YYSIZEOF (*yyssp), - &yyvs1, yysize * YYSIZEOF (*yyvsp), - &yyls1, yysize * YYSIZEOF (*yylsp), - &yystacksize); - yyss = yyss1; - yyvs = yyvs1; - yyls = yyls1; - } -# else /* defined YYSTACK_RELOCATE */ - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yy_state_t *yyss1 = yyss; - union yyalloc *yyptr = - YY_CAST (union yyalloc *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); - YYSTACK_RELOCATE (yyls_alloc, yyls); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - yylsp = yyls + yysize - 1; - - YY_IGNORE_USELESS_CAST_BEGIN - YYDPRINTF ((stderr, "Stack size increased to %ld\n", - YY_CAST (long, yystacksize))); - YY_IGNORE_USELESS_CAST_END - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } -#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (&yylval, &yylloc, sb); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - *++yylsp = yylloc; - - /* Discard the shifted token. */ - yychar = YYEMPTY; - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - /* Default location. */ - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); - yyerror_range[1] = yyloc; - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: - { *root = MakeTree ( ctx, PT_PARSE, T ( ctx, yyvsp[0] ) ); yyval . subtree = 0; yyval . leading_ws = 0; } - break; - - case 3: - { *root = MakeTree ( ctx, PT_PARSE, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); yyval . subtree = 0; yyval . leading_ws = 0; } - break; - - case 4: - { yyval . subtree = MakeTree ( ctx, PT_SOURCE, P ( yyvsp[0] ) ); } - break; - - case 5: - { yyval . subtree = MakeTree ( ctx, PT_SOURCE, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 6: - { yyval . subtree = MakeTree ( ctx, PT_SOURCE, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 7: - { yyval . subtree = MakeTree ( ctx, PT_VERSION_1_0, T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 8: - { yyval . subtree = P ( yyvsp[0] ); } - break; - - case 9: - { yyval = yyvsp[0]; } - break; - - case 10: - { yyval . subtree = MakeTree ( ctx, PT_SCHEMA_1_0, P ( yyvsp[0] ) ); } - break; - - case 11: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ) , P ( yyvsp[0] ) ); } - break; - - case 12: - { yyval = yyvsp[0]; } - break; - - case 13: - { yyval = yyvsp[0]; } - break; - - case 14: - { yyval = yyvsp[0]; } - break; - - case 15: - { yyval = yyvsp[0]; } - break; - - case 16: - { yyval = yyvsp[0]; } - break; - - case 17: - { yyval = yyvsp[0]; } - break; - - case 18: - { yyval = yyvsp[0]; } - break; - - case 19: - { yyval = yyvsp[0]; } - break; - - case 20: - { yyval = yyvsp[0]; } - break; - - case 21: - { yyval = yyvsp[0]; } - break; - - case 22: - { yyval = yyvsp[0]; } - break; - - case 23: - { yyval = yyvsp[0]; } - break; - - case 24: - { yyval = yyvsp[0]; } - break; - - case 25: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 26: - { yyval . subtree = MakeTree ( ctx, PT_TYPEDEF, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 27: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 28: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 29: - { yyval . subtree = MakeTree ( ctx, PT_TYPESET, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 30: - { yyval = yyvsp[0]; } - break; - - case 31: - { yyval . subtree = MakeTree ( ctx, PT_TYPESETDEF, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 32: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 33: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 34: - { yyval = yyvsp[0]; } - break; - - case 35: - { yyval . subtree = MakeTree ( ctx, PT_ARRAY, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 36: - { yyval = yyvsp[0]; } - break; - - case 37: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 38: - { yyval . subtree = MakeTree ( ctx, PT_FORMAT, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 39: - { yyval . subtree = MakeTree ( ctx, PT_FORMAT, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 40: - { yyval = yyvsp[0]; } - break; - - case 41: - { yyval = yyvsp[0]; } - break; - - case 42: - { yyval . subtree = MakeTree ( ctx, PT_CONST, T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 43: - { yyval . subtree = MakeTree ( ctx, PT_ALIAS, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 44: - { yyval = yyvsp[0]; } - break; - - case 45: - { yyval . subtree = MakeTree ( ctx, PT_FUNCTION, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 46: - { yyval = yyvsp[0]; } - break; - - case 47: - { yyval = yyvsp[0]; } - break; - - case 48: - { yyval . subtree = MakeTree ( ctx, PT_FUNCDECL, P ( yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 49: - { yyval . subtree = MakeTree ( ctx, PT_UNTYPED, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 50: - { yyval . subtree = MakeTree ( ctx, PT_ROWLENGTH, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 51: - { yyval = yyvsp[0]; } - break; - - case 52: - { yyval = yyvsp[0]; } - break; - - case 53: - { yyval . subtree = MakeTree ( ctx, PT_SCHEMASIG, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 54: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 55: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 56: - { yyval . subtree = MakeTree ( ctx, PT_SCHEMAFORMAL, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 57: - { yyval . subtree = MakeTree ( ctx, PT_SCHEMAFORMAL, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 58: - { yyval . subtree = MakeTree ( ctx, PT_RETURNTYPE, T ( ctx, yyvsp[0] ) ); } - break; - - case 59: - { yyval . subtree = MakeTree ( ctx, PT_RETURNTYPE, P ( yyvsp[0] ) ); } - break; - - case 60: - { yyval = yyvsp[0]; } - break; - - case 61: - { yyval = yyvsp[0]; } - break; - - case 62: - { yyval . subtree = MakeTree ( ctx, PT_FACTSIG, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 63: - { yyval = yyvsp[0]; } - break; - - case 64: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 65: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 66: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 67: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 68: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 69: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 70: - { yyval . subtree = MakeTree ( ctx, PT_FORMALPARAM, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 71: - { yyval . subtree = MakeTree ( ctx, PT_FUNCSIG, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 72: - { yyval = yyvsp[0]; } - break; - - case 73: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 74: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 75: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 76: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPARAMS, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 77: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 78: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 79: - { yyval . subtree = MakeTree ( ctx, PT_FORMALPARAM, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 80: - { yyval . subtree = MakeTree ( ctx, PT_FORMALPARAM, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 81: - { yyval = yyvsp[0]; } - break; - - case 82: - { yyval . subtree = MakeTree ( ctx, PT_ELLIPSIS, T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 83: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, yyvsp[0] ) ); } - break; - - case 84: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 85: - { yyval . subtree = MakeTree ( ctx, PT_FUNCPROLOGUE, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 86: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 87: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 88: - { yyval . subtree = MakeTree ( ctx, PT_RETURN, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 89: - { yyval . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 90: - { yyval . subtree = MakeTree ( ctx, PT_EXTERN, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 91: - { yyval = yyvsp[0]; } - break; - - case 92: - { yyval . subtree = MakeTree ( ctx, PT_SCHEMA, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 93: - { yyval . subtree = MakeTree ( ctx, PT_SCHEMA, T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 94: - { yyval . subtree = MakeTree ( ctx, PT_VALIDATE, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 95: - { yyval . subtree = MakeTree ( ctx, PT_PHYSICAL, T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 96: - { yyval = yyvsp[0]; } - break; - - case 97: - { yyval . subtree = MakeTree ( ctx, PT_NOHEADER, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 98: - { yyval . subtree = MakeTree ( ctx, PT_PHYSPROLOGUE, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 99: - { yyval . subtree = MakeTree ( ctx, PT_PHYSPROLOGUE, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 100: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 101: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 102: - { yyval . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, yyvsp[0] ) ); } - break; - - case 103: - { yyval . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 104: - { yyval . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 105: - { yyval . subtree = MakeTree ( ctx, PT_PHYSBODYSTMT, T ( ctx, yyvsp[-4] ), T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 106: - { yyval . subtree = MakeTree ( ctx, PT_PHYSSTMT, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 107: - { yyval . subtree = MakeTree ( ctx, PT_TABLE, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 108: - { yyval = yyvsp[0]; } - break; - - case 109: - { yyval . subtree = MakeTree ( ctx, PT_TABLEPARENTS, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 110: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 111: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 112: - { yyval . subtree = MakeTree ( ctx, PT_TABLEBODY, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 113: - { yyval . subtree = MakeTree ( ctx, PT_TABLEBODY, T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 114: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 115: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 116: - { yyval = yyvsp[0]; } - break; - - case 117: - { yyval . subtree = MakeTree ( ctx, PT_COLUMN, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 118: - { yyval . subtree = MakeTree ( ctx, PT_COLUMNEXPR, T ( ctx, yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 119: - { yyval . subtree = MakeTree ( ctx, PT_COLUMNEXPR, T ( ctx, yyvsp[-5] ), T ( ctx, yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 120: - { yyval . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 121: - { yyval . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 122: - { yyval . subtree = MakeTree ( ctx, PT_PHYSCOL, T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 123: - { yyval = yyvsp[0]; } - break; - - case 124: - { yyval . subtree = MakeTree ( ctx, PT_COLUNTYPED, T ( ctx, yyvsp[-5] ), T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 125: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 126: - { yyval . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 127: - { yyval . subtree = MakeTree ( ctx, PT_PRODTRIGGER, T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 128: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 129: - { yyval = yyvsp[-1]; AddToList ( ctx, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 130: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 131: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 132: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 133: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 134: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 135: - { yyval . subtree = MakeTree ( ctx, PT_COLDECL, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 136: - { yyval . subtree = MakeTree ( ctx, PT_COLDECL, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 137: - { yyval . subtree = MakeTree ( ctx, PT_PHYSENCREF, T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 138: - { yyval . subtree = MakeTree ( ctx, PT_PHYSENCREF, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 139: - { yyval . subtree = MakeTree ( ctx, PT_PHYSENCREF, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 140: - { yyval . subtree = MakeTree ( ctx, PT_TYPEDCOL, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 141: - { yyval . subtree = MakeTree ( ctx, PT_TYPEDCOLEXPR, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 142: - { yyval . subtree = MakeTree ( ctx, PT_TYPEDCOL, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 143: - { yyval = yyvsp[0]; } - break; - - case 144: - { yyval = yyvsp[0]; } - break; - - case 145: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 146: - { yyval = yyvsp[0]; } - break; - - case 147: - { yyval = yyvsp[0]; } - break; - - case 148: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 149: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 150: - { yyval . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 151: - { yyval . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 152: - { yyval . subtree = MakeTree ( ctx, PT_COLSTMT, T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 153: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 154: - { yyval . subtree = MakeTree ( ctx, PT_DFLTVIEW, T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 155: - { yyval . subtree = MakeTree ( ctx, PT_PHYSMBR, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 156: - { yyval . subtree = MakeTree ( ctx, PT_PHYSMBR, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 157: - { yyval . subtree = MakeTree ( ctx, PT_PHYSMBR, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 158: - { yyval . subtree = MakeTree ( ctx, PT_PHYSMBR, T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 159: - { yyval . subtree = MakeTree ( ctx, PT_PHYSCOLDEF, P ( yyvsp[-2] ), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 160: - { yyval = yyvsp[0]; } - break; - - case 161: - { yyval . subtree = MakeTree ( ctx, PT_COLSCHEMAPARMS, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 162: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 163: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 164: - { yyval . subtree = MakeTree ( ctx, PT_COLSCHEMAPARAM, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 165: - { yyval = yyvsp[0]; } - break; - - case 166: - { yyval = yyvsp[0]; } - break; - - case 167: - { yyval = yyvsp[0]; } - break; - - case 168: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 169: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 170: - { yyval = yyvsp[0]; } - break; - - case 171: - { yyval . subtree = MakeTree ( ctx, PT_CASTEXPR, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 172: - { yyval = yyvsp[0]; } - break; - - case 173: - { yyval = yyvsp[0]; } - break; - - case 174: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 175: - { yyval = yyvsp[0]; } - break; - - case 176: - { yyval = yyvsp[0]; } - break; - - case 177: - { yyval = yyvsp[0]; } - break; - - case 178: - { yyval = yyvsp[0]; } - break; - - case 179: - { yyval = yyvsp[0]; } - break; - - case 180: - { yyval = yyvsp[0]; } - break; - - case 181: - { yyval . subtree = MakeTree ( ctx, PT_NEGATE, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 182: - { yyval . subtree = MakeTree ( ctx, PT_UNARYPLUS, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 183: - { yyval = yyvsp[0]; } - break; - - case 184: - { yyval = yyvsp[0]; } - break; - - case 185: - { yyval . subtree = MakeTree ( ctx, PT_FUNCEXPR, T ( ctx, yyvsp[-7] ), P ( yyvsp[-6] ), T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 186: - { yyval . subtree = MakeTree ( ctx, PT_FUNCEXPR, P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 187: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 188: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 189: - { yyval = yyvsp[0]; } - break; - - case 190: - { yyval . subtree = MakeTree ( ctx, PT_ARRAY, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 191: - { yyval = yyvsp[0]; } - break; - - case 192: - { yyval = yyvsp[0]; } - break; - - case 193: - { yyval = yyvsp[0]; } - break; - - case 194: - { yyval . subtree = MakeTree ( ctx, PT_FACTPARMS, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 195: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 196: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 197: - { yyval = yyvsp[0]; } - break; - - case 198: - { yyval = yyvsp[0]; } - break; - - case 199: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 200: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 201: - { yyval . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, yyvsp[0] ) ); } - break; - - case 202: - { yyval . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, yyvsp[0] ) ); } - break; - - case 203: - { yyval . subtree = MakeTree ( ctx, PT_UINT, T ( ctx, yyvsp[0] ) ); } - break; - - case 204: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 205: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 206: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 207: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 208: - { yyval . subtree = MakeTree ( ctx, PT_CONSTVECT, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 209: - { yyval = yyvsp[0]; } - break; - - case 210: - { yyval = yyvsp[0]; } - break; - - case 211: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 212: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 213: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 214: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 215: - { yyval = yyvsp[0]; } - break; - - case 216: - { yyval . subtree = MakeTree ( ctx, PT_TYPEEXPR, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1]), P ( yyvsp[0] ) ); } - break; - - case 217: - { yyval . subtree = MakeTree ( ctx, PT_MEMBEREXPR, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 218: - { yyval . subtree = MakeTree ( ctx, PT_MEMBEREXPR, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 219: - { yyval . subtree = MakeTree ( ctx, PT_JOINEXPR, P ( yyvsp[-5] ), T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P (yyvsp[0] ) ); } - break; - - case 220: - { yyval . subtree = MakeTree ( ctx, PT_JOINEXPR, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 221: - { yyval . subtree = MakeTree ( ctx, PT_DATABASE, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2]), P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 222: - { yyval = yyvsp[0]; } - break; - - case 223: - { yyval . subtree = MakeTree ( ctx, PT_DBDAD, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 224: - { yyval . subtree = MakeTree ( ctx, PT_DBBODY, T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 225: - { yyval . subtree = MakeTree ( ctx, PT_DBBODY, T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 226: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 227: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 228: - { yyval = yyvsp[0]; } - break; - - case 229: - { yyval = yyvsp[0]; } - break; - - case 230: - { yyval = yyvsp[0]; } - break; - - case 231: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 232: - { yyval = yyvsp[0]; } - break; - - case 233: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 234: - { yyval . subtree = MakeTree ( ctx, PT_DBMEMBER, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 235: - { yyval . subtree = MakeTree ( ctx, PT_TBLMEMBER, P ( yyvsp[-4] ), T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 236: - { yyval . subtree = MakeTree ( ctx, PT_ALIASMEMBER, T ( ctx, yyvsp[-3] ), P ( yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 237: - { yyval . subtree = MakeTree ( ctx, PT_VIEWSPEC, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 238: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 239: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 240: - { yyval . subtree = MakeTree ( ctx, PT_INCLUDE, T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 241: - { yyval . subtree = MakeTree ( ctx, PT_FQN, P ( yyvsp[0] ) ); } - break; - - case 242: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 243: - { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } - break; - - case 244: - { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } - break; - - case 245: - { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } - break; - - case 246: - { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } - break; - - case 247: - { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } - break; - - case 248: - { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } - break; - - case 249: - { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } - break; - - case 250: - { yyvsp[0] . type = IDENTIFIER_1_0; yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ) ); } - break; - - case 251: - { yyval . subtree = MakeTree ( ctx, PT_IDENT, T ( ctx, yyvsp[0] ) ); } - break; - - case 252: - { yyval . subtree = MakeTree ( ctx, PT_EMPTY ); } - break; - - case 253: - { yyval . subtree = MakeTree ( ctx, PT_VERSNAME, P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 254: - { yyval = yyvsp[0]; } - break; - - case 255: - { yyval = yyvsp[0]; } - break; - - case 256: - { yyval . subtree = MakeTree ( ctx, PT_VERSION_2, T ( ctx, yyvsp[-2] ), T ( ctx, yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 257: - { yyval . subtree = P ( yyvsp[0] ); } - break; - - case 258: - { yyval = yyvsp[0]; } - break; - - case 259: - { yyval . subtree = MakeTree ( ctx, PT_SCHEMA_2_0, P ( yyvsp[0] ) ); } - break; - - case 260: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ) , P ( yyvsp[0] ) ); } - break; - - case 261: - { yyval = yyvsp[0]; } - break; - - case 262: - { yyval = yyvsp[0]; } - break; - - case 263: - { yyval . subtree = MakeTree ( ctx, PT_VIEW, T ( ctx, yyvsp[-8] ), P ( yyvsp[-7] ), T ( ctx, yyvsp[-6] ), P ( yyvsp[-5] ), T ( ctx, yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 264: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 265: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 266: - { yyval . subtree = MakeTree ( ctx, PT_VIEWPARAM, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 267: - { yyval = yyvsp[0]; } - break; - - case 268: - { yyval = yyvsp[0]; } - break; - - case 269: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 270: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 271: - { yyval . subtree = MakeTree ( ctx, PT_PRODSTMT, P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 272: - { yyval . subtree = MakeTree ( ctx, PT_COLUMN, T ( ctx, yyvsp[-5] ), P ( yyvsp[-4] ), P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 273: - { yyval . subtree = T ( ctx, yyvsp[0] ); } - break; - - case 274: - { yyval = yyvsp[0]; } - break; - - case 275: - { yyval . subtree = MakeTree ( ctx, PT_VIEWPARENTS, T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 276: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 277: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - case 278: - { yyval . subtree = MakeTree ( ctx, PT_VIEWPARENT, P ( yyvsp[-3] ), T ( ctx, yyvsp[-2] ), P ( yyvsp[-1] ), T ( ctx, yyvsp[0] ) ); } - break; - - case 279: - { yyval . subtree = MakeList ( ctx, yyvsp[0] ); } - break; - - case 280: - { yyval . subtree = AddToList ( ctx, P ( yyvsp[-2] ), T ( ctx, yyvsp[-1] ), P ( yyvsp[0] ) ); } - break; - - - - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - *++yylsp = yyloc; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - { - const int yylhs = yyr1[yyn] - YYNTOKENS; - const int yyi = yypgoto[yylhs] + *yyssp; - yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp - ? yytable[yyi] - : yydefgoto[yylhs]); - } - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (&yylloc, ctx, root, errors, sb, YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (&yylloc, ctx, root, errors, sb, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - yyerror_range[1] = yylloc; - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval, &yylloc, ctx, root, errors, sb); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - /* Pacify compilers when the user code never invokes YYERROR and the - label yyerrorlab therefore never appears in user code. */ - if (0) - YYERROR; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - yyerror_range[1] = *yylsp; - yydestruct ("Error: popping", - yystos[yystate], yyvsp, yylsp, ctx, root, errors, sb); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - yyerror_range[2] = yylloc; - /* Using YYLLOC is tempting, but would change the location of - the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, yyerror_range, 2); - *++yylsp = yyloc; - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (&yylloc, ctx, root, errors, sb, YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - - -/*-----------------------------------------------------. -| yyreturn -- parsing is finished, return the result. | -`-----------------------------------------------------*/ -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc, ctx, root, errors, sb); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[+*yyssp], yyvsp, yylsp, ctx, root, errors, sb); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} diff --git a/libs/kdbtext/zz_kdbtext-grammar.hpp b/libs/kdbtext/zz_kdbtext-grammar.hpp deleted file mode 100644 index 0a13e81a0..000000000 --- a/libs/kdbtext/zz_kdbtext-grammar.hpp +++ /dev/null @@ -1,224 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.5.1. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, - Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - -#ifndef YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED -# define YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED -/* Debug traces. */ -#ifndef KDBTEXT_DEBUG -# if defined YYDEBUG -#if YYDEBUG -# define KDBTEXT_DEBUG 1 -# else -# define KDBTEXT_DEBUG 0 -# endif -# else /* ! defined YYDEBUG */ -# define KDBTEXT_DEBUG 0 -# endif /* ! defined YYDEBUG */ -#endif /* ! defined KDBTEXT_DEBUG */ -#if KDBTEXT_DEBUG -extern int KDBText_debug; -#endif - -/* Token type. */ -#ifndef KDBTEXT_TOKENTYPE -# define KDBTEXT_TOKENTYPE - enum KDBText_tokentype - { - END_SOURCE = 0, - UNRECOGNIZED = 258, - ELLIPSIS = 259, - INCREMENT = 260, - DECIMAL = 261, - OCTAL = 262, - HEX = 263, - FLOAT_ = 264, - EXP_FLOAT = 265, - STRING = 266, - ESCAPED_STRING = 267, - IDENTIFIER_1_0 = 268, - PHYSICAL_IDENTIFIER_1_0 = 269, - VERSION = 270, - UNTERM_STRING = 271, - UNTERM_ESCAPED_STRING = 272, - VERS_1_0 = 273, - VERS_2_0 = 274, - KW___no_header = 275, - KW___row_length = 276, - KW___untyped = 277, - KW_alias = 278, - KW_column = 279, - KW_const = 280, - KW_control = 281, - KW_database = 282, - KW_decode = 283, - KW_default = 284, - KW_encode = 285, - KW_extern = 286, - KW_false = 287, - KW_fmtdef = 288, - KW_function = 289, - KW_include = 290, - KW_limit = 291, - KW_physical = 292, - KW_read = 293, - KW_readonly = 294, - KW_return = 295, - KW_kdbtext = 296, - KW_static = 297, - KW_table = 298, - KW_template = 299, - KW_trigger = 300, - KW_true = 301, - KW_type = 302, - KW_typedef = 303, - KW_typeset = 304, - KW_validate = 305, - KW_version = 306, - KW_view = 307, - KW_virtual = 308, - KW_void = 309, - KW_write = 310, - PT_ASTLIST = 311, - PT_PARSE = 312, - PT_SOURCE = 313, - PT_VERSION_1_0 = 314, - PT_VERSION_2 = 315, - PT_SCHEMA_1_0 = 316, - PT_SCHEMA_2_0 = 317, - PT_INCLUDE = 318, - PT_TYPEDEF = 319, - PT_FQN = 320, - PT_IDENT = 321, - PT_PHYSIDENT = 322, - PT_UINT = 323, - PT_TYPESET = 324, - PT_TYPESETDEF = 325, - PT_FORMAT = 326, - PT_CONST = 327, - PT_ALIAS = 328, - PT_EXTERN = 329, - PT_FUNCTION = 330, - PT_UNTYPED = 331, - PT_ROWLENGTH = 332, - PT_FUNCDECL = 333, - PT_EMPTY = 334, - PT_SCHEMASIG = 335, - PT_SCHEMAFORMAL = 336, - PT_RETURNTYPE = 337, - PT_FACTSIG = 338, - PT_FUNCSIG = 339, - PT_FUNCPARAMS = 340, - PT_FORMALPARAM = 341, - PT_ELLIPSIS = 342, - PT_FUNCPROLOGUE = 343, - PT_RETURN = 344, - PT_PRODSTMT = 345, - PT_PRODTRIGGER = 346, - PT_SCHEMA = 347, - PT_VALIDATE = 348, - PT_PHYSICAL = 349, - PT_PHYSPROLOGUE = 350, - PT_PHYSSTMT = 351, - PT_PHYSBODYSTMT = 352, - PT_TABLE = 353, - PT_TABLEPARENTS = 354, - PT_TABLEBODY = 355, - PT_FUNCEXPR = 356, - PT_FACTPARMS = 357, - PT_COLUMN = 358, - PT_COLUMNEXPR = 359, - PT_COLDECL = 360, - PT_TYPEDCOL = 361, - PT_COLSTMT = 362, - PT_DFLTVIEW = 363, - PT_PHYSMBR = 364, - PT_PHYSCOL = 365, - PT_PHYSCOLDEF = 366, - PT_COLSCHEMAPARMS = 367, - PT_COLSCHEMAPARAM = 368, - PT_COLUNTYPED = 369, - PT_DATABASE = 370, - PT_TYPEEXPR = 371, - PT_DBBODY = 372, - PT_DBDAD = 373, - PT_DBMEMBER = 374, - PT_TBLMEMBER = 375, - PT_NOHEADER = 376, - PT_CASTEXPR = 377, - PT_CONSTVECT = 378, - PT_NEGATE = 379, - PT_UNARYPLUS = 380, - PT_VERSNAME = 381, - PT_ARRAY = 382, - PT_PHYSENCREF = 383, - PT_TYPEDCOLEXPR = 384, - PT_VIEW = 385, - PT_VIEWPARAM = 386, - PT_VIEWPARENTS = 387, - PT_VIEWPARENT = 388, - PT_MEMBEREXPR = 389, - PT_JOINEXPR = 390, - PT_ALIASMEMBER = 391, - PT_VIEWSPEC = 392 - }; -#endif - -/* Value type. */ -#if ! defined KDBTEXT_STYPE && ! defined KDBTEXT_STYPE_IS_DECLARED -typedef KDBTextToken KDBTEXT_STYPE; -# define KDBTEXT_STYPE_IS_TRIVIAL 1 -# define KDBTEXT_STYPE_IS_DECLARED 1 -#endif - -/* Location type. */ -#if ! defined KDBTEXT_LTYPE && ! defined KDBTEXT_LTYPE_IS_DECLARED -typedef struct KDBTEXT_LTYPE KDBTEXT_LTYPE; -struct KDBTEXT_LTYPE -{ - int first_line; - int first_column; - int last_line; - int last_column; -}; -# define KDBTEXT_LTYPE_IS_DECLARED 1 -# define KDBTEXT_LTYPE_IS_TRIVIAL 1 -#endif - - - -int KDBText_parse (ctx_t ctx, ParseTree** root, ErrorReport * errors, struct KDBTextScanBlock* sb); - -#endif /* !YY_KDBTEXT_HOME_BOSHKINS_NCBI_DEVEL_NCBI_VDB_LIBS_KDBTEXT_ZZ_KDBTEXT_GRAMMAR_HPP_INCLUDED */ diff --git a/libs/kdbtext/zz_kdbtext-grammar.output b/libs/kdbtext/zz_kdbtext-grammar.output deleted file mode 100644 index 6c046f168..000000000 --- a/libs/kdbtext/zz_kdbtext-grammar.output +++ /dev/null @@ -1,7134 +0,0 @@ -Terminals unused in grammar - - UNRECOGNIZED - INCREMENT - UNTERM_STRING - UNTERM_ESCAPED_STRING - KW_virtual - PT_ASTLIST - PT_PARSE - PT_SOURCE - PT_VERSION_1_0 - PT_VERSION_2 - PT_SCHEMA_1_0 - PT_SCHEMA_2_0 - PT_INCLUDE - PT_TYPEDEF - PT_FQN - PT_IDENT - PT_PHYSIDENT - PT_UINT - PT_TYPESET - PT_TYPESETDEF - PT_FORMAT - PT_CONST - PT_ALIAS - PT_EXTERN - PT_FUNCTION - PT_UNTYPED - PT_ROWLENGTH - PT_FUNCDECL - PT_EMPTY - PT_SCHEMASIG - PT_SCHEMAFORMAL - PT_RETURNTYPE - PT_FACTSIG - PT_FUNCSIG - PT_FUNCPARAMS - PT_FORMALPARAM - PT_ELLIPSIS - PT_FUNCPROLOGUE - PT_RETURN - PT_PRODSTMT - PT_PRODTRIGGER - PT_SCHEMA - PT_VALIDATE - PT_PHYSICAL - PT_PHYSPROLOGUE - PT_PHYSSTMT - PT_PHYSBODYSTMT - PT_TABLE - PT_TABLEPARENTS - PT_TABLEBODY - PT_FUNCEXPR - PT_FACTPARMS - PT_COLUMN - PT_COLUMNEXPR - PT_COLDECL - PT_TYPEDCOL - PT_COLSTMT - PT_DFLTVIEW - PT_PHYSMBR - PT_PHYSCOL - PT_PHYSCOLDEF - PT_COLSCHEMAPARMS - PT_COLSCHEMAPARAM - PT_COLUNTYPED - PT_DATABASE - PT_TYPEEXPR - PT_DBBODY - PT_DBDAD - PT_DBMEMBER - PT_TBLMEMBER - PT_NOHEADER - PT_CASTEXPR - PT_CONSTVECT - PT_NEGATE - PT_UNARYPLUS - PT_VERSNAME - PT_ARRAY - PT_PHYSENCREF - PT_TYPEDCOLEXPR - PT_VIEW - PT_VIEWPARAM - PT_VIEWPARENTS - PT_VIEWPARENT - PT_MEMBEREXPR - PT_JOINEXPR - PT_ALIASMEMBER - PT_VIEWSPEC - - -Grammar - - 0 $accept: parse "end of source" - - 1 parse: "end of source" - 2 | source "end of source" - - 3 source: kdbtext_1_0 - 4 | version_1_0 kdbtext_1_0_opt - 5 | version_2_0 kdbtext_2_0_opt - - 6 version_1_0: KW_version VERS_1_0 ';' - - 7 kdbtext_1_0_opt: kdbtext_1_0 - 8 | empty - - 9 kdbtext_1_0: kdbtext_1_0_decl - 10 | kdbtext_1_0 kdbtext_1_0_decl - - 11 kdbtext_1_0_decl: typedef_1_0_decl - 12 | typeset_1_0_decl - 13 | format_1_0_decl - 14 | const_1_0_decl - 15 | alias_1_0_decl - 16 | function_1_0_decl - 17 | extern_1_0_decl - 18 | script_1_0_decl - 19 | validate_1_0_decl - 20 | physical_1_0_decl - 21 | table_1_0_decl - 22 | database_1_0_decl - 23 | include_directive - 24 | ';' - - 25 typedef_1_0_decl: KW_typedef fqn_1_0 typedef_1_0_new_name_list ';' - - 26 typedef_1_0_new_name_list: typespec_1_0 - 27 | typedef_1_0_new_name_list ',' typespec_1_0 - - 28 typeset_1_0_decl: KW_typeset typeset_1_0_new_name typeset_1_0_def ';' - - 29 typeset_1_0_new_name: fqn_1_0 - - 30 typeset_1_0_def: '{' typespec_1_0_list '}' - - 31 typespec_1_0_list: typespec_1_0 - 32 | typespec_1_0_list ',' typespec_1_0 - - 33 typespec_1_0: fqn_1_0 - 34 | fqn_1_0 '[' dim_1_0 ']' - - 35 dim_1_0: expression_1_0 - 36 | '*' - - 37 format_1_0_decl: KW_fmtdef format_1_0_new_name ';' - 38 | KW_fmtdef format_1_0_name format_1_0_new_name ';' - - 39 format_1_0_new_name: fqn_1_0 - - 40 format_1_0_name: fqn_1_0 - - 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 '=' expression_1_0 ';' - - 42 alias_1_0_decl: KW_alias fqn_1_0 alias_1_0_new_name ';' - - 43 alias_1_0_new_name: fqn_1_0 - - 44 function_1_0_decl: KW_function func_1_0_decl - - 45 func_1_0_decl: untyped_func_1_0_decl - 46 | row_length_func_1_0_decl - 47 | opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue - - 48 untyped_func_1_0_decl: KW___untyped fqn_1_0 '(' ')' - - 49 row_length_func_1_0_decl: KW___row_length fqn_1_0 '(' ')' - - 50 opt_func_1_0_kdbtext_sig: empty - 51 | func_1_0_kdbtext_sig - - 52 func_1_0_kdbtext_sig: '<' func_1_0_kdbtext_formals '>' - - 53 func_1_0_kdbtext_formals: func_1_0_kdbtext_formal - 54 | func_1_0_kdbtext_formals ',' func_1_0_kdbtext_formal - - 55 func_1_0_kdbtext_formal: KW_type ident_1_0 - 56 | type_expr_1_0 ident_1_0 - - 57 func_1_0_return_type: KW_void - 58 | type_expr_1_0 - - 59 opt_func_1_0_fact_sig: empty - 60 | func_1_0_fact_sig - - 61 func_1_0_fact_sig: '<' func_1_0_fact_signature '>' - - 62 func_1_0_fact_signature: empty - 63 | func_1_0_fact_params func_1_0_vararg_formals - 64 | '*' func_1_0_fact_params func_1_0_vararg_formals - 65 | func_1_0_fact_params '*' func_1_0_fact_params func_1_0_vararg_formals - 66 | func_1_0_fact_params ',' '*' func_1_0_fact_params func_1_0_vararg_formals - - 67 func_1_0_fact_params: fact_param_1_0 - 68 | func_1_0_fact_params ',' fact_param_1_0 - - 69 fact_param_1_0: typespec_1_0 IDENTIFIER_1_0 - - 70 func_1_0_param_sig: '(' func_1_0_param_signature ')' - - 71 func_1_0_param_signature: empty - 72 | func_1_0_formal_params func_1_0_vararg_formals - 73 | '*' func_1_0_formal_params func_1_0_vararg_formals - 74 | func_1_0_formal_params '*' func_1_0_formal_params func_1_0_vararg_formals - 75 | func_1_0_formal_params ',' '*' func_1_0_formal_params func_1_0_vararg_formals - - 76 func_1_0_formal_params: formal_param_1_0 - 77 | func_1_0_formal_params ',' formal_param_1_0 - - 78 formal_param_1_0: typespec_1_0 IDENTIFIER_1_0 - 79 | KW_control typespec_1_0 IDENTIFIER_1_0 - - 80 func_1_0_vararg_formals: empty - 81 | ',' ELLIPSIS - - 82 func_1_0_prologue: ';' - 83 | '=' fqn_1_0 ';' - 84 | '{' script_1_0_stmt_seq '}' - - 85 script_1_0_stmt_seq: script_1_0_stmt - 86 | script_1_0_stmt_seq script_1_0_stmt - - 87 script_1_0_stmt: KW_return cond_expr_1_0 ';' - 88 | type_expr_1_0 ident_1_0 '=' cond_expr_1_0 ';' - - 89 extern_1_0_decl: KW_extern ext_func_1_0_decl - - 90 ext_func_1_0_decl: function_1_0_decl - - 91 script_1_0_decl: KW_kdbtext func_1_0_decl - 92 | KW_kdbtext KW_function func_1_0_decl - - 93 validate_1_0_decl: KW_validate function_1_0_decl - - 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue - - 95 phys_1_0_return_type: func_1_0_return_type - 96 | KW___no_header func_1_0_return_type - - 97 phys_1_0_prologue: '=' phys_1_0_stmt - 98 | '{' phys_1_0_body '}' - - 99 phys_1_0_body: phys_1_0_body_stmt - 100 | phys_1_0_body phys_1_0_body_stmt - - 101 phys_1_0_body_stmt: ';' - 102 | KW_decode phys_1_0_stmt - 103 | KW_encode phys_1_0_stmt - 104 | KW___row_length '=' fqn_1_0 '(' ')' - - 105 phys_1_0_stmt: '{' script_1_0_stmt_seq '}' - - 106 table_1_0_decl: KW_table fqn_vers opt_tbl_1_0_parents tbl_1_0_body - - 107 opt_tbl_1_0_parents: empty - 108 | '=' tbl_1_0_parents - - 109 tbl_1_0_parents: fqn_opt_vers - 110 | tbl_1_0_parents ',' fqn_opt_vers - - 111 tbl_1_0_body: '{' tbl_1_0_stmt_seq '}' - 112 | '{' '}' - - 113 tbl_1_0_stmt_seq: tbl_1_0_stmt - 114 | tbl_1_0_stmt_seq tbl_1_0_stmt - - 115 tbl_1_0_stmt: production_1_0_stmt - 116 | col_1_0_modifiers col_1_0_decl - 117 | KW_column KW_limit '=' expression_1_0 ';' - 118 | KW_column KW_default KW_limit '=' expression_1_0 ';' - 119 | KW_static physmbr_1_0_decl - 120 | KW_physical physmbr_1_0_decl - 121 | KW_static KW_physical physmbr_1_0_decl - 122 | default_view_1_0_decl - 123 | KW___untyped '=' fqn_1_0 '(' ')' ';' - 124 | ';' - - 125 production_1_0_stmt: typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' - 126 | KW_trigger ident_1_0 '=' cond_expr_1_0 ';' - - 127 col_1_0_modifiers: KW_column - 128 | col_1_0_modifier_seq KW_column - - 129 col_1_0_modifier_seq: col_1_0_modifier - 130 | col_1_0_modifier_seq col_1_0_modifier - - 131 col_1_0_modifier: KW_default - 132 | KW_extern - 133 | KW_readonly - - 134 col_1_0_decl: typespec_1_0 typed_column_decl_1_0 - 135 | phys_enc_ref typed_column_decl_1_0 - - 136 phys_enc_ref: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 - 137 | fqn_vers opt_factory_parms_1_0 - 138 | fqn_1_0 factory_parms_1_0 - - 139 typed_column_decl_1_0: col_ident '{' opt_column_body_1_0 '}' - 140 | col_ident '=' cond_expr_1_0 ';' - 141 | col_ident ';' - - 142 col_ident: ident_1_0 - 143 | phys_ident - - 144 phys_ident: PHYSICAL_IDENTIFIER_1_0 - - 145 opt_column_body_1_0: empty - 146 | column_body_1_0 - - 147 column_body_1_0: column_stmt_1_0 - 148 | column_body_1_0 column_stmt_1_0 - - 149 column_stmt_1_0: KW_read '=' cond_expr_1_0 ';' - 150 | KW_validate '=' cond_expr_1_0 ';' - 151 | KW_limit '=' uint_expr_1_0 ';' - 152 | ';' - - 153 default_view_1_0_decl: KW_default KW_view STRING ';' - - 154 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' - 155 | phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' - 156 | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' - 157 | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' - - 158 phys_coldef_1_0: opt_col_kdbtext_parms_1_0 fqn_opt_vers opt_factory_parms_1_0 - - 159 opt_col_kdbtext_parms_1_0: empty - 160 | '<' col_kdbtext_parms_1_0 '>' - - 161 col_kdbtext_parms_1_0: col_kdbtext_parm_1_0 - 162 | col_kdbtext_parms_1_0 ',' col_kdbtext_parm_1_0 - - 163 col_kdbtext_parm_1_0: fqn_1_0 '=' col_kdbtext_value_1_0 - 164 | col_kdbtext_value_1_0 - - 165 col_kdbtext_value_1_0: fqn_1_0 - 166 | uint_expr_1_0 - - 167 cond_expr_1_0: expression_1_0 - 168 | cond_expr_1_0 '|' expression_1_0 - - 169 expression_1_0: primary_expr_1_0 - 170 | '(' type_expr_1_0 ')' expression_1_0 - - 171 primary_expr_1_0: fqn_1_0 - 172 | phys_ident - 173 | '@' - 174 | func_expr_1_0 - 175 | uint_expr_1_0 - 176 | float_expr_1_0 - 177 | string_expr_1_0 - 178 | const_vect_expr_1_0 - 179 | bool_expr_1_0 - 180 | '-' expression_1_0 - 181 | '+' expression_1_0 - 182 | member_expr_2_0 - 183 | join_expr_2_0 - - 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' - 185 | fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' - - 186 kdbtext_parms_1_0: kdbtext_parm_1_0 - 187 | kdbtext_parms_1_0 ',' kdbtext_parm_1_0 - - 188 kdbtext_parm_1_0: fqn_1_0 - 189 | fqn_1_0 '[' dim_1_0 ']' - 190 | uint_expr_1_0 - - 191 opt_factory_parms_1_0: empty - 192 | factory_parms_1_0 - - 193 factory_parms_1_0: '<' factory_parms '>' - - 194 factory_parms: expression_1_0 - 195 | factory_parms ',' expression_1_0 - - 196 opt_func_1_0_parms: empty - 197 | func_1_0_parms - - 198 func_1_0_parms: expression_1_0 - 199 | func_1_0_parms ',' expression_1_0 - - 200 uint_expr_1_0: DECIMAL - 201 | HEX - 202 | OCTAL - - 203 float_expr_1_0: FLOAT_ - 204 | EXP_FLOAT - - 205 string_expr_1_0: STRING - 206 | ESCAPED_STRING - - 207 const_vect_expr_1_0: '[' opt_const_vect_exprlist_1_0 ']' - - 208 opt_const_vect_exprlist_1_0: empty - 209 | const_vect_exprlist_1_0 - - 210 const_vect_exprlist_1_0: expression_1_0 - 211 | const_vect_exprlist_1_0 ',' expression_1_0 - - 212 bool_expr_1_0: KW_true - 213 | KW_false - - 214 type_expr_1_0: typespec_1_0 - 215 | fqn_1_0 '/' fqn_1_0 - - 216 member_expr_2_0: ident_1_0 '.' ident_1_0 - 217 | ident_1_0 PHYSICAL_IDENTIFIER_1_0 - - 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' '.' ident_1_0 - 219 | ident_1_0 '[' cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 - - 220 database_1_0_decl: KW_database fqn_vers opt_database_dad_1_0 database_body_1_0 - - 221 opt_database_dad_1_0: empty - 222 | '=' fqn_opt_vers - - 223 database_body_1_0: '{' '}' - 224 | '{' database_members_1_0 '}' - - 225 database_members_1_0: database_member_1_0 - 226 | database_members_1_0 database_member_1_0 - - 227 database_member_1_0: db_member_1_0 - 228 | table_member_1_0 - 229 | alias_member_1_0 - 230 | ';' - - 231 opt_template_1_0: empty - 232 | KW_template - - 233 db_member_1_0: opt_template_1_0 KW_database fqn_opt_vers ident_1_0 ';' - - 234 table_member_1_0: opt_template_1_0 KW_table fqn_opt_vers ident_1_0 ';' - - 235 alias_member_1_0: KW_alias view_spec ident_1_0 ';' - - 236 view_spec: fqn_opt_vers '<' view_parms '>' - - 237 view_parms: ident_1_0 - 238 | view_parms ',' ident_1_0 - - 239 include_directive: KW_include STRING - - 240 fqn_1_0: ident_1_0 - 241 | fqn_1_0 ':' ident_1_0 - 242 | fqn_1_0 ':' KW_database - 243 | fqn_1_0 ':' KW_decode - 244 | fqn_1_0 ':' KW_encode - 245 | fqn_1_0 ':' KW_read - 246 | fqn_1_0 ':' KW_table - 247 | fqn_1_0 ':' KW_type - 248 | fqn_1_0 ':' KW_view - 249 | fqn_1_0 ':' KW_write - - 250 ident_1_0: IDENTIFIER_1_0 - - 251 empty: %empty - - 252 fqn_vers: fqn_1_0 VERSION - - 253 fqn_opt_vers: fqn_1_0 - 254 | fqn_vers - - 255 version_2_0: KW_version VERS_2_0 ';' - - 256 kdbtext_2_0_opt: kdbtext_2_0 - 257 | empty - - 258 kdbtext_2_0: kdbtext_2_0_decl - 259 | kdbtext_2_0 kdbtext_2_0_decl - - 260 kdbtext_2_0_decl: kdbtext_1_0_decl - 261 | view_2_0_decl - - 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body '}' - - 263 view_parms: view_parm - 264 | view_parms ',' view_parm - - 265 view_parm: fqn_opt_vers ident_1_0 - - 266 opt_view_body: empty - 267 | view_body - - 268 view_body: view_member - 269 | view_body view_member - - 270 view_member: typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' - 271 | KW_column typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' - 272 | ';' - - 273 opt_view_parents: empty - 274 | '=' view_parents - - 275 view_parents: view_parent - 276 | view_parents ',' view_parent - - 277 view_parent: fqn_opt_vers '<' view_parent_parms '>' - - 278 view_parent_parms: ident_1_0 - 279 | view_parent_parms ',' ident_1_0 - - -Terminals, with rules where they appear - - "end of source" (0) 0 1 2 - '(' (40) 48 49 70 104 123 170 184 185 - ')' (41) 48 49 70 104 123 170 184 185 - '*' (42) 36 64 65 66 73 74 75 - '+' (43) 181 - ',' (44) 27 32 54 66 68 75 77 81 110 162 187 195 199 211 238 264 276 279 - '-' (45) 180 - '.' (46) 216 218 - '/' (47) 215 - ':' (58) 241 242 243 244 245 246 247 248 249 - ';' (59) 6 24 25 28 37 38 41 42 82 83 87 88 101 117 118 123 124 125 126 140 141 149 150 151 152 153 154 155 156 157 230 233 234 235 255 270 271 272 - '<' (60) 52 61 136 160 184 193 236 262 277 - '=' (61) 41 83 88 97 104 108 117 118 123 125 126 140 149 150 151 155 157 163 222 270 271 274 - '>' (62) 52 61 136 160 184 193 236 262 277 - '@' (64) 173 - '[' (91) 34 189 207 218 219 - ']' (93) 34 189 207 218 219 - '{' (123) 30 84 98 105 111 112 139 223 224 262 - '|' (124) 168 - '}' (125) 30 84 98 105 111 112 139 223 224 262 - error (256) - UNRECOGNIZED (258) - ELLIPSIS (259) 81 - INCREMENT (260) - DECIMAL (261) 200 - OCTAL (262) 202 - HEX (263) 201 - FLOAT_ (264) 203 - EXP_FLOAT (265) 204 - STRING (266) 153 205 239 - ESCAPED_STRING (267) 206 - IDENTIFIER_1_0 (268) 69 78 79 250 - PHYSICAL_IDENTIFIER_1_0 (269) 144 154 155 156 157 217 219 - VERSION (270) 252 - UNTERM_STRING (271) - UNTERM_ESCAPED_STRING (272) - VERS_1_0 (273) 6 - VERS_2_0 (274) 255 - KW___no_header (275) 96 - KW___row_length (276) 49 104 - KW___untyped (277) 48 123 - KW_alias (278) 42 235 - KW_column (279) 117 118 127 128 156 157 271 - KW_const (280) 41 - KW_control (281) 79 - KW_database (282) 220 233 242 - KW_decode (283) 102 243 - KW_default (284) 118 131 153 - KW_encode (285) 103 244 - KW_extern (286) 89 132 - KW_false (287) 213 - KW_fmtdef (288) 37 38 - KW_function (289) 44 92 - KW_include (290) 239 - KW_limit (291) 117 118 151 - KW_physical (292) 94 120 121 - KW_read (293) 149 245 - KW_readonly (294) 133 - KW_return (295) 87 - KW_kdbtext (296) 91 92 - KW_static (297) 119 121 - KW_table (298) 106 234 246 - KW_template (299) 232 - KW_trigger (300) 126 - KW_true (301) 212 - KW_type (302) 55 247 - KW_typedef (303) 25 - KW_typeset (304) 28 - KW_validate (305) 93 150 - KW_version (306) 6 255 - KW_view (307) 153 248 262 - KW_virtual (308) - KW_void (309) 57 - KW_write (310) 249 - PT_ASTLIST (311) - PT_PARSE (312) - PT_SOURCE (313) - PT_VERSION_1_0 (314) - PT_VERSION_2 (315) - PT_SCHEMA_1_0 (316) - PT_SCHEMA_2_0 (317) - PT_INCLUDE (318) - PT_TYPEDEF (319) - PT_FQN (320) - PT_IDENT (321) - PT_PHYSIDENT (322) - PT_UINT (323) - PT_TYPESET (324) - PT_TYPESETDEF (325) - PT_FORMAT (326) - PT_CONST (327) - PT_ALIAS (328) - PT_EXTERN (329) - PT_FUNCTION (330) - PT_UNTYPED (331) - PT_ROWLENGTH (332) - PT_FUNCDECL (333) - PT_EMPTY (334) - PT_SCHEMASIG (335) - PT_SCHEMAFORMAL (336) - PT_RETURNTYPE (337) - PT_FACTSIG (338) - PT_FUNCSIG (339) - PT_FUNCPARAMS (340) - PT_FORMALPARAM (341) - PT_ELLIPSIS (342) - PT_FUNCPROLOGUE (343) - PT_RETURN (344) - PT_PRODSTMT (345) - PT_PRODTRIGGER (346) - PT_SCHEMA (347) - PT_VALIDATE (348) - PT_PHYSICAL (349) - PT_PHYSPROLOGUE (350) - PT_PHYSSTMT (351) - PT_PHYSBODYSTMT (352) - PT_TABLE (353) - PT_TABLEPARENTS (354) - PT_TABLEBODY (355) - PT_FUNCEXPR (356) - PT_FACTPARMS (357) - PT_COLUMN (358) - PT_COLUMNEXPR (359) - PT_COLDECL (360) - PT_TYPEDCOL (361) - PT_COLSTMT (362) - PT_DFLTVIEW (363) - PT_PHYSMBR (364) - PT_PHYSCOL (365) - PT_PHYSCOLDEF (366) - PT_COLSCHEMAPARMS (367) - PT_COLSCHEMAPARAM (368) - PT_COLUNTYPED (369) - PT_DATABASE (370) - PT_TYPEEXPR (371) - PT_DBBODY (372) - PT_DBDAD (373) - PT_DBMEMBER (374) - PT_TBLMEMBER (375) - PT_NOHEADER (376) - PT_CASTEXPR (377) - PT_CONSTVECT (378) - PT_NEGATE (379) - PT_UNARYPLUS (380) - PT_VERSNAME (381) - PT_ARRAY (382) - PT_PHYSENCREF (383) - PT_TYPEDCOLEXPR (384) - PT_VIEW (385) - PT_VIEWPARAM (386) - PT_VIEWPARENTS (387) - PT_VIEWPARENT (388) - PT_MEMBEREXPR (389) - PT_JOINEXPR (390) - PT_ALIASMEMBER (391) - PT_VIEWSPEC (392) - - -Nonterminals, with rules where they appear - - $accept (157) - on left: 0 - parse (158) - on left: 1 2 - on right: 0 - source (159) - on left: 3 4 5 - on right: 2 - version_1_0 (160) - on left: 6 - on right: 4 - kdbtext_1_0_opt (161) - on left: 7 8 - on right: 4 - kdbtext_1_0 (162) - on left: 9 10 - on right: 3 7 10 - kdbtext_1_0_decl (163) - on left: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 - on right: 9 10 260 - typedef_1_0_decl (164) - on left: 25 - on right: 11 - typedef_1_0_new_name_list (165) - on left: 26 27 - on right: 25 27 - typeset_1_0_decl (166) - on left: 28 - on right: 12 - typeset_1_0_new_name (167) - on left: 29 - on right: 28 - typeset_1_0_def (168) - on left: 30 - on right: 28 - typespec_1_0_list (169) - on left: 31 32 - on right: 30 32 - typespec_1_0 (170) - on left: 33 34 - on right: 26 27 31 32 41 69 78 79 125 134 214 270 271 - dim_1_0 (171) - on left: 35 36 - on right: 34 189 - format_1_0_decl (172) - on left: 37 38 - on right: 13 - format_1_0_new_name (173) - on left: 39 - on right: 37 38 - format_1_0_name (174) - on left: 40 - on right: 38 - const_1_0_decl (175) - on left: 41 - on right: 14 - alias_1_0_decl (176) - on left: 42 - on right: 15 - alias_1_0_new_name (177) - on left: 43 - on right: 42 - function_1_0_decl (178) - on left: 44 - on right: 16 90 93 - func_1_0_decl (179) - on left: 45 46 47 - on right: 44 91 92 - untyped_func_1_0_decl (180) - on left: 48 - on right: 45 - row_length_func_1_0_decl (181) - on left: 49 - on right: 46 - opt_func_1_0_kdbtext_sig (182) - on left: 50 51 - on right: 47 94 - func_1_0_kdbtext_sig (183) - on left: 52 - on right: 51 - func_1_0_kdbtext_formals (184) - on left: 53 54 - on right: 52 54 - func_1_0_kdbtext_formal (185) - on left: 55 56 - on right: 53 54 - func_1_0_return_type (186) - on left: 57 58 - on right: 47 95 96 - opt_func_1_0_fact_sig (187) - on left: 59 60 - on right: 47 94 - func_1_0_fact_sig (188) - on left: 61 - on right: 60 - func_1_0_fact_signature (189) - on left: 62 63 64 65 66 - on right: 61 - func_1_0_fact_params (190) - on left: 67 68 - on right: 63 64 65 66 68 - fact_param_1_0 (191) - on left: 69 - on right: 67 68 - func_1_0_param_sig (192) - on left: 70 - on right: 47 - func_1_0_param_signature (193) - on left: 71 72 73 74 75 - on right: 70 - func_1_0_formal_params (194) - on left: 76 77 - on right: 72 73 74 75 77 - formal_param_1_0 (195) - on left: 78 79 - on right: 76 77 - func_1_0_vararg_formals (196) - on left: 80 81 - on right: 63 64 65 66 72 73 74 75 - func_1_0_prologue (197) - on left: 82 83 84 - on right: 47 - script_1_0_stmt_seq (198) - on left: 85 86 - on right: 84 86 105 - script_1_0_stmt (199) - on left: 87 88 - on right: 85 86 - extern_1_0_decl (200) - on left: 89 - on right: 17 - ext_func_1_0_decl (201) - on left: 90 - on right: 89 - script_1_0_decl (202) - on left: 91 92 - on right: 18 - validate_1_0_decl (203) - on left: 93 - on right: 19 - physical_1_0_decl (204) - on left: 94 - on right: 20 - phys_1_0_return_type (205) - on left: 95 96 - on right: 94 - phys_1_0_prologue (206) - on left: 97 98 - on right: 94 - phys_1_0_body (207) - on left: 99 100 - on right: 98 100 - phys_1_0_body_stmt (208) - on left: 101 102 103 104 - on right: 99 100 - phys_1_0_stmt (209) - on left: 105 - on right: 97 102 103 - table_1_0_decl (210) - on left: 106 - on right: 21 - opt_tbl_1_0_parents (211) - on left: 107 108 - on right: 106 - tbl_1_0_parents (212) - on left: 109 110 - on right: 108 110 - tbl_1_0_body (213) - on left: 111 112 - on right: 106 - tbl_1_0_stmt_seq (214) - on left: 113 114 - on right: 111 114 - tbl_1_0_stmt (215) - on left: 115 116 117 118 119 120 121 122 123 124 - on right: 113 114 - production_1_0_stmt (216) - on left: 125 126 - on right: 115 - col_1_0_modifiers (217) - on left: 127 128 - on right: 116 - col_1_0_modifier_seq (218) - on left: 129 130 - on right: 128 130 - col_1_0_modifier (219) - on left: 131 132 133 - on right: 129 130 - col_1_0_decl (220) - on left: 134 135 - on right: 116 - phys_enc_ref (221) - on left: 136 137 138 - on right: 135 - typed_column_decl_1_0 (222) - on left: 139 140 141 - on right: 134 135 - col_ident (223) - on left: 142 143 - on right: 139 140 141 - phys_ident (224) - on left: 144 - on right: 143 172 - opt_column_body_1_0 (225) - on left: 145 146 - on right: 139 - column_body_1_0 (226) - on left: 147 148 - on right: 146 148 - column_stmt_1_0 (227) - on left: 149 150 151 152 - on right: 147 148 - default_view_1_0_decl (228) - on left: 153 - on right: 122 - physmbr_1_0_decl (229) - on left: 154 155 156 157 - on right: 119 120 121 - phys_coldef_1_0 (230) - on left: 158 - on right: 154 155 156 157 - opt_col_kdbtext_parms_1_0 (231) - on left: 159 160 - on right: 158 - col_kdbtext_parms_1_0 (232) - on left: 161 162 - on right: 160 162 - col_kdbtext_parm_1_0 (233) - on left: 163 164 - on right: 161 162 - col_kdbtext_value_1_0 (234) - on left: 165 166 - on right: 163 164 - cond_expr_1_0 (235) - on left: 167 168 - on right: 87 88 125 126 140 149 150 155 157 168 218 219 270 271 - expression_1_0 (236) - on left: 169 170 - on right: 35 41 117 118 167 168 170 180 181 194 195 198 199 210 211 - primary_expr_1_0 (237) - on left: 171 172 173 174 175 176 177 178 179 180 181 182 183 - on right: 169 - func_expr_1_0 (238) - on left: 184 185 - on right: 174 - kdbtext_parms_1_0 (239) - on left: 186 187 - on right: 136 184 187 - kdbtext_parm_1_0 (240) - on left: 188 189 190 - on right: 186 187 - opt_factory_parms_1_0 (241) - on left: 191 192 - on right: 136 137 158 184 185 - factory_parms_1_0 (242) - on left: 193 - on right: 138 192 - factory_parms (243) - on left: 194 195 - on right: 193 195 - opt_func_1_0_parms (244) - on left: 196 197 - on right: 184 185 - func_1_0_parms (245) - on left: 198 199 - on right: 197 199 - uint_expr_1_0 (246) - on left: 200 201 202 - on right: 151 166 175 190 - float_expr_1_0 (247) - on left: 203 204 - on right: 176 - string_expr_1_0 (248) - on left: 205 206 - on right: 177 - const_vect_expr_1_0 (249) - on left: 207 - on right: 178 - opt_const_vect_exprlist_1_0 (250) - on left: 208 209 - on right: 207 - const_vect_exprlist_1_0 (251) - on left: 210 211 - on right: 209 211 - bool_expr_1_0 (252) - on left: 212 213 - on right: 179 - type_expr_1_0 (253) - on left: 214 215 - on right: 56 58 88 170 - member_expr_2_0 (254) - on left: 216 217 - on right: 182 - join_expr_2_0 (255) - on left: 218 219 - on right: 183 - database_1_0_decl (256) - on left: 220 - on right: 22 - opt_database_dad_1_0 (257) - on left: 221 222 - on right: 220 - database_body_1_0 (258) - on left: 223 224 - on right: 220 - database_members_1_0 (259) - on left: 225 226 - on right: 224 226 - database_member_1_0 (260) - on left: 227 228 229 230 - on right: 225 226 - opt_template_1_0 (261) - on left: 231 232 - on right: 233 234 - db_member_1_0 (262) - on left: 233 - on right: 227 - table_member_1_0 (263) - on left: 234 - on right: 228 - alias_member_1_0 (264) - on left: 235 - on right: 229 - view_spec (265) - on left: 236 - on right: 235 - view_parms (266) - on left: 237 238 263 264 - on right: 236 238 262 264 - include_directive (267) - on left: 239 - on right: 23 - fqn_1_0 (268) - on left: 240 241 242 243 244 245 246 247 248 249 - on right: 25 29 33 34 39 40 41 42 43 48 49 83 104 123 138 163 165 171 188 189 215 241 242 243 244 245 246 247 248 249 252 253 - ident_1_0 (269) - on left: 250 - on right: 55 56 88 125 126 142 216 217 218 219 233 234 235 237 238 240 241 265 270 271 278 279 - empty (270) - on left: 251 - on right: 8 50 59 62 71 80 107 145 159 191 196 208 221 231 257 266 273 - fqn_vers (271) - on left: 252 - on right: 94 106 137 220 254 262 - fqn_opt_vers (272) - on left: 253 254 - on right: 47 109 110 136 158 184 185 222 233 234 236 265 277 - version_2_0 (273) - on left: 255 - on right: 5 - kdbtext_2_0_opt (274) - on left: 256 257 - on right: 5 - kdbtext_2_0 (275) - on left: 258 259 - on right: 256 259 - kdbtext_2_0_decl (276) - on left: 260 261 - on right: 258 259 - view_2_0_decl (277) - on left: 262 - on right: 261 - view_parm (278) - on left: 265 - on right: 263 264 - opt_view_body (279) - on left: 266 267 - on right: 262 - view_body (280) - on left: 268 269 - on right: 267 269 - view_member (281) - on left: 270 271 272 - on right: 268 269 - opt_view_parents (282) - on left: 273 274 - on right: 262 - view_parents (283) - on left: 275 276 - on right: 274 276 - view_parent (284) - on left: 277 - on right: 275 276 - view_parent_parms (285) - on left: 278 279 - on right: 277 279 - - -State 0 - - 0 $accept: . parse "end of source" - - "end of source" shift, and go to state 1 - KW_alias shift, and go to state 2 - KW_const shift, and go to state 3 - KW_database shift, and go to state 4 - KW_extern shift, and go to state 5 - KW_fmtdef shift, and go to state 6 - KW_function shift, and go to state 7 - KW_include shift, and go to state 8 - KW_physical shift, and go to state 9 - KW_kdbtext shift, and go to state 10 - KW_table shift, and go to state 11 - KW_typedef shift, and go to state 12 - KW_typeset shift, and go to state 13 - KW_validate shift, and go to state 14 - KW_version shift, and go to state 15 - ';' shift, and go to state 16 - - parse go to state 17 - source go to state 18 - version_1_0 go to state 19 - kdbtext_1_0 go to state 20 - kdbtext_1_0_decl go to state 21 - typedef_1_0_decl go to state 22 - typeset_1_0_decl go to state 23 - format_1_0_decl go to state 24 - const_1_0_decl go to state 25 - alias_1_0_decl go to state 26 - function_1_0_decl go to state 27 - extern_1_0_decl go to state 28 - script_1_0_decl go to state 29 - validate_1_0_decl go to state 30 - physical_1_0_decl go to state 31 - table_1_0_decl go to state 32 - database_1_0_decl go to state 33 - include_directive go to state 34 - version_2_0 go to state 35 - - -State 1 - - 1 parse: "end of source" . - - $default reduce using rule 1 (parse) - - -State 2 - - 42 alias_1_0_decl: KW_alias . fqn_1_0 alias_1_0_new_name ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 37 - ident_1_0 go to state 38 - - -State 3 - - 41 const_1_0_decl: KW_const . typespec_1_0 fqn_1_0 '=' expression_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 39 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 4 - - 220 database_1_0_decl: KW_database . fqn_vers opt_database_dad_1_0 database_body_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 41 - ident_1_0 go to state 38 - fqn_vers go to state 42 - - -State 5 - - 89 extern_1_0_decl: KW_extern . ext_func_1_0_decl - - KW_function shift, and go to state 7 - - function_1_0_decl go to state 43 - ext_func_1_0_decl go to state 44 - - -State 6 - - 37 format_1_0_decl: KW_fmtdef . format_1_0_new_name ';' - 38 | KW_fmtdef . format_1_0_name format_1_0_new_name ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - format_1_0_new_name go to state 45 - format_1_0_name go to state 46 - fqn_1_0 go to state 47 - ident_1_0 go to state 38 - - -State 7 - - 44 function_1_0_decl: KW_function . func_1_0_decl - - KW___row_length shift, and go to state 48 - KW___untyped shift, and go to state 49 - '<' shift, and go to state 50 - - $default reduce using rule 251 (empty) - - func_1_0_decl go to state 51 - untyped_func_1_0_decl go to state 52 - row_length_func_1_0_decl go to state 53 - opt_func_1_0_kdbtext_sig go to state 54 - func_1_0_kdbtext_sig go to state 55 - empty go to state 56 - - -State 8 - - 239 include_directive: KW_include . STRING - - STRING shift, and go to state 57 - - -State 9 - - 94 physical_1_0_decl: KW_physical . opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue - - '<' shift, and go to state 50 - - $default reduce using rule 251 (empty) - - opt_func_1_0_kdbtext_sig go to state 58 - func_1_0_kdbtext_sig go to state 55 - empty go to state 56 - - -State 10 - - 91 script_1_0_decl: KW_kdbtext . func_1_0_decl - 92 | KW_kdbtext . KW_function func_1_0_decl - - KW___row_length shift, and go to state 48 - KW___untyped shift, and go to state 49 - KW_function shift, and go to state 59 - '<' shift, and go to state 50 - - $default reduce using rule 251 (empty) - - func_1_0_decl go to state 60 - untyped_func_1_0_decl go to state 52 - row_length_func_1_0_decl go to state 53 - opt_func_1_0_kdbtext_sig go to state 54 - func_1_0_kdbtext_sig go to state 55 - empty go to state 56 - - -State 11 - - 106 table_1_0_decl: KW_table . fqn_vers opt_tbl_1_0_parents tbl_1_0_body - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 41 - ident_1_0 go to state 38 - fqn_vers go to state 61 - - -State 12 - - 25 typedef_1_0_decl: KW_typedef . fqn_1_0 typedef_1_0_new_name_list ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 62 - ident_1_0 go to state 38 - - -State 13 - - 28 typeset_1_0_decl: KW_typeset . typeset_1_0_new_name typeset_1_0_def ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - typeset_1_0_new_name go to state 63 - fqn_1_0 go to state 64 - ident_1_0 go to state 38 - - -State 14 - - 93 validate_1_0_decl: KW_validate . function_1_0_decl - - KW_function shift, and go to state 7 - - function_1_0_decl go to state 65 - - -State 15 - - 6 version_1_0: KW_version . VERS_1_0 ';' - 255 version_2_0: KW_version . VERS_2_0 ';' - - VERS_1_0 shift, and go to state 66 - VERS_2_0 shift, and go to state 67 - - -State 16 - - 24 kdbtext_1_0_decl: ';' . - - $default reduce using rule 24 (kdbtext_1_0_decl) - - -State 17 - - 0 $accept: parse . "end of source" - - "end of source" shift, and go to state 68 - - -State 18 - - 2 parse: source . "end of source" - - "end of source" shift, and go to state 69 - - -State 19 - - 4 source: version_1_0 . kdbtext_1_0_opt - - KW_alias shift, and go to state 2 - KW_const shift, and go to state 3 - KW_database shift, and go to state 4 - KW_extern shift, and go to state 5 - KW_fmtdef shift, and go to state 6 - KW_function shift, and go to state 7 - KW_include shift, and go to state 8 - KW_physical shift, and go to state 9 - KW_kdbtext shift, and go to state 10 - KW_table shift, and go to state 11 - KW_typedef shift, and go to state 12 - KW_typeset shift, and go to state 13 - KW_validate shift, and go to state 14 - ';' shift, and go to state 16 - - $default reduce using rule 251 (empty) - - kdbtext_1_0_opt go to state 70 - kdbtext_1_0 go to state 71 - kdbtext_1_0_decl go to state 21 - typedef_1_0_decl go to state 22 - typeset_1_0_decl go to state 23 - format_1_0_decl go to state 24 - const_1_0_decl go to state 25 - alias_1_0_decl go to state 26 - function_1_0_decl go to state 27 - extern_1_0_decl go to state 28 - script_1_0_decl go to state 29 - validate_1_0_decl go to state 30 - physical_1_0_decl go to state 31 - table_1_0_decl go to state 32 - database_1_0_decl go to state 33 - include_directive go to state 34 - empty go to state 72 - - -State 20 - - 3 source: kdbtext_1_0 . - 10 kdbtext_1_0: kdbtext_1_0 . kdbtext_1_0_decl - - KW_alias shift, and go to state 2 - KW_const shift, and go to state 3 - KW_database shift, and go to state 4 - KW_extern shift, and go to state 5 - KW_fmtdef shift, and go to state 6 - KW_function shift, and go to state 7 - KW_include shift, and go to state 8 - KW_physical shift, and go to state 9 - KW_kdbtext shift, and go to state 10 - KW_table shift, and go to state 11 - KW_typedef shift, and go to state 12 - KW_typeset shift, and go to state 13 - KW_validate shift, and go to state 14 - ';' shift, and go to state 16 - - $default reduce using rule 3 (source) - - kdbtext_1_0_decl go to state 73 - typedef_1_0_decl go to state 22 - typeset_1_0_decl go to state 23 - format_1_0_decl go to state 24 - const_1_0_decl go to state 25 - alias_1_0_decl go to state 26 - function_1_0_decl go to state 27 - extern_1_0_decl go to state 28 - script_1_0_decl go to state 29 - validate_1_0_decl go to state 30 - physical_1_0_decl go to state 31 - table_1_0_decl go to state 32 - database_1_0_decl go to state 33 - include_directive go to state 34 - - -State 21 - - 9 kdbtext_1_0: kdbtext_1_0_decl . - - $default reduce using rule 9 (kdbtext_1_0) - - -State 22 - - 11 kdbtext_1_0_decl: typedef_1_0_decl . - - $default reduce using rule 11 (kdbtext_1_0_decl) - - -State 23 - - 12 kdbtext_1_0_decl: typeset_1_0_decl . - - $default reduce using rule 12 (kdbtext_1_0_decl) - - -State 24 - - 13 kdbtext_1_0_decl: format_1_0_decl . - - $default reduce using rule 13 (kdbtext_1_0_decl) - - -State 25 - - 14 kdbtext_1_0_decl: const_1_0_decl . - - $default reduce using rule 14 (kdbtext_1_0_decl) - - -State 26 - - 15 kdbtext_1_0_decl: alias_1_0_decl . - - $default reduce using rule 15 (kdbtext_1_0_decl) - - -State 27 - - 16 kdbtext_1_0_decl: function_1_0_decl . - - $default reduce using rule 16 (kdbtext_1_0_decl) - - -State 28 - - 17 kdbtext_1_0_decl: extern_1_0_decl . - - $default reduce using rule 17 (kdbtext_1_0_decl) - - -State 29 - - 18 kdbtext_1_0_decl: script_1_0_decl . - - $default reduce using rule 18 (kdbtext_1_0_decl) - - -State 30 - - 19 kdbtext_1_0_decl: validate_1_0_decl . - - $default reduce using rule 19 (kdbtext_1_0_decl) - - -State 31 - - 20 kdbtext_1_0_decl: physical_1_0_decl . - - $default reduce using rule 20 (kdbtext_1_0_decl) - - -State 32 - - 21 kdbtext_1_0_decl: table_1_0_decl . - - $default reduce using rule 21 (kdbtext_1_0_decl) - - -State 33 - - 22 kdbtext_1_0_decl: database_1_0_decl . - - $default reduce using rule 22 (kdbtext_1_0_decl) - - -State 34 - - 23 kdbtext_1_0_decl: include_directive . - - $default reduce using rule 23 (kdbtext_1_0_decl) - - -State 35 - - 5 source: version_2_0 . kdbtext_2_0_opt - - KW_alias shift, and go to state 2 - KW_const shift, and go to state 3 - KW_database shift, and go to state 4 - KW_extern shift, and go to state 5 - KW_fmtdef shift, and go to state 6 - KW_function shift, and go to state 7 - KW_include shift, and go to state 8 - KW_physical shift, and go to state 9 - KW_kdbtext shift, and go to state 10 - KW_table shift, and go to state 11 - KW_typedef shift, and go to state 12 - KW_typeset shift, and go to state 13 - KW_validate shift, and go to state 14 - KW_view shift, and go to state 74 - ';' shift, and go to state 16 - - $default reduce using rule 251 (empty) - - kdbtext_1_0_decl go to state 75 - typedef_1_0_decl go to state 22 - typeset_1_0_decl go to state 23 - format_1_0_decl go to state 24 - const_1_0_decl go to state 25 - alias_1_0_decl go to state 26 - function_1_0_decl go to state 27 - extern_1_0_decl go to state 28 - script_1_0_decl go to state 29 - validate_1_0_decl go to state 30 - physical_1_0_decl go to state 31 - table_1_0_decl go to state 32 - database_1_0_decl go to state 33 - include_directive go to state 34 - empty go to state 76 - kdbtext_2_0_opt go to state 77 - kdbtext_2_0 go to state 78 - kdbtext_2_0_decl go to state 79 - view_2_0_decl go to state 80 - - -State 36 - - 250 ident_1_0: IDENTIFIER_1_0 . - - $default reduce using rule 250 (ident_1_0) - - -State 37 - - 42 alias_1_0_decl: KW_alias fqn_1_0 . alias_1_0_new_name ';' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - IDENTIFIER_1_0 shift, and go to state 36 - ':' shift, and go to state 81 - - alias_1_0_new_name go to state 82 - fqn_1_0 go to state 83 - ident_1_0 go to state 38 - - -State 38 - - 240 fqn_1_0: ident_1_0 . - - $default reduce using rule 240 (fqn_1_0) - - -State 39 - - 41 const_1_0_decl: KW_const typespec_1_0 . fqn_1_0 '=' expression_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 84 - ident_1_0 go to state 38 - - -State 40 - - 33 typespec_1_0: fqn_1_0 . - 34 | fqn_1_0 . '[' dim_1_0 ']' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '[' shift, and go to state 85 - ':' shift, and go to state 81 - - $default reduce using rule 33 (typespec_1_0) - - -State 41 - - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - 252 fqn_vers: fqn_1_0 . VERSION - - VERSION shift, and go to state 86 - ':' shift, and go to state 81 - - -State 42 - - 220 database_1_0_decl: KW_database fqn_vers . opt_database_dad_1_0 database_body_1_0 - - '=' shift, and go to state 87 - - $default reduce using rule 251 (empty) - - opt_database_dad_1_0 go to state 88 - empty go to state 89 - - -State 43 - - 90 ext_func_1_0_decl: function_1_0_decl . - - $default reduce using rule 90 (ext_func_1_0_decl) - - -State 44 - - 89 extern_1_0_decl: KW_extern ext_func_1_0_decl . - - $default reduce using rule 89 (extern_1_0_decl) - - -State 45 - - 37 format_1_0_decl: KW_fmtdef format_1_0_new_name . ';' - - ';' shift, and go to state 90 - - -State 46 - - 38 format_1_0_decl: KW_fmtdef format_1_0_name . format_1_0_new_name ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - format_1_0_new_name go to state 91 - fqn_1_0 go to state 92 - ident_1_0 go to state 38 - - -State 47 - - 39 format_1_0_new_name: fqn_1_0 . - 40 format_1_0_name: fqn_1_0 . - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - ':' shift, and go to state 81 - - IDENTIFIER_1_0 reduce using rule 40 (format_1_0_name) - $default reduce using rule 39 (format_1_0_new_name) - - -State 48 - - 49 row_length_func_1_0_decl: KW___row_length . fqn_1_0 '(' ')' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 93 - ident_1_0 go to state 38 - - -State 49 - - 48 untyped_func_1_0_decl: KW___untyped . fqn_1_0 '(' ')' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 94 - ident_1_0 go to state 38 - - -State 50 - - 52 func_1_0_kdbtext_sig: '<' . func_1_0_kdbtext_formals '>' - - IDENTIFIER_1_0 shift, and go to state 36 - KW_type shift, and go to state 95 - - typespec_1_0 go to state 96 - func_1_0_kdbtext_formals go to state 97 - func_1_0_kdbtext_formal go to state 98 - type_expr_1_0 go to state 99 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 51 - - 44 function_1_0_decl: KW_function func_1_0_decl . - - $default reduce using rule 44 (function_1_0_decl) - - -State 52 - - 45 func_1_0_decl: untyped_func_1_0_decl . - - $default reduce using rule 45 (func_1_0_decl) - - -State 53 - - 46 func_1_0_decl: row_length_func_1_0_decl . - - $default reduce using rule 46 (func_1_0_decl) - - -State 54 - - 47 func_1_0_decl: opt_func_1_0_kdbtext_sig . func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue - - IDENTIFIER_1_0 shift, and go to state 36 - KW_void shift, and go to state 101 - - typespec_1_0 go to state 96 - func_1_0_return_type go to state 102 - type_expr_1_0 go to state 103 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 55 - - 51 opt_func_1_0_kdbtext_sig: func_1_0_kdbtext_sig . - - $default reduce using rule 51 (opt_func_1_0_kdbtext_sig) - - -State 56 - - 50 opt_func_1_0_kdbtext_sig: empty . - - $default reduce using rule 50 (opt_func_1_0_kdbtext_sig) - - -State 57 - - 239 include_directive: KW_include STRING . - - $default reduce using rule 239 (include_directive) - - -State 58 - - 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig . phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue - - IDENTIFIER_1_0 shift, and go to state 36 - KW___no_header shift, and go to state 104 - KW_void shift, and go to state 101 - - typespec_1_0 go to state 96 - func_1_0_return_type go to state 105 - phys_1_0_return_type go to state 106 - type_expr_1_0 go to state 103 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 59 - - 92 script_1_0_decl: KW_kdbtext KW_function . func_1_0_decl - - KW___row_length shift, and go to state 48 - KW___untyped shift, and go to state 49 - '<' shift, and go to state 50 - - $default reduce using rule 251 (empty) - - func_1_0_decl go to state 107 - untyped_func_1_0_decl go to state 52 - row_length_func_1_0_decl go to state 53 - opt_func_1_0_kdbtext_sig go to state 54 - func_1_0_kdbtext_sig go to state 55 - empty go to state 56 - - -State 60 - - 91 script_1_0_decl: KW_kdbtext func_1_0_decl . - - $default reduce using rule 91 (script_1_0_decl) - - -State 61 - - 106 table_1_0_decl: KW_table fqn_vers . opt_tbl_1_0_parents tbl_1_0_body - - '=' shift, and go to state 108 - - $default reduce using rule 251 (empty) - - opt_tbl_1_0_parents go to state 109 - empty go to state 110 - - -State 62 - - 25 typedef_1_0_decl: KW_typedef fqn_1_0 . typedef_1_0_new_name_list ';' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - IDENTIFIER_1_0 shift, and go to state 36 - ':' shift, and go to state 81 - - typedef_1_0_new_name_list go to state 111 - typespec_1_0 go to state 112 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 63 - - 28 typeset_1_0_decl: KW_typeset typeset_1_0_new_name . typeset_1_0_def ';' - - '{' shift, and go to state 113 - - typeset_1_0_def go to state 114 - - -State 64 - - 29 typeset_1_0_new_name: fqn_1_0 . - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - ':' shift, and go to state 81 - - $default reduce using rule 29 (typeset_1_0_new_name) - - -State 65 - - 93 validate_1_0_decl: KW_validate function_1_0_decl . - - $default reduce using rule 93 (validate_1_0_decl) - - -State 66 - - 6 version_1_0: KW_version VERS_1_0 . ';' - - ';' shift, and go to state 115 - - -State 67 - - 255 version_2_0: KW_version VERS_2_0 . ';' - - ';' shift, and go to state 116 - - -State 68 - - 0 $accept: parse "end of source" . - - $default accept - - -State 69 - - 2 parse: source "end of source" . - - $default reduce using rule 2 (parse) - - -State 70 - - 4 source: version_1_0 kdbtext_1_0_opt . - - $default reduce using rule 4 (source) - - -State 71 - - 7 kdbtext_1_0_opt: kdbtext_1_0 . - 10 kdbtext_1_0: kdbtext_1_0 . kdbtext_1_0_decl - - KW_alias shift, and go to state 2 - KW_const shift, and go to state 3 - KW_database shift, and go to state 4 - KW_extern shift, and go to state 5 - KW_fmtdef shift, and go to state 6 - KW_function shift, and go to state 7 - KW_include shift, and go to state 8 - KW_physical shift, and go to state 9 - KW_kdbtext shift, and go to state 10 - KW_table shift, and go to state 11 - KW_typedef shift, and go to state 12 - KW_typeset shift, and go to state 13 - KW_validate shift, and go to state 14 - ';' shift, and go to state 16 - - $default reduce using rule 7 (kdbtext_1_0_opt) - - kdbtext_1_0_decl go to state 73 - typedef_1_0_decl go to state 22 - typeset_1_0_decl go to state 23 - format_1_0_decl go to state 24 - const_1_0_decl go to state 25 - alias_1_0_decl go to state 26 - function_1_0_decl go to state 27 - extern_1_0_decl go to state 28 - script_1_0_decl go to state 29 - validate_1_0_decl go to state 30 - physical_1_0_decl go to state 31 - table_1_0_decl go to state 32 - database_1_0_decl go to state 33 - include_directive go to state 34 - - -State 72 - - 8 kdbtext_1_0_opt: empty . - - $default reduce using rule 8 (kdbtext_1_0_opt) - - -State 73 - - 10 kdbtext_1_0: kdbtext_1_0 kdbtext_1_0_decl . - - $default reduce using rule 10 (kdbtext_1_0) - - -State 74 - - 262 view_2_0_decl: KW_view . fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body '}' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 41 - ident_1_0 go to state 38 - fqn_vers go to state 117 - - -State 75 - - 260 kdbtext_2_0_decl: kdbtext_1_0_decl . - - $default reduce using rule 260 (kdbtext_2_0_decl) - - -State 76 - - 257 kdbtext_2_0_opt: empty . - - $default reduce using rule 257 (kdbtext_2_0_opt) - - -State 77 - - 5 source: version_2_0 kdbtext_2_0_opt . - - $default reduce using rule 5 (source) - - -State 78 - - 256 kdbtext_2_0_opt: kdbtext_2_0 . - 259 kdbtext_2_0: kdbtext_2_0 . kdbtext_2_0_decl - - KW_alias shift, and go to state 2 - KW_const shift, and go to state 3 - KW_database shift, and go to state 4 - KW_extern shift, and go to state 5 - KW_fmtdef shift, and go to state 6 - KW_function shift, and go to state 7 - KW_include shift, and go to state 8 - KW_physical shift, and go to state 9 - KW_kdbtext shift, and go to state 10 - KW_table shift, and go to state 11 - KW_typedef shift, and go to state 12 - KW_typeset shift, and go to state 13 - KW_validate shift, and go to state 14 - KW_view shift, and go to state 74 - ';' shift, and go to state 16 - - $default reduce using rule 256 (kdbtext_2_0_opt) - - kdbtext_1_0_decl go to state 75 - typedef_1_0_decl go to state 22 - typeset_1_0_decl go to state 23 - format_1_0_decl go to state 24 - const_1_0_decl go to state 25 - alias_1_0_decl go to state 26 - function_1_0_decl go to state 27 - extern_1_0_decl go to state 28 - script_1_0_decl go to state 29 - validate_1_0_decl go to state 30 - physical_1_0_decl go to state 31 - table_1_0_decl go to state 32 - database_1_0_decl go to state 33 - include_directive go to state 34 - kdbtext_2_0_decl go to state 118 - view_2_0_decl go to state 80 - - -State 79 - - 258 kdbtext_2_0: kdbtext_2_0_decl . - - $default reduce using rule 258 (kdbtext_2_0) - - -State 80 - - 261 kdbtext_2_0_decl: view_2_0_decl . - - $default reduce using rule 261 (kdbtext_2_0_decl) - - -State 81 - - 241 fqn_1_0: fqn_1_0 ':' . ident_1_0 - 242 | fqn_1_0 ':' . KW_database - 243 | fqn_1_0 ':' . KW_decode - 244 | fqn_1_0 ':' . KW_encode - 245 | fqn_1_0 ':' . KW_read - 246 | fqn_1_0 ':' . KW_table - 247 | fqn_1_0 ':' . KW_type - 248 | fqn_1_0 ':' . KW_view - 249 | fqn_1_0 ':' . KW_write - - IDENTIFIER_1_0 shift, and go to state 36 - KW_database shift, and go to state 119 - KW_decode shift, and go to state 120 - KW_encode shift, and go to state 121 - KW_read shift, and go to state 122 - KW_table shift, and go to state 123 - KW_type shift, and go to state 124 - KW_view shift, and go to state 125 - KW_write shift, and go to state 126 - - ident_1_0 go to state 127 - - -State 82 - - 42 alias_1_0_decl: KW_alias fqn_1_0 alias_1_0_new_name . ';' - - ';' shift, and go to state 128 - - -State 83 - - 43 alias_1_0_new_name: fqn_1_0 . - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - ':' shift, and go to state 81 - - $default reduce using rule 43 (alias_1_0_new_name) - - -State 84 - - 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 . '=' expression_1_0 ';' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '=' shift, and go to state 129 - ':' shift, and go to state 81 - - -State 85 - - 34 typespec_1_0: fqn_1_0 '[' . dim_1_0 ']' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '*' shift, and go to state 141 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - dim_1_0 go to state 147 - phys_ident go to state 148 - expression_1_0 go to state 149 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 86 - - 252 fqn_vers: fqn_1_0 VERSION . - - $default reduce using rule 252 (fqn_vers) - - -State 87 - - 222 opt_database_dad_1_0: '=' . fqn_opt_vers - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 164 - - -State 88 - - 220 database_1_0_decl: KW_database fqn_vers opt_database_dad_1_0 . database_body_1_0 - - '{' shift, and go to state 165 - - database_body_1_0 go to state 166 - - -State 89 - - 221 opt_database_dad_1_0: empty . - - $default reduce using rule 221 (opt_database_dad_1_0) - - -State 90 - - 37 format_1_0_decl: KW_fmtdef format_1_0_new_name ';' . - - $default reduce using rule 37 (format_1_0_decl) - - -State 91 - - 38 format_1_0_decl: KW_fmtdef format_1_0_name format_1_0_new_name . ';' - - ';' shift, and go to state 167 - - -State 92 - - 39 format_1_0_new_name: fqn_1_0 . - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - ':' shift, and go to state 81 - - $default reduce using rule 39 (format_1_0_new_name) - - -State 93 - - 49 row_length_func_1_0_decl: KW___row_length fqn_1_0 . '(' ')' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '(' shift, and go to state 168 - ':' shift, and go to state 81 - - -State 94 - - 48 untyped_func_1_0_decl: KW___untyped fqn_1_0 . '(' ')' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '(' shift, and go to state 169 - ':' shift, and go to state 81 - - -State 95 - - 55 func_1_0_kdbtext_formal: KW_type . ident_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 170 - - -State 96 - - 214 type_expr_1_0: typespec_1_0 . - - $default reduce using rule 214 (type_expr_1_0) - - -State 97 - - 52 func_1_0_kdbtext_sig: '<' func_1_0_kdbtext_formals . '>' - 54 func_1_0_kdbtext_formals: func_1_0_kdbtext_formals . ',' func_1_0_kdbtext_formal - - ',' shift, and go to state 171 - '>' shift, and go to state 172 - - -State 98 - - 53 func_1_0_kdbtext_formals: func_1_0_kdbtext_formal . - - $default reduce using rule 53 (func_1_0_kdbtext_formals) - - -State 99 - - 56 func_1_0_kdbtext_formal: type_expr_1_0 . ident_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 173 - - -State 100 - - 33 typespec_1_0: fqn_1_0 . - 34 | fqn_1_0 . '[' dim_1_0 ']' - 215 type_expr_1_0: fqn_1_0 . '/' fqn_1_0 - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '[' shift, and go to state 85 - '/' shift, and go to state 174 - ':' shift, and go to state 81 - - $default reduce using rule 33 (typespec_1_0) - - -State 101 - - 57 func_1_0_return_type: KW_void . - - $default reduce using rule 57 (func_1_0_return_type) - - -State 102 - - 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type . fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 175 - - -State 103 - - 58 func_1_0_return_type: type_expr_1_0 . - - $default reduce using rule 58 (func_1_0_return_type) - - -State 104 - - 96 phys_1_0_return_type: KW___no_header . func_1_0_return_type - - IDENTIFIER_1_0 shift, and go to state 36 - KW_void shift, and go to state 101 - - typespec_1_0 go to state 96 - func_1_0_return_type go to state 176 - type_expr_1_0 go to state 103 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 105 - - 95 phys_1_0_return_type: func_1_0_return_type . - - $default reduce using rule 95 (phys_1_0_return_type) - - -State 106 - - 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type . fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 41 - ident_1_0 go to state 38 - fqn_vers go to state 177 - - -State 107 - - 92 script_1_0_decl: KW_kdbtext KW_function func_1_0_decl . - - $default reduce using rule 92 (script_1_0_decl) - - -State 108 - - 108 opt_tbl_1_0_parents: '=' . tbl_1_0_parents - - IDENTIFIER_1_0 shift, and go to state 36 - - tbl_1_0_parents go to state 178 - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 179 - - -State 109 - - 106 table_1_0_decl: KW_table fqn_vers opt_tbl_1_0_parents . tbl_1_0_body - - '{' shift, and go to state 180 - - tbl_1_0_body go to state 181 - - -State 110 - - 107 opt_tbl_1_0_parents: empty . - - $default reduce using rule 107 (opt_tbl_1_0_parents) - - -State 111 - - 25 typedef_1_0_decl: KW_typedef fqn_1_0 typedef_1_0_new_name_list . ';' - 27 typedef_1_0_new_name_list: typedef_1_0_new_name_list . ',' typespec_1_0 - - ';' shift, and go to state 182 - ',' shift, and go to state 183 - - -State 112 - - 26 typedef_1_0_new_name_list: typespec_1_0 . - - $default reduce using rule 26 (typedef_1_0_new_name_list) - - -State 113 - - 30 typeset_1_0_def: '{' . typespec_1_0_list '}' - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0_list go to state 184 - typespec_1_0 go to state 185 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 114 - - 28 typeset_1_0_decl: KW_typeset typeset_1_0_new_name typeset_1_0_def . ';' - - ';' shift, and go to state 186 - - -State 115 - - 6 version_1_0: KW_version VERS_1_0 ';' . - - $default reduce using rule 6 (version_1_0) - - -State 116 - - 255 version_2_0: KW_version VERS_2_0 ';' . - - $default reduce using rule 255 (version_2_0) - - -State 117 - - 262 view_2_0_decl: KW_view fqn_vers . '<' view_parms '>' opt_view_parents '{' opt_view_body '}' - - '<' shift, and go to state 187 - - -State 118 - - 259 kdbtext_2_0: kdbtext_2_0 kdbtext_2_0_decl . - - $default reduce using rule 259 (kdbtext_2_0) - - -State 119 - - 242 fqn_1_0: fqn_1_0 ':' KW_database . - - $default reduce using rule 242 (fqn_1_0) - - -State 120 - - 243 fqn_1_0: fqn_1_0 ':' KW_decode . - - $default reduce using rule 243 (fqn_1_0) - - -State 121 - - 244 fqn_1_0: fqn_1_0 ':' KW_encode . - - $default reduce using rule 244 (fqn_1_0) - - -State 122 - - 245 fqn_1_0: fqn_1_0 ':' KW_read . - - $default reduce using rule 245 (fqn_1_0) - - -State 123 - - 246 fqn_1_0: fqn_1_0 ':' KW_table . - - $default reduce using rule 246 (fqn_1_0) - - -State 124 - - 247 fqn_1_0: fqn_1_0 ':' KW_type . - - $default reduce using rule 247 (fqn_1_0) - - -State 125 - - 248 fqn_1_0: fqn_1_0 ':' KW_view . - - $default reduce using rule 248 (fqn_1_0) - - -State 126 - - 249 fqn_1_0: fqn_1_0 ':' KW_write . - - $default reduce using rule 249 (fqn_1_0) - - -State 127 - - 241 fqn_1_0: fqn_1_0 ':' ident_1_0 . - - $default reduce using rule 241 (fqn_1_0) - - -State 128 - - 42 alias_1_0_decl: KW_alias fqn_1_0 alias_1_0_new_name ';' . - - $default reduce using rule 42 (alias_1_0_decl) - - -State 129 - - 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 '=' . expression_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 188 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 130 - - 200 uint_expr_1_0: DECIMAL . - - $default reduce using rule 200 (uint_expr_1_0) - - -State 131 - - 202 uint_expr_1_0: OCTAL . - - $default reduce using rule 202 (uint_expr_1_0) - - -State 132 - - 201 uint_expr_1_0: HEX . - - $default reduce using rule 201 (uint_expr_1_0) - - -State 133 - - 203 float_expr_1_0: FLOAT_ . - - $default reduce using rule 203 (float_expr_1_0) - - -State 134 - - 204 float_expr_1_0: EXP_FLOAT . - - $default reduce using rule 204 (float_expr_1_0) - - -State 135 - - 205 string_expr_1_0: STRING . - - $default reduce using rule 205 (string_expr_1_0) - - -State 136 - - 206 string_expr_1_0: ESCAPED_STRING . - - $default reduce using rule 206 (string_expr_1_0) - - -State 137 - - 144 phys_ident: PHYSICAL_IDENTIFIER_1_0 . - - $default reduce using rule 144 (phys_ident) - - -State 138 - - 213 bool_expr_1_0: KW_false . - - $default reduce using rule 213 (bool_expr_1_0) - - -State 139 - - 212 bool_expr_1_0: KW_true . - - $default reduce using rule 212 (bool_expr_1_0) - - -State 140 - - 207 const_vect_expr_1_0: '[' . opt_const_vect_exprlist_1_0 ']' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - $default reduce using rule 251 (empty) - - phys_ident go to state 148 - expression_1_0 go to state 189 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - opt_const_vect_exprlist_1_0 go to state 190 - const_vect_exprlist_1_0 go to state 191 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - empty go to state 192 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 141 - - 36 dim_1_0: '*' . - - $default reduce using rule 36 (dim_1_0) - - -State 142 - - 170 expression_1_0: '(' . type_expr_1_0 ')' expression_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 96 - type_expr_1_0 go to state 193 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 143 - - 184 func_expr_1_0: '<' . kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - IDENTIFIER_1_0 shift, and go to state 36 - - kdbtext_parms_1_0 go to state 194 - kdbtext_parm_1_0 go to state 195 - uint_expr_1_0 go to state 196 - fqn_1_0 go to state 197 - ident_1_0 go to state 38 - - -State 144 - - 173 primary_expr_1_0: '@' . - - $default reduce using rule 173 (primary_expr_1_0) - - -State 145 - - 180 primary_expr_1_0: '-' . expression_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 198 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 146 - - 181 primary_expr_1_0: '+' . expression_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 199 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 147 - - 34 typespec_1_0: fqn_1_0 '[' dim_1_0 . ']' - - ']' shift, and go to state 200 - - -State 148 - - 172 primary_expr_1_0: phys_ident . - - $default reduce using rule 172 (primary_expr_1_0) - - -State 149 - - 35 dim_1_0: expression_1_0 . - - $default reduce using rule 35 (dim_1_0) - - -State 150 - - 169 expression_1_0: primary_expr_1_0 . - - $default reduce using rule 169 (expression_1_0) - - -State 151 - - 174 primary_expr_1_0: func_expr_1_0 . - - $default reduce using rule 174 (primary_expr_1_0) - - -State 152 - - 175 primary_expr_1_0: uint_expr_1_0 . - - $default reduce using rule 175 (primary_expr_1_0) - - -State 153 - - 176 primary_expr_1_0: float_expr_1_0 . - - $default reduce using rule 176 (primary_expr_1_0) - - -State 154 - - 177 primary_expr_1_0: string_expr_1_0 . - - $default reduce using rule 177 (primary_expr_1_0) - - -State 155 - - 178 primary_expr_1_0: const_vect_expr_1_0 . - - $default reduce using rule 178 (primary_expr_1_0) - - -State 156 - - 179 primary_expr_1_0: bool_expr_1_0 . - - $default reduce using rule 179 (primary_expr_1_0) - - -State 157 - - 182 primary_expr_1_0: member_expr_2_0 . - - $default reduce using rule 182 (primary_expr_1_0) - - -State 158 - - 183 primary_expr_1_0: join_expr_2_0 . - - $default reduce using rule 183 (primary_expr_1_0) - - -State 159 - - 171 primary_expr_1_0: fqn_1_0 . - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - 252 fqn_vers: fqn_1_0 . VERSION - 253 fqn_opt_vers: fqn_1_0 . - - VERSION shift, and go to state 86 - ':' shift, and go to state 81 - - '(' reduce using rule 253 (fqn_opt_vers) - '<' reduce using rule 253 (fqn_opt_vers) - $default reduce using rule 171 (primary_expr_1_0) - - -State 160 - - 216 member_expr_2_0: ident_1_0 . '.' ident_1_0 - 217 | ident_1_0 . PHYSICAL_IDENTIFIER_1_0 - 218 join_expr_2_0: ident_1_0 . '[' cond_expr_1_0 ']' '.' ident_1_0 - 219 | ident_1_0 . '[' cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 - 240 fqn_1_0: ident_1_0 . - - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 201 - '[' shift, and go to state 202 - '.' shift, and go to state 203 - - $default reduce using rule 240 (fqn_1_0) - - -State 161 - - 254 fqn_opt_vers: fqn_vers . - - $default reduce using rule 254 (fqn_opt_vers) - - -State 162 - - 185 func_expr_1_0: fqn_opt_vers . opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' - - '<' shift, and go to state 204 - - $default reduce using rule 251 (empty) - - opt_factory_parms_1_0 go to state 205 - factory_parms_1_0 go to state 206 - empty go to state 207 - - -State 163 - - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - 252 fqn_vers: fqn_1_0 . VERSION - 253 fqn_opt_vers: fqn_1_0 . - - VERSION shift, and go to state 86 - ':' shift, and go to state 81 - - $default reduce using rule 253 (fqn_opt_vers) - - -State 164 - - 222 opt_database_dad_1_0: '=' fqn_opt_vers . - - $default reduce using rule 222 (opt_database_dad_1_0) - - -State 165 - - 223 database_body_1_0: '{' . '}' - 224 | '{' . database_members_1_0 '}' - - KW_alias shift, and go to state 208 - KW_template shift, and go to state 209 - ';' shift, and go to state 210 - '}' shift, and go to state 211 - - $default reduce using rule 251 (empty) - - database_members_1_0 go to state 212 - database_member_1_0 go to state 213 - opt_template_1_0 go to state 214 - db_member_1_0 go to state 215 - table_member_1_0 go to state 216 - alias_member_1_0 go to state 217 - empty go to state 218 - - -State 166 - - 220 database_1_0_decl: KW_database fqn_vers opt_database_dad_1_0 database_body_1_0 . - - $default reduce using rule 220 (database_1_0_decl) - - -State 167 - - 38 format_1_0_decl: KW_fmtdef format_1_0_name format_1_0_new_name ';' . - - $default reduce using rule 38 (format_1_0_decl) - - -State 168 - - 49 row_length_func_1_0_decl: KW___row_length fqn_1_0 '(' . ')' - - ')' shift, and go to state 219 - - -State 169 - - 48 untyped_func_1_0_decl: KW___untyped fqn_1_0 '(' . ')' - - ')' shift, and go to state 220 - - -State 170 - - 55 func_1_0_kdbtext_formal: KW_type ident_1_0 . - - $default reduce using rule 55 (func_1_0_kdbtext_formal) - - -State 171 - - 54 func_1_0_kdbtext_formals: func_1_0_kdbtext_formals ',' . func_1_0_kdbtext_formal - - IDENTIFIER_1_0 shift, and go to state 36 - KW_type shift, and go to state 95 - - typespec_1_0 go to state 96 - func_1_0_kdbtext_formal go to state 221 - type_expr_1_0 go to state 99 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 172 - - 52 func_1_0_kdbtext_sig: '<' func_1_0_kdbtext_formals '>' . - - $default reduce using rule 52 (func_1_0_kdbtext_sig) - - -State 173 - - 56 func_1_0_kdbtext_formal: type_expr_1_0 ident_1_0 . - - $default reduce using rule 56 (func_1_0_kdbtext_formal) - - -State 174 - - 215 type_expr_1_0: fqn_1_0 '/' . fqn_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 222 - ident_1_0 go to state 38 - - -State 175 - - 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers . opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue - - '<' shift, and go to state 223 - - $default reduce using rule 251 (empty) - - opt_func_1_0_fact_sig go to state 224 - func_1_0_fact_sig go to state 225 - empty go to state 226 - - -State 176 - - 96 phys_1_0_return_type: KW___no_header func_1_0_return_type . - - $default reduce using rule 96 (phys_1_0_return_type) - - -State 177 - - 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers . opt_func_1_0_fact_sig phys_1_0_prologue - - '<' shift, and go to state 223 - - $default reduce using rule 251 (empty) - - opt_func_1_0_fact_sig go to state 227 - func_1_0_fact_sig go to state 225 - empty go to state 226 - - -State 178 - - 108 opt_tbl_1_0_parents: '=' tbl_1_0_parents . - 110 tbl_1_0_parents: tbl_1_0_parents . ',' fqn_opt_vers - - ',' shift, and go to state 228 - - $default reduce using rule 108 (opt_tbl_1_0_parents) - - -State 179 - - 109 tbl_1_0_parents: fqn_opt_vers . - - $default reduce using rule 109 (tbl_1_0_parents) - - -State 180 - - 111 tbl_1_0_body: '{' . tbl_1_0_stmt_seq '}' - 112 | '{' . '}' - - IDENTIFIER_1_0 shift, and go to state 36 - KW___untyped shift, and go to state 229 - KW_column shift, and go to state 230 - KW_default shift, and go to state 231 - KW_extern shift, and go to state 232 - KW_physical shift, and go to state 233 - KW_readonly shift, and go to state 234 - KW_static shift, and go to state 235 - KW_trigger shift, and go to state 236 - ';' shift, and go to state 237 - '}' shift, and go to state 238 - - typespec_1_0 go to state 239 - tbl_1_0_stmt_seq go to state 240 - tbl_1_0_stmt go to state 241 - production_1_0_stmt go to state 242 - col_1_0_modifiers go to state 243 - col_1_0_modifier_seq go to state 244 - col_1_0_modifier go to state 245 - default_view_1_0_decl go to state 246 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 181 - - 106 table_1_0_decl: KW_table fqn_vers opt_tbl_1_0_parents tbl_1_0_body . - - $default reduce using rule 106 (table_1_0_decl) - - -State 182 - - 25 typedef_1_0_decl: KW_typedef fqn_1_0 typedef_1_0_new_name_list ';' . - - $default reduce using rule 25 (typedef_1_0_decl) - - -State 183 - - 27 typedef_1_0_new_name_list: typedef_1_0_new_name_list ',' . typespec_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 247 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 184 - - 30 typeset_1_0_def: '{' typespec_1_0_list . '}' - 32 typespec_1_0_list: typespec_1_0_list . ',' typespec_1_0 - - ',' shift, and go to state 248 - '}' shift, and go to state 249 - - -State 185 - - 31 typespec_1_0_list: typespec_1_0 . - - $default reduce using rule 31 (typespec_1_0_list) - - -State 186 - - 28 typeset_1_0_decl: KW_typeset typeset_1_0_new_name typeset_1_0_def ';' . - - $default reduce using rule 28 (typeset_1_0_decl) - - -State 187 - - 262 view_2_0_decl: KW_view fqn_vers '<' . view_parms '>' opt_view_parents '{' opt_view_body '}' - - IDENTIFIER_1_0 shift, and go to state 36 - - view_parms go to state 250 - fqn_1_0 go to state 163 - ident_1_0 go to state 251 - fqn_vers go to state 161 - fqn_opt_vers go to state 252 - view_parm go to state 253 - - -State 188 - - 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 '=' expression_1_0 . ';' - - ';' shift, and go to state 254 - - -State 189 - - 210 const_vect_exprlist_1_0: expression_1_0 . - - $default reduce using rule 210 (const_vect_exprlist_1_0) - - -State 190 - - 207 const_vect_expr_1_0: '[' opt_const_vect_exprlist_1_0 . ']' - - ']' shift, and go to state 255 - - -State 191 - - 209 opt_const_vect_exprlist_1_0: const_vect_exprlist_1_0 . - 211 const_vect_exprlist_1_0: const_vect_exprlist_1_0 . ',' expression_1_0 - - ',' shift, and go to state 256 - - $default reduce using rule 209 (opt_const_vect_exprlist_1_0) - - -State 192 - - 208 opt_const_vect_exprlist_1_0: empty . - - $default reduce using rule 208 (opt_const_vect_exprlist_1_0) - - -State 193 - - 170 expression_1_0: '(' type_expr_1_0 . ')' expression_1_0 - - ')' shift, and go to state 257 - - -State 194 - - 184 func_expr_1_0: '<' kdbtext_parms_1_0 . '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' - 187 kdbtext_parms_1_0: kdbtext_parms_1_0 . ',' kdbtext_parm_1_0 - - ',' shift, and go to state 258 - '>' shift, and go to state 259 - - -State 195 - - 186 kdbtext_parms_1_0: kdbtext_parm_1_0 . - - $default reduce using rule 186 (kdbtext_parms_1_0) - - -State 196 - - 190 kdbtext_parm_1_0: uint_expr_1_0 . - - $default reduce using rule 190 (kdbtext_parm_1_0) - - -State 197 - - 188 kdbtext_parm_1_0: fqn_1_0 . - 189 | fqn_1_0 . '[' dim_1_0 ']' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '[' shift, and go to state 260 - ':' shift, and go to state 81 - - $default reduce using rule 188 (kdbtext_parm_1_0) - - -State 198 - - 180 primary_expr_1_0: '-' expression_1_0 . - - $default reduce using rule 180 (primary_expr_1_0) - - -State 199 - - 181 primary_expr_1_0: '+' expression_1_0 . - - $default reduce using rule 181 (primary_expr_1_0) - - -State 200 - - 34 typespec_1_0: fqn_1_0 '[' dim_1_0 ']' . - - $default reduce using rule 34 (typespec_1_0) - - -State 201 - - 217 member_expr_2_0: ident_1_0 PHYSICAL_IDENTIFIER_1_0 . - - $default reduce using rule 217 (member_expr_2_0) - - -State 202 - - 218 join_expr_2_0: ident_1_0 '[' . cond_expr_1_0 ']' '.' ident_1_0 - 219 | ident_1_0 '[' . cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 261 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 203 - - 216 member_expr_2_0: ident_1_0 '.' . ident_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 263 - - -State 204 - - 193 factory_parms_1_0: '<' . factory_parms '>' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 264 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - factory_parms go to state 265 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 205 - - 185 func_expr_1_0: fqn_opt_vers opt_factory_parms_1_0 . '(' opt_func_1_0_parms ')' - - '(' shift, and go to state 266 - - -State 206 - - 192 opt_factory_parms_1_0: factory_parms_1_0 . - - $default reduce using rule 192 (opt_factory_parms_1_0) - - -State 207 - - 191 opt_factory_parms_1_0: empty . - - $default reduce using rule 191 (opt_factory_parms_1_0) - - -State 208 - - 235 alias_member_1_0: KW_alias . view_spec ident_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - view_spec go to state 267 - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 268 - - -State 209 - - 232 opt_template_1_0: KW_template . - - $default reduce using rule 232 (opt_template_1_0) - - -State 210 - - 230 database_member_1_0: ';' . - - $default reduce using rule 230 (database_member_1_0) - - -State 211 - - 223 database_body_1_0: '{' '}' . - - $default reduce using rule 223 (database_body_1_0) - - -State 212 - - 224 database_body_1_0: '{' database_members_1_0 . '}' - 226 database_members_1_0: database_members_1_0 . database_member_1_0 - - KW_alias shift, and go to state 208 - KW_template shift, and go to state 209 - ';' shift, and go to state 210 - '}' shift, and go to state 269 - - $default reduce using rule 251 (empty) - - database_member_1_0 go to state 270 - opt_template_1_0 go to state 214 - db_member_1_0 go to state 215 - table_member_1_0 go to state 216 - alias_member_1_0 go to state 217 - empty go to state 218 - - -State 213 - - 225 database_members_1_0: database_member_1_0 . - - $default reduce using rule 225 (database_members_1_0) - - -State 214 - - 233 db_member_1_0: opt_template_1_0 . KW_database fqn_opt_vers ident_1_0 ';' - 234 table_member_1_0: opt_template_1_0 . KW_table fqn_opt_vers ident_1_0 ';' - - KW_database shift, and go to state 271 - KW_table shift, and go to state 272 - - -State 215 - - 227 database_member_1_0: db_member_1_0 . - - $default reduce using rule 227 (database_member_1_0) - - -State 216 - - 228 database_member_1_0: table_member_1_0 . - - $default reduce using rule 228 (database_member_1_0) - - -State 217 - - 229 database_member_1_0: alias_member_1_0 . - - $default reduce using rule 229 (database_member_1_0) - - -State 218 - - 231 opt_template_1_0: empty . - - $default reduce using rule 231 (opt_template_1_0) - - -State 219 - - 49 row_length_func_1_0_decl: KW___row_length fqn_1_0 '(' ')' . - - $default reduce using rule 49 (row_length_func_1_0_decl) - - -State 220 - - 48 untyped_func_1_0_decl: KW___untyped fqn_1_0 '(' ')' . - - $default reduce using rule 48 (untyped_func_1_0_decl) - - -State 221 - - 54 func_1_0_kdbtext_formals: func_1_0_kdbtext_formals ',' func_1_0_kdbtext_formal . - - $default reduce using rule 54 (func_1_0_kdbtext_formals) - - -State 222 - - 215 type_expr_1_0: fqn_1_0 '/' fqn_1_0 . - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - ':' shift, and go to state 81 - - $default reduce using rule 215 (type_expr_1_0) - - -State 223 - - 61 func_1_0_fact_sig: '<' . func_1_0_fact_signature '>' - - IDENTIFIER_1_0 shift, and go to state 36 - '*' shift, and go to state 273 - - $default reduce using rule 251 (empty) - - typespec_1_0 go to state 274 - func_1_0_fact_signature go to state 275 - func_1_0_fact_params go to state 276 - fact_param_1_0 go to state 277 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - empty go to state 278 - - -State 224 - - 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig . func_1_0_param_sig func_1_0_prologue - - '(' shift, and go to state 279 - - func_1_0_param_sig go to state 280 - - -State 225 - - 60 opt_func_1_0_fact_sig: func_1_0_fact_sig . - - $default reduce using rule 60 (opt_func_1_0_fact_sig) - - -State 226 - - 59 opt_func_1_0_fact_sig: empty . - - $default reduce using rule 59 (opt_func_1_0_fact_sig) - - -State 227 - - 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig . phys_1_0_prologue - - '{' shift, and go to state 281 - '=' shift, and go to state 282 - - phys_1_0_prologue go to state 283 - - -State 228 - - 110 tbl_1_0_parents: tbl_1_0_parents ',' . fqn_opt_vers - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 284 - - -State 229 - - 123 tbl_1_0_stmt: KW___untyped . '=' fqn_1_0 '(' ')' ';' - - '=' shift, and go to state 285 - - -State 230 - - 117 tbl_1_0_stmt: KW_column . KW_limit '=' expression_1_0 ';' - 118 | KW_column . KW_default KW_limit '=' expression_1_0 ';' - 127 col_1_0_modifiers: KW_column . - - KW_default shift, and go to state 286 - KW_limit shift, and go to state 287 - - $default reduce using rule 127 (col_1_0_modifiers) - - -State 231 - - 131 col_1_0_modifier: KW_default . - 153 default_view_1_0_decl: KW_default . KW_view STRING ';' - - KW_view shift, and go to state 288 - - $default reduce using rule 131 (col_1_0_modifier) - - -State 232 - - 132 col_1_0_modifier: KW_extern . - - $default reduce using rule 132 (col_1_0_modifier) - - -State 233 - - 120 tbl_1_0_stmt: KW_physical . physmbr_1_0_decl - - KW_column shift, and go to state 289 - '<' shift, and go to state 290 - - $default reduce using rule 251 (empty) - - physmbr_1_0_decl go to state 291 - phys_coldef_1_0 go to state 292 - opt_col_kdbtext_parms_1_0 go to state 293 - empty go to state 294 - - -State 234 - - 133 col_1_0_modifier: KW_readonly . - - $default reduce using rule 133 (col_1_0_modifier) - - -State 235 - - 119 tbl_1_0_stmt: KW_static . physmbr_1_0_decl - 121 | KW_static . KW_physical physmbr_1_0_decl - - KW_column shift, and go to state 289 - KW_physical shift, and go to state 295 - '<' shift, and go to state 290 - - $default reduce using rule 251 (empty) - - physmbr_1_0_decl go to state 296 - phys_coldef_1_0 go to state 292 - opt_col_kdbtext_parms_1_0 go to state 293 - empty go to state 294 - - -State 236 - - 126 production_1_0_stmt: KW_trigger . ident_1_0 '=' cond_expr_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 297 - - -State 237 - - 124 tbl_1_0_stmt: ';' . - - $default reduce using rule 124 (tbl_1_0_stmt) - - -State 238 - - 112 tbl_1_0_body: '{' '}' . - - $default reduce using rule 112 (tbl_1_0_body) - - -State 239 - - 125 production_1_0_stmt: typespec_1_0 . ident_1_0 '=' cond_expr_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 298 - - -State 240 - - 111 tbl_1_0_body: '{' tbl_1_0_stmt_seq . '}' - 114 tbl_1_0_stmt_seq: tbl_1_0_stmt_seq . tbl_1_0_stmt - - IDENTIFIER_1_0 shift, and go to state 36 - KW___untyped shift, and go to state 229 - KW_column shift, and go to state 230 - KW_default shift, and go to state 231 - KW_extern shift, and go to state 232 - KW_physical shift, and go to state 233 - KW_readonly shift, and go to state 234 - KW_static shift, and go to state 235 - KW_trigger shift, and go to state 236 - ';' shift, and go to state 237 - '}' shift, and go to state 299 - - typespec_1_0 go to state 239 - tbl_1_0_stmt go to state 300 - production_1_0_stmt go to state 242 - col_1_0_modifiers go to state 243 - col_1_0_modifier_seq go to state 244 - col_1_0_modifier go to state 245 - default_view_1_0_decl go to state 246 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 241 - - 113 tbl_1_0_stmt_seq: tbl_1_0_stmt . - - $default reduce using rule 113 (tbl_1_0_stmt_seq) - - -State 242 - - 115 tbl_1_0_stmt: production_1_0_stmt . - - $default reduce using rule 115 (tbl_1_0_stmt) - - -State 243 - - 116 tbl_1_0_stmt: col_1_0_modifiers . col_1_0_decl - - IDENTIFIER_1_0 shift, and go to state 36 - '<' shift, and go to state 301 - - typespec_1_0 go to state 302 - col_1_0_decl go to state 303 - phys_enc_ref go to state 304 - fqn_1_0 go to state 305 - ident_1_0 go to state 38 - fqn_vers go to state 306 - - -State 244 - - 128 col_1_0_modifiers: col_1_0_modifier_seq . KW_column - 130 col_1_0_modifier_seq: col_1_0_modifier_seq . col_1_0_modifier - - KW_column shift, and go to state 307 - KW_default shift, and go to state 308 - KW_extern shift, and go to state 232 - KW_readonly shift, and go to state 234 - - col_1_0_modifier go to state 309 - - -State 245 - - 129 col_1_0_modifier_seq: col_1_0_modifier . - - $default reduce using rule 129 (col_1_0_modifier_seq) - - -State 246 - - 122 tbl_1_0_stmt: default_view_1_0_decl . - - $default reduce using rule 122 (tbl_1_0_stmt) - - -State 247 - - 27 typedef_1_0_new_name_list: typedef_1_0_new_name_list ',' typespec_1_0 . - - $default reduce using rule 27 (typedef_1_0_new_name_list) - - -State 248 - - 32 typespec_1_0_list: typespec_1_0_list ',' . typespec_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 310 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 249 - - 30 typeset_1_0_def: '{' typespec_1_0_list '}' . - - $default reduce using rule 30 (typeset_1_0_def) - - -State 250 - - 238 view_parms: view_parms . ',' ident_1_0 - 262 view_2_0_decl: KW_view fqn_vers '<' view_parms . '>' opt_view_parents '{' opt_view_body '}' - 264 view_parms: view_parms . ',' view_parm - - ',' shift, and go to state 311 - '>' shift, and go to state 312 - - -State 251 - - 237 view_parms: ident_1_0 . - 240 fqn_1_0: ident_1_0 . - - ',' reduce using rule 237 (view_parms) - '>' reduce using rule 237 (view_parms) - $default reduce using rule 240 (fqn_1_0) - - -State 252 - - 265 view_parm: fqn_opt_vers . ident_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 313 - - -State 253 - - 263 view_parms: view_parm . - - $default reduce using rule 263 (view_parms) - - -State 254 - - 41 const_1_0_decl: KW_const typespec_1_0 fqn_1_0 '=' expression_1_0 ';' . - - $default reduce using rule 41 (const_1_0_decl) - - -State 255 - - 207 const_vect_expr_1_0: '[' opt_const_vect_exprlist_1_0 ']' . - - $default reduce using rule 207 (const_vect_expr_1_0) - - -State 256 - - 211 const_vect_exprlist_1_0: const_vect_exprlist_1_0 ',' . expression_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 314 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 257 - - 170 expression_1_0: '(' type_expr_1_0 ')' . expression_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 315 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 258 - - 187 kdbtext_parms_1_0: kdbtext_parms_1_0 ',' . kdbtext_parm_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - IDENTIFIER_1_0 shift, and go to state 36 - - kdbtext_parm_1_0 go to state 316 - uint_expr_1_0 go to state 196 - fqn_1_0 go to state 197 - ident_1_0 go to state 38 - - -State 259 - - 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' . fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 317 - - -State 260 - - 189 kdbtext_parm_1_0: fqn_1_0 '[' . dim_1_0 ']' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '*' shift, and go to state 141 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - dim_1_0 go to state 318 - phys_ident go to state 148 - expression_1_0 go to state 149 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 261 - - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 . ']' '.' ident_1_0 - 219 | ident_1_0 '[' cond_expr_1_0 . ']' PHYSICAL_IDENTIFIER_1_0 - - ']' shift, and go to state 319 - '|' shift, and go to state 320 - - -State 262 - - 167 cond_expr_1_0: expression_1_0 . - - $default reduce using rule 167 (cond_expr_1_0) - - -State 263 - - 216 member_expr_2_0: ident_1_0 '.' ident_1_0 . - - $default reduce using rule 216 (member_expr_2_0) - - -State 264 - - 194 factory_parms: expression_1_0 . - - $default reduce using rule 194 (factory_parms) - - -State 265 - - 193 factory_parms_1_0: '<' factory_parms . '>' - 195 factory_parms: factory_parms . ',' expression_1_0 - - ',' shift, and go to state 321 - '>' shift, and go to state 322 - - -State 266 - - 185 func_expr_1_0: fqn_opt_vers opt_factory_parms_1_0 '(' . opt_func_1_0_parms ')' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - $default reduce using rule 251 (empty) - - phys_ident go to state 148 - expression_1_0 go to state 323 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - opt_func_1_0_parms go to state 324 - func_1_0_parms go to state 325 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - empty go to state 326 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 267 - - 235 alias_member_1_0: KW_alias view_spec . ident_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 327 - - -State 268 - - 236 view_spec: fqn_opt_vers . '<' view_parms '>' - - '<' shift, and go to state 328 - - -State 269 - - 224 database_body_1_0: '{' database_members_1_0 '}' . - - $default reduce using rule 224 (database_body_1_0) - - -State 270 - - 226 database_members_1_0: database_members_1_0 database_member_1_0 . - - $default reduce using rule 226 (database_members_1_0) - - -State 271 - - 233 db_member_1_0: opt_template_1_0 KW_database . fqn_opt_vers ident_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 329 - - -State 272 - - 234 table_member_1_0: opt_template_1_0 KW_table . fqn_opt_vers ident_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 330 - - -State 273 - - 64 func_1_0_fact_signature: '*' . func_1_0_fact_params func_1_0_vararg_formals - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 274 - func_1_0_fact_params go to state 331 - fact_param_1_0 go to state 277 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 274 - - 69 fact_param_1_0: typespec_1_0 . IDENTIFIER_1_0 - - IDENTIFIER_1_0 shift, and go to state 332 - - -State 275 - - 61 func_1_0_fact_sig: '<' func_1_0_fact_signature . '>' - - '>' shift, and go to state 333 - - -State 276 - - 63 func_1_0_fact_signature: func_1_0_fact_params . func_1_0_vararg_formals - 65 | func_1_0_fact_params . '*' func_1_0_fact_params func_1_0_vararg_formals - 66 | func_1_0_fact_params . ',' '*' func_1_0_fact_params func_1_0_vararg_formals - 68 func_1_0_fact_params: func_1_0_fact_params . ',' fact_param_1_0 - - ',' shift, and go to state 334 - '*' shift, and go to state 335 - - $default reduce using rule 251 (empty) - - func_1_0_vararg_formals go to state 336 - empty go to state 337 - - -State 277 - - 67 func_1_0_fact_params: fact_param_1_0 . - - $default reduce using rule 67 (func_1_0_fact_params) - - -State 278 - - 62 func_1_0_fact_signature: empty . - - $default reduce using rule 62 (func_1_0_fact_signature) - - -State 279 - - 70 func_1_0_param_sig: '(' . func_1_0_param_signature ')' - - IDENTIFIER_1_0 shift, and go to state 36 - KW_control shift, and go to state 338 - '*' shift, and go to state 339 - - $default reduce using rule 251 (empty) - - typespec_1_0 go to state 340 - func_1_0_param_signature go to state 341 - func_1_0_formal_params go to state 342 - formal_param_1_0 go to state 343 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - empty go to state 344 - - -State 280 - - 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig . func_1_0_prologue - - ';' shift, and go to state 345 - '{' shift, and go to state 346 - '=' shift, and go to state 347 - - func_1_0_prologue go to state 348 - - -State 281 - - 98 phys_1_0_prologue: '{' . phys_1_0_body '}' - - KW___row_length shift, and go to state 349 - KW_decode shift, and go to state 350 - KW_encode shift, and go to state 351 - ';' shift, and go to state 352 - - phys_1_0_body go to state 353 - phys_1_0_body_stmt go to state 354 - - -State 282 - - 97 phys_1_0_prologue: '=' . phys_1_0_stmt - - '{' shift, and go to state 355 - - phys_1_0_stmt go to state 356 - - -State 283 - - 94 physical_1_0_decl: KW_physical opt_func_1_0_kdbtext_sig phys_1_0_return_type fqn_vers opt_func_1_0_fact_sig phys_1_0_prologue . - - $default reduce using rule 94 (physical_1_0_decl) - - -State 284 - - 110 tbl_1_0_parents: tbl_1_0_parents ',' fqn_opt_vers . - - $default reduce using rule 110 (tbl_1_0_parents) - - -State 285 - - 123 tbl_1_0_stmt: KW___untyped '=' . fqn_1_0 '(' ')' ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 357 - ident_1_0 go to state 38 - - -State 286 - - 118 tbl_1_0_stmt: KW_column KW_default . KW_limit '=' expression_1_0 ';' - - KW_limit shift, and go to state 358 - - -State 287 - - 117 tbl_1_0_stmt: KW_column KW_limit . '=' expression_1_0 ';' - - '=' shift, and go to state 359 - - -State 288 - - 153 default_view_1_0_decl: KW_default KW_view . STRING ';' - - STRING shift, and go to state 360 - - -State 289 - - 156 physmbr_1_0_decl: KW_column . phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' - 157 | KW_column . phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' - - '<' shift, and go to state 290 - - $default reduce using rule 251 (empty) - - phys_coldef_1_0 go to state 361 - opt_col_kdbtext_parms_1_0 go to state 293 - empty go to state 294 - - -State 290 - - 160 opt_col_kdbtext_parms_1_0: '<' . col_kdbtext_parms_1_0 '>' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - IDENTIFIER_1_0 shift, and go to state 36 - - col_kdbtext_parms_1_0 go to state 362 - col_kdbtext_parm_1_0 go to state 363 - col_kdbtext_value_1_0 go to state 364 - uint_expr_1_0 go to state 365 - fqn_1_0 go to state 366 - ident_1_0 go to state 38 - - -State 291 - - 120 tbl_1_0_stmt: KW_physical physmbr_1_0_decl . - - $default reduce using rule 120 (tbl_1_0_stmt) - - -State 292 - - 154 physmbr_1_0_decl: phys_coldef_1_0 . PHYSICAL_IDENTIFIER_1_0 ';' - 155 | phys_coldef_1_0 . PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' - - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 367 - - -State 293 - - 158 phys_coldef_1_0: opt_col_kdbtext_parms_1_0 . fqn_opt_vers opt_factory_parms_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 368 - - -State 294 - - 159 opt_col_kdbtext_parms_1_0: empty . - - $default reduce using rule 159 (opt_col_kdbtext_parms_1_0) - - -State 295 - - 121 tbl_1_0_stmt: KW_static KW_physical . physmbr_1_0_decl - - KW_column shift, and go to state 289 - '<' shift, and go to state 290 - - $default reduce using rule 251 (empty) - - physmbr_1_0_decl go to state 369 - phys_coldef_1_0 go to state 292 - opt_col_kdbtext_parms_1_0 go to state 293 - empty go to state 294 - - -State 296 - - 119 tbl_1_0_stmt: KW_static physmbr_1_0_decl . - - $default reduce using rule 119 (tbl_1_0_stmt) - - -State 297 - - 126 production_1_0_stmt: KW_trigger ident_1_0 . '=' cond_expr_1_0 ';' - - '=' shift, and go to state 370 - - -State 298 - - 125 production_1_0_stmt: typespec_1_0 ident_1_0 . '=' cond_expr_1_0 ';' - - '=' shift, and go to state 371 - - -State 299 - - 111 tbl_1_0_body: '{' tbl_1_0_stmt_seq '}' . - - $default reduce using rule 111 (tbl_1_0_body) - - -State 300 - - 114 tbl_1_0_stmt_seq: tbl_1_0_stmt_seq tbl_1_0_stmt . - - $default reduce using rule 114 (tbl_1_0_stmt_seq) - - -State 301 - - 136 phys_enc_ref: '<' . kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - IDENTIFIER_1_0 shift, and go to state 36 - - kdbtext_parms_1_0 go to state 372 - kdbtext_parm_1_0 go to state 195 - uint_expr_1_0 go to state 196 - fqn_1_0 go to state 197 - ident_1_0 go to state 38 - - -State 302 - - 134 col_1_0_decl: typespec_1_0 . typed_column_decl_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - - typed_column_decl_1_0 go to state 373 - col_ident go to state 374 - phys_ident go to state 375 - ident_1_0 go to state 376 - - -State 303 - - 116 tbl_1_0_stmt: col_1_0_modifiers col_1_0_decl . - - $default reduce using rule 116 (tbl_1_0_stmt) - - -State 304 - - 135 col_1_0_decl: phys_enc_ref . typed_column_decl_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - - typed_column_decl_1_0 go to state 377 - col_ident go to state 374 - phys_ident go to state 375 - ident_1_0 go to state 376 - - -State 305 - - 33 typespec_1_0: fqn_1_0 . - 34 | fqn_1_0 . '[' dim_1_0 ']' - 138 phys_enc_ref: fqn_1_0 . factory_parms_1_0 - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - 252 fqn_vers: fqn_1_0 . VERSION - - VERSION shift, and go to state 86 - '[' shift, and go to state 85 - '<' shift, and go to state 204 - ':' shift, and go to state 81 - - $default reduce using rule 33 (typespec_1_0) - - factory_parms_1_0 go to state 378 - - -State 306 - - 137 phys_enc_ref: fqn_vers . opt_factory_parms_1_0 - - '<' shift, and go to state 204 - - $default reduce using rule 251 (empty) - - opt_factory_parms_1_0 go to state 379 - factory_parms_1_0 go to state 206 - empty go to state 207 - - -State 307 - - 128 col_1_0_modifiers: col_1_0_modifier_seq KW_column . - - $default reduce using rule 128 (col_1_0_modifiers) - - -State 308 - - 131 col_1_0_modifier: KW_default . - - $default reduce using rule 131 (col_1_0_modifier) - - -State 309 - - 130 col_1_0_modifier_seq: col_1_0_modifier_seq col_1_0_modifier . - - $default reduce using rule 130 (col_1_0_modifier_seq) - - -State 310 - - 32 typespec_1_0_list: typespec_1_0_list ',' typespec_1_0 . - - $default reduce using rule 32 (typespec_1_0_list) - - -State 311 - - 238 view_parms: view_parms ',' . ident_1_0 - 264 | view_parms ',' . view_parm - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 380 - fqn_vers go to state 161 - fqn_opt_vers go to state 252 - view_parm go to state 381 - - -State 312 - - 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' . opt_view_parents '{' opt_view_body '}' - - '=' shift, and go to state 382 - - $default reduce using rule 251 (empty) - - empty go to state 383 - opt_view_parents go to state 384 - - -State 313 - - 265 view_parm: fqn_opt_vers ident_1_0 . - - $default reduce using rule 265 (view_parm) - - -State 314 - - 211 const_vect_exprlist_1_0: const_vect_exprlist_1_0 ',' expression_1_0 . - - $default reduce using rule 211 (const_vect_exprlist_1_0) - - -State 315 - - 170 expression_1_0: '(' type_expr_1_0 ')' expression_1_0 . - - $default reduce using rule 170 (expression_1_0) - - -State 316 - - 187 kdbtext_parms_1_0: kdbtext_parms_1_0 ',' kdbtext_parm_1_0 . - - $default reduce using rule 187 (kdbtext_parms_1_0) - - -State 317 - - 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers . opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' - - '<' shift, and go to state 204 - - $default reduce using rule 251 (empty) - - opt_factory_parms_1_0 go to state 385 - factory_parms_1_0 go to state 206 - empty go to state 207 - - -State 318 - - 189 kdbtext_parm_1_0: fqn_1_0 '[' dim_1_0 . ']' - - ']' shift, and go to state 386 - - -State 319 - - 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' . '.' ident_1_0 - 219 | ident_1_0 '[' cond_expr_1_0 ']' . PHYSICAL_IDENTIFIER_1_0 - - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 387 - '.' shift, and go to state 388 - - -State 320 - - 168 cond_expr_1_0: cond_expr_1_0 '|' . expression_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 389 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 321 - - 195 factory_parms: factory_parms ',' . expression_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 390 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 322 - - 193 factory_parms_1_0: '<' factory_parms '>' . - - $default reduce using rule 193 (factory_parms_1_0) - - -State 323 - - 198 func_1_0_parms: expression_1_0 . - - $default reduce using rule 198 (func_1_0_parms) - - -State 324 - - 185 func_expr_1_0: fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms . ')' - - ')' shift, and go to state 391 - - -State 325 - - 197 opt_func_1_0_parms: func_1_0_parms . - 199 func_1_0_parms: func_1_0_parms . ',' expression_1_0 - - ',' shift, and go to state 392 - - $default reduce using rule 197 (opt_func_1_0_parms) - - -State 326 - - 196 opt_func_1_0_parms: empty . - - $default reduce using rule 196 (opt_func_1_0_parms) - - -State 327 - - 235 alias_member_1_0: KW_alias view_spec ident_1_0 . ';' - - ';' shift, and go to state 393 - - -State 328 - - 236 view_spec: fqn_opt_vers '<' . view_parms '>' - - IDENTIFIER_1_0 shift, and go to state 36 - - view_parms go to state 394 - fqn_1_0 go to state 163 - ident_1_0 go to state 251 - fqn_vers go to state 161 - fqn_opt_vers go to state 252 - view_parm go to state 253 - - -State 329 - - 233 db_member_1_0: opt_template_1_0 KW_database fqn_opt_vers . ident_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 395 - - -State 330 - - 234 table_member_1_0: opt_template_1_0 KW_table fqn_opt_vers . ident_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 396 - - -State 331 - - 64 func_1_0_fact_signature: '*' func_1_0_fact_params . func_1_0_vararg_formals - 68 func_1_0_fact_params: func_1_0_fact_params . ',' fact_param_1_0 - - ',' shift, and go to state 397 - - $default reduce using rule 251 (empty) - - func_1_0_vararg_formals go to state 398 - empty go to state 337 - - -State 332 - - 69 fact_param_1_0: typespec_1_0 IDENTIFIER_1_0 . - - $default reduce using rule 69 (fact_param_1_0) - - -State 333 - - 61 func_1_0_fact_sig: '<' func_1_0_fact_signature '>' . - - $default reduce using rule 61 (func_1_0_fact_sig) - - -State 334 - - 66 func_1_0_fact_signature: func_1_0_fact_params ',' . '*' func_1_0_fact_params func_1_0_vararg_formals - 68 func_1_0_fact_params: func_1_0_fact_params ',' . fact_param_1_0 - 81 func_1_0_vararg_formals: ',' . ELLIPSIS - - ELLIPSIS shift, and go to state 399 - IDENTIFIER_1_0 shift, and go to state 36 - '*' shift, and go to state 400 - - typespec_1_0 go to state 274 - fact_param_1_0 go to state 401 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 335 - - 65 func_1_0_fact_signature: func_1_0_fact_params '*' . func_1_0_fact_params func_1_0_vararg_formals - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 274 - func_1_0_fact_params go to state 402 - fact_param_1_0 go to state 277 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 336 - - 63 func_1_0_fact_signature: func_1_0_fact_params func_1_0_vararg_formals . - - $default reduce using rule 63 (func_1_0_fact_signature) - - -State 337 - - 80 func_1_0_vararg_formals: empty . - - $default reduce using rule 80 (func_1_0_vararg_formals) - - -State 338 - - 79 formal_param_1_0: KW_control . typespec_1_0 IDENTIFIER_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 403 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 339 - - 73 func_1_0_param_signature: '*' . func_1_0_formal_params func_1_0_vararg_formals - - IDENTIFIER_1_0 shift, and go to state 36 - KW_control shift, and go to state 338 - - typespec_1_0 go to state 340 - func_1_0_formal_params go to state 404 - formal_param_1_0 go to state 343 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 340 - - 78 formal_param_1_0: typespec_1_0 . IDENTIFIER_1_0 - - IDENTIFIER_1_0 shift, and go to state 405 - - -State 341 - - 70 func_1_0_param_sig: '(' func_1_0_param_signature . ')' - - ')' shift, and go to state 406 - - -State 342 - - 72 func_1_0_param_signature: func_1_0_formal_params . func_1_0_vararg_formals - 74 | func_1_0_formal_params . '*' func_1_0_formal_params func_1_0_vararg_formals - 75 | func_1_0_formal_params . ',' '*' func_1_0_formal_params func_1_0_vararg_formals - 77 func_1_0_formal_params: func_1_0_formal_params . ',' formal_param_1_0 - - ',' shift, and go to state 407 - '*' shift, and go to state 408 - - $default reduce using rule 251 (empty) - - func_1_0_vararg_formals go to state 409 - empty go to state 337 - - -State 343 - - 76 func_1_0_formal_params: formal_param_1_0 . - - $default reduce using rule 76 (func_1_0_formal_params) - - -State 344 - - 71 func_1_0_param_signature: empty . - - $default reduce using rule 71 (func_1_0_param_signature) - - -State 345 - - 82 func_1_0_prologue: ';' . - - $default reduce using rule 82 (func_1_0_prologue) - - -State 346 - - 84 func_1_0_prologue: '{' . script_1_0_stmt_seq '}' - - IDENTIFIER_1_0 shift, and go to state 36 - KW_return shift, and go to state 410 - - typespec_1_0 go to state 96 - script_1_0_stmt_seq go to state 411 - script_1_0_stmt go to state 412 - type_expr_1_0 go to state 413 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 347 - - 83 func_1_0_prologue: '=' . fqn_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 414 - ident_1_0 go to state 38 - - -State 348 - - 47 func_1_0_decl: opt_func_1_0_kdbtext_sig func_1_0_return_type fqn_opt_vers opt_func_1_0_fact_sig func_1_0_param_sig func_1_0_prologue . - - $default reduce using rule 47 (func_1_0_decl) - - -State 349 - - 104 phys_1_0_body_stmt: KW___row_length . '=' fqn_1_0 '(' ')' - - '=' shift, and go to state 415 - - -State 350 - - 102 phys_1_0_body_stmt: KW_decode . phys_1_0_stmt - - '{' shift, and go to state 355 - - phys_1_0_stmt go to state 416 - - -State 351 - - 103 phys_1_0_body_stmt: KW_encode . phys_1_0_stmt - - '{' shift, and go to state 355 - - phys_1_0_stmt go to state 417 - - -State 352 - - 101 phys_1_0_body_stmt: ';' . - - $default reduce using rule 101 (phys_1_0_body_stmt) - - -State 353 - - 98 phys_1_0_prologue: '{' phys_1_0_body . '}' - 100 phys_1_0_body: phys_1_0_body . phys_1_0_body_stmt - - KW___row_length shift, and go to state 349 - KW_decode shift, and go to state 350 - KW_encode shift, and go to state 351 - ';' shift, and go to state 352 - '}' shift, and go to state 418 - - phys_1_0_body_stmt go to state 419 - - -State 354 - - 99 phys_1_0_body: phys_1_0_body_stmt . - - $default reduce using rule 99 (phys_1_0_body) - - -State 355 - - 105 phys_1_0_stmt: '{' . script_1_0_stmt_seq '}' - - IDENTIFIER_1_0 shift, and go to state 36 - KW_return shift, and go to state 410 - - typespec_1_0 go to state 96 - script_1_0_stmt_seq go to state 420 - script_1_0_stmt go to state 412 - type_expr_1_0 go to state 413 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 356 - - 97 phys_1_0_prologue: '=' phys_1_0_stmt . - - $default reduce using rule 97 (phys_1_0_prologue) - - -State 357 - - 123 tbl_1_0_stmt: KW___untyped '=' fqn_1_0 . '(' ')' ';' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '(' shift, and go to state 421 - ':' shift, and go to state 81 - - -State 358 - - 118 tbl_1_0_stmt: KW_column KW_default KW_limit . '=' expression_1_0 ';' - - '=' shift, and go to state 422 - - -State 359 - - 117 tbl_1_0_stmt: KW_column KW_limit '=' . expression_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 423 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 360 - - 153 default_view_1_0_decl: KW_default KW_view STRING . ';' - - ';' shift, and go to state 424 - - -State 361 - - 156 physmbr_1_0_decl: KW_column phys_coldef_1_0 . PHYSICAL_IDENTIFIER_1_0 ';' - 157 | KW_column phys_coldef_1_0 . PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' - - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 425 - - -State 362 - - 160 opt_col_kdbtext_parms_1_0: '<' col_kdbtext_parms_1_0 . '>' - 162 col_kdbtext_parms_1_0: col_kdbtext_parms_1_0 . ',' col_kdbtext_parm_1_0 - - ',' shift, and go to state 426 - '>' shift, and go to state 427 - - -State 363 - - 161 col_kdbtext_parms_1_0: col_kdbtext_parm_1_0 . - - $default reduce using rule 161 (col_kdbtext_parms_1_0) - - -State 364 - - 164 col_kdbtext_parm_1_0: col_kdbtext_value_1_0 . - - $default reduce using rule 164 (col_kdbtext_parm_1_0) - - -State 365 - - 166 col_kdbtext_value_1_0: uint_expr_1_0 . - - $default reduce using rule 166 (col_kdbtext_value_1_0) - - -State 366 - - 163 col_kdbtext_parm_1_0: fqn_1_0 . '=' col_kdbtext_value_1_0 - 165 col_kdbtext_value_1_0: fqn_1_0 . - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '=' shift, and go to state 428 - ':' shift, and go to state 81 - - $default reduce using rule 165 (col_kdbtext_value_1_0) - - -State 367 - - 154 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 . ';' - 155 | phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 . '=' cond_expr_1_0 ';' - - ';' shift, and go to state 429 - '=' shift, and go to state 430 - - -State 368 - - 158 phys_coldef_1_0: opt_col_kdbtext_parms_1_0 fqn_opt_vers . opt_factory_parms_1_0 - - '<' shift, and go to state 204 - - $default reduce using rule 251 (empty) - - opt_factory_parms_1_0 go to state 431 - factory_parms_1_0 go to state 206 - empty go to state 207 - - -State 369 - - 121 tbl_1_0_stmt: KW_static KW_physical physmbr_1_0_decl . - - $default reduce using rule 121 (tbl_1_0_stmt) - - -State 370 - - 126 production_1_0_stmt: KW_trigger ident_1_0 '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 432 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 371 - - 125 production_1_0_stmt: typespec_1_0 ident_1_0 '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 433 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 372 - - 136 phys_enc_ref: '<' kdbtext_parms_1_0 . '>' fqn_opt_vers opt_factory_parms_1_0 - 187 kdbtext_parms_1_0: kdbtext_parms_1_0 . ',' kdbtext_parm_1_0 - - ',' shift, and go to state 258 - '>' shift, and go to state 434 - - -State 373 - - 134 col_1_0_decl: typespec_1_0 typed_column_decl_1_0 . - - $default reduce using rule 134 (col_1_0_decl) - - -State 374 - - 139 typed_column_decl_1_0: col_ident . '{' opt_column_body_1_0 '}' - 140 | col_ident . '=' cond_expr_1_0 ';' - 141 | col_ident . ';' - - ';' shift, and go to state 435 - '{' shift, and go to state 436 - '=' shift, and go to state 437 - - -State 375 - - 143 col_ident: phys_ident . - - $default reduce using rule 143 (col_ident) - - -State 376 - - 142 col_ident: ident_1_0 . - - $default reduce using rule 142 (col_ident) - - -State 377 - - 135 col_1_0_decl: phys_enc_ref typed_column_decl_1_0 . - - $default reduce using rule 135 (col_1_0_decl) - - -State 378 - - 138 phys_enc_ref: fqn_1_0 factory_parms_1_0 . - - $default reduce using rule 138 (phys_enc_ref) - - -State 379 - - 137 phys_enc_ref: fqn_vers opt_factory_parms_1_0 . - - $default reduce using rule 137 (phys_enc_ref) - - -State 380 - - 238 view_parms: view_parms ',' ident_1_0 . - 240 fqn_1_0: ident_1_0 . - - ',' reduce using rule 238 (view_parms) - '>' reduce using rule 238 (view_parms) - $default reduce using rule 240 (fqn_1_0) - - -State 381 - - 264 view_parms: view_parms ',' view_parm . - - $default reduce using rule 264 (view_parms) - - -State 382 - - 274 opt_view_parents: '=' . view_parents - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 438 - view_parents go to state 439 - view_parent go to state 440 - - -State 383 - - 273 opt_view_parents: empty . - - $default reduce using rule 273 (opt_view_parents) - - -State 384 - - 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents . '{' opt_view_body '}' - - '{' shift, and go to state 441 - - -State 385 - - 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 . '(' opt_func_1_0_parms ')' - - '(' shift, and go to state 442 - - -State 386 - - 189 kdbtext_parm_1_0: fqn_1_0 '[' dim_1_0 ']' . - - $default reduce using rule 189 (kdbtext_parm_1_0) - - -State 387 - - 219 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' PHYSICAL_IDENTIFIER_1_0 . - - $default reduce using rule 219 (join_expr_2_0) - - -State 388 - - 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' '.' . ident_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 443 - - -State 389 - - 168 cond_expr_1_0: cond_expr_1_0 '|' expression_1_0 . - - $default reduce using rule 168 (cond_expr_1_0) - - -State 390 - - 195 factory_parms: factory_parms ',' expression_1_0 . - - $default reduce using rule 195 (factory_parms) - - -State 391 - - 185 func_expr_1_0: fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' . - - $default reduce using rule 185 (func_expr_1_0) - - -State 392 - - 199 func_1_0_parms: func_1_0_parms ',' . expression_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 444 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 393 - - 235 alias_member_1_0: KW_alias view_spec ident_1_0 ';' . - - $default reduce using rule 235 (alias_member_1_0) - - -State 394 - - 236 view_spec: fqn_opt_vers '<' view_parms . '>' - 238 view_parms: view_parms . ',' ident_1_0 - 264 | view_parms . ',' view_parm - - ',' shift, and go to state 311 - '>' shift, and go to state 445 - - -State 395 - - 233 db_member_1_0: opt_template_1_0 KW_database fqn_opt_vers ident_1_0 . ';' - - ';' shift, and go to state 446 - - -State 396 - - 234 table_member_1_0: opt_template_1_0 KW_table fqn_opt_vers ident_1_0 . ';' - - ';' shift, and go to state 447 - - -State 397 - - 68 func_1_0_fact_params: func_1_0_fact_params ',' . fact_param_1_0 - 81 func_1_0_vararg_formals: ',' . ELLIPSIS - - ELLIPSIS shift, and go to state 399 - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 274 - fact_param_1_0 go to state 401 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 398 - - 64 func_1_0_fact_signature: '*' func_1_0_fact_params func_1_0_vararg_formals . - - $default reduce using rule 64 (func_1_0_fact_signature) - - -State 399 - - 81 func_1_0_vararg_formals: ',' ELLIPSIS . - - $default reduce using rule 81 (func_1_0_vararg_formals) - - -State 400 - - 66 func_1_0_fact_signature: func_1_0_fact_params ',' '*' . func_1_0_fact_params func_1_0_vararg_formals - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 274 - func_1_0_fact_params go to state 448 - fact_param_1_0 go to state 277 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 401 - - 68 func_1_0_fact_params: func_1_0_fact_params ',' fact_param_1_0 . - - $default reduce using rule 68 (func_1_0_fact_params) - - -State 402 - - 65 func_1_0_fact_signature: func_1_0_fact_params '*' func_1_0_fact_params . func_1_0_vararg_formals - 68 func_1_0_fact_params: func_1_0_fact_params . ',' fact_param_1_0 - - ',' shift, and go to state 397 - - $default reduce using rule 251 (empty) - - func_1_0_vararg_formals go to state 449 - empty go to state 337 - - -State 403 - - 79 formal_param_1_0: KW_control typespec_1_0 . IDENTIFIER_1_0 - - IDENTIFIER_1_0 shift, and go to state 450 - - -State 404 - - 73 func_1_0_param_signature: '*' func_1_0_formal_params . func_1_0_vararg_formals - 77 func_1_0_formal_params: func_1_0_formal_params . ',' formal_param_1_0 - - ',' shift, and go to state 451 - - $default reduce using rule 251 (empty) - - func_1_0_vararg_formals go to state 452 - empty go to state 337 - - -State 405 - - 78 formal_param_1_0: typespec_1_0 IDENTIFIER_1_0 . - - $default reduce using rule 78 (formal_param_1_0) - - -State 406 - - 70 func_1_0_param_sig: '(' func_1_0_param_signature ')' . - - $default reduce using rule 70 (func_1_0_param_sig) - - -State 407 - - 75 func_1_0_param_signature: func_1_0_formal_params ',' . '*' func_1_0_formal_params func_1_0_vararg_formals - 77 func_1_0_formal_params: func_1_0_formal_params ',' . formal_param_1_0 - 81 func_1_0_vararg_formals: ',' . ELLIPSIS - - ELLIPSIS shift, and go to state 399 - IDENTIFIER_1_0 shift, and go to state 36 - KW_control shift, and go to state 338 - '*' shift, and go to state 453 - - typespec_1_0 go to state 340 - formal_param_1_0 go to state 454 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 408 - - 74 func_1_0_param_signature: func_1_0_formal_params '*' . func_1_0_formal_params func_1_0_vararg_formals - - IDENTIFIER_1_0 shift, and go to state 36 - KW_control shift, and go to state 338 - - typespec_1_0 go to state 340 - func_1_0_formal_params go to state 455 - formal_param_1_0 go to state 343 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 409 - - 72 func_1_0_param_signature: func_1_0_formal_params func_1_0_vararg_formals . - - $default reduce using rule 72 (func_1_0_param_signature) - - -State 410 - - 87 script_1_0_stmt: KW_return . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 456 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 411 - - 84 func_1_0_prologue: '{' script_1_0_stmt_seq . '}' - 86 script_1_0_stmt_seq: script_1_0_stmt_seq . script_1_0_stmt - - IDENTIFIER_1_0 shift, and go to state 36 - KW_return shift, and go to state 410 - '}' shift, and go to state 457 - - typespec_1_0 go to state 96 - script_1_0_stmt go to state 458 - type_expr_1_0 go to state 413 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 412 - - 85 script_1_0_stmt_seq: script_1_0_stmt . - - $default reduce using rule 85 (script_1_0_stmt_seq) - - -State 413 - - 88 script_1_0_stmt: type_expr_1_0 . ident_1_0 '=' cond_expr_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 459 - - -State 414 - - 83 func_1_0_prologue: '=' fqn_1_0 . ';' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - ';' shift, and go to state 460 - ':' shift, and go to state 81 - - -State 415 - - 104 phys_1_0_body_stmt: KW___row_length '=' . fqn_1_0 '(' ')' - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 461 - ident_1_0 go to state 38 - - -State 416 - - 102 phys_1_0_body_stmt: KW_decode phys_1_0_stmt . - - $default reduce using rule 102 (phys_1_0_body_stmt) - - -State 417 - - 103 phys_1_0_body_stmt: KW_encode phys_1_0_stmt . - - $default reduce using rule 103 (phys_1_0_body_stmt) - - -State 418 - - 98 phys_1_0_prologue: '{' phys_1_0_body '}' . - - $default reduce using rule 98 (phys_1_0_prologue) - - -State 419 - - 100 phys_1_0_body: phys_1_0_body phys_1_0_body_stmt . - - $default reduce using rule 100 (phys_1_0_body) - - -State 420 - - 86 script_1_0_stmt_seq: script_1_0_stmt_seq . script_1_0_stmt - 105 phys_1_0_stmt: '{' script_1_0_stmt_seq . '}' - - IDENTIFIER_1_0 shift, and go to state 36 - KW_return shift, and go to state 410 - '}' shift, and go to state 462 - - typespec_1_0 go to state 96 - script_1_0_stmt go to state 458 - type_expr_1_0 go to state 413 - fqn_1_0 go to state 100 - ident_1_0 go to state 38 - - -State 421 - - 123 tbl_1_0_stmt: KW___untyped '=' fqn_1_0 '(' . ')' ';' - - ')' shift, and go to state 463 - - -State 422 - - 118 tbl_1_0_stmt: KW_column KW_default KW_limit '=' . expression_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - expression_1_0 go to state 464 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 423 - - 117 tbl_1_0_stmt: KW_column KW_limit '=' expression_1_0 . ';' - - ';' shift, and go to state 465 - - -State 424 - - 153 default_view_1_0_decl: KW_default KW_view STRING ';' . - - $default reduce using rule 153 (default_view_1_0_decl) - - -State 425 - - 156 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 . ';' - 157 | KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 . '=' cond_expr_1_0 ';' - - ';' shift, and go to state 466 - '=' shift, and go to state 467 - - -State 426 - - 162 col_kdbtext_parms_1_0: col_kdbtext_parms_1_0 ',' . col_kdbtext_parm_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - IDENTIFIER_1_0 shift, and go to state 36 - - col_kdbtext_parm_1_0 go to state 468 - col_kdbtext_value_1_0 go to state 364 - uint_expr_1_0 go to state 365 - fqn_1_0 go to state 366 - ident_1_0 go to state 38 - - -State 427 - - 160 opt_col_kdbtext_parms_1_0: '<' col_kdbtext_parms_1_0 '>' . - - $default reduce using rule 160 (opt_col_kdbtext_parms_1_0) - - -State 428 - - 163 col_kdbtext_parm_1_0: fqn_1_0 '=' . col_kdbtext_value_1_0 - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - IDENTIFIER_1_0 shift, and go to state 36 - - col_kdbtext_value_1_0 go to state 469 - uint_expr_1_0 go to state 365 - fqn_1_0 go to state 470 - ident_1_0 go to state 38 - - -State 429 - - 154 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' . - - $default reduce using rule 154 (physmbr_1_0_decl) - - -State 430 - - 155 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 471 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 431 - - 158 phys_coldef_1_0: opt_col_kdbtext_parms_1_0 fqn_opt_vers opt_factory_parms_1_0 . - - $default reduce using rule 158 (phys_coldef_1_0) - - -State 432 - - 126 production_1_0_stmt: KW_trigger ident_1_0 '=' cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 472 - '|' shift, and go to state 320 - - -State 433 - - 125 production_1_0_stmt: typespec_1_0 ident_1_0 '=' cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 473 - '|' shift, and go to state 320 - - -State 434 - - 136 phys_enc_ref: '<' kdbtext_parms_1_0 '>' . fqn_opt_vers opt_factory_parms_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 474 - - -State 435 - - 141 typed_column_decl_1_0: col_ident ';' . - - $default reduce using rule 141 (typed_column_decl_1_0) - - -State 436 - - 139 typed_column_decl_1_0: col_ident '{' . opt_column_body_1_0 '}' - - KW_limit shift, and go to state 475 - KW_read shift, and go to state 476 - KW_validate shift, and go to state 477 - ';' shift, and go to state 478 - - $default reduce using rule 251 (empty) - - opt_column_body_1_0 go to state 479 - column_body_1_0 go to state 480 - column_stmt_1_0 go to state 481 - empty go to state 482 - - -State 437 - - 140 typed_column_decl_1_0: col_ident '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 483 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 438 - - 277 view_parent: fqn_opt_vers . '<' view_parent_parms '>' - - '<' shift, and go to state 484 - - -State 439 - - 274 opt_view_parents: '=' view_parents . - 276 view_parents: view_parents . ',' view_parent - - ',' shift, and go to state 485 - - $default reduce using rule 274 (opt_view_parents) - - -State 440 - - 275 view_parents: view_parent . - - $default reduce using rule 275 (view_parents) - - -State 441 - - 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' . opt_view_body '}' - - IDENTIFIER_1_0 shift, and go to state 36 - KW_column shift, and go to state 486 - ';' shift, and go to state 487 - - $default reduce using rule 251 (empty) - - typespec_1_0 go to state 488 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - empty go to state 489 - opt_view_body go to state 490 - view_body go to state 491 - view_member go to state 492 - - -State 442 - - 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' . opt_func_1_0_parms ')' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - $default reduce using rule 251 (empty) - - phys_ident go to state 148 - expression_1_0 go to state 323 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - opt_func_1_0_parms go to state 493 - func_1_0_parms go to state 325 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - empty go to state 326 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 443 - - 218 join_expr_2_0: ident_1_0 '[' cond_expr_1_0 ']' '.' ident_1_0 . - - $default reduce using rule 218 (join_expr_2_0) - - -State 444 - - 199 func_1_0_parms: func_1_0_parms ',' expression_1_0 . - - $default reduce using rule 199 (func_1_0_parms) - - -State 445 - - 236 view_spec: fqn_opt_vers '<' view_parms '>' . - - $default reduce using rule 236 (view_spec) - - -State 446 - - 233 db_member_1_0: opt_template_1_0 KW_database fqn_opt_vers ident_1_0 ';' . - - $default reduce using rule 233 (db_member_1_0) - - -State 447 - - 234 table_member_1_0: opt_template_1_0 KW_table fqn_opt_vers ident_1_0 ';' . - - $default reduce using rule 234 (table_member_1_0) - - -State 448 - - 66 func_1_0_fact_signature: func_1_0_fact_params ',' '*' func_1_0_fact_params . func_1_0_vararg_formals - 68 func_1_0_fact_params: func_1_0_fact_params . ',' fact_param_1_0 - - ',' shift, and go to state 397 - - $default reduce using rule 251 (empty) - - func_1_0_vararg_formals go to state 494 - empty go to state 337 - - -State 449 - - 65 func_1_0_fact_signature: func_1_0_fact_params '*' func_1_0_fact_params func_1_0_vararg_formals . - - $default reduce using rule 65 (func_1_0_fact_signature) - - -State 450 - - 79 formal_param_1_0: KW_control typespec_1_0 IDENTIFIER_1_0 . - - $default reduce using rule 79 (formal_param_1_0) - - -State 451 - - 77 func_1_0_formal_params: func_1_0_formal_params ',' . formal_param_1_0 - 81 func_1_0_vararg_formals: ',' . ELLIPSIS - - ELLIPSIS shift, and go to state 399 - IDENTIFIER_1_0 shift, and go to state 36 - KW_control shift, and go to state 338 - - typespec_1_0 go to state 340 - formal_param_1_0 go to state 454 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 452 - - 73 func_1_0_param_signature: '*' func_1_0_formal_params func_1_0_vararg_formals . - - $default reduce using rule 73 (func_1_0_param_signature) - - -State 453 - - 75 func_1_0_param_signature: func_1_0_formal_params ',' '*' . func_1_0_formal_params func_1_0_vararg_formals - - IDENTIFIER_1_0 shift, and go to state 36 - KW_control shift, and go to state 338 - - typespec_1_0 go to state 340 - func_1_0_formal_params go to state 495 - formal_param_1_0 go to state 343 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 454 - - 77 func_1_0_formal_params: func_1_0_formal_params ',' formal_param_1_0 . - - $default reduce using rule 77 (func_1_0_formal_params) - - -State 455 - - 74 func_1_0_param_signature: func_1_0_formal_params '*' func_1_0_formal_params . func_1_0_vararg_formals - 77 func_1_0_formal_params: func_1_0_formal_params . ',' formal_param_1_0 - - ',' shift, and go to state 451 - - $default reduce using rule 251 (empty) - - func_1_0_vararg_formals go to state 496 - empty go to state 337 - - -State 456 - - 87 script_1_0_stmt: KW_return cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 497 - '|' shift, and go to state 320 - - -State 457 - - 84 func_1_0_prologue: '{' script_1_0_stmt_seq '}' . - - $default reduce using rule 84 (func_1_0_prologue) - - -State 458 - - 86 script_1_0_stmt_seq: script_1_0_stmt_seq script_1_0_stmt . - - $default reduce using rule 86 (script_1_0_stmt_seq) - - -State 459 - - 88 script_1_0_stmt: type_expr_1_0 ident_1_0 . '=' cond_expr_1_0 ';' - - '=' shift, and go to state 498 - - -State 460 - - 83 func_1_0_prologue: '=' fqn_1_0 ';' . - - $default reduce using rule 83 (func_1_0_prologue) - - -State 461 - - 104 phys_1_0_body_stmt: KW___row_length '=' fqn_1_0 . '(' ')' - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - '(' shift, and go to state 499 - ':' shift, and go to state 81 - - -State 462 - - 105 phys_1_0_stmt: '{' script_1_0_stmt_seq '}' . - - $default reduce using rule 105 (phys_1_0_stmt) - - -State 463 - - 123 tbl_1_0_stmt: KW___untyped '=' fqn_1_0 '(' ')' . ';' - - ';' shift, and go to state 500 - - -State 464 - - 118 tbl_1_0_stmt: KW_column KW_default KW_limit '=' expression_1_0 . ';' - - ';' shift, and go to state 501 - - -State 465 - - 117 tbl_1_0_stmt: KW_column KW_limit '=' expression_1_0 ';' . - - $default reduce using rule 117 (tbl_1_0_stmt) - - -State 466 - - 156 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 ';' . - - $default reduce using rule 156 (physmbr_1_0_decl) - - -State 467 - - 157 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 502 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 468 - - 162 col_kdbtext_parms_1_0: col_kdbtext_parms_1_0 ',' col_kdbtext_parm_1_0 . - - $default reduce using rule 162 (col_kdbtext_parms_1_0) - - -State 469 - - 163 col_kdbtext_parm_1_0: fqn_1_0 '=' col_kdbtext_value_1_0 . - - $default reduce using rule 163 (col_kdbtext_parm_1_0) - - -State 470 - - 165 col_kdbtext_value_1_0: fqn_1_0 . - 241 fqn_1_0: fqn_1_0 . ':' ident_1_0 - 242 | fqn_1_0 . ':' KW_database - 243 | fqn_1_0 . ':' KW_decode - 244 | fqn_1_0 . ':' KW_encode - 245 | fqn_1_0 . ':' KW_read - 246 | fqn_1_0 . ':' KW_table - 247 | fqn_1_0 . ':' KW_type - 248 | fqn_1_0 . ':' KW_view - 249 | fqn_1_0 . ':' KW_write - - ':' shift, and go to state 81 - - $default reduce using rule 165 (col_kdbtext_value_1_0) - - -State 471 - - 155 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 503 - '|' shift, and go to state 320 - - -State 472 - - 126 production_1_0_stmt: KW_trigger ident_1_0 '=' cond_expr_1_0 ';' . - - $default reduce using rule 126 (production_1_0_stmt) - - -State 473 - - 125 production_1_0_stmt: typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' . - - $default reduce using rule 125 (production_1_0_stmt) - - -State 474 - - 136 phys_enc_ref: '<' kdbtext_parms_1_0 '>' fqn_opt_vers . opt_factory_parms_1_0 - - '<' shift, and go to state 204 - - $default reduce using rule 251 (empty) - - opt_factory_parms_1_0 go to state 504 - factory_parms_1_0 go to state 206 - empty go to state 207 - - -State 475 - - 151 column_stmt_1_0: KW_limit . '=' uint_expr_1_0 ';' - - '=' shift, and go to state 505 - - -State 476 - - 149 column_stmt_1_0: KW_read . '=' cond_expr_1_0 ';' - - '=' shift, and go to state 506 - - -State 477 - - 150 column_stmt_1_0: KW_validate . '=' cond_expr_1_0 ';' - - '=' shift, and go to state 507 - - -State 478 - - 152 column_stmt_1_0: ';' . - - $default reduce using rule 152 (column_stmt_1_0) - - -State 479 - - 139 typed_column_decl_1_0: col_ident '{' opt_column_body_1_0 . '}' - - '}' shift, and go to state 508 - - -State 480 - - 146 opt_column_body_1_0: column_body_1_0 . - 148 column_body_1_0: column_body_1_0 . column_stmt_1_0 - - KW_limit shift, and go to state 475 - KW_read shift, and go to state 476 - KW_validate shift, and go to state 477 - ';' shift, and go to state 478 - - $default reduce using rule 146 (opt_column_body_1_0) - - column_stmt_1_0 go to state 509 - - -State 481 - - 147 column_body_1_0: column_stmt_1_0 . - - $default reduce using rule 147 (column_body_1_0) - - -State 482 - - 145 opt_column_body_1_0: empty . - - $default reduce using rule 145 (opt_column_body_1_0) - - -State 483 - - 140 typed_column_decl_1_0: col_ident '=' cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 510 - '|' shift, and go to state 320 - - -State 484 - - 277 view_parent: fqn_opt_vers '<' . view_parent_parms '>' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 511 - view_parent_parms go to state 512 - - -State 485 - - 276 view_parents: view_parents ',' . view_parent - - IDENTIFIER_1_0 shift, and go to state 36 - - fqn_1_0 go to state 163 - ident_1_0 go to state 38 - fqn_vers go to state 161 - fqn_opt_vers go to state 438 - view_parent go to state 513 - - -State 486 - - 271 view_member: KW_column . typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - typespec_1_0 go to state 514 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - - -State 487 - - 272 view_member: ';' . - - $default reduce using rule 272 (view_member) - - -State 488 - - 270 view_member: typespec_1_0 . ident_1_0 '=' cond_expr_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 515 - - -State 489 - - 266 opt_view_body: empty . - - $default reduce using rule 266 (opt_view_body) - - -State 490 - - 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body . '}' - - '}' shift, and go to state 516 - - -State 491 - - 267 opt_view_body: view_body . - 269 view_body: view_body . view_member - - IDENTIFIER_1_0 shift, and go to state 36 - KW_column shift, and go to state 486 - ';' shift, and go to state 487 - - $default reduce using rule 267 (opt_view_body) - - typespec_1_0 go to state 488 - fqn_1_0 go to state 40 - ident_1_0 go to state 38 - view_member go to state 517 - - -State 492 - - 268 view_body: view_member . - - $default reduce using rule 268 (view_body) - - -State 493 - - 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms . ')' - - ')' shift, and go to state 518 - - -State 494 - - 66 func_1_0_fact_signature: func_1_0_fact_params ',' '*' func_1_0_fact_params func_1_0_vararg_formals . - - $default reduce using rule 66 (func_1_0_fact_signature) - - -State 495 - - 75 func_1_0_param_signature: func_1_0_formal_params ',' '*' func_1_0_formal_params . func_1_0_vararg_formals - 77 func_1_0_formal_params: func_1_0_formal_params . ',' formal_param_1_0 - - ',' shift, and go to state 451 - - $default reduce using rule 251 (empty) - - func_1_0_vararg_formals go to state 519 - empty go to state 337 - - -State 496 - - 74 func_1_0_param_signature: func_1_0_formal_params '*' func_1_0_formal_params func_1_0_vararg_formals . - - $default reduce using rule 74 (func_1_0_param_signature) - - -State 497 - - 87 script_1_0_stmt: KW_return cond_expr_1_0 ';' . - - $default reduce using rule 87 (script_1_0_stmt) - - -State 498 - - 88 script_1_0_stmt: type_expr_1_0 ident_1_0 '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 520 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 499 - - 104 phys_1_0_body_stmt: KW___row_length '=' fqn_1_0 '(' . ')' - - ')' shift, and go to state 521 - - -State 500 - - 123 tbl_1_0_stmt: KW___untyped '=' fqn_1_0 '(' ')' ';' . - - $default reduce using rule 123 (tbl_1_0_stmt) - - -State 501 - - 118 tbl_1_0_stmt: KW_column KW_default KW_limit '=' expression_1_0 ';' . - - $default reduce using rule 118 (tbl_1_0_stmt) - - -State 502 - - 157 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 522 - '|' shift, and go to state 320 - - -State 503 - - 155 physmbr_1_0_decl: phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' . - - $default reduce using rule 155 (physmbr_1_0_decl) - - -State 504 - - 136 phys_enc_ref: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 . - - $default reduce using rule 136 (phys_enc_ref) - - -State 505 - - 151 column_stmt_1_0: KW_limit '=' . uint_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - - uint_expr_1_0 go to state 523 - - -State 506 - - 149 column_stmt_1_0: KW_read '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 524 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 507 - - 150 column_stmt_1_0: KW_validate '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 525 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 508 - - 139 typed_column_decl_1_0: col_ident '{' opt_column_body_1_0 '}' . - - $default reduce using rule 139 (typed_column_decl_1_0) - - -State 509 - - 148 column_body_1_0: column_body_1_0 column_stmt_1_0 . - - $default reduce using rule 148 (column_body_1_0) - - -State 510 - - 140 typed_column_decl_1_0: col_ident '=' cond_expr_1_0 ';' . - - $default reduce using rule 140 (typed_column_decl_1_0) - - -State 511 - - 278 view_parent_parms: ident_1_0 . - - $default reduce using rule 278 (view_parent_parms) - - -State 512 - - 277 view_parent: fqn_opt_vers '<' view_parent_parms . '>' - 279 view_parent_parms: view_parent_parms . ',' ident_1_0 - - ',' shift, and go to state 526 - '>' shift, and go to state 527 - - -State 513 - - 276 view_parents: view_parents ',' view_parent . - - $default reduce using rule 276 (view_parents) - - -State 514 - - 271 view_member: KW_column typespec_1_0 . ident_1_0 '=' cond_expr_1_0 ';' - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 528 - - -State 515 - - 270 view_member: typespec_1_0 ident_1_0 . '=' cond_expr_1_0 ';' - - '=' shift, and go to state 529 - - -State 516 - - 262 view_2_0_decl: KW_view fqn_vers '<' view_parms '>' opt_view_parents '{' opt_view_body '}' . - - $default reduce using rule 262 (view_2_0_decl) - - -State 517 - - 269 view_body: view_body view_member . - - $default reduce using rule 269 (view_body) - - -State 518 - - 184 func_expr_1_0: '<' kdbtext_parms_1_0 '>' fqn_opt_vers opt_factory_parms_1_0 '(' opt_func_1_0_parms ')' . - - $default reduce using rule 184 (func_expr_1_0) - - -State 519 - - 75 func_1_0_param_signature: func_1_0_formal_params ',' '*' func_1_0_formal_params func_1_0_vararg_formals . - - $default reduce using rule 75 (func_1_0_param_signature) - - -State 520 - - 88 script_1_0_stmt: type_expr_1_0 ident_1_0 '=' cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 530 - '|' shift, and go to state 320 - - -State 521 - - 104 phys_1_0_body_stmt: KW___row_length '=' fqn_1_0 '(' ')' . - - $default reduce using rule 104 (phys_1_0_body_stmt) - - -State 522 - - 157 physmbr_1_0_decl: KW_column phys_coldef_1_0 PHYSICAL_IDENTIFIER_1_0 '=' cond_expr_1_0 ';' . - - $default reduce using rule 157 (physmbr_1_0_decl) - - -State 523 - - 151 column_stmt_1_0: KW_limit '=' uint_expr_1_0 . ';' - - ';' shift, and go to state 531 - - -State 524 - - 149 column_stmt_1_0: KW_read '=' cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 532 - '|' shift, and go to state 320 - - -State 525 - - 150 column_stmt_1_0: KW_validate '=' cond_expr_1_0 . ';' - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - - ';' shift, and go to state 533 - '|' shift, and go to state 320 - - -State 526 - - 279 view_parent_parms: view_parent_parms ',' . ident_1_0 - - IDENTIFIER_1_0 shift, and go to state 36 - - ident_1_0 go to state 534 - - -State 527 - - 277 view_parent: fqn_opt_vers '<' view_parent_parms '>' . - - $default reduce using rule 277 (view_parent) - - -State 528 - - 271 view_member: KW_column typespec_1_0 ident_1_0 . '=' cond_expr_1_0 ';' - - '=' shift, and go to state 535 - - -State 529 - - 270 view_member: typespec_1_0 ident_1_0 '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 536 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 530 - - 88 script_1_0_stmt: type_expr_1_0 ident_1_0 '=' cond_expr_1_0 ';' . - - $default reduce using rule 88 (script_1_0_stmt) - - -State 531 - - 151 column_stmt_1_0: KW_limit '=' uint_expr_1_0 ';' . - - $default reduce using rule 151 (column_stmt_1_0) - - -State 532 - - 149 column_stmt_1_0: KW_read '=' cond_expr_1_0 ';' . - - $default reduce using rule 149 (column_stmt_1_0) - - -State 533 - - 150 column_stmt_1_0: KW_validate '=' cond_expr_1_0 ';' . - - $default reduce using rule 150 (column_stmt_1_0) - - -State 534 - - 279 view_parent_parms: view_parent_parms ',' ident_1_0 . - - $default reduce using rule 279 (view_parent_parms) - - -State 535 - - 271 view_member: KW_column typespec_1_0 ident_1_0 '=' . cond_expr_1_0 ';' - - DECIMAL shift, and go to state 130 - OCTAL shift, and go to state 131 - HEX shift, and go to state 132 - FLOAT_ shift, and go to state 133 - EXP_FLOAT shift, and go to state 134 - STRING shift, and go to state 135 - ESCAPED_STRING shift, and go to state 136 - IDENTIFIER_1_0 shift, and go to state 36 - PHYSICAL_IDENTIFIER_1_0 shift, and go to state 137 - KW_false shift, and go to state 138 - KW_true shift, and go to state 139 - '[' shift, and go to state 140 - '(' shift, and go to state 142 - '<' shift, and go to state 143 - '@' shift, and go to state 144 - '-' shift, and go to state 145 - '+' shift, and go to state 146 - - phys_ident go to state 148 - cond_expr_1_0 go to state 537 - expression_1_0 go to state 262 - primary_expr_1_0 go to state 150 - func_expr_1_0 go to state 151 - uint_expr_1_0 go to state 152 - float_expr_1_0 go to state 153 - string_expr_1_0 go to state 154 - const_vect_expr_1_0 go to state 155 - bool_expr_1_0 go to state 156 - member_expr_2_0 go to state 157 - join_expr_2_0 go to state 158 - fqn_1_0 go to state 159 - ident_1_0 go to state 160 - fqn_vers go to state 161 - fqn_opt_vers go to state 162 - - -State 536 - - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - 270 view_member: typespec_1_0 ident_1_0 '=' cond_expr_1_0 . ';' - - ';' shift, and go to state 538 - '|' shift, and go to state 320 - - -State 537 - - 168 cond_expr_1_0: cond_expr_1_0 . '|' expression_1_0 - 271 view_member: KW_column typespec_1_0 ident_1_0 '=' cond_expr_1_0 . ';' - - ';' shift, and go to state 539 - '|' shift, and go to state 320 - - -State 538 - - 270 view_member: typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' . - - $default reduce using rule 270 (view_member) - - -State 539 - - 271 view_member: KW_column typespec_1_0 ident_1_0 '=' cond_expr_1_0 ';' . - - $default reduce using rule 271 (view_member) diff --git a/libs/kdbtext/zz_kdbtext-lex.c b/libs/kdbtext/zz_kdbtext-lex.c deleted file mode 100644 index 0f40efbf5..000000000 --- a/libs/kdbtext/zz_kdbtext-lex.c +++ /dev/null @@ -1,2356 +0,0 @@ - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -/* %not-for-header */ -/* %if-c-only */ -/* %if-not-reentrant */ -#define yy_create_buffer KDBText__create_buffer -#define yy_delete_buffer KDBText__delete_buffer -#define yy_scan_buffer KDBText__scan_buffer -#define yy_scan_string KDBText__scan_string -#define yy_scan_bytes KDBText__scan_bytes -#define yy_init_buffer KDBText__init_buffer -#define yy_flush_buffer KDBText__flush_buffer -#define yy_load_buffer_state KDBText__load_buffer_state -#define yy_switch_to_buffer KDBText__switch_to_buffer -#define yypush_buffer_state KDBText_push_buffer_state -#define yypop_buffer_state KDBText_pop_buffer_state -#define yyensure_buffer_stack KDBText_ensure_buffer_stack -#define yy_flex_debug KDBText__flex_debug -#define yyin KDBText_in -#define yyleng KDBText_leng -#define yylex KDBText_lex -#define yylineno KDBText_lineno -#define yyout KDBText_out -#define yyrestart KDBText_restart -#define yytext KDBText_text -#define yywrap KDBText_wrap -#define yyalloc KDBText_alloc -#define yyrealloc KDBText_realloc -#define yyfree KDBText_free - -/* %endif */ -/* %endif */ -/* %ok-for-header */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* %if-c++-only */ -/* %endif */ - -/* %if-c-only */ -#ifdef yy_create_buffer -#define KDBText__create_buffer_ALREADY_DEFINED -#else -#define yy_create_buffer KDBText__create_buffer -#endif - -#ifdef yy_delete_buffer -#define KDBText__delete_buffer_ALREADY_DEFINED -#else -#define yy_delete_buffer KDBText__delete_buffer -#endif - -#ifdef yy_scan_buffer -#define KDBText__scan_buffer_ALREADY_DEFINED -#else -#define yy_scan_buffer KDBText__scan_buffer -#endif - -#ifdef yy_scan_string -#define KDBText__scan_string_ALREADY_DEFINED -#else -#define yy_scan_string KDBText__scan_string -#endif - -#ifdef yy_scan_bytes -#define KDBText__scan_bytes_ALREADY_DEFINED -#else -#define yy_scan_bytes KDBText__scan_bytes -#endif - -#ifdef yy_init_buffer -#define KDBText__init_buffer_ALREADY_DEFINED -#else -#define yy_init_buffer KDBText__init_buffer -#endif - -#ifdef yy_flush_buffer -#define KDBText__flush_buffer_ALREADY_DEFINED -#else -#define yy_flush_buffer KDBText__flush_buffer -#endif - -#ifdef yy_load_buffer_state -#define KDBText__load_buffer_state_ALREADY_DEFINED -#else -#define yy_load_buffer_state KDBText__load_buffer_state -#endif - -#ifdef yy_switch_to_buffer -#define KDBText__switch_to_buffer_ALREADY_DEFINED -#else -#define yy_switch_to_buffer KDBText__switch_to_buffer -#endif - -#ifdef yypush_buffer_state -#define KDBText_push_buffer_state_ALREADY_DEFINED -#else -#define yypush_buffer_state KDBText_push_buffer_state -#endif - -#ifdef yypop_buffer_state -#define KDBText_pop_buffer_state_ALREADY_DEFINED -#else -#define yypop_buffer_state KDBText_pop_buffer_state -#endif - -#ifdef yyensure_buffer_stack -#define KDBText_ensure_buffer_stack_ALREADY_DEFINED -#else -#define yyensure_buffer_stack KDBText_ensure_buffer_stack -#endif - -#ifdef yylex -#define KDBText_lex_ALREADY_DEFINED -#else -#define yylex KDBText_lex -#endif - -#ifdef yyrestart -#define KDBText_restart_ALREADY_DEFINED -#else -#define yyrestart KDBText_restart -#endif - -#ifdef yylex_init -#define KDBText_lex_init_ALREADY_DEFINED -#else -#define yylex_init KDBText_lex_init -#endif - -#ifdef yylex_init_extra -#define KDBText_lex_init_extra_ALREADY_DEFINED -#else -#define yylex_init_extra KDBText_lex_init_extra -#endif - -#ifdef yylex_destroy -#define KDBText_lex_destroy_ALREADY_DEFINED -#else -#define yylex_destroy KDBText_lex_destroy -#endif - -#ifdef yyget_debug -#define KDBText_get_debug_ALREADY_DEFINED -#else -#define yyget_debug KDBText_get_debug -#endif - -#ifdef yyset_debug -#define KDBText_set_debug_ALREADY_DEFINED -#else -#define yyset_debug KDBText_set_debug -#endif - -#ifdef yyget_extra -#define KDBText_get_extra_ALREADY_DEFINED -#else -#define yyget_extra KDBText_get_extra -#endif - -#ifdef yyset_extra -#define KDBText_set_extra_ALREADY_DEFINED -#else -#define yyset_extra KDBText_set_extra -#endif - -#ifdef yyget_in -#define KDBText_get_in_ALREADY_DEFINED -#else -#define yyget_in KDBText_get_in -#endif - -#ifdef yyset_in -#define KDBText_set_in_ALREADY_DEFINED -#else -#define yyset_in KDBText_set_in -#endif - -#ifdef yyget_out -#define KDBText_get_out_ALREADY_DEFINED -#else -#define yyget_out KDBText_get_out -#endif - -#ifdef yyset_out -#define KDBText_set_out_ALREADY_DEFINED -#else -#define yyset_out KDBText_set_out -#endif - -#ifdef yyget_leng -#define KDBText_get_leng_ALREADY_DEFINED -#else -#define yyget_leng KDBText_get_leng -#endif - -#ifdef yyget_text -#define KDBText_get_text_ALREADY_DEFINED -#else -#define yyget_text KDBText_get_text -#endif - -#ifdef yyget_lineno -#define KDBText_get_lineno_ALREADY_DEFINED -#else -#define yyget_lineno KDBText_get_lineno -#endif - -#ifdef yyset_lineno -#define KDBText_set_lineno_ALREADY_DEFINED -#else -#define yyset_lineno KDBText_set_lineno -#endif - -#ifdef yywrap -#define KDBText_wrap_ALREADY_DEFINED -#else -#define yywrap KDBText_wrap -#endif - -/* %endif */ - -#ifdef yyalloc -#define KDBText_alloc_ALREADY_DEFINED -#else -#define yyalloc KDBText_alloc -#endif - -#ifdef yyrealloc -#define KDBText_realloc_ALREADY_DEFINED -#else -#define yyrealloc KDBText_realloc -#endif - -#ifdef yyfree -#define KDBText_free_ALREADY_DEFINED -#else -#define yyfree KDBText_free -#endif - -/* %if-c-only */ - -#ifdef yytext -#define KDBText_text_ALREADY_DEFINED -#else -#define yytext KDBText_text -#endif - -#ifdef yyleng -#define KDBText_leng_ALREADY_DEFINED -#else -#define yyleng KDBText_leng -#endif - -#ifdef yyin -#define KDBText_in_ALREADY_DEFINED -#else -#define yyin KDBText_in -#endif - -#ifdef yyout -#define KDBText_out_ALREADY_DEFINED -#else -#define yyout KDBText_out -#endif - -#ifdef yy_flex_debug -#define KDBText__flex_debug_ALREADY_DEFINED -#else -#define yy_flex_debug KDBText__flex_debug -#endif - -#ifdef yylineno -#define KDBText_lineno_ALREADY_DEFINED -#else -#define yylineno KDBText_lineno -#endif - -/* %endif */ - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -/* %if-c-only */ -#include -#include -#include -#include -/* %endif */ - -/* %if-tables-serialization */ -/* %endif */ -/* end standard C headers. */ - -/* %if-c-or-c++ */ -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -/* %endif */ - -/* begin standard C++ headers. */ -/* %if-c++-only */ -/* %endif */ - -/* TODO: this is always defined, so inline it */ -#define yyconst const - -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) -#else -#define yynoreturn -#endif - -/* %not-for-header */ -/* Returned upon end-of-file. */ -#define YY_NULL 0 -/* %ok-for-header */ - -/* %not-for-header */ -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. - */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) -/* %ok-for-header */ - -/* %if-reentrant */ -/* %endif */ - -/* %if-not-reentrant */ - -/* %endif */ - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -/* %if-not-reentrant */ -extern int yyleng; -/* %endif */ - -/* %if-c-only */ -/* %if-not-reentrant */ -extern FILE *yyin, *yyout; -/* %endif */ -/* %endif */ - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { -/* %if-c-only */ - FILE *yy_input_file; -/* %endif */ - -/* %if-c++-only */ -/* %endif */ - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - int yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* %if-c-only Standard (non-C++) definition */ -/* %not-for-header */ -/* %if-not-reentrant */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ -/* %endif */ -/* %ok-for-header */ - -/* %endif */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* %if-c-only Standard (non-C++) definition */ - -/* %if-not-reentrant */ -/* %not-for-header */ -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = NULL; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; -/* %ok-for-header */ - -/* %endif */ - -void yyrestart ( FILE *input_file ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); -void yy_delete_buffer ( YY_BUFFER_STATE b ); -void yy_flush_buffer ( YY_BUFFER_STATE b ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state ( void ); - -static void yyensure_buffer_stack ( void ); -static void yy_load_buffer_state ( void ); -static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); - -/* %endif */ - -void *yyalloc ( yy_size_t ); -void *yyrealloc ( void *, yy_size_t ); -void yyfree ( void * ); - -#define yy_new_buffer yy_create_buffer -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ - -#define KDBText_wrap() (/*CONSTCOND*/1) -#define YY_SKIP_YYWRAP - -#define FLEX_DEBUG -typedef flex_uint8_t YY_CHAR; - -FILE *yyin = NULL, *yyout = NULL; - -typedef int yy_state_type; - -extern int yylineno; -int yylineno = 1; - -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext - -/* %% [1.5] DFA */ - -/* %if-c-only Standard (non-C++) definition */ - -static yy_state_type yy_get_previous_state ( void ); -static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); -static int yy_get_next_buffer ( void ); -static void yynoreturn yy_fatal_error ( const char* msg ); - -/* %endif */ - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ -/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ - yyleng = (int) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ -/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ - (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 7 -#define YY_END_OF_BUFFER 8 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static const flex_int16_t yy_accept[20] = - { 0, - 0, 0, 8, 6, 5, 5, 4, 4, 1, 2, - 4, 4, 4, 4, 4, 4, 4, 3, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 1, 1, 1, 1, 5, 1, 6, 7, 5, 8, - - 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 10, 11, 5, 5, 5, 5, - 5, 5, 12, 1, 13, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[14] = - { 0, - 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 1, 1 - } ; - -static const flex_int16_t yy_base[21] = - { 0, - 0, 0, 22, 23, 23, 23, 0, 15, 23, 23, - 0, 9, 13, 11, 11, 6, 6, 0, 23, 12 - } ; - -static const flex_int16_t yy_def[21] = - { 0, - 19, 1, 19, 19, 19, 19, 20, 20, 19, 19, - 20, 20, 20, 20, 20, 20, 20, 20, 0, 19 - } ; - -static const flex_int16_t yy_nxt[37] = - { 0, - 4, 5, 6, 4, 7, 7, 7, 8, 7, 7, - 7, 9, 10, 11, 18, 17, 16, 15, 14, 13, - 12, 19, 3, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19 - } ; - -static const flex_int16_t yy_chk[37] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 20, 17, 16, 15, 14, 13, 12, - 8, 3, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 1; - -static const flex_int16_t yy_rule_linenum[7] = - { 0, - 44, 45, 48, 50, 53, 56 - } ; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -/*=========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -*/ -#include "kdbtext-lex.h" - /* let parser handle EOF */ - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -/* %if-c-only */ -#include -/* %endif */ -/* %if-c++-only */ -/* %endif */ -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -/* %if-c-only Reentrant structure and macros (non-C++). */ -/* %if-reentrant */ -/* %if-c-only */ - -static int yy_init_globals ( void ); - -/* %endif */ -/* %if-reentrant */ -/* %endif */ -/* %endif End reentrant structures and macros. */ - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy ( void ); - -int yyget_debug ( void ); - -void yyset_debug ( int debug_flag ); - -YY_EXTRA_TYPE yyget_extra ( void ); - -void yyset_extra ( YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in ( void ); - -void yyset_in ( FILE * _in_str ); - -FILE *yyget_out ( void ); - -void yyset_out ( FILE * _out_str ); - - int yyget_leng ( void ); - -char *yyget_text ( void ); - -int yyget_lineno ( void ); - -void yyset_lineno ( int _line_number ); - -/* %if-bison-bridge */ -/* %endif */ - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap ( void ); -#else -extern int yywrap ( void ); -#endif -#endif - -/* %not-for-header */ -#ifndef YY_NO_UNPUT - - static void yyunput ( int c, char *buf_ptr ); - -#endif -/* %ok-for-header */ - -/* %endif */ - -#ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * ); -#endif - -#ifndef YY_NO_INPUT -/* %if-c-only Standard (non-C++) definition */ -/* %not-for-header */ -#ifdef __cplusplus -static int yyinput ( void ); -#else -static int input ( void ); -#endif -/* %ok-for-header */ - -/* %endif */ -#endif - -/* %if-c-only */ - -/* %endif */ - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* %if-c-only Standard (non-C++) definition */ -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) -/* %endif */ -/* %if-c++-only C++ definition */ -/* %endif */ -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - int n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ -/* %if-c++-only C++ definition \ */\ -/* %endif */ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -/* %if-c-only */ -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -#endif - -/* %if-tables-serialization structures and prototypes */ -/* %not-for-header */ -/* %ok-for-header */ - -/* %not-for-header */ -/* %tables-yydmap generated elements */ -/* %endif */ -/* end tables serialization structures and prototypes */ - -/* %ok-for-header */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 -/* %if-c-only Standard (non-C++) definition */ - -extern int yylex (void); - -#define YY_DECL int yylex (void) -/* %endif */ -/* %if-c++-only C++ definition */ -/* %endif */ -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; -#endif - -/* %% [6.0] YY_RULE_SETUP definition goes here */ -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/* %not-for-header */ -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) -/* %if-c-only */ - yyin = stdin; -/* %endif */ -/* %if-c++-only */ -/* %endif */ - - if ( ! yyout ) -/* %if-c-only */ - yyout = stdout; -/* %endif */ -/* %if-c++-only */ -/* %endif */ - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - { -/* %% [7.0] user's declarations go here */ - - /* literals */ - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { -/* %% [8.0] yymore()-related code goes here */ - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -/* %% [9.0] code to set up and find next match goes here */ - yy_current_state = (yy_start); -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - 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 >= 20 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 23 ); - -yy_find_action: -/* %% [10.0] code to find the action number goes here */ - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -/* %% [11.0] code for yylineno update goes here */ - -do_action: /* This label is used only to access EOF actions. */ - -/* %% [12.0] debug code goes here */ - if ( yy_flex_debug ) - { - if ( yy_act == 0 ) - fprintf( stderr, "--scanner backing up\n" ); - else if ( yy_act < 7 ) - fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", - (long)yy_rule_linenum[yy_act], yytext ); - else if ( yy_act == 7 ) - fprintf( stderr, "--accepting default rule (\"%s\")\n", - yytext ); - else if ( yy_act == 8 ) - fprintf( stderr, "--(end of buffer or a NUL)\n" ); - else - fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); - } - - switch ( yy_act ) - { /* beginning of action switch */ -/* %% [13.0] actions go here */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -{ return yytext [ 0 ]; } - YY_BREAK -case 2: -YY_RULE_SETUP -{ return yytext [ 0 ]; } - YY_BREAK -/* keywords */ -case 3: -YY_RULE_SETUP -{ return KW_database; } - YY_BREAK -case 4: -YY_RULE_SETUP -{ return IDENTIFIER; } - YY_BREAK -/* ignored tokens */ -case 5: -/* rule 5 can match eol */ -YY_RULE_SETUP - - YY_BREAK -/* unrecognized input */ -case 6: -YY_RULE_SETUP -{ return UNRECOGNIZED; } - YY_BREAK -case 7: -YY_RULE_SETUP -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; -/* %if-c-only */ - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; -/* %endif */ -/* %if-c++-only */ -/* %endif */ - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ -/* %ok-for-header */ - -/* %if-c++-only */ -/* %not-for-header */ -/* %ok-for-header */ - -/* %endif */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -/* %if-c-only */ -static int yy_get_next_buffer (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( - (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -/* %if-c-only */ -/* %not-for-header */ - static yy_state_type yy_get_previous_state (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - yy_state_type yy_current_state; - char *yy_cp; - -/* %% [15.0] code to get the start state into yy_current_state goes here */ - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { -/* %% [16.0] code to find the next state goes here */ - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - 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 >= 20 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ -/* %if-c-only */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - int yy_is_jam; - /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ - char *yy_cp = (yy_c_buf_p); - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - 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 >= 20 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 19); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT -/* %if-c-only */ - - static void yyunput (int c, char * yy_bp ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -/* %% [18.0] update yylineno here */ - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} -/* %if-c-only */ - -/* %endif */ -#endif - -/* %if-c-only */ -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return 0; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - -/* %% [19.0] update BOL and yylineno */ - - return c; -} -/* %if-c-only */ -#endif /* ifndef YY_NO_INPUT */ -/* %endif */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ -/* %if-c-only */ - void yyrestart (FILE * input_file ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); - } - - yy_init_buffer( YY_CURRENT_BUFFER, input_file ); - yy_load_buffer_state( ); -} - -/* %if-c++-only */ -/* %endif */ - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ -/* %if-c-only */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -/* %if-c-only */ -static void yy_load_buffer_state (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; -/* %if-c-only */ - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; -/* %endif */ -/* %if-c++-only */ -/* %endif */ - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ -/* %if-c-only */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; -} - -/* %if-c++-only */ -/* %endif */ - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ -/* %if-c-only */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf ); - - yyfree( (void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ -/* %if-c-only */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ - -{ - int oerrno = errno; - - yy_flush_buffer( b ); - -/* %if-c-only */ - b->yy_input_file = file; -/* %endif */ -/* %if-c++-only */ -/* %endif */ - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - -/* %if-c-only */ - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - -/* %endif */ -/* %if-c++-only */ -/* %endif */ - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ -/* %if-c-only */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/* %if-c-or-c++ */ -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -/* %if-c-only */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} -/* %endif */ - -/* %if-c-or-c++ */ -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -/* %if-c-only */ -void yypop_buffer_state (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} -/* %endif */ - -/* %if-c-or-c++ */ -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -/* %if-c-only */ -static void yyensure_buffer_stack (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} -/* %endif */ - -/* %if-c-only */ -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return NULL; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = NULL; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; -} -/* %endif */ - -/* %if-c-only */ -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (const char * yystr ) -{ - - return yy_scan_bytes( yystr, (int) strlen(yystr) ); -} -/* %endif */ - -/* %if-c-only */ -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} -/* %endif */ - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -/* %if-c-only */ -static void yynoreturn yy_fatal_error (const char* msg ) -{ - fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} -/* %endif */ -/* %if-c++-only */ -/* %endif */ - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/* %if-c-only */ -/* %if-reentrant */ -/* %endif */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/* %if-reentrant */ -/* %endif */ - -/** Set the current line number. - * @param _line_number line number - * - */ -void yyset_lineno (int _line_number ) -{ - - yylineno = _line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param _in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * _in_str ) -{ - yyin = _in_str ; -} - -void yyset_out (FILE * _out_str ) -{ - yyout = _out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int _bdebug ) -{ - yy_flex_debug = _bdebug ; -} - -/* %endif */ - -/* %if-reentrant */ -/* %if-bison-bridge */ -/* %endif */ -/* %endif if-c-only */ - -/* %if-c-only */ -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = NULL; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = NULL; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = NULL; - yyout = NULL; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} -/* %endif */ - -/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - -/* %if-reentrant */ -/* %endif */ - return 0; -} -/* %endif */ - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n ) -{ - - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s ) -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return malloc(size); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return realloc(ptr, size); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -/* %if-tables-serialization definitions */ -/* %define-yytables The name for this specific scanner's tables. */ -#define YYTABLES_NAME "yytables" -/* %endif */ - -/* %ok-for-header */ - diff --git a/test/kdbtext/CMakeLists.txt b/test/kdbtext/CMakeLists.txt index e427023f0..039e21331 100644 --- a/test/kdbtext/CMakeLists.txt +++ b/test/kdbtext/CMakeLists.txt @@ -22,16 +22,14 @@ # # =========================================================================== -if( WIN32 ) - set( ADDITIONAL_LIBS Crypt32 ) - set( TMPDIR ./data) -else() - set( ADDITIONAL_LIBS "" ) - set( TMPDIR /tmp ) -endif() +# if( WIN32 ) +# set( ADDITIONAL_LIBS Crypt32 ) +# set( TMPDIR ./data) +# else() +# set( ADDITIONAL_LIBS "" ) +# set( TMPDIR /tmp ) +# endif() add_compile_definitions( __mod__="test/kdbtext" ) -AddExecutableTest( Test_KDBText_Scanner "wb-test-kdbtext-lex" "${COMMON_LIBS_READ};kdbtext" ) - AddExecutableTest( Test_KDBText_Manager "test-manager" "${COMMON_LIBS_READ};kdbtext" ) diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index 6f6a99b16..32373e527 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -31,33 +31,54 @@ #include #include +#include +#include + +#include + +#include +#include using namespace std; TEST_SUITE(KDBTextManagerTestSuite); -class KDBManager_Fixture +class KDBTextManager_Fixture { public: - KDBManager_Fixture() + KDBTextManager_Fixture() { } - ~KDBManager_Fixture() + ~KDBTextManager_Fixture() { KDBManagerRelease( m_mgr ); } - + void Setup( const char * input = "{}" ) + { + THROW_ON_RC( KDBManagerMakeText ( & m_mgr, input, m_error, sizeof m_error ) ); + } const KDBManager * m_mgr = nullptr; + char m_error[1024]; }; -FIXTURE_TEST_CASE(KDBRManager_Make_Null, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_Make_Null, KDBTextManager_Fixture) { - REQUIRE_RC_FAIL( KDBManagerMakeText ( nullptr, "" ) ); + REQUIRE_RC_FAIL( KDBManagerMakeText ( nullptr, "{}", m_error, sizeof m_error ) ); } -FIXTURE_TEST_CASE(KDBRManager_AddRelease, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_Make_BadJson, KDBTextManager_Fixture) { - REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "" ) ); + REQUIRE_RC_FAIL( KDBManagerMakeText ( & m_mgr, "notavalidjson", m_error, sizeof m_error ) ); +} + +FIXTURE_TEST_CASE(KDBTextManager_Make_WrongJsonRoot, KDBTextManager_Fixture) +{ + REQUIRE_RC_FAIL( KDBManagerMakeText ( & m_mgr, "[]", m_error, sizeof m_error ) ); +} + +FIXTURE_TEST_CASE(KDBTextManager_AddRelease, KDBTextManager_Fixture) +{ + Setup(); REQUIRE_NOT_NULL( m_mgr ) ; REQUIRE_RC( KDBManagerAddRef( m_mgr ) ); @@ -65,147 +86,58 @@ FIXTURE_TEST_CASE(KDBRManager_AddRelease, KDBManager_Fixture) // use valgrind to find any leaks } -FIXTURE_TEST_CASE(KDBRManager_Version_Null, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_Version_Null, KDBTextManager_Fixture) { - REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "" ) ); + Setup(); REQUIRE_RC_FAIL( KDBManagerVersion( m_mgr, nullptr ) ); } -FIXTURE_TEST_CASE(KDBRManager_Version, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_Version, KDBTextManager_Fixture) { - REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "" ) ); + Setup(); uint32_t version = 0; REQUIRE_RC( KDBManagerVersion( m_mgr, & version ) ); REQUIRE_EQ( (uint32_t)0, version ); } -FIXTURE_TEST_CASE(KDBRManager_Db_Exists_Not, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_Db_Exists_Not, KDBTextManager_Fixture) { - REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "" ) ); + Setup(); REQUIRE( ! KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb" ) ); } -FIXTURE_TEST_CASE(KDBRManager_Db_Exists, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_Db_Exists, KDBTextManager_Fixture) { - REQUIRE_RC( KDBManagerMakeText ( & m_mgr, "database testdb{}" ) ); + Setup( R"({"type": "database", "name": "testdb"})" ); REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb" ) ); } - - struct Database { - let name: String - let metadata: Metadata - - let tables: [Table] - let indices: [Index] - let databases: [Database] - } - struct Node { - struct Attribute { - let name: String - let value: [UInt8] - } - let name: String - let value: [UInt8] - let attributes: [Attribute] - let children: [Node] - } - let root: Node - } - struct Table { - let name: String - let metadata: Metadata - - let columns: [Column] - let indices: [Index] - } - struct Column { - let name: String - let metadata: Metadata - let data: [(row: Int64, value: [UInt8])] - } - struct Index { - struct Value { - let startId: Int64 - let count: UInt64 - } - enum IndexType { - case text([String: Value]) - case rowId([UInt64: Value]) - } - let name: String - let text: IndexType - } - -{ - "type": "database", - "name": "testdb", - "metadata": - { - "name":"", - "value":"blah", - "attributes":{"attr0":"value", "attr1":"attr1value"}, - "children":{ - "name":"schema", - "value":"version 1;....", - "attributes":{}, - "children":{} - } - } - "tables":[ - { - "name":"SEQUENCE", - "metadata":null, - "columns":[ - { - "name":"READ", - "metadata":null, - "data": - [ - {"row":1,"value":"AGCT"}, - {"row":2,"value":"AGCT"} - ] - } - ] - "indexes":[ - { - "name":"qwer", - "text":[ - {"key":"CG", "startId":1, "count":10}, - {"key":"AT", "startId":11, "count":2}, - ], - }, - { - "name":"rewq", - "projection":[ - {"value":"CG", "startId":1, "count":10}, - {"value":"AT", "startId":11, "count":2}, - ], - } - ] - } - ] -} - -metadata testdb.m -{ - name : +FIXTURE_TEST_CASE(KDBTextManager_Writable_Found, KDBTextManager_Fixture) +{ // for now, any path will be reported as readonly + Setup( R"({"type": "database", "name": "testdb"})" ); + rc_t rc = KDBManagerWritable( m_mgr, "%s", "testdb" ); + REQUIRE_EQ( SILENT_RC( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ), rc ); } +//TODO +// FIXTURE_TEST_CASE(KDBTextManager_Writable_NotFound, KDBTextManager_Fixture) +// { +// Setup( R"({"type": "database", "name": "testdb"})" ); +// rc_t rc = KDBManagerWritable( m_mgr, "%s", "proddb" ); +// REQUIRE_EQ( SILENT_RC( rcDB, rcPath, rcAccessing, rcPath, rcNotFound ), rc ); +// } +//TODO: KDBManagerWritable on internal objects, to test interpretation of the path -#if 0 -FIXTURE_TEST_CASE(KDBRManager_Writable, KDBManager_Fixture) -{ - REQUIRE_RC( KDBManagerWritable( m_mgr, "%s", "testdb" ) ); -} - -FIXTURE_TEST_CASE(KDBRManager_RunPeriodicTasks, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_RunPeriodicTasks, KDBTextManager_Fixture) { + Setup( R"({"type": "database", "name": "testdb"})" ); REQUIRE_RC( KDBManagerRunPeriodicTasks( m_mgr ) ); } -FIXTURE_TEST_CASE(KDBRManager_PathTypeVP, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db, KDBTextManager_Fixture) { + Setup( R"({"type": "database", "name": "testdb"})" ); + VFSManager * vfs; REQUIRE_RC( VFSManagerMake ( & vfs ) ); @@ -216,40 +148,31 @@ FIXTURE_TEST_CASE(KDBRManager_PathTypeVP, KDBManager_Fixture) REQUIRE_RC( VPathRelease( path ) ); REQUIRE_RC( VFSManagerRelease( vfs ) ); } - -FIXTURE_TEST_CASE(KDBRManager_PathType, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_NotFound, KDBTextManager_Fixture) { - REQUIRE_EQ( (int)kptDatabase, KDBManagerPathType( m_mgr, "%s", "testdb" ) ); -} - -FIXTURE_TEST_CASE(KDBManagerVPathType, KDBManager_Fixture) -{ - string path; - { // convert accession "SRR000123" into a file system path - VFSManager* vfsmgr; - REQUIRE_RC(VFSManagerMake(&vfsmgr)); - { - VPath * vpath; - const struct KFile *dummy1; - const struct VPath *dummy2; - REQUIRE_RC(VFSManagerResolveSpec ( vfsmgr, "SRR000123", &vpath, &dummy1, &dummy2, true)); + Setup( R"({"type": "database", "name": "testdb"})" ); - path = ToString(vpath); + VFSManager * vfs; + REQUIRE_RC( VFSManagerMake ( & vfs ) ); - REQUIRE_RC(KFileRelease(dummy1)); - REQUIRE_RC(VPathRelease(dummy2)); - REQUIRE_RC(VPathRelease(vpath)); - } - REQUIRE_RC(VFSManagerRelease(vfsmgr)); - } + struct VPath * path; + REQUIRE_RC( VFSManagerMakePath ( vfs, & path, "%s", "proddb" ) ); + REQUIRE_EQ( (int)kptNotFound, KDBManagerPathTypeVP( m_mgr, path ) ); -//cout << path << endl; - REQUIRE_EQ((int)kptTable, KDBManagerPathType(m_mgr, path.c_str())); + REQUIRE_RC( VPathRelease( path ) ); + REQUIRE_RC( VFSManagerRelease( vfs ) ); } +//TODO: KDBManagerPathTypeVP on internal objects, to test interpretation of the path +FIXTURE_TEST_CASE(KDBTextManager_PathType, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + REQUIRE_EQ( (int)kptDatabase, KDBManagerPathType( m_mgr, "%s", "testdb" ) ); +} -FIXTURE_TEST_CASE(KDBRManager_VPathTypeUnreliable, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_VPathTypeUnreliable, KDBTextManager_Fixture) { + Setup( R"({"type": "database", "name": "testdb"})" ); auto fn = [] ( const KDBManager * self, const char *path, ... ) -> int { va_list args; @@ -261,15 +184,17 @@ FIXTURE_TEST_CASE(KDBRManager_VPathTypeUnreliable, KDBManager_Fixture) REQUIRE_EQ( (int)kptDatabase, fn( m_mgr, "%s", "testdb" ) ); } -FIXTURE_TEST_CASE(KDBRManager_OpenDBRead, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_OpenDBRead, KDBTextManager_Fixture) { + Setup( R"({"type": "database", "name": "testdb"})" ); const KDatabase * db = nullptr; REQUIRE_RC( KDBManagerOpenDBRead( m_mgr, & db, "%s", "testdb" ) ); REQUIRE_NOT_NULL( db ); REQUIRE_RC( KDatabaseRelease( db ) ); } -FIXTURE_TEST_CASE(KDBRManager_OpenTableRead, KDBManager_Fixture) +#if 0 +FIXTURE_TEST_CASE(KDBTextManager_OpenTableRead, KDBTextManager_Fixture) { const KTable * tbl = nullptr; REQUIRE_RC( KDBManagerOpenTableRead( m_mgr, & tbl, "%s", "SRR000123" ) ); @@ -277,7 +202,7 @@ FIXTURE_TEST_CASE(KDBRManager_OpenTableRead, KDBManager_Fixture) REQUIRE_RC( KTableRelease( tbl ) ); } -FIXTURE_TEST_CASE(KDBRManager_OpenTableReadVPath, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_OpenTableReadVPath, KDBTextManager_Fixture) { VFSManager * vfs; REQUIRE_RC( VFSManagerMake ( & vfs ) ); @@ -294,7 +219,7 @@ FIXTURE_TEST_CASE(KDBRManager_OpenTableReadVPath, KDBManager_Fixture) REQUIRE_RC( VFSManagerRelease( vfs ) ); } -FIXTURE_TEST_CASE(KDBRManager_OpenColumnRead, KDBManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead, KDBTextManager_Fixture) { const KColumn * col = nullptr; rc_t rc = SILENT_RC( rcVFS,rcMgr,rcOpening,rcDirectory,rcNotFound ); @@ -337,3 +262,105 @@ rc_t CC KMain ( int argc, char *argv [] ) } } + +#if 0 + struct Database { + let name: String + let metadata: Metadata + + let tables: [Table] + let indices: [Index] + let databases: [Database] + } + struct Node { + struct Attribute { + let name: String + let value: [UInt8] + } + let name: String + let value: [UInt8] + let attributes: [Attribute] + let children: [Node] + } + let root: Node + } + struct Table { + let name: String + let metadata: Metadata + + let columns: [Column] + let indices: [Index] + } + struct Column { + let name: String + let metadata: Metadata + let data: [(row: Int64, value: [UInt8])] + } + struct Index { + struct Value { + let startId: Int64 + let count: UInt64 + } + enum IndexType { + case text([String: Value]) + case rowId([UInt64: Value]) + } + let name: String + let text: IndexType + } + +{ + "type": "database", + "name": "testdb", + "metadata": + { + "name":"", + "value":"blah", + "attributes":{"attr0":"value", "attr1":"attr1value"}, + "children":{ + "name":"schema", + "value":"version 1;....", + "attributes":{}, + "children":{} + } + } + "tables":[ + { + "name":"SEQUENCE", + "metadata":null, + "columns":[ + { + "name":"READ", + "metadata":null, + "data": + [ + {"row":1,"value":"AGCT"}, + {"row":2,"value":"AGCT"} + ] + } + ] + "indexes":[ + { + "name":"qwer", + "text":[ + {"key":"CG", "startId":1, "count":10}, + {"key":"AT", "startId":11, "count":2}, + ], + }, + { + "name":"rewq", + "projection":[ + {"value":"CG", "startId":1, "count":10}, + {"value":"AT", "startId":11, "count":2}, + ], + } + ] + } + ] +} + +metadata testdb.m +{ + name : +} +#endif \ No newline at end of file diff --git a/test/kdbtext/wb-test-kdbtext-lex.cpp b/test/kdbtext/wb-test-kdbtext-lex.cpp deleted file mode 100644 index 5a510078f..000000000 --- a/test/kdbtext/wb-test-kdbtext-lex.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/*=========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -*/ - -/** -* Unit tests for schema tokenizer -*/ - -#include - -#include - -#include "../../libs/kdbtext/KDBTextScanner.hpp" - -#if 0 -using namespace ncbi::KdbTextParser; - -// need these fake to make schema-tokens.h compile -typedef struct ParseTree ParseTree; -typedef struct ErrorReport ErrorReport; - -#include "../../libs/schema/schema-grammar.hpp" - -using namespace std; -using namespace ncbi::NK; -#endif -TEST_SUITE ( KdbTextLexTestSuite ); -#if 0 -void -VerifyLocation ( const Token & p_token, uint32_t p_line, uint32_t p_column, const char * p_file = "" ) -{ - return;//TODO - const Token :: Location & loc = p_token . GetLocation (); - if ( string ( p_file ) != string ( loc . m_file ) ) - { - ostringstream out; - out << "VerifyLocation(): file name expected '" << p_file << "', actual '" << loc . m_file << "'" << endl; - throw std :: logic_error ( out . str () ); - } - if ( p_line != loc . m_line ) - { - ostringstream out; - out << "VerifyLocation(): line expected '" << p_line << "', actual '" << loc . m_line << "'" << endl; - throw std :: logic_error ( out . str () ); - } - if ( p_column != loc . m_column ) - { - ostringstream out; - out << "VerifyLocation(): column expected '" << p_column << "', actual '" << loc . m_column << "'" << endl; - throw std :: logic_error ( out . str () ); - } -} -#endif - -TEST_CASE ( EmptyInput ) -{ - REQUIRE_EQ ( (int)END_SOURCE, KDBTextScanner ( "" ) . NextToken () . GetType () ); -} -#if 0 -TEST_CASE ( Location ) -{ - KDBTextScanner s ( "" ); - Token t = s . NextToken (); - VerifyLocation ( t, 1, 1 ); -} - -TEST_CASE ( Whitespace ) -{ - KDBTextScanner s ( " " ); - Token t = s . NextToken (); - REQUIRE_EQ ( (int)END_SOURCE, t. GetType () ); - REQUIRE_EQ ( string ( " " ), string ( t . GetLeadingWhitespace () ) ); - VerifyLocation ( t, 1, 4 ); -} - -TEST_CASE ( NotNulTerminated ) -{ - KDBTextScanner s ( " bad", 2, false ); // only first 2 bytes looked at - Token t = s . NextToken (); - REQUIRE_EQ ( (int)END_SOURCE, t. GetType () ); - REQUIRE_EQ ( string ( " " ), string ( t . GetLeadingWhitespace () ) ); -} - -TEST_CASE ( Unrecognized ) -{ - REQUIRE_EQ ( (int)UNRECOGNIZED, KDBTextScanner ( "ÑŠ" ) . NextToken () . GetType () ); -} - -#define REQUIRE_LITERAL(name, lit) \ - TEST_CASE ( name ) { REQUIRE_EQ ( ( Token :: TokenType ) lit [ 0 ], KDBTextScanner ( lit ) . NextToken () . GetType () ); } - -REQUIRE_LITERAL ( Semicolon, ";" ) -REQUIRE_LITERAL ( Dollar, "$" ) -REQUIRE_LITERAL ( Comma, "," ) -REQUIRE_LITERAL ( LeftBrace, "{" ) -REQUIRE_LITERAL ( RightBrace, "}" ) -REQUIRE_LITERAL ( Equals, "=" ) -REQUIRE_LITERAL ( LeftParen, "(" ) -REQUIRE_LITERAL ( RightParen, ")" ) -REQUIRE_LITERAL ( Hash, "#" ) -REQUIRE_LITERAL ( LeftAngle, "<" ) -REQUIRE_LITERAL ( RightAngle, ">" ) -REQUIRE_LITERAL ( Asterisk, "*" ) -REQUIRE_LITERAL ( Slash, "/" ) -REQUIRE_LITERAL ( Colon, ":" ) -REQUIRE_LITERAL ( LeftSquare, "[" ) -REQUIRE_LITERAL ( RightSquare, "]" ) -REQUIRE_LITERAL ( Pipe, "|" ) -REQUIRE_LITERAL ( Dor, "." ) -REQUIRE_LITERAL ( Plus, "+" ) -REQUIRE_LITERAL ( Minus, "-" ) -REQUIRE_LITERAL ( At, "@" ) - -TEST_CASE ( Ellipsis ) -{ - REQUIRE_EQ ( ( Token :: TokenType ) ELLIPSIS, KDBTextScanner ( "..." ) . NextToken () . GetType () ); -} - -#define REQUIRE_TOKEN(expected, token) \ - REQUIRE_EQ ( string ( expected ), string ( token . GetValue () ) ) -#define REQUIRE_WS(expected, token) \ - REQUIRE_EQ ( string ( expected ), string ( token . GetLeadingWhitespace () ) ) - -#define REQUIRE_TERMINAL(name, token, term) \ -TEST_CASE ( name ) \ -{ \ - Token t = KDBTextScanner ( term ) . NextToken (); \ - REQUIRE_EQ ( ( Token :: TokenType ) token, t . GetType () ); \ - REQUIRE_TOKEN ( term, t ); \ -} - -REQUIRE_TERMINAL ( Decimal, DECIMAL, "123456789" ) -REQUIRE_TERMINAL ( Octal, OCTAL, "01234567" ) -REQUIRE_TERMINAL ( Hex_0x, HEX, "0x01abCDef23" ) -REQUIRE_TERMINAL ( Hex1_0X, HEX, "0X01abCDef23" ) -REQUIRE_TERMINAL ( Float, FLOAT_, ".1415" ) -REQUIRE_TERMINAL ( Float_NoLeadDigits, FLOAT_, "3.1415" ) -REQUIRE_TERMINAL ( Float_NoTrailDigits, FLOAT_, "3." ) -REQUIRE_TERMINAL ( ExpFloat_e, EXP_FLOAT, "3.14e1" ) -REQUIRE_TERMINAL ( ExpFloat_E, EXP_FLOAT, "3.14E1" ) - -REQUIRE_TERMINAL ( DoubleQuotedString, STRING, "\"qwerty\"" ) -REQUIRE_TERMINAL ( EscapedDQString, ESCAPED_STRING, "\"q\\w\\nerty\"" ) -REQUIRE_TERMINAL ( UnterminatedDQString, UNTERM_STRING, "\"qwerty" ) -REQUIRE_TERMINAL ( UnterminatedEDQString, UNTERM_ESCAPED_STRING, "\"q\\w\\nerty" ) - -REQUIRE_TERMINAL ( SingleQuotedString, STRING, "'qwerty'" ) -REQUIRE_TERMINAL ( EscapedSQString, ESCAPED_STRING, "\"q\\w\\nerty\"" ) -REQUIRE_TERMINAL ( UnterminatedSQString, UNTERM_STRING, "'qwerty" ) -REQUIRE_TERMINAL ( UnterminatedESQString, UNTERM_ESCAPED_STRING, "'q\\w\\nerty" ) - -REQUIRE_TERMINAL ( Identifier_OneChar, IDENTIFIER_1_0, "T" ) -REQUIRE_TERMINAL ( Identifier, IDENTIFIER_1_0, "abc123_" ) -REQUIRE_TERMINAL ( Identifier_StartsWithDigit, IDENTIFIER_1_0, "1abc123_" ) // "2na" is used in 1.0 schemas -REQUIRE_TERMINAL ( PhysicalIdentifier, PHYSICAL_IDENTIFIER_1_0, ".T" ) - -REQUIRE_TERMINAL ( Version_Maj, VERSION, "#1" ) -REQUIRE_TERMINAL ( Version_MajMin, VERSION, "#1.2" ) -REQUIRE_TERMINAL ( Version_MajMinRel, VERSION, "#1.2.3" ) -REQUIRE_TERMINAL ( Version_Ws_Maj, VERSION, "# 1" ) -REQUIRE_TERMINAL ( Version_Ws_MajMin, VERSION, "# 1.2" ) -REQUIRE_TERMINAL ( Version_Ws_MajMinRel, VERSION, "# 1.2.3" ) - -#define REQUIRE_KEYWORD(word) \ -TEST_CASE ( kw_##word ) \ -{ \ - Token t = KDBTextScanner ( #word ) . NextToken (); \ - REQUIRE_EQ ( ( Token :: TokenType ) KW_##word, t . GetType () ); \ - REQUIRE_TOKEN ( #word, t ); \ -} - -REQUIRE_KEYWORD(__no_header) -REQUIRE_KEYWORD(__row_length) -REQUIRE_KEYWORD(__untyped) -REQUIRE_KEYWORD(alias) -REQUIRE_KEYWORD(column) -REQUIRE_KEYWORD(const) -REQUIRE_KEYWORD(control) -REQUIRE_KEYWORD(database) -REQUIRE_KEYWORD(decode) -REQUIRE_KEYWORD(default) -REQUIRE_KEYWORD(encode) -REQUIRE_KEYWORD(extern) -REQUIRE_KEYWORD(false) -REQUIRE_KEYWORD(fmtdef) -REQUIRE_KEYWORD(function) -REQUIRE_KEYWORD(include) -REQUIRE_KEYWORD(limit) -REQUIRE_KEYWORD(physical) -REQUIRE_KEYWORD(read) -REQUIRE_KEYWORD(readonly) -REQUIRE_KEYWORD(return) -REQUIRE_KEYWORD(schema) -REQUIRE_KEYWORD(static) -REQUIRE_KEYWORD(table) -REQUIRE_KEYWORD(template) -REQUIRE_KEYWORD(trigger) -REQUIRE_KEYWORD(true) -REQUIRE_KEYWORD(type) -REQUIRE_KEYWORD(typedef) -REQUIRE_KEYWORD(typeset) -REQUIRE_KEYWORD(validate) -REQUIRE_KEYWORD(version) -REQUIRE_KEYWORD(view) -REQUIRE_KEYWORD(virtual) -REQUIRE_KEYWORD(void) -REQUIRE_KEYWORD(write) - -TEST_CASE ( Comment ) -{ - Token t = KDBTextScanner ( "/**/abc" ) . NextToken (); - REQUIRE_EQ ( ( Token :: TokenType ) IDENTIFIER_1_0, t . GetType () ); - REQUIRE_TOKEN ( "abc", t ); - REQUIRE_WS ( "/**/", t ); -} - -TEST_CASE ( LineComment ) -{ - Token t = KDBTextScanner ( "//qed\nabc" ) . NextToken (); - REQUIRE_EQ ( ( Token :: TokenType ) IDENTIFIER_1_0, t . GetType () ); - VerifyLocation ( t, 1, 4 ); - REQUIRE_TOKEN ( "abc", t ); - REQUIRE_WS ( "//qed\n", t ); -} - -TEST_CASE ( MultiLineComment ) -{ - Token t = KDBTextScanner ( "/*\n\n*/abc" ) . NextToken (); - REQUIRE_EQ ( ( Token :: TokenType ) IDENTIFIER_1_0, t . GetType () ); - REQUIRE_TOKEN ( "abc", t ); - REQUIRE_WS ( "/*\n\n*/", t ); -} - -TEST_CASE ( WhiteSpace ) -{ - Token t = KDBTextScanner ( " \t\f\v\r\nabc \t\f\v\r\n" ) . NextToken (); - REQUIRE_EQ ( ( Token :: TokenType ) IDENTIFIER_1_0, t . GetType () ); - REQUIRE_TOKEN ( "abc", t ); \ -} - -TEST_CASE ( Version_1 ) -{ - KDBTextScanner s ( "version 1;" ); - REQUIRE_EQ ( ( Token :: TokenType ) KW_version, s . NextToken () . GetType () ); - REQUIRE_EQ ( ( Token :: TokenType ) VERS_1_0, s . NextToken () . GetType () ); - REQUIRE_EQ ( ( Token :: TokenType ) ';', s . NextToken () . GetType () ); -} - -TEST_CASE ( Version_1_comment ) -{ - KDBTextScanner s ( "version /*!!*/ 1;" ); - REQUIRE_EQ ( ( Token :: TokenType ) KW_version, s . NextToken () . GetType () ); - REQUIRE_EQ ( ( Token :: TokenType ) VERS_1_0, s . NextToken () . GetType () ); - REQUIRE_EQ ( ( Token :: TokenType ) ';', s . NextToken () . GetType () ); -} - -TEST_CASE ( Version_2 ) -{ - KDBTextScanner s ( "version 2;" ); - REQUIRE_EQ ( ( Token :: TokenType ) KW_version, s . NextToken () . GetType () ); - REQUIRE_EQ ( ( Token :: TokenType ) VERS_2_0, s . NextToken () . GetType () ); -} - -TEST_CASE ( Version_2_0 ) -{ - KDBTextScanner s ( "version 2.0;" ); - REQUIRE_EQ ( ( Token :: TokenType ) KW_version, s . NextToken () . GetType () ); - REQUIRE_EQ ( ( Token :: TokenType ) VERS_2_0, s . NextToken () . GetType () ); -} -#endif -//////////////////////////////////////////// Main -#include -#include -#include - -extern "C" -{ - -ver_t CC KAppVersion ( void ) -{ - return 0x1000000; -} - -const char UsageDefaultName[] = "wb-test-kdbtext-lex"; - -rc_t CC UsageSummary (const char * progname) -{ - return KOutMsg ( "Usage:\n" "\t%s [options] -o path\n\n", progname ); -} - -rc_t CC Usage( const Args* args ) -{ - return 0; -} - -rc_t CC KMain ( int argc, char *argv [] ) -{ - return KdbTextLexTestSuite(argc, argv); -} - -} - From a7197272ed798b28d989a15dd2a4ce098280b2aa Mon Sep 17 00:00:00 2001 From: aboshkin Date: Mon, 20 Nov 2023 15:37:02 -0500 Subject: [PATCH 04/42] VDB-5394 saving work --- libs/kdb/manager-base.h | 3 - libs/kdb/rtable.c | 2 +- libs/kdb/table-base.h | 6 +- libs/kdb/wtable.c | 2 +- libs/kdbtext/CMakeLists.txt | 1 + libs/kdbtext/database.cpp | 81 +++++++++++--------- libs/kdbtext/manager.cpp | 134 ++++++++++++++++++++++------------ libs/kdbtext/table.cpp | 113 ++++++++++++++++++++++++++++ libs/kdbtext/table.hpp | 56 ++++++++++++++ test/kdbtext/test-manager.cpp | 9 ++- 10 files changed, 315 insertions(+), 92 deletions(-) create mode 100644 libs/kdbtext/table.cpp create mode 100644 libs/kdbtext/table.hpp diff --git a/libs/kdb/manager-base.h b/libs/kdb/manager-base.h index 99023aee7..33c3d426f 100644 --- a/libs/kdb/manager-base.h +++ b/libs/kdb/manager-base.h @@ -96,9 +96,6 @@ extern rc_t CC KDBManagerBaseRelease ( const KDBMGR_IMPL *self ); KDBMGR_IMPL *KDBManagerAttach ( const KDBMGR_IMPL *self ); rc_t KDBManagerSever ( const KDBMGR_IMPL *self ); -// write side only public API -// ... - #ifdef __cplusplus } #endif diff --git a/libs/kdb/rtable.c b/libs/kdb/rtable.c index 765283d35..a871e2891 100644 --- a/libs/kdb/rtable.c +++ b/libs/kdb/rtable.c @@ -66,7 +66,7 @@ static rc_t CC KRTableListCol ( const KTable *self, KNamelist **names ); static rc_t CC KRTableListIdx ( const KTable *self, KNamelist **names ); static rc_t CC KRTableMetaCompare( const KTable *self, const KTable *other, const char * path, bool * equal ); -static KTableBase_vt KRTable_vt = +static KTable_vt KRTable_vt = { KRTableWhack, KTableBaseAddRef, diff --git a/libs/kdb/table-base.h b/libs/kdb/table-base.h index 76b6a2742..78e665599 100644 --- a/libs/kdb/table-base.h +++ b/libs/kdb/table-base.h @@ -48,8 +48,8 @@ struct KNamelist; */ typedef struct KTable KTable; -typedef struct KTableBase_vt KTableBase_vt; -struct KTableBase_vt +typedef struct KTable_vt KTable_vt; +struct KTable_vt { /* Public API */ rc_t ( CC * whack ) ( KTable * self ); @@ -80,7 +80,7 @@ extern rc_t CC KTableBaseRelease ( const KTable *self ); struct KTable { - const KTableBase_vt * vt; + const KTable_vt * vt; KRefcount refcount; }; diff --git a/libs/kdb/wtable.c b/libs/kdb/wtable.c index cfe6cda14..927128729 100644 --- a/libs/kdb/wtable.c +++ b/libs/kdb/wtable.c @@ -66,7 +66,7 @@ static rc_t CC KWTableListCol ( const KTable *self, KNamelist **names ); static rc_t CC KWTableListIdx ( const KTable *self, KNamelist **names ); static rc_t CC KWTableMetaCompare( const KTable *self, const KTable *other, const char * path, bool * equal ); -static KTableBase_vt KWTable_vt = +static KTable_vt KWTable_vt = { KWTableWhack, KTableBaseAddRef, diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt index 3fb5086d8..942b2670e 100644 --- a/libs/kdbtext/CMakeLists.txt +++ b/libs/kdbtext/CMakeLists.txt @@ -25,6 +25,7 @@ set( KDBTEXT_SRC manager.cpp database.cpp + table.cpp ) GenerateStaticLibs( kdbtext "${KDBTEXT_SRC}" ) diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 104353feb..6b029ccb5 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -28,51 +28,54 @@ using namespace KDBText; -// static rc_t CC KRDatabaseWhack ( KDatabase *self ); -// static bool CC KRDatabaseLocked ( const KDatabase *self ); -// static bool CC KRDatabaseVExists ( const KDatabase *self, uint32_t type, const char *name, va_list args ); -// static bool CC KRDatabaseIsAlias ( const KDatabase *self, uint32_t type, char *resolved, size_t rsize, const char *name ); -// static rc_t CC KRDatabaseVWritable ( const KDatabase *self, uint32_t type, const char *name, va_list args ); -// static rc_t CC KRDatabaseOpenManagerRead ( const KDatabase *self, const KDBManager **mgr ); -// static rc_t CC KRDatabaseOpenParentRead ( const KDatabase *self, const KDatabase **par ); -// static rc_t CC KRDatabaseOpenDirectoryRead ( const KDatabase *self, const KDirectory **dir ); -// static rc_t CC KRDatabaseVOpenDBRead ( const KDatabase *self, const KDatabase **dbp, const char *name, va_list args ); -// static rc_t CC KRDatabaseVOpenTableRead ( const KDatabase *self, const KTable **tblp, const char *name, va_list args ); -// static rc_t CC KRDatabaseOpenMetadataRead ( const KDatabase *self, const KMetadata **metap ); -// static rc_t CC KRDatabaseVOpenIndexRead ( const KDatabase *self, const KIndex **idxp, const char *name, va_list args ); -// static rc_t CC KRDatabaseListDB ( const KDatabase *self, KNamelist **names ); -// static rc_t CC KRDatabaseListTbl ( struct KDatabase const *self, KNamelist **names ); -// static rc_t CC KRDatabaseListIdx ( struct KDatabase const *self, KNamelist **names ); -// static rc_t CC KRDatabaseGetPath ( KDatabase const *self, const char **path ); +static rc_t CC KTextDatabaseWhack ( KTextDatabase *self ); +// static bool CC KTextDatabaseLocked ( const KTextDatabase *self ); +// static bool CC KTextDatabaseVExists ( const KTextDatabase *self, uint32_t type, const char *name, va_list args ); +// static bool CC KTextDatabaseIsAlias ( const KTextDatabase *self, uint32_t type, char *resolved, size_t rsize, const char *name ); +// static rc_t CC KTextDatabaseVWritable ( const KTextDatabase *self, uint32_t type, const char *name, va_list args ); +// static rc_t CC KTextDatabaseOpenManagerRead ( const KTextDatabase *self, const KDBManager **mgr ); +// static rc_t CC KTextDatabaseOpenParentRead ( const KTextDatabase *self, const KTextDatabase **par ); +// static rc_t CC KTextDatabaseOpenDirectoryRead ( const KTextDatabase *self, const KDirectory **dir ); +// static rc_t CC KTextDatabaseVOpenDBRead ( const KTextDatabase *self, const KTextDatabase **dbp, const char *name, va_list args ); +// static rc_t CC KTextDatabaseVOpenTableRead ( const KTextDatabase *self, const KTable **tblp, const char *name, va_list args ); +// static rc_t CC KTextDatabaseOpenMetadataRead ( const KTextDatabase *self, const KMetadata **metap ); +// static rc_t CC KTextDatabaseVOpenIndexRead ( const KTextDatabase *self, const KIndex **idxp, const char *name, va_list args ); +// static rc_t CC KTextDatabaseListDB ( const KTextDatabase *self, KNamelist **names ); +// static rc_t CC KTextDatabaseListTbl ( struct KTextDatabase const *self, KNamelist **names ); +// static rc_t CC KTextDatabaseListIdx ( struct KTextDatabase const *self, KNamelist **names ); +// static rc_t CC KTextDatabaseGetPath ( KTextDatabase const *self, const char **path ); -static KDatabase_vt KRTextDatabase_vt = +static KDatabase_vt KTextDatabase_vt = { - // KRDatabaseWhack, - // KDatabaseBaseAddRef, - // KDatabaseBaseRelease, - // KRDatabaseLocked, - // KRDatabaseVExists, - // KRDatabaseIsAlias, - // KRDatabaseVWritable, - // KRDatabaseOpenManagerRead, - // KRDatabaseOpenParentRead, - // KRDatabaseOpenDirectoryRead, - // KRDatabaseVOpenDBRead, - // KRDatabaseVOpenTableRead, - // KRDatabaseOpenMetadataRead, - // KRDatabaseVOpenIndexRead, - // KRDatabaseListDB, - // KRDatabaseListTbl, - // KRDatabaseListIdx, - // KRDatabaseGetPath + KTextDatabaseWhack, + KDatabaseBaseAddRef, + KDatabaseBaseRelease, + // KTextDatabaseLocked, + // KTextDatabaseVExists, + // KTextDatabaseIsAlias, + // KTextDatabaseVWritable, + // KTextDatabaseOpenManagerRead, + // KTextDatabaseOpenParentRead, + // KTextDatabaseOpenDirectoryRead, + // KTextDatabaseVOpenDBRead, + // KTextDatabaseVOpenTableRead, + // KTextDatabaseOpenMetadataRead, + // KTextDatabaseVOpenIndexRead, + // KTextDatabaseListDB, + // KTextDatabaseListTbl, + // KTextDatabaseListIdx, + // KTextDatabaseGetPath }; Database::Database( const KJsonObject * p_json ) : m_json ( p_json ) { + dad . vt = & KTextDatabase_vt; + KRefcountInit ( & dad . refcount, 1, "KDBText::Database", "ctor", "db" ); } Database::~Database() { + KRefcountWhack ( & dad . refcount, "KDBText::Database" ); } rc_t @@ -94,3 +97,11 @@ Database::inflate( char * error, size_t error_size ) return rc; } +static +rc_t CC +KTextDatabaseWhack ( KTextDatabase *self ) +{ + assert( self -> dad . vt == & KTextDatabase_vt ); + delete reinterpret_cast( self ); + return 0; +} \ No newline at end of file diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index c9a7caf09..db490b75e 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -27,6 +27,10 @@ #include #include "database.hpp" +#include "table.hpp" + +#include +#include #include #include @@ -51,40 +55,40 @@ struct KDBManager const uint32_t LIBKDBTEXT_VERS = 0; -static rc_t CC KDBTextManagerWhack ( KDBManager *self ); -static rc_t CC KDBTextManagerVersion ( const KDBManager *self, uint32_t *version ); -static bool CC KDBTextManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args ); -static rc_t CC KDBTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ); -static rc_t CC KDBTextManagerRunPeriodicTasks ( const KDBManager *self ); -static int CC KDBTextManagerPathTypeVP( const KDBManager * self, const VPath * path ); -static int CC KDBTextManagerVPathType ( const KDBManager * self, const char *path, va_list args ); -static int CC KDBTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ); -static rc_t CC KDBTextManagerVOpenDBRead ( const KDBManager *self, const KDatabase **db, const char *path, va_list args ); - -// static rc_t CC KDBTextManagerVOpenTableRead ( const KDBManager *self, const KTable **tbl, const char *path, va_list args ); -// static rc_t CC KDBTextManagerOpenTableReadVPath(const KDBManager *self, const KTable **tbl, const struct VPath *path); -// static rc_t CC KDBTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ); -// static rc_t CC KDBTextManagerVPathOpenLocalDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * vpath ); -// static rc_t CC KDBTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ); - -static KDBManager_vt KDBTextManager_vt = +static rc_t CC KTextManagerWhack ( KDBManager *self ); +static rc_t CC KTextManagerVersion ( const KDBManager *self, uint32_t *version ); +static bool CC KTextManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args ); +static rc_t CC KTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ); +static rc_t CC KTextManagerRunPeriodicTasks ( const KDBManager *self ); +static int CC KTextManagerPathTypeVP( const KDBManager * self, const VPath * path ); +static int CC KTextManagerVPathType ( const KDBManager * self, const char *path, va_list args ); +static int CC KTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ); +static rc_t CC KTextManagerVOpenDBRead ( const KDBManager *self, const KDatabase **db, const char *path, va_list args ); +static rc_t CC KTextManagerVOpenTableRead ( const KDBManager *self, const KTable **tbl, const char *path, va_list args ); + +// static rc_t CC KTextManagerOpenTableReadVPath(const KDBManager *self, const KTable **tbl, const struct VPath *path); +// static rc_t CC KTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ); +// static rc_t CC KTextManagerVPathOpenLocalDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * vpath ); +// static rc_t CC KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ); + +static KDBManager_vt KTextManager_vt = { - KDBTextManagerWhack, + KTextManagerWhack, KDBManagerBaseAddRef, KDBManagerBaseRelease, - KDBTextManagerVersion, - KDBTextManagerVExists, - KDBTextManagerVWritable, - KDBTextManagerRunPeriodicTasks, - KDBTextManagerPathTypeVP, - KDBTextManagerVPathType, - KDBTextManagerVPathTypeUnreliable, - KDBTextManagerVOpenDBRead, - // KDBTextManagerVOpenTableRead, - // KDBTextManagerOpenTableReadVPath, - // KDBTextManagerVOpenColumnRead, - // KDBTextManagerVPathOpenLocalDBRead, - // KDBTextManagerVPathOpenRemoteDBRead + KTextManagerVersion, + KTextManagerVExists, + KTextManagerVWritable, + KTextManagerRunPeriodicTasks, + KTextManagerPathTypeVP, + KTextManagerVPathType, + KTextManagerVPathTypeUnreliable, + KTextManagerVOpenDBRead, + KTextManagerVOpenTableRead, + // KTextManagerOpenTableReadVPath, + // KTextManagerVOpenColumnRead, + // KTextManagerVPathOpenLocalDBRead, + // KTextManagerVPathOpenRemoteDBRead }; namespace KDBText @@ -94,14 +98,15 @@ namespace KDBText public: Manager() { - dad . vt = & KDBTextManager_vt; - KRefcountInit ( & dad . refcount, 1, "KDBManager", "make-read-text", "kmgr" ); + dad . vt = & KTextManager_vt; + KRefcountInit ( & dad . refcount, 1, "KDBText::Manager", "ctor", "kmgr" ); } ~Manager() { + delete m_tbl; delete m_db; KJsonValueWhack( m_root ); - KRefcountWhack ( & dad . refcount, "KDBManager" ); + KRefcountWhack ( & dad . refcount, "KDBText::Manager" ); } rc_t parse( const char * input, char * error, size_t error_size ) @@ -133,6 +138,11 @@ namespace KDBText m_db = new Database( rootObj ); rc = m_db -> inflate( error, error_size ); } + else if ( strcmp( typeStr, "table") == 0 ) + { + m_tbl = new Table( rootObj ); + rc = m_tbl -> inflate( error, error_size ); + } } } @@ -140,6 +150,7 @@ namespace KDBText } const Database * getRootDatabase() const { return m_db; } + const Table * getRootTable() const { return m_tbl; } int pathType( const string & path ) const { @@ -157,25 +168,26 @@ namespace KDBText private: KJsonValue * m_root = nullptr; Database * m_db = nullptr; + Table * m_tbl = nullptr; }; } using namespace KDBText; -#define CAST() assert( bself -> dad . vt == & KDBTextManager_vt ); const Manager *self = static_cast(bself); +#define CAST() assert( bself -> dad . vt == & KTextManager_vt ); const Manager *self = static_cast(bself); static rc_t CC -KDBTextManagerWhack ( KDBManager *self ) +KTextManagerWhack ( KDBManager *self ) { - assert( self -> dad . vt == & KDBTextManager_vt ); + assert( self -> dad . vt == & KTextManager_vt ); delete reinterpret_cast( self ); return 0; } static rc_t CC -KDBTextManagerVersion ( const KDBManager *self, uint32_t * version ) +KTextManagerVersion ( const KDBManager *self, uint32_t * version ) { if ( version == nullptr ) { @@ -217,7 +229,7 @@ PrintToString( const char *fmt, va_list args, string & out ) static bool CC -KDBTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *fmt, va_list args ) +KTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *fmt, va_list args ) { CAST(); @@ -257,7 +269,7 @@ KDBTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char static rc_t CC -KDBTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ) +KTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ) { //TODO: parse and resolve the path, if the object is valid return rcReadOnly, otherwise rcNotFound return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); @@ -265,14 +277,14 @@ KDBTextManagerVWritable ( const KDBManager *self, const char * path, va_list arg static rc_t CC -KDBTextManagerRunPeriodicTasks ( const KDBManager *self ) +KTextManagerRunPeriodicTasks ( const KDBManager *self ) { return 0; } static int CC -KDBTextManagerPathTypeVP( const KDBManager * bself, const VPath * path ) +KTextManagerPathTypeVP( const KDBManager * bself, const VPath * path ) { CAST(); @@ -291,7 +303,7 @@ KDBTextManagerPathTypeVP( const KDBManager * bself, const VPath * path ) static int CC -KDBTextManagerVPathType ( const KDBManager * bself, const char *fmt, va_list args ) +KTextManagerVPathType ( const KDBManager * bself, const char *fmt, va_list args ) { CAST(); @@ -303,14 +315,14 @@ KDBTextManagerVPathType ( const KDBManager * bself, const char *fmt, va_list arg static int CC -KDBTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ) +KTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ) { - return KDBTextManagerVPathType( self, path, args ); + return KTextManagerVPathType( self, path, args ); } static rc_t CC -KDBTextManagerVOpenDBRead ( const KDBManager *bself, const KDatabase **p_db, const char *fmt, va_list args ) +KTextManagerVOpenDBRead ( const KDBManager *bself, const KDatabase **p_db, const char *fmt, va_list args ) { CAST(); @@ -321,12 +333,42 @@ KDBTextManagerVOpenDBRead ( const KDBManager *bself, const KDatabase **p_db, con const Database * db = self -> getRootDatabase(); if (db && db -> getName() == path ) { + rc_t rc = KDatabaseAddRef( (const KDatabase *)db ); + if ( rc != 0 ) + { + return rc; + } *p_db = (const KDatabase *)db; return 0; } return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); } +static +rc_t CC +KTextManagerVOpenTableRead ( const KDBManager *bself, const KTable **p_tbl, const char *fmt, va_list args ) +{ + CAST(); + + string path; + PrintToString( fmt, args, path ); + + // TODO: non-root tables? + const Table * tbl= self -> getRootTable(); + if (tbl && tbl -> getName() == path ) + { + rc_t rc = KTableAddRef( (const KTable *)tbl ); + if ( rc != 0 ) + { + return rc; + } + *p_tbl = (const KTable *)tbl; + return 0; + } + return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); +} + + LIB_EXPORT rc_t CC KDBManagerMakeText ( const KDBManager ** p_mgr, const char * input, char * error, size_t error_size ) diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp new file mode 100644 index 000000000..e96f086eb --- /dev/null +++ b/libs/kdbtext/table.cpp @@ -0,0 +1,113 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "table.hpp" + +using namespace KDBText; + + +static rc_t KTextTableWhack ( KTable *self ); +// static bool CC KTextTableLocked ( const KTable *self ); +// static bool CC KTextTableVExists ( const KTable *self, uint32_t type, const char *name, va_list args ); +// static bool CC KTextTableIsAlias ( const KTable *self, uint32_t type, char *resolved, size_t rsize, const char *name ); +// static rc_t CC KTextTableVWritable ( const KTable *self, uint32_t type, const char *name, va_list args ); +// static rc_t CC KTextTableOpenManagerRead ( const KTable *self, const KDBManager **mgr ); +// static rc_t CC KTextTableOpenParentRead ( const KTable *self, const KDatabase **db ); +// static bool CC KTextTableHasRemoteData ( const KTable *self ); +// static rc_t CC KTextTableOpenDirectoryRead ( const KTable *self, const KDirectory **dir ); +// static rc_t CC KTextTableVOpenColumnRead ( const KTable *self, const KColumn **colp, const char *name, va_list args ); +// static rc_t CC KTextTableOpenMetadataRead ( const KTable *self, const KMetadata **metap ); +// static rc_t CC KTextTableVOpenIndexRead ( const KTable *self, const KIndex **idxp, const char *name, va_list args ); +// static rc_t CC KTextTableGetPath ( const KTable *self, const char **path ); +// static rc_t CC KTextTableGetName (KTable const *self, char const **rslt); +// static rc_t CC KTextTableListCol ( const KTable *self, KNamelist **names ); +// static rc_t CC KTextTableListIdx ( const KTable *self, KNamelist **names ); +// static rc_t CC KTextTableMetaCompare( const KTable *self, const KTable *other, const char * path, bool * equal ); + +static KTable_vt KTextTable_vt = +{ + KTextTableWhack, + KTableBaseAddRef, + KTableBaseRelease, + // KTextTableLocked, + // KTextTableVExists, + // KTextTableIsAlias, + // KTextTableVWritable, + // KTextTableOpenManagerRead, + // KTextTableOpenParentRead, + // KTextTableHasRemoteData, + // KTextTableOpenDirectoryRead, + // KTextTableVOpenColumnRead, + // KTextTableOpenMetadataRead, + // KTextTableVOpenIndexRead, + // KTextTableGetPath, + // KTextTableGetName, + // KTextTableListCol, + // KTextTableListIdx, + // KTextTableMetaCompare +}; + +#define CAST() assert( bself->vt == &KTextTable_vt ); Table * self = (Table *)bself + +Table::Table( const KJsonObject * p_json ) : m_json ( p_json ) +{ + dad . vt = & KTextTable_vt; + KRefcountInit ( & dad . refcount, 1, "KDBText::Table", "ctor", "db" ); +} + +Table::~Table() +{ + KRefcountWhack ( & dad . refcount, "KDBText::Table" ); +} + +rc_t +Table::inflate( char * error, size_t error_size ) +{ + rc_t rc = 0; + + const KJsonValue * name = KJsonObjectGetMember ( m_json, "name" ); + if ( name != nullptr ) + { + const char * nameStr = nullptr; + rc = KJsonGetString ( name, & nameStr ); + if ( rc == 0 ) + { + m_name = nameStr; + } + } + + return rc; +} + +static +rc_t CC +KTextTableWhack ( KTable *bself ) +{ + CAST(); + + delete reinterpret_cast( self ); + return 0; +} \ No newline at end of file diff --git a/libs/kdbtext/table.hpp b/libs/kdbtext/table.hpp new file mode 100644 index 000000000..37e7a3fca --- /dev/null +++ b/libs/kdbtext/table.hpp @@ -0,0 +1,56 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "../libs/kdb/table-base.h" + +#include +#include + +#include + +typedef struct KTextTable KTextTable; +struct KTextTable +{ + KTable dad; +}; + +namespace KDBText +{ + class Table : public KTextTable + { + public: + Table( const KJsonObject * p_json ); + ~Table(); + + rc_t inflate( char * error, size_t error_size ); + + const std::string & getName() const { return m_name; } + + private: + const KJsonObject * m_json = nullptr; + std::string m_name; + }; +} diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index 32373e527..088f91b32 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -193,15 +194,17 @@ FIXTURE_TEST_CASE(KDBTextManager_OpenDBRead, KDBTextManager_Fixture) REQUIRE_RC( KDatabaseRelease( db ) ); } -#if 0 FIXTURE_TEST_CASE(KDBTextManager_OpenTableRead, KDBTextManager_Fixture) -{ +{ // root table + Setup( R"({"type": "table", "name": "tbl"})" ); const KTable * tbl = nullptr; - REQUIRE_RC( KDBManagerOpenTableRead( m_mgr, & tbl, "%s", "SRR000123" ) ); + REQUIRE_RC( KDBManagerOpenTableRead( m_mgr, & tbl, "%s", "tbl" ) ); REQUIRE_NOT_NULL( tbl ); REQUIRE_RC( KTableRelease( tbl ) ); } +//TODO: non-root tables +#if 0 FIXTURE_TEST_CASE(KDBTextManager_OpenTableReadVPath, KDBTextManager_Fixture) { VFSManager * vfs; From c89ff8305af918bad21b92bbcf80b595cf350104 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Thu, 30 Nov 2023 14:00:01 -0500 Subject: [PATCH 05/42] VDB-5394 saving work --- libs/kdbtext/CMakeLists.txt | 1 + libs/kdbtext/database.cpp | 74 ++++++++++++++ libs/kdbtext/database.hpp | 5 + libs/kdbtext/manager.cpp | 154 ++++++++++++++++++++++++++--- libs/kdbtext/path.cpp | 85 ++++++++++++++++ libs/kdbtext/path.hpp | 42 ++++++++ libs/kdbtext/table.cpp | 33 ++++++- test/kdbtext/CMakeLists.txt | 2 + test/kdbtext/test-database.cpp | 176 +++++++++++++++++++++++++++++++++ test/kdbtext/test-manager.cpp | 98 +++++++++--------- test/kdbtext/test-table.cpp | 143 +++++++++++++++++++++++++++ 11 files changed, 750 insertions(+), 63 deletions(-) create mode 100644 libs/kdbtext/path.cpp create mode 100644 libs/kdbtext/path.hpp create mode 100644 test/kdbtext/test-database.cpp create mode 100644 test/kdbtext/test-table.cpp diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt index 942b2670e..20fda9347 100644 --- a/libs/kdbtext/CMakeLists.txt +++ b/libs/kdbtext/CMakeLists.txt @@ -26,6 +26,7 @@ set( KDBTEXT_SRC manager.cpp database.cpp table.cpp + path.cpp ) GenerateStaticLibs( kdbtext "${KDBTEXT_SRC}" ) diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 6b029ccb5..9f0e853e6 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -26,6 +26,8 @@ #include "database.hpp" +#include + using namespace KDBText; static rc_t CC KTextDatabaseWhack ( KTextDatabase *self ); @@ -78,6 +80,13 @@ Database::~Database() KRefcountWhack ( & dad . refcount, "KDBText::Database" ); } +const Database * +Database::getDatabase( const std::string & name ) const +{ + auto v = m_subdbs.find( name ); + return v == m_subdbs.end() ? nullptr : & v->second; +} + rc_t Database::inflate( char * error, size_t error_size ) { @@ -93,6 +102,71 @@ Database::inflate( char * error, size_t error_size ) m_name = nameStr; } } + else + { + string_printf ( error, error_size, nullptr, "Database name is missing" ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + + const KJsonValue * type = KJsonObjectGetMember ( m_json, "type" ); + if ( type != nullptr ) + { + const char * typeStr = nullptr; + rc = KJsonGetString ( type, & typeStr ); + if ( rc == 0 ) + { + if ( strcmp( "database", typeStr ) != 0 ) + { + string_printf ( error, error_size, nullptr, "%s.type is not 'database'('%s')", m_name.c_str(), typeStr ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + else + { + string_printf ( error, error_size, nullptr, "%s.type is invalid", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + else + { + string_printf ( error, error_size, nullptr, "%s.type is missing", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + + // nested DBs + const KJsonValue * dbs = KJsonObjectGetMember ( m_json, "databases" ); + if ( dbs != nullptr ) + { + const KJsonArray * dbarr = KJsonValueToArray ( dbs ); + if ( dbarr == nullptr ) + { + string_printf ( error, error_size, nullptr, "%s.databases is not an array", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + + uint32_t len = KJsonArrayGetLength ( dbarr ); + for ( uint32_t i = 0; i < len; ++i ) + { + const KJsonValue * v = KJsonArrayGetElement ( dbarr, i ); + assert( v != nullptr ); + const KJsonObject * obj = KJsonValueToObject ( v ); + if( obj != nullptr ) + { + Database subdb( obj ); + rc = subdb . inflate ( error, error_size ); + if ( rc != 0 ) + { + return rc; + } + m_subdbs [ subdb.getName() ] = subdb; + } + else + { // not an object + string_printf ( error, error_size, nullptr, "%s.databases[%i] is not an object", m_name.c_str(), i ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + } return rc; } diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index fa0221a55..cbe3934a8 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -32,6 +32,7 @@ typedef struct KTextDatabase KTextDatabase; #include #include +#include struct KTextDatabase { @@ -43,6 +44,7 @@ namespace KDBText class Database : public KTextDatabase { public: + Database() {} Database( const KJsonObject * p_json ); ~Database(); @@ -50,8 +52,11 @@ namespace KDBText const std::string & getName() const { return m_name; } + const Database * getDatabase( const std::string & name ) const; + private: const KJsonObject * m_json = nullptr; std::string m_name; + std::map m_subdbs; }; } diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index db490b75e..6722ec553 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -28,6 +28,7 @@ #include "database.hpp" #include "table.hpp" +#include "path.hpp" #include #include @@ -65,11 +66,10 @@ static int CC KTextManagerVPathType ( const KDBManager * self, const char *path, static int CC KTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ); static rc_t CC KTextManagerVOpenDBRead ( const KDBManager *self, const KDatabase **db, const char *path, va_list args ); static rc_t CC KTextManagerVOpenTableRead ( const KDBManager *self, const KTable **tbl, const char *path, va_list args ); - -// static rc_t CC KTextManagerOpenTableReadVPath(const KDBManager *self, const KTable **tbl, const struct VPath *path); -// static rc_t CC KTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ); -// static rc_t CC KTextManagerVPathOpenLocalDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * vpath ); -// static rc_t CC KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ); +static rc_t CC KTextManagerOpenTableReadVPath(const KDBManager *self, const KTable **tbl, const struct VPath *path); +static rc_t CC KTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ); +static rc_t CC KTextManagerVPathOpenLocalDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * vpath ); +static rc_t CC KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ); static KDBManager_vt KTextManager_vt = { @@ -85,10 +85,10 @@ static KDBManager_vt KTextManager_vt = KTextManagerVPathTypeUnreliable, KTextManagerVOpenDBRead, KTextManagerVOpenTableRead, - // KTextManagerOpenTableReadVPath, - // KTextManagerVOpenColumnRead, - // KTextManagerVPathOpenLocalDBRead, - // KTextManagerVPathOpenRemoteDBRead + KTextManagerOpenTableReadVPath, + KTextManagerVOpenColumnRead, + KTextManagerVPathOpenLocalDBRead, + KTextManagerVPathOpenRemoteDBRead }; namespace KDBText @@ -227,14 +227,14 @@ PrintToString( const char *fmt, va_list args, string & out ) } + static bool CC KTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *fmt, va_list args ) { CAST(); - string path; - PrintToString( fmt, args, path ); + Path path( fmt, args ); // TODO: non-root dbs and other objects (incl root tables) switch ( requested ) @@ -242,7 +242,40 @@ KTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *f case kptDatabase: { const Database * db = self -> getRootDatabase(); - return db && db -> getName() == path; + do + { + if ( db && path.size() > 0 && db -> getName() == path.front() ) + { + path.pop(); + if ( path.empty() ) + { + return true; + } + + if ( string("db") == path.front() ) + { + path.pop(); + if ( path.size() > 0 ) + { + db = db -> getDatabase( path.front() ); + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + while ( path . size () > 0 ); + return true; } default: return false; @@ -259,8 +292,6 @@ KTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *f // case kptMetadata: // break; // case kptPrereleaseTbl: - // type = kptTable; - // break; // default: // return false; // } @@ -269,10 +300,27 @@ KTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *f static rc_t CC -KTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ) +KTextManagerVWritable ( const KDBManager *bself, const char * fmt, va_list args ) { + CAST(); + + string path; + PrintToString( fmt, args, path ); + //TODO: parse and resolve the path, if the object is valid return rcReadOnly, otherwise rcNotFound - return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); + + const Database * db = self -> getRootDatabase(); + if (db && db -> getName() == path ) + { + return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); + } + const Table * tbl= self -> getRootTable(); + if (tbl && tbl -> getName() == path ) + { + return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); + } + + return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcNotFound ); } static @@ -368,6 +416,80 @@ KTextManagerVOpenTableRead ( const KDBManager *bself, const KTable **p_tbl, cons return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); } +static +rc_t CC +KTextManagerOpenTableReadVPath(const KDBManager *bself, const KTable **p_tbl, const struct VPath *path) +{ + CAST(); + + // parse and resolve the path + const String * p; + rc_t rc = VPathMakeString ( path, &p ); + if ( rc == 0 ) + { + // TODO: non-root tables? + const Table * tbl= self -> getRootTable(); + if (tbl && tbl -> getName() == string ( p -> addr, p -> size ) ) + { + StringWhack ( p ); + rc_t rc = KTableAddRef( (const KTable *)tbl ); + if ( rc != 0 ) + { + return rc; + } + *p_tbl = (const KTable *)tbl; + return 0; + } + StringWhack ( p ); + return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); + } + + return rc; +} + +static +rc_t CC +KTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ) +{ + return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); +} + +static +rc_t CC +KTextManagerVPathOpenLocalDBRead ( const struct KDBManager * bself, struct KDatabase const ** p_db, struct VPath const * path ) +{ + CAST(); + + // parse and resolve the path + const String * p; + rc_t rc = VPathMakeString ( path, &p ); + if ( rc == 0 ) + { + // TODO: non-root dbs + const Database * db = self -> getRootDatabase(); + if ( db && db -> getName() == string( p -> addr, p -> size ) ) + { + rc_t rc = KDatabaseAddRef( (const KDatabase *)db ); + StringWhack ( p ); + if ( rc != 0 ) + { + return rc; + } + *p_db = (const KDatabase *)db; + return 0; + } + StringWhack ( p ); + return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); + } + return rc; +} + +static +rc_t CC +KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ) +{ + return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); +} LIB_EXPORT rc_t CC diff --git a/libs/kdbtext/path.cpp b/libs/kdbtext/path.cpp new file mode 100644 index 000000000..25ff75693 --- /dev/null +++ b/libs/kdbtext/path.cpp @@ -0,0 +1,85 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "path.hpp" + +#include +#include +#include + +#include + +using namespace std; +using namespace KDBText; + +static +rc_t +PrintToString( const char *fmt, va_list args, string & out ) +{ + KDataBuffer buf; + rc_t rc = KDataBufferMake ( & buf, 8, 0 ); + if ( rc != 0 ) + { + return false; + } + + rc = KDataBufferVPrintf ( & buf, fmt, args ); + if ( rc != 0 ) + { + return rc; + } + + out = string((const char *) (buf . base)); // will be 0-terminated + + rc = KDataBufferWhack ( & buf ); + if ( rc != 0 ) + { + return rc; + } + + return rc; +} + +Path::Path( const std::string & p_source ) +{ +} + +Path::Path( const char *fmt, va_list args ) +{ + string p; + PrintToString( fmt, args, p ); + + string word; + istringstream in( p ); + while( getline(in, word, '/') ) + { + push( word ); + } +} + +Path::Path( const struct VPath * path ) +{ +} diff --git a/libs/kdbtext/path.hpp b/libs/kdbtext/path.hpp new file mode 100644 index 000000000..f9f61fa22 --- /dev/null +++ b/libs/kdbtext/path.hpp @@ -0,0 +1,42 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include +#include + +struct VPath; + +namespace KDBText +{ + // converts a string path with '/' as the separator into a vector of individual elements + class Path : public std::queue< std::string > + { + public: + Path( const std::string & p_source ); + Path( const char *fmt, va_list args ); + Path( const struct VPath * path ); + }; +} diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp index e96f086eb..5b66d52bb 100644 --- a/libs/kdbtext/table.cpp +++ b/libs/kdbtext/table.cpp @@ -26,8 +26,9 @@ #include "table.hpp" -using namespace KDBText; +#include +using namespace KDBText; static rc_t KTextTableWhack ( KTable *self ); // static bool CC KTextTableLocked ( const KTable *self ); @@ -98,6 +99,36 @@ Table::inflate( char * error, size_t error_size ) m_name = nameStr; } } + else + { + string_printf ( error, error_size, nullptr, "Table name is missing" ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + + const KJsonValue * type = KJsonObjectGetMember ( m_json, "type" ); + if ( type != nullptr ) + { + const char * typeStr = nullptr; + rc = KJsonGetString ( type, & typeStr ); + if ( rc == 0 ) + { + if ( strcmp( "table", typeStr ) != 0 ) + { + string_printf ( error, error_size, nullptr, "%s.type is not 'table'('%s')", m_name.c_str(), typeStr ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + else + { + string_printf ( error, error_size, nullptr, "%s.type is invalid", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + else + { + string_printf ( error, error_size, nullptr, "%s.type is missing", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } return rc; } diff --git a/test/kdbtext/CMakeLists.txt b/test/kdbtext/CMakeLists.txt index 039e21331..714c6c579 100644 --- a/test/kdbtext/CMakeLists.txt +++ b/test/kdbtext/CMakeLists.txt @@ -32,4 +32,6 @@ add_compile_definitions( __mod__="test/kdbtext" ) +AddExecutableTest( Test_KDBText_Table "test-table" "${COMMON_LIBS_READ};kdbtext" ) +AddExecutableTest( Test_KDBText_Database "test-database" "${COMMON_LIBS_READ};kdbtext" ) AddExecutableTest( Test_KDBText_Manager "test-manager" "${COMMON_LIBS_READ};kdbtext" ) diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp new file mode 100644 index 000000000..57fa9fb75 --- /dev/null +++ b/test/kdbtext/test-database.cpp @@ -0,0 +1,176 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for KDBDatabase for reading textual data +*/ + +#include + +#include "../../libs/kdbtext/database.hpp" + +#include +#include + +using namespace std; +using namespace KDBText; + +TEST_SUITE(KDBTextDatabaseTestSuite); + +class KDBTextDatabase_Fixture +{ +public: + KDBTextDatabase_Fixture() + { + } + ~KDBTextDatabase_Fixture() + { + delete m_db; + KJsonValueWhack( m_json ); + } + + void Setup( const char * input ) + { + THROW_ON_RC( KJsonValueMake ( & m_json, input, m_error, sizeof m_error ) ); + THROW_ON_FALSE( jsObject == KJsonGetValueType ( m_json ) ); + + const KJsonObject * json = KJsonValueToObject ( m_json ); + THROW_ON_FALSE( json != nullptr ); + + m_db = new Database( json ); + } + + KJsonValue * m_json = nullptr; + Database * m_db = nullptr; + char m_error[1024] = {0}; +}; + +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Empty, KDBTextDatabase_Fixture) +{ + Setup(R"({})"); + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_NoName, KDBTextDatabase_Fixture) +{ + Setup(R"({"type": "database"})"); + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_NoType, KDBTextDatabase_Fixture) +{ + Setup(R"({"name": "testdb"})"); + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_InvalidType, KDBTextDatabase_Fixture) +{ + Setup(R"({"type": [], "name": "testdb"})"); + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_WrongType, KDBTextDatabase_Fixture) +{ + Setup(R"({"type": "table", "name": "testdb"})"); + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Flat, KDBTextDatabase_Fixture) +{ + Setup(R"({"type": "database", "name": "testdb"})"); + + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + REQUIRE_EQ( string("testdb"), m_db -> getName() ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_NotArray, KDBTextDatabase_Fixture) +{ + Setup(R"({"type": "database", "name": "testdb","databases":{"type": "database", "name":"subdb1"} })"); + + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementNull, KDBTextDatabase_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb","databases":[ null ]})" ); + + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementBad, KDBTextDatabase_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "notadatabase", "name":"subdb1"} ]})" ); + + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database", "name":"subdb1"} , {"type": "database", "name":"subdb2"} ]})" ); + + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + REQUIRE_NULL( m_db -> getDatabase( "notthere") ); + REQUIRE_NOT_NULL( m_db -> getDatabase( "subdb1") ); + REQUIRE_NOT_NULL( m_db -> getDatabase( "subdb2") ); +} + +//TODO: tables, metadata, indexes + +//////////////////////////////////////////// Main +extern "C" +{ + +#include +#include + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} +rc_t CC UsageSummary (const char * progname) +{ + return 0; +} + +rc_t CC Usage ( const Args * args ) +{ + return 0; +} + +const char UsageDefaultName[] = "Test_KDBText_Database"; + +rc_t CC KMain ( int argc, char *argv [] ) +{ + KConfigDisableUserSettings(); + rc_t rc=KDBTextDatabaseTestSuite(argc, argv); + return rc; +} + +} diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index 088f91b32..ed7b81fab 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -52,13 +52,23 @@ class KDBTextManager_Fixture } ~KDBTextManager_Fixture() { + VPathRelease( m_path ); KDBManagerRelease( m_mgr ); } void Setup( const char * input = "{}" ) { THROW_ON_RC( KDBManagerMakeText ( & m_mgr, input, m_error, sizeof m_error ) ); } + void MakeVPath( const char * path ) + { + VFSManager * vfs; + THROW_ON_RC( VFSManagerMake ( & vfs ) ); + THROW_ON_RC( VFSManagerMakePath ( vfs, & m_path, "%s", path ) ); + THROW_ON_RC( VFSManagerRelease( vfs ) ); + } + const KDBManager * m_mgr = nullptr; + VPath * m_path = nullptr; char m_error[1024]; }; @@ -112,6 +122,12 @@ FIXTURE_TEST_CASE(KDBTextManager_Db_Exists, KDBTextManager_Fixture) Setup( R"({"type": "database", "name": "testdb"})" ); REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb" ) ); } +FIXTURE_TEST_CASE(KDBTextManager_SubDb_Exists, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database","name":"subdb1"} , {"type": "database","name":"subdb2"} ]})" ); + REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb1" ) ); + REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb2" ) ); +} FIXTURE_TEST_CASE(KDBTextManager_Writable_Found, KDBTextManager_Fixture) { // for now, any path will be reported as readonly @@ -119,15 +135,12 @@ FIXTURE_TEST_CASE(KDBTextManager_Writable_Found, KDBTextManager_Fixture) rc_t rc = KDBManagerWritable( m_mgr, "%s", "testdb" ); REQUIRE_EQ( SILENT_RC( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ), rc ); } -//TODO -// FIXTURE_TEST_CASE(KDBTextManager_Writable_NotFound, KDBTextManager_Fixture) -// { -// Setup( R"({"type": "database", "name": "testdb"})" ); -// rc_t rc = KDBManagerWritable( m_mgr, "%s", "proddb" ); -// REQUIRE_EQ( SILENT_RC( rcDB, rcPath, rcAccessing, rcPath, rcNotFound ), rc ); -// } - -//TODO: KDBManagerWritable on internal objects, to test interpretation of the path +FIXTURE_TEST_CASE(KDBTextManager_Writable_NotFound, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + rc_t rc = KDBManagerWritable( m_mgr, "%s", "proddb" ); + REQUIRE_EQ( SILENT_RC( rcDB, rcPath, rcAccessing, rcPath, rcNotFound ), rc ); +} FIXTURE_TEST_CASE(KDBTextManager_RunPeriodicTasks, KDBTextManager_Fixture) { @@ -138,30 +151,14 @@ FIXTURE_TEST_CASE(KDBTextManager_RunPeriodicTasks, KDBTextManager_Fixture) FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db, KDBTextManager_Fixture) { Setup( R"({"type": "database", "name": "testdb"})" ); - - VFSManager * vfs; - REQUIRE_RC( VFSManagerMake ( & vfs ) ); - - struct VPath * path; - REQUIRE_RC( VFSManagerMakePath ( vfs, & path, "%s", "testdb" ) ); - REQUIRE_EQ( (int)kptDatabase, KDBManagerPathTypeVP( m_mgr, path ) ); - - REQUIRE_RC( VPathRelease( path ) ); - REQUIRE_RC( VFSManagerRelease( vfs ) ); + MakeVPath( "testdb"); + REQUIRE_EQ( (int)kptDatabase, KDBManagerPathTypeVP( m_mgr, m_path ) ); } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_NotFound, KDBTextManager_Fixture) { Setup( R"({"type": "database", "name": "testdb"})" ); - - VFSManager * vfs; - REQUIRE_RC( VFSManagerMake ( & vfs ) ); - - struct VPath * path; - REQUIRE_RC( VFSManagerMakePath ( vfs, & path, "%s", "proddb" ) ); - REQUIRE_EQ( (int)kptNotFound, KDBManagerPathTypeVP( m_mgr, path ) ); - - REQUIRE_RC( VPathRelease( path ) ); - REQUIRE_RC( VFSManagerRelease( vfs ) ); + MakeVPath( "proddb"); + REQUIRE_EQ( (int)kptNotFound, KDBManagerPathTypeVP( m_mgr, m_path ) ); } //TODO: KDBManagerPathTypeVP on internal objects, to test interpretation of the path @@ -204,35 +201,44 @@ FIXTURE_TEST_CASE(KDBTextManager_OpenTableRead, KDBTextManager_Fixture) } //TODO: non-root tables -#if 0 FIXTURE_TEST_CASE(KDBTextManager_OpenTableReadVPath, KDBTextManager_Fixture) { - VFSManager * vfs; - REQUIRE_RC( VFSManagerMake ( & vfs ) ); - - struct VPath * path; - REQUIRE_RC( VFSManagerMakePath ( vfs, & path, "%s", "SRR000123" ) ); - + Setup( R"({"type": "table", "name": "tbl"})" ); + MakeVPath( "tbl"); const KTable * tbl = nullptr; - REQUIRE_RC( KDBManagerOpenTableReadVPath( m_mgr, & tbl, path ) ); + REQUIRE_RC( KDBManagerOpenTableReadVPath( m_mgr, & tbl, m_path ) ); REQUIRE_NOT_NULL( tbl ); REQUIRE_RC( KTableRelease( tbl ) ); - - REQUIRE_RC( VPathRelease( path ) ); - REQUIRE_RC( VFSManagerRelease( vfs ) ); } FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead, KDBTextManager_Fixture) { + Setup( R"({"type": "table", "name": "SEQUENCE", "columns":[{"name":"qq"}]})" ); + const KColumn * col = nullptr; - rc_t rc = SILENT_RC( rcVFS,rcMgr,rcOpening,rcDirectory,rcNotFound ); - REQUIRE_EQ( rc, KDBManagerOpenColumnRead( m_mgr, & col, "%s", "testdb/tbl/SEQUENCE/col/qq" ) ); - REQUIRE_NULL( col ); + REQUIRE_RC( KDBManagerOpenColumnRead( m_mgr, & col, "%s", "SEQUENCE/col/qq" ) ); + REQUIRE_NOT_NULL( col ); + REQUIRE_RC( KColumnRelease( col ) ); +} + +FIXTURE_TEST_CASE(KDBManager_VPathOpenLocalDBRead, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + MakeVPath( "testdb"); + const KDatabase * db = nullptr; + REQUIRE_RC( KDBManagerVPathOpenLocalDBRead( m_mgr, & db, m_path ) ); + REQUIRE_NOT_NULL( db ); + REQUIRE_RC( KDatabaseRelease( db ) ); } -//KDBManagerVPathOpenLocalDBRead: see remote_open_test.cpp/kdbtest.cpp -//KDBManagerVPathOpenRemoteDBRead -#endif +FIXTURE_TEST_CASE(KDBManager_VPathOpenRemoteDBRead, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + MakeVPath( "testdb"); + const KDatabase * db = nullptr; + rc_t rc = KDBManagerVPathOpenRemoteDBRead( m_mgr, & db, m_path, nullptr ); + REQUIRE_EQ( SILENT_RC( rcDB, rcMgr, rcOpening, rcType, rcInvalid ), rc ); +} //////////////////////////////////////////// Main extern "C" diff --git a/test/kdbtext/test-table.cpp b/test/kdbtext/test-table.cpp new file mode 100644 index 000000000..eb510d623 --- /dev/null +++ b/test/kdbtext/test-table.cpp @@ -0,0 +1,143 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for KDBTable for reading textual data +*/ + +#include + +#include "../../libs/kdbtext/table.hpp" + +#include +#include + +using namespace std; +using namespace KDBText; + +TEST_SUITE(KDBTextTableTestSuite); + +class KDBTextTable_Fixture +{ +public: + KDBTextTable_Fixture() + { + } + ~KDBTextTable_Fixture() + { + delete m_tbl; + KJsonValueWhack( m_json ); + } + + void Setup( const char * input ) + { + THROW_ON_RC( KJsonValueMake ( & m_json, input, m_error, sizeof m_error ) ); + THROW_ON_FALSE( jsObject == KJsonGetValueType ( m_json ) ); + + const KJsonObject * json = KJsonValueToObject ( m_json ); + THROW_ON_FALSE( json != nullptr ); + + m_tbl = new Table( json ); + } + + KJsonValue * m_json = nullptr; + Table * m_tbl = nullptr; + char m_error[1024] = {0}; +}; + +FIXTURE_TEST_CASE(KDBTextTable_Make_Empty, KDBTextTable_Fixture) +{ + Setup(R"({})"); + REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextTable_Make_NoName, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table"})"); + REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextTable_Make_NoType, KDBTextTable_Fixture) +{ + Setup(R"({"name": "testtbl"})"); + REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextTable_Make_InvalidType, KDBTextTable_Fixture) +{ + Setup(R"({"type": [], "name": "testtbl"})"); + REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextTable_Make_WrongType, KDBTextTable_Fixture) +{ + Setup(R"({"type": "database", "name": "testtbl"})"); + REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KDBTextTable_Make_Flat, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table", "name": "testtbl"})"); + + REQUIRE_RC( m_tbl -> inflate( m_error, sizeof m_error ) ); + + REQUIRE_EQ( string("testtbl"), m_tbl -> getName() ); +} + +//TODO: columns, metadata, indexes + +//////////////////////////////////////////// Main +extern "C" +{ + +#include +#include + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} +rc_t CC UsageSummary (const char * progname) +{ + return 0; +} + +rc_t CC Usage ( const Args * args ) +{ + return 0; +} + +const char UsageDefaultName[] = "Test_KDBText_Table"; + +rc_t CC KMain ( int argc, char *argv [] ) +{ + KConfigDisableUserSettings(); + rc_t rc=KDBTextTableTestSuite(argc, argv); + return rc; +} + +} From 15ae0619c74921b9dc183eeece62959587a31f81 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 1 Dec 2023 15:14:06 -0500 Subject: [PATCH 06/42] VDB-5394 saving work --- libs/kdbtext/CMakeLists.txt | 1 + libs/kdbtext/column.cpp | 89 +++++++++++++++++++++++++ libs/kdbtext/column.hpp | 56 ++++++++++++++++ libs/kdbtext/database.cpp | 23 ++++++- libs/kdbtext/database.hpp | 4 +- libs/kdbtext/table.cpp | 64 ++++++++++++++++-- libs/kdbtext/table.hpp | 6 ++ test/kdbtext/CMakeLists.txt | 1 + test/kdbtext/test-column.cpp | 117 +++++++++++++++++++++++++++++++++ test/kdbtext/test-database.cpp | 7 ++ test/kdbtext/test-table.cpp | 30 +++++++++ 11 files changed, 389 insertions(+), 9 deletions(-) create mode 100644 libs/kdbtext/column.cpp create mode 100644 libs/kdbtext/column.hpp create mode 100644 test/kdbtext/test-column.cpp diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt index 20fda9347..6587f0641 100644 --- a/libs/kdbtext/CMakeLists.txt +++ b/libs/kdbtext/CMakeLists.txt @@ -26,6 +26,7 @@ set( KDBTEXT_SRC manager.cpp database.cpp table.cpp + column.cpp path.cpp ) diff --git a/libs/kdbtext/column.cpp b/libs/kdbtext/column.cpp new file mode 100644 index 000000000..a636f4002 --- /dev/null +++ b/libs/kdbtext/column.cpp @@ -0,0 +1,89 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "column.hpp" + +#include + +using namespace KDBText; + +static rc_t KTextColumnWhack ( KColumn *self ); + +static KColumn_vt KTextColumn_vt = +{ + KTextColumnWhack, + KColumnBaseAddRef, + KColumnBaseRelease, +}; + +#define CAST() assert( bself->vt == &KTextColumn_vt ); Column * self = (Column *)bself + +Column::Column( const KJsonObject * p_json ) : m_json ( p_json ) +{ + dad . vt = & KTextColumn_vt; + KRefcountInit ( & dad . refcount, 1, "KDBText::Column", "ctor", "db" ); +} + +Column::~Column() +{ + KRefcountWhack ( & dad . refcount, "KDBText::Column" ); +} + +rc_t +Column::inflate( char * error, size_t error_size ) +{ + rc_t rc = 0; + + const KJsonValue * name = KJsonObjectGetMember ( m_json, "name" ); + if ( name != nullptr ) + { + const char * nameStr = nullptr; + rc = KJsonGetString ( name, & nameStr ); + if ( rc == 0 ) + { + m_name = nameStr; + } + } + else + { + string_printf ( error, error_size, nullptr, "Column name is missing" ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + + //TBD + + return rc; +} + +static +rc_t CC +KTextColumnWhack ( KColumn *bself ) +{ + CAST(); + + delete reinterpret_cast( self ); + return 0; +} \ No newline at end of file diff --git a/libs/kdbtext/column.hpp b/libs/kdbtext/column.hpp new file mode 100644 index 000000000..933e5e6e4 --- /dev/null +++ b/libs/kdbtext/column.hpp @@ -0,0 +1,56 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "../libs/kdb/column-base.h" + +#include +#include + +#include + +typedef struct KTextColumn KTextColumn; +struct KTextColumn +{ + KColumn dad; +}; + +namespace KDBText +{ + class Column : public KTextColumn + { + public: + Column( const KJsonObject * p_json ); + ~Column(); + + rc_t inflate( char * error, size_t error_size ); + + const std::string & getName() const { return m_name; } + + private: + const KJsonObject * m_json = nullptr; + std::string m_name; + }; +} diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 9f0e853e6..529774f85 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -28,6 +28,8 @@ #include +#include + using namespace KDBText; static rc_t CC KTextDatabaseWhack ( KTextDatabase *self ); @@ -83,8 +85,14 @@ Database::~Database() const Database * Database::getDatabase( const std::string & name ) const { - auto v = m_subdbs.find( name ); - return v == m_subdbs.end() ? nullptr : & v->second; + for( auto & d : m_subdbs ) + { + if ( name == d.getName() ) + { + return & d; + } + } + return nullptr; } rc_t @@ -158,7 +166,16 @@ Database::inflate( char * error, size_t error_size ) { return rc; } - m_subdbs [ subdb.getName() ] = subdb; + + for( auto & d : m_subdbs ) + { + if ( subdb.getName() == d.getName() ) + { + string_printf ( error, error_size, nullptr, "Duplicate nested db: %s", subdb.getName().c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + m_subdbs .push_back( subdb ); } else { // not an object diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index cbe3934a8..60beb0cb3 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -32,7 +32,7 @@ typedef struct KTextDatabase KTextDatabase; #include #include -#include +#include struct KTextDatabase { @@ -57,6 +57,6 @@ namespace KDBText private: const KJsonObject * m_json = nullptr; std::string m_name; - std::map m_subdbs; + std::vector m_subdbs; }; } diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp index 5b66d52bb..9f7740c40 100644 --- a/libs/kdbtext/table.cpp +++ b/libs/kdbtext/table.cpp @@ -84,6 +84,19 @@ Table::~Table() KRefcountWhack ( & dad . refcount, "KDBText::Table" ); } +const Column * +Table::getColumn( const std::string & name ) const +{ + for( auto & c : m_columns ) + { + if ( name == c.getName() ) + { + return & c; + } + } + return nullptr; +} + rc_t Table::inflate( char * error, size_t error_size ) { @@ -102,7 +115,7 @@ Table::inflate( char * error, size_t error_size ) else { string_printf ( error, error_size, nullptr, "Table name is missing" ); - return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } const KJsonValue * type = KJsonObjectGetMember ( m_json, "type" ); @@ -115,21 +128,64 @@ Table::inflate( char * error, size_t error_size ) if ( strcmp( "table", typeStr ) != 0 ) { string_printf ( error, error_size, nullptr, "%s.type is not 'table'('%s')", m_name.c_str(), typeStr ); - return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } } else { string_printf ( error, error_size, nullptr, "%s.type is invalid", m_name.c_str() ); - return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } } else { string_printf ( error, error_size, nullptr, "%s.type is missing", m_name.c_str() ); - return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } + // Columns + const KJsonValue * dbs = KJsonObjectGetMember ( m_json, "columns" ); + if ( dbs != nullptr ) + { + const KJsonArray * colarr = KJsonValueToArray ( dbs ); + if ( colarr == nullptr ) + { + string_printf ( error, error_size, nullptr, "%s.columns is not an array", m_name.c_str() ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); + } + + uint32_t len = KJsonArrayGetLength ( colarr ); + for ( uint32_t i = 0; i < len; ++i ) + { + const KJsonValue * v = KJsonArrayGetElement ( colarr, i ); + assert( v != nullptr ); + const KJsonObject * obj = KJsonValueToObject ( v ); + if( obj != nullptr ) + { + Column col( obj ); + rc = col . inflate ( error, error_size ); + if ( rc != 0 ) + { + return rc; + } + + for( auto & d : m_columns ) + { + if ( col.getName() == d.getName() ) + { + string_printf ( error, error_size, nullptr, "Duplicate column: %s", col.getName().c_str() ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); + } + } + m_columns .push_back( col ); + } + else + { // not an object + string_printf ( error, error_size, nullptr, "%s.columns[%i] is not an object", m_name.c_str(), i ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); + } + } + } return rc; } diff --git a/libs/kdbtext/table.hpp b/libs/kdbtext/table.hpp index 37e7a3fca..656369071 100644 --- a/libs/kdbtext/table.hpp +++ b/libs/kdbtext/table.hpp @@ -26,10 +26,13 @@ #include "../libs/kdb/table-base.h" +#include "column.hpp" + #include #include #include +#include typedef struct KTextTable KTextTable; struct KTextTable @@ -49,8 +52,11 @@ namespace KDBText const std::string & getName() const { return m_name; } + const Column * getColumn( const std::string& name ) const; + private: const KJsonObject * m_json = nullptr; std::string m_name; + std::vector m_columns; }; } diff --git a/test/kdbtext/CMakeLists.txt b/test/kdbtext/CMakeLists.txt index 714c6c579..14b226b0c 100644 --- a/test/kdbtext/CMakeLists.txt +++ b/test/kdbtext/CMakeLists.txt @@ -32,6 +32,7 @@ add_compile_definitions( __mod__="test/kdbtext" ) +AddExecutableTest( Test_KDBText_Column "test-column" "${COMMON_LIBS_READ};kdbtext" ) AddExecutableTest( Test_KDBText_Table "test-table" "${COMMON_LIBS_READ};kdbtext" ) AddExecutableTest( Test_KDBText_Database "test-database" "${COMMON_LIBS_READ};kdbtext" ) AddExecutableTest( Test_KDBText_Manager "test-manager" "${COMMON_LIBS_READ};kdbtext" ) diff --git a/test/kdbtext/test-column.cpp b/test/kdbtext/test-column.cpp new file mode 100644 index 000000000..2c1f9a392 --- /dev/null +++ b/test/kdbtext/test-column.cpp @@ -0,0 +1,117 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for KDBColumn for reading textual data +*/ + +#include + +#include "../../libs/kdbtext/column.hpp" + +#include +#include + +using namespace std; +using namespace KDBText; + +TEST_SUITE(KDBTextColumnTestSuite); + +class KDBTextColumn_Fixture +{ +public: + KDBTextColumn_Fixture() + { + } + ~KDBTextColumn_Fixture() + { + delete m_col; + KJsonValueWhack( m_json ); + } + + void Setup( const char * input ) + { + THROW_ON_RC( KJsonValueMake ( & m_json, input, m_error, sizeof m_error ) ); + THROW_ON_FALSE( jsObject == KJsonGetValueType ( m_json ) ); + + const KJsonObject * json = KJsonValueToObject ( m_json ); + THROW_ON_FALSE( json != nullptr ); + + m_col = new Column( json ); + } + + KJsonValue * m_json = nullptr; + Column * m_col = nullptr; + char m_error[1024] = {0}; +}; + +FIXTURE_TEST_CASE(KDBTextColumn_Make_Empty, KDBTextColumn_Fixture) +{ + Setup(R"({})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KDBTextColumn_Make, KDBTextColumn_Fixture) +{ + Setup(R"({"name":"col"})"); + REQUIRE_RC( m_col -> inflate( m_error, sizeof m_error ) ); + REQUIRE_EQ( string("col"), m_col->getName() ); +} + +//TODO: the rest + +//////////////////////////////////////////// Main +extern "C" +{ + +#include +#include + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} +rc_t CC UsageSummary (const char * progname) +{ + return 0; +} + +rc_t CC Usage ( const Args * args ) +{ + return 0; +} + +const char UsageDefaultName[] = "Test_KDBText_Column"; + +rc_t CC KMain ( int argc, char *argv [] ) +{ + KConfigDisableUserSettings(); + rc_t rc=KDBTextColumnTestSuite(argc, argv); + return rc; +} + +} diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index 57fa9fb75..ff7e5e241 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -129,6 +129,13 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementBad, KDBTextDatabase_Fixtur REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_Duplicate, KDBTextDatabase_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database", "name":"subdb1"} , {"type": "database", "name":"subdb1"} ]})" ); + + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) { diff --git a/test/kdbtext/test-table.cpp b/test/kdbtext/test-table.cpp index eb510d623..b8c8d291f 100644 --- a/test/kdbtext/test-table.cpp +++ b/test/kdbtext/test-table.cpp @@ -108,6 +108,36 @@ FIXTURE_TEST_CASE(KDBTextTable_Make_Flat, KDBTextTable_Fixture) REQUIRE_EQ( string("testtbl"), m_tbl -> getName() ); } +FIXTURE_TEST_CASE(KDBTextTable_Make_ColumnsNoArray, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table", "name": "testtbl","columns":{"name":"col1"}})"); + REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextTable_Make_ColumnDuplicate, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col1"}]})"); + REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextTable_Make_ColumnNotObject, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table", "name": "testtbl","columns":["1"]})"); + REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KDBTextTable_Make_WithColumns, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col2"}]})"); + + REQUIRE_RC( m_tbl -> inflate( m_error, sizeof m_error ) ); + + REQUIRE_NULL( m_tbl -> getColumn( "nocol" ) ); + REQUIRE_NOT_NULL( m_tbl -> getColumn( "col1" ) ); + REQUIRE_NOT_NULL( m_tbl -> getColumn( "col2" ) ); +} + //TODO: columns, metadata, indexes //////////////////////////////////////////// Main From 44622b3dfb79a8346246682c502f2a7acf2bccb1 Mon Sep 17 00:00:00 2001 From: Alexander Ukrainchik Date: Tue, 5 Dec 2023 11:47:45 -0500 Subject: [PATCH 07/42] VDB-5492 removing most of the warnings, fixing some bugs --- libs/klib/printf.c | 12 +- libs/klib/report-klib.c | 2 +- libs/klib/text.c | 2 +- libs/klib/token.c | 6 +- libs/kns/http-client.c | 24 ++- libs/kns/http-file.c | 37 ++-- libs/kns/http-request.c | 39 ++++- libs/kns/http-retrier.c | 18 +- libs/kns/manager.c | 307 ++++++++++++++++++++++++++++++++-- libs/kns/proxy.c | 49 ++++-- libs/kns/stable-http-file.c | 56 +++++++ libs/kns/stream-from-buffer.c | 9 +- libs/kns/stream.c | 4 +- libs/kns/tls.c | 61 ++++++- libs/kns/win/syssock.c | 36 ++-- libs/kns/win/sysstream.c | 4 +- 16 files changed, 562 insertions(+), 104 deletions(-) diff --git a/libs/klib/printf.c b/libs/klib/printf.c index e151d0e60..d6d7a29fa 100644 --- a/libs/klib/printf.c +++ b/libs/klib/printf.c @@ -2650,7 +2650,7 @@ rc_t structured_print_engine ( KBufferedWrtHandler *out, case sptNulTermString: /* special initialization to flag size/length unknown */ - StringInit ( & S, args [ arg_idx ] . s, (uint32_t)0, (uint32_t)-1 ); + StringInit ( & S, args [ arg_idx ] . s, 0, (uint32_t)-1 ); /* IF THE STRING IS INDEXED OR MAY NEED LEFT ALIGNMENT */ if ( f . u . f . start_idx != 0 || f . u . f . select_len != 0 || @@ -2904,7 +2904,7 @@ rc_t structured_print_engine ( KBufferedWrtHandler *out, #endif /* create text string */ assert(int_len >= 0); - StringInit ( & S, & text [ i ], (uint32_t)int_len, (uint32_t)int_len ); + StringInit ( & S, & text [ i ], int_len, (uint32_t)int_len ); /* zero-fill amount */ assert(f.u.f.precision == -1 || f . u . f . precision >= 0); @@ -3097,7 +3097,7 @@ rc_t structured_print_engine ( KBufferedWrtHandler *out, ); #endif assert(dst_len >= 0); - StringInit ( & S, text, (uint32_t)dst_len, (uint32_t)dst_len ); + StringInit ( & S, text, dst_len, (uint32_t)dst_len ); f.u.f.precision = dst_len; break; @@ -3223,7 +3223,7 @@ rc_t structured_print_engine ( KBufferedWrtHandler *out, } assert(dst_len >= 0); - StringInit ( & S, text, (uint32_t)dst_len, (uint32_t)dst_len ); + StringInit ( & S, text, dst_len, (uint32_t)dst_len ); break; case spfRC: @@ -3231,7 +3231,7 @@ rc_t structured_print_engine ( KBufferedWrtHandler *out, assert ( FITS_INTO_INT32 ( temp_size_t ) ); dst_len = (int32_t)temp_size_t; assert(dst_len >= 0); - StringInit ( & S, text, (uint32_t)dst_len, (uint32_t)dst_len ); + StringInit ( & S, text, dst_len, (uint32_t)dst_len ); break; case spfOSErr: @@ -3239,7 +3239,7 @@ rc_t structured_print_engine ( KBufferedWrtHandler *out, assert ( FITS_INTO_INT32 ( temp_size_t ) ); dst_len = (uint32_t)temp_size_t; assert(dst_len >= 0); - StringInit ( & S, text, (uint32_t)dst_len, (uint32_t)dst_len ); + StringInit ( & S, text, dst_len, (uint32_t)dst_len ); break; default: diff --git a/libs/klib/report-klib.c b/libs/klib/report-klib.c index 16deb52f6..e2629124d 100644 --- a/libs/klib/report-klib.c +++ b/libs/klib/report-klib.c @@ -517,7 +517,7 @@ static rc_t ReportRun(int indent, rc_t rc_in) { { name = val = "not found"; } report(indent + 1, "Home", 2, "name", 's', name, "value", 's', val); } -#endif // WINDOWS +#endif /* WINDOWS */ if ( self -> report_cwd != NULL ) rc = ( * self -> report_cwd ) ( & report_funcs, indent + 1 ); diff --git a/libs/klib/text.c b/libs/klib/text.c index 54bd4faa2..1a1eced8c 100644 --- a/libs/klib/text.c +++ b/libs/klib/text.c @@ -174,7 +174,7 @@ LIB_EXPORT String * CC StringTrim ( const String * str, String * trimmed ) assert ( FITS_INTO_INT32 ( end - i ) ); assert ( FITS_INTO_INT32 ( len - ( i + sz - end ) ) ); - StringInit ( trimmed, & addr [ i ], (uint32_t) (end - i), (uint32_t)(len - ( i + sz - end )) ); + StringInit ( trimmed, & addr [ i ], end - i, (uint32_t)(len - ( i + sz - end )) ); } } diff --git a/libs/klib/token.c b/libs/klib/token.c index 162a095c6..3fb990d45 100644 --- a/libs/klib/token.c +++ b/libs/klib/token.c @@ -266,7 +266,7 @@ LIB_EXPORT rc_t CC KTokenToVersion ( const KToken *self, uint32_t *vp ) case eMajMinRel: dot = string_rchr ( start, end - start, '.' ) + 1; assert ( dot > start && dot < end ); - StringInit ( & str, dot, (size_t)( end - dot ), (uint32_t)( end - dot ) ); + StringInit ( & str, dot, end - dot, (uint32_t)( end - dot ) ); rc = StringConvertDecimal ( & str, & i, 16 ); if ( rc != 0 ) break; @@ -281,7 +281,7 @@ LIB_EXPORT rc_t CC KTokenToVersion ( const KToken *self, uint32_t *vp ) return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect ); if ( ++ dot == end ) return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect ); - StringInit ( & str, dot, (size_t)( end - dot ), (uint32_t)( end - dot ) ); + StringInit ( & str, dot, end - dot, (uint32_t)( end - dot ) ); rc = StringConvertDecimal ( & str, & i, 8 ); if ( rc != 0 ) break; @@ -292,7 +292,7 @@ LIB_EXPORT rc_t CC KTokenToVersion ( const KToken *self, uint32_t *vp ) /* single-part versions */ case eOctal: case eDecimal: - StringInit ( & str, start, (size_t)( end - start ), (uint32_t)( end - start ) ); + StringInit ( & str, start, end - start, (uint32_t)( end - start ) ); rc = StringConvertDecimal ( & str, & i, 8 ); if ( rc != 0 ) break; diff --git a/libs/kns/http-client.c b/libs/kns/http-client.c index a3252bf57..7bbdb1db3 100644 --- a/libs/kns/http-client.c +++ b/libs/kns/http-client.c @@ -55,6 +55,8 @@ typedef struct KClientHttpStream KClientHttpStream; #include +#include "../klib/int_checks-priv.h" + #if _DEBUGGING && 0 #include #define TRACE( x, ... ) \ @@ -326,7 +328,8 @@ struct KEndPointArgsIterator * KNSManagerMakeKEndPointArgsIterator ( { struct KEndPointArgsIterator * i = calloc ( 1, sizeof * i ); - KEndPointArgsIteratorMake ( i, self, hostname, port, cnt ); + assert(FITS_INTO_INT16(port)); + KEndPointArgsIteratorMake ( i, self, hostname, (uint16_t)port, cnt ); return i; } @@ -478,7 +481,15 @@ rc_t KClientHttpOpen ( KClientHttp * self, const String * aHostname, uint32_t aP static bool INITED = false; static bool PRINT_STAT = false; if (!INITED) { +#ifdef WINDOWS + { + size_t buf_size; + errno_t err = getenv_s ( & buf_size, NULL, 0, "NCBI_VDB_STS_SILENT" ); + PRINT_STAT = ( err != 0 || buf_size == 0 ); + } +#else PRINT_STAT = getenv("NCBI_VDB_STS_SILENT") == NULL; +#endif INITED = true; } @@ -488,7 +499,8 @@ rc_t KClientHttpOpen ( KClientHttp * self, const String * aHostname, uint32_t aP mgr = self -> mgr; assert ( mgr ); - KEndPointArgsIteratorMake ( & it, mgr, aHostname, aPort, NULL ); + assert ( FITS_INTO_INT16 ( aPort ) ); + KEndPointArgsIteratorMake ( & it, mgr, aHostname, (uint16_t)aPort, NULL ); while ( KEndPointArgsIteratorNext ( & it, & hostname, & port, & proxy_default_port, & proxy_ep, NULL, NULL ) ) { @@ -702,7 +714,7 @@ rc_t KClientHttpInit ( KClientHttp * http, const KDataBuffer *hostname_buffer, v if ( rc == 0 ) { - const char * s; + const char * s = NULL; const char * ua = NULL; rc = KNSManagerGetUserAgent(&ua); if (rc == 0) @@ -1506,7 +1518,7 @@ rc_t KClientHttpGetStatusLine ( KClientHttp *self, timeout_t *tm, String *msg, u else { /* which version was returned? */ - * version = string_cmp ( "1.0", 3, buffer, sep - buffer, -1 ) == 0 ? 0x01000000 : 0x01010000; + * version = string_cmp ( "1.0", 3, buffer, sep - buffer, (uint32_t)-1 ) == 0 ? 0x01000000 : 0x01010000; /* move up to status code */ buffer = sep + 1; @@ -1915,7 +1927,7 @@ rc_t KClientHttpSendReceiveMsg ( KClientHttp *self, KClientHttpResult **rslt, const char *buffer, size_t len, const KDataBuffer *body, const char *url ) { rc_t rc = 0; - size_t sent; + size_t sent = 0; timeout_t tm; timeout_t * ptm = NULL; uint32_t status; @@ -2601,7 +2613,7 @@ LIB_EXPORT bool CC KClientHttpResultTestHeaderValue ( const KClientHttpResult *s sep = end; /* test for case-insensitive match of value */ - if ( strcase_cmp ( start, sep - start, value, val_size, -1 ) == 0 ) + if ( strcase_cmp ( start, sep - start, value, val_size, (uint32_t)-1 ) == 0 ) { /* found it - delete p if malloc'd */ if ( p != buffer && p != NULL ) diff --git a/libs/kns/http-file.c b/libs/kns/http-file.c index 76ded386f..e5d9b84fc 100644 --- a/libs/kns/http-file.c +++ b/libs/kns/http-file.c @@ -73,6 +73,8 @@ #include #endif +#include "../klib/int_checks-priv.h" + #if _DEBUGGING && 0 #include #define TRACE( x, ... ) \ @@ -793,12 +795,12 @@ rc_t CC KHttpFileTimedRead ( const KHttpFile *self, rc = KHttpFileTimedReadLocked ( self, pos, buffer, bsize, num_read, tm, & http_status ); if ( rc != 0 ) { - rc_t rc2=KClientHttpReopen ( self -> http ); + rc_t rc3=KClientHttpReopen ( self -> http ); DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_HTTP ), ( "KHttpFileTimedRead: KHttpFileTimedReadLocked failed, reopening\n" ) ); - if ( rc2 == 0 ) + if ( rc3 == 0 ) { - rc2 = KHttpFileTimedReadLocked ( self, pos, buffer, bsize, num_read, tm, & http_status ); - if ( rc2 == 0 ) + rc3 = KHttpFileTimedReadLocked ( self, pos, buffer, bsize, num_read, tm, & http_status ); + if ( rc3 == 0 ) { DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_HTTP ), ( "KHttpFileTimedRead: reopened successfully\n" ) ); rc= 0; @@ -1332,15 +1334,15 @@ static rc_t KNSManagerVMakeHttpFileIntUnstableImpl( const KNSManager *self, if ( rc == 0 ) { - KDataBuffer * buf = & f -> orig_url_buffer; + KDataBuffer * buf_f = & f -> orig_url_buffer; KClientHttp *http; - rc = KNSManagerMakeClientHttpInt ( self, & http, buf, conn, vers, + rc = KNSManagerMakeClientHttpInt ( self, & http, buf_f, conn, vers, self -> http_read_timeout, self -> http_write_timeout, & f -> block . host, f -> block . port, reliable, f -> block . tls ); if ( rc == 0 ) { KClientHttpRequest *req; - rc = KClientHttpMakeRequestInt ( http, & req, & f -> block, buf ); + rc = KClientHttpMakeRequestInt ( http, & req, & f -> block, buf_f ); if ( rc == 0 ) { KClientHttpResult *rslt; @@ -1377,7 +1379,7 @@ static rc_t KNSManagerVMakeHttpFileIntUnstableImpl( const KNSManager *self, "Failed to KClientHttpRequestHEAD(" "'$(path)' ($(ip))) from '$(local)'", "path=%.*s,ip=%s,local=%s", - buf -> elem_count - 1, buf -> base, + buf_f -> elem_count - 1, buf_f -> base, ep . ip_address, local_ep . ip_address ) ); } } @@ -1452,15 +1454,15 @@ static rc_t KNSManagerVMakeHttpFileIntUnstableImpl( const KNSManager *self, KClientHttpGetLocalEndpoint ( http, & local_ep ); KClientHttpGetRemoteEndpoint ( http, & ep ); if ( KNSManagerLogNcbiVdbNetError ( self ) ) { - char * base = buf -> base; + char * base = buf_f -> base; bool print = true; - char * query = string_chr ( base, buf -> elem_count, '?' ); + char * query = string_chr ( base, buf_f -> elem_count, '?' ); String vdbcache; CONST_STRING ( & vdbcache, ".vdbcache" ); - if ( buf -> elem_count > vdbcache . size ) { + if ( buf_f -> elem_count > vdbcache . size ) { String ext; StringInit ( & ext, - base + buf -> elem_count - vdbcache . size - 1, + base + buf_f -> elem_count - vdbcache . size - 1, vdbcache . size, vdbcache . len ); if ( ext . addr [ ext . size ] == '\0' && StringEqual ( & vdbcache, & ext ) ) @@ -1468,9 +1470,10 @@ static rc_t KNSManagerVMakeHttpFileIntUnstableImpl( const KNSManager *self, print = false; } else if ( query != NULL ) { - size_t size = query - base; + assert ( FITS_INTO_SIZE_T ( query - base ) ); + size_t size2 = (size_t)(query - base); StringInit ( & ext, - base + size - vdbcache . size, + base + size2 - vdbcache . size, vdbcache . size, vdbcache . len ); if ( ext . addr [ ext . size ] == '?' && StringEqual ( & vdbcache, & ext ) ) @@ -1482,12 +1485,12 @@ static rc_t KNSManagerVMakeHttpFileIntUnstableImpl( const KNSManager *self, if ( ! reliable ) print = false; if ( print ) { - assert ( buf ); + assert ( buf_f ); PLOGERR ( klogErr, ( klogErr, rc, "Failed to KNSManagerVMakeHttpFileInt('$(path)' ($(ip)))" " from '$(local)'", "path=%.*s,ip=%s,local=%s", - ( int ) buf -> elem_count, buf -> base, + ( int ) buf_f -> elem_count, buf_f -> base, ep . ip_address, local_ep . ip_address ) ); } @@ -1495,7 +1498,7 @@ static rc_t KNSManagerVMakeHttpFileIntUnstableImpl( const KNSManager *self, else DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_HTTP ), ( "Failed to KNSManagerVMakeHttpFileInt('%.*s' (%s))\n", - ( int ) buf -> elem_count, buf -> base, + ( int ) buf_f -> elem_count, buf_f -> base, ep . ip_address ) ); } } diff --git a/libs/kns/http-request.c b/libs/kns/http-request.c index a5e13dc49..ba4bdc895 100644 --- a/libs/kns/http-request.c +++ b/libs/kns/http-request.c @@ -45,6 +45,7 @@ #include "http-priv.h" #include "mgr-priv.h" +#include "../klib/int_checks-priv.h" #if _DEBUGGING && 0 #include @@ -901,7 +902,8 @@ rc_t KClientHttpRequestUrlEncodeBase64(const String ** encoding) { size_t iFrom = 0, iTo = 0; const char *from = (*encoding)->addr; char *to = NULL; - uint32_t len = (*encoding)->size + n + n; + assert ( FITS_INTO_INT32 ((*encoding)->size + n + n ) ); + uint32_t len = (uint32_t)((*encoding)->size + n + n); String * encoded = (String *) calloc(1, sizeof * encoded + len + 1); if (encoded == NULL) @@ -1044,11 +1046,12 @@ static EUriForm EUriFormGuess ( const String * hostname, else { String amazonaws; CONST_STRING ( & amazonaws, "amazonaws.com" ); + assert ( FITS_INTO_INT32 ( amazonaws.size ) ); if ( hostname -> size > amazonaws . size && string_cmp ( amazonaws . addr, amazonaws . size, hostname -> addr + hostname -> size - amazonaws . size, amazonaws . size, - amazonaws . size ) == 0 ) + (uint32_t) amazonaws . size ) == 0 ) { return eUFOriginNoPort; } @@ -1237,6 +1240,22 @@ FormatForCloud( const KClientHttpRequest *cself, const char *method ) CloudMgrCurrentProvider ( cloudMgr, & cpId ); { +#ifdef WINDOWS + char * e = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & e, &buf_count, "NCBI_VDB_PROVIDER" ); + if ( ! err && e != NULL ) + { + if (e[0] != '\0') + { + CloudProviderId i = cloud_provider_none; + i = atoi(e); + if (i != cloud_provider_none) + cpId = i; + } + free ( e ); + } +#else const char * e = getenv("NCBI_VDB_PROVIDER"); if (e != NULL && e[0] != '\0') { CloudProviderId i = cloud_provider_none; @@ -1244,6 +1263,7 @@ FormatForCloud( const KClientHttpRequest *cself, const char *method ) if (i != cloud_provider_none) cpId = i; } +#endif } if ( cpId != cloud_provider_none && ( cself->ceRequired || cself->payRequired ) ) @@ -1689,7 +1709,16 @@ LIB_EXPORT rc_t CC KClientHttpRequestHEAD ( KClientHttpRequest *self, KClientHtt static int HEADLESS = -1; if ( HEADLESS < 0 ) { +#ifdef WINDOWS + const char * s = NULL; + char s_buf[16]; + size_t buf_count = 0; + errno_t err = getenv_s ( & buf_count, s_buf, sizeof(s_buf), "NCBI_VDB_GET_AS_HEAD" ); + if ( ! err && buf_count > 0 ) + s = s_buf; +#else char * s = getenv ( "NCBI_VDB_GET_AS_HEAD" ); +#endif if ( s == NULL ) HEADLESS = 0; else if ( s [ 0 ] != '\0' ) @@ -2015,12 +2044,12 @@ static bool GovSiteByHttp ( const char * path ) { return false; } else { - size_t size = 0; + size_t size2 = 0; String gov; CONST_STRING ( & gov, ".gov" ); - size = gov . size; + size2 = gov . size; if ( strcase_cmp - ( path + i - 5, size, gov . addr, size, gov.len ) == 0 ) + ( path + i - 5, size2, gov . addr, size2, gov.len ) == 0 ) { return true; } diff --git a/libs/kns/http-retrier.c b/libs/kns/http-retrier.c index b05bb8d0a..2161689d3 100644 --- a/libs/kns/http-retrier.c +++ b/libs/kns/http-retrier.c @@ -43,6 +43,7 @@ typedef struct KHttpFile KHttpFile; #include #include "mgr-priv.h" +#include "../klib/int_checks-priv.h" struct HttpRetrySchedule { @@ -116,7 +117,8 @@ rc_t HttpRetryCodesConfig( HttpRetrySchedule** self, uint16_t code, const String return RC ( rcNS, rcData, rcCreating, rcMemory, rcExhausted ); } (*self) -> code = code; - (*self) -> max_retries = retryCount; + assert ( FITS_INTO_INT8 ( retryCount ) ); + (*self) -> max_retries = (uint8_t)retryCount; (*self) -> open_ended = false; { /* populate sleep_before_retry and open_ended */ @@ -145,11 +147,13 @@ rc_t HttpRetryCodesConfig( HttpRetrySchedule** self, uint16_t code, const String { if ( ! in_number ) { /* first digit of a new number */ - cur_value = ch - '0'; + assert ( FITS_INTO_INT16 ( ch - '0' ) ); + cur_value = (uint16_t)(ch - '0'); } else { - cur_value = cur_value * 10 + ch - '0'; + assert ( FITS_INTO_INT16 ( cur_value * 10 + ch - '0' ) ); + cur_value = (uint16_t)(cur_value * 10 + ch - '0'); } in_number = true; } @@ -206,7 +210,7 @@ rc_t HttpRetrySpecsFromConfig ( HttpRetrySpecs* self, const KConfigNode* node ) bool has4xx = false; bool has5xx = false; KNamelist * names; - uint32_t nameCount; + uint32_t nameCount = 0; rc_t rc = KConfigNodeListChildren ( node, & names ); if ( rc == 0 ) { /* count 4xx and 5xx */ @@ -260,7 +264,8 @@ rc_t HttpRetrySpecsFromConfig ( HttpRetrySpecs* self, const KConfigNode* node ) rc_t rc2; uint32_t i; uint32_t cur = 0; - self -> count = total; + assert ( FITS_INTO_INT8 ( total ) ); + self -> count = (uint8_t)total; self -> codes = (HttpRetrySchedule**) calloc ( self -> count, sizeof * self -> codes ); for ( i = 0; i < nameCount; ++ i ) { @@ -461,7 +466,8 @@ bool KHttpRetrierWait ( KHttpRetrier * self, uint32_t status ) uint8_t max_retries; const uint16_t * sleep_before_retry; bool open_ended; - if ( ! HttpGetRetryCodes ( & self -> kns -> retry_specs, status, & max_retries, & sleep_before_retry, & open_ended ) ) + assert ( FITS_INTO_INT16 ( status ) ); + if ( ! HttpGetRetryCodes ( & self -> kns -> retry_specs, (uint16_t)status, & max_retries, & sleep_before_retry, & open_ended ) ) { return false; } diff --git a/libs/kns/manager.c b/libs/kns/manager.c index 80d881fc9..d25983466 100644 --- a/libs/kns/manager.c +++ b/libs/kns/manager.c @@ -55,6 +55,8 @@ #include +#include "../klib/int_checks-priv.h" + #if HAVE_GNU_LIBC_VERSION_H #include #endif @@ -528,9 +530,21 @@ bool OwnCertfromEnv(const char ** own_cert, const char ** pk_key) { char ** key = (char**)pk_key; assert(cert && key); +#ifdef WINDOWS + char* e = NULL; + { + size_t buf_count = 0; + errno_t err = _dupenv_s ( & e, & buf_count, "VCBI_VDB_OWN_CERT" ); + if ( err || e == NULL ) + return false; + } +#else char * e = getenv("VCBI_VDB_OWN_CERT"); if (e == NULL) return false; +#endif /* WINDOWS */ + + /* CAUTION: free( e ) must be called before exiting the function on WINDOWS */ KDirectory * dir = NULL; rc_t rc = KDirectoryNativeDir(&dir); @@ -546,7 +560,13 @@ bool OwnCertfromEnv(const char ** own_cert, const char ** pk_key) { if (rc == 0) *cert = calloc(1, size + 1); if (rc == 0 && *cert == NULL) + { +#ifdef WINDOWS + free ( e ); + e = NULL; +#endif return false; + } if (rc == 0) rc = KFileRead(file, 0, *cert, size + 1, &num_read); if (rc == 0) @@ -560,7 +580,13 @@ bool OwnCertfromEnv(const char ** own_cert, const char ** pk_key) { if (rc == 0) *key = calloc(1, size + 1); if (rc == 0 && *key == NULL) + { +#ifdef WINDOWS + free ( e ); + e = NULL; +#endif return false; + } if (rc == 0) rc = KFileRead(file, 0, *key, size + 1, &num_read); if (rc == 0) @@ -568,6 +594,9 @@ bool OwnCertfromEnv(const char ** own_cert, const char ** pk_key) { } KDirectoryRelease(dir); +#ifdef WINDOWS + free ( e ); +#endif return rc == 0; } @@ -734,7 +763,8 @@ static int32_t KNSManagerLoadConnTimeout ( KConfig *kfg ) if ( rc != 0 ) result = MAX_CONN_LIMIT; - return result; + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; } static int32_t KNSManagerLoadConnReadTimeout ( KConfig *kfg ) { @@ -744,7 +774,8 @@ static int32_t KNSManagerLoadConnReadTimeout ( KConfig *kfg ) if ( rc != 0 ) result = MAX_CONN_READ_LIMIT; - return result; + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; } static int32_t KNSManagerLoadConnWriteTimeout ( KConfig *kfg ) { @@ -755,7 +786,8 @@ static int32_t KNSManagerLoadConnWriteTimeout ( KConfig *kfg ) if ( rc != 0 ) result = MAX_CONN_WRITE_LIMIT; - return result; + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; } static int32_t KNSManagerLoadHttpReadTimeout ( KConfig *kfg ) @@ -766,7 +798,8 @@ static int32_t KNSManagerLoadHttpReadTimeout ( KConfig *kfg ) if ( rc != 0 ) result = MAX_HTTP_READ_LIMIT; - return result; + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; } static int32_t KNSManagerLoadHttpWriteTimeout ( KConfig *kfg ) { @@ -776,7 +809,8 @@ static int32_t KNSManagerLoadHttpWriteTimeout ( KConfig *kfg ) if ( rc != 0 ) result = MAX_HTTP_WRITE_LIMIT; - return result; + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; } static @@ -786,13 +820,35 @@ int32_t KNSManagerLoadTotalWaitForReliableURLs(const KConfig *kfg) int64_t result = 0; +#ifdef WINDOWS + { + char * str = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & str, & buf_count, "NCBI_VDB_RELIABLE_WAIT" ); + if (!err && str != NULL) { + char *end = NULL; + result = strtou64(str, &end, 0); + char chend = end[0]; + free(str); + if (chend == 0) + { + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; + } + } + } +#else const char * str = getenv("NCBI_VDB_RELIABLE_WAIT"); if (str != NULL) { char *end = NULL; result = strtou64(str, &end, 0); if (end[0] == 0) - return result; + { + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; + } } +#endif /* WINDOWS */ rc = KConfigReadI64(kfg, "/http/reliable/wait", &result); if (rc != 0 @@ -801,7 +857,8 @@ int32_t KNSManagerLoadTotalWaitForReliableURLs(const KConfig *kfg) result = MAX_HTTP_TOTAL_READ_LIMIT; } - return result; + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; } static int32_t KNSManagerLoadTotalConnectWaitForReliableURLs( @@ -811,19 +868,42 @@ static int32_t KNSManagerLoadTotalConnectWaitForReliableURLs( int64_t result = 0; +#ifdef WINDOWS + { + char * str = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & str, & buf_count, "NCBI_VDB_RELIABLE_CONNECT_WAIT" ); + if (!err && str != NULL) { + char *end = NULL; + result = strtou64(str, &end, 0); + char chend = end[0]; + free(str); + if (chend == 0) + { + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; + } + } + } +#else const char * str = getenv("NCBI_VDB_RELIABLE_CONNECT_WAIT"); if (str != NULL) { char *end = NULL; result = strtou64(str, &end, 0); if (end[0] == 0) - return result; + { + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; + } } +#endif rc = KConfigReadI64(kfg, "/http/reliable/connect/wait", &result); if (rc != 0) result = MAX_HTTP_TOTAL_CONNECT_LIMIT; - return result; + assert ( FITS_INTO_INT32 ( result ) ); + return (int32_t)result; } static bool KNSManagerLoadRetryFirstRead(const KConfig *kfg) { @@ -831,6 +911,28 @@ static bool KNSManagerLoadRetryFirstRead(const KConfig *kfg) { bool result = 0; +#ifdef WINDOWS + { + char * str = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & str, & buf_count, "NCBI_VDB_RELIABLE_RETRY_FIRST_READ" ); + if (!err && str != NULL) + { + char ch = str[0]; + free(str); + if (ch != '\0') { + switch (ch) { + case 'f': + return false; + case 't': + return true; + default: + break; + } + } + } + } +#else const char * str = getenv("NCBI_VDB_RELIABLE_RETRY_FIRST_READ"); if (str != NULL && str[0] != '\0') { switch (str[0]) { @@ -842,6 +944,7 @@ static bool KNSManagerLoadRetryFirstRead(const KConfig *kfg) { break; } } +#endif rc = KConfigReadBool(kfg, "/http/reliable/retryFirstRead", &result); if (rc != 0) @@ -855,6 +958,28 @@ static bool KNSManagerLoadRetryFile(const KConfig *kfg) { bool result = 0; +#ifdef WINDOWS + { + char * str = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & str, & buf_count, "NCBI_VDB_RELIABLE_RETRY_FILE" ); + if (!err && str != NULL) + { + char ch = str[0]; + free(str); + if (ch != '\0') { + switch (ch) { + case 'f': + return false; + case 't': + return true; + default: + break; + } + } + } + } +#else const char * str = getenv("NCBI_VDB_RELIABLE_RETRY_FILE"); if (str != NULL && str[0] != '\0') { switch (str[0]) { @@ -866,6 +991,7 @@ static bool KNSManagerLoadRetryFile(const KConfig *kfg) { break; } } +#endif rc = KConfigReadBool(kfg, "/http/reliable/retryFile", &result); if (rc != 0) @@ -882,11 +1008,39 @@ static uint8_t KNSManagerLoadMaxNumberOfRetriesOnFailureForReliableURLs if (rc != 0 || result < 0) result = 10; - return result; + assert ( FITS_INTO_INT8 ( result ) ); + return (uint8_t)result; } #if 1 static uint64_t KNSManagerLoadLogTlsErrors(KConfig* kfg) { +#ifdef WINDOWS + char * e = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & e, & buf_count, "NCBI_VDB_TLS_LOG_ERR" ); + uint64_t ret = 0; + if (!err && e != NULL) + { + if (e[0] == '\0') + ret = 0; + else { + if (e[0] == '0' || + e[0] == 'f') /* false */ + { + ret = 0; + } + else + { + int n = atoi(e); + assert( n >= 0 ); + ret = (uint64_t)n; + } + } + free(e); + return ret; + } + +#else const char * e = getenv("NCBI_VDB_TLS_LOG_ERR"); if (e != NULL) if (e[0] == '\0') @@ -900,6 +1054,7 @@ static uint64_t KNSManagerLoadLogTlsErrors(KConfig* kfg) { else return atoi(e); } +#endif else { uint64_t log = 0; rc_t rc = KConfigReadU64(kfg, "/tls/NCBI_VDB_TLS_LOG_ERR", &log); @@ -1111,6 +1266,25 @@ LIB_EXPORT rc_t CC KNSManagerGetUserAgent ( const char **user_agent ) } char cloudtrunc[64]; + +#ifdef WINDOWS + { + char *cloudid = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & cloudid, & buf_count, ENV_MAGIC_CE_TOKEN ); + if ( !err && cloudid && strlen ( cloudid ) > 8 ) { + /* AWS access keys should always begin with AKIA, + * suffixes seems non-random */ + assert ( strlen ( cloudid ) - 4 < sizeof cloudtrunc ); + strncpy_s ( cloudtrunc, sizeof cloudtrunc, cloudid + 4, strlen ( cloudid ) - 4 ); + cloudtrunc[3] = '\0'; + } else { + strncpy_s ( cloudtrunc, sizeof cloudtrunc, "noc", 3 ); + } + if ( !err && cloudid ) + free ( cloudid ); + } +#else const char *cloudid = getenv ( ENV_MAGIC_CE_TOKEN ); if ( cloudid && strlen ( cloudid ) > 8 ) { /* AWS access keys should always begin with AKIA, @@ -1121,17 +1295,62 @@ LIB_EXPORT rc_t CC KNSManagerGetUserAgent ( const char **user_agent ) } else { strcpy ( cloudtrunc, "noc" ); } +#endif +#ifdef WINDOWS + char sessid_buf[64]; + const char * sessid = NULL; + { + char *str = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & str, & buf_count, ENV_VAR_SESSION_ID); + if ( err || str == NULL ) + { + sessid = "nos"; + } + else + { + size_t len = strlen(str); + assert ( len < sizeof sessid_buf ); + strncpy_s ( sessid_buf, sizeof sessid_buf, str, len ); + sessid = sessid_buf; + free ( str ); + } + } +#else const char *sessid = getenv ( ENV_VAR_SESSION_ID ); if ( sessid == NULL ) { sessid = "nos"; } +#endif const char *libc_version = ""; #if HAVE_GNU_GET_LIBC_VERSION_F libc_version = gnu_get_libc_version (); #endif +#ifdef WINDOWS + char opt_bitmap_buf[64]; + const char * opt_bitmap = NULL; + { + char *str = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & str, & buf_count, ENV_MAGIC_OPT_BITMAP); + if ( err || str == NULL ) + { + opt_bitmap = "nob"; + } + else + { + size_t len = strlen(str); + assert ( len < sizeof opt_bitmap_buf ); + strncpy_s (opt_bitmap_buf, sizeof opt_bitmap_buf, str, len ); + opt_bitmap = opt_bitmap_buf; + free ( str ); + } + } +#else const char *opt_bitmap=getenv(ENV_MAGIC_OPT_BITMAP); // VDB_OPT_BITMAP if (!opt_bitmap) opt_bitmap="nob"; +#endif const char *guid = "nog"; @@ -1182,10 +1401,10 @@ LIB_EXPORT rc_t CC KNSManagerGetUserAgent ( const char **user_agent ) if ( rc ) { return rc; } if ( kns_manager_lock ) { - rc_t rc = KLockAcquire ( kns_manager_lock ); - if ( rc ) { + rc_t rc2 = KLockAcquire ( kns_manager_lock ); + if ( rc2 ) { KDataBufferWhack ( &phid ); - return rc; + return rc2; } } @@ -1214,14 +1433,47 @@ LIB_EXPORT rc_t CC KNSManagerGetUserAgent ( const char **user_agent ) } KDataBuffer platform; + const char* env_platform_name = NULL; + const char* env_platform_version = NULL; +#ifdef WINDOWS + char env_platform_name_buf[64], env_platform_version_buf[64]; + { + char * str = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & str, & buf_count, ENV_MAGIC_PLATFORM_NAME ); + if ( !err && str != NULL ) + { + assert ( strlen(str) < sizeof(env_platform_name_buf) ); + strncpy_s ( env_platform_name_buf, sizeof env_platform_name_buf, str, strlen(str) ); + env_platform_name = env_platform_name_buf; + free ( str ); + } + } + { + char * str = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & str, & buf_count, ENV_MAGIC_PLATFORM_VERSION ); + if ( !err && str != NULL ) + { + assert ( strlen(str) < sizeof(env_platform_version_buf) ); + strncpy_s ( env_platform_version_buf, sizeof env_platform_version_buf, str, strlen(str) ); + env_platform_version = env_platform_version_buf; + free ( str ); + } + } +#else + env_platform_name = getenv(ENV_MAGIC_PLATFORM_NAME); + env_platform_version = getenv(ENV_MAGIC_PLATFORM_VERSION); +#endif + KDataBufferMakeBytes(&platform, 0); - if (getenv(ENV_MAGIC_PLATFORM_NAME)) + if (env_platform_name) { - if (getenv(ENV_MAGIC_PLATFORM_VERSION)) + if (env_platform_version) { rc=KDataBufferPrintf(&platform," via %s %s", - getenv(ENV_MAGIC_PLATFORM_NAME), - getenv(ENV_MAGIC_PLATFORM_VERSION)); + env_platform_name, + env_platform_version); if (rc) { KDataBufferWhack ( &phid ); @@ -1231,7 +1483,7 @@ LIB_EXPORT rc_t CC KNSManagerGetUserAgent ( const char **user_agent ) } } else{ - rc=KDataBufferPrintf(&platform," via %s", getenv(ENV_MAGIC_PLATFORM_NAME)); + rc=KDataBufferPrintf(&platform," via %s", env_platform_name); if (rc) { KDataBufferWhack ( &phid ); @@ -1301,6 +1553,24 @@ uint64_t KNSManagerLogNcbiVdbNetError ( const KNSManager *self ) return 0; if ( self->NCBI_VDB_NETnoLogError ) { return 0; } + +#ifdef WINDOWS + { + char * e = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & e, & buf_count, "NCBI_VDB_NET" ); + if ( !err && e != NULL ) + { + char ch = e[0]; + free ( e ); + if (ch == '\0' || ch == '0' || ch == 'f') /* false */ + { + return 0; + } + return 1; + } + } +#else const char *e = getenv ( "NCBI_VDB_NET" ); if ( e != NULL ) { if ( e[0] == '\0' || e[0] == '0' || e[0] == 'f' ) /* false */ @@ -1310,6 +1580,7 @@ uint64_t KNSManagerLogNcbiVdbNetError ( const KNSManager *self ) return 1; } +#endif if ( self->NCBI_VDB_NETkfgValueSet ) { return self->NCBI_VDB_NETkfgValue; } return self->logTlsErrors; diff --git a/libs/kns/proxy.c b/libs/kns/proxy.c index fb7d666ce..86ae6c563 100644 --- a/libs/kns/proxy.c +++ b/libs/kns/proxy.c @@ -45,6 +45,7 @@ #include #include /* time */ +#include "../klib/int_checks-priv.h" #define RELEASE( type, obj ) do { rc_t rc2 = type##Release ( obj ); \ if (rc2 != 0 && rc == 0) { rc = rc2; } obj = NULL; } while ( false ) @@ -326,7 +327,10 @@ static rc_t KNSProxiesAddHttpProxyPath ( KNSProxies * self, HttpProxy * new_proxy = NULL; BSTItem * node = NULL; - HttpProxy add = { proxy_host, proxy_port, 0 }; + HttpProxy add; + add.proxy_host = proxy_host; + add.proxy_port = proxy_port; + add.next = 0; assert ( self ); @@ -396,7 +400,17 @@ static rc_t CC KNSProxiesAddHTTPProxyPath ( KNSProxies * self, static bool KNSProxiesHttpProxyInitFromEnvVar ( KNSProxies * self, const char * name ) { + bool ret = 0; +#ifdef WINDOWS + errno_t err = 0; + char* path = NULL; + { + size_t buf_count = 0; + err = _dupenv_s ( & path, & buf_count, name ); + } +#else const char * path = getenv ( name ); +#endif if ( path != NULL ) { assert ( self ); @@ -405,13 +419,21 @@ static bool KNSProxiesHttpProxyInitFromEnvVar ( KNSProxies * self, ( "Loading proxy env.var. %s='%s'\n", name, path ) ); if ( KNSProxiesAddHTTPProxyPath ( self, path ) != 0 ) - return false; - assert ( self -> http_proxy_enabled ); - - return true; + ret = false; + else + { + assert ( self -> http_proxy_enabled ); + ret = true; + } +#ifdef WINDOWS + assert ( ! err ); + free ( path ); +#endif } + else + ret = false; - return false; + return ret; } static bool KNSProxiesHttpProxyInitFromEnv ( KNSProxies * self ) { @@ -509,8 +531,10 @@ rc_t KNSProxiesVSetHTTPProxyPath ( KNSProxies * self, const char * port_spec = NULL; long port_num = 0; - int have = colon - p; - int remains = s - have; + int have = (int)(colon - p); + int remains = (int)(s - have); + assert ( FITS_INTO_INT ( colon - p ) ); + assert ( FITS_INTO_INT ( s - have ) ); if ( remains > 2 ) { assert ( colon [ 0 ] == ':' ); if ( colon [ 1 ] == '/' && colon [ 2 ] == '/' ) { @@ -629,8 +653,8 @@ KNSProxies * KNSManagerKNSProxiesMake ( struct KNSManager * mgr, { bool proxy_only = false; - rc_t rc = KConfigReadBool ( kfg, "/http/proxy/only", & proxy_only ); - if ( rc == 0 && proxy_only ) + rc_t rc2 = KConfigReadBool ( kfg, "/http/proxy/only", & proxy_only ); + if ( rc2 == 0 && proxy_only ) self-> http_proxy_only = true; } @@ -688,8 +712,9 @@ KNSProxies * KNSManagerKNSProxiesMake ( struct KNSManager * mgr, } self -> tmpS = 0; - n = self -> http_proxies_cnt; - srand ( time ( NULL ) ); + n = (int)(self -> http_proxies_cnt); + assert ( FITS_INTO_INT (self->http_proxies_cnt) ); + srand ( (unsigned int)time ( NULL ) ); while ( n > 0 ) { self -> rand = rand () % n; self -> tmpI = 0; diff --git a/libs/kns/stable-http-file.c b/libs/kns/stable-http-file.c index d511a7485..b3bd0429d 100644 --- a/libs/kns/stable-http-file.c +++ b/libs/kns/stable-http-file.c @@ -57,9 +57,22 @@ void RetrierReset(const KStableHttpFile * cself, const char * func) static int logLevel = -1; if (logLevel == -1) { logLevel = 0; +#ifdef WINDOWS + { + char * e = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & e, & buf_count, ENV_VAR_LOG_HTTP_RETRY ); + if ( !err && e != NULL ) + { + logLevel = atoi(e); + free ( e ); + } + } +#else const char * e = getenv(ENV_VAR_LOG_HTTP_RETRY); if (e != NULL) logLevel = atoi(e); +#endif } self->live = true; @@ -91,9 +104,22 @@ rc_t RetrierReopenRemote(KStableHttpFile * self, bool neverBefore) int logLevel = -1; if (logLevel == -1) { logLevel = 0; +#ifdef WINDOWS + { + char * e = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & e, & buf_count, ENV_VAR_LOG_HTTP_RETRY ); + if ( !err && e != NULL ) + { + logLevel = atoi(e); + free ( e ); + } + } +#else const char * e = getenv(ENV_VAR_LOG_HTTP_RETRY); if (e != NULL) logLevel = atoi(e); +#endif } KFileRelease(self->file); @@ -257,9 +283,22 @@ rc_t RetrierAgain(const KStableHttpFile * cself, static int logLevel = -1; if (logLevel == -1) { logLevel = 0; +#ifdef WINDOWS + { + char * e = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & e, & buf_count, ENV_VAR_LOG_HTTP_RETRY ); + if ( !err && e != NULL ) + { + logLevel = atoi(e); + free ( e ); + } + } +#else const char * e = getenv(ENV_VAR_LOG_HTTP_RETRY); if (e != NULL) logLevel = atoi(e); +#endif } if (logLevel > 1 || lvl > 0) { switch (self->_state) { @@ -609,6 +648,22 @@ rc_t KNSManagerVMakeHttpFileInt(const KNSManager *self, if (rc == 0) { static int sReliable = eUninitialized; if (sReliable == eUninitialized) { +#ifdef WINDOWS + { + char * e = NULL; + size_t buf_count = 0; + errno_t err = _dupenv_s ( & e, & buf_count, "NCBI_VDB_RELIABLE" ); + if (err || e == NULL) + sReliable = eNotSet; + else if (e != NULL && e[0] == '\0') + sReliable = eUnreliable; + else + sReliable = eReliable; + + if (!err && e != NULL) + free(e); + } +#else const char * e = getenv("NCBI_VDB_RELIABLE"); if (e == NULL) sReliable = eNotSet; @@ -616,6 +671,7 @@ rc_t KNSManagerVMakeHttpFileInt(const KNSManager *self, sReliable = eUnreliable; else sReliable = eReliable; +#endif } if (sReliable == eUnreliable) reliable = false; diff --git a/libs/kns/stream-from-buffer.c b/libs/kns/stream-from-buffer.c index 63582742d..ff761716b 100644 --- a/libs/kns/stream-from-buffer.c +++ b/libs/kns/stream-from-buffer.c @@ -37,6 +37,8 @@ typedef struct KBufferStream KBufferStream; #define rcStream rcFile #endif +#include "../klib/int_checks-priv.h" + struct KBufferStream { KStream dad; String buffer; @@ -80,9 +82,11 @@ rc_t CC KBufferStreamRead ( const KBufferStream * self, void * buffer, * num_read = string_copy ( buffer, bsize, src -> addr, src -> size ); + assert ( FITS_INTO_INT32 ( * num_read ) ); + src -> addr += * num_read; src -> size -= * num_read; - src -> len -= * num_read; + src -> len -= (uint32_t) (* num_read); return 0; } @@ -144,7 +148,8 @@ LIB_EXPORT rc_t CC KStreamMakeFromBuffer ( KStream ** self, const char * buffer, rc = KStreamInit ( & obj -> dad, ( const KStream_vt* ) & vtKBufferStream, "KBufferStream", "KBufferStream", true, false ); if ( rc == 0 ) { - StringInit ( & obj -> buffer, buffer, size, size ); + assert ( FITS_INTO_INT32 ( size ) ); + StringInit ( & obj -> buffer, buffer, size, (uint32_t)size ); * self = & obj -> dad; } else { diff --git a/libs/kns/stream.c b/libs/kns/stream.c index 20a5ce102..fa8ea31a1 100644 --- a/libs/kns/stream.c +++ b/libs/kns/stream.c @@ -372,7 +372,7 @@ LIB_EXPORT rc_t CC KStreamTimedReadAll ( const KStream *self, LIB_EXPORT rc_t CC KStreamReadExactly ( const KStream *self, void *buffer, size_t bytes ) { - rc_t rc; + rc_t rc = 0; uint8_t *b; size_t total, count; @@ -487,7 +487,7 @@ LIB_EXPORT rc_t CC KStreamTimedReadExactly ( const KStream *self, return RC ( rcNS, rcStream, rcReading, rcInterface, rcBadVersion ); } - return rc; + return rc = 0; } /* Write diff --git a/libs/kns/tls.c b/libs/kns/tls.c index 0fd744e38..6f3b9827f 100644 --- a/libs/kns/tls.c +++ b/libs/kns/tls.c @@ -68,6 +68,8 @@ struct KTLSStream; #include #include +#include "../klib/int_checks-priv.h" + #if WINDOWS #define IGNORE_ALL_CERTS_ALLOWED 1 #endif @@ -607,12 +609,27 @@ static int set_threshold ( const KConfig * kfg ) { int64_t threshold = 0; const char * env = NULL; +#ifdef WINDOWS + char env_buf[64]; +#endif rc_t rc = KConfigReadI64 ( kfg, "/tls/NCBI_VDB_TLS", & threshold ); if ( rc == 0 ) set = true; +#ifdef WINDOWS + { + size_t buf_count = 0; + errno_t err = getenv_s ( & buf_count, env_buf, sizeof(env_buf), "NCBI_VDB_TLS" ); + if ( !err && buf_count > 0 ) + { + assert ( buf_count < sizeof(env_buf) ); + env = env_buf; + } + } +#else env = getenv ( "NCBI_VDB_TLS" ); +#endif if ( env != NULL ) { int NCBI_VDB_TLS = 0; @@ -803,10 +820,21 @@ rc_t CC KTLSStreamRead ( const KTLSStream * cself, KTLSStream * self = ( KTLSStream * ) cself; if (SILENCE_READING_MSG < 0) { +#ifdef WINDOWS + { + size_t buf_count = 0; + errno_t err = getenv_s ( & buf_count, NULL, 0, "NCBI_VDB_SILENCE_MBEDTLS_READ" ); + if ( !err && buf_count > 0 ) + SILENCE_READING_MSG = 1; + else + SILENCE_READING_MSG = 0; + } +#else if (getenv("NCBI_VDB_SILENCE_MBEDTLS_READ") != NULL) SILENCE_READING_MSG = 1; else SILENCE_READING_MSG = 0; +#endif } assert(self); @@ -832,7 +860,19 @@ rc_t CC KTLSStreamRead ( const KTLSStream * cself, ret = mbedtls_ssl_read( &self -> ssl, buffer, bsize ); if (!inited) { /* simulate mbedtls read timeout */ +#ifdef WINDOWS + const char * v = NULL; + char v_buf[64]; + size_t buf_count = 0; + errno_t err = getenv_s ( & buf_count, v_buf, sizeof(v_buf), "NCBI_VDB_ERR_MBEDTLS_READ" ); + if ( ! err && buf_count > 0 ) + { + assert ( buf_count < sizeof (v_buf) ); + v = v_buf; + } +#else const char * v = getenv("NCBI_VDB_ERR_MBEDTLS_READ"); +#endif if (v != NULL) { m = atoi(v); if (m < 0) @@ -1163,7 +1203,8 @@ rc_t KTLSGlobalsSetupOwnCert(KTLSGlobals * tlsg, else { size_t len = tlsg->clicert.subject.val.len; String subject; - StringInit(&subject, (char*)tlsg->clicert.subject.val.p, len, len); + assert ( FITS_INTO_INT32 ( len ) ); + StringInit(&subject, (char*)tlsg->clicert.subject.val.p, len, (uint32_t)len); STATUS(STAT_QA, "Setting '%S' client certificate", &subject); tlsg->clicert_was_set = true; } @@ -1264,7 +1305,19 @@ rc_t ktls_handshake ( KTLSStream *self ) ret = mbedtls_ssl_handshake( &self -> ssl ); if (!inited) { /* simulate mbedtls handshake timeout */ +#ifdef WINDOWS + const char * v = NULL; + char v_buf[64]; + size_t buf_count = 0; + errno_t err = getenv_s ( & buf_count, v_buf, sizeof(v_buf), "NCBI_VDB_ERR_MBEDTLS_HANDSHAKE" ); + if ( ! err && buf_count > 0 ) + { + assert ( buf_count < sizeof(v_buf) ); + v = v_buf; + } +#else const char * v = getenv("NCBI_VDB_ERR_MBEDTLS_HANDSHAKE"); +#endif if (v != NULL) { m = atoi(v); if (m < 0) @@ -1519,17 +1572,17 @@ LIB_EXPORT rc_t CC KTLSStreamVerifyCACert ( const KTLSStream * self ) if ( flags != 0 ) { char buf [ 4096 ]; - rc_t rc = RC ( rcKrypto, rcToken, rcValidating, rcEncryption, rcFailed ); + rc_t rc2 = RC ( rcKrypto, rcToken, rcValidating, rcEncryption, rcFailed ); mbedtls_x509_crt_verify_info ( buf, sizeof( buf ), " ! ", flags ); - PLOGERR ( klogSys, ( klogSys, rc + PLOGERR ( klogSys, ( klogSys, rc2 , "mbedtls_ssl_get_verify_result returned $(flags) ( $(info) )" , "flags=0x%X,info=%s" , flags , buf ) ); - return rc; + return rc2; } } diff --git a/libs/kns/win/syssock.c b/libs/kns/win/syssock.c index 935a88805..1d798c61e 100644 --- a/libs/kns/win/syssock.c +++ b/libs/kns/win/syssock.c @@ -237,7 +237,7 @@ static rc_t CC KIpv4SocketWhack ( KSocket * self ) data = &( self -> type_data.ipv4_data ); - if ( shutdown ( data -> fd, SHUT_WR ) == -1 ) + if ( shutdown ( data -> fd, SHUT_WR ) == SOCKET_ERROR ) rc = KSocketHandleShutdownCallWin (); else { @@ -256,7 +256,7 @@ static rc_t CC KIpv4SocketWhack ( KSocket * self ) } } - if ( shutdown ( data -> fd, SHUT_RD ) == -1 ) + if ( shutdown ( data -> fd, SHUT_RD ) == SOCKET_ERROR) rc = KSocketHandleShutdownCallWin (); else if ( closesocket ( data -> fd ) == SOCKET_ERROR ) rc = RC ( rcNS, rcSocket, rcClosing, rcError, rcUnknown ); /* maybe report */ @@ -264,7 +264,7 @@ static rc_t CC KIpv4SocketWhack ( KSocket * self ) #if 0 RC_CTX ( rcSocket, rcClosing ); - if ( shutdown ( data -> fd, SHUT_WR ) != -1 ) + if ( shutdown ( data -> fd, SHUT_WR ) != SOCKET_ERROR) { while ( 1 ) { @@ -274,7 +274,7 @@ static rc_t CC KIpv4SocketWhack ( KSocket * self ) break; } - if ( shutdown ( data -> fd, SHUT_RD ) != -1 ) + if ( shutdown ( data -> fd, SHUT_RD ) != SOCKET_ERROR) { if ( closesocket ( data -> fd ) == SOCKET_ERROR ) rc = RC ( rcNS, rcSocket, rcClosing, rcError, rcUnknown ); @@ -319,7 +319,7 @@ static rc_t CC KIpv4SocketTimedRead ( const KSocket * self, void * buffer, size_ selectRes = select( 0, &readFds, NULL, NULL, ( tm == NULL ) ? NULL : &ts ); /* check for error */ - if ( selectRes == -1 ) + if ( selectRes == SOCKET_ERROR ) rc = KSocketHandleSelectCallWin ( rcReading ); else if ( selectRes == 0 ) rc = RC ( rcNS, rcSocket, rcReading, rcTimeout, rcExhausted ); /* timeout */ @@ -435,7 +435,7 @@ static rc_t CC KIpv4SocketTimedWrite ( KSocket * self, const void * buffer, size selectRes = select( 0, NULL, &writeFds, NULL, ( tm == NULL ) ? NULL : &ts ); /* check for error */ - if ( selectRes == -1 ) + if ( selectRes == SOCKET_ERROR ) rc = KSocketHandleSelectCallWin ( rcWriting ); else if ( selectRes == 0 ) rc = RC ( rcNS, rcSocket, rcWriting, rcTimeout, rcExhausted ); /* timeout */ @@ -805,7 +805,7 @@ connect_wait(int sock, int32_t timeoutMs) FD_SET(sock, &writeFds); selectRes = select(0, NULL, &writeFds, NULL, &ts); - if (selectRes == -1) + if (selectRes == SOCKET_ERROR) rc = KSocketHandleSelectCallWin(rcCreating); else if (selectRes == 0) rc = RC(rcNS, rcSocket, rcCreating, rcTimeout, rcExhausted); /* timeout */ @@ -860,7 +860,6 @@ rc_t KSocketConnectIPv4 ( KSocket * self, const KEndPoint * from, const KEndPoin if (rc == 0) { - int res; SOCKET sock = self->type_data.ipv4_data.fd; ss.sin_port = htons(to->u.ipv4.port); ss.sin_addr.s_addr = htonl(to->u.ipv4.addr); @@ -914,7 +913,7 @@ static rc_t KNSManagerMakeIPv4Listener ( const KNSManager *self, KSocket **out, { KSocketIPv4 * data = &( listener -> type_data . ipv4_data ); data -> fd = socket ( AF_INET, SOCK_STREAM, 0 ); - if ( data -> fd < 0 ) + if ( data -> fd == INVALID_SOCKET ) rc = KSocketHandleSocketCallWin (); else { @@ -939,7 +938,7 @@ static rc_t KNSManagerMakeIPv4Listener ( const KNSManager *self, KSocket **out, } closesocket ( data -> fd ); - data -> fd = -1; + data -> fd = INVALID_SOCKET; } } @@ -974,14 +973,14 @@ static rc_t KListenerIPv4Accept ( KSocket * self, struct KSocket ** out ) len = sizeof new_data -> remote_addr; new_data -> fd = accept ( self_data -> fd, ( struct sockaddr * ) & new_data -> remote_addr, & len ); - if ( new_data -> fd < 0 ) + if ( new_data -> fd == INVALID_SOCKET ) rc = KSocketHandleAcceptCallWin (); else if ( len <= sizeof new_data -> remote_addr ) new_data -> remote_addr_valid = true; else { closesocket ( new_data -> fd ); - new_data -> fd = -1; + new_data -> fd = INVALID_SOCKET; rc = RC ( rcNS, rcConnection, rcWaiting, rcBuffer, rcInsufficient ); } @@ -1073,7 +1072,7 @@ static rc_t KNSManagerMakeIPv6Listener ( const KNSManager *self, KSocket **out, KSocketIPv6 * data = &( listener -> type_data.ipv6_data ); data -> fd = socket ( AF_INET6, SOCK_STREAM, 0 ); - if ( data -> fd < 0 ) + if ( data -> fd == INVALID_SOCKET ) rc = KSocketHandleSocketCallWin (); else { @@ -1100,7 +1099,7 @@ static rc_t KNSManagerMakeIPv6Listener ( const KNSManager *self, KSocket **out, } closesocket ( data -> fd ); - data -> fd = -1; + data -> fd = INVALID_SOCKET; } } } @@ -1134,14 +1133,14 @@ static rc_t KListenerIPv6Accept ( KSocket * self, struct KSocket ** out ) len = sizeof new_data -> remote_addr; new_data -> fd = accept ( self_data -> fd, ( struct sockaddr * ) & new_data -> remote_addr, & len ); - if ( new_data -> fd < 0 ) + if ( new_data -> fd == INVALID_SOCKET ) rc = KSocketHandleAcceptCallWin (); else if ( len <= sizeof new_data -> remote_addr ) new_data -> remote_addr_valid = true; else { closesocket ( new_data -> fd ); - new_data -> fd = -1; + new_data -> fd = INVALID_SOCKET; rc = RC ( rcNS, rcConnection, rcWaiting, rcBuffer, rcInsufficient ); } @@ -1465,7 +1464,6 @@ static rc_t CC KIPCSocketTimedRead ( const KSocket * self, void * buffer, size_t case WAIT_OBJECT_0 : { - DWORD count; DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_SOCKET ), ( "%p: successful\n", self ) ); /* wait to complete if necessary */ if ( GetOverlappedResult( data->pipe, &overlap, &count, TRUE ) ) @@ -1985,7 +1983,7 @@ KNS_EXTERN rc_t CC KNSManagerMakeRetryTimedConnection ( struct KNSManager const rc = RC ( rcNS, rcStream, rcConstructing, rcMemory, rcExhausted ); else { - const KStream_vt * vt; + const KStream_vt * vt = NULL; conn -> read_timeout = readMillis; conn -> write_timeout = writeMillis; @@ -2294,7 +2292,7 @@ LIB_EXPORT rc_t CC KListenerRelease( const KListener *self ) LIB_EXPORT rc_t CC KListenerAccept ( KListener * self, struct KSocket ** out ) { - rc_t rc; + rc_t rc = 0; if ( out == NULL ) rc = RC ( rcNS, rcSocket, rcConstructing, rcParam, rcNull ); diff --git a/libs/kns/win/sysstream.c b/libs/kns/win/sysstream.c index 55e7e87f3..0708c0308 100644 --- a/libs/kns/win/sysstream.c +++ b/libs/kns/win/sysstream.c @@ -72,7 +72,7 @@ rc_t CC KStdIOStreamRead ( const KStdIOStream *self, to_read = ( DWORD ) bsize; if ( ( size_t ) to_read < bsize ) - to_read = -1; + to_read = ( DWORD ) -1; while ( 1 ) { @@ -116,7 +116,7 @@ rc_t CC KStdIOStreamWrite ( KStdIOStream *self, to_write = ( DWORD ) size; if ( ( size_t ) to_write < size ) - to_write = -1; + to_write = ( DWORD ) -1; * num_writ = 0; From 7c3110995a309594f058a82553baddf210cca8d9 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Wed, 6 Dec 2023 15:23:30 -0500 Subject: [PATCH 08/42] VDB-5394 saving work --- libs/kdb/database-base.h | 2 +- libs/kdb/index-base.h | 2 +- libs/kdb/manager-base.h | 2 +- libs/kdb/meta-base.h | 2 +- libs/kdb/metanode-base.h | 2 +- libs/kdbtext/CMakeLists.txt | 1 + libs/kdbtext/api.cpp | 304 ++++++++++++++++++++++ libs/kdbtext/api.hpp | 36 +++ libs/kdbtext/column.hpp | 2 + libs/kdbtext/database.hpp | 2 + libs/kdbtext/manager.cpp | 459 ++++++++-------------------------- libs/kdbtext/manager.hpp | 66 +++++ libs/kdbtext/path.cpp | 32 ++- libs/kdbtext/path.hpp | 5 + libs/kdbtext/table.hpp | 2 + test/kdbtext/CMakeLists.txt | 1 + test/kdbtext/test-manager.cpp | 61 ++++- test/kdbtext/test-path.cpp | 131 ++++++++++ 18 files changed, 739 insertions(+), 373 deletions(-) create mode 100644 libs/kdbtext/api.cpp create mode 100644 libs/kdbtext/api.hpp create mode 100644 libs/kdbtext/manager.hpp create mode 100644 test/kdbtext/test-path.cpp diff --git a/libs/kdb/database-base.h b/libs/kdb/database-base.h index 469cb9745..a883bfea3 100644 --- a/libs/kdb/database-base.h +++ b/libs/kdb/database-base.h @@ -80,7 +80,7 @@ struct KDatabase_vt struct KDatabaseBase { - KDatabase_vt * vt; + const KDatabase_vt * vt; KRefcount refcount; }; diff --git a/libs/kdb/index-base.h b/libs/kdb/index-base.h index 38558f18c..3abe481b5 100644 --- a/libs/kdb/index-base.h +++ b/libs/kdb/index-base.h @@ -74,7 +74,7 @@ struct KIndex_vt struct KIndex { - KIndex_vt * vt; + const KIndex_vt * vt; KRefcount refcount; }; diff --git a/libs/kdb/manager-base.h b/libs/kdb/manager-base.h index 33c3d426f..13a66ee71 100644 --- a/libs/kdb/manager-base.h +++ b/libs/kdb/manager-base.h @@ -78,7 +78,7 @@ struct KDBManager_vt struct KDBManagerBase { - KDBManager_vt * vt; + const KDBManager_vt * vt; KRefcount refcount; }; diff --git a/libs/kdb/meta-base.h b/libs/kdb/meta-base.h index e9feaf03f..251cb4fe3 100644 --- a/libs/kdb/meta-base.h +++ b/libs/kdb/meta-base.h @@ -65,7 +65,7 @@ struct KMetadata_vt struct KMetadata { - KMetadata_vt * vt; + const KMetadata_vt * vt; KRefcount refcount; }; diff --git a/libs/kdb/metanode-base.h b/libs/kdb/metanode-base.h index 9df6de278..036403bec 100644 --- a/libs/kdb/metanode-base.h +++ b/libs/kdb/metanode-base.h @@ -74,7 +74,7 @@ struct KMDataNode { BSTNode n; - KMDataNode_vt * vt; + const KMDataNode_vt * vt; KRefcount refcount; }; diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt index 6587f0641..99b04dfcb 100644 --- a/libs/kdbtext/CMakeLists.txt +++ b/libs/kdbtext/CMakeLists.txt @@ -23,6 +23,7 @@ # =========================================================================== set( KDBTEXT_SRC + api.cpp manager.cpp database.cpp table.cpp diff --git a/libs/kdbtext/api.cpp b/libs/kdbtext/api.cpp new file mode 100644 index 000000000..01bf838f9 --- /dev/null +++ b/libs/kdbtext/api.cpp @@ -0,0 +1,304 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "api.hpp" + +#include "manager.hpp" +#include "database.hpp" +#include "table.hpp" +#include "path.hpp" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +using namespace std; + +const uint32_t LIBKDBTEXT_VERS = 0; + +static rc_t CC KTextManagerWhack ( KDBManager *self ); +static rc_t CC KTextManagerVersion ( const KDBManager *self, uint32_t *version ); +static bool CC KTextManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args ); +static rc_t CC KTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ); +static rc_t CC KTextManagerRunPeriodicTasks ( const KDBManager *self ); +static int CC KTextManagerPathTypeVP( const KDBManager * self, const VPath * path ); +static int CC KTextManagerVPathType ( const KDBManager * self, const char *path, va_list args ); +static int CC KTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ); +static rc_t CC KTextManagerVOpenDBRead ( const KDBManager *self, const KDatabase **db, const char *path, va_list args ); +static rc_t CC KTextManagerVOpenTableRead ( const KDBManager *self, const KTable **tbl, const char *path, va_list args ); +static rc_t CC KTextManagerOpenTableReadVPath(const KDBManager *self, const KTable **tbl, const struct VPath *path); +static rc_t CC KTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ); +static rc_t CC KTextManagerVPathOpenLocalDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * vpath ); +static rc_t CC KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ); + +static KDBManager_vt KTextManager_vt = +{ + KTextManagerWhack, + KDBManagerBaseAddRef, + KDBManagerBaseRelease, + KTextManagerVersion, + KTextManagerVExists, + KTextManagerVWritable, + KTextManagerRunPeriodicTasks, + KTextManagerPathTypeVP, + KTextManagerVPathType, + KTextManagerVPathTypeUnreliable, + KTextManagerVOpenDBRead, + KTextManagerVOpenTableRead, + KTextManagerOpenTableReadVPath, + KTextManagerVOpenColumnRead, + KTextManagerVPathOpenLocalDBRead, + KTextManagerVPathOpenRemoteDBRead +}; + +using namespace KDBText; +#define CAST() assert( bself -> dad . vt == & KTextManager_vt ); const Manager *self = static_cast(bself); + +static +rc_t CC +KTextManagerWhack ( KDBManager *self ) +{ + assert( self -> dad . vt == & KTextManager_vt ); + delete reinterpret_cast( self ); + return 0; +} + +static +rc_t CC +KTextManagerVersion ( const KDBManager *self, uint32_t * version ) +{ + if ( version == nullptr ) + { + return SILENT_RC ( rcDB, rcMgr, rcAccessing, rcParam, rcNull ); + } + + * version = LIBKDBTEXT_VERS; + return 0; +} + +static +rc_t +PrintToString( const char *fmt, va_list args, string & out ) +{ + KDataBuffer buf; + rc_t rc = KDataBufferMake ( & buf, 8, 0 ); + if ( rc != 0 ) + { + return false; + } + + rc = KDataBufferVPrintf ( & buf, fmt, args ); + if ( rc != 0 ) + { + return rc; + } + + out = string((const char *) (buf . base)); // will be 0-terminated + + rc = KDataBufferWhack ( & buf ); + if ( rc != 0 ) + { + return rc; + } + + return rc; +} + +static +bool CC +KTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *fmt, va_list args ) +{ + CAST(); + return self -> exists( requested, Path( fmt, args ) ); +} + +static +rc_t CC +KTextManagerVWritable ( const KDBManager *bself, const char * fmt, va_list args ) +{ + CAST(); + + string path; + PrintToString( fmt, args, path ); + + return self -> writable( Path(path) ); +} + +static +rc_t CC +KTextManagerRunPeriodicTasks ( const KDBManager *self ) +{ + return 0; +} + +static +int CC +KTextManagerPathTypeVP( const KDBManager * bself, const VPath * path ) +{ + CAST(); + + // parse and resolve the path + const String * p; + rc_t rc = VPathMakeString ( path, &p ); + if ( rc == 0 ) + { + int ret = self -> pathType( string ( p -> addr, p -> size ) ); + StringWhack ( p ); + return ret; + } + + return kptNotFound; +} + +static +int CC +KTextManagerVPathType ( const KDBManager * bself, const char *fmt, va_list args ) +{ + CAST(); + + string path; + PrintToString( fmt, args, path ); + + return self -> pathType( path ); +} + +static +int CC +KTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ) +{ + return KTextManagerVPathType( self, path, args ); +} + +static +rc_t CC +KTextManagerVOpenDBRead ( const KDBManager *bself, const KDatabase **p_db, const char *fmt, va_list args ) +{ + CAST(); + + string path; + PrintToString( fmt, args, path ); + const Database * db = nullptr; + rc_t rc = self -> openDatabase( Path( path ), db ); + *p_db = (const KDatabase *)db; + + return rc; +} + +static +rc_t CC +KTextManagerVOpenTableRead ( const KDBManager *bself, const KTable **p_tbl, const char *fmt, va_list args ) +{ + CAST(); + + string path; + PrintToString( fmt, args, path ); + const Table * tbl = nullptr; + rc_t rc = self -> openTable( Path( path ), tbl ); + *p_tbl = (const KTable *)tbl; + + return rc; +} + +static +rc_t CC +KTextManagerOpenTableReadVPath(const KDBManager *bself, const KTable **p_tbl, const struct VPath *p_path) +{ + CAST(); + + const Table * tbl = nullptr; + rc_t rc = self -> openTable( Path( p_path ), tbl ); + *p_tbl = (const KTable *)tbl; + + return rc; +} + +static +rc_t CC +KTextManagerVOpenColumnRead ( const KDBManager *bself, const KColumn **p_col, const char *fmt, va_list args ) +{ + CAST(); + + const Column * col = nullptr; + rc_t rc = self -> openColumn( Path( fmt, args ), col ); + *p_col = (const KColumn *)col; + + return rc; +} + +static +rc_t CC +KTextManagerVPathOpenLocalDBRead ( const KDBManager * bself, struct KDatabase const ** p_db, struct VPath const * vpath ) +{ + CAST(); + + const Database * db = nullptr; + rc_t rc = self -> openDatabase( Path( vpath ), db ); + *p_db = (const KDatabase *)db; + + return rc; +} + +static +rc_t CC +KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ) +{ + return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); +} + +LIB_EXPORT +rc_t CC +KDBManagerMakeText ( const KDBManager ** p_mgr, const char * input, char * error, size_t error_size ) +{ + if ( p_mgr == nullptr ) + { + return SILENT_RC ( rcDB, rcMgr, rcCreating, rcSelf, rcNull ); + } + + Manager * mgr = new Manager( KTextManager_vt ); + + rc_t rc = mgr -> parse( input, error, error_size ); + if ( rc == 0 ) + { + *p_mgr = mgr; + } + else + { + delete mgr; + } + + return rc; +} + diff --git a/libs/kdbtext/api.hpp b/libs/kdbtext/api.hpp new file mode 100644 index 000000000..7c94f1c14 --- /dev/null +++ b/libs/kdbtext/api.hpp @@ -0,0 +1,36 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#pragma once + +typedef struct KDBManager KDBManager; +#define KDBMGR_IMPL KDBManager +#include "../libs/kdb/manager-base.h" + +struct KDBManager +{ + KDBManagerBase dad; +}; diff --git a/libs/kdbtext/column.hpp b/libs/kdbtext/column.hpp index 933e5e6e4..a5f130ebd 100644 --- a/libs/kdbtext/column.hpp +++ b/libs/kdbtext/column.hpp @@ -24,6 +24,8 @@ * */ +#pragma once + #include "../libs/kdb/column-base.h" #include diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index 60beb0cb3..50bad83dc 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -24,6 +24,8 @@ * */ +#pragma once + typedef struct KTextDatabase KTextDatabase; #define KDATABASE_IMPL KTextDatabase #include "../libs/kdb/database-base.h" diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index 6722ec553..b73f1266d 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -24,11 +24,9 @@ * */ -#include +#include "manager.hpp" -#include "database.hpp" -#include "table.hpp" -#include "path.hpp" +#include #include #include @@ -41,207 +39,88 @@ #include -#include - using namespace std; - -typedef struct KDBManager KDBManager; -#define KDBMGR_IMPL KDBManager -#include "../libs/kdb/manager-base.h" - -struct KDBManager -{ - KDBManagerBase dad; -}; - -const uint32_t LIBKDBTEXT_VERS = 0; - -static rc_t CC KTextManagerWhack ( KDBManager *self ); -static rc_t CC KTextManagerVersion ( const KDBManager *self, uint32_t *version ); -static bool CC KTextManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args ); -static rc_t CC KTextManagerVWritable ( const KDBManager *self, const char * path, va_list args ); -static rc_t CC KTextManagerRunPeriodicTasks ( const KDBManager *self ); -static int CC KTextManagerPathTypeVP( const KDBManager * self, const VPath * path ); -static int CC KTextManagerVPathType ( const KDBManager * self, const char *path, va_list args ); -static int CC KTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ); -static rc_t CC KTextManagerVOpenDBRead ( const KDBManager *self, const KDatabase **db, const char *path, va_list args ); -static rc_t CC KTextManagerVOpenTableRead ( const KDBManager *self, const KTable **tbl, const char *path, va_list args ); -static rc_t CC KTextManagerOpenTableReadVPath(const KDBManager *self, const KTable **tbl, const struct VPath *path); -static rc_t CC KTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ); -static rc_t CC KTextManagerVPathOpenLocalDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * vpath ); -static rc_t CC KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ); - -static KDBManager_vt KTextManager_vt = -{ - KTextManagerWhack, - KDBManagerBaseAddRef, - KDBManagerBaseRelease, - KTextManagerVersion, - KTextManagerVExists, - KTextManagerVWritable, - KTextManagerRunPeriodicTasks, - KTextManagerPathTypeVP, - KTextManagerVPathType, - KTextManagerVPathTypeUnreliable, - KTextManagerVOpenDBRead, - KTextManagerVOpenTableRead, - KTextManagerOpenTableReadVPath, - KTextManagerVOpenColumnRead, - KTextManagerVPathOpenLocalDBRead, - KTextManagerVPathOpenRemoteDBRead -}; - -namespace KDBText -{ - class Manager : public KDBManager - { - public: - Manager() - { - dad . vt = & KTextManager_vt; - KRefcountInit ( & dad . refcount, 1, "KDBText::Manager", "ctor", "kmgr" ); - } - ~Manager() - { - delete m_tbl; - delete m_db; - KJsonValueWhack( m_root ); - KRefcountWhack ( & dad . refcount, "KDBText::Manager" ); - } - - rc_t parse( const char * input, char * error, size_t error_size ) - { - rc_t rc = KJsonValueMake ( & m_root, input, error, error_size ); - if ( rc != 0 ) - { - return rc; - } - - if ( KJsonGetValueType ( m_root ) != jsObject ) - { - string_printf ( error, error_size, nullptr, "Json root is invalid" ); - return SILENT_RC( rcDB, rcMgr, rcCreating, rcParam, rcInvalid ); - } - - const KJsonObject * rootObj = KJsonValueToObject ( m_root ); - assert( rootObj != nullptr ); - - const KJsonValue * type = KJsonObjectGetMember ( rootObj, "type" ); - if ( type != nullptr ) - { - const char * typeStr = nullptr; - rc = KJsonGetString ( type, & typeStr ); - if ( rc == 0 ) - { - if ( strcmp( typeStr, "database") == 0 ) - { - m_db = new Database( rootObj ); - rc = m_db -> inflate( error, error_size ); - } - else if ( strcmp( typeStr, "table") == 0 ) - { - m_tbl = new Table( rootObj ); - rc = m_tbl -> inflate( error, error_size ); - } - } - } - - return rc; - } - - const Database * getRootDatabase() const { return m_db; } - const Table * getRootTable() const { return m_tbl; } - - int pathType( const string & path ) const - { - if ( m_db ) - { //TODO: implement proper parsing (allow "db/table/col" etc.) - if ( m_db -> getName () == path ) - { - return kptDatabase; - } - } - //TODO: else root table - return kptNotFound; - } - - private: - KJsonValue * m_root = nullptr; - Database * m_db = nullptr; - Table * m_tbl = nullptr; - }; - -} - using namespace KDBText; -#define CAST() assert( bself -> dad . vt == & KTextManager_vt ); const Manager *self = static_cast(bself); -static -rc_t CC -KTextManagerWhack ( KDBManager *self ) +Manager::Manager( const KDBManager_vt & vt) { - assert( self -> dad . vt == & KTextManager_vt ); - delete reinterpret_cast( self ); - return 0; + dad . vt = & vt; + KRefcountInit ( & dad . refcount, 1, "KDBText::Manager", "ctor", "kmgr" ); } -static -rc_t CC -KTextManagerVersion ( const KDBManager *self, uint32_t * version ) +Manager::~Manager() { - if ( version == nullptr ) - { - return SILENT_RC ( rcDB, rcMgr, rcAccessing, rcParam, rcNull ); - } - - * version = LIBKDBTEXT_VERS; - return 0; + delete m_tbl; + delete m_db; + KJsonValueWhack( m_root ); + KRefcountWhack ( & dad . refcount, "KDBText::Manager" ); } -static rc_t -PrintToString( const char *fmt, va_list args, string & out ) +Manager::parse( const char * input, char * error, size_t error_size ) { - KDataBuffer buf; - rc_t rc = KDataBufferMake ( & buf, 8, 0 ); + rc_t rc = KJsonValueMake ( & m_root, input, error, error_size ); if ( rc != 0 ) { - return false; + return rc; } - rc = KDataBufferVPrintf ( & buf, fmt, args ); - if ( rc != 0 ) + if ( KJsonGetValueType ( m_root ) != jsObject ) { - return rc; + string_printf ( error, error_size, nullptr, "Json root is invalid" ); + return SILENT_RC( rcDB, rcMgr, rcCreating, rcParam, rcInvalid ); } - out = string((const char *) (buf . base)); // will be 0-terminated + const KJsonObject * rootObj = KJsonValueToObject ( m_root ); + assert( rootObj != nullptr ); - rc = KDataBufferWhack ( & buf ); - if ( rc != 0 ) + const KJsonValue * type = KJsonObjectGetMember ( rootObj, "type" ); + if ( type != nullptr ) { - return rc; + const char * typeStr = nullptr; + rc = KJsonGetString ( type, & typeStr ); + if ( rc == 0 ) + { + if ( strcmp( typeStr, "database") == 0 ) + { + m_db = new Database( rootObj ); + rc = m_db -> inflate( error, error_size ); + } + else if ( strcmp( typeStr, "table") == 0 ) + { + m_tbl = new Table( rootObj ); + rc = m_tbl -> inflate( error, error_size ); + } + } } return rc; } - - -static -bool CC -KTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *fmt, va_list args ) +int +Manager::pathType( const string & path ) const { - CAST(); - - Path path( fmt, args ); + if ( m_db ) + { //TODO: implement proper parsing (allow "db/table/col" etc.) + if ( m_db -> getName () == path ) + { + return kptDatabase; + } + } + //TODO: else root table + return kptNotFound; +} +bool +Manager::exists( uint32_t requested, const Path & p_path ) const +{ // TODO: non-root dbs and other objects (incl root tables) + Path path = p_path; switch ( requested ) { case kptDatabase: { - const Database * db = self -> getRootDatabase(); + const Database * db = getRootDatabase(); do { if ( db && path.size() > 0 && db -> getName() == path.front() ) @@ -298,219 +177,99 @@ KTextManagerVExists ( const KDBManager *bself, uint32_t requested, const char *f // return requested == ( uint32_t ) type; } -static -rc_t CC -KTextManagerVWritable ( const KDBManager *bself, const char * fmt, va_list args ) -{ - CAST(); - - string path; - PrintToString( fmt, args, path ); - - //TODO: parse and resolve the path, if the object is valid return rcReadOnly, otherwise rcNotFound - - const Database * db = self -> getRootDatabase(); - if (db && db -> getName() == path ) - { - return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); - } - const Table * tbl= self -> getRootTable(); - if (tbl && tbl -> getName() == path ) - { - return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); - } - - return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcNotFound ); -} - -static -rc_t CC -KTextManagerRunPeriodicTasks ( const KDBManager *self ) -{ - return 0; -} - -static -int CC -KTextManagerPathTypeVP( const KDBManager * bself, const VPath * path ) -{ - CAST(); - - // parse and resolve the path - const String * p; - rc_t rc = VPathMakeString ( path, &p ); - if ( rc == 0 ) - { - int ret = self -> pathType( string ( p -> addr, p -> size ) ); - StringWhack ( p ); - return ret; - } - - return kptNotFound; -} - -static -int CC -KTextManagerVPathType ( const KDBManager * bself, const char *fmt, va_list args ) -{ - CAST(); - - string path; - PrintToString( fmt, args, path ); - - return self -> pathType( path ); -} - -static -int CC -KTextManagerVPathTypeUnreliable ( const KDBManager * self, const char *path, va_list args ) -{ - return KTextManagerVPathType( self, path, args ); -} - -static -rc_t CC -KTextManagerVOpenDBRead ( const KDBManager *bself, const KDatabase **p_db, const char *fmt, va_list args ) +rc_t +Manager::writable( const Path & p_path ) const { - CAST(); - - string path; - PrintToString( fmt, args, path ); - - // TODO: non-root dbs - const Database * db = self -> getRootDatabase(); - if (db && db -> getName() == path ) + if ( ! p_path.empty() ) { - rc_t rc = KDatabaseAddRef( (const KDatabase *)db ); - if ( rc != 0 ) + //TODO: parse and resolve the path, if the object is valid return rcReadOnly, otherwise rcNotFound + const Database * db = getRootDatabase(); + if (db && db -> getName() == p_path.front() ) { - return rc; + return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); } - *p_db = (const KDatabase *)db; - return 0; - } - return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); -} - -static -rc_t CC -KTextManagerVOpenTableRead ( const KDBManager *bself, const KTable **p_tbl, const char *fmt, va_list args ) -{ - CAST(); - - string path; - PrintToString( fmt, args, path ); - - // TODO: non-root tables? - const Table * tbl= self -> getRootTable(); - if (tbl && tbl -> getName() == path ) - { - rc_t rc = KTableAddRef( (const KTable *)tbl ); - if ( rc != 0 ) + const Table * tbl= getRootTable(); + if (tbl && tbl -> getName() == p_path.front() ) { - return rc; + return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); } - *p_tbl = (const KTable *)tbl; - return 0; } - return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); + + return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcNotFound ); } -static -rc_t CC -KTextManagerOpenTableReadVPath(const KDBManager *bself, const KTable **p_tbl, const struct VPath *path) +rc_t +Manager::openDatabase( const Path & p_path, const Database *& p_db ) const { - CAST(); - - // parse and resolve the path - const String * p; - rc_t rc = VPathMakeString ( path, &p ); - if ( rc == 0 ) + if ( ! p_path.empty() ) { - // TODO: non-root tables? - const Table * tbl= self -> getRootTable(); - if (tbl && tbl -> getName() == string ( p -> addr, p -> size ) ) + // TODO: non-root dbs + const Database * db = getRootDatabase(); + if ( db && db -> getName() == p_path.front() ) { - StringWhack ( p ); - rc_t rc = KTableAddRef( (const KTable *)tbl ); + rc_t rc = KDatabaseAddRef( (const KDatabase *)db ); if ( rc != 0 ) { return rc; } - *p_tbl = (const KTable *)tbl; + p_db = db; return 0; } - StringWhack ( p ); - return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); } - - return rc; -} - -static -rc_t CC -KTextManagerVOpenColumnRead ( const KDBManager *self, const KColumn **col, const char *path, va_list args ) -{ return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); } -static -rc_t CC -KTextManagerVPathOpenLocalDBRead ( const struct KDBManager * bself, struct KDatabase const ** p_db, struct VPath const * path ) +rc_t +Manager::openTable( const Path & p_path, const Table *& p_tbl ) const { - CAST(); - - // parse and resolve the path - const String * p; - rc_t rc = VPathMakeString ( path, &p ); - if ( rc == 0 ) + if ( ! p_path.empty() ) { - // TODO: non-root dbs - const Database * db = self -> getRootDatabase(); - if ( db && db -> getName() == string( p -> addr, p -> size ) ) + // TODO: non-root tables + const Table * tbl= getRootTable(); + if (tbl && tbl -> getName() == p_path.front() ) { - rc_t rc = KDatabaseAddRef( (const KDatabase *)db ); - StringWhack ( p ); + rc_t rc = KTableAddRef( (const KTable *)tbl ); if ( rc != 0 ) { return rc; } - *p_db = (const KDatabase *)db; + p_tbl = tbl; return 0; } - StringWhack ( p ); - return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); } - return rc; -} - -static -rc_t CC -KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KDatabase const ** p_db, struct VPath const * remote, struct VPath const * cache ) -{ return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); } -LIB_EXPORT -rc_t CC -KDBManagerMakeText ( const KDBManager ** p_mgr, const char * input, char * error, size_t error_size ) +rc_t +Manager::openColumn( const Path & p_path, const Column *& p_col) const { - if ( p_mgr == nullptr ) + if ( ! p_path.empty() ) { - return SILENT_RC ( rcDB, rcMgr, rcCreating, rcSelf, rcNull ); - } - - Manager * mgr = new Manager(); - - rc_t rc = mgr -> parse( input, error, error_size ); - if ( rc == 0 ) - { - *p_mgr = mgr; - } - else - { - delete mgr; + // TODO: non-root tables + const Table * tbl= getRootTable(); + if ( ! p_path.empty() && tbl && tbl -> getName() == p_path.front() ) + { + Path path = p_path; + path.pop(); + if ( ! path.empty() && path.front() == "col" ) + { + path.pop(); + if ( ! path.empty() ) + { + const Column* col = tbl -> getColumn( path.front() ); + if ( col != nullptr ) + { + rc_t rc = KColumnAddRef( (const KColumn *)col ); + if ( rc != 0 ) + { + return rc; + } + p_col = col; + return 0; + } + } + } + } } - return rc; + return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); } - diff --git a/libs/kdbtext/manager.hpp b/libs/kdbtext/manager.hpp new file mode 100644 index 000000000..61650c365 --- /dev/null +++ b/libs/kdbtext/manager.hpp @@ -0,0 +1,66 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#pragma once + +#include "api.hpp" + +#include + +#include "database.hpp" +#include "table.hpp" +#include "path.hpp" + +namespace KDBText +{ + class Manager : public KDBManager + { + public: + Manager( const KDBManager_vt& ); + ~Manager(); + + rc_t parse( const char * input, char * error, size_t error_size ); + + const Database * getRootDatabase() const { return m_db; } + const Table * getRootTable() const { return m_tbl; } + + int pathType( const std::string & path ) const; + + bool exists( uint32_t requested, const Path & ) const; + + rc_t writable( const Path & ) const; + + rc_t openDatabase( const Path &, const Database *& ) const; + rc_t openTable( const Path &, const Table *& ) const; + rc_t openColumn( const Path &, const Column *& ) const; + + private: + KJsonValue * m_root = nullptr; + Database * m_db = nullptr; + Table * m_tbl = nullptr; + }; +} + diff --git a/libs/kdbtext/path.cpp b/libs/kdbtext/path.cpp index 25ff75693..1af30448b 100644 --- a/libs/kdbtext/path.cpp +++ b/libs/kdbtext/path.cpp @@ -29,6 +29,9 @@ #include #include #include +#include + +#include #include @@ -63,23 +66,36 @@ PrintToString( const char *fmt, va_list args, string & out ) return rc; } +void +Path::fromString( const string & p_source ) +{ + string word; + istringstream in( p_source ); + while( getline(in, word, '/') ) + { + push( word ); + } +} + Path::Path( const std::string & p_source ) { + fromString( p_source ); } Path::Path( const char *fmt, va_list args ) { string p; PrintToString( fmt, args, p ); - - string word; - istringstream in( p ); - while( getline(in, word, '/') ) - { - push( word ); - } + fromString( p ); } -Path::Path( const struct VPath * path ) +Path::Path( const struct VPath * p_path ) { + const String * str; + rc_t rc = VPathMakeString ( p_path, &str ); + if ( rc == 0 ) + { + fromString( string( str -> addr, str -> size ) ); + StringWhack( str ); + } } diff --git a/libs/kdbtext/path.hpp b/libs/kdbtext/path.hpp index f9f61fa22..e46eadeae 100644 --- a/libs/kdbtext/path.hpp +++ b/libs/kdbtext/path.hpp @@ -24,6 +24,8 @@ * */ +#pragma once + #include #include @@ -38,5 +40,8 @@ namespace KDBText Path( const std::string & p_source ); Path( const char *fmt, va_list args ); Path( const struct VPath * path ); + + private: + void fromString( const std::string & p_source ); }; } diff --git a/libs/kdbtext/table.hpp b/libs/kdbtext/table.hpp index 656369071..5983ea16a 100644 --- a/libs/kdbtext/table.hpp +++ b/libs/kdbtext/table.hpp @@ -24,6 +24,8 @@ * */ +#pragma once + #include "../libs/kdb/table-base.h" #include "column.hpp" diff --git a/test/kdbtext/CMakeLists.txt b/test/kdbtext/CMakeLists.txt index 14b226b0c..f4ed0efe8 100644 --- a/test/kdbtext/CMakeLists.txt +++ b/test/kdbtext/CMakeLists.txt @@ -32,6 +32,7 @@ add_compile_definitions( __mod__="test/kdbtext" ) +AddExecutableTest( Test_KDBText_Path "test-path" "${COMMON_LIBS_READ};kdbtext" ) AddExecutableTest( Test_KDBText_Column "test-column" "${COMMON_LIBS_READ};kdbtext" ) AddExecutableTest( Test_KDBText_Table "test-table" "${COMMON_LIBS_READ};kdbtext" ) AddExecutableTest( Test_KDBText_Database "test-database" "${COMMON_LIBS_READ};kdbtext" ) diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index ed7b81fab..54ad91573 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -52,6 +52,8 @@ class KDBTextManager_Fixture } ~KDBTextManager_Fixture() { + KColumnRelease( m_col ); + VPathRelease( m_path ); KDBManagerRelease( m_mgr ); } @@ -69,6 +71,7 @@ class KDBTextManager_Fixture const KDBManager * m_mgr = nullptr; VPath * m_path = nullptr; + const KColumn * m_col = nullptr; char m_error[1024]; }; @@ -148,19 +151,37 @@ FIXTURE_TEST_CASE(KDBTextManager_RunPeriodicTasks, KDBTextManager_Fixture) REQUIRE_RC( KDBManagerRunPeriodicTasks( m_mgr ) ); } +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_NotFound, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + MakeVPath( "proddb"); + REQUIRE_EQ( (int)kptNotFound, KDBManagerPathTypeVP( m_mgr, m_path ) ); +} FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db, KDBTextManager_Fixture) { Setup( R"({"type": "database", "name": "testdb"})" ); MakeVPath( "testdb"); REQUIRE_EQ( (int)kptDatabase, KDBManagerPathTypeVP( m_mgr, m_path ) ); } -FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_NotFound, KDBTextManager_Fixture) +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db_Nested, KDBTextManager_Fixture) { - Setup( R"({"type": "database", "name": "testdb"})" ); - MakeVPath( "proddb"); - REQUIRE_EQ( (int)kptNotFound, KDBManagerPathTypeVP( m_mgr, m_path ) ); + Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database","name":"subdb1"} , {"type": "database","name":"subdb2"} ]})" ); + REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb1" ) ); + MakeVPath( "testdb/db/subdb2"); + REQUIRE_EQ( (int)kptDatabase, KDBManagerPathTypeVP( m_mgr, m_path ) ); +} +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Table_Root, KDBTextManager_Fixture) +{ + Setup( R"({"type": "table", "name": "tbl"})" ); + REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "tbl" ) ); + MakeVPath( "tbl"); + REQUIRE_EQ( (int)kptTable, KDBManagerPathTypeVP( m_mgr, m_path ) ); } //TODO: KDBManagerPathTypeVP on internal objects, to test interpretation of the path + // kptTable - internal + // kptColumn, + // kptIndex, + // kptMetadata, FIXTURE_TEST_CASE(KDBTextManager_PathType, KDBTextManager_Fixture) { @@ -211,15 +232,35 @@ FIXTURE_TEST_CASE(KDBTextManager_OpenTableReadVPath, KDBTextManager_Fixture) REQUIRE_RC( KTableRelease( tbl ) ); } -FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead, KDBTextManager_Fixture) +const char * TableWithColumnQQ = R"({"type": "table", "name": "SEQUENCE", "columns":[{"name":"qq"}]})"; +FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead_BadPath1, KDBTextManager_Fixture) +{ + Setup( TableWithColumnQQ ); + REQUIRE_RC_FAIL( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SHMEQUENCE/col/qq" ) ); // bad table name +} +FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead_BadPath2, KDBTextManager_Fixture) { - Setup( R"({"type": "table", "name": "SEQUENCE", "columns":[{"name":"qq"}]})" ); + Setup( TableWithColumnQQ ); + REQUIRE_RC_FAIL( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/shmol/qq" ) ); // bad "col" +} +FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead_BadPath3, KDBTextManager_Fixture) +{ + Setup( TableWithColumnQQ ); + REQUIRE_RC_FAIL( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/col" ) ); // col name missing +} +FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead_BadPath4, KDBTextManager_Fixture) +{ + Setup( TableWithColumnQQ ); + REQUIRE_RC_FAIL( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/col/shmol" ) ); // no such column +} +FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead, KDBTextManager_Fixture) +{ // root table + Setup( TableWithColumnQQ ); - const KColumn * col = nullptr; - REQUIRE_RC( KDBManagerOpenColumnRead( m_mgr, & col, "%s", "SEQUENCE/col/qq" ) ); - REQUIRE_NOT_NULL( col ); - REQUIRE_RC( KColumnRelease( col ) ); + REQUIRE_RC( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/col/qq" ) ); + REQUIRE_NOT_NULL( m_col ); } +//TODO: non-root tables FIXTURE_TEST_CASE(KDBManager_VPathOpenLocalDBRead, KDBTextManager_Fixture) { diff --git a/test/kdbtext/test-path.cpp b/test/kdbtext/test-path.cpp new file mode 100644 index 000000000..a2346c387 --- /dev/null +++ b/test/kdbtext/test-path.cpp @@ -0,0 +1,131 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for a file-system-type path represented as queue of strings +*/ + +#include + +#include "../../libs/kdbtext/path.hpp" + +#include +#include + +#include + +using namespace std; +using namespace KDBText; + +TEST_SUITE(KDBTextPathTestSuite); + +TEST_CASE(KDBTextPath_fromEmptyString) +{ + Path path( string("") ); + REQUIRE( path.empty() ); +} +TEST_CASE(KDBTextPath_fromString) +{ + Path path( string("a/bb/cccc") ); + REQUIRE( ! path.empty() ); + REQUIRE_EQ( string("a"), path.front() ); + path.pop(); + REQUIRE_EQ( string("bb"), path.front() ); + path.pop(); + REQUIRE_EQ( string("cccc"), path.front() ); + path.pop(); + REQUIRE( path.empty() ); +} +TEST_CASE(KDBTextPath_fromFmtArgs) +{ + auto fn = [] ( const char *fmt, ... ) -> Path + { + va_list args; + va_start ( args, fmt ); + return Path( fmt, args ); + }; + Path path = fn( "%s", "a/bb/cccc" ); + REQUIRE( ! path.empty() ); + REQUIRE_EQ( string("a"), path.front() ); + path.pop(); + REQUIRE_EQ( string("bb"), path.front() ); + path.pop(); + REQUIRE_EQ( string("cccc"), path.front() ); + path.pop(); + REQUIRE( path.empty() ); +} + +TEST_CASE(KDBTextPath_fromVPath) +{ + VPath * vpath; + VFSManager * vfs; + REQUIRE_RC( VFSManagerMake ( & vfs ) ); + REQUIRE_RC( VFSManagerMakePath ( vfs, & vpath, "%s", "a/bb/cccc" ) ); + REQUIRE_RC( VFSManagerRelease( vfs ) ); + + Path path ( vpath ); + REQUIRE_RC( VPathRelease( vpath ) ); + + REQUIRE( ! path.empty() ); + REQUIRE_EQ( string("a"), path.front() ); + path.pop(); + REQUIRE_EQ( string("bb"), path.front() ); + path.pop(); + REQUIRE_EQ( string("cccc"), path.front() ); + path.pop(); + REQUIRE( path.empty() ); +} +//////////////////////////////////////////// Main +extern "C" +{ + +#include +#include + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} +rc_t CC UsageSummary (const char * progname) +{ + return 0; +} + +rc_t CC Usage ( const Args * args ) +{ + return 0; +} + +const char UsageDefaultName[] = "Test_KDBText_Path"; + +rc_t CC KMain ( int argc, char *argv [] ) +{ + KConfigDisableUserSettings(); + rc_t rc=KDBTextPathTestSuite(argc, argv); + return rc; +} + +} From cf78c7a22b4c9e978b41d58dcbd347b3d607b4d7 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Thu, 7 Dec 2023 14:54:51 -0500 Subject: [PATCH 09/42] VDB-5394 saving work --- libs/kdbtext/database.cpp | 101 ++++++++++++++++++++++++++++++++- libs/kdbtext/database.hpp | 7 +++ libs/kdbtext/manager.cpp | 53 ++++++++--------- libs/kdbtext/table.cpp | 19 +++++++ libs/kdbtext/table.hpp | 3 + test/kdbtext/test-database.cpp | 85 +++++++++++++++++++++++++-- test/kdbtext/test-manager.cpp | 11 +++- 7 files changed, 246 insertions(+), 33 deletions(-) diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 529774f85..9bf2d8c2f 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -26,6 +26,7 @@ #include "database.hpp" +#include #include #include @@ -95,6 +96,19 @@ Database::getDatabase( const std::string & name ) const return nullptr; } +const Table * +Database::getTable( const std::string & name ) const +{ + for( auto & d : m_tables ) + { + if ( name == d.getName() ) + { + return & d; + } + } + return nullptr; +} + rc_t Database::inflate( char * error, size_t error_size ) { @@ -185,9 +199,93 @@ Database::inflate( char * error, size_t error_size ) } } + // tables + const KJsonValue * tables = KJsonObjectGetMember ( m_json, "tables" ); + if ( tables != nullptr ) + { + const KJsonArray * tblarr = KJsonValueToArray ( tables ); + if ( tblarr == nullptr ) + { + string_printf ( error, error_size, nullptr, "%s.tables is not an array", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + uint32_t len = KJsonArrayGetLength ( tblarr ); + for ( uint32_t i = 0; i < len; ++i ) + { + const KJsonValue * v = KJsonArrayGetElement ( tblarr, i ); + assert( v != nullptr ); + const KJsonObject * obj = KJsonValueToObject ( v ); + if( obj != nullptr ) + { + Table tbl ( obj ); + rc = tbl . inflate ( error, error_size ); + if ( rc != 0 ) + { + return rc; + } + + for( auto & t : m_tables ) + { + if ( tbl.getName() == t.getName() ) + { + string_printf ( error, error_size, nullptr, "Duplicate table: %s", tbl.getName().c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + m_tables .push_back( tbl ); + } + else + { // not an object + string_printf ( error, error_size, nullptr, "%s.tables[%i] is not an object", m_name.c_str(), i ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + } + return rc; } +int +Database::pathType( Path & p ) const +{ + if ( ! p.empty() ) + { + if ( p.front() == m_name ) + { + p.pop(); + if ( p.empty() ) + { + return kptDatabase; + } + if ( p.front() == "db" ) + { + p.pop(); + if ( ! p.empty() ) + { + const Database * db = getDatabase( p.front() ); + if ( db != nullptr ) + { + return db->pathType( p ); + } + } + } + else if ( p.front() == "tbl" ) + { + p.pop(); + if ( ! p.empty() ) + { + const Table * t = getTable( p.front() ); + if ( t != nullptr ) + { + return t -> pathType( p ); + } + } + } + } + } + return kptNotFound; +} + static rc_t CC KTextDatabaseWhack ( KTextDatabase *self ) @@ -195,4 +293,5 @@ KTextDatabaseWhack ( KTextDatabase *self ) assert( self -> dad . vt == & KTextDatabase_vt ); delete reinterpret_cast( self ); return 0; -} \ No newline at end of file +} + diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index 50bad83dc..c143098b2 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -30,6 +30,9 @@ typedef struct KTextDatabase KTextDatabase; #define KDATABASE_IMPL KTextDatabase #include "../libs/kdb/database-base.h" +#include "path.hpp" +#include "table.hpp" + #include #include @@ -55,10 +58,14 @@ namespace KDBText const std::string & getName() const { return m_name; } const Database * getDatabase( const std::string & name ) const; + const Table * getTable( const std::string & name ) const; + + int pathType( Path & ) const; private: const KJsonObject * m_json = nullptr; std::string m_name; std::vector m_subdbs; + std::vector m_tables; }; } diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index b73f1266d..a20006940 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -98,16 +98,18 @@ Manager::parse( const char * input, char * error, size_t error_size ) } int -Manager::pathType( const string & path ) const +Manager::pathType( const string & p_path ) const { - if ( m_db ) - { //TODO: implement proper parsing (allow "db/table/col" etc.) - if ( m_db -> getName () == path ) - { - return kptDatabase; - } +//TODO: allow db/table/col etc. + Path path( p_path ); + if ( m_db != nullptr ) + { + return m_db -> pathType( path ); + } + if ( m_tbl != nullptr ) + { + return m_tbl -> pathType( path ); } - //TODO: else root table return kptNotFound; } @@ -120,10 +122,10 @@ Manager::exists( uint32_t requested, const Path & p_path ) const { case kptDatabase: { - const Database * db = getRootDatabase(); + const Database * db = m_db; do { - if ( db && path.size() > 0 && db -> getName() == path.front() ) + if ( db && ! path.empty() && db -> getName() == path.front() ) { path.pop(); if ( path.empty() ) @@ -134,7 +136,7 @@ Manager::exists( uint32_t requested, const Path & p_path ) const if ( string("db") == path.front() ) { path.pop(); - if ( path.size() > 0 ) + if ( ! path.empty() ) { db = db -> getDatabase( path.front() ); } @@ -156,6 +158,10 @@ Manager::exists( uint32_t requested, const Path & p_path ) const while ( path . size () > 0 ); return true; } + + case kptTable: + return m_tbl != nullptr && path.size() == 1 && m_tbl -> getName() == path.front(); + default: return false; } @@ -183,13 +189,11 @@ Manager::writable( const Path & p_path ) const if ( ! p_path.empty() ) { //TODO: parse and resolve the path, if the object is valid return rcReadOnly, otherwise rcNotFound - const Database * db = getRootDatabase(); - if (db && db -> getName() == p_path.front() ) + if ( m_db && m_db -> getName() == p_path.front() ) { return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); } - const Table * tbl= getRootTable(); - if (tbl && tbl -> getName() == p_path.front() ) + if ( m_tbl && m_tbl -> getName() == p_path.front() ) { return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); } @@ -204,15 +208,14 @@ Manager::openDatabase( const Path & p_path, const Database *& p_db ) const if ( ! p_path.empty() ) { // TODO: non-root dbs - const Database * db = getRootDatabase(); - if ( db && db -> getName() == p_path.front() ) + if ( m_db && m_db -> getName() == p_path.front() ) { - rc_t rc = KDatabaseAddRef( (const KDatabase *)db ); + rc_t rc = KDatabaseAddRef( (const KDatabase *)m_db ); if ( rc != 0 ) { return rc; } - p_db = db; + p_db = m_db; return 0; } } @@ -225,15 +228,14 @@ Manager::openTable( const Path & p_path, const Table *& p_tbl ) const if ( ! p_path.empty() ) { // TODO: non-root tables - const Table * tbl= getRootTable(); - if (tbl && tbl -> getName() == p_path.front() ) + if ( m_tbl && m_tbl -> getName() == p_path.front() ) { - rc_t rc = KTableAddRef( (const KTable *)tbl ); + rc_t rc = KTableAddRef( (const KTable *)m_tbl ); if ( rc != 0 ) { return rc; } - p_tbl = tbl; + p_tbl = m_tbl; return 0; } } @@ -246,8 +248,7 @@ Manager::openColumn( const Path & p_path, const Column *& p_col) const if ( ! p_path.empty() ) { // TODO: non-root tables - const Table * tbl= getRootTable(); - if ( ! p_path.empty() && tbl && tbl -> getName() == p_path.front() ) + if ( ! p_path.empty() && m_tbl && m_tbl -> getName() == p_path.front() ) { Path path = p_path; path.pop(); @@ -256,7 +257,7 @@ Manager::openColumn( const Path & p_path, const Column *& p_col) const path.pop(); if ( ! path.empty() ) { - const Column* col = tbl -> getColumn( path.front() ); + const Column* col = m_tbl -> getColumn( path.front() ); if ( col != nullptr ) { rc_t rc = KColumnAddRef( (const KColumn *)col ); diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp index 9f7740c40..23f25f2c3 100644 --- a/libs/kdbtext/table.cpp +++ b/libs/kdbtext/table.cpp @@ -26,6 +26,8 @@ #include "table.hpp" +#include + #include using namespace KDBText; @@ -189,6 +191,23 @@ Table::inflate( char * error, size_t error_size ) return rc; } +int +Table::pathType( Path & p ) const +{ + if ( ! p.empty() ) + { + if ( p.front() == m_name ) + { + p.pop(); + if ( p.empty() ) + { + return kptTable; + } + } + } + return kptNotFound; +} + static rc_t CC KTextTableWhack ( KTable *bself ) diff --git a/libs/kdbtext/table.hpp b/libs/kdbtext/table.hpp index 5983ea16a..35ff83ad7 100644 --- a/libs/kdbtext/table.hpp +++ b/libs/kdbtext/table.hpp @@ -28,6 +28,7 @@ #include "../libs/kdb/table-base.h" +#include "path.hpp" #include "column.hpp" #include @@ -56,6 +57,8 @@ namespace KDBText const Column * getColumn( const std::string& name ) const; + int pathType( Path & ) const; + private: const KJsonObject * m_json = nullptr; std::string m_name; diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index ff7e5e241..4c2466026 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -32,6 +32,8 @@ #include "../../libs/kdbtext/database.hpp" +#include + #include #include @@ -124,7 +126,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementNull, KDBTextDatabase_Fixtu } FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementBad, KDBTextDatabase_Fixture) { - Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "notadatabase", "name":"subdb1"} ]})" ); + Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "NOTAdatabase", "name":"subdb1"} ]})" ); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; @@ -137,18 +139,93 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_Duplicate, KDBTextDatabase_Fixture //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_NotArray, KDBTextDatabase_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb", "tables":{"type":"table","name":"tbl"} })" ); + + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementNull, KDBTextDatabase_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb", "tables":[null] })" ); + + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementBad, KDBTextDatabase_Fixture) { - Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database", "name":"subdb1"} , {"type": "database", "name":"subdb2"} ]})" ); + Setup( R"({"type": "database", "name": "testdb", "tables":[{"type":"NOTAtable","name":"tbl"}] })" ); + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementDuplicate, KDBTextDatabase_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb", "tables":[{"type":"table","name":"tbl"},{"type":"table","name":"tbl"}] })" ); + + REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +const char * NestedDb = R"({"type": "database", "name": "testdb","databases":[ {"type": "database", "name":"subdb1"} , {"type": "database", "name":"subdb2","tables":[{"type": "table", "name": "tbl2-1"},{"type": "table", "name": "tbl2-2"}]} ], "tables":[{"type": "table", "name": "tbl0-1"},{"type": "table", "name": "tbl0-2"}]})"; + +FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); REQUIRE_NULL( m_db -> getDatabase( "notthere") ); REQUIRE_NOT_NULL( m_db -> getDatabase( "subdb1") ); REQUIRE_NOT_NULL( m_db -> getDatabase( "subdb2") ); + + REQUIRE_NULL( m_db -> getTable( "notthere") ); + REQUIRE_NOT_NULL( m_db -> getTable( "tbl0-1") ); + REQUIRE_NOT_NULL( m_db -> getTable( "tbl0-2") ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_pathType_empty, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "" ); + REQUIRE_EQ( (int)kptNotFound, m_db -> pathType( p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_pathType_miss, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "qq" ); + REQUIRE_EQ( (int)kptNotFound, m_db -> pathType( p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_pathType_self, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "testdb" ); + REQUIRE_EQ( (int)kptDatabase, m_db -> pathType( p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_pathType_nestedDb, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "testdb/db/subdb2" ); + REQUIRE_EQ( (int)kptDatabase, m_db -> pathType( p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_pathType_nestedTable, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "testdb/db/subdb2/tbl/tbl2-2" ); + REQUIRE_EQ( (int)kptTable, m_db -> pathType( p ) ); } -//TODO: tables, metadata, indexes +//TODO: metadata, indexes //////////////////////////////////////////// Main extern "C" diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index 54ad91573..5fc9b7026 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -173,12 +173,19 @@ FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db_Nested, KDBTextManager_Fixture) FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Table_Root, KDBTextManager_Fixture) { Setup( R"({"type": "table", "name": "tbl"})" ); - REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "tbl" ) ); + REQUIRE( KDBManagerExists( m_mgr, kptTable, "%s", "tbl" ) ); MakeVPath( "tbl"); REQUIRE_EQ( (int)kptTable, KDBManagerPathTypeVP( m_mgr, m_path ) ); } +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Table_Nested, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database","name":"subdb1"} , {"type": "database","name":"subdb2","tables":[{"type": "table", "name": "tbl1"},{"type": "table", "name": "tbl2"}]} ]})" ); + REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb1" ) ); + MakeVPath( "testdb/db/subdb2/tbl/tbl2"); + REQUIRE_EQ( (int)kptTable, KDBManagerPathTypeVP( m_mgr, m_path ) ); +} + //TODO: KDBManagerPathTypeVP on internal objects, to test interpretation of the path - // kptTable - internal // kptColumn, // kptIndex, // kptMetadata, From bb723aad4f3f19bbeac98e2af2eeb65a43fc3eb7 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 8 Dec 2023 13:30:17 -0500 Subject: [PATCH 10/42] VDB-5394 saving work --- libs/kdbtext/database.cpp | 83 +++++++++++++++++++++++-------- libs/kdbtext/database.hpp | 1 + libs/kdbtext/manager.cpp | 67 +++---------------------- libs/kdbtext/table.cpp | 18 +++++++ libs/kdbtext/table.hpp | 1 + test/kdbtext/test-database.cpp | 89 ++++++++++++++++++++++++++++++++-- test/kdbtext/test-manager.cpp | 70 +++++++++++++++++++++++--- test/kdbtext/test-table.cpp | 28 +++++++++++ 8 files changed, 264 insertions(+), 93 deletions(-) diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 9bf2d8c2f..73d9996cd 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -32,6 +32,7 @@ #include using namespace KDBText; +using namespace std; static rc_t CC KTextDatabaseWhack ( KTextDatabase *self ); // static bool CC KTextDatabaseLocked ( const KTextDatabase *self ); @@ -248,42 +249,82 @@ Database::inflate( char * error, size_t error_size ) int Database::pathType( Path & p ) const { - if ( ! p.empty() ) + if ( ! p.empty() && p.front() == m_name ) { - if ( p.front() == m_name ) + p.pop(); + if ( p.empty() ) + { + return kptDatabase; + } + if ( p.front() == "db" ) { p.pop(); - if ( p.empty() ) + if ( ! p.empty() ) { - return kptDatabase; + const Database * db = getDatabase( p.front() ); + if ( db != nullptr ) + { + return db->pathType( p ); + } } - if ( p.front() == "db" ) + } + else if ( p.front() == "tbl" ) + { + p.pop(); + if ( ! p.empty() ) { - p.pop(); - if ( ! p.empty() ) + const Table * t = getTable( p.front() ); + if ( t != nullptr ) { - const Database * db = getDatabase( p.front() ); - if ( db != nullptr ) - { - return db->pathType( p ); - } + return t -> pathType( p ); + } + } + } + } + return kptNotFound; +} + +bool +Database::exists( uint32_t requested, Path & path ) const +{ + if ( ! path.empty() && m_name == path.front() ) + { + path.pop(); + if ( path.empty() ) + { + return requested == kptDatabase; + } + + if ( string("db") == path.front() ) + { + path.pop(); + if ( ! path.empty() ) + { + const Database * db = getDatabase( path.front() ); + if ( db != nullptr ) + { + return db->exists( requested, path ); } } - else if ( p.front() == "tbl" ) + } + else if ( string("tbl") == path.front() ) + { + path.pop(); + if ( ! path.empty() ) { - p.pop(); - if ( ! p.empty() ) + const Table * tbl= getTable( path.front() ); + if ( tbl != nullptr ) { - const Table * t = getTable( p.front() ); - if ( t != nullptr ) - { - return t -> pathType( p ); - } + return tbl -> exists( requested, path ); } } } + // case kptIndex: + // case kptColumn: + // case kptMetadata: } - return kptNotFound; + + return false; } static diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index c143098b2..4204a5efe 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -61,6 +61,7 @@ namespace KDBText const Table * getTable( const std::string & name ) const; int pathType( Path & ) const; + bool exists( uint32_t requested, Path & p_path ) const; private: const KJsonObject * m_json = nullptr; diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index a20006940..85cff7209 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -100,7 +100,6 @@ Manager::parse( const char * input, char * error, size_t error_size ) int Manager::pathType( const string & p_path ) const { -//TODO: allow db/table/col etc. Path path( p_path ); if ( m_db != nullptr ) { @@ -116,71 +115,19 @@ Manager::pathType( const string & p_path ) const bool Manager::exists( uint32_t requested, const Path & p_path ) const { - // TODO: non-root dbs and other objects (incl root tables) Path path = p_path; - switch ( requested ) + if ( m_db != nullptr ) { - case kptDatabase: - { - const Database * db = m_db; - do - { - if ( db && ! path.empty() && db -> getName() == path.front() ) - { - path.pop(); - if ( path.empty() ) - { - return true; - } - - if ( string("db") == path.front() ) - { - path.pop(); - if ( ! path.empty() ) - { - db = db -> getDatabase( path.front() ); - } - else - { - return false; - } - } - else - { - return false; - } - } - else - { - return false; - } - } - while ( path . size () > 0 ); - return true; - } - - case kptTable: - return m_tbl != nullptr && path.size() == 1 && m_tbl -> getName() == path.front(); - - default: - return false; + return m_db -> exists( requested, path ); + } + if ( m_tbl != nullptr ) + { + return m_tbl -> exists( requested, path ); } - // int type; - - // type = KDBManagerVPathType (self, name, args); - // switch ( type ) - // { - // case kptDatabase: - // case kptTable: // case kptIndex: // case kptColumn: // case kptMetadata: - // break; - // case kptPrereleaseTbl: - // default: - // return false; - // } - // return requested == ( uint32_t ) type; + return false; } rc_t diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp index 23f25f2c3..419596354 100644 --- a/libs/kdbtext/table.cpp +++ b/libs/kdbtext/table.cpp @@ -208,6 +208,24 @@ Table::pathType( Path & p ) const return kptNotFound; } +bool +Table::exists( uint32_t requested, Path & path ) const +{ + if ( ! path.empty() && m_name == path.front() ) + { + path.pop(); + if ( path.empty() ) + { + return requested == kptTable; + } + // case kptIndex: + // case kptColumn: + // case kptMetadata: + } + + return false; +} + static rc_t CC KTextTableWhack ( KTable *bself ) diff --git a/libs/kdbtext/table.hpp b/libs/kdbtext/table.hpp index 35ff83ad7..9ffcf2b17 100644 --- a/libs/kdbtext/table.hpp +++ b/libs/kdbtext/table.hpp @@ -58,6 +58,7 @@ namespace KDBText const Column * getColumn( const std::string& name ) const; int pathType( Path & ) const; + bool exists( uint32_t requested, Path & p_path ) const; private: const KJsonObject * m_json = nullptr; diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index 4c2466026..6dec581b3 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -112,7 +112,9 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Flat, KDBTextDatabase_Fixture) FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_NotArray, KDBTextDatabase_Fixture) { - Setup(R"({"type": "database", "name": "testdb","databases":{"type": "database", "name":"subdb1"} })"); + Setup(R"({"type": "database", "name": "testdb", + "databases":{"type": "database", "name":"subdb1"} + })"); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; @@ -126,14 +128,21 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementNull, KDBTextDatabase_Fixtu } FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementBad, KDBTextDatabase_Fixture) { - Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "NOTAdatabase", "name":"subdb1"} ]})" ); + Setup( R"({"type": "database", "name": "testdb", + "databases":[ {"type": "NOTAdatabase", "name":"subdb1"} ] + })" ); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_Duplicate, KDBTextDatabase_Fixture) { - Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database", "name":"subdb1"} , {"type": "database", "name":"subdb1"} ]})" ); + Setup( R"({"type": "database", "name": "testdb", + "databases":[ + {"type": "database", "name":"subdb1"} , + {"type": "database", "name":"subdb1"} + ] + })" ); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; @@ -162,13 +171,33 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementBad, KDBTextDatabase_Fixtur } FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementDuplicate, KDBTextDatabase_Fixture) { - Setup( R"({"type": "database", "name": "testdb", "tables":[{"type":"table","name":"tbl"},{"type":"table","name":"tbl"}] })" ); + Setup( R"({"type": "database", "name": "testdb", + "tables":[ + {"type":"table","name":"tbl"}, + {"type":"table","name":"tbl"} + ] + })" ); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -const char * NestedDb = R"({"type": "database", "name": "testdb","databases":[ {"type": "database", "name":"subdb1"} , {"type": "database", "name":"subdb2","tables":[{"type": "table", "name": "tbl2-1"},{"type": "table", "name": "tbl2-2"}]} ], "tables":[{"type": "table", "name": "tbl0-1"},{"type": "table", "name": "tbl0-2"}]})"; +const char * NestedDb = R"({ + "type": "database", + "name": "testdb", + "databases":[ + {"type": "database", "name":"subdb1"}, + {"type": "database", "name":"subdb2","tables":[ + {"type": "table", "name": "tbl2-1"}, + {"type": "table", "name": "tbl2-2"} + ] + } + ], + "tables":[ + {"type": "table", "name": "tbl0-1"}, + {"type": "table", "name": "tbl0-2"} + ] +})"; FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) { @@ -227,6 +256,56 @@ FIXTURE_TEST_CASE(KDBTextDatabase_pathType_nestedTable, KDBTextDatabase_Fixture) //TODO: metadata, indexes +FIXTURE_TEST_CASE(KDBTextDatabase_exists_empty, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "" ); + REQUIRE( ! m_db -> exists( kptDatabase, p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Not, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "notadb" ); + REQUIRE( ! m_db -> exists( kptDatabase, p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_WrongType, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "testdb" ); + REQUIRE( ! m_db -> exists( kptTable, p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Root, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "testdb" ); + REQUIRE( m_db -> exists( kptDatabase, p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Nested, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "testdb/db/subdb2" ); + REQUIRE( m_db -> exists( kptDatabase, p ) ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_exists_Table, KDBTextDatabase_Fixture) +{ + Setup( NestedDb ); + REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + + Path p( "testdb/db/subdb2/tbl/tbl2-1" ); + REQUIRE( m_db -> exists( kptTable, p ) ); +} +//TODO: metadata, indexes (?) + //////////////////////////////////////////// Main extern "C" { diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index 5fc9b7026..19f89966f 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -125,13 +125,42 @@ FIXTURE_TEST_CASE(KDBTextManager_Db_Exists, KDBTextManager_Fixture) Setup( R"({"type": "database", "name": "testdb"})" ); REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb" ) ); } + +FIXTURE_TEST_CASE(KDBTextManager_SubDb_Exists_Not, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + REQUIRE( ! KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb1" ) ); +} FIXTURE_TEST_CASE(KDBTextManager_SubDb_Exists, KDBTextManager_Fixture) { - Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database","name":"subdb1"} , {"type": "database","name":"subdb2"} ]})" ); + Setup( R"({"type": "database","name": "testdb", + "databases":[ + {"type": "database","name":"subdb1"} , + {"type": "database","name":"subdb2"} + ] + })"); REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb1" ) ); REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb2" ) ); } +FIXTURE_TEST_CASE(KDBTextManager_Table_Exists_Not, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + REQUIRE( ! KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/tbl/tbl1" ) ); +} +FIXTURE_TEST_CASE(KDBTextManager_Table_Exists, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database","name": "testdb", + "tables":[ + {"type": "table", "name": "tbl1"}, + {"type": "table", "name": "tbl2"} + ] + })" ); + REQUIRE( KDBManagerExists( m_mgr, kptTable, "%s", "testdb/tbl/tbl1" ) ); +} + +//TODO: table, index, column, metadata + FIXTURE_TEST_CASE(KDBTextManager_Writable_Found, KDBTextManager_Fixture) { // for now, any path will be reported as readonly Setup( R"({"type": "database", "name": "testdb"})" ); @@ -165,26 +194,53 @@ FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db, KDBTextManager_Fixture) } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db_Nested, KDBTextManager_Fixture) { - Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database","name":"subdb1"} , {"type": "database","name":"subdb2"} ]})" ); - REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb1" ) ); + Setup( R"({ + "type": "database", + "name": "testdb", + "databases":[ + {"type": "database","name":"subdb1"}, + {"type": "database","name":"subdb2"} + ] + })" ); MakeVPath( "testdb/db/subdb2"); REQUIRE_EQ( (int)kptDatabase, KDBManagerPathTypeVP( m_mgr, m_path ) ); } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Table_Root, KDBTextManager_Fixture) { Setup( R"({"type": "table", "name": "tbl"})" ); - REQUIRE( KDBManagerExists( m_mgr, kptTable, "%s", "tbl" ) ); MakeVPath( "tbl"); REQUIRE_EQ( (int)kptTable, KDBManagerPathTypeVP( m_mgr, m_path ) ); } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Table_Nested, KDBTextManager_Fixture) { - Setup( R"({"type": "database", "name": "testdb","databases":[ {"type": "database","name":"subdb1"} , {"type": "database","name":"subdb2","tables":[{"type": "table", "name": "tbl1"},{"type": "table", "name": "tbl2"}]} ]})" ); - REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb1" ) ); + Setup( R"({ + "type": "database", + "name": "testdb", + "databases": [ + {"type": "database","name":"subdb1"}, + {"type": "database","name":"subdb2","tables":[ + {"type": "table", "name": "tbl1"}, + {"type": "table", "name": "tbl2"} + ]} + ] + })" ); MakeVPath( "testdb/db/subdb2/tbl/tbl2"); REQUIRE_EQ( (int)kptTable, KDBManagerPathTypeVP( m_mgr, m_path ) ); } +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_NotFound, KDBTextManager_Fixture) +{ + Setup( R"({ "type": "table", "name": "tbl1", "columns":[{"name":"col"}] })" ); + MakeVPath( "testdb/db/subdb2/tbl/tbl2"); + REQUIRE_EQ( (int)kptNotFound, KDBManagerPathTypeVP( m_mgr, m_path ) ); +} +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_RootTable, KDBTextManager_Fixture) +{ +} +FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_Db, KDBTextManager_Fixture) +{ +} + //TODO: KDBManagerPathTypeVP on internal objects, to test interpretation of the path // kptColumn, // kptIndex, @@ -267,7 +323,7 @@ FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead, KDBTextManager_Fixture) REQUIRE_RC( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/col/qq" ) ); REQUIRE_NOT_NULL( m_col ); } -//TODO: non-root tables +//TODO: columns in non-root tables FIXTURE_TEST_CASE(KDBManager_VPathOpenLocalDBRead, KDBTextManager_Fixture) { diff --git a/test/kdbtext/test-table.cpp b/test/kdbtext/test-table.cpp index b8c8d291f..811cc0573 100644 --- a/test/kdbtext/test-table.cpp +++ b/test/kdbtext/test-table.cpp @@ -32,6 +32,8 @@ #include "../../libs/kdbtext/table.hpp" +#include + #include #include @@ -140,6 +142,32 @@ FIXTURE_TEST_CASE(KDBTextTable_Make_WithColumns, KDBTextTable_Fixture) //TODO: columns, metadata, indexes +FIXTURE_TEST_CASE(KDBTextTable_exists_empty, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table", "name": "testtbl"})"); + REQUIRE_RC( m_tbl-> inflate( m_error, sizeof m_error ) ); + + Path p( "" ); + REQUIRE( ! m_tbl -> exists( kptTable, p ) ); +} +FIXTURE_TEST_CASE(KDBTextTable_exists_WrongType, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table", "name": "testtbl"})"); + REQUIRE_RC( m_tbl-> inflate( m_error, sizeof m_error ) ); + + Path p( "testtbl" ); + REQUIRE( ! m_tbl -> exists( kptDatabase, p ) ); +} +FIXTURE_TEST_CASE(KDBTextTable_exists, KDBTextTable_Fixture) +{ + Setup(R"({"type": "table", "name": "testtbl"})"); + REQUIRE_RC( m_tbl-> inflate( m_error, sizeof m_error ) ); + + Path p( "testtbl" ); + REQUIRE( m_tbl -> exists( kptTable, p ) ); +} +//TODO: columns, metadata, indexes + //////////////////////////////////////////// Main extern "C" { From 3803cd2aecd2c95838b42b8d6f89d4e6b6956d6f Mon Sep 17 00:00:00 2001 From: Alexander Ukrainchik Date: Mon, 11 Dec 2023 17:46:06 -0500 Subject: [PATCH 11/42] VDB-5492 fixing a wrong initialization --- libs/kns/stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/kns/stream.c b/libs/kns/stream.c index fa8ea31a1..5cbfd7f8c 100644 --- a/libs/kns/stream.c +++ b/libs/kns/stream.c @@ -418,7 +418,7 @@ LIB_EXPORT rc_t CC KStreamReadExactly ( const KStream *self, LIB_EXPORT rc_t CC KStreamTimedReadExactly ( const KStream *self, void *buffer, size_t bytes, struct timeout_t *tm ) { - rc_t rc; + rc_t rc = 0; uint8_t *b; size_t total, count; @@ -487,7 +487,7 @@ LIB_EXPORT rc_t CC KStreamTimedReadExactly ( const KStream *self, return RC ( rcNS, rcStream, rcReading, rcInterface, rcBadVersion ); } - return rc = 0; + return rc; } /* Write From efabc26275a8042d62eac8208a9012d1dff4c7b1 Mon Sep 17 00:00:00 2001 From: Alexander Ukrainchik Date: Tue, 12 Dec 2023 13:40:45 -0500 Subject: [PATCH 12/42] VDB-5492 suppressing windows winsock deprecated warnings because old functions work just fine --- libs/kns/win/sysendpoint.c | 12 ++++++++++++ libs/kns/win/syssock.c | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/libs/kns/win/sysendpoint.c b/libs/kns/win/sysendpoint.c index f9291118b..fc05ad15c 100644 --- a/libs/kns/win/sysendpoint.c +++ b/libs/kns/win/sysendpoint.c @@ -24,6 +24,12 @@ * */ +#ifdef _WINSOCK_DEPRECATED_NO_WARNINGS +#define WINSOCK_DEP_NO_WARN_WAS_DEFINED 1 +#else +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif + #include #include #include @@ -154,3 +160,9 @@ rc_t CC KNSManagerInitDNSEndpoint ( struct KNSManager const *self, return rc; } + +#ifdef WINSOCK_DEP_NO_WARN_WAS_DEFINED +#undef WINSOCK_DEP_NO_WARN_WAS_DEFINED +#else +#undef _WINSOCK_DEPRECATED_NO_WARNINGS +#endif diff --git a/libs/kns/win/syssock.c b/libs/kns/win/syssock.c index 1d798c61e..098601e6f 100644 --- a/libs/kns/win/syssock.c +++ b/libs/kns/win/syssock.c @@ -24,6 +24,11 @@ * */ +#ifdef _WINSOCK_DEPRECATED_NO_WARNINGS +#define WINSOCK_DEP_NO_WARN_WAS_DEFINED 1 +#else +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif /*-------------------------------------------------------------------------- * forwards @@ -2446,3 +2451,8 @@ static rc_t HandleErrnoEx ( const char *func_name, unsigned int lineno, rc_t rc_ return rc; } +#ifdef WINSOCK_DEP_NO_WARN_WAS_DEFINED +#undef WINSOCK_DEP_NO_WARN_WAS_DEFINED +#else +#undef _WINSOCK_DEPRECATED_NO_WARNINGS +#endif From 3fb7d5999f2d7682f03cd585a09f1665b7f28285 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Thu, 14 Dec 2023 13:14:25 -0500 Subject: [PATCH 13/42] VDB-5394 done --- libs/kdbtext/CMakeLists.txt | 2 + libs/kdbtext/api.cpp | 10 +-- libs/kdbtext/database.cpp | 81 ++++++++++++++--- libs/kdbtext/database.hpp | 8 +- libs/kdbtext/index.cpp | 134 +++++++++++++++++++++++++++++ libs/kdbtext/index.hpp | 58 +++++++++++++ libs/kdbtext/manager.cpp | 75 +++++----------- libs/kdbtext/manager.hpp | 3 +- libs/kdbtext/metadata.cpp | 134 +++++++++++++++++++++++++++++ libs/kdbtext/metadata.hpp | 58 +++++++++++++ libs/kdbtext/table.cpp | 83 +++++++++++++++++- libs/kdbtext/table.hpp | 3 + test/kdbtext/CMakeLists.txt | 13 +-- test/kdbtext/test-database.cpp | 106 ++++++++++++----------- test/kdbtext/test-index.cpp | 117 +++++++++++++++++++++++++ test/kdbtext/test-manager.cpp | 153 ++++++++++++++++----------------- test/kdbtext/test-metadata.cpp | 117 +++++++++++++++++++++++++ test/kdbtext/test-table.cpp | 59 +++++++++---- 18 files changed, 986 insertions(+), 228 deletions(-) create mode 100644 libs/kdbtext/index.cpp create mode 100644 libs/kdbtext/index.hpp create mode 100644 libs/kdbtext/metadata.cpp create mode 100644 libs/kdbtext/metadata.hpp create mode 100644 test/kdbtext/test-index.cpp create mode 100644 test/kdbtext/test-metadata.cpp diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt index 99b04dfcb..55b77cd88 100644 --- a/libs/kdbtext/CMakeLists.txt +++ b/libs/kdbtext/CMakeLists.txt @@ -28,7 +28,9 @@ set( KDBTEXT_SRC database.cpp table.cpp column.cpp + index.cpp path.cpp + metadata.cpp ) GenerateStaticLibs( kdbtext "${KDBTEXT_SRC}" ) diff --git a/libs/kdbtext/api.cpp b/libs/kdbtext/api.cpp index 01bf838f9..b78561483 100644 --- a/libs/kdbtext/api.cpp +++ b/libs/kdbtext/api.cpp @@ -248,14 +248,8 @@ KTextManagerOpenTableReadVPath(const KDBManager *bself, const KTable **p_tbl, co static rc_t CC KTextManagerVOpenColumnRead ( const KDBManager *bself, const KColumn **p_col, const char *fmt, va_list args ) -{ - CAST(); - - const Column * col = nullptr; - rc_t rc = self -> openColumn( Path( fmt, args ), col ); - *p_col = (const KColumn *)col; - - return rc; +{ // not supported here + return SILENT_RC ( rcDB, rcMgr, rcAccessing, rcColumn, rcUnsupported ); } static diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 73d9996cd..612e579a0 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -85,11 +85,11 @@ Database::~Database() } const Database * -Database::getDatabase( const std::string & name ) const -{ +Database::findDatabase( const string & p_name ) const +{ // shallow search for a db for( auto & d : m_subdbs ) { - if ( name == d.getName() ) + if ( p_name == d.getName() ) { return & d; } @@ -98,8 +98,8 @@ Database::getDatabase( const std::string & name ) const } const Table * -Database::getTable( const std::string & name ) const -{ +Database::findTable( const std::string & name ) const +{ // shallow search for a table for( auto & d : m_tables ) { if ( name == d.getName() ) @@ -110,6 +110,65 @@ Database::getTable( const std::string & name ) const return nullptr; } +const Database * +Database::getDatabase( Path & p_path ) const +{ + if ( ! p_path.empty() && p_path.front() == m_name ) + { + p_path.pop(); + if ( p_path.empty() ) + { + return this; + } + if ( p_path.front() == "db" ) + { + p_path.pop(); + if ( ! p_path.empty() ) + { + const Database * db = findDatabase( p_path.front() ); + if ( db != nullptr ) + { + return db -> getDatabase( p_path ); + } + } + } + } + return nullptr; +} + +const Table * +Database::getTable( Path & p_path ) const +{ + if ( ! p_path.empty() && p_path.front() == m_name ) + { + p_path.pop(); + if ( ! p_path.empty() ) + { + if ( p_path.front() == "tbl" ) + { + p_path.pop(); + if ( ! p_path.empty() ) + { + return findTable( p_path.front() ); + } + } + else if ( p_path.front() == "db" ) + { + p_path.pop(); + if ( ! p_path.empty() ) + { + const Database * db = findDatabase( p_path.front() ); + if ( db != nullptr ) + { + return db -> getTable( p_path ); + } + } + } + } + } + return nullptr; +} + rc_t Database::inflate( char * error, size_t error_size ) { @@ -190,7 +249,7 @@ Database::inflate( char * error, size_t error_size ) return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } } - m_subdbs .push_back( subdb ); + m_subdbs . push_back( subdb ); } else { // not an object @@ -261,7 +320,7 @@ Database::pathType( Path & p ) const p.pop(); if ( ! p.empty() ) { - const Database * db = getDatabase( p.front() ); + const Database * db = findDatabase( p.front() ); if ( db != nullptr ) { return db->pathType( p ); @@ -273,7 +332,7 @@ Database::pathType( Path & p ) const p.pop(); if ( ! p.empty() ) { - const Table * t = getTable( p.front() ); + const Table * t = findTable( p.front() ); if ( t != nullptr ) { return t -> pathType( p ); @@ -300,7 +359,7 @@ Database::exists( uint32_t requested, Path & path ) const path.pop(); if ( ! path.empty() ) { - const Database * db = getDatabase( path.front() ); + const Database * db = findDatabase( path.front() ); if ( db != nullptr ) { return db->exists( requested, path ); @@ -312,15 +371,13 @@ Database::exists( uint32_t requested, Path & path ) const path.pop(); if ( ! path.empty() ) { - const Table * tbl= getTable( path.front() ); + const Table * tbl= findTable( path.front() ); if ( tbl != nullptr ) { return tbl -> exists( requested, path ); } } } - // case kptIndex: - // case kptColumn: // case kptMetadata: } diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index 4204a5efe..2857f1c58 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -57,13 +57,17 @@ namespace KDBText const std::string & getName() const { return m_name; } - const Database * getDatabase( const std::string & name ) const; - const Table * getTable( const std::string & name ) const; + const Database * getDatabase( Path & path ) const; + const Database * findDatabase( const std::string & name ) const; + + const Table * getTable( Path & path ) const; + const Table * findTable( const std::string & name ) const; int pathType( Path & ) const; bool exists( uint32_t requested, Path & p_path ) const; private: + const KJsonObject * m_json = nullptr; std::string m_name; std::vector m_subdbs; diff --git a/libs/kdbtext/index.cpp b/libs/kdbtext/index.cpp new file mode 100644 index 000000000..473c39389 --- /dev/null +++ b/libs/kdbtext/index.cpp @@ -0,0 +1,134 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "index.hpp" + +#include + +#include + +using namespace KDBText; + +static rc_t KTextIndexWhack ( KIndex *self ); +// static bool CC KTextIndexLocked ( const KIndex *self ); +// static bool CC KTextIndexVExists ( const KIndex *self, uint32_t type, const char *name, va_list args ); +// static bool CC KTextIndexIsAlias ( const KIndex *self, uint32_t type, char *resolved, size_t rsize, const char *name ); +// static rc_t CC KTextIndexVWritable ( const KIndex *self, uint32_t type, const char *name, va_list args ); +// static rc_t CC KTextIndexOpenManagerRead ( const KIndex *self, const KDBManager **mgr ); +// static rc_t CC KTextIndexOpenParentRead ( const KIndex *self, const KDatabase **db ); +// static bool CC KTextIndexHasRemoteData ( const KIndex *self ); +// static rc_t CC KTextIndexOpenDirectoryRead ( const KIndex *self, const KDirectory **dir ); +// static rc_t CC KTextIndexVOpenColumnRead ( const KIndex *self, const KColumn **colp, const char *name, va_list args ); +// static rc_t CC KTextIndexOpenMetadataRead ( const KIndex *self, const KMetadata **metap ); +// static rc_t CC KTextIndexVOpenIndexRead ( const KIndex *self, const KIndex **idxp, const char *name, va_list args ); +// static rc_t CC KTextIndexGetPath ( const KIndex *self, const char **path ); +// static rc_t CC KTextIndexGetName (KIndex const *self, char const **rslt); +// static rc_t CC KTextIndexListCol ( const KIndex *self, KNamelist **names ); +// static rc_t CC KTextIndexListIdx ( const KIndex *self, KNamelist **names ); +// static rc_t CC KTextIndexMetaCompare( const KIndex *self, const KIndex *other, const char * path, bool * equal ); + +static KIndex_vt KTextIndex_vt = +{ + KTextIndexWhack, + KIndexBaseAddRef, + KIndexBaseRelease, + // KTextIndexLocked, + // KTextIndexVExists, + // KTextIndexIsAlias, + // KTextIndexVWritable, + // KTextIndexOpenManagerRead, + // KTextIndexOpenParentRead, + // KTextIndexHasRemoteData, + // KTextIndexOpenDirectoryRead, + // KTextIndexVOpenColumnRead, + // KTextIndexOpenMetadataRead, + // KTextIndexVOpenIndexRead, + // KTextIndexGetPath, + // KTextIndexGetName, + // KTextIndexListCol, + // KTextIndexListIdx, + // KTextIndexMetaCompare +}; + +#define CAST() assert( bself->vt == &KTextIndex_vt ); Index * self = (Index *)bself + +Index::Index( const KJsonObject * p_json ) : m_json ( p_json ) +{ + dad . vt = & KTextIndex_vt; + KRefcountInit ( & dad . refcount, 1, "KDBText::Index", "ctor", "db" ); +} + +Index::~Index() +{ + KRefcountWhack ( & dad . refcount, "KDBText::Index" ); +} + +rc_t +Index::inflate( char * error, size_t error_size ) +{ + rc_t rc = 0; + + const KJsonValue * name = KJsonObjectGetMember ( m_json, "name" ); + if ( name != nullptr ) + { + const char * nameStr = nullptr; + rc = KJsonGetString ( name, & nameStr ); + if ( rc == 0 ) + { + m_name = nameStr; + } + } + else + { + string_printf ( error, error_size, nullptr, "Index name is missing" ); + return SILENT_RC( rcDB, rcIndex, rcCreating, rcParam, rcInvalid ); + } + + // const KJsonValue * type = KJsonObjectGetMember ( m_json, "type" ); + // if ( type != nullptr ) + // { + // const char * typeStr = nullptr; + // rc = KJsonGetString ( type, & typeStr ); + // //TBD + // } + // else + // { + // string_printf ( error, error_size, nullptr, "%s.type is missing", m_name.c_str() ); + // return SILENT_RC( rcDB, rcIndex, rcCreating, rcParam, rcInvalid ); + // } + + return rc; +} + +static +rc_t CC +KTextIndexWhack ( KIndex *bself ) +{ + CAST(); + + delete reinterpret_cast( self ); + return 0; +} \ No newline at end of file diff --git a/libs/kdbtext/index.hpp b/libs/kdbtext/index.hpp new file mode 100644 index 000000000..6e96389fe --- /dev/null +++ b/libs/kdbtext/index.hpp @@ -0,0 +1,58 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#pragma once + +#include "../libs/kdb/index-base.h" + +#include +#include + +#include + +typedef struct KTextIndex KTextIndex; +struct KTextIndex +{ + KIndex dad; +}; + +namespace KDBText +{ + class Index : public KTextIndex + { + public: + Index( const KJsonObject * p_json ); + ~Index(); + + rc_t inflate( char * error, size_t error_size ); + + const std::string & getName() const { return m_name; } + + private: + const KJsonObject * m_json = nullptr; + std::string m_name; + }; +} diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index 85cff7209..203136cb4 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -98,7 +98,7 @@ Manager::parse( const char * input, char * error, size_t error_size ) } int -Manager::pathType( const string & p_path ) const +Manager::pathType( const Path & p_path ) const { Path path( p_path ); if ( m_db != nullptr ) @@ -124,8 +124,6 @@ Manager::exists( uint32_t requested, const Path & p_path ) const { return m_tbl -> exists( requested, path ); } - // case kptIndex: - // case kptColumn: // case kptMetadata: return false; } @@ -133,20 +131,8 @@ Manager::exists( uint32_t requested, const Path & p_path ) const rc_t Manager::writable( const Path & p_path ) const { - if ( ! p_path.empty() ) - { - //TODO: parse and resolve the path, if the object is valid return rcReadOnly, otherwise rcNotFound - if ( m_db && m_db -> getName() == p_path.front() ) - { - return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); - } - if ( m_tbl && m_tbl -> getName() == p_path.front() ) - { - return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ); - } - } - - return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, rcNotFound ); + //if the object is valid return rcReadOnly, otherwise rcNotFound + return SILENT_RC ( rcDB, rcPath, rcAccessing, rcPath, pathType( p_path ) != kptNotFound ? rcReadonly : rcNotFound ); } rc_t @@ -154,16 +140,20 @@ Manager::openDatabase( const Path & p_path, const Database *& p_db ) const { if ( ! p_path.empty() ) { - // TODO: non-root dbs - if ( m_db && m_db -> getName() == p_path.front() ) + if ( m_db ) { - rc_t rc = KDatabaseAddRef( (const KDatabase *)m_db ); - if ( rc != 0 ) + Path path ( p_path ); + const Database * db = m_db -> getDatabase( path ); + if ( db != nullptr ) { - return rc; + rc_t rc = KDatabaseAddRef( (const KDatabase *)db ); + if ( rc != 0 ) + { + return rc; + } + p_db = db; + return 0; } - p_db = m_db; - return 0; } } return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); @@ -174,7 +164,6 @@ Manager::openTable( const Path & p_path, const Table *& p_tbl ) const { if ( ! p_path.empty() ) { - // TODO: non-root tables if ( m_tbl && m_tbl -> getName() == p_path.front() ) { rc_t rc = KTableAddRef( (const KTable *)m_tbl ); @@ -185,37 +174,19 @@ Manager::openTable( const Path & p_path, const Table *& p_tbl ) const p_tbl = m_tbl; return 0; } - } - return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); -} - -rc_t -Manager::openColumn( const Path & p_path, const Column *& p_col) const -{ - if ( ! p_path.empty() ) - { - // TODO: non-root tables - if ( ! p_path.empty() && m_tbl && m_tbl -> getName() == p_path.front() ) + if ( m_db ) { - Path path = p_path; - path.pop(); - if ( ! path.empty() && path.front() == "col" ) + Path path ( p_path ); + const Table * tbl = m_db -> getTable( path ); + if ( tbl != nullptr ) { - path.pop(); - if ( ! path.empty() ) + rc_t rc = KTableAddRef( (const KTable *)tbl ); + if ( rc != 0 ) { - const Column* col = m_tbl -> getColumn( path.front() ); - if ( col != nullptr ) - { - rc_t rc = KColumnAddRef( (const KColumn *)col ); - if ( rc != 0 ) - { - return rc; - } - p_col = col; - return 0; - } + return rc; } + p_tbl = tbl; + return 0; } } } diff --git a/libs/kdbtext/manager.hpp b/libs/kdbtext/manager.hpp index 61650c365..a0f834e77 100644 --- a/libs/kdbtext/manager.hpp +++ b/libs/kdbtext/manager.hpp @@ -47,7 +47,7 @@ namespace KDBText const Database * getRootDatabase() const { return m_db; } const Table * getRootTable() const { return m_tbl; } - int pathType( const std::string & path ) const; + int pathType( const Path & path ) const; bool exists( uint32_t requested, const Path & ) const; @@ -55,7 +55,6 @@ namespace KDBText rc_t openDatabase( const Path &, const Database *& ) const; rc_t openTable( const Path &, const Table *& ) const; - rc_t openColumn( const Path &, const Column *& ) const; private: KJsonValue * m_root = nullptr; diff --git a/libs/kdbtext/metadata.cpp b/libs/kdbtext/metadata.cpp new file mode 100644 index 000000000..72005ed38 --- /dev/null +++ b/libs/kdbtext/metadata.cpp @@ -0,0 +1,134 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "metadata.hpp" + +#include + +#include + +using namespace KDBText; + +static rc_t KTextMetadataWhack ( KMetadata *self ); +// static bool CC KTextMetadataLocked ( const KMetadata *self ); +// static bool CC KTextMetadataVExists ( const KMetadata *self, uint32_t type, const char *name, va_list args ); +// static bool CC KTextMetadataIsAlias ( const KMetadata *self, uint32_t type, char *resolved, size_t rsize, const char *name ); +// static rc_t CC KTextMetadataVWritable ( const KMetadata *self, uint32_t type, const char *name, va_list args ); +// static rc_t CC KTextMetadataOpenManagerRead ( const KMetadata *self, const KDBManager **mgr ); +// static rc_t CC KTextMetadataOpenParentRead ( const KMetadata *self, const KDatabase **db ); +// static bool CC KTextMetadataHasRemoteData ( const KMetadata *self ); +// static rc_t CC KTextMetadataOpenDirectoryRead ( const KMetadata *self, const KDirectory **dir ); +// static rc_t CC KTextMetadataVOpenColumnRead ( const KMetadata *self, const KColumn **colp, const char *name, va_list args ); +// static rc_t CC KTextMetadataOpenMetadataRead ( const KMetadata *self, const KMetadata **metap ); +// static rc_t CC KTextMetadataVOpenMetadataRead ( const KMetadata *self, const KMetadata **idxp, const char *name, va_list args ); +// static rc_t CC KTextMetadataGetPath ( const KMetadata *self, const char **path ); +// static rc_t CC KTextMetadataGetName (KMetadata const *self, char const **rslt); +// static rc_t CC KTextMetadataListCol ( const KMetadata *self, KNamelist **names ); +// static rc_t CC KTextMetadataListIdx ( const KMetadata *self, KNamelist **names ); +// static rc_t CC KTextMetadataMetaCompare( const KMetadata *self, const KMetadata *other, const char * path, bool * equal ); + +static KMetadata_vt KTextMetadata_vt = +{ + KTextMetadataWhack, + KMetadataBaseAddRef, + KMetadataBaseRelease, + // KTextMetadataLocked, + // KTextMetadataVExists, + // KTextMetadataIsAlias, + // KTextMetadataVWritable, + // KTextMetadataOpenManagerRead, + // KTextMetadataOpenParentRead, + // KTextMetadataHasRemoteData, + // KTextMetadataOpenDirectoryRead, + // KTextMetadataVOpenColumnRead, + // KTextMetadataOpenMetadataRead, + // KTextMetadataVOpenMetadataRead, + // KTextMetadataGetPath, + // KTextMetadataGetName, + // KTextMetadataListCol, + // KTextMetadataListIdx, + // KTextMetadataMetaCompare +}; + +#define CAST() assert( bself->vt == &KTextMetadata_vt ); Metadata * self = (Metadata *)bself + +Metadata::Metadata( const KJsonObject * p_json ) : m_json ( p_json ) +{ + dad . vt = & KTextMetadata_vt; + KRefcountInit ( & dad . refcount, 1, "KDBText::Metadata", "ctor", "db" ); +} + +Metadata::~Metadata() +{ + KRefcountWhack ( & dad . refcount, "KDBText::Metadata" ); +} + +rc_t +Metadata::inflate( char * error, size_t error_size ) +{ + rc_t rc = 0; + + const KJsonValue * name = KJsonObjectGetMember ( m_json, "name" ); + if ( name != nullptr ) + { + const char * nameStr = nullptr; + rc = KJsonGetString ( name, & nameStr ); + if ( rc == 0 ) + { + m_name = nameStr; + } + } + else + { + string_printf ( error, error_size, nullptr, "Metadata name is missing" ); + return SILENT_RC( rcDB, rcMetadata, rcCreating, rcParam, rcInvalid ); + } + + // const KJsonValue * type = KJsonObjectGetMember ( m_json, "type" ); + // if ( type != nullptr ) + // { + // const char * typeStr = nullptr; + // rc = KJsonGetString ( type, & typeStr ); + // //TBD + // } + // else + // { + // string_printf ( error, error_size, nullptr, "%s.type is missing", m_name.c_str() ); + // return SILENT_RC( rcDB, rcMetadata, rcCreating, rcParam, rcInvalid ); + // } + + return rc; +} + +static +rc_t CC +KTextMetadataWhack ( KMetadata *bself ) +{ + CAST(); + + delete reinterpret_cast( self ); + return 0; +} \ No newline at end of file diff --git a/libs/kdbtext/metadata.hpp b/libs/kdbtext/metadata.hpp new file mode 100644 index 000000000..ce8c469ff --- /dev/null +++ b/libs/kdbtext/metadata.hpp @@ -0,0 +1,58 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#pragma once + +#include "../libs/kdb/meta-base.h" + +#include +#include + +#include + +typedef struct KTextMetadata KTextMetadata; +struct KTextMetadata +{ + KMetadata dad; +}; + +namespace KDBText +{ + class Metadata : public KTextMetadata + { + public: + Metadata( const KJsonObject * p_json ); + ~Metadata(); + + rc_t inflate( char * error, size_t error_size ); + + const std::string & getName() const { return m_name; } + + private: + const KJsonObject * m_json = nullptr; + std::string m_name; + }; +} diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp index 419596354..4306d33f9 100644 --- a/libs/kdbtext/table.cpp +++ b/libs/kdbtext/table.cpp @@ -99,6 +99,19 @@ Table::getColumn( const std::string & name ) const return nullptr; } +const Index * +Table::getIndex( const std::string & name ) const +{ + for( auto & c : m_indexes ) + { + if ( name == c.getName() ) + { + return & c; + } + } + return nullptr; +} + rc_t Table::inflate( char * error, size_t error_size ) { @@ -146,10 +159,10 @@ Table::inflate( char * error, size_t error_size ) } // Columns - const KJsonValue * dbs = KJsonObjectGetMember ( m_json, "columns" ); - if ( dbs != nullptr ) + const KJsonValue * columns = KJsonObjectGetMember ( m_json, "columns" ); + if ( columns != nullptr ) { - const KJsonArray * colarr = KJsonValueToArray ( dbs ); + const KJsonArray * colarr = KJsonValueToArray ( columns ); if ( colarr == nullptr ) { string_printf ( error, error_size, nullptr, "%s.columns is not an array", m_name.c_str() ); @@ -188,6 +201,51 @@ Table::inflate( char * error, size_t error_size ) } } } + + // Indexes + const KJsonValue * indexes = KJsonObjectGetMember ( m_json, "indexes" ); + if ( indexes != nullptr ) + { + const KJsonArray * idxarr = KJsonValueToArray ( indexes ); + if ( idxarr == nullptr ) + { + string_printf ( error, error_size, nullptr, "%s.indexes is not an array", m_name.c_str() ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); + } + + uint32_t len = KJsonArrayGetLength ( idxarr ); + for ( uint32_t i = 0; i < len; ++i ) + { + const KJsonValue * v = KJsonArrayGetElement ( idxarr, i ); + assert( v != nullptr ); + const KJsonObject * obj = KJsonValueToObject ( v ); + if( obj != nullptr ) + { + Index idx( obj ); + rc = idx . inflate ( error, error_size ); + if ( rc != 0 ) + { + return rc; + } + + for( auto & d : m_indexes ) + { + if ( idx.getName() == d.getName() ) + { + string_printf ( error, error_size, nullptr, "Duplicate index: %s", idx.getName().c_str() ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); + } + } + m_indexes .push_back( idx ); + } + else + { // not an object + string_printf ( error, error_size, nullptr, "%s.indexes[%i] is not an object", m_name.c_str(), i ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); + } + } + } + return rc; } @@ -203,6 +261,15 @@ Table::pathType( Path & p ) const { return kptTable; } + if ( p.front() == "col" ) + { + p.pop(); + if ( ! p.empty() && getColumn( p.front() ) != nullptr ) + { + return kptColumn; + } + } + //else TODO: index, metadata } } return kptNotFound; @@ -218,7 +285,15 @@ Table::exists( uint32_t requested, Path & path ) const { return requested == kptTable; } - // case kptIndex: + if ( path.front() == "idx" ) + { + path.pop(); + if ( ! path.empty() ) + { + return getIndex( path.front() ) != nullptr; + } + + } // case kptColumn: // case kptMetadata: } diff --git a/libs/kdbtext/table.hpp b/libs/kdbtext/table.hpp index 9ffcf2b17..044b4aa2d 100644 --- a/libs/kdbtext/table.hpp +++ b/libs/kdbtext/table.hpp @@ -30,6 +30,7 @@ #include "path.hpp" #include "column.hpp" +#include "index.hpp" #include #include @@ -56,6 +57,7 @@ namespace KDBText const std::string & getName() const { return m_name; } const Column * getColumn( const std::string& name ) const; + const Index * getIndex( const std::string& name ) const; int pathType( Path & ) const; bool exists( uint32_t requested, Path & p_path ) const; @@ -64,5 +66,6 @@ namespace KDBText const KJsonObject * m_json = nullptr; std::string m_name; std::vector m_columns; + std::vector m_indexes; }; } diff --git a/test/kdbtext/CMakeLists.txt b/test/kdbtext/CMakeLists.txt index f4ed0efe8..32c8d6aa1 100644 --- a/test/kdbtext/CMakeLists.txt +++ b/test/kdbtext/CMakeLists.txt @@ -32,8 +32,11 @@ add_compile_definitions( __mod__="test/kdbtext" ) -AddExecutableTest( Test_KDBText_Path "test-path" "${COMMON_LIBS_READ};kdbtext" ) -AddExecutableTest( Test_KDBText_Column "test-column" "${COMMON_LIBS_READ};kdbtext" ) -AddExecutableTest( Test_KDBText_Table "test-table" "${COMMON_LIBS_READ};kdbtext" ) -AddExecutableTest( Test_KDBText_Database "test-database" "${COMMON_LIBS_READ};kdbtext" ) -AddExecutableTest( Test_KDBText_Manager "test-manager" "${COMMON_LIBS_READ};kdbtext" ) +set( LIBS ${COMMON_LIBS_READ};kdbtext ) +AddExecutableTest( Test_KDBText_Path "test-path" "${LIBS}" ) +AddExecutableTest( Test_KDBText_Metadata "test-metadata" "${LIBS}" ) +AddExecutableTest( Test_KDBText_Index "test-index" "${LIBS}" ) +AddExecutableTest( Test_KDBText_Column "test-column" "${LIBS}" ) +AddExecutableTest( Test_KDBText_Table "test-table" "${LIBS}" ) +AddExecutableTest( Test_KDBText_Database "test-database" "${LIBS}" ) +AddExecutableTest( Test_KDBText_Manager "test-manager" "${LIBS}" ) diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index 6dec581b3..c2d3d49dc 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -64,6 +64,11 @@ class KDBTextDatabase_Fixture m_db = new Database( json ); } + void SetupAndInflate( const char * input ) + { + Setup( input ); + THROW_ON_RC( m_db -> inflate( m_error, sizeof m_error ) ); + } KJsonValue * m_json = nullptr; Database * m_db = nullptr; @@ -103,10 +108,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_WrongType, KDBTextDatabase_Fixture) FIXTURE_TEST_CASE(KDBTextDatabase_Make_Flat, KDBTextDatabase_Fixture) { - Setup(R"({"type": "database", "name": "testdb"})"); - - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate(R"({"type": "database", "name": "testdb"})"); REQUIRE_EQ( string("testdb"), m_db -> getName() ); } @@ -201,110 +203,118 @@ const char * NestedDb = R"({ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); + SetupAndInflate( NestedDb ); - REQUIRE_NULL( m_db -> getDatabase( "notthere") ); - REQUIRE_NOT_NULL( m_db -> getDatabase( "subdb1") ); - REQUIRE_NOT_NULL( m_db -> getDatabase( "subdb2") ); + REQUIRE_NULL( m_db -> findDatabase( "notthere") ); + REQUIRE_NOT_NULL( m_db -> findDatabase( "subdb1") ); + REQUIRE_NOT_NULL( m_db -> findDatabase( "subdb2") ); - REQUIRE_NULL( m_db -> getTable( "notthere") ); - REQUIRE_NOT_NULL( m_db -> getTable( "tbl0-1") ); - REQUIRE_NOT_NULL( m_db -> getTable( "tbl0-2") ); + REQUIRE_NULL( m_db -> findTable( "notthere") ); + REQUIRE_NOT_NULL( m_db -> findTable( "tbl0-1") ); + REQUIRE_NOT_NULL( m_db -> findTable( "tbl0-2") ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_getDatabase, KDBTextDatabase_Fixture) +{ + SetupAndInflate( NestedDb ); + Path p( "testdb" ); + const Database * db = m_db -> getDatabase( p ); + REQUIRE_NOT_NULL( db ); + REQUIRE_EQ( string("testdb"), db->getName() ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_getDatabase_Nested, KDBTextDatabase_Fixture) +{ + SetupAndInflate( NestedDb ); + Path p( "testdb/db/subdb2" ); + const Database * db = m_db -> getDatabase( p ); + REQUIRE_NOT_NULL( db ); + REQUIRE_EQ( string("subdb2"), db->getName() ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_getTable, KDBTextDatabase_Fixture) +{ + SetupAndInflate( NestedDb ); + Path p( "testdb/tbl/tbl0-1" ); + const Table * tbl = m_db -> getTable( p ); + REQUIRE_NOT_NULL( tbl ); + REQUIRE_EQ( string("tbl0-1"), tbl->getName() ); +} +FIXTURE_TEST_CASE(KDBTextDatabase_getTable_Nested, KDBTextDatabase_Fixture) +{ + SetupAndInflate( NestedDb ); + Path p( "testdb/db/subdb2/tbl/tbl2-2" ); + const Table * tbl = m_db -> getTable( p ); + REQUIRE_NOT_NULL( tbl ); + REQUIRE_EQ( string("tbl2-2"), tbl->getName() ); } FIXTURE_TEST_CASE(KDBTextDatabase_pathType_empty, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "" ); REQUIRE_EQ( (int)kptNotFound, m_db -> pathType( p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_pathType_miss, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "qq" ); REQUIRE_EQ( (int)kptNotFound, m_db -> pathType( p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_pathType_self, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "testdb" ); REQUIRE_EQ( (int)kptDatabase, m_db -> pathType( p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_pathType_nestedDb, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2" ); REQUIRE_EQ( (int)kptDatabase, m_db -> pathType( p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_pathType_nestedTable, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2/tbl/tbl2-2" ); REQUIRE_EQ( (int)kptTable, m_db -> pathType( p ) ); } - -//TODO: metadata, indexes +//TODO: metadata (db/table), index (db/table) FIXTURE_TEST_CASE(KDBTextDatabase_exists_empty, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "" ); REQUIRE( ! m_db -> exists( kptDatabase, p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Not, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "notadb" ); REQUIRE( ! m_db -> exists( kptDatabase, p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_WrongType, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "testdb" ); REQUIRE( ! m_db -> exists( kptTable, p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Root, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "testdb" ); REQUIRE( m_db -> exists( kptDatabase, p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Nested, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2" ); REQUIRE( m_db -> exists( kptDatabase, p ) ); } FIXTURE_TEST_CASE(KDBTextDatabase_exists_Table, KDBTextDatabase_Fixture) { - Setup( NestedDb ); - REQUIRE_RC( m_db -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2/tbl/tbl2-1" ); REQUIRE( m_db -> exists( kptTable, p ) ); } -//TODO: metadata, indexes (?) +//TODO: KDBTextDatabase_exists_Metadata (db/table) //////////////////////////////////////////// Main extern "C" diff --git a/test/kdbtext/test-index.cpp b/test/kdbtext/test-index.cpp new file mode 100644 index 000000000..9b5165136 --- /dev/null +++ b/test/kdbtext/test-index.cpp @@ -0,0 +1,117 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for KDBIndex for reading textual data +*/ + +#include + +#include "../../libs/kdbtext/index.hpp" + +#include +#include + +using namespace std; +using namespace KDBText; + +TEST_SUITE(KDBTextIndexTestSuite); + +class KDBTextIndex_Fixture +{ +public: + KDBTextIndex_Fixture() + { + } + ~KDBTextIndex_Fixture() + { + delete m_idx; + KJsonValueWhack( m_json ); + } + + void Setup( const char * input ) + { + THROW_ON_RC( KJsonValueMake ( & m_json, input, m_error, sizeof m_error ) ); + THROW_ON_FALSE( jsObject == KJsonGetValueType ( m_json ) ); + + const KJsonObject * json = KJsonValueToObject ( m_json ); + THROW_ON_FALSE( json != nullptr ); + + m_idx = new Index( json ); + } + + KJsonValue * m_json = nullptr; + Index * m_idx = nullptr; + char m_error[1024] = {0}; +}; + +FIXTURE_TEST_CASE(KDBTextIndex_Make_Empty, KDBTextIndex_Fixture) +{ + Setup(R"({})"); + REQUIRE_RC_FAIL( m_idx -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KDBTextIndex_Make, KDBTextIndex_Fixture) +{ + Setup(R"({"name":"idx"})"); + REQUIRE_RC( m_idx -> inflate( m_error, sizeof m_error ) ); + REQUIRE_EQ( string("idx"), m_idx->getName() ); +} + +//TODO: the rest + +//////////////////////////////////////////// Main +extern "C" +{ + +#include +#include + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} +rc_t CC UsageSummary (const char * progname) +{ + return 0; +} + +rc_t CC Usage ( const Args * args ) +{ + return 0; +} + +const char UsageDefaultName[] = "Test_KDBText_Index"; + +rc_t CC KMain ( int argc, char *argv [] ) +{ + KConfigDisableUserSettings(); + rc_t rc=KDBTextIndexTestSuite(argc, argv); + return rc; +} + +} diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index 19f89966f..373ca81ca 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include //KDBManagerVPathTypeUnreliable #include @@ -126,6 +126,18 @@ FIXTURE_TEST_CASE(KDBTextManager_Db_Exists, KDBTextManager_Fixture) REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb" ) ); } +const char * NestedDatabases = R"({ + "type": "database", + "name": "testdb", + "databases": [ + {"type": "database","name":"subdb1"}, + {"type": "database","name":"subdb2","tables":[ + {"type": "table", "name": "tbl1"}, + {"type": "table", "name": "tbl2"} + ]} + ] +})"; + FIXTURE_TEST_CASE(KDBTextManager_SubDb_Exists_Not, KDBTextManager_Fixture) { Setup( R"({"type": "database", "name": "testdb"})" ); @@ -133,12 +145,7 @@ FIXTURE_TEST_CASE(KDBTextManager_SubDb_Exists_Not, KDBTextManager_Fixture) } FIXTURE_TEST_CASE(KDBTextManager_SubDb_Exists, KDBTextManager_Fixture) { - Setup( R"({"type": "database","name": "testdb", - "databases":[ - {"type": "database","name":"subdb1"} , - {"type": "database","name":"subdb2"} - ] - })"); + Setup( NestedDatabases ); REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb1" ) ); REQUIRE( KDBManagerExists( m_mgr, kptDatabase, "%s", "testdb/db/subdb2" ) ); } @@ -151,28 +158,38 @@ FIXTURE_TEST_CASE(KDBTextManager_Table_Exists_Not, KDBTextManager_Fixture) FIXTURE_TEST_CASE(KDBTextManager_Table_Exists, KDBTextManager_Fixture) { Setup( R"({"type": "database","name": "testdb", - "tables":[ - {"type": "table", "name": "tbl1"}, - {"type": "table", "name": "tbl2"} - ] + "tables":[ + {"type": "table", "name": "tbl1"}, + {"type": "table", "name": "tbl2"} + ] })" ); REQUIRE( KDBManagerExists( m_mgr, kptTable, "%s", "testdb/tbl/tbl1" ) ); } - -//TODO: table, index, column, metadata - -FIXTURE_TEST_CASE(KDBTextManager_Writable_Found, KDBTextManager_Fixture) -{ // for now, any path will be reported as readonly - Setup( R"({"type": "database", "name": "testdb"})" ); - rc_t rc = KDBManagerWritable( m_mgr, "%s", "testdb" ); - REQUIRE_EQ( SILENT_RC( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ), rc ); +FIXTURE_TEST_CASE(KDBTextManager_Index_Exists, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database","name": "testdb", + "tables":[ + {"type": "table", "name": "tbl1", + "indexes":[ + {"name":"qwer","text":[]} + ]} + ] + })" ); + REQUIRE( KDBManagerExists( m_mgr, kptIndex, "%s", "testdb/tbl/tbl1/idx/qwer" ) ); } + FIXTURE_TEST_CASE(KDBTextManager_Writable_NotFound, KDBTextManager_Fixture) { Setup( R"({"type": "database", "name": "testdb"})" ); rc_t rc = KDBManagerWritable( m_mgr, "%s", "proddb" ); REQUIRE_EQ( SILENT_RC( rcDB, rcPath, rcAccessing, rcPath, rcNotFound ), rc ); } +FIXTURE_TEST_CASE(KDBTextManager_Writable_Found, KDBTextManager_Fixture) +{ // for now, any existing object will be reported as readonly + Setup( R"({"type": "database", "name": "testdb"})" ); + rc_t rc = KDBManagerWritable( m_mgr, "%s", "testdb" ); + REQUIRE_EQ( SILENT_RC( rcDB, rcPath, rcAccessing, rcPath, rcReadonly ), rc ); +} FIXTURE_TEST_CASE(KDBTextManager_RunPeriodicTasks, KDBTextManager_Fixture) { @@ -194,14 +211,7 @@ FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db, KDBTextManager_Fixture) } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Db_Nested, KDBTextManager_Fixture) { - Setup( R"({ - "type": "database", - "name": "testdb", - "databases":[ - {"type": "database","name":"subdb1"}, - {"type": "database","name":"subdb2"} - ] - })" ); + Setup( NestedDatabases ); MakeVPath( "testdb/db/subdb2"); REQUIRE_EQ( (int)kptDatabase, KDBManagerPathTypeVP( m_mgr, m_path ) ); } @@ -213,39 +223,36 @@ FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Table_Root, KDBTextManager_Fixture) } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Table_Nested, KDBTextManager_Fixture) { - Setup( R"({ - "type": "database", - "name": "testdb", - "databases": [ - {"type": "database","name":"subdb1"}, - {"type": "database","name":"subdb2","tables":[ - {"type": "table", "name": "tbl1"}, - {"type": "table", "name": "tbl2"} - ]} - ] - })" ); + Setup( NestedDatabases ); MakeVPath( "testdb/db/subdb2/tbl/tbl2"); REQUIRE_EQ( (int)kptTable, KDBManagerPathTypeVP( m_mgr, m_path ) ); } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_NotFound, KDBTextManager_Fixture) { - Setup( R"({ "type": "table", "name": "tbl1", "columns":[{"name":"col"}] })" ); - MakeVPath( "testdb/db/subdb2/tbl/tbl2"); + Setup( R"({ "type": "table", "name": "tbl1", "columns":[{"name":"col1"}] })" ); + MakeVPath( "tbl1/col/notcol"); REQUIRE_EQ( (int)kptNotFound, KDBManagerPathTypeVP( m_mgr, m_path ) ); } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_RootTable, KDBTextManager_Fixture) { + Setup( R"({ "type": "table", "name": "tbl1", "columns":[{"name":"col1"}] })" ); + MakeVPath( "tbl1/col/col1"); + REQUIRE_EQ( (int)kptColumn, KDBManagerPathTypeVP( m_mgr, m_path ) ); } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_Db, KDBTextManager_Fixture) { + Setup( R"({"type": "database","name": "testdb", + "tables":[ + { "type": "table", "name": "tbl1", + "columns":[{"name":"col1"}] + } + ] + })" ); + MakeVPath( "testdb/tbl/tbl1/col/col1"); + REQUIRE_EQ( (int)kptColumn, KDBManagerPathTypeVP( m_mgr, m_path ) ); } -//TODO: KDBManagerPathTypeVP on internal objects, to test interpretation of the path - // kptColumn, - // kptIndex, - // kptMetadata, - FIXTURE_TEST_CASE(KDBTextManager_PathType, KDBTextManager_Fixture) { Setup( R"({"type": "database", "name": "testdb"})" ); @@ -274,6 +281,14 @@ FIXTURE_TEST_CASE(KDBTextManager_OpenDBRead, KDBTextManager_Fixture) REQUIRE_NOT_NULL( db ); REQUIRE_RC( KDatabaseRelease( db ) ); } +FIXTURE_TEST_CASE(KDBTextManager_OpenDBRead_Nested, KDBTextManager_Fixture) +{ + Setup( NestedDatabases ); + const KDatabase * db = nullptr; + REQUIRE_RC( KDBManagerOpenDBRead( m_mgr, & db, "%s", "testdb/db/subdb2" ) ); + REQUIRE_NOT_NULL( db ); + REQUIRE_RC( KDatabaseRelease( db ) ); +} FIXTURE_TEST_CASE(KDBTextManager_OpenTableRead, KDBTextManager_Fixture) { // root table @@ -283,7 +298,14 @@ FIXTURE_TEST_CASE(KDBTextManager_OpenTableRead, KDBTextManager_Fixture) REQUIRE_NOT_NULL( tbl ); REQUIRE_RC( KTableRelease( tbl ) ); } -//TODO: non-root tables +FIXTURE_TEST_CASE(KDBTextManager_OpenTableRead_NonRoot, KDBTextManager_Fixture) +{ + Setup( NestedDatabases ); + const KTable * tbl = nullptr; + REQUIRE_RC( KDBManagerOpenTableRead( m_mgr, & tbl, "%s", "testdb/db/subdb2/tbl/tbl2" ) ); + REQUIRE_NOT_NULL( tbl ); + REQUIRE_RC( KTableRelease( tbl ) ); +} FIXTURE_TEST_CASE(KDBTextManager_OpenTableReadVPath, KDBTextManager_Fixture) { @@ -295,36 +317,6 @@ FIXTURE_TEST_CASE(KDBTextManager_OpenTableReadVPath, KDBTextManager_Fixture) REQUIRE_RC( KTableRelease( tbl ) ); } -const char * TableWithColumnQQ = R"({"type": "table", "name": "SEQUENCE", "columns":[{"name":"qq"}]})"; -FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead_BadPath1, KDBTextManager_Fixture) -{ - Setup( TableWithColumnQQ ); - REQUIRE_RC_FAIL( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SHMEQUENCE/col/qq" ) ); // bad table name -} -FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead_BadPath2, KDBTextManager_Fixture) -{ - Setup( TableWithColumnQQ ); - REQUIRE_RC_FAIL( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/shmol/qq" ) ); // bad "col" -} -FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead_BadPath3, KDBTextManager_Fixture) -{ - Setup( TableWithColumnQQ ); - REQUIRE_RC_FAIL( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/col" ) ); // col name missing -} -FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead_BadPath4, KDBTextManager_Fixture) -{ - Setup( TableWithColumnQQ ); - REQUIRE_RC_FAIL( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/col/shmol" ) ); // no such column -} -FIXTURE_TEST_CASE(KDBTextManager_OpenColumnRead, KDBTextManager_Fixture) -{ // root table - Setup( TableWithColumnQQ ); - - REQUIRE_RC( KDBManagerOpenColumnRead( m_mgr, & m_col, "%s", "SEQUENCE/col/qq" ) ); - REQUIRE_NOT_NULL( m_col ); -} -//TODO: columns in non-root tables - FIXTURE_TEST_CASE(KDBManager_VPathOpenLocalDBRead, KDBTextManager_Fixture) { Setup( R"({"type": "database", "name": "testdb"})" ); @@ -344,6 +336,14 @@ FIXTURE_TEST_CASE(KDBManager_VPathOpenRemoteDBRead, KDBTextManager_Fixture) REQUIRE_EQ( SILENT_RC( rcDB, rcMgr, rcOpening, rcType, rcInvalid ), rc ); } +FIXTURE_TEST_CASE(KDBManager_OpenColumnRead, KDBTextManager_Fixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + const KColumn *col = nullptr; + rc_t rc = KDBManagerOpenColumnRead( m_mgr, & col, "%s", "testdb/col/col1" ); + REQUIRE_EQ( SILENT_RC( rcDB, rcMgr, rcAccessing, rcColumn, rcUnsupported ), rc ); +} + //////////////////////////////////////////// Main extern "C" { @@ -382,7 +382,6 @@ rc_t CC KMain ( int argc, char *argv [] ) let metadata: Metadata let tables: [Table] - let indices: [Index] let databases: [Database] } struct Node { diff --git a/test/kdbtext/test-metadata.cpp b/test/kdbtext/test-metadata.cpp new file mode 100644 index 000000000..2bbab97d4 --- /dev/null +++ b/test/kdbtext/test-metadata.cpp @@ -0,0 +1,117 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for KDBMetadata for reading textual data +*/ + +#include + +#include "../../libs/kdbtext/metadata.hpp" + +#include +#include + +using namespace std; +using namespace KDBText; + +TEST_SUITE(KDBTextMetadataTestSuite); + +class KDBTextMetadata_Fixture +{ +public: + KDBTextMetadata_Fixture() + { + } + ~KDBTextMetadata_Fixture() + { + delete m_meta; + KJsonValueWhack( m_json ); + } + + void Setup( const char * input ) + { + THROW_ON_RC( KJsonValueMake ( & m_json, input, m_error, sizeof m_error ) ); + THROW_ON_FALSE( jsObject == KJsonGetValueType ( m_json ) ); + + const KJsonObject * json = KJsonValueToObject ( m_json ); + THROW_ON_FALSE( json != nullptr ); + + m_meta = new Metadata( json ); + } + + KJsonValue * m_json = nullptr; + Metadata * m_meta = nullptr; + char m_error[1024] = {0}; +}; + +FIXTURE_TEST_CASE(KDBTextMetadata_Make_Empty, KDBTextMetadata_Fixture) +{ + Setup(R"({})"); + REQUIRE_RC_FAIL( m_meta -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KDBTextMetadata_Make, KDBTextMetadata_Fixture) +{ + Setup(R"({"name":"md"})"); + REQUIRE_RC( m_meta -> inflate( m_error, sizeof m_error ) ); + REQUIRE_EQ( string("md"), m_meta->getName() ); +} + +//TODO: the rest + +//////////////////////////////////////////// Main +extern "C" +{ + +#include +#include + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} +rc_t CC UsageSummary (const char * progname) +{ + return 0; +} + +rc_t CC Usage ( const Args * args ) +{ + return 0; +} + +const char UsageDefaultName[] = "Test_KDBText_Metadata"; + +rc_t CC KMain ( int argc, char *argv [] ) +{ + KConfigDisableUserSettings(); + rc_t rc=KDBTextMetadataTestSuite(argc, argv); + return rc; +} + +} diff --git a/test/kdbtext/test-table.cpp b/test/kdbtext/test-table.cpp index 811cc0573..895adfb02 100644 --- a/test/kdbtext/test-table.cpp +++ b/test/kdbtext/test-table.cpp @@ -64,6 +64,11 @@ class KDBTextTable_Fixture m_tbl = new Table( json ); } + void SetupAndInflate( const char * input ) + { + Setup( input ); + THROW_ON_RC( m_tbl -> inflate( m_error, sizeof m_error ) ); + } KJsonValue * m_json = nullptr; Table * m_tbl = nullptr; @@ -103,10 +108,7 @@ FIXTURE_TEST_CASE(KDBTextTable_Make_WrongType, KDBTextTable_Fixture) FIXTURE_TEST_CASE(KDBTextTable_Make_Flat, KDBTextTable_Fixture) { - Setup(R"({"type": "table", "name": "testtbl"})"); - - REQUIRE_RC( m_tbl -> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); REQUIRE_EQ( string("testtbl"), m_tbl -> getName() ); } @@ -131,42 +133,63 @@ FIXTURE_TEST_CASE(KDBTextTable_Make_ColumnNotObject, KDBTextTable_Fixture) FIXTURE_TEST_CASE(KDBTextTable_Make_WithColumns, KDBTextTable_Fixture) { - Setup(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col2"}]})"); - - REQUIRE_RC( m_tbl -> inflate( m_error, sizeof m_error ) ); + SetupAndInflate(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col2"}]})"); REQUIRE_NULL( m_tbl -> getColumn( "nocol" ) ); REQUIRE_NOT_NULL( m_tbl -> getColumn( "col1" ) ); REQUIRE_NOT_NULL( m_tbl -> getColumn( "col2" ) ); } -//TODO: columns, metadata, indexes +FIXTURE_TEST_CASE(KDBTextTable_Make_WithIndex, KDBTextTable_Fixture) +{ + SetupAndInflate(R"({"type": "table", "name": "testtbl", + "indexes":[ {"name":"i1","text":[]}, {"name":"i2","text":[]}] + })"); + + REQUIRE_NULL( m_tbl -> getIndex( "noidx" ) ); + REQUIRE_NOT_NULL( m_tbl -> getIndex( "i1" ) ); + REQUIRE_NOT_NULL( m_tbl -> getIndex( "i2" ) ); +} + +//TODO: metadata, index FIXTURE_TEST_CASE(KDBTextTable_exists_empty, KDBTextTable_Fixture) { - Setup(R"({"type": "table", "name": "testtbl"})"); - REQUIRE_RC( m_tbl-> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); Path p( "" ); REQUIRE( ! m_tbl -> exists( kptTable, p ) ); } FIXTURE_TEST_CASE(KDBTextTable_exists_WrongType, KDBTextTable_Fixture) { - Setup(R"({"type": "table", "name": "testtbl"})"); - REQUIRE_RC( m_tbl-> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); Path p( "testtbl" ); REQUIRE( ! m_tbl -> exists( kptDatabase, p ) ); } FIXTURE_TEST_CASE(KDBTextTable_exists, KDBTextTable_Fixture) { - Setup(R"({"type": "table", "name": "testtbl"})"); - REQUIRE_RC( m_tbl-> inflate( m_error, sizeof m_error ) ); - + SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); Path p( "testtbl" ); REQUIRE( m_tbl -> exists( kptTable, p ) ); } -//TODO: columns, metadata, indexes +FIXTURE_TEST_CASE(KDBTextTable_exists_Index, KDBTextTable_Fixture) +{ + SetupAndInflate(R"({"type": "table", "name": "testtbl", + "indexes":[ + {"name":"qwer","text":[]} + ]})"); + Path p( "testtbl/idx/qwer" ); + REQUIRE( m_tbl -> exists( kptIndex, p ) ); +} +//TODO: column, metadata, index + +//pathType +FIXTURE_TEST_CASE(KDBTextTable_pathType_Column, KDBTextTable_Fixture) +{ + SetupAndInflate(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col2"}]})"); + Path p( "testtbl/col/col2" ); + REQUIRE_EQ( (int)kptColumn, m_tbl -> pathType( p ) ); +} +//TODO: empty, wrong type, table, metadata, index //////////////////////////////////////////// Main extern "C" From 77537bc0c48f5ac9907104939e02aa0c512ef5f6 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Sat, 16 Dec 2023 14:38:58 -0500 Subject: [PATCH 14/42] VDB-5498 saving work --- libs/kdbtext/CMakeLists.txt | 2 +- libs/kdbtext/{api.cpp => api-manager.cpp} | 2 +- libs/kdbtext/{api.hpp => api-manager.hpp} | 0 libs/kdbtext/database.hpp | 12 ++++---- libs/kdbtext/manager.hpp | 2 +- test/kdbtext/test-database.cpp | 35 +++++++++++++++++++++++ 6 files changed, 43 insertions(+), 10 deletions(-) rename libs/kdbtext/{api.cpp => api-manager.cpp} (99%) rename libs/kdbtext/{api.hpp => api-manager.hpp} (100%) diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt index 55b77cd88..2c3abf5d2 100644 --- a/libs/kdbtext/CMakeLists.txt +++ b/libs/kdbtext/CMakeLists.txt @@ -23,7 +23,7 @@ # =========================================================================== set( KDBTEXT_SRC - api.cpp + api-manager.cpp manager.cpp database.cpp table.cpp diff --git a/libs/kdbtext/api.cpp b/libs/kdbtext/api-manager.cpp similarity index 99% rename from libs/kdbtext/api.cpp rename to libs/kdbtext/api-manager.cpp index b78561483..838bb5e2b 100644 --- a/libs/kdbtext/api.cpp +++ b/libs/kdbtext/api-manager.cpp @@ -24,7 +24,7 @@ * */ -#include "api.hpp" +#include "api-manager.hpp" #include "manager.hpp" #include "database.hpp" diff --git a/libs/kdbtext/api.hpp b/libs/kdbtext/api-manager.hpp similarity index 100% rename from libs/kdbtext/api.hpp rename to libs/kdbtext/api-manager.hpp diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index 2857f1c58..438c6afb0 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -30,6 +30,11 @@ typedef struct KTextDatabase KTextDatabase; #define KDATABASE_IMPL KTextDatabase #include "../libs/kdb/database-base.h" +struct KTextDatabase +{ + KDatabaseBase dad; +}; + #include "path.hpp" #include "table.hpp" @@ -39,17 +44,11 @@ typedef struct KTextDatabase KTextDatabase; #include #include -struct KTextDatabase -{ - KDatabaseBase dad; -}; - namespace KDBText { class Database : public KTextDatabase { public: - Database() {} Database( const KJsonObject * p_json ); ~Database(); @@ -67,7 +66,6 @@ namespace KDBText bool exists( uint32_t requested, Path & p_path ) const; private: - const KJsonObject * m_json = nullptr; std::string m_name; std::vector m_subdbs; diff --git a/libs/kdbtext/manager.hpp b/libs/kdbtext/manager.hpp index a0f834e77..94c6dd543 100644 --- a/libs/kdbtext/manager.hpp +++ b/libs/kdbtext/manager.hpp @@ -26,7 +26,7 @@ #pragma once -#include "api.hpp" +#include "api-manager.hpp" #include diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index c2d3d49dc..46d0ec8bf 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -33,6 +33,7 @@ #include "../../libs/kdbtext/database.hpp" #include +#include #include #include @@ -316,6 +317,40 @@ FIXTURE_TEST_CASE(KDBTextDatabase_exists_Table, KDBTextDatabase_Fixture) } //TODO: KDBTextDatabase_exists_Metadata (db/table) +// API + +class KDBTextDatabase_ApiFixture +{ +public: + KDBTextDatabase_ApiFixture() + { + } + ~KDBTextDatabase_ApiFixture() + { + KDatabaseRelease( m_db ); + } + void Setup( const char * input ) + { + const KDBManager * mgr = nullptr; + THROW_ON_RC( KDBManagerMakeText ( & mgr, input, m_error, sizeof m_error ) ); + THROW_ON_RC( KDBManagerOpenDBRead( mgr, & m_db, "%s", "testdb" ) ); + KDBManagerRelease( mgr ); + } + + const KDatabase * m_db = nullptr; + char m_error[1024]; +}; + +FIXTURE_TEST_CASE(KDBTextDatabase_AddRelease, KDBTextDatabase_ApiFixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + + REQUIRE_NOT_NULL( m_db ) ; + REQUIRE_RC( KDatabaseAddRef( m_db ) ); + REQUIRE_RC( KDatabaseRelease( m_db ) ); + // use valgrind to find any leaks +} + //////////////////////////////////////////// Main extern "C" { From 7e9bf80b2ed8b701b03b2c5834b150290d4a6a54 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 22 Dec 2023 15:11:03 -0500 Subject: [PATCH 15/42] VDB-5498 saving work --- libs/kdbtext/api-manager.cpp | 1 + libs/kdbtext/database.cpp | 166 +++++++++++++++++++++++++++------ libs/kdbtext/database.hpp | 21 ++++- libs/kdbtext/manager.cpp | 18 +++- libs/kdbtext/manager.hpp | 3 + test/kdbtext/test-database.cpp | 57 ++++++++++- 6 files changed, 225 insertions(+), 41 deletions(-) diff --git a/libs/kdbtext/api-manager.cpp b/libs/kdbtext/api-manager.cpp index 838bb5e2b..0352c7b67 100644 --- a/libs/kdbtext/api-manager.cpp +++ b/libs/kdbtext/api-manager.cpp @@ -85,6 +85,7 @@ static KDBManager_vt KTextManager_vt = }; using namespace KDBText; + #define CAST() assert( bself -> dad . vt == & KTextManager_vt ); const Manager *self = static_cast(bself); static diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 612e579a0..8862c1278 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -26,7 +26,13 @@ #include "database.hpp" +#include "table.hpp" +#include "manager.hpp" + #include +#include +#include + #include #include @@ -35,14 +41,14 @@ using namespace KDBText; using namespace std; static rc_t CC KTextDatabaseWhack ( KTextDatabase *self ); -// static bool CC KTextDatabaseLocked ( const KTextDatabase *self ); -// static bool CC KTextDatabaseVExists ( const KTextDatabase *self, uint32_t type, const char *name, va_list args ); -// static bool CC KTextDatabaseIsAlias ( const KTextDatabase *self, uint32_t type, char *resolved, size_t rsize, const char *name ); -// static rc_t CC KTextDatabaseVWritable ( const KTextDatabase *self, uint32_t type, const char *name, va_list args ); -// static rc_t CC KTextDatabaseOpenManagerRead ( const KTextDatabase *self, const KDBManager **mgr ); -// static rc_t CC KTextDatabaseOpenParentRead ( const KTextDatabase *self, const KTextDatabase **par ); +static bool CC KTextDatabaseLocked ( const KTextDatabase *self ); +static bool CC KTextDatabaseVExists ( const KTextDatabase *self, uint32_t type, const char *name, va_list args ); +static bool CC KTextDatabaseIsAlias ( const KTextDatabase *self, uint32_t type, char *resolved, size_t rsize, const char *name ); +static rc_t CC KTextDatabaseVWritable ( const KTextDatabase *self, uint32_t type, const char *name, va_list args ); +static rc_t CC KTextDatabaseOpenManagerRead ( const KTextDatabase *self, const KDBManager **mgr ); +static rc_t CC KTextDatabaseOpenParentRead ( const KTextDatabase *self, const KDatabase **par ); // static rc_t CC KTextDatabaseOpenDirectoryRead ( const KTextDatabase *self, const KDirectory **dir ); -// static rc_t CC KTextDatabaseVOpenDBRead ( const KTextDatabase *self, const KTextDatabase **dbp, const char *name, va_list args ); +// static rc_t CC KTextDatabaseVOpenDBRead ( const KTextDatabase *self, const KDatabase **dbp, const char *name, va_list args ); // static rc_t CC KTextDatabaseVOpenTableRead ( const KTextDatabase *self, const KTable **tblp, const char *name, va_list args ); // static rc_t CC KTextDatabaseOpenMetadataRead ( const KTextDatabase *self, const KMetadata **metap ); // static rc_t CC KTextDatabaseVOpenIndexRead ( const KTextDatabase *self, const KIndex **idxp, const char *name, va_list args ); @@ -56,12 +62,12 @@ static KDatabase_vt KTextDatabase_vt = KTextDatabaseWhack, KDatabaseBaseAddRef, KDatabaseBaseRelease, - // KTextDatabaseLocked, - // KTextDatabaseVExists, - // KTextDatabaseIsAlias, - // KTextDatabaseVWritable, - // KTextDatabaseOpenManagerRead, - // KTextDatabaseOpenParentRead, + KTextDatabaseLocked, + KTextDatabaseVExists, + KTextDatabaseIsAlias, + KTextDatabaseVWritable, + KTextDatabaseOpenManagerRead, + KTextDatabaseOpenParentRead, // KTextDatabaseOpenDirectoryRead, // KTextDatabaseVOpenDBRead, // KTextDatabaseVOpenTableRead, @@ -73,7 +79,8 @@ static KDatabase_vt KTextDatabase_vt = // KTextDatabaseGetPath }; -Database::Database( const KJsonObject * p_json ) : m_json ( p_json ) +Database::Database( const KJsonObject * p_json, const Manager * p_mgr, const Database * p_parent ) +: m_mgr( p_mgr ), m_parent( p_parent ), m_json ( p_json ) { dad . vt = & KTextDatabase_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::Database", "ctor", "db" ); @@ -81,7 +88,35 @@ Database::Database( const KJsonObject * p_json ) : m_json ( p_json ) Database::~Database() { + for( auto & d : m_tables ) + { + KTableRelease( (const KTable*) d ); + } + for( auto & d : m_subdbs ) + { + KDatabaseRelease( (const KDatabase*) d ); + } KRefcountWhack ( & dad . refcount, "KDBText::Database" ); + if ( m_mgr != nullptr ) + { + m_mgr -> sever(); + } + if ( m_parent != nullptr ) + { + m_parent -> sever(); + } +} + +void +Database::attach() const +{ + KRefcountAdd( & dad . refcount, "KDBText::Database" ); +} + +void +Database::sever() const +{ + KRefcountDrop( & dad . refcount, "KDBText::Database" ); } const Database * @@ -89,9 +124,9 @@ Database::findDatabase( const string & p_name ) const { // shallow search for a db for( auto & d : m_subdbs ) { - if ( p_name == d.getName() ) + if ( p_name == d -> getName() ) { - return & d; + return d; } } return nullptr; @@ -102,9 +137,9 @@ Database::findTable( const std::string & name ) const { // shallow search for a table for( auto & d : m_tables ) { - if ( name == d.getName() ) + if ( name == d -> getName() ) { - return & d; + return d; } } return nullptr; @@ -234,18 +269,20 @@ Database::inflate( char * error, size_t error_size ) const KJsonObject * obj = KJsonValueToObject ( v ); if( obj != nullptr ) { - Database subdb( obj ); - rc = subdb . inflate ( error, error_size ); + Database * subdb = new Database ( obj, m_mgr, this ); + rc = subdb -> inflate ( error, error_size ); if ( rc != 0 ) { + delete subdb; return rc; } for( auto & d : m_subdbs ) { - if ( subdb.getName() == d.getName() ) + if ( subdb -> getName() == d -> getName() ) { - string_printf ( error, error_size, nullptr, "Duplicate nested db: %s", subdb.getName().c_str() ); + string_printf ( error, error_size, nullptr, "Duplicate nested db: %s", subdb -> getName().c_str() ); + delete subdb; return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } } @@ -277,22 +314,24 @@ Database::inflate( char * error, size_t error_size ) const KJsonObject * obj = KJsonValueToObject ( v ); if( obj != nullptr ) { - Table tbl ( obj ); - rc = tbl . inflate ( error, error_size ); + Table * tbl = new Table( obj ); + rc = tbl -> inflate ( error, error_size ); if ( rc != 0 ) { + delete tbl; return rc; } for( auto & t : m_tables ) { - if ( tbl.getName() == t.getName() ) + if ( tbl -> getName() == t -> getName() ) { - string_printf ( error, error_size, nullptr, "Duplicate table: %s", tbl.getName().c_str() ); + string_printf ( error, error_size, nullptr, "Duplicate table: %s", tbl -> getName().c_str() ); + delete tbl; return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } } - m_tables .push_back( tbl ); + m_tables . push_back( tbl ); } else { // not an object @@ -384,12 +423,79 @@ Database::exists( uint32_t requested, Path & path ) const return false; } + +// API functions + +#define CAST() assert( bself -> dad . vt == & KTextDatabase_vt ); const Database *self = static_cast(bself); + static rc_t CC -KTextDatabaseWhack ( KTextDatabase *self ) +KTextDatabaseWhack ( KTextDatabase *bself ) { - assert( self -> dad . vt == & KTextDatabase_vt ); - delete reinterpret_cast( self ); + CAST(); + delete self; return 0; } +static +bool CC +KTextDatabaseLocked ( const KTextDatabase *self ) +{ + return false; +} + +static +bool CC +KTextDatabaseVExists ( const KTextDatabase *bself, uint32_t type, const char *name, va_list args ) +{ + CAST(); + Path p( name, args ); + return self -> exists( type, p ); +} + +static +bool CC +KTextDatabaseIsAlias ( const KTextDatabase *self, uint32_t type, char *resolved, size_t rsize, const char *name ) +{ + return false; +} + +static +rc_t CC +KTextDatabaseVWritable ( const KTextDatabase *self, uint32_t type, const char *name, va_list args ) +{ + return false; +} + +static +rc_t CC +KTextDatabaseOpenManagerRead ( const KTextDatabase *bself, const KDBManager **mgr ) +{ + CAST(); + + const KDBManager * m = (const KDBManager*) self -> getManager(); + if ( m != nullptr ) + { + self -> getManager() -> attach(); + } + + *mgr = m; + return 0; +} + +static +rc_t CC +KTextDatabaseOpenParentRead ( const KTextDatabase *bself, const KDatabase **par ) +{ + CAST(); + + const KDatabase * p = (const KDatabase*) self -> getParent(); + if ( p != nullptr ) + { + self -> getParent() -> attach(); + } + + *par = p; + + return 0; +} diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index 438c6afb0..431a2eed7 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -36,7 +36,6 @@ struct KTextDatabase }; #include "path.hpp" -#include "table.hpp" #include #include @@ -46,14 +45,25 @@ struct KTextDatabase namespace KDBText { + class Manager; + class Table; + class Database : public KTextDatabase { public: - Database( const KJsonObject * p_json ); + Database( const KJsonObject * p_json, const Manager * = nullptr, const Database * = nullptr ); ~Database(); + void attach() const; + void sever() const; + rc_t inflate( char * error, size_t error_size ); + const Manager * getManager() const { return m_mgr; } + void setManager( const Manager * mgr ) { m_mgr = mgr; } + + const Database * getParent() const { return m_parent; } + const std::string & getName() const { return m_name; } const Database * getDatabase( Path & path ) const; @@ -66,9 +76,12 @@ namespace KDBText bool exists( uint32_t requested, Path & p_path ) const; private: + const Manager * m_mgr = nullptr; + const Database * m_parent = nullptr; + const KJsonObject * m_json = nullptr; std::string m_name; - std::vector m_subdbs; - std::vector
m_tables; + std::vector< const Database* > m_subdbs; + std::vector< const Table* >m_tables; }; } diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index 203136cb4..a2c6f2150 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -50,12 +50,24 @@ Manager::Manager( const KDBManager_vt & vt) Manager::~Manager() { - delete m_tbl; - delete m_db; + KTableRelease( (KTable*) m_tbl); + KDatabaseRelease( (KDatabase*) m_db ); KJsonValueWhack( m_root ); KRefcountWhack ( & dad . refcount, "KDBText::Manager" ); } +void +Manager::attach() const +{ + KRefcountAdd( & dad . refcount, "KDBText::Manager" ); +} + +void +Manager::sever() const +{ + KRefcountDrop( & dad . refcount, "KDBText::Manager" ); +} + rc_t Manager::parse( const char * input, char * error, size_t error_size ) { @@ -83,7 +95,7 @@ Manager::parse( const char * input, char * error, size_t error_size ) { if ( strcmp( typeStr, "database") == 0 ) { - m_db = new Database( rootObj ); + m_db = new Database( rootObj, this ); rc = m_db -> inflate( error, error_size ); } else if ( strcmp( typeStr, "table") == 0 ) diff --git a/libs/kdbtext/manager.hpp b/libs/kdbtext/manager.hpp index 94c6dd543..702e1dda2 100644 --- a/libs/kdbtext/manager.hpp +++ b/libs/kdbtext/manager.hpp @@ -42,6 +42,9 @@ namespace KDBText Manager( const KDBManager_vt& ); ~Manager(); + void attach() const; + void sever() const; + rc_t parse( const char * input, char * error, size_t error_size ); const Database * getRootDatabase() const { return m_db; } diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index 46d0ec8bf..4dd91d112 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -31,6 +31,7 @@ #include #include "../../libs/kdbtext/database.hpp" +#include "../../libs/kdbtext/table.hpp" #include #include @@ -328,15 +329,17 @@ class KDBTextDatabase_ApiFixture ~KDBTextDatabase_ApiFixture() { KDatabaseRelease( m_db ); + KDBManagerRelease( m_mgr ); } void Setup( const char * input ) { - const KDBManager * mgr = nullptr; - THROW_ON_RC( KDBManagerMakeText ( & mgr, input, m_error, sizeof m_error ) ); - THROW_ON_RC( KDBManagerOpenDBRead( mgr, & m_db, "%s", "testdb" ) ); - KDBManagerRelease( mgr ); +// const KDBManager * mgr = nullptr; + THROW_ON_RC( KDBManagerMakeText ( & m_mgr, input, m_error, sizeof m_error ) ); + THROW_ON_RC( KDBManagerOpenDBRead( m_mgr, & m_db, "%s", "testdb" ) ); +// Release(mgr); hold on to the parsed Json, not the top level db/table } + const KDBManager * m_mgr = nullptr; const KDatabase * m_db = nullptr; char m_error[1024]; }; @@ -351,6 +354,52 @@ FIXTURE_TEST_CASE(KDBTextDatabase_AddRelease, KDBTextDatabase_ApiFixture) // use valgrind to find any leaks } +FIXTURE_TEST_CASE(KDBTextDatabase_Locked, KDBTextDatabase_ApiFixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + REQUIRE( ! KDatabaseLocked( m_db ) ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_Exists, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + REQUIRE( KDatabaseExists( m_db, kptTable, "%s", "testdb/db/subdb2/tbl/tbl2-2" ) ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_Alias, KDBTextDatabase_ApiFixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + REQUIRE( ! KDatabaseIsAlias( m_db, kptDatabase, nullptr, 0, "testdb" ) ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_Writable, KDBTextDatabase_ApiFixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + REQUIRE( ! KDatabaseWritable( m_db, kptDatabase, 0, "testdb" ) ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_OpenManagerRead, KDBTextDatabase_ApiFixture) +{ + Setup( R"({"type": "database", "name": "testdb"})" ); + const KDBManager * mgr; + REQUIRE_RC( KDatabaseOpenManagerRead( m_db, & mgr ) ); + REQUIRE_EQ( m_mgr, mgr ); + KDBManagerRelease( mgr ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_OpenParentRead, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + const KDatabase * subdb = nullptr; + REQUIRE_RC( KDBManagerOpenDBRead( m_mgr, & subdb, "testdb/db/subdb1" ) ); + REQUIRE_NOT_NULL( subdb ); + const KDatabase * parent = nullptr; + REQUIRE_RC( KDatabaseOpenParentRead( subdb, & parent ) ); + REQUIRE_EQ( m_db, parent ); + KDatabaseRelease( parent ); + KDatabaseRelease( subdb ); +} + //////////////////////////////////////////// Main extern "C" { From 6be266a21cf2fd90bed2e345366e25d033f4bd8b Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Tue, 26 Dec 2023 14:43:18 -0500 Subject: [PATCH 16/42] VDB-4293: added KNSManagerMakeTimedClientRequest --- interfaces/kns/http.h | 12 ++++++++++++ libs/cloud/cloud-cmn.c | 13 ++++--------- libs/kns/http-request.c | 28 ++++++++++++++++++++++++---- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/interfaces/kns/http.h b/interfaces/kns/http.h index 91e581088..6c37fcd8d 100644 --- a/interfaces/kns/http.h +++ b/interfaces/kns/http.h @@ -209,17 +209,29 @@ typedef struct KClientHttpRequest KClientHttpRequest, KHttpRequest; * * "vers" [ IN ] - http version * + * "readMillis, writeMillis" [ IN ] - read, write timeouts + * to supply to sockets - when negative, infinite timeout; + * when 0, return immediately; positive gives maximum wait time in sec/mS + * for reads and writes respectively. + * * "conn" [ IN, NULL OKAY ] - previously opened stream for communications. * * "url" [ IN ] - full resource identifier. if "conn" is NULL, * the url is parsed for remote endpoint and is opened by mgr. */ +/* Use timeouts from KNSManager */ KNS_EXTERN rc_t CC KClientHttpMakeRequest ( const KClientHttp *self, KClientHttpRequest **req, const char *url, ... ); +/* Use timeouts from KNSManager */ KNS_EXTERN rc_t CC KNSManagerMakeClientRequest ( struct KNSManager const *self, KClientHttpRequest **req, ver_t version, struct KStream *conn, const char *url, ... ); +/* Timeouts are specified */ +KNS_EXTERN rc_t CC KNSManagerMakeTimedClientRequest ( + struct KNSManager const *self, + KClientHttpRequest **req, ver_t version, int32_t readMillis, + int32_t writeMillis, struct KStream *conn, const char *url, ... ); /* AddRef * Release diff --git a/libs/cloud/cloud-cmn.c b/libs/cloud/cloud-cmn.c index dac9d1b2f..7686d5f08 100644 --- a/libs/cloud/cloud-cmn.c +++ b/libs/cloud/cloud-cmn.c @@ -49,21 +49,18 @@ rc_t KNSManager_Read(const struct KNSManager *cself, char *buffer, size_t bsize, KClientHttpRequest *req = NULL; int32_t cmsec = 0; - int32_t rmsec = 0; - int32_t wmsec = 0; assert(self); /* save existing timeouts */ cmsec = self->conn_timeout; - rmsec = self->http_read_timeout; - wmsec = self->http_write_timeout; /* minimize timeouts to check cloudy URLs */ - self -> conn_timeout - = self -> http_read_timeout = self->http_write_timeout = 500; + self -> conn_timeout = 500; - rc = KNSManagerMakeRequest(self, &req, 0x01010000, NULL, url); + /* minimize timeouts to check cloudy URLs */ + rc = KNSManagerMakeTimedClientRequest( + self, &req, 0x01010000, 500, 500, NULL, url); if (rc == 0 && hdrName != NULL) { @@ -110,8 +107,6 @@ rc_t KNSManager_Read(const struct KNSManager *cself, char *buffer, size_t bsize, /* restore timeouts in KNSManager */ self->conn_timeout = cmsec; - self->http_read_timeout = rmsec; - self->http_write_timeout = wmsec; RELEASE(KClientHttpRequest, req); diff --git a/libs/kns/http-request.c b/libs/kns/http-request.c index a5e13dc49..5691092b6 100644 --- a/libs/kns/http-request.c +++ b/libs/kns/http-request.c @@ -291,7 +291,9 @@ LIB_EXPORT rc_t CC KClientHttpMakeRequest ( const KClientHttp *self, */ static rc_t CC KNSManagerMakeClientRequestInt ( const KNSManager *self, - KClientHttpRequest **req, ver_t vers, KStream *conn, bool reliable, const char *url, va_list args ) + KClientHttpRequest **req, + ver_t vers, int32_t readMillis, int32_t writeMillis, + KStream *conn, bool reliable, const char *url, va_list args ) { rc_t rc; @@ -327,7 +329,8 @@ rc_t CC KNSManagerMakeClientRequestInt ( const KNSManager *self, KClientHttp * http; rc = KNSManagerMakeClientHttpInt ( self, & http, & buf, conn, vers, - self -> http_read_timeout, self -> http_write_timeout, & block . host, block . port, reliable, block . tls ); + readMillis, writeMillis, & block . host, + block . port, reliable, block . tls ); if ( rc == 0 ) { rc = KClientHttpMakeRequestInt ( http, req, & block, & buf ); @@ -348,7 +351,9 @@ LIB_EXPORT rc_t CC KNSManagerMakeClientRequest ( const KNSManager *self, rc_t rc; va_list args; va_start ( args, url ); - rc = KNSManagerMakeClientRequestInt ( self, req, vers, conn, false, url, args ); + rc = KNSManagerMakeClientRequestInt ( self, req, + vers, self->http_read_timeout, self->http_write_timeout, + conn, false, url, args ); va_end ( args ); return rc; } @@ -359,11 +364,26 @@ LIB_EXPORT rc_t CC KNSManagerMakeReliableClientRequest ( const KNSManager *self, rc_t rc; va_list args; va_start ( args, url ); - rc = KNSManagerMakeClientRequestInt ( self, req, vers, conn, true, url, args ); + rc = KNSManagerMakeClientRequestInt ( self, req, + vers, self->http_read_timeout, self->http_write_timeout, + conn, true, url, args ); va_end ( args ); return rc; } +LIB_EXPORT rc_t CC KNSManagerMakeTimedClientRequest(const KNSManager *self, + KClientHttpRequest **req, ver_t vers, int32_t readMillis, + int32_t writeMillis, KStream *conn, const char *url, ...) +{ + rc_t rc; + va_list args; + va_start(args, url); + rc = KNSManagerMakeClientRequestInt(self, req, + vers, readMillis, writeMillis, conn, false, url, args); + va_end(args); + return rc; +} + /* AddRef * Release From 1d5e5a6baeb12101320acd300b2c29dbd9bbff3d Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Tue, 26 Dec 2023 17:08:20 -0500 Subject: [PATCH 17/42] VDB-4293: allow to use not Manager's connect timeout --- interfaces/kns/http.h | 8 ++--- interfaces/kns/socket.h | 12 +++++-- libs/cloud/cloud-cmn.c | 13 +------- libs/kns/http-client.c | 13 +++++--- libs/kns/http-file.c | 3 +- libs/kns/http-priv.h | 3 +- libs/kns/http-request.c | 18 ++++++----- libs/kns/manager.c | 70 +++++++++++++++++++++++++++-------------- 8 files changed, 83 insertions(+), 57 deletions(-) diff --git a/interfaces/kns/http.h b/interfaces/kns/http.h index 6c37fcd8d..ee9189ed9 100644 --- a/interfaces/kns/http.h +++ b/interfaces/kns/http.h @@ -209,8 +209,8 @@ typedef struct KClientHttpRequest KClientHttpRequest, KHttpRequest; * * "vers" [ IN ] - http version * - * "readMillis, writeMillis" [ IN ] - read, write timeouts - * to supply to sockets - when negative, infinite timeout; + * "connectMillis", "readMillis, writeMillis" [ IN ] - connect/read/write + * timeouts to supply to sockets - when negative, infinite timeout; * when 0, return immediately; positive gives maximum wait time in sec/mS * for reads and writes respectively. * @@ -229,8 +229,8 @@ KNS_EXTERN rc_t CC KNSManagerMakeClientRequest ( struct KNSManager const *self, /* Timeouts are specified */ KNS_EXTERN rc_t CC KNSManagerMakeTimedClientRequest ( - struct KNSManager const *self, - KClientHttpRequest **req, ver_t version, int32_t readMillis, + struct KNSManager const *self, KClientHttpRequest **req, + ver_t version, int32_t connMillis, int32_t readMillis, int32_t writeMillis, struct KStream *conn, const char *url, ... ); /* AddRef diff --git a/interfaces/kns/socket.h b/interfaces/kns/socket.h index 1baee5e87..65148441f 100644 --- a/interfaces/kns/socket.h +++ b/interfaces/kns/socket.h @@ -68,8 +68,9 @@ typedef struct KSocket KSocket; * "retryTimeout" [ IN ] - the connect request should be repeated upon failure * until this timeout expires. * - * "readMillis" [ IN ] and "writeMillis" - when negative, infinite timeout - * when 0, return immediately, positive gives maximum wait time in mS + * "connectMillis", "readMillis" and "writeMillis" [ IN ] - when negative, + * infinite timeout; + * when 0, return immediately; positive gives maximum wait time in mS * for reads and writes respectively. * * "from" [ IN ] - client endpoint @@ -78,12 +79,17 @@ typedef struct KSocket KSocket; * * both endpoints have to be of type epIP; creates a TCP connection */ + /* Use connectMillis from KNSManager */ KNS_EXTERN rc_t CC KNSManagerMakeConnection ( struct KNSManager const * self, struct KSocket ** conn, struct KEndPoint const * from, struct KEndPoint const * to ); - KNS_EXTERN rc_t CC KNSManagerMakeTimedConnection ( struct KNSManager const * self, struct KSocket ** conn, int32_t readMillis, int32_t writeMillis, struct KEndPoint const * from, struct KEndPoint const * to ); +/* connectMillis is specified */ +KNS_EXTERN rc_t CC KNSManagerMakeTimedConnectionExt ( + struct KNSManager const * self, struct KSocket ** conn, + int32_t connectMillis, int32_t readMillis, int32_t writeMillis, + struct KEndPoint const * from, struct KEndPoint const * to ); KNS_EXTERN rc_t CC KNSManagerMakeRetryConnection ( struct KNSManager const * self, struct KSocket ** conn, struct timeout_t * retryTimeout, diff --git a/libs/cloud/cloud-cmn.c b/libs/cloud/cloud-cmn.c index 7686d5f08..4882ab490 100644 --- a/libs/cloud/cloud-cmn.c +++ b/libs/cloud/cloud-cmn.c @@ -48,19 +48,11 @@ rc_t KNSManager_Read(const struct KNSManager *cself, char *buffer, size_t bsize, KClientHttpRequest *req = NULL; - int32_t cmsec = 0; - assert(self); - /* save existing timeouts */ - cmsec = self->conn_timeout; - - /* minimize timeouts to check cloudy URLs */ - self -> conn_timeout = 500; - /* minimize timeouts to check cloudy URLs */ rc = KNSManagerMakeTimedClientRequest( - self, &req, 0x01010000, 500, 500, NULL, url); + self, &req, 0x01010000, 500, 500, 500, NULL, url); if (rc == 0 && hdrName != NULL) { @@ -105,9 +97,6 @@ rc_t KNSManager_Read(const struct KNSManager *cself, char *buffer, size_t bsize, RELEASE(KClientHttpResult, rslt); } - /* restore timeouts in KNSManager */ - self->conn_timeout = cmsec; - RELEASE(KClientHttpRequest, req); return rc; diff --git a/libs/kns/http-client.c b/libs/kns/http-client.c index a3252bf57..d6d992075 100644 --- a/libs/kns/http-client.c +++ b/libs/kns/http-client.c @@ -518,8 +518,9 @@ rc_t KClientHttpOpen ( KClientHttp * self, const String * aHostname, uint32_t aP /* try to establish a connection */ /* "read_timeout", "write_timeout" - when negative, infinite timeout */ - rc = KNSManagerMakeTimedConnection(mgr, &sock, - self->read_timeout, self->write_timeout, NULL, &self->ep); + rc = KNSManagerMakeTimedConnectionExt(mgr, &sock, + self->conn_timeout, self->read_timeout, self->write_timeout, + NULL, &self->ep); /* if we connected to a proxy, try to follow-through to server */ if (proxy_ep && self->tls && rc == 0) @@ -771,7 +772,7 @@ rc_t KClientHttpInit ( KClientHttp * http, const KDataBuffer *hostname_buffer, v */ rc_t KNSManagerMakeClientHttpInt ( const KNSManager *self, KClientHttp **_http, const KDataBuffer *hostname_buffer, KStream *opt_conn, - ver_t vers, int32_t readMillis, int32_t writeMillis, + ver_t vers, int32_t connMillis, int32_t readMillis, int32_t writeMillis, const String *host, uint32_t port, bool reliable, bool tls ) { rc_t rc; @@ -787,6 +788,7 @@ rc_t KNSManagerMakeClientHttpInt ( const KNSManager *self, KClientHttp **_http, char save, *text; http -> mgr = self; + http -> conn_timeout = connMillis; http -> read_timeout = readMillis; http -> write_timeout = writeMillis; @@ -896,8 +898,9 @@ rc_t KNSManagerMakeTimedClientHttpInt ( const KNSManager *self, port = dflt_port; /* initialize http object - will create a new reference to hostname buffer */ - rc = KNSManagerMakeClientHttpInt ( self, _http, & hostname_buffer, - opt_conn, vers, readMillis, writeMillis, &_host, port, false, tls ); + rc = KNSManagerMakeClientHttpInt ( self, _http, + & hostname_buffer, opt_conn, vers, self->conn_timeout, + readMillis, writeMillis, &_host, port, false, tls ); /* release our reference to buffer */ KDataBufferWhack ( & hostname_buffer ); diff --git a/libs/kns/http-file.c b/libs/kns/http-file.c index 76ded386f..d214d1a29 100644 --- a/libs/kns/http-file.c +++ b/libs/kns/http-file.c @@ -1334,7 +1334,8 @@ static rc_t KNSManagerVMakeHttpFileIntUnstableImpl( const KNSManager *self, { KDataBuffer * buf = & f -> orig_url_buffer; KClientHttp *http; - rc = KNSManagerMakeClientHttpInt ( self, & http, buf, conn, vers, + rc = KNSManagerMakeClientHttpInt ( self, & http, buf, conn, + vers, self -> conn_timeout, self -> http_read_timeout, self -> http_write_timeout, & f -> block . host, f -> block . port, reliable, f -> block . tls ); if ( rc == 0 ) { diff --git a/libs/kns/http-priv.h b/libs/kns/http-priv.h index 956ebd008..ba0048fab 100644 --- a/libs/kns/http-priv.h +++ b/libs/kns/http-priv.h @@ -175,6 +175,7 @@ struct KClientHttp KRefcount refcount; + int32_t conn_timeout; int32_t read_timeout; int32_t write_timeout; @@ -202,7 +203,7 @@ rc_t KClientHttpReopen ( struct KClientHttp * self ); rc_t KNSManagerMakeClientHttpInt ( struct KNSManager const *self, struct KClientHttp **_http, const KDataBuffer *hostname_buffer, struct KStream *opt_conn, - ver_t vers, int32_t readMillis, int32_t writeMillis, + ver_t vers, int32_t connMillis, int32_t readMillis, int32_t writeMillis, const String *host, uint32_t port, bool reliable, bool tls ); rc_t KClientHttpVAddHeader ( BSTree *hdrs, bool add, const char *_name, const char *_val, va_list args ); diff --git a/libs/kns/http-request.c b/libs/kns/http-request.c index 5691092b6..b83143767 100644 --- a/libs/kns/http-request.c +++ b/libs/kns/http-request.c @@ -292,7 +292,7 @@ LIB_EXPORT rc_t CC KClientHttpMakeRequest ( const KClientHttp *self, static rc_t CC KNSManagerMakeClientRequestInt ( const KNSManager *self, KClientHttpRequest **req, - ver_t vers, int32_t readMillis, int32_t writeMillis, + ver_t vers, int32_t connMillis, int32_t readMillis, int32_t writeMillis, KStream *conn, bool reliable, const char *url, va_list args ) { rc_t rc; @@ -328,7 +328,8 @@ rc_t CC KNSManagerMakeClientRequestInt ( const KNSManager *self, { KClientHttp * http; - rc = KNSManagerMakeClientHttpInt ( self, & http, & buf, conn, vers, + rc = KNSManagerMakeClientHttpInt ( self, & http, & buf, + conn, vers, connMillis, readMillis, writeMillis, & block . host, block . port, reliable, block . tls ); if ( rc == 0 ) @@ -351,8 +352,8 @@ LIB_EXPORT rc_t CC KNSManagerMakeClientRequest ( const KNSManager *self, rc_t rc; va_list args; va_start ( args, url ); - rc = KNSManagerMakeClientRequestInt ( self, req, - vers, self->http_read_timeout, self->http_write_timeout, + rc = KNSManagerMakeClientRequestInt ( self, req, vers, + self->conn_timeout, self->http_read_timeout, self->http_write_timeout, conn, false, url, args ); va_end ( args ); return rc; @@ -364,22 +365,23 @@ LIB_EXPORT rc_t CC KNSManagerMakeReliableClientRequest ( const KNSManager *self, rc_t rc; va_list args; va_start ( args, url ); - rc = KNSManagerMakeClientRequestInt ( self, req, - vers, self->http_read_timeout, self->http_write_timeout, + rc = KNSManagerMakeClientRequestInt ( self, req, vers, + self->conn_timeout, self->http_read_timeout, self->http_write_timeout, conn, true, url, args ); va_end ( args ); return rc; } LIB_EXPORT rc_t CC KNSManagerMakeTimedClientRequest(const KNSManager *self, - KClientHttpRequest **req, ver_t vers, int32_t readMillis, + KClientHttpRequest **req, + ver_t vers, int32_t connMillis, int32_t readMillis, int32_t writeMillis, KStream *conn, const char *url, ...) { rc_t rc; va_list args; va_start(args, url); rc = KNSManagerMakeClientRequestInt(self, req, - vers, readMillis, writeMillis, conn, false, url, args); + vers, connMillis, readMillis, writeMillis, conn, false, url, args); va_end(args); return rc; } diff --git a/libs/kns/manager.c b/libs/kns/manager.c index 80d881fc9..243bd1420 100644 --- a/libs/kns/manager.c +++ b/libs/kns/manager.c @@ -334,27 +334,9 @@ LIB_EXPORT rc_t CC KNSManagerMakeConnection ( const KNSManager *self, return KNSManagerMakeRetryTimedConnection ( self, conn, ptm, self->conn_read_timeout, self->conn_write_timeout, from, to ); } -/* MakeTimedConnection - * create a connection-oriented stream - * - * "conn" [ OUT ] - a stream for communication with the server - * - * "retryTimeout" [ IN ] - if connection is refused, retry with 1ms intervals: - * when negative, retry infinitely, when 0, do not retry, positive gives maximum - * wait time in seconds - * - * "readMillis" [ IN ] and "writeMillis" - when negative, infinite timeout - * when 0, return immediately, positive gives maximum wait time in mS - * for reads and writes respectively. - * - * "from" [ IN ] - client endpoint - * - * "to" [ IN ] - server endpoint - * - * both endpoints have to be of type epIP; creates a TCP connection - */ -LIB_EXPORT rc_t CC KNSManagerMakeTimedConnection ( - struct KNSManager const *self, struct KSocket **conn, int32_t readMillis, + +static rc_t KNSManagerMakeTimedConnectionInt ( struct KNSManager const *self, + struct KSocket **conn, int32_t connectMillis, int32_t readMillis, int32_t writeMillis, struct KEndPoint const *from, struct KEndPoint const *to ) { @@ -371,8 +353,8 @@ LIB_EXPORT rc_t CC KNSManagerMakeTimedConnection ( return RC ( rcNS, rcStream, rcConstructing, rcSelf, rcNull ); } - if (self->conn_timeout >=0 ) { - TimeoutInit ( &tm, self->conn_timeout ); + if (connectMillis >=0 ) { + TimeoutInit ( &tm, connectMillis ); ptm = &tm; } @@ -380,6 +362,48 @@ LIB_EXPORT rc_t CC KNSManagerMakeTimedConnection ( self, conn, ptm, readMillis, writeMillis, from, to ); } +/* MakeTimedConnection, MakeTimedConnectionExt + * create a connection-oriented stream + * + * "conn" [ OUT ] - a stream for communication with the server + * + * "retryTimeout" [ IN ] - if connection is refused, retry with 1ms intervals: + * when negative, retry infinitely, when 0, do not retry, positive gives maximum + * wait time in seconds + * + * "connectMillis", "readMillis" and "writeMillis" [ IN ] - when negative, + * infinite timeout; + * when 0, return immediately; positive gives maximum wait time in mS + * for connection, reads and writes respectively. + * + * "from" [ IN ] - client endpoint + * + * "to" [ IN ] - server endpoint + * + * both endpoints have to be of type epIP; creates a TCP connection + */ +/* Use connectMillis from KNSManager */ +LIB_EXPORT rc_t CC KNSManagerMakeTimedConnection( + struct KNSManager const *self, struct KSocket **conn, int32_t readMillis, + int32_t writeMillis, struct KEndPoint const *from, + struct KEndPoint const *to) +{ + if (self == NULL) + return RC(rcNS, rcStream, rcConstructing, rcSelf, rcNull); + + return KNSManagerMakeTimedConnectionInt( + self, conn, self->conn_timeout, readMillis, writeMillis, from, to); +} +/* connectMillis is specified */ +LIB_EXPORT rc_t CC KNSManagerMakeTimedConnectionExt ( + struct KNSManager const *self, struct KSocket **conn, int32_t connectMillis, + int32_t readMillis, int32_t writeMillis, struct KEndPoint const *from, + struct KEndPoint const *to ) +{ + return KNSManagerMakeTimedConnectionInt( + self, conn, connectMillis, readMillis, writeMillis, from, to); + } + /* MakeRetryConnection * create a connection-oriented stream * From f7cf8365cf505134b503d56a1cc252a85819818e Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Wed, 27 Dec 2023 14:30:57 -0500 Subject: [PATCH 18/42] VDB-4293: check for self==NULL in KNSManagerMake[Reliable]ClientRequest --- libs/kns/http-request.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/kns/http-request.c b/libs/kns/http-request.c index b83143767..67ff0f1cf 100644 --- a/libs/kns/http-request.c +++ b/libs/kns/http-request.c @@ -351,6 +351,8 @@ LIB_EXPORT rc_t CC KNSManagerMakeClientRequest ( const KNSManager *self, { rc_t rc; va_list args; + if (self == NULL) + return RC(rcNS, rcNoTarg, rcValidating, rcSelf, rcNull); va_start ( args, url ); rc = KNSManagerMakeClientRequestInt ( self, req, vers, self->conn_timeout, self->http_read_timeout, self->http_write_timeout, @@ -364,6 +366,8 @@ LIB_EXPORT rc_t CC KNSManagerMakeReliableClientRequest ( const KNSManager *self, { rc_t rc; va_list args; + if (self == NULL) + return RC(rcNS, rcNoTarg, rcValidating, rcSelf, rcNull); va_start ( args, url ); rc = KNSManagerMakeClientRequestInt ( self, req, vers, self->conn_timeout, self->http_read_timeout, self->http_write_timeout, From d4ed7ff1ffcd254538180c17196976dc37cbff85 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Thu, 28 Dec 2023 13:59:46 -0500 Subject: [PATCH 19/42] VDB-5498 saving work --- libs/kdbtext/api-manager.cpp | 20 ++- libs/kdbtext/database.cpp | 309 ++++++++++++++++++--------------- libs/kdbtext/database.hpp | 22 +-- libs/kdbtext/manager.cpp | 155 ++++++++++++----- libs/kdbtext/manager.hpp | 16 +- test/kdbtext/test-database.cpp | 81 ++++++--- 6 files changed, 374 insertions(+), 229 deletions(-) diff --git a/libs/kdbtext/api-manager.cpp b/libs/kdbtext/api-manager.cpp index 0352c7b67..1491848f2 100644 --- a/libs/kdbtext/api-manager.cpp +++ b/libs/kdbtext/api-manager.cpp @@ -213,7 +213,10 @@ KTextManagerVOpenDBRead ( const KDBManager *bself, const KDatabase **p_db, const PrintToString( fmt, args, path ); const Database * db = nullptr; rc_t rc = self -> openDatabase( Path( path ), db ); - *p_db = (const KDatabase *)db; + if ( rc == 0 ) + { + *p_db = (const KDatabase *)db; + } return rc; } @@ -228,7 +231,10 @@ KTextManagerVOpenTableRead ( const KDBManager *bself, const KTable **p_tbl, cons PrintToString( fmt, args, path ); const Table * tbl = nullptr; rc_t rc = self -> openTable( Path( path ), tbl ); - *p_tbl = (const KTable *)tbl; + if ( rc == 0 ) + { + *p_tbl = (const KTable *)tbl; + } return rc; } @@ -241,7 +247,10 @@ KTextManagerOpenTableReadVPath(const KDBManager *bself, const KTable **p_tbl, co const Table * tbl = nullptr; rc_t rc = self -> openTable( Path( p_path ), tbl ); - *p_tbl = (const KTable *)tbl; + if ( rc == 0 ) + { + *p_tbl = (const KTable *)tbl; + } return rc; } @@ -261,7 +270,10 @@ KTextManagerVPathOpenLocalDBRead ( const KDBManager * bself, struct KDatabase co const Database * db = nullptr; rc_t rc = self -> openDatabase( Path( vpath ), db ); - *p_db = (const KDatabase *)db; + if ( rc == 0 ) + { + *p_db = (const KDatabase *)db; + } return rc; } diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 8862c1278..4cd65948a 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -47,8 +47,8 @@ static bool CC KTextDatabaseIsAlias ( const KTextDatabase *self, uint32_t type, static rc_t CC KTextDatabaseVWritable ( const KTextDatabase *self, uint32_t type, const char *name, va_list args ); static rc_t CC KTextDatabaseOpenManagerRead ( const KTextDatabase *self, const KDBManager **mgr ); static rc_t CC KTextDatabaseOpenParentRead ( const KTextDatabase *self, const KDatabase **par ); -// static rc_t CC KTextDatabaseOpenDirectoryRead ( const KTextDatabase *self, const KDirectory **dir ); -// static rc_t CC KTextDatabaseVOpenDBRead ( const KTextDatabase *self, const KDatabase **dbp, const char *name, va_list args ); +static rc_t CC KTextDatabaseOpenDirectoryRead ( const KTextDatabase *self, const KDirectory **dir ); +static rc_t CC KTextDatabaseVOpenDBRead ( const KTextDatabase *self, const KDatabase **dbp, const char *name, va_list args ); // static rc_t CC KTextDatabaseVOpenTableRead ( const KTextDatabase *self, const KTable **tblp, const char *name, va_list args ); // static rc_t CC KTextDatabaseOpenMetadataRead ( const KTextDatabase *self, const KMetadata **metap ); // static rc_t CC KTextDatabaseVOpenIndexRead ( const KTextDatabase *self, const KIndex **idxp, const char *name, va_list args ); @@ -68,8 +68,8 @@ static KDatabase_vt KTextDatabase_vt = KTextDatabaseVWritable, KTextDatabaseOpenManagerRead, KTextDatabaseOpenParentRead, - // KTextDatabaseOpenDirectoryRead, - // KTextDatabaseVOpenDBRead, + KTextDatabaseOpenDirectoryRead, + KTextDatabaseVOpenDBRead, // KTextDatabaseVOpenTableRead, // KTextDatabaseOpenMetadataRead, // KTextDatabaseVOpenIndexRead, @@ -79,91 +79,64 @@ static KDatabase_vt KTextDatabase_vt = // KTextDatabaseGetPath }; +static char error[1024]; + Database::Database( const KJsonObject * p_json, const Manager * p_mgr, const Database * p_parent ) : m_mgr( p_mgr ), m_parent( p_parent ), m_json ( p_json ) { dad . vt = & KTextDatabase_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::Database", "ctor", "db" ); + + if ( m_mgr != nullptr ) + { + Manager::addRef( m_mgr ); + } } Database::~Database() { - for( auto & d : m_tables ) - { - KTableRelease( (const KTable*) d ); - } - for( auto & d : m_subdbs ) - { - KDatabaseRelease( (const KDatabase*) d ); - } - KRefcountWhack ( & dad . refcount, "KDBText::Database" ); if ( m_mgr != nullptr ) { - m_mgr -> sever(); - } - if ( m_parent != nullptr ) - { - m_parent -> sever(); + Manager::release( m_mgr ); } + KRefcountWhack ( & dad . refcount, "KDBText::Database" ); } void -Database::attach() const +Database::addRef( const Database * mgr ) { - KRefcountAdd( & dad . refcount, "KDBText::Database" ); + KDatabaseAddRef( (const KDatabase*) mgr ); } void -Database::sever() const +Database::release( const Database * mgr ) { - KRefcountDrop( & dad . refcount, "KDBText::Database" ); + KDatabaseRelease( (const KDatabase*) mgr ); } const Database * -Database::findDatabase( const string & p_name ) const -{ // shallow search for a db - for( auto & d : m_subdbs ) - { - if ( p_name == d -> getName() ) - { - return d; - } - } - return nullptr; -} - -const Table * -Database::findTable( const std::string & name ) const -{ // shallow search for a table - for( auto & d : m_tables ) - { - if ( name == d -> getName() ) - { - return d; - } - } - return nullptr; -} - -const Database * -Database::getDatabase( Path & p_path ) const +Database::openDatabase( Path & p_path ) const { if ( ! p_path.empty() && p_path.front() == m_name ) { p_path.pop(); if ( p_path.empty() ) - { - return this; + { // return a new copy of this db + Database * ret = new Database( m_json, m_mgr, this ); + ret -> inflate( error, sizeof error ); + return ret; } if ( p_path.front() == "db" ) { p_path.pop(); if ( ! p_path.empty() ) { - const Database * db = findDatabase( p_path.front() ); - if ( db != nullptr ) + auto j = m_subdbs.find( p_path.front() ); + if ( j != m_subdbs.end() ) { - return db -> getDatabase( p_path ); + Database * ret = new Database( j -> second, m_mgr, this ); + ret -> inflate( error, sizeof error ); + return ret; } } } @@ -171,31 +144,58 @@ Database::getDatabase( Path & p_path ) const return nullptr; } +const Database * +Database::openSubDatabase( std::string & name ) const +{ + auto j = m_subdbs.find( name ); + if ( j != m_subdbs.end() ) + { + Database * ret = new Database( j -> second, m_mgr, this ); + ret -> inflate( error, sizeof error ); + return ret; + } + return nullptr; +} + + const Table * -Database::getTable( Path & p_path ) const +Database::openTable( Path & p_path ) const { if ( ! p_path.empty() && p_path.front() == m_name ) { p_path.pop(); - if ( ! p_path.empty() ) + } + if ( ! p_path.empty() ) + { + if ( p_path.front() == "tbl" ) { - if ( p_path.front() == "tbl" ) + p_path.pop(); + if ( ! p_path.empty() ) { - p_path.pop(); - if ( ! p_path.empty() ) + auto j = m_tables.find( p_path.front() ); + if ( j != m_tables.end() ) { - return findTable( p_path.front() ); + Table * ret = new Table( j -> second ); + ret -> inflate( error, sizeof error ); + return ret; } } - else if ( p_path.front() == "db" ) + } + else if ( p_path.front() == "db" ) + { + p_path.pop(); + if ( ! p_path.empty() ) { - p_path.pop(); - if ( ! p_path.empty() ) + auto j = m_subdbs.find( p_path.front() ); + if ( j != m_subdbs.end() ) { - const Database * db = findDatabase( p_path.front() ); + Database * db = new Database( j -> second, m_mgr, this ); if ( db != nullptr ) { - return db -> getTable( p_path ); + db -> inflate( error, sizeof error); + const Table * ret = db -> openTable( p_path ); + delete db; + return ret; } } } @@ -205,7 +205,7 @@ Database::getTable( Path & p_path ) const } rc_t -Database::inflate( char * error, size_t error_size ) +Database::inflate( char * p_error, size_t error_size ) { rc_t rc = 0; @@ -221,7 +221,7 @@ Database::inflate( char * error, size_t error_size ) } else { - string_printf ( error, error_size, nullptr, "Database name is missing" ); + string_printf ( p_error, error_size, nullptr, "Database name is missing" ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } @@ -234,19 +234,19 @@ Database::inflate( char * error, size_t error_size ) { if ( strcmp( "database", typeStr ) != 0 ) { - string_printf ( error, error_size, nullptr, "%s.type is not 'database'('%s')", m_name.c_str(), typeStr ); + string_printf ( p_error, error_size, nullptr, "%s.type is not 'database'('%s')", m_name.c_str(), typeStr ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } } else { - string_printf ( error, error_size, nullptr, "%s.type is invalid", m_name.c_str() ); + string_printf ( p_error, error_size, nullptr, "%s.type is invalid", m_name.c_str() ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } } else { - string_printf ( error, error_size, nullptr, "%s.type is missing", m_name.c_str() ); + string_printf ( p_error, error_size, nullptr, "%s.type is missing", m_name.c_str() ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } @@ -257,7 +257,7 @@ Database::inflate( char * error, size_t error_size ) const KJsonArray * dbarr = KJsonValueToArray ( dbs ); if ( dbarr == nullptr ) { - string_printf ( error, error_size, nullptr, "%s.databases is not an array", m_name.c_str() ); + string_printf ( p_error, error_size, nullptr, "%s.databases is not an array", m_name.c_str() ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } @@ -269,28 +269,23 @@ Database::inflate( char * error, size_t error_size ) const KJsonObject * obj = KJsonValueToObject ( v ); if( obj != nullptr ) { - Database * subdb = new Database ( obj, m_mgr, this ); - rc = subdb -> inflate ( error, error_size ); + Database subdb ( obj, m_mgr, this ); // temporary, for Json verification + rc = subdb . inflate ( p_error, error_size ); if ( rc != 0 ) { - delete subdb; return rc; } - for( auto & d : m_subdbs ) + if ( m_subdbs.find( subdb . getName() ) != m_subdbs . end() ) { - if ( subdb -> getName() == d -> getName() ) - { - string_printf ( error, error_size, nullptr, "Duplicate nested db: %s", subdb -> getName().c_str() ); - delete subdb; - return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); - } + string_printf ( p_error, error_size, nullptr, "Duplicate nested db: %s", subdb.getName().c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } - m_subdbs . push_back( subdb ); + m_subdbs [ subdb . getName() ] = obj; } else { // not an object - string_printf ( error, error_size, nullptr, "%s.databases[%i] is not an object", m_name.c_str(), i ); + string_printf ( p_error, error_size, nullptr, "%s.databases[%i] is not an object", m_name.c_str(), i ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } } @@ -303,7 +298,7 @@ Database::inflate( char * error, size_t error_size ) const KJsonArray * tblarr = KJsonValueToArray ( tables ); if ( tblarr == nullptr ) { - string_printf ( error, error_size, nullptr, "%s.tables is not an array", m_name.c_str() ); + string_printf ( p_error, error_size, nullptr, "%s.tables is not an array", m_name.c_str() ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } uint32_t len = KJsonArrayGetLength ( tblarr ); @@ -314,28 +309,23 @@ Database::inflate( char * error, size_t error_size ) const KJsonObject * obj = KJsonValueToObject ( v ); if( obj != nullptr ) { - Table * tbl = new Table( obj ); - rc = tbl -> inflate ( error, error_size ); + Table tbl ( obj ); + rc = tbl . inflate ( p_error, error_size ); if ( rc != 0 ) { - delete tbl; return rc; } - for( auto & t : m_tables ) + if ( m_tables.find( tbl . getName() ) != m_tables . end() ) { - if ( tbl -> getName() == t -> getName() ) - { - string_printf ( error, error_size, nullptr, "Duplicate table: %s", tbl -> getName().c_str() ); - delete tbl; - return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); - } + string_printf ( p_error, error_size, nullptr, "Duplicate table: %s", tbl.getName().c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } - m_tables . push_back( tbl ); + m_tables [ tbl . getName() ] = obj; } else { // not an object - string_printf ( error, error_size, nullptr, "%s.tables[%i] is not an object", m_name.c_str(), i ); + string_printf ( p_error, error_size, nullptr, "%s.tables[%i] is not an object", m_name.c_str(), i ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } } @@ -345,46 +335,50 @@ Database::inflate( char * error, size_t error_size ) } int -Database::pathType( Path & p ) const -{ - if ( ! p.empty() && p.front() == m_name ) +Database::pathType( Path & path ) const +{ //TODO: use only Json? + int ret = kptNotFound; + if ( path.size() == 1 && m_name == path.front() ) { - p.pop(); - if ( p.empty() ) - { - return kptDatabase; - } - if ( p.front() == "db" ) + ret = kptDatabase; + } + else if ( ! path.empty() ) + { + if ( m_name == path.front() ) { - p.pop(); - if ( ! p.empty() ) + path.pop(); + if ( path.size() > 1 ) { - const Database * db = findDatabase( p.front() ); - if ( db != nullptr ) + if ( path.front() == "db" ) { - return db->pathType( p ); + path.pop(); + const Database * db = openSubDatabase( path.front() ); + if ( db != nullptr ) + { + ret = db->pathType( path ); + delete db; + } } - } - } - else if ( p.front() == "tbl" ) - { - p.pop(); - if ( ! p.empty() ) - { - const Table * t = findTable( p.front() ); - if ( t != nullptr ) + else if ( path.front() == "tbl" ) { - return t -> pathType( p ); + const Table * tbl = openTable( path ); + if ( tbl != nullptr ) + { + ret = tbl -> pathType( path ); + delete tbl; + } } + //TODO: index, metadata, etc } } } - return kptNotFound; + + return ret; } bool Database::exists( uint32_t requested, Path & path ) const -{ +{ //TODO: use only Json? if ( ! path.empty() && m_name == path.front() ) { path.pop(); @@ -396,25 +390,22 @@ Database::exists( uint32_t requested, Path & path ) const if ( string("db") == path.front() ) { path.pop(); - if ( ! path.empty() ) + const Database * db = openSubDatabase( path.front() ); + if ( db != nullptr ) { - const Database * db = findDatabase( path.front() ); - if ( db != nullptr ) - { - return db->exists( requested, path ); - } + bool ret = db->exists( requested, path ); + delete db; + return ret; } } else if ( string("tbl") == path.front() ) { - path.pop(); - if ( ! path.empty() ) + const Table * tbl = openTable( path ); + if ( tbl != nullptr ) { - const Table * tbl= findTable( path.front() ); - if ( tbl != nullptr ) - { - return tbl -> exists( requested, path ); - } + bool ret = tbl -> exists( requested, path ); + delete tbl; + return ret; } } // case kptMetadata: @@ -474,13 +465,12 @@ KTextDatabaseOpenManagerRead ( const KTextDatabase *bself, const KDBManager **mg CAST(); const KDBManager * m = (const KDBManager*) self -> getManager(); - if ( m != nullptr ) + rc_t rc = KDBManagerAddRef( m ); + if ( rc == 0 ) { - self -> getManager() -> attach(); + *mgr = m; } - - *mgr = m; - return 0; + return rc; } static @@ -489,13 +479,46 @@ KTextDatabaseOpenParentRead ( const KTextDatabase *bself, const KDatabase **par { CAST(); - const KDatabase * p = (const KDatabase*) self -> getParent(); + const Database * p = self -> getParent(); if ( p != nullptr ) { - self -> getParent() -> attach(); + Database::addRef( p ); } - *par = p; + *par = (const KDatabase*) p; return 0; } + +static +rc_t CC +KTextDatabaseOpenDirectoryRead ( const KTextDatabase *self, const KDirectory **dir ) +{ + return SILENT_RC ( rcDB, rcDatabase, rcAccessing, rcColumn, rcUnsupported ); +} + +static +rc_t CC +KTextDatabaseVOpenDBRead ( const KTextDatabase *bself, const KDatabase **dbp, const char *name, va_list args ) +{ + CAST(); + + Path p( name, args ); + if ( p.size() > 0 ) + { + const Database * db = self -> openSubDatabase( p.front() ); + if ( p.size() > 1 ) + { + p.pop(); + db = self -> openDatabase( p ); + } + + if ( db != nullptr ) + { + * dbp = (const KDatabase *)db; + return 0; + } + } + + return SILENT_RC( rcDB, rcDatabase, rcOpening, rcParam, rcInvalid ); +} diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index 431a2eed7..e36153a2f 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -42,6 +42,7 @@ struct KTextDatabase #include #include +#include namespace KDBText { @@ -51,11 +52,12 @@ namespace KDBText class Database : public KTextDatabase { public: - Database( const KJsonObject * p_json, const Manager * = nullptr, const Database * = nullptr ); - ~Database(); + static void addRef( const Database* ); + static void release( const Database *); - void attach() const; - void sever() const; + public: + Database( const KJsonObject * json, const Manager * mgr = nullptr, const Database * parent = nullptr ); + ~Database(); rc_t inflate( char * error, size_t error_size ); @@ -66,11 +68,10 @@ namespace KDBText const std::string & getName() const { return m_name; } - const Database * getDatabase( Path & path ) const; - const Database * findDatabase( const std::string & name ) const; + const Database * openDatabase( Path & path ) const; + const Database * openSubDatabase( std::string & name ) const; - const Table * getTable( Path & path ) const; - const Table * findTable( const std::string & name ) const; + const Table *openTable( Path & path ) const; int pathType( Path & ) const; bool exists( uint32_t requested, Path & p_path ) const; @@ -81,7 +82,8 @@ namespace KDBText const KJsonObject * m_json = nullptr; std::string m_name; - std::vector< const Database* > m_subdbs; - std::vector< const Table* >m_tables; + // verified Jsons: + std::map< std::string, const KJsonObject * > m_subdbs; + std::map< std::string, const KJsonObject * > m_tables; }; } diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index a2c6f2150..2551f9e0d 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -43,6 +43,7 @@ using namespace std; using namespace KDBText; Manager::Manager( const KDBManager_vt & vt) +: m_isDb( false ) { dad . vt = & vt; KRefcountInit ( & dad . refcount, 1, "KDBText::Manager", "ctor", "kmgr" ); @@ -50,22 +51,20 @@ Manager::Manager( const KDBManager_vt & vt) Manager::~Manager() { - KTableRelease( (KTable*) m_tbl); - KDatabaseRelease( (KDatabase*) m_db ); KJsonValueWhack( m_root ); KRefcountWhack ( & dad . refcount, "KDBText::Manager" ); } void -Manager::attach() const +Manager::addRef( const Manager * mgr ) { - KRefcountAdd( & dad . refcount, "KDBText::Manager" ); + KDBManagerAddRef( (const KDBManager*) mgr ); } void -Manager::sever() const +Manager::release( const Manager * mgr ) { - KRefcountDrop( & dad . refcount, "KDBText::Manager" ); + KDBManagerRelease( (const KDBManager*) mgr ); } rc_t @@ -92,16 +91,22 @@ Manager::parse( const char * input, char * error, size_t error_size ) const char * typeStr = nullptr; rc = KJsonGetString ( type, & typeStr ); if ( rc == 0 ) - { + { // determine the type of the root object (which is then discarded) if ( strcmp( typeStr, "database") == 0 ) { - m_db = new Database( rootObj, this ); - rc = m_db -> inflate( error, error_size ); + rc = Database( rootObj, this ) . inflate( error, error_size ); + if ( rc == 0 ) + { + m_isDb = true; + } } else if ( strcmp( typeStr, "table") == 0 ) { - m_tbl = new Table( rootObj ); - rc = m_tbl -> inflate( error, error_size ); + rc = Table( rootObj ) . inflate( error, error_size ); + if ( rc == 0 ) + { + m_isDb = false; + } } } } @@ -109,35 +114,88 @@ Manager::parse( const char * input, char * error, size_t error_size ) return rc; } +const Database * +Manager::getRootDatabase() const +{ + Database * db = new Database( KJsonValueToObject ( m_root ), this ); + char error[1024]; + if ( db -> inflate( error, sizeof error ) == 0 ) + { + return db; + } + delete db; + return nullptr; +} + +const Table * +Manager::getRootTable() const +{ + Table * tbl = new Table( KJsonValueToObject ( m_root ) ); + char error[1024]; + if ( tbl -> inflate( error, sizeof error ) == 0 ) + { + return tbl; + } + delete tbl; + return nullptr; +} + + int Manager::pathType( const Path & p_path ) const { Path path( p_path ); - if ( m_db != nullptr ) + int ret = kptNotFound; + + //TODO: do it without creating a DB/Tbl, by walking the Json + + if ( m_isDb ) { - return m_db -> pathType( path ); + const Database * db = getRootDatabase(); + if ( db != nullptr ) + { + ret = db -> pathType( path ); + } + delete db; } - if ( m_tbl != nullptr ) + else { - return m_tbl -> pathType( path ); + const Table * tbl = getRootTable(); + if ( tbl != nullptr ) + { + ret = tbl -> pathType( path ); + } + delete tbl; } - return kptNotFound; + return ret; } bool Manager::exists( uint32_t requested, const Path & p_path ) const { - Path path = p_path; - if ( m_db != nullptr ) + Path path( p_path ); + bool ret = false; + + //TODO: do it without creating a DB/Tbl, by walking the Json + if ( m_isDb ) { - return m_db -> exists( requested, path ); + const Database * db = getRootDatabase(); + if ( db != nullptr ) + { + ret = db -> exists( requested, path ); + } + delete db; } - if ( m_tbl != nullptr ) + else { - return m_tbl -> exists( requested, path ); + const Table * tbl = getRootTable(); + if ( tbl ) + { + ret = tbl -> exists( requested, path ); + } + delete tbl; } - // case kptMetadata: - return false; + return ret; } rc_t @@ -152,19 +210,24 @@ Manager::openDatabase( const Path & p_path, const Database *& p_db ) const { if ( ! p_path.empty() ) { - if ( m_db ) + if ( m_isDb ) { Path path ( p_path ); - const Database * db = m_db -> getDatabase( path ); - if ( db != nullptr ) + const Database * root = getRootDatabase(); + if ( root != nullptr ) { - rc_t rc = KDatabaseAddRef( (const KDatabase *)db ); - if ( rc != 0 ) + const Database * db = root -> openDatabase( path ); // could be same as root + if ( db != root ) + { + KDatabaseRelease( (const KDatabase *)root ); + p_db = db; + return 0; + } + else { - return rc; + p_db = root; + return 0; } - p_db = db; - return 0; } } } @@ -176,30 +239,34 @@ Manager::openTable( const Path & p_path, const Table *& p_tbl ) const { if ( ! p_path.empty() ) { - if ( m_tbl && m_tbl -> getName() == p_path.front() ) + if ( m_isDb ) { - rc_t rc = KTableAddRef( (const KTable *)m_tbl ); - if ( rc != 0 ) + Path path ( p_path ); + const Database * root = getRootDatabase(); + if ( root != nullptr ) { - return rc; + const Table * tbl = root -> openTable( path ); + KDatabaseRelease( (const KDatabase *)root ); + if ( tbl != nullptr ) + { + p_tbl = tbl; + return 0; + } } - p_tbl = m_tbl; - return 0; } - if ( m_db ) + else { Path path ( p_path ); - const Table * tbl = m_db -> getTable( path ); + const Table * tbl = getRootTable(); if ( tbl != nullptr ) { - rc_t rc = KTableAddRef( (const KTable *)tbl ); - if ( rc != 0 ) + if ( tbl -> getName() == p_path.front() ) { - return rc; + p_tbl = tbl; + return 0; } - p_tbl = tbl; - return 0; } + KTableRelease( (const KTable*)tbl ); } } return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); diff --git a/libs/kdbtext/manager.hpp b/libs/kdbtext/manager.hpp index 702e1dda2..ae6ebe8fc 100644 --- a/libs/kdbtext/manager.hpp +++ b/libs/kdbtext/manager.hpp @@ -38,17 +38,18 @@ namespace KDBText { class Manager : public KDBManager { + public: + static void addRef( const Manager* ); + static void release( const Manager *); + public: Manager( const KDBManager_vt& ); ~Manager(); - void attach() const; - void sever() const; - rc_t parse( const char * input, char * error, size_t error_size ); - const Database * getRootDatabase() const { return m_db; } - const Table * getRootTable() const { return m_tbl; } + const Database * getRootDatabase() const; + const Table * getRootTable() const; int pathType( const Path & path ) const; @@ -60,9 +61,8 @@ namespace KDBText rc_t openTable( const Path &, const Table *& ) const; private: - KJsonValue * m_root = nullptr; - Database * m_db = nullptr; - Table * m_tbl = nullptr; + KJsonValue * m_root = nullptr; //TODO: convert to KJsonObject + bool m_isDb; }; } diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index 4dd91d112..1b104f0d8 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -207,45 +208,69 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) { SetupAndInflate( NestedDb ); - REQUIRE_NULL( m_db -> findDatabase( "notthere") ); - REQUIRE_NOT_NULL( m_db -> findDatabase( "subdb1") ); - REQUIRE_NOT_NULL( m_db -> findDatabase( "subdb2") ); + { Path p( "notthere" ); REQUIRE_NULL( m_db -> openDatabase( p ) ); } + { + Path p( "testdb/db/subdb1" ); + const Database * d = m_db -> openDatabase( p ); + REQUIRE_NOT_NULL( d ); + delete d; + } + { + Path p( "testdb/db/subdb2" ); + const Database * d = m_db -> openDatabase( p ); + REQUIRE_NOT_NULL( d ); + delete d; + } - REQUIRE_NULL( m_db -> findTable( "notthere") ); - REQUIRE_NOT_NULL( m_db -> findTable( "tbl0-1") ); - REQUIRE_NOT_NULL( m_db -> findTable( "tbl0-2") ); + { Path p( "notthere"); REQUIRE_NULL( m_db -> openTable( p ) ); } + { + Path p( "testdb/tbl/tbl0-1"); + const Table * t = m_db -> openTable( p ); + REQUIRE_NOT_NULL( t ); + delete t; + } + { + Path p( "testdb/tbl/tbl0-2"); + const Table * t = m_db -> openTable( p ); + REQUIRE_NOT_NULL( t ); + delete t; + } } -FIXTURE_TEST_CASE(KDBTextDatabase_getDatabase, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KDBTextDatabase_openDatabase, KDBTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb" ); - const Database * db = m_db -> getDatabase( p ); + const Database * db = m_db -> openDatabase( p ); REQUIRE_NOT_NULL( db ); REQUIRE_EQ( string("testdb"), db->getName() ); + Database::release( db ); } -FIXTURE_TEST_CASE(KDBTextDatabase_getDatabase_Nested, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KDBTextDatabase_openDatabase_Nested, KDBTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2" ); - const Database * db = m_db -> getDatabase( p ); + const Database * db = m_db -> openDatabase( p ); REQUIRE_NOT_NULL( db ); REQUIRE_EQ( string("subdb2"), db->getName() ); + Database::release( db ); } FIXTURE_TEST_CASE(KDBTextDatabase_getTable, KDBTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/tbl/tbl0-1" ); - const Table * tbl = m_db -> getTable( p ); + const Table * tbl = m_db -> openTable( p ); REQUIRE_NOT_NULL( tbl ); REQUIRE_EQ( string("tbl0-1"), tbl->getName() ); + delete tbl; } FIXTURE_TEST_CASE(KDBTextDatabase_getTable_Nested, KDBTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2/tbl/tbl2-2" ); - const Table * tbl = m_db -> getTable( p ); + const Table * tbl = m_db -> openTable( p ); REQUIRE_NOT_NULL( tbl ); REQUIRE_EQ( string("tbl2-2"), tbl->getName() ); + delete tbl; } FIXTURE_TEST_CASE(KDBTextDatabase_pathType_empty, KDBTextDatabase_Fixture) @@ -329,17 +354,15 @@ class KDBTextDatabase_ApiFixture ~KDBTextDatabase_ApiFixture() { KDatabaseRelease( m_db ); - KDBManagerRelease( m_mgr ); } void Setup( const char * input ) { -// const KDBManager * mgr = nullptr; - THROW_ON_RC( KDBManagerMakeText ( & m_mgr, input, m_error, sizeof m_error ) ); - THROW_ON_RC( KDBManagerOpenDBRead( m_mgr, & m_db, "%s", "testdb" ) ); -// Release(mgr); hold on to the parsed Json, not the top level db/table + const KDBManager * mgr = nullptr; + THROW_ON_RC( KDBManagerMakeText ( & mgr, input, m_error, sizeof m_error ) ); + THROW_ON_RC( KDBManagerOpenDBRead( mgr, & m_db, "%s", "testdb" ) ); + KDBManagerRelease( mgr ); } - const KDBManager * m_mgr = nullptr; const KDatabase * m_db = nullptr; char m_error[1024]; }; @@ -383,16 +406,26 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenManagerRead, KDBTextDatabase_ApiFixture) Setup( R"({"type": "database", "name": "testdb"})" ); const KDBManager * mgr; REQUIRE_RC( KDatabaseOpenManagerRead( m_db, & mgr ) ); - REQUIRE_EQ( m_mgr, mgr ); + REQUIRE_NOT_NULL( mgr ); KDBManagerRelease( mgr ); } +FIXTURE_TEST_CASE(KDBTextDatabase_OpenDbRead, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + const KDatabase * subdb = nullptr; + REQUIRE_RC( KDatabaseOpenDBRead( m_db, & subdb, "subdb1" ) ); + REQUIRE_NOT_NULL( subdb ); + KDatabaseRelease( subdb ); +} + FIXTURE_TEST_CASE(KDBTextDatabase_OpenParentRead, KDBTextDatabase_ApiFixture) { Setup( NestedDb ); const KDatabase * subdb = nullptr; - REQUIRE_RC( KDBManagerOpenDBRead( m_mgr, & subdb, "testdb/db/subdb1" ) ); + REQUIRE_RC( KDatabaseOpenDBRead( m_db, & subdb, "subdb1" ) ); REQUIRE_NOT_NULL( subdb ); + const KDatabase * parent = nullptr; REQUIRE_RC( KDatabaseOpenParentRead( subdb, & parent ) ); REQUIRE_EQ( m_db, parent ); @@ -400,6 +433,14 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenParentRead, KDBTextDatabase_ApiFixture) KDatabaseRelease( subdb ); } +FIXTURE_TEST_CASE(KTextDatabase_OpenDirectoryRead, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + const KDirectory * dir; + rc_t rc = KDatabaseOpenDirectoryRead( m_db, & dir ); + REQUIRE_EQ( SILENT_RC( rcDB, rcDatabase, rcAccessing, rcColumn, rcUnsupported ), rc ); +} + //////////////////////////////////////////// Main extern "C" { From 00b3ff4871de3ad22b8ff48b1fd3c4536408615d Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Fri, 29 Dec 2023 12:32:28 -0500 Subject: [PATCH 20/42] VDB-5461: release = 3.0.11-dev --- build/Makefile.vers | 2 +- interfaces/klib/vdb_release_version.h | 2 +- libs/blast/blast-mgr.c | 2 +- libs/kdb/libkdb.vers.h | 2 +- libs/klib/release-vers.h | 2 +- libs/ncbi-vdb/libncbi-vdb.vers | 2 +- libs/vdb/libvdb.vers.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build/Makefile.vers b/build/Makefile.vers index 2a089606c..f0c2d4dd1 100644 --- a/build/Makefile.vers +++ b/build/Makefile.vers @@ -23,4 +23,4 @@ # =========================================================================== # NCBI-VDB and library version -VERSION = 3.0.10 +VERSION = 3.0.11 diff --git a/interfaces/klib/vdb_release_version.h b/interfaces/klib/vdb_release_version.h index 65ed64c3d..888f0bcdc 100644 --- a/interfaces/klib/vdb_release_version.h +++ b/interfaces/klib/vdb_release_version.h @@ -26,6 +26,6 @@ * ============================================================================== */ -#define VDB_RELEASE_VERSION 0x0300000A +#define VDB_RELEASE_VERSION 0x0300000B #endif /* _h_klib_vdb_release_version_ */ diff --git a/libs/blast/blast-mgr.c b/libs/blast/blast-mgr.c index bcdb755a7..98dec331c 100644 --- a/libs/blast/blast-mgr.c +++ b/libs/blast/blast-mgr.c @@ -50,7 +50,7 @@ #include /* fprintf */ #include /* memset */ -#define TOOLKIT "sratoolkit3_0_10" +#define TOOLKIT "sratoolkit3_0_11" /******************************************************************************/ diff --git a/libs/kdb/libkdb.vers.h b/libs/kdb/libkdb.vers.h index 9e8c421a8..321ec2e7f 100644 --- a/libs/kdb/libkdb.vers.h +++ b/libs/kdb/libkdb.vers.h @@ -26,4 +26,4 @@ #pragma once -#define LIBKDB_VERS 0x0300000A +#define LIBKDB_VERS 0x0300000B diff --git a/libs/klib/release-vers.h b/libs/klib/release-vers.h index 842fe64f8..8a1eaa4a6 100644 --- a/libs/klib/release-vers.h +++ b/libs/klib/release-vers.h @@ -43,7 +43,7 @@ * 'c' - release candidate * 'r' - final */ -#define RELEASE_TYPE 'r' +#define RELEASE_TYPE 'd' /* Revision of Version of current SRA Toolkit Release */ #define RELEASE_REVISION 0 diff --git a/libs/ncbi-vdb/libncbi-vdb.vers b/libs/ncbi-vdb/libncbi-vdb.vers index a909317fe..778bf95c0 100644 --- a/libs/ncbi-vdb/libncbi-vdb.vers +++ b/libs/ncbi-vdb/libncbi-vdb.vers @@ -1 +1 @@ -3.0.10 +3.0.11 diff --git a/libs/vdb/libvdb.vers.h b/libs/vdb/libvdb.vers.h index 93083fdd8..c86dd9868 100644 --- a/libs/vdb/libvdb.vers.h +++ b/libs/vdb/libvdb.vers.h @@ -24,4 +24,4 @@ * */ -#define LIBVDB_VERS 0x0300000A +#define LIBVDB_VERS 0x0300000B From 5a49ddbe3b33b09b2ab116e8ee18a0d7067bca63 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 29 Dec 2023 14:19:36 -0500 Subject: [PATCH 21/42] VDB-5498 saving work --- libs/kdbtext/database.cpp | 123 +++++++++++++++++++++++++++------ libs/kdbtext/database.hpp | 7 +- libs/kdbtext/manager.cpp | 10 ++- libs/kdbtext/metadata.cpp | 19 +++++ libs/kdbtext/metadata.hpp | 4 ++ libs/kdbtext/path.cpp | 4 +- libs/kdbtext/path.hpp | 5 ++ test/kdbtext/test-database.cpp | 82 +++++++++++++++++----- 8 files changed, 209 insertions(+), 45 deletions(-) diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 4cd65948a..8910cee9d 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -28,6 +28,7 @@ #include "table.hpp" #include "manager.hpp" +#include "metadata.hpp" #include #include @@ -49,8 +50,8 @@ static rc_t CC KTextDatabaseOpenManagerRead ( const KTextDatabase *self, const K static rc_t CC KTextDatabaseOpenParentRead ( const KTextDatabase *self, const KDatabase **par ); static rc_t CC KTextDatabaseOpenDirectoryRead ( const KTextDatabase *self, const KDirectory **dir ); static rc_t CC KTextDatabaseVOpenDBRead ( const KTextDatabase *self, const KDatabase **dbp, const char *name, va_list args ); -// static rc_t CC KTextDatabaseVOpenTableRead ( const KTextDatabase *self, const KTable **tblp, const char *name, va_list args ); -// static rc_t CC KTextDatabaseOpenMetadataRead ( const KTextDatabase *self, const KMetadata **metap ); +static rc_t CC KTextDatabaseVOpenTableRead ( const KTextDatabase *self, const KTable **tblp, const char *name, va_list args ); +static rc_t CC KTextDatabaseOpenMetadataRead ( const KTextDatabase *self, const KMetadata **metap ); // static rc_t CC KTextDatabaseVOpenIndexRead ( const KTextDatabase *self, const KIndex **idxp, const char *name, va_list args ); // static rc_t CC KTextDatabaseListDB ( const KTextDatabase *self, KNamelist **names ); // static rc_t CC KTextDatabaseListTbl ( struct KTextDatabase const *self, KNamelist **names ); @@ -70,8 +71,8 @@ static KDatabase_vt KTextDatabase_vt = KTextDatabaseOpenParentRead, KTextDatabaseOpenDirectoryRead, KTextDatabaseVOpenDBRead, - // KTextDatabaseVOpenTableRead, - // KTextDatabaseOpenMetadataRead, + KTextDatabaseVOpenTableRead, + KTextDatabaseOpenMetadataRead, // KTextDatabaseVOpenIndexRead, // KTextDatabaseListDB, // KTextDatabaseListTbl, @@ -86,32 +87,32 @@ Database::Database( const KJsonObject * p_json, const Manager * p_mgr, const Dat { dad . vt = & KTextDatabase_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::Database", "ctor", "db" ); - - if ( m_mgr != nullptr ) - { - Manager::addRef( m_mgr ); - } + Manager::addRef( m_mgr ); } Database::~Database() { - if ( m_mgr != nullptr ) - { - Manager::release( m_mgr ); - } + Metadata::release( m_meta ); + Manager::release( m_mgr ); KRefcountWhack ( & dad . refcount, "KDBText::Database" ); } void -Database::addRef( const Database * mgr ) +Database::addRef( const Database * db ) { - KDatabaseAddRef( (const KDatabase*) mgr ); + if ( db != nullptr ) + { + KDatabaseAddRef( (const KDatabase*) db ); + } } void -Database::release( const Database * mgr ) +Database::release( const Database * db ) { - KDatabaseRelease( (const KDatabase*) mgr ); + if ( db != nullptr ) + { + KDatabaseRelease( (const KDatabase*) db ); + } } const Database * @@ -145,7 +146,7 @@ Database::openDatabase( Path & p_path ) const } const Database * -Database::openSubDatabase( std::string & name ) const +Database::openSubDatabase( const std::string & name ) const { auto j = m_subdbs.find( name ); if ( j != m_subdbs.end() ) @@ -157,7 +158,6 @@ Database::openSubDatabase( std::string & name ) const return nullptr; } - const Table * Database::openTable( Path & p_path ) const { @@ -170,7 +170,7 @@ Database::openTable( Path & p_path ) const if ( p_path.front() == "tbl" ) { p_path.pop(); - if ( ! p_path.empty() ) + if ( p_path.size() == 1 ) { auto j = m_tables.find( p_path.front() ); if ( j != m_tables.end() ) @@ -204,6 +204,19 @@ Database::openTable( Path & p_path ) const return nullptr; } +const Table * +Database::openTable( const string & name ) const +{ + auto j = m_tables.find( name ); + if ( j != m_tables.end() ) + { + Table * ret = new Table( j -> second ); + ret -> inflate( error, sizeof error ); + return ret; + } + return nullptr; +} + rc_t Database::inflate( char * p_error, size_t error_size ) { @@ -331,6 +344,28 @@ Database::inflate( char * p_error, size_t error_size ) } } + const KJsonValue * meta = KJsonObjectGetMember ( m_json, "metadata" ); + if ( meta != nullptr ) + { + const KJsonObject * obj = KJsonValueToObject ( meta ); + if( obj != nullptr ) + { + Metadata * m = new Metadata( obj ); + rc = m -> inflate( p_error, error_size ); + if ( rc != 0 ) + { + delete m; + return rc; + } + m_meta = m; + } + else + { // not an object + string_printf ( p_error, error_size, nullptr, "%s.metadata is not an object", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + return rc; } @@ -414,6 +449,12 @@ Database::exists( uint32_t requested, Path & path ) const return false; } +const Metadata * +Database::openMetadata() const +{ + return m_meta; +} + // API functions @@ -510,7 +551,9 @@ KTextDatabaseVOpenDBRead ( const KTextDatabase *bself, const KDatabase **dbp, co if ( p.size() > 1 ) { p.pop(); + const Database * topdb = db; db = self -> openDatabase( p ); + Database::release( topdb ); } if ( db != nullptr ) @@ -522,3 +565,43 @@ KTextDatabaseVOpenDBRead ( const KTextDatabase *bself, const KDatabase **dbp, co return SILENT_RC( rcDB, rcDatabase, rcOpening, rcParam, rcInvalid ); } + +static +rc_t CC +KTextDatabaseVOpenTableRead ( const KTextDatabase *bself, const KTable **tblp, const char * fmt, va_list args ) +{ + CAST(); + + string name; + rc_t rc = Path::PrintToString( fmt, args, name ); + if ( rc == 0 ) + { + const Table * t = self -> openTable( name ); + if ( t != nullptr ) + { + *tblp = (const KTable *) t; + } + else + { + rc = SILENT_RC( rcDB, rcTable, rcOpening, rcParam, rcInvalid ); + } + } + + return rc; +} + +static +rc_t CC +KTextDatabaseOpenMetadataRead ( const KTextDatabase *bself, const KMetadata **metap ) +{ + CAST(); + const Metadata * m = self->openMetadata(); + if ( m != nullptr ) + { + Metadata::addRef( m ); + *metap = (const KMetadata*)m; + return 0; + } + return SILENT_RC( rcDB, rcMetadata, rcOpening, rcParam, rcInvalid );; +} + diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index e36153a2f..5d7f6d85e 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -48,6 +48,7 @@ namespace KDBText { class Manager; class Table; + class Metadata; class Database : public KTextDatabase { @@ -69,13 +70,16 @@ namespace KDBText const std::string & getName() const { return m_name; } const Database * openDatabase( Path & path ) const; - const Database * openSubDatabase( std::string & name ) const; + const Database * openSubDatabase( const std::string & name ) const; const Table *openTable( Path & path ) const; + const Table *openTable( const std::string & name ) const; int pathType( Path & ) const; bool exists( uint32_t requested, Path & p_path ) const; + const Metadata * openMetadata() const; + private: const Manager * m_mgr = nullptr; const Database * m_parent = nullptr; @@ -85,5 +89,6 @@ namespace KDBText // verified Jsons: std::map< std::string, const KJsonObject * > m_subdbs; std::map< std::string, const KJsonObject * > m_tables; + const Metadata * m_meta = nullptr; }; } diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index 2551f9e0d..cb0e36f11 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -58,13 +58,19 @@ Manager::~Manager() void Manager::addRef( const Manager * mgr ) { - KDBManagerAddRef( (const KDBManager*) mgr ); + if ( mgr != nullptr ) + { + KDBManagerAddRef( (const KDBManager*) mgr ); + } } void Manager::release( const Manager * mgr ) { - KDBManagerRelease( (const KDBManager*) mgr ); + if ( mgr != nullptr ) + { + KDBManagerRelease( (const KDBManager*) mgr ); + } } rc_t diff --git a/libs/kdbtext/metadata.cpp b/libs/kdbtext/metadata.cpp index 72005ed38..5ec90e089 100644 --- a/libs/kdbtext/metadata.cpp +++ b/libs/kdbtext/metadata.cpp @@ -27,6 +27,7 @@ #include "metadata.hpp" #include +#include #include @@ -86,6 +87,24 @@ Metadata::~Metadata() KRefcountWhack ( & dad . refcount, "KDBText::Metadata" ); } +void +Metadata::addRef( const Metadata * meta ) +{ + if ( meta != nullptr ) + { + KMetadataAddRef( (const KMetadata*) meta ); + } +} + +void +Metadata::release( const Metadata * meta ) +{ + if ( meta != nullptr ) + { + KMetadataRelease( (const KMetadata*) meta ); + } +} + rc_t Metadata::inflate( char * error, size_t error_size ) { diff --git a/libs/kdbtext/metadata.hpp b/libs/kdbtext/metadata.hpp index ce8c469ff..2cdb0fe11 100644 --- a/libs/kdbtext/metadata.hpp +++ b/libs/kdbtext/metadata.hpp @@ -43,6 +43,10 @@ namespace KDBText { class Metadata : public KTextMetadata { + public: + static void addRef( const Metadata* ); + static void release( const Metadata *); + public: Metadata( const KJsonObject * p_json ); ~Metadata(); diff --git a/libs/kdbtext/path.cpp b/libs/kdbtext/path.cpp index 1af30448b..0b29d4364 100644 --- a/libs/kdbtext/path.cpp +++ b/libs/kdbtext/path.cpp @@ -26,7 +26,6 @@ #include "path.hpp" -#include #include #include #include @@ -38,9 +37,8 @@ using namespace std; using namespace KDBText; -static rc_t -PrintToString( const char *fmt, va_list args, string & out ) +Path::PrintToString( const char *fmt, va_list args, string & out ) { KDataBuffer buf; rc_t rc = KDataBufferMake ( & buf, 8, 0 ); diff --git a/libs/kdbtext/path.hpp b/libs/kdbtext/path.hpp index e46eadeae..d494d4158 100644 --- a/libs/kdbtext/path.hpp +++ b/libs/kdbtext/path.hpp @@ -29,6 +29,8 @@ #include #include +#include + struct VPath; namespace KDBText @@ -36,6 +38,9 @@ namespace KDBText // converts a string path with '/' as the separator into a vector of individual elements class Path : public std::queue< std::string > { + public: + static rc_t PrintToString( const char *fmt, va_list args, std::string & out ); + public: Path( const std::string & p_source ); Path( const char *fmt, va_list args ); diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index 1b104f0d8..fc7b28f06 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -32,9 +32,12 @@ #include "../../libs/kdbtext/database.hpp" #include "../../libs/kdbtext/table.hpp" +#include "../../libs/kdbtext/metadata.hpp" #include #include +#include +#include #include #include @@ -45,6 +48,29 @@ using namespace KDBText; TEST_SUITE(KDBTextDatabaseTestSuite); +const char * NestedDb = R"({ + "type": "database", + "name": "testdb", + "databases":[ + {"type": "database", "name":"subdb1"}, + {"type": "database", "name":"subdb2","tables":[ + {"type": "table", "name": "tbl2-1"}, + {"type": "table", "name": "tbl2-2"} + ] + } + ], + "tables":[ + {"type": "table", "name": "tbl0-1"}, + {"type": "table", "name": "tbl0-2"} + ] +})"; + +const char * DbWithMeta = R"({ + "type": "database", + "name": "testdb", + "metadata": { "name":"root", "value":"blah" } +})"; + class KDBTextDatabase_Fixture { public: @@ -187,23 +213,6 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementDuplicate, KDBTextDatabase_ //cout << m_error << endl; } -const char * NestedDb = R"({ - "type": "database", - "name": "testdb", - "databases":[ - {"type": "database", "name":"subdb1"}, - {"type": "database", "name":"subdb2","tables":[ - {"type": "table", "name": "tbl2-1"}, - {"type": "table", "name": "tbl2-2"} - ] - } - ], - "tables":[ - {"type": "table", "name": "tbl0-1"}, - {"type": "table", "name": "tbl0-2"} - ] -})"; - FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) { SetupAndInflate( NestedDb ); @@ -254,7 +263,16 @@ FIXTURE_TEST_CASE(KDBTextDatabase_openDatabase_Nested, KDBTextDatabase_Fixture) REQUIRE_EQ( string("subdb2"), db->getName() ); Database::release( db ); } -FIXTURE_TEST_CASE(KDBTextDatabase_getTable, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KDBTextDatabase_openSubDatabase, KDBTextDatabase_Fixture) +{ + SetupAndInflate( NestedDb ); + const Database * db = m_db -> openSubDatabase( "subdb2" ); + REQUIRE_NOT_NULL( db ); + REQUIRE_EQ( string("subdb2"), db->getName() ); + Database::release( db ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_openTable, KDBTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/tbl/tbl0-1" ); @@ -263,7 +281,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_getTable, KDBTextDatabase_Fixture) REQUIRE_EQ( string("tbl0-1"), tbl->getName() ); delete tbl; } -FIXTURE_TEST_CASE(KDBTextDatabase_getTable_Nested, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KDBTextDatabase_openTable_Nested, KDBTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2/tbl/tbl2-2" ); @@ -343,6 +361,14 @@ FIXTURE_TEST_CASE(KDBTextDatabase_exists_Table, KDBTextDatabase_Fixture) } //TODO: KDBTextDatabase_exists_Metadata (db/table) +FIXTURE_TEST_CASE(KDBTextDatabase_openMetadata, KDBTextDatabase_Fixture) +{ + SetupAndInflate( DbWithMeta ); + const Metadata * m = m_db -> openMetadata(); + REQUIRE_NOT_NULL( m ); + REQUIRE_EQ( string("root"), m -> getName() ); +} + // API class KDBTextDatabase_ApiFixture @@ -441,6 +467,24 @@ FIXTURE_TEST_CASE(KTextDatabase_OpenDirectoryRead, KDBTextDatabase_ApiFixture) REQUIRE_EQ( SILENT_RC( rcDB, rcDatabase, rcAccessing, rcColumn, rcUnsupported ), rc ); } +FIXTURE_TEST_CASE(KDBTextDatabase_OpenTableRead, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + const KTable * tbl = nullptr; + REQUIRE_RC( KDatabaseOpenTableRead ( m_db, &tbl, "%s", "tbl0-2" ) ); + REQUIRE_NOT_NULL( tbl ); + KTableRelease( tbl ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_OpenMetadataRead, KDBTextDatabase_ApiFixture) +{ + Setup( DbWithMeta ); + const KMetadata * m = nullptr; + REQUIRE_RC( KDatabaseOpenMetadataRead ( m_db, &m ) ); + REQUIRE_NOT_NULL( m ); + KMetadataRelease( m ); +} + //////////////////////////////////////////// Main extern "C" { From d3ec60f9518cc0d043e2c2cd6dc5fbc8226a5369 Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Tue, 2 Jan 2024 16:34:34 -0500 Subject: [PATCH 22/42] VDB-5528: don't print error message when trying to open non-existing md5 file --- libs/kfs/win/sysdir.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/kfs/win/sysdir.c b/libs/kfs/win/sysdir.c index b1e2813e1..f358b038c 100644 --- a/libs/kfs/win/sysdir.c +++ b/libs/kfs/win/sysdir.c @@ -563,10 +563,11 @@ uint32_t KSysDirFullFSPathType ( const wchar_t * path ) DWORD status = GetLastError (); switch( status ) { - case ERROR_FILE_NOT_FOUND: - case ERROR_PATH_NOT_FOUND: case ERROR_BAD_NETPATH: case ERROR_BAD_NET_NAME: + case ERROR_DIRECTORY: + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: /* try to follow the path, section by section if a section cannot be found try to resolve it as MS-shell-link ( .lnk file ) */ @@ -2426,6 +2427,9 @@ rc_t CC KSysDirOpenFileWrite ( KSysDir *self, if ( file_handle == INVALID_HANDLE_VALUE ) { + if(path[0] != '%' && path[1] != 's' && path[2] != '/' && path[3] != 'm' + && path[4] != 'd' && path[5] != '5' && path[6] != '\0') + /* don't print error when kdbmeta tries to open md5 file */ rc = print_error_for( GetLastError(), file_name, "CreateFileW", rcAccessing, klogErr ); } From a533b67beba380a0ed1e4f4c7f416ceb7cb46ff5 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Thu, 4 Jan 2024 09:14:29 -0500 Subject: [PATCH 23/42] VDB-5498 done --- libs/kdbtext/database.cpp | 108 ++++++++++++++++++++++++++++----- libs/kdbtext/database.hpp | 12 +++- libs/kdbtext/table.cpp | 1 + test/kdbtext/test-database.cpp | 91 +++++++++++++++++++++++++-- 4 files changed, 188 insertions(+), 24 deletions(-) diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index 8910cee9d..bf4ead1b0 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -35,6 +35,7 @@ #include #include +#include #include @@ -52,11 +53,11 @@ static rc_t CC KTextDatabaseOpenDirectoryRead ( const KTextDatabase *self, const static rc_t CC KTextDatabaseVOpenDBRead ( const KTextDatabase *self, const KDatabase **dbp, const char *name, va_list args ); static rc_t CC KTextDatabaseVOpenTableRead ( const KTextDatabase *self, const KTable **tblp, const char *name, va_list args ); static rc_t CC KTextDatabaseOpenMetadataRead ( const KTextDatabase *self, const KMetadata **metap ); -// static rc_t CC KTextDatabaseVOpenIndexRead ( const KTextDatabase *self, const KIndex **idxp, const char *name, va_list args ); -// static rc_t CC KTextDatabaseListDB ( const KTextDatabase *self, KNamelist **names ); -// static rc_t CC KTextDatabaseListTbl ( struct KTextDatabase const *self, KNamelist **names ); -// static rc_t CC KTextDatabaseListIdx ( struct KTextDatabase const *self, KNamelist **names ); -// static rc_t CC KTextDatabaseGetPath ( KTextDatabase const *self, const char **path ); +static rc_t CC KTextDatabaseVOpenIndexRead ( const KTextDatabase *self, const KIndex **idxp, const char *name, va_list args ); +static rc_t CC KTextDatabaseListDB ( const KTextDatabase *self, KNamelist **names ); +static rc_t CC KTextDatabaseListTbl ( struct KTextDatabase const *self, KNamelist **names ); +static rc_t CC KTextDatabaseListIdx ( struct KTextDatabase const *self, KNamelist **names ); +static rc_t CC KTextDatabaseGetPath ( KTextDatabase const *self, const char **path ); static KDatabase_vt KTextDatabase_vt = { @@ -73,11 +74,11 @@ static KDatabase_vt KTextDatabase_vt = KTextDatabaseVOpenDBRead, KTextDatabaseVOpenTableRead, KTextDatabaseOpenMetadataRead, - // KTextDatabaseVOpenIndexRead, - // KTextDatabaseListDB, - // KTextDatabaseListTbl, - // KTextDatabaseListIdx, - // KTextDatabaseGetPath + KTextDatabaseVOpenIndexRead, + KTextDatabaseListDB, + KTextDatabaseListTbl, + KTextDatabaseListIdx, + KTextDatabaseGetPath }; static char error[1024]; @@ -162,7 +163,7 @@ const Table * Database::openTable( Path & p_path ) const { if ( ! p_path.empty() && p_path.front() == m_name ) - { + { // remove a possible db name from the front p_path.pop(); } if ( ! p_path.empty() ) @@ -170,7 +171,7 @@ Database::openTable( Path & p_path ) const if ( p_path.front() == "tbl" ) { p_path.pop(); - if ( p_path.size() == 1 ) + if ( ! p_path.empty() ) { auto j = m_tables.find( p_path.front() ); if ( j != m_tables.end() ) @@ -382,7 +383,7 @@ Database::pathType( Path & path ) const if ( m_name == path.front() ) { path.pop(); - if ( path.size() > 1 ) + if ( path.size() >= 1 ) { if ( path.front() == "db" ) { @@ -403,7 +404,13 @@ Database::pathType( Path & path ) const delete tbl; } } - //TODO: index, metadata, etc + else if ( path.front() == "md" ) + { + if ( m_meta != nullptr ) + { + return kptMetadata; + } + } } } } @@ -443,7 +450,10 @@ Database::exists( uint32_t requested, Path & path ) const return ret; } } - // case kptMetadata: + else if ( string("md") == path.front() ) + { + return m_meta != nullptr; + } } return false; @@ -605,3 +615,71 @@ KTextDatabaseOpenMetadataRead ( const KTextDatabase *bself, const KMetadata **me return SILENT_RC( rcDB, rcMetadata, rcOpening, rcParam, rcInvalid );; } +static +rc_t CC +KTextDatabaseVOpenIndexRead ( const KTextDatabase *bself, const KIndex **idxp, const char *name, va_list args ) +{ // no database-level indices here + return SILENT_RC( rcDB, rcDatabase, rcAccessing, rcIndex, rcUnsupported ); +} + +static +rc_t CC +KTextDatabaseListDB ( const KTextDatabase *bself, KNamelist **names ) +{ + CAST(); + + VNamelist * ret; + const Database::Subobjects & dbs = self -> getDatabases(); + rc_t rc = VNamelistMake( & ret, dbs.size() ); + if (rc == 0 ) + { + for (auto & key_val : dbs ) + { + VNamelistAppend ( ret, key_val . first . c_str() ); + } + *names = (KNamelist*) ret; + } + + return rc; +} + +static +rc_t CC +KTextDatabaseListTbl ( struct KTextDatabase const *bself, KNamelist **names ) +{ + CAST(); + + VNamelist * ret; + const Database::Subobjects & dbs = self -> getTables(); + rc_t rc = VNamelistMake( & ret, dbs.size() ); + if (rc == 0 ) + { + for (auto & key_val : dbs ) + { + VNamelistAppend ( ret, key_val . first . c_str() ); + } + *names = (KNamelist*) ret; + } + + return rc; +} + +static +rc_t CC +KTextDatabaseListIdx ( struct KTextDatabase const *self, KNamelist **names ) +{ // an empty list + VNamelist * ret; + rc_t rc = VNamelistMake( & ret, 0 ); + if (rc == 0 ) + { + *names = (KNamelist*) ret; + } + return rc; +} + +static +rc_t CC +KTextDatabaseGetPath ( KTextDatabase const *self, const char **path ) +{ + return SILENT_RC( rcDB, rcDatabase, rcAccessing, rcPath, rcUnsupported ); +} \ No newline at end of file diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index 5d7f6d85e..520e5d212 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -80,15 +80,21 @@ namespace KDBText const Metadata * openMetadata() const; + // verified Jsons: + typedef std::map< std::string, const KJsonObject * > Subobjects; + + const Subobjects& getDatabases() const { return m_subdbs; } + const Subobjects& getTables() const { return m_tables; } + private: const Manager * m_mgr = nullptr; const Database * m_parent = nullptr; const KJsonObject * m_json = nullptr; std::string m_name; - // verified Jsons: - std::map< std::string, const KJsonObject * > m_subdbs; - std::map< std::string, const KJsonObject * > m_tables; + + Subobjects m_subdbs; + Subobjects m_tables; const Metadata * m_meta = nullptr; }; } diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp index 4306d33f9..04eaa390e 100644 --- a/libs/kdbtext/table.cpp +++ b/libs/kdbtext/table.cpp @@ -294,6 +294,7 @@ Table::exists( uint32_t requested, Path & path ) const } } + //TODO: // case kptColumn: // case kptMetadata: } diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index fc7b28f06..167bf7e58 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -38,10 +38,13 @@ #include #include #include +#include +#include #include #include #include +#include using namespace std; using namespace KDBText; @@ -321,7 +324,12 @@ FIXTURE_TEST_CASE(KDBTextDatabase_pathType_nestedTable, KDBTextDatabase_Fixture) Path p( "testdb/db/subdb2/tbl/tbl2-2" ); REQUIRE_EQ( (int)kptTable, m_db -> pathType( p ) ); } -//TODO: metadata (db/table), index (db/table) +FIXTURE_TEST_CASE(KDBTextDatabase_pathType_metadata, KDBTextDatabase_Fixture) +{ + SetupAndInflate( DbWithMeta ); + Path p( "testdb/md" ); + REQUIRE_EQ( (int)kptMetadata, m_db -> pathType( p ) ); +} FIXTURE_TEST_CASE(KDBTextDatabase_exists_empty, KDBTextDatabase_Fixture) { @@ -359,7 +367,12 @@ FIXTURE_TEST_CASE(KDBTextDatabase_exists_Table, KDBTextDatabase_Fixture) Path p( "testdb/db/subdb2/tbl/tbl2-1" ); REQUIRE( m_db -> exists( kptTable, p ) ); } -//TODO: KDBTextDatabase_exists_Metadata (db/table) +FIXTURE_TEST_CASE(KDBTextDatabase_exists_metadata, KDBTextDatabase_Fixture) +{ + SetupAndInflate( DbWithMeta ); + Path p( "testdb/md" ); + REQUIRE( m_db -> exists( kptMetadata, p ) ); +} FIXTURE_TEST_CASE(KDBTextDatabase_openMetadata, KDBTextDatabase_Fixture) { @@ -383,10 +396,18 @@ class KDBTextDatabase_ApiFixture } void Setup( const char * input ) { - const KDBManager * mgr = nullptr; - THROW_ON_RC( KDBManagerMakeText ( & mgr, input, m_error, sizeof m_error ) ); - THROW_ON_RC( KDBManagerOpenDBRead( mgr, & m_db, "%s", "testdb" ) ); - KDBManagerRelease( mgr ); + try + { + const KDBManager * mgr = nullptr; + THROW_ON_RC( KDBManagerMakeText ( & mgr, input, m_error, sizeof m_error ) ); + THROW_ON_RC( KDBManagerOpenDBRead( mgr, & m_db, "%s", "testdb" ) ); + KDBManagerRelease( mgr ); + } + catch(const std::exception& e) + { + std::cerr << e.what() << " with '" << m_error << "'" << endl; + } + } const KDatabase * m_db = nullptr; @@ -485,6 +506,64 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenMetadataRead, KDBTextDatabase_ApiFixture) KMetadataRelease( m ); } +FIXTURE_TEST_CASE(KDBTextDatabase_OpenIndexRead, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + const KIndex * idx; + rc_t rc = KDatabaseOpenIndexRead( m_db, & idx, "idx" ); + REQUIRE_EQ( SILENT_RC( rcDB, rcDatabase, rcAccessing, rcIndex, rcUnsupported ), rc ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_ListDB, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + KNamelist * names; + REQUIRE_RC( KDatabaseListDB( m_db, & names ) ); + REQUIRE_NOT_NULL( names ); + uint32_t count = 0; + REQUIRE_RC( KNamelistCount ( names, & count ) ); + REQUIRE_EQ( (uint32_t)2, count ); + REQUIRE( KNamelistContains( names, "subdb1" ) ); + REQUIRE( KNamelistContains( names, "subdb2" ) ); + KNamelistRelease( names ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_ListTbl, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + KNamelist * names; + REQUIRE_RC( KDatabaseListTbl( m_db, & names ) ); + REQUIRE_NOT_NULL( names ); + uint32_t count = 0; + REQUIRE_RC( KNamelistCount ( names, & count ) ); + REQUIRE_EQ( (uint32_t)2, count ); + REQUIRE( KNamelistContains( names, "tbl0-1" ) ); + REQUIRE( KNamelistContains( names, "tbl0-2" ) ); + KNamelistRelease( names ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_ListIdx, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + KNamelist * names; + + REQUIRE_RC( KDatabaseListIdx( m_db, & names ) ); + REQUIRE_NOT_NULL( names ); + uint32_t count = 1; + REQUIRE_RC( KNamelistCount ( names, & count ) ); + REQUIRE_EQ( (uint32_t)0, count ); + + KNamelistRelease( names ); +} + +FIXTURE_TEST_CASE(KDBTextDatabase_GetPath, KDBTextDatabase_ApiFixture) +{ + Setup( NestedDb ); + const char * path; + rc_t rc = KDatabaseGetPath( m_db, & path ); + REQUIRE_EQ( SILENT_RC( rcDB, rcDatabase, rcAccessing, rcPath, rcUnsupported ), rc ); +} + //////////////////////////////////////////// Main extern "C" { From bd2e468d3b254748c95c867cadcd11f54a0ac167 Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Thu, 4 Jan 2024 16:08:15 -0500 Subject: [PATCH 24/42] VDB-5503: KServiceSetQuality() was moved to private interface --- interfaces/vfs/services-priv.h | 2 ++ libs/vfs/services-priv.h | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/interfaces/vfs/services-priv.h b/interfaces/vfs/services-priv.h index 222907f95..914a7c129 100644 --- a/interfaces/vfs/services-priv.h +++ b/interfaces/vfs/services-priv.h @@ -66,7 +66,9 @@ rc_t KServiceTestNamesQueryExt ( KService * self, VRemoteProtocols protocols, const char * dir, const char * file, const char * expected ); +/* Get/Set quality type in service request */ rc_t KServiceGetQuality(const KService * self, const char ** quality); +rc_t KServiceSetQuality(KService * self, const char * quality); rc_t KService1Search ( const struct KNSManager * mgr, const char * cgi, diff --git a/libs/vfs/services-priv.h b/libs/vfs/services-priv.h index 8c245c986..84e1e83f4 100644 --- a/libs/vfs/services-priv.h +++ b/libs/vfs/services-priv.h @@ -135,9 +135,6 @@ const KSrvResponse * KSrvRunIteratorGetResponse( 2: don't resolve */ rc_t KServiceResolveName ( struct KService * service, int resolve ); -/* Set quality type in service request */ -rc_t KServiceSetQuality(KService * self, const char * quality); - bool KServiceSkipLocal(const KService * self); bool KServiceSkipRemote(const KService * self); From 5fb365e795a737a45561ffa7ffa8c6ee0b13ccb6 Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Thu, 4 Jan 2024 16:48:24 -0500 Subject: [PATCH 25/42] VDB-5503: KServiceSetQuality() was moved to private interface --- test/kns/test-aws-proxy.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/kns/test-aws-proxy.cpp b/test/kns/test-aws-proxy.cpp index 20cea15f7..b71562dcf 100644 --- a/test/kns/test-aws-proxy.cpp +++ b/test/kns/test-aws-proxy.cpp @@ -31,8 +31,7 @@ #include // TEST_SUITE #include /* VPathRelease */ #include /* KServiceRelease */ - -#include "../../libs/vfs/services-priv.h" /* KServiceSetQuality */ +#include /* KServiceSetQuality */ #include /* PATH_MAX */ #ifndef PATH_MAX From b2d24c6c586d25367306a74fcfdd46947f592e35 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 5 Jan 2024 15:56:49 -0500 Subject: [PATCH 26/42] VDB-5500 done --- libs/kdbtext/column.cpp | 23 +- libs/kdbtext/column.hpp | 9 +- libs/kdbtext/database.cpp | 22 +- libs/kdbtext/database.hpp | 3 - libs/kdbtext/index.cpp | 21 +- libs/kdbtext/index.hpp | 10 +- libs/kdbtext/manager.cpp | 2 +- libs/kdbtext/table.cpp | 454 ++++++++++++++++++++++++++------- libs/kdbtext/table.hpp | 42 ++- test/kdbtext/test-column.cpp | 2 +- test/kdbtext/test-database.cpp | 118 ++++----- test/kdbtext/test-table.cpp | 335 +++++++++++++++++++++--- 12 files changed, 827 insertions(+), 214 deletions(-) diff --git a/libs/kdbtext/column.cpp b/libs/kdbtext/column.cpp index a636f4002..4af9b8b06 100644 --- a/libs/kdbtext/column.cpp +++ b/libs/kdbtext/column.cpp @@ -26,6 +26,8 @@ #include "column.hpp" +#include + #include using namespace KDBText; @@ -41,7 +43,8 @@ static KColumn_vt KTextColumn_vt = #define CAST() assert( bself->vt == &KTextColumn_vt ); Column * self = (Column *)bself -Column::Column( const KJsonObject * p_json ) : m_json ( p_json ) +Column::Column( const KJsonObject * p_json, const Table * p_parent ) +: m_json ( p_json ), m_parent( p_parent ) { dad . vt = & KTextColumn_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::Column", "ctor", "db" ); @@ -52,6 +55,24 @@ Column::~Column() KRefcountWhack ( & dad . refcount, "KDBText::Column" ); } +void +Column::addRef( const Column * col ) +{ + if ( col != nullptr ) + { + KColumnAddRef( (const KColumn*) col ); + } +} + +void +Column::release( const Column * col ) +{ + if ( col != nullptr ) + { + KColumnRelease( (const KColumn*) col ); + } +} + rc_t Column::inflate( char * error, size_t error_size ) { diff --git a/libs/kdbtext/column.hpp b/libs/kdbtext/column.hpp index a5f130ebd..72a2b509d 100644 --- a/libs/kdbtext/column.hpp +++ b/libs/kdbtext/column.hpp @@ -41,10 +41,16 @@ struct KTextColumn namespace KDBText { + class Table; + class Column : public KTextColumn { public: - Column( const KJsonObject * p_json ); + static void addRef( const Column* ); + static void release( const Column *); + + public: + Column( const KJsonObject * p_json, const Table * parent = nullptr ); ~Column(); rc_t inflate( char * error, size_t error_size ); @@ -53,6 +59,7 @@ namespace KDBText private: const KJsonObject * m_json = nullptr; + const Table * m_parent = nullptr; std::string m_name; }; } diff --git a/libs/kdbtext/database.cpp b/libs/kdbtext/database.cpp index bf4ead1b0..809d5b600 100644 --- a/libs/kdbtext/database.cpp +++ b/libs/kdbtext/database.cpp @@ -176,7 +176,7 @@ Database::openTable( Path & p_path ) const auto j = m_tables.find( p_path.front() ); if ( j != m_tables.end() ) { - Table * ret = new Table( j -> second ); + Table * ret = new Table( j -> second, m_mgr, this ); ret -> inflate( error, sizeof error ); return ret; } @@ -211,7 +211,7 @@ Database::openTable( const string & name ) const auto j = m_tables.find( name ); if ( j != m_tables.end() ) { - Table * ret = new Table( j -> second ); + Table * ret = new Table( j -> second, m_mgr, this ); ret -> inflate( error, sizeof error ); return ret; } @@ -515,13 +515,15 @@ KTextDatabaseOpenManagerRead ( const KTextDatabase *bself, const KDBManager **mg { CAST(); - const KDBManager * m = (const KDBManager*) self -> getManager(); - rc_t rc = KDBManagerAddRef( m ); - if ( rc == 0 ) + const Manager * m = self -> getManager(); + if ( m != nullptr ) { - *mgr = m; + Manager::addRef( m ); } - return rc; + + *mgr = (const KDBManager*)m; + + return 0; } static @@ -545,7 +547,7 @@ static rc_t CC KTextDatabaseOpenDirectoryRead ( const KTextDatabase *self, const KDirectory **dir ) { - return SILENT_RC ( rcDB, rcDatabase, rcAccessing, rcColumn, rcUnsupported ); + return SILENT_RC ( rcDB, rcDatabase, rcAccessing, rcDirectory, rcUnsupported ); } static @@ -593,7 +595,7 @@ KTextDatabaseVOpenTableRead ( const KTextDatabase *bself, const KTable **tblp, c } else { - rc = SILENT_RC( rcDB, rcTable, rcOpening, rcParam, rcInvalid ); + rc = SILENT_RC( rcDB, rcDatabase, rcOpening, rcTable, rcNotFound ); } } @@ -682,4 +684,4 @@ rc_t CC KTextDatabaseGetPath ( KTextDatabase const *self, const char **path ) { return SILENT_RC( rcDB, rcDatabase, rcAccessing, rcPath, rcUnsupported ); -} \ No newline at end of file +} diff --git a/libs/kdbtext/database.hpp b/libs/kdbtext/database.hpp index 520e5d212..339e1d467 100644 --- a/libs/kdbtext/database.hpp +++ b/libs/kdbtext/database.hpp @@ -63,10 +63,7 @@ namespace KDBText rc_t inflate( char * error, size_t error_size ); const Manager * getManager() const { return m_mgr; } - void setManager( const Manager * mgr ) { m_mgr = mgr; } - const Database * getParent() const { return m_parent; } - const std::string & getName() const { return m_name; } const Database * openDatabase( Path & path ) const; diff --git a/libs/kdbtext/index.cpp b/libs/kdbtext/index.cpp index 473c39389..6ff212c74 100644 --- a/libs/kdbtext/index.cpp +++ b/libs/kdbtext/index.cpp @@ -75,7 +75,8 @@ static KIndex_vt KTextIndex_vt = #define CAST() assert( bself->vt == &KTextIndex_vt ); Index * self = (Index *)bself -Index::Index( const KJsonObject * p_json ) : m_json ( p_json ) +Index::Index( const KJsonObject * p_json, const Table * p_parent ) +: m_json ( p_json ), m_parent( p_parent ) { dad . vt = & KTextIndex_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::Index", "ctor", "db" ); @@ -86,6 +87,24 @@ Index::~Index() KRefcountWhack ( & dad . refcount, "KDBText::Index" ); } +void +Index::addRef( const Index * idx ) +{ + if ( idx != nullptr ) + { + KIndexAddRef( (const KIndex*) idx ); + } +} + +void +Index::release( const Index * idx ) +{ + if ( idx != nullptr ) + { + KIndexRelease( (const KIndex*) idx ); + } +} + rc_t Index::inflate( char * error, size_t error_size ) { diff --git a/libs/kdbtext/index.hpp b/libs/kdbtext/index.hpp index 6e96389fe..a489a1815 100644 --- a/libs/kdbtext/index.hpp +++ b/libs/kdbtext/index.hpp @@ -41,10 +41,16 @@ struct KTextIndex namespace KDBText { + class Table; + class Index : public KTextIndex { public: - Index( const KJsonObject * p_json ); + static void addRef( const Index* ); + static void release( const Index *); + + public: + Index( const KJsonObject * p_json, const Table * parent = nullptr ); ~Index(); rc_t inflate( char * error, size_t error_size ); @@ -54,5 +60,7 @@ namespace KDBText private: const KJsonObject * m_json = nullptr; std::string m_name; + + const Table * m_parent = nullptr; }; } diff --git a/libs/kdbtext/manager.cpp b/libs/kdbtext/manager.cpp index cb0e36f11..6c293c53a 100644 --- a/libs/kdbtext/manager.cpp +++ b/libs/kdbtext/manager.cpp @@ -136,7 +136,7 @@ Manager::getRootDatabase() const const Table * Manager::getRootTable() const { - Table * tbl = new Table( KJsonValueToObject ( m_root ) ); + Table * tbl = new Table( KJsonValueToObject ( m_root ), this, nullptr ); char error[1024]; if ( tbl -> inflate( error, sizeof error ) == 0 ) { diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp index 04eaa390e..780bce853 100644 --- a/libs/kdbtext/table.cpp +++ b/libs/kdbtext/table.cpp @@ -26,94 +26,126 @@ #include "table.hpp" +#include "metadata.hpp" +#include "manager.hpp" +#include "database.hpp" +#include "column.hpp" + #include +#include #include +#include using namespace KDBText; +using namespace std; static rc_t KTextTableWhack ( KTable *self ); -// static bool CC KTextTableLocked ( const KTable *self ); -// static bool CC KTextTableVExists ( const KTable *self, uint32_t type, const char *name, va_list args ); -// static bool CC KTextTableIsAlias ( const KTable *self, uint32_t type, char *resolved, size_t rsize, const char *name ); -// static rc_t CC KTextTableVWritable ( const KTable *self, uint32_t type, const char *name, va_list args ); -// static rc_t CC KTextTableOpenManagerRead ( const KTable *self, const KDBManager **mgr ); -// static rc_t CC KTextTableOpenParentRead ( const KTable *self, const KDatabase **db ); -// static bool CC KTextTableHasRemoteData ( const KTable *self ); -// static rc_t CC KTextTableOpenDirectoryRead ( const KTable *self, const KDirectory **dir ); -// static rc_t CC KTextTableVOpenColumnRead ( const KTable *self, const KColumn **colp, const char *name, va_list args ); -// static rc_t CC KTextTableOpenMetadataRead ( const KTable *self, const KMetadata **metap ); -// static rc_t CC KTextTableVOpenIndexRead ( const KTable *self, const KIndex **idxp, const char *name, va_list args ); -// static rc_t CC KTextTableGetPath ( const KTable *self, const char **path ); -// static rc_t CC KTextTableGetName (KTable const *self, char const **rslt); -// static rc_t CC KTextTableListCol ( const KTable *self, KNamelist **names ); -// static rc_t CC KTextTableListIdx ( const KTable *self, KNamelist **names ); -// static rc_t CC KTextTableMetaCompare( const KTable *self, const KTable *other, const char * path, bool * equal ); +static bool CC KTextTableLocked ( const KTable *self ); +static bool CC KTextTableVExists ( const KTable *self, uint32_t type, const char *name, va_list args ); +static bool CC KTextTableIsAlias ( const KTable *self, uint32_t type, char *resolved, size_t rsize, const char *name ); +static rc_t CC KTextTableVWritable ( const KTable *self, uint32_t type, const char *name, va_list args ); +static rc_t CC KTextTableOpenManagerRead ( const KTable *self, const KDBManager **mgr ); +static rc_t CC KTextTableOpenParentRead ( const KTable *self, const KDatabase **db ); +static bool CC KTextTableHasRemoteData ( const KTable *self ); +static rc_t CC KTextTableOpenDirectoryRead ( const KTable *self, const KDirectory **dir ); +static rc_t CC KTextTableVOpenColumnRead ( const KTable *self, const KColumn **colp, const char *name, va_list args ); +static rc_t CC KTextTableOpenMetadataRead ( const KTable *self, const KMetadata **metap ); +static rc_t CC KTextTableVOpenIndexRead ( const KTable *self, const KIndex **idxp, const char *name, va_list args ); +static rc_t CC KTextTableGetPath ( const KTable *self, const char **path ); +static rc_t CC KTextTableGetName (KTable const *self, char const **rslt); +static rc_t CC KTextTableListCol ( const KTable *self, KNamelist **names ); +static rc_t CC KTextTableListIdx ( const KTable *self, KNamelist **names ); +static rc_t CC KTextTableMetaCompare( const KTable *self, const KTable *other, const char * path, bool * equal ); static KTable_vt KTextTable_vt = { KTextTableWhack, KTableBaseAddRef, KTableBaseRelease, - // KTextTableLocked, - // KTextTableVExists, - // KTextTableIsAlias, - // KTextTableVWritable, - // KTextTableOpenManagerRead, - // KTextTableOpenParentRead, - // KTextTableHasRemoteData, - // KTextTableOpenDirectoryRead, - // KTextTableVOpenColumnRead, - // KTextTableOpenMetadataRead, - // KTextTableVOpenIndexRead, - // KTextTableGetPath, - // KTextTableGetName, - // KTextTableListCol, - // KTextTableListIdx, - // KTextTableMetaCompare + KTextTableLocked, + KTextTableVExists, + KTextTableIsAlias, + KTextTableVWritable, + KTextTableOpenManagerRead, + KTextTableOpenParentRead, + KTextTableHasRemoteData, + KTextTableOpenDirectoryRead, + KTextTableVOpenColumnRead, + KTextTableOpenMetadataRead, + KTextTableVOpenIndexRead, + KTextTableGetPath, + KTextTableGetName, + KTextTableListCol, + KTextTableListIdx, + KTextTableMetaCompare }; #define CAST() assert( bself->vt == &KTextTable_vt ); Table * self = (Table *)bself -Table::Table( const KJsonObject * p_json ) : m_json ( p_json ) +static char error[1024]; + +Table::Table( const KJsonObject * p_json, const Manager * p_mgr, const Database * p_parent ) +: m_mgr( p_mgr ), m_parent( p_parent ), m_json ( p_json ) { dad . vt = & KTextTable_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::Table", "ctor", "db" ); + Manager::addRef( m_mgr ); } Table::~Table() { + Metadata::release( m_meta ); + Manager::release( m_mgr ); KRefcountWhack ( & dad . refcount, "KDBText::Table" ); } +void +Table::addRef( const Table * tbl ) +{ + if ( tbl != nullptr ) + { + KTableAddRef( (const KTable*) tbl ); + } +} + +void +Table::release( const Table * tbl ) +{ + if ( tbl != nullptr ) + { + KTableRelease( (const KTable*) tbl ); + } +} + const Column * -Table::getColumn( const std::string & name ) const +Table::openColumn( const string & name ) const { - for( auto & c : m_columns ) + auto j = m_columns.find( name ); + if ( j != m_columns.end() ) { - if ( name == c.getName() ) - { - return & c; - } + Column * ret = new Column( j -> second, this ); + ret -> inflate( error, sizeof error ); + return ret; } return nullptr; } const Index * -Table::getIndex( const std::string & name ) const +Table::openIndex( const string & name ) const { - for( auto & c : m_indexes ) + auto j = m_indexes.find( name ); + if ( j != m_indexes.end() ) { - if ( name == c.getName() ) - { - return & c; - } + Index * ret = new Index( j -> second, this ); + ret -> inflate( error, sizeof error ); + return ret; } return nullptr; } rc_t -Table::inflate( char * error, size_t error_size ) +Table::inflate( char * p_error, size_t p_error_size ) { rc_t rc = 0; @@ -129,7 +161,7 @@ Table::inflate( char * error, size_t error_size ) } else { - string_printf ( error, error_size, nullptr, "Table name is missing" ); + string_printf ( p_error, p_error_size, nullptr, "Table name is missing" ); return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } @@ -142,19 +174,19 @@ Table::inflate( char * error, size_t error_size ) { if ( strcmp( "table", typeStr ) != 0 ) { - string_printf ( error, error_size, nullptr, "%s.type is not 'table'('%s')", m_name.c_str(), typeStr ); + string_printf ( p_error, p_error_size, nullptr, "%s.type is not 'table'('%s')", m_name.c_str(), typeStr ); return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } } else { - string_printf ( error, error_size, nullptr, "%s.type is invalid", m_name.c_str() ); + string_printf ( p_error, p_error_size, nullptr, "%s.type is invalid", m_name.c_str() ); return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } } else { - string_printf ( error, error_size, nullptr, "%s.type is missing", m_name.c_str() ); + string_printf ( p_error, p_error_size, nullptr, "%s.type is missing", m_name.c_str() ); return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } @@ -165,7 +197,7 @@ Table::inflate( char * error, size_t error_size ) const KJsonArray * colarr = KJsonValueToArray ( columns ); if ( colarr == nullptr ) { - string_printf ( error, error_size, nullptr, "%s.columns is not an array", m_name.c_str() ); + string_printf ( p_error, p_error_size, nullptr, "%s.columns is not an array", m_name.c_str() ); return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } @@ -177,26 +209,23 @@ Table::inflate( char * error, size_t error_size ) const KJsonObject * obj = KJsonValueToObject ( v ); if( obj != nullptr ) { - Column col( obj ); - rc = col . inflate ( error, error_size ); + Column col( obj ); // a temporary for Json verification + rc = col . inflate ( p_error, p_error_size ); if ( rc != 0 ) { return rc; } - for( auto & d : m_columns ) + if ( m_columns.find( col . getName() ) != m_columns . end() ) { - if ( col.getName() == d.getName() ) - { - string_printf ( error, error_size, nullptr, "Duplicate column: %s", col.getName().c_str() ); - return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); - } + string_printf ( p_error, p_error_size, nullptr, "Duplicate column: %s", col . getName().c_str() ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } - m_columns .push_back( col ); + m_columns [ col . getName() ] = obj; } else { // not an object - string_printf ( error, error_size, nullptr, "%s.columns[%i] is not an object", m_name.c_str(), i ); + string_printf ( p_error, p_error_size, nullptr, "%s.columns[%i] is not an object", m_name.c_str(), i ); return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } } @@ -209,7 +238,7 @@ Table::inflate( char * error, size_t error_size ) const KJsonArray * idxarr = KJsonValueToArray ( indexes ); if ( idxarr == nullptr ) { - string_printf ( error, error_size, nullptr, "%s.indexes is not an array", m_name.c_str() ); + string_printf ( p_error, p_error_size, nullptr, "%s.indexes is not an array", m_name.c_str() ); return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } @@ -221,55 +250,89 @@ Table::inflate( char * error, size_t error_size ) const KJsonObject * obj = KJsonValueToObject ( v ); if( obj != nullptr ) { - Index idx( obj ); - rc = idx . inflate ( error, error_size ); + Index idx( obj ); // a temporary for Json verification + rc = idx . inflate ( p_error, p_error_size ); if ( rc != 0 ) { return rc; } - for( auto & d : m_indexes ) + if ( m_indexes.find( idx . getName() ) != m_indexes . end() ) { - if ( idx.getName() == d.getName() ) - { - string_printf ( error, error_size, nullptr, "Duplicate index: %s", idx.getName().c_str() ); - return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); - } + string_printf ( p_error, p_error_size, nullptr, "Duplicate index: %s", idx.getName().c_str() ); + return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } - m_indexes .push_back( idx ); + m_indexes [ idx . getName() ] = obj; } else { // not an object - string_printf ( error, error_size, nullptr, "%s.indexes[%i] is not an object", m_name.c_str(), i ); + string_printf ( p_error, p_error_size, nullptr, "%s.indexes[%i] is not an object", m_name.c_str(), i ); return SILENT_RC( rcDB, rcTable, rcCreating, rcParam, rcInvalid ); } } } + // metadata + const KJsonValue * meta = KJsonObjectGetMember ( m_json, "metadata" ); + if ( meta != nullptr ) + { + const KJsonObject * obj = KJsonValueToObject ( meta ); + if( obj != nullptr ) + { + Metadata * m = new Metadata( obj ); + rc = m -> inflate( p_error, p_error_size ); + if ( rc != 0 ) + { + delete m; + return rc; + } + m_meta = m; + } + else + { // not an object + string_printf ( p_error, p_error_size, nullptr, "%s.metadata is not an object", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } + return rc; } int -Table::pathType( Path & p ) const +Table::pathType( Path & path ) const { - if ( ! p.empty() ) + if ( ! path.empty() ) { - if ( p.front() == m_name ) + if ( path.front() == m_name ) { - p.pop(); - if ( p.empty() ) + path.pop(); + if ( path.empty() ) { return kptTable; } - if ( p.front() == "col" ) + if ( path.front() == "col" ) { - p.pop(); - if ( ! p.empty() && getColumn( p.front() ) != nullptr ) + path.pop(); + if ( path.size() == 1 && hasColumn( path.front() ) ) { return kptColumn; } } - //else TODO: index, metadata + else if ( path.front() == "md" ) + { + if ( path.size() == 1 && m_meta != nullptr ) + { + return kptMetadata; + } + } + else if ( path.front() == "idx" ) + { + path.pop(); + if ( path.size() == 1 && hasIndex( path.front() ) ) + { + return kptIndex; + } + } } } return kptNotFound; @@ -285,18 +348,30 @@ Table::exists( uint32_t requested, Path & path ) const { return requested == kptTable; } + } + + if ( ! path.empty() ) + { if ( path.front() == "idx" ) { path.pop(); - if ( ! path.empty() ) + if ( path.size() == 1 ) { - return getIndex( path.front() ) != nullptr; + return hasIndex( path.front() ); } - } - //TODO: - // case kptColumn: - // case kptMetadata: + else if ( path.front() == "col" ) + { + path.pop(); + if ( path.size() == 1 ) + { + return hasColumn( path.front() ); + } + } + else if ( path.front() == "md" ) + { + return path.size() == 1 && m_meta != nullptr; + } } return false; @@ -310,4 +385,207 @@ KTextTableWhack ( KTable *bself ) delete reinterpret_cast( self ); return 0; -} \ No newline at end of file +} + +static +bool CC +KTextTableLocked ( const KTable *self ) +{ + return false; +} + +static +bool CC +KTextTableVExists ( const KTable *bself, uint32_t type, const char *name, va_list args ) +{ + CAST(); + Path p ( name, args ); + return self -> exists( type, p ); +} + +static +bool CC +KTextTableIsAlias ( const KTable *self, uint32_t type, char *resolved, size_t rsize, const char *name ) +{ + return false; +} + +static +rc_t CC +KTextTableVWritable ( const KTable *self, uint32_t type, const char *name, va_list args ) +{ + return false; +} + +static +rc_t CC +KTextTableOpenManagerRead ( const KTable *bself, const KDBManager **mgr ) +{ + CAST(); + + const Manager * m = self -> getManager(); + if ( m != nullptr ) + { + Manager::addRef( m ); + } + + *mgr = (const KDBManager*)m; + + return 0; +} + +static +rc_t CC +KTextTableOpenParentRead ( const KTable *bself, const KDatabase **par ) +{ + CAST(); + + const Database * p = self -> getParent(); + if ( p != nullptr ) + { + Database::addRef( p ); + } + + *par = (const KDatabase*) p; + + return 0; +} + +static +bool CC +KTextTableHasRemoteData ( const KTable *self ) +{ + return false; +} + +static +rc_t CC +KTextTableOpenDirectoryRead ( const KTable *self, const KDirectory **dir ) +{ + return SILENT_RC ( rcDB, rcTable, rcAccessing, rcDirectory, rcUnsupported ); +} + +static +rc_t CC +KTextTableVOpenColumnRead ( const KTable * bself, const KColumn **colp, const char *fmt, va_list args ) +{ + CAST(); + + string name; + rc_t rc = Path::PrintToString( fmt, args, name ); + if ( rc == 0 ) + { + const Column * col = self -> openColumn( name ); + if ( col != nullptr ) + { + *colp = (const KColumn*)col; + } + else + { + rc = SILENT_RC( rcDB, rcTable, rcOpening, rcColumn, rcNotFound ); + } + } + return rc; +} + +static +rc_t CC +KTextTableOpenMetadataRead ( const KTable * bself, const KMetadata **metap ) +{ + CAST(); + const Metadata * m = self->openMetadata(); + if ( m != nullptr ) + { + Metadata::addRef( m ); + *metap = (const KMetadata*)m; + return 0; + } + return SILENT_RC( rcDB, rcTable, rcOpening, rcMetadata, rcInvalid );; +} + +static +rc_t CC +KTextTableVOpenIndexRead ( const KTable * bself, const KIndex **idxp, const char *fmt, va_list args ) +{ + CAST(); + + string name; + rc_t rc = Path::PrintToString( fmt, args, name ); + if ( rc == 0 ) + { + const Index * idx = self->openIndex( name ); + if ( idx != nullptr ) + { + *idxp = (const KIndex*)idx; + return 0; + } + } + return SILENT_RC( rcDB, rcTable, rcOpening, rcIndex, rcInvalid );; +} + +static +rc_t CC +KTextTableGetPath ( const KTable *self, const char **path ) +{ + return SILENT_RC ( rcDB, rcTable, rcAccessing, rcPath, rcUnsupported ); +} + +static +rc_t CC +KTextTableGetName (KTable const * bself, char const **rslt) +{ + CAST(); + + *rslt = self->getName().c_str(); + return 0; +} + +static +rc_t CC +KTextTableListCol ( const KTable * bself, KNamelist **names ) +{ + CAST(); + + VNamelist * ret; + const Table::Subobjects & cols = self -> getColumns(); + rc_t rc = VNamelistMake( & ret, cols.size() ); + if (rc == 0 ) + { + for (auto & key_val : cols ) + { + VNamelistAppend ( ret, key_val . first . c_str() ); + } + *names = (KNamelist*) ret; + } + + return rc; +} + +static +rc_t CC +KTextTableListIdx ( const KTable * bself, KNamelist **names ) +{ + CAST(); + + VNamelist * ret; + const Table::Subobjects & cols = self -> getIndexes(); + rc_t rc = VNamelistMake( & ret, cols.size() ); + if (rc == 0 ) + { + for (auto & key_val : cols ) + { + VNamelistAppend ( ret, key_val . first . c_str() ); + } + *names = (KNamelist*) ret; + } + + return rc; +} + +static +rc_t CC +KTextTableMetaCompare( const KTable *self, const KTable *other, const char * path, bool * equal ) +{ + return SILENT_RC ( rcDB, rcTable, rcComparing, rcMetadata, rcUnsupported ); +} + diff --git a/libs/kdbtext/table.hpp b/libs/kdbtext/table.hpp index 044b4aa2d..bff5c3fd7 100644 --- a/libs/kdbtext/table.hpp +++ b/libs/kdbtext/table.hpp @@ -29,14 +29,13 @@ #include "../libs/kdb/table-base.h" #include "path.hpp" -#include "column.hpp" #include "index.hpp" #include #include #include -#include +#include typedef struct KTextTable KTextTable; struct KTextTable @@ -46,26 +45,55 @@ struct KTextTable namespace KDBText { + class Metadata; + class Manager; + class Database; + class Column; + class Table : public KTextTable { public: - Table( const KJsonObject * p_json ); + static void addRef( const Table* ); + static void release( const Table *); + + public: + Table( const KJsonObject * p_json, const Manager * mgr = nullptr, const Database * parent = nullptr ); ~Table(); rc_t inflate( char * error, size_t error_size ); + const Manager * getManager() const { return m_mgr; } + const Database * getParent() const { return m_parent; } const std::string & getName() const { return m_name; } - const Column * getColumn( const std::string& name ) const; - const Index * getIndex( const std::string& name ) const; + bool hasColumn( const std::string& name ) const { return m_columns.find(name) != m_columns.end(); } + const Column * openColumn( const std::string& name ) const; + + bool hasIndex( const std::string& name ) const { return m_indexes.find(name) != m_indexes.end(); } + const Index * openIndex( const std::string& name ) const; int pathType( Path & ) const; bool exists( uint32_t requested, Path & p_path ) const; + const Metadata * openMetadata() const { return m_meta; } + + // verified Jsons: + typedef std::map< std::string, const KJsonObject * > Subobjects; + + const Subobjects& getColumns() const { return m_columns; } + const Subobjects& getIndexes() const { return m_indexes; } + private: + const Manager * m_mgr = nullptr; + const Database * m_parent = nullptr; + const KJsonObject * m_json = nullptr; std::string m_name; - std::vector m_columns; - std::vector m_indexes; + + // verified Jsons + Subobjects m_columns; + Subobjects m_indexes; + + const Metadata * m_meta = nullptr; }; } diff --git a/test/kdbtext/test-column.cpp b/test/kdbtext/test-column.cpp index 2c1f9a392..040eebab5 100644 --- a/test/kdbtext/test-column.cpp +++ b/test/kdbtext/test-column.cpp @@ -60,7 +60,7 @@ class KDBTextColumn_Fixture const KJsonObject * json = KJsonValueToObject ( m_json ); THROW_ON_FALSE( json != nullptr ); - m_col = new Column( json ); + m_col = new Column( json, nullptr ); } KJsonValue * m_json = nullptr; diff --git a/test/kdbtext/test-database.cpp b/test/kdbtext/test-database.cpp index 167bf7e58..e31dc6354 100644 --- a/test/kdbtext/test-database.cpp +++ b/test/kdbtext/test-database.cpp @@ -49,7 +49,7 @@ using namespace std; using namespace KDBText; -TEST_SUITE(KDBTextDatabaseTestSuite); +TEST_SUITE(KTextDatabaseTestSuite); const char * NestedDb = R"({ "type": "database", @@ -74,13 +74,13 @@ const char * DbWithMeta = R"({ "metadata": { "name":"root", "value":"blah" } })"; -class KDBTextDatabase_Fixture +class KTextDatabase_Fixture { public: - KDBTextDatabase_Fixture() + KTextDatabase_Fixture() { } - ~KDBTextDatabase_Fixture() + ~KTextDatabase_Fixture() { delete m_db; KJsonValueWhack( m_json ); @@ -107,44 +107,44 @@ class KDBTextDatabase_Fixture char m_error[1024] = {0}; }; -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Empty, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Empty, KTextDatabase_Fixture) { Setup(R"({})"); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_NoName, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_NoName, KTextDatabase_Fixture) { Setup(R"({"type": "database"})"); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_NoType, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_NoType, KTextDatabase_Fixture) { Setup(R"({"name": "testdb"})"); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_InvalidType, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_InvalidType, KTextDatabase_Fixture) { Setup(R"({"type": [], "name": "testdb"})"); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_WrongType, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_WrongType, KTextDatabase_Fixture) { Setup(R"({"type": "table", "name": "testdb"})"); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Flat, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Flat, KTextDatabase_Fixture) { SetupAndInflate(R"({"type": "database", "name": "testdb"})"); REQUIRE_EQ( string("testdb"), m_db -> getName() ); } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_NotArray, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Nested_NotArray, KTextDatabase_Fixture) { Setup(R"({"type": "database", "name": "testdb", "databases":{"type": "database", "name":"subdb1"} @@ -153,14 +153,14 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_NotArray, KDBTextDatabase_Fixture) REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementNull, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Nested_ElementNull, KTextDatabase_Fixture) { Setup( R"({"type": "database", "name": "testdb","databases":[ null ]})" ); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementBad, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Nested_ElementBad, KTextDatabase_Fixture) { Setup( R"({"type": "database", "name": "testdb", "databases":[ {"type": "NOTAdatabase", "name":"subdb1"} ] @@ -169,7 +169,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_ElementBad, KDBTextDatabase_Fixtur REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_Duplicate, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Nested_Duplicate, KTextDatabase_Fixture) { Setup( R"({"type": "database", "name": "testdb", "databases":[ @@ -182,28 +182,28 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested_Duplicate, KDBTextDatabase_Fixture //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_NotArray, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Tables_NotArray, KTextDatabase_Fixture) { Setup( R"({"type": "database", "name": "testdb", "tables":{"type":"table","name":"tbl"} })" ); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementNull, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Tables_ElementNull, KTextDatabase_Fixture) { Setup( R"({"type": "database", "name": "testdb", "tables":[null] })" ); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementBad, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Tables_ElementBad, KTextDatabase_Fixture) { Setup( R"({"type": "database", "name": "testdb", "tables":[{"type":"NOTAtable","name":"tbl"}] })" ); REQUIRE_RC_FAIL( m_db -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementDuplicate, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Tables_ElementDuplicate, KTextDatabase_Fixture) { Setup( R"({"type": "database", "name": "testdb", "tables":[ @@ -216,7 +216,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Tables_ElementDuplicate, KDBTextDatabase_ //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_Make_Nested, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); @@ -248,7 +248,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_Make_Nested, KDBTextDatabase_Fixture) delete t; } } -FIXTURE_TEST_CASE(KDBTextDatabase_openDatabase, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_openDatabase, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb" ); @@ -257,7 +257,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_openDatabase, KDBTextDatabase_Fixture) REQUIRE_EQ( string("testdb"), db->getName() ); Database::release( db ); } -FIXTURE_TEST_CASE(KDBTextDatabase_openDatabase_Nested, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_openDatabase_Nested, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2" ); @@ -266,7 +266,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_openDatabase_Nested, KDBTextDatabase_Fixture) REQUIRE_EQ( string("subdb2"), db->getName() ); Database::release( db ); } -FIXTURE_TEST_CASE(KDBTextDatabase_openSubDatabase, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_openSubDatabase, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); const Database * db = m_db -> openSubDatabase( "subdb2" ); @@ -275,7 +275,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_openSubDatabase, KDBTextDatabase_Fixture) Database::release( db ); } -FIXTURE_TEST_CASE(KDBTextDatabase_openTable, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_openTable, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/tbl/tbl0-1" ); @@ -284,7 +284,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_openTable, KDBTextDatabase_Fixture) REQUIRE_EQ( string("tbl0-1"), tbl->getName() ); delete tbl; } -FIXTURE_TEST_CASE(KDBTextDatabase_openTable_Nested, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_openTable_Nested, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2/tbl/tbl2-2" ); @@ -294,87 +294,87 @@ FIXTURE_TEST_CASE(KDBTextDatabase_openTable_Nested, KDBTextDatabase_Fixture) delete tbl; } -FIXTURE_TEST_CASE(KDBTextDatabase_pathType_empty, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_pathType_empty, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "" ); REQUIRE_EQ( (int)kptNotFound, m_db -> pathType( p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_pathType_miss, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_pathType_miss, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "qq" ); REQUIRE_EQ( (int)kptNotFound, m_db -> pathType( p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_pathType_self, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_pathType_self, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb" ); REQUIRE_EQ( (int)kptDatabase, m_db -> pathType( p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_pathType_nestedDb, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_pathType_nestedDb, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2" ); REQUIRE_EQ( (int)kptDatabase, m_db -> pathType( p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_pathType_nestedTable, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_pathType_nestedTable, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2/tbl/tbl2-2" ); REQUIRE_EQ( (int)kptTable, m_db -> pathType( p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_pathType_metadata, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_pathType_metadata, KTextDatabase_Fixture) { SetupAndInflate( DbWithMeta ); Path p( "testdb/md" ); REQUIRE_EQ( (int)kptMetadata, m_db -> pathType( p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_exists_empty, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_exists_empty, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "" ); REQUIRE( ! m_db -> exists( kptDatabase, p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Not, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_exists_Database_Not, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "notadb" ); REQUIRE( ! m_db -> exists( kptDatabase, p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_WrongType, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_exists_Database_WrongType, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb" ); REQUIRE( ! m_db -> exists( kptTable, p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Root, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_exists_Database_Root, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb" ); REQUIRE( m_db -> exists( kptDatabase, p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_exists_Database_Nested, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_exists_Database_Nested, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2" ); REQUIRE( m_db -> exists( kptDatabase, p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_exists_Table, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_exists_Table, KTextDatabase_Fixture) { SetupAndInflate( NestedDb ); Path p( "testdb/db/subdb2/tbl/tbl2-1" ); REQUIRE( m_db -> exists( kptTable, p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_exists_metadata, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_exists_metadata, KTextDatabase_Fixture) { SetupAndInflate( DbWithMeta ); Path p( "testdb/md" ); REQUIRE( m_db -> exists( kptMetadata, p ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_openMetadata, KDBTextDatabase_Fixture) +FIXTURE_TEST_CASE(KTextDatabase_openMetadata, KTextDatabase_Fixture) { SetupAndInflate( DbWithMeta ); const Metadata * m = m_db -> openMetadata(); @@ -384,13 +384,13 @@ FIXTURE_TEST_CASE(KDBTextDatabase_openMetadata, KDBTextDatabase_Fixture) // API -class KDBTextDatabase_ApiFixture +class KTextDatabase_ApiFixture { public: - KDBTextDatabase_ApiFixture() + KTextDatabase_ApiFixture() { } - ~KDBTextDatabase_ApiFixture() + ~KTextDatabase_ApiFixture() { KDatabaseRelease( m_db ); } @@ -414,7 +414,7 @@ class KDBTextDatabase_ApiFixture char m_error[1024]; }; -FIXTURE_TEST_CASE(KDBTextDatabase_AddRelease, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_AddRelease, KTextDatabase_ApiFixture) { Setup( R"({"type": "database", "name": "testdb"})" ); @@ -424,31 +424,31 @@ FIXTURE_TEST_CASE(KDBTextDatabase_AddRelease, KDBTextDatabase_ApiFixture) // use valgrind to find any leaks } -FIXTURE_TEST_CASE(KDBTextDatabase_Locked, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_Locked, KTextDatabase_ApiFixture) { Setup( R"({"type": "database", "name": "testdb"})" ); REQUIRE( ! KDatabaseLocked( m_db ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_Exists, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_Exists, KTextDatabase_ApiFixture) { Setup( NestedDb ); REQUIRE( KDatabaseExists( m_db, kptTable, "%s", "testdb/db/subdb2/tbl/tbl2-2" ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_Alias, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_Alias, KTextDatabase_ApiFixture) { Setup( R"({"type": "database", "name": "testdb"})" ); REQUIRE( ! KDatabaseIsAlias( m_db, kptDatabase, nullptr, 0, "testdb" ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_Writable, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_Writable, KTextDatabase_ApiFixture) { Setup( R"({"type": "database", "name": "testdb"})" ); REQUIRE( ! KDatabaseWritable( m_db, kptDatabase, 0, "testdb" ) ); } -FIXTURE_TEST_CASE(KDBTextDatabase_OpenManagerRead, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_OpenManagerRead, KTextDatabase_ApiFixture) { Setup( R"({"type": "database", "name": "testdb"})" ); const KDBManager * mgr; @@ -457,7 +457,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenManagerRead, KDBTextDatabase_ApiFixture) KDBManagerRelease( mgr ); } -FIXTURE_TEST_CASE(KDBTextDatabase_OpenDbRead, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_OpenDbRead, KTextDatabase_ApiFixture) { Setup( NestedDb ); const KDatabase * subdb = nullptr; @@ -466,7 +466,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenDbRead, KDBTextDatabase_ApiFixture) KDatabaseRelease( subdb ); } -FIXTURE_TEST_CASE(KDBTextDatabase_OpenParentRead, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_OpenParentRead, KTextDatabase_ApiFixture) { Setup( NestedDb ); const KDatabase * subdb = nullptr; @@ -480,15 +480,15 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenParentRead, KDBTextDatabase_ApiFixture) KDatabaseRelease( subdb ); } -FIXTURE_TEST_CASE(KTextDatabase_OpenDirectoryRead, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_OpenDirectoryRead, KTextDatabase_ApiFixture) { Setup( NestedDb ); const KDirectory * dir; rc_t rc = KDatabaseOpenDirectoryRead( m_db, & dir ); - REQUIRE_EQ( SILENT_RC( rcDB, rcDatabase, rcAccessing, rcColumn, rcUnsupported ), rc ); + REQUIRE_EQ( SILENT_RC( rcDB, rcDatabase, rcAccessing, rcDirectory, rcUnsupported ), rc ); } -FIXTURE_TEST_CASE(KDBTextDatabase_OpenTableRead, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_OpenTableRead, KTextDatabase_ApiFixture) { Setup( NestedDb ); const KTable * tbl = nullptr; @@ -497,7 +497,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenTableRead, KDBTextDatabase_ApiFixture) KTableRelease( tbl ); } -FIXTURE_TEST_CASE(KDBTextDatabase_OpenMetadataRead, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_OpenMetadataRead, KTextDatabase_ApiFixture) { Setup( DbWithMeta ); const KMetadata * m = nullptr; @@ -506,7 +506,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenMetadataRead, KDBTextDatabase_ApiFixture) KMetadataRelease( m ); } -FIXTURE_TEST_CASE(KDBTextDatabase_OpenIndexRead, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_OpenIndexRead, KTextDatabase_ApiFixture) { Setup( NestedDb ); const KIndex * idx; @@ -514,7 +514,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_OpenIndexRead, KDBTextDatabase_ApiFixture) REQUIRE_EQ( SILENT_RC( rcDB, rcDatabase, rcAccessing, rcIndex, rcUnsupported ), rc ); } -FIXTURE_TEST_CASE(KDBTextDatabase_ListDB, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_ListDB, KTextDatabase_ApiFixture) { Setup( NestedDb ); KNamelist * names; @@ -528,7 +528,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_ListDB, KDBTextDatabase_ApiFixture) KNamelistRelease( names ); } -FIXTURE_TEST_CASE(KDBTextDatabase_ListTbl, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_ListTbl, KTextDatabase_ApiFixture) { Setup( NestedDb ); KNamelist * names; @@ -542,7 +542,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_ListTbl, KDBTextDatabase_ApiFixture) KNamelistRelease( names ); } -FIXTURE_TEST_CASE(KDBTextDatabase_ListIdx, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_ListIdx, KTextDatabase_ApiFixture) { Setup( NestedDb ); KNamelist * names; @@ -556,7 +556,7 @@ FIXTURE_TEST_CASE(KDBTextDatabase_ListIdx, KDBTextDatabase_ApiFixture) KNamelistRelease( names ); } -FIXTURE_TEST_CASE(KDBTextDatabase_GetPath, KDBTextDatabase_ApiFixture) +FIXTURE_TEST_CASE(KTextDatabase_GetPath, KTextDatabase_ApiFixture) { Setup( NestedDb ); const char * path; @@ -590,7 +590,7 @@ const char UsageDefaultName[] = "Test_KDBText_Database"; rc_t CC KMain ( int argc, char *argv [] ) { KConfigDisableUserSettings(); - rc_t rc=KDBTextDatabaseTestSuite(argc, argv); + rc_t rc=KTextDatabaseTestSuite(argc, argv); return rc; } diff --git a/test/kdbtext/test-table.cpp b/test/kdbtext/test-table.cpp index 895adfb02..1b78cfd28 100644 --- a/test/kdbtext/test-table.cpp +++ b/test/kdbtext/test-table.cpp @@ -31,24 +31,32 @@ #include #include "../../libs/kdbtext/table.hpp" +#include "../../libs/kdbtext/column.hpp" #include +#include +#include +#include +#include +#include +#include #include #include +#include using namespace std; using namespace KDBText; -TEST_SUITE(KDBTextTableTestSuite); +TEST_SUITE(KTextTableTestSuite); -class KDBTextTable_Fixture +class KTextTable_Fixture { public: - KDBTextTable_Fixture() + KTextTable_Fixture() { } - ~KDBTextTable_Fixture() + ~KTextTable_Fixture() { delete m_tbl; KJsonValueWhack( m_json ); @@ -75,121 +83,366 @@ class KDBTextTable_Fixture char m_error[1024] = {0}; }; -FIXTURE_TEST_CASE(KDBTextTable_Make_Empty, KDBTextTable_Fixture) +const char * FullTable = R"({"type": "table", "name": "testtbl", + "columns":[ {"name":"col1"},{"name":"col2"} ], + "indexes":[ {"name":"i1","text":[]}, {"name":"i2","text":[]} ], + "metadata":{"name":"", "value":"blah"} +})"; + +FIXTURE_TEST_CASE(KTextTable_Make_Empty, KTextTable_Fixture) { Setup(R"({})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextTable_Make_NoName, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_NoName, KTextTable_Fixture) { Setup(R"({"type": "table"})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextTable_Make_NoType, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_NoType, KTextTable_Fixture) { Setup(R"({"name": "testtbl"})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextTable_Make_InvalidType, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_InvalidType, KTextTable_Fixture) { Setup(R"({"type": [], "name": "testtbl"})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextTable_Make_WrongType, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_WrongType, KTextTable_Fixture) { Setup(R"({"type": "database", "name": "testtbl"})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextTable_Make_Flat, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_Flat, KTextTable_Fixture) { SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); REQUIRE_EQ( string("testtbl"), m_tbl -> getName() ); } -FIXTURE_TEST_CASE(KDBTextTable_Make_ColumnsNoArray, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_ColumnsNoArray, KTextTable_Fixture) { Setup(R"({"type": "table", "name": "testtbl","columns":{"name":"col1"}})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextTable_Make_ColumnDuplicate, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_ColumnDuplicate, KTextTable_Fixture) { Setup(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col1"}]})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextTable_Make_ColumnNotObject, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_ColumnNotObject, KTextTable_Fixture) { Setup(R"({"type": "table", "name": "testtbl","columns":["1"]})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextTable_Make_WithColumns, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_WithColumns, KTextTable_Fixture) { - SetupAndInflate(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col2"}]})"); + SetupAndInflate(FullTable); - REQUIRE_NULL( m_tbl -> getColumn( "nocol" ) ); - REQUIRE_NOT_NULL( m_tbl -> getColumn( "col1" ) ); - REQUIRE_NOT_NULL( m_tbl -> getColumn( "col2" ) ); + REQUIRE( ! m_tbl -> hasColumn( "nocol" ) ); + REQUIRE( m_tbl -> hasColumn( "col1" ) ); + REQUIRE( m_tbl -> hasColumn( "col2" ) ); } -FIXTURE_TEST_CASE(KDBTextTable_Make_WithIndex, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_Make_WithIndex, KTextTable_Fixture) { - SetupAndInflate(R"({"type": "table", "name": "testtbl", - "indexes":[ {"name":"i1","text":[]}, {"name":"i2","text":[]}] - })"); + SetupAndInflate(FullTable); - REQUIRE_NULL( m_tbl -> getIndex( "noidx" ) ); - REQUIRE_NOT_NULL( m_tbl -> getIndex( "i1" ) ); - REQUIRE_NOT_NULL( m_tbl -> getIndex( "i2" ) ); + REQUIRE( ! m_tbl -> hasIndex( "noidx" ) ); + REQUIRE( m_tbl -> hasIndex( "i1" ) ); + REQUIRE( m_tbl -> hasIndex( "i2" ) ); } -//TODO: metadata, index +FIXTURE_TEST_CASE(KTextTable_Make_WithMetadata, KTextTable_Fixture) +{ + SetupAndInflate(FullTable); + REQUIRE_NOT_NULL( m_tbl -> openMetadata() ); +} -FIXTURE_TEST_CASE(KDBTextTable_exists_empty, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_exists_empty, KTextTable_Fixture) { SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); Path p( "" ); REQUIRE( ! m_tbl -> exists( kptTable, p ) ); } -FIXTURE_TEST_CASE(KDBTextTable_exists_WrongType, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_exists_WrongType, KTextTable_Fixture) { SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); Path p( "testtbl" ); REQUIRE( ! m_tbl -> exists( kptDatabase, p ) ); } -FIXTURE_TEST_CASE(KDBTextTable_exists, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_exists, KTextTable_Fixture) { - SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); + SetupAndInflate(FullTable); Path p( "testtbl" ); REQUIRE( m_tbl -> exists( kptTable, p ) ); } -FIXTURE_TEST_CASE(KDBTextTable_exists_Index, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_exists_Index, KTextTable_Fixture) { - SetupAndInflate(R"({"type": "table", "name": "testtbl", - "indexes":[ - {"name":"qwer","text":[]} - ]})"); - Path p( "testtbl/idx/qwer" ); + SetupAndInflate(FullTable); + Path p( "testtbl/idx/i1" ); REQUIRE( m_tbl -> exists( kptIndex, p ) ); } -//TODO: column, metadata, index +FIXTURE_TEST_CASE(KTextTable_exists_Column, KTextTable_Fixture) +{ + SetupAndInflate(FullTable); + Path p( "testtbl/col/col2" ); + REQUIRE( m_tbl -> exists( kptColumn, p ) ); +} +FIXTURE_TEST_CASE(KTextTable_exists_Metadata, KTextTable_Fixture) +{ + SetupAndInflate(FullTable); + Path p( "testtbl/md" ); + REQUIRE( m_tbl -> exists( kptMetadata, p ) ); +} +FIXTURE_TEST_CASE(KTextTable_exists_Metadata_Not, KTextTable_Fixture) +{ + SetupAndInflate(R"({"type": "table", "name": "testtbl"})"); + Path p( "testtbl/md" ); + REQUIRE( ! m_tbl -> exists( kptMetadata, p ) ); +} //pathType -FIXTURE_TEST_CASE(KDBTextTable_pathType_Column, KDBTextTable_Fixture) +FIXTURE_TEST_CASE(KTextTable_pathType_Empty, KTextTable_Fixture) { - SetupAndInflate(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col2"}]})"); + SetupAndInflate(FullTable); + Path p( "" ); + REQUIRE_EQ( (int)kptNotFound, m_tbl -> pathType( p ) ); +} +FIXTURE_TEST_CASE(KTextTable_pathType_Self, KTextTable_Fixture) +{ + SetupAndInflate(FullTable); + Path p( "testtbl" ); + REQUIRE_EQ( (int)kptTable, m_tbl -> pathType( p ) ); +} +FIXTURE_TEST_CASE(KTextTable_pathType_Column, KTextTable_Fixture) +{ + SetupAndInflate(FullTable); Path p( "testtbl/col/col2" ); REQUIRE_EQ( (int)kptColumn, m_tbl -> pathType( p ) ); } -//TODO: empty, wrong type, table, metadata, index +FIXTURE_TEST_CASE(KTextTable_pathType_Index, KTextTable_Fixture) +{ + SetupAndInflate(FullTable); + Path p( "testtbl/idx/i1" ); + REQUIRE_EQ( (int)kptIndex, m_tbl -> pathType( p ) ); +} +FIXTURE_TEST_CASE(KTextTable_pathType_Metadata, KTextTable_Fixture) +{ + SetupAndInflate(FullTable); + Path p( "testtbl/md" ); + REQUIRE_EQ( (int)kptMetadata, m_tbl -> pathType( p ) ); +} + +// API + +class KTextTable_ApiFixture +{ +public: + KTextTable_ApiFixture() + { + } + ~KTextTable_ApiFixture() + { + KTableRelease( m_tbl ); + } + void Setup( const char * input ) + { + try + { + const KDBManager * mgr = nullptr; + THROW_ON_RC( KDBManagerMakeText ( & mgr, input, m_error, sizeof m_error ) ); + THROW_ON_RC( KDBManagerOpenTableRead( mgr, & m_tbl, "%s", "testtbl" ) ); + KDBManagerRelease( mgr ); + } + catch(const std::exception& e) + { + std::cerr << e.what() << " with '" << m_error << "'" << endl; + } + + } + + const KTable * m_tbl = nullptr; + char m_error[1024]; +}; + +FIXTURE_TEST_CASE(KTextTable_AddRelease, KTextTable_ApiFixture) +{ + Setup(FullTable); + + REQUIRE_NOT_NULL( m_tbl ) ; + REQUIRE_RC( KTableAddRef( m_tbl ) ); + REQUIRE_RC( KTableRelease( m_tbl ) ); + // use valgrind to find any leaks +} + +FIXTURE_TEST_CASE(KTextTable_Locked, KTextTable_ApiFixture) +{ + Setup(FullTable); + REQUIRE( ! KTableLocked( m_tbl ) ); +} + +FIXTURE_TEST_CASE(KTextTable_Exists, KTextTable_ApiFixture) +{ + Setup(FullTable); + REQUIRE( KTableExists( m_tbl, kptColumn, "col/%s", "col2" ) ); +} + +FIXTURE_TEST_CASE(KTextTable_IsAlias, KTextTable_ApiFixture) +{ + Setup(FullTable); + REQUIRE( ! KTableIsAlias( m_tbl, kptColumn, nullptr, 0, "col2" ) ); +} + +FIXTURE_TEST_CASE(KTextTable_IsWritable, KTextTable_ApiFixture) +{ + Setup(FullTable); + REQUIRE( ! KTableWritable( m_tbl, kptColumn, "%s", "col2" ) ); +} + +FIXTURE_TEST_CASE(KTextTable_OpenManagerRead, KTextTable_ApiFixture) +{ + Setup(FullTable); + const KDBManager * mgr = nullptr; + REQUIRE_RC( KTableOpenManagerRead( m_tbl, & mgr ) ); + REQUIRE_NOT_NULL( mgr ); + REQUIRE_RC( KDBManagerRelease( mgr ) ); +} + +FIXTURE_TEST_CASE(KTextTable_OpenParentRead_Null, KTextTable_ApiFixture) +{ + Setup(FullTable); + const KDatabase * par = nullptr; + REQUIRE_RC( KTableOpenParentRead( m_tbl, & par ) ); + REQUIRE_NULL( par ); +} +FIXTURE_TEST_CASE(KTextTable_OpenParentRead, KTextTable_ApiFixture) +{ + const char * Db = R"({ + "type": "database", + "name": "testdb", + "tables":[ {"type": "table", "name": "tbl0-1"} ] + })"; + const KDatabase * db; + const KDBManager * mgr = nullptr; + THROW_ON_RC( KDBManagerMakeText ( & mgr, Db, m_error, sizeof m_error ) ); + THROW_ON_RC( KDBManagerOpenDBRead( mgr, & db, "%s", "testdb" ) ); + KDBManagerRelease( mgr ); + + REQUIRE_RC( KDatabaseOpenTableRead ( db, & m_tbl, "%s", "tbl0-1" ) ); + REQUIRE_NOT_NULL( m_tbl ); + + const KDatabase * par = nullptr; + REQUIRE_RC( KTableOpenParentRead( m_tbl, & par ) ); + REQUIRE_NOT_NULL( par ); + REQUIRE_EQ( db, par ); + KDatabaseRelease( par ); + + KDatabaseRelease( db ); +} + +FIXTURE_TEST_CASE(KTextTable_HasRemoteData, KTextTable_ApiFixture) +{ + Setup(FullTable); + REQUIRE( ! KTableHasRemoteData( m_tbl ) ); +} + +FIXTURE_TEST_CASE(KTextTable_OpenDirectoryRead, KTextTable_ApiFixture) +{ + Setup(FullTable); + const KDirectory *dir = nullptr; + rc_t rc = KTableOpenDirectoryRead( m_tbl, & dir ); + REQUIRE_EQ( SILENT_RC ( rcDB, rcTable, rcAccessing, rcDirectory, rcUnsupported ), rc); +} + +FIXTURE_TEST_CASE(KTextTable_OpenColumnRead, KTextTable_ApiFixture) +{ + Setup(FullTable); + const KColumn *col = nullptr; + REQUIRE_RC( KTableOpenColumnRead( m_tbl, & col, "%s", "col2" ) ); + REQUIRE_NOT_NULL( col ); + REQUIRE_RC( KColumnRelease( col ) ); +} + +FIXTURE_TEST_CASE(KTextTable_OpenMetadataRead, KTextTable_ApiFixture) +{ + Setup( FullTable ); + const KMetadata * m = nullptr; + REQUIRE_RC( KTableOpenMetadataRead ( m_tbl, &m ) ); + REQUIRE_NOT_NULL( m ); + KMetadataRelease( m ); +} + +FIXTURE_TEST_CASE(KTextTable_OpenIndexRead, KTextTable_ApiFixture) +{ + Setup( FullTable ); + const KIndex * idx = nullptr; + REQUIRE_RC( KTableOpenIndexRead ( m_tbl, &idx, "%s", "i2" ) ); + REQUIRE_NOT_NULL( idx ); + KIndexRelease( idx ); +} + +FIXTURE_TEST_CASE(KTextTable_GetPath, KTextTable_ApiFixture) +{ + Setup(FullTable); + const char * p = nullptr; + rc_t rc = KTableGetPath( m_tbl, & p ); + REQUIRE_EQ( SILENT_RC ( rcDB, rcTable, rcAccessing, rcPath, rcUnsupported ), rc); +} + +FIXTURE_TEST_CASE(KTextTable_GetName, KTextTable_ApiFixture) +{ + Setup(FullTable); + const char * n = nullptr; + REQUIRE_RC( KTableGetName( m_tbl, & n ) ); + REQUIRE_EQ( string("testtbl"), string(n) ); +} + +FIXTURE_TEST_CASE(KTextTable_ListCol, KTextTable_ApiFixture) +{ + Setup( FullTable ); + KNamelist * names; + REQUIRE_RC( KTableListCol( m_tbl, & names ) ); + REQUIRE_NOT_NULL( names ); + uint32_t count = 0; + REQUIRE_RC( KNamelistCount ( names, & count ) ); + REQUIRE_EQ( (uint32_t)2, count ); + REQUIRE( KNamelistContains( names, "col1" ) ); + REQUIRE( KNamelistContains( names, "col2" ) ); + KNamelistRelease( names ); +} + +FIXTURE_TEST_CASE(KTextTable_ListIdx, KTextTable_ApiFixture) +{ + Setup( FullTable ); + KNamelist * names; + REQUIRE_RC( KTableListIdx( m_tbl, & names ) ); + REQUIRE_NOT_NULL( names ); + uint32_t count = 0; + REQUIRE_RC( KNamelistCount ( names, & count ) ); + REQUIRE_EQ( (uint32_t)2, count ); + REQUIRE( KNamelistContains( names, "i1" ) ); + REQUIRE( KNamelistContains( names, "i2" ) ); + KNamelistRelease( names ); +} + +FIXTURE_TEST_CASE(KTextTable_MetaCompare, KTextTable_ApiFixture) +{ + Setup( FullTable ); + bool equal = false; + rc_t rc = KTableMetaCompare( m_tbl, m_tbl, "", &equal ); + REQUIRE_EQ( SILENT_RC ( rcDB, rcTable, rcComparing, rcMetadata, rcUnsupported ), rc); +} //////////////////////////////////////////// Main extern "C" @@ -217,7 +470,7 @@ const char UsageDefaultName[] = "Test_KDBText_Table"; rc_t CC KMain ( int argc, char *argv [] ) { KConfigDisableUserSettings(); - rc_t rc=KDBTextTableTestSuite(argc, argv); + rc_t rc=KTextTableTestSuite(argc, argv); return rc; } From afd22e350ded67c8683fabf5f983d48ac1055029 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 5 Jan 2024 16:12:51 -0500 Subject: [PATCH 27/42] VDB-5500 even more done --- test/kdb/test-rcolumn.cpp | 2 +- test/kdb/test-wcolumn.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/kdb/test-rcolumn.cpp b/test/kdb/test-rcolumn.cpp index 1f83637b4..01b0b77ed 100644 --- a/test/kdb/test-rcolumn.cpp +++ b/test/kdb/test-rcolumn.cpp @@ -130,7 +130,7 @@ FIXTURE_TEST_CASE(KRColumn_OpenParentRead, KColumn_Fixture) { Setup( GetName() ); const KTable * tbl = nullptr; - rc_t rc = SILENT_RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull ); + rc_t rc = SILENT_RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull ); // no parent set REQUIRE_EQ( rc, KColumnOpenParentRead( & m_col -> dad, & tbl ) ); REQUIRE_NULL( tbl ); } diff --git a/test/kdb/test-wcolumn.cpp b/test/kdb/test-wcolumn.cpp index 201f08da0..5300fdc03 100644 --- a/test/kdb/test-wcolumn.cpp +++ b/test/kdb/test-wcolumn.cpp @@ -134,7 +134,7 @@ FIXTURE_TEST_CASE(KWColumn_OpenParentRead, KColumn_Fixture) { Setup( GetName() ); const KTable * tbl = nullptr; - rc_t rc = SILENT_RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull ); + rc_t rc = SILENT_RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull ); // no parent set REQUIRE_EQ( rc, KColumnOpenParentRead( & m_col -> dad, & tbl ) ); REQUIRE_NULL( tbl ); } @@ -143,7 +143,7 @@ FIXTURE_TEST_CASE(KWColumn_OpenMetadataRead, KColumn_Fixture) { Setup( GetName() ); const KMetadata * meta = nullptr; - rc_t rc = SILENT_RC ( rcDB,rcMgr,rcOpening,rcMetadata,rcNotFound ); + rc_t rc = SILENT_RC ( rcDB, rcMgr, rcOpening, rcMetadata, rcNotFound ); REQUIRE_EQ( rc, KColumnOpenMetadataRead( & m_col -> dad, & meta ) ); } @@ -151,7 +151,7 @@ FIXTURE_TEST_CASE(KWColumn_OpenBlobRead, KColumn_Fixture) { Setup( GetName() ); const KColumnBlob * blob = nullptr; - rc_t rc = SILENT_RC ( rcDB,rcColumn,rcSelecting,rcBlob,rcNotFound ); + rc_t rc = SILENT_RC ( rcDB, rcColumn, rcSelecting,rcBlob,rcNotFound ); REQUIRE_EQ( rc, KColumnOpenBlobRead( & m_col -> dad, & blob, 1 ) ); } From 71b224df8c4b980e4dd2dd8f4e36394ad3b7e5ef Mon Sep 17 00:00:00 2001 From: aboshkin Date: Wed, 10 Jan 2024 21:51:24 -0500 Subject: [PATCH 28/42] VDB-5533 saving work --- libs/kdbtext/column.cpp | 127 +++++++++++++++++++++++++++-- libs/kdbtext/column.hpp | 6 ++ test/kdbtext/test-column.cpp | 149 ++++++++++++++++++++++++++++++++-- test/kdbtext/test-manager.cpp | 1 + 4 files changed, 269 insertions(+), 14 deletions(-) diff --git a/libs/kdbtext/column.cpp b/libs/kdbtext/column.cpp index 4af9b8b06..dea1287b9 100644 --- a/libs/kdbtext/column.cpp +++ b/libs/kdbtext/column.cpp @@ -31,14 +31,39 @@ #include using namespace KDBText; - -static rc_t KTextColumnWhack ( KColumn *self ); +using namespace std; + +/*-------------------------------------------------------------------------- + * KTextColumn (formerly KColumn) + * a read-only collection of blobs indexed by oid; file system-based + */ + +static rc_t CC KTextColumnWhack ( KColumn *self ); +static bool CC KTextColumnLocked ( const KColumn *self ); +static rc_t CC KTextColumnVersion ( const KColumn *self, uint32_t *version ); +static rc_t CC KTextColumnByteOrder ( const KColumn *self, bool *reversed ); +static rc_t CC KTextColumnIdRange ( const KColumn *self, int64_t *first, uint64_t *count ); +// static rc_t CC KTextColumnFindFirstRowId ( const KColumn * self, int64_t * found, int64_t start ); +// static rc_t CC KTextColumnOpenManagerRead ( const KColumn *self, const KDBManager **mgr ); +// static rc_t CC KTextColumnOpenParentRead ( const KColumn *self, const KTable **tbl ); +// static rc_t CC KTextColumnOpenMetadataRead ( const KColumn *self, const KMetadata **metap ); +// static rc_t CC KTextColumnOpenBlobRead ( const KColumn *self, const KColumnBlob **blobp, int64_t id ); static KColumn_vt KTextColumn_vt = { + /* Public API */ KTextColumnWhack, KColumnBaseAddRef, KColumnBaseRelease, + KTextColumnLocked, + KTextColumnVersion, + KTextColumnByteOrder, + KTextColumnIdRange, + // KTextColumnFindFirstRowId, + // KTextColumnOpenManagerRead, + // KTextColumnOpenParentRead, + // KTextColumnOpenMetadataRead, + // KTextColumnOpenBlobRead }; #define CAST() assert( bself->vt == &KTextColumn_vt ); Column * self = (Column *)bself @@ -74,7 +99,7 @@ Column::release( const Column * col ) } rc_t -Column::inflate( char * error, size_t error_size ) +Column::inflate( char * p_error, size_t p_error_size ) { rc_t rc = 0; @@ -90,15 +115,74 @@ Column::inflate( char * error, size_t error_size ) } else { - string_printf ( error, error_size, nullptr, "Column name is missing" ); + string_printf ( p_error, p_error_size, nullptr, "Column name is missing" ); return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } + // data + const KJsonValue * data = KJsonObjectGetMember ( m_json, "data" ); + if ( data != nullptr ) + { + const KJsonArray * dataarr = KJsonValueToArray ( data ); + if ( dataarr == nullptr ) + { + string_printf ( p_error, p_error_size, nullptr, "%s.data is not an array", m_name.c_str() ); + return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); + } + + uint32_t len = KJsonArrayGetLength ( dataarr ); + for ( uint32_t i = 0; i < len; ++i ) + { + const KJsonValue * v = KJsonArrayGetElement ( dataarr, i ); + assert( v != nullptr ); + const KJsonObject * obj = KJsonValueToObject ( v ); + if( obj != nullptr ) + { + const KJsonValue * id = KJsonObjectGetMember ( obj, "row" ); + if ( id == nullptr ) + { + string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].row is missing", m_name.c_str(), i ); + return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); + } + const KJsonValue * value = KJsonObjectGetMember ( obj, "value" ); + if ( value == nullptr ) + { + string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].value is missing", m_name.c_str(), i ); + return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); + } + + if ( m_data.find( id ) != m_data . end() ) + { + string_printf ( p_error, p_error_size, nullptr, "Duplicate row id: %s", id.c_str() ); + return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); + } + // m_data [ id ] = value; + } + else + { // not an object + string_printf ( p_error, p_error_size, nullptr, "%s.data[%i] is not an object", m_name.c_str(), i ); + return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); + } + } + + } + //TBD return rc; } +pair< int64_t, uint64_t > +Column::idRange() const +{ // { first, last - first + 1 } + + if ( m_data.empty() ) + { + return make_pair( 0, 0 ); + } + return make_pair( m_data.begin()->first, m_data.rbegin()->first - m_data.begin()->first + 1 ); +} + static rc_t CC KTextColumnWhack ( KColumn *bself ) @@ -107,4 +191,37 @@ KTextColumnWhack ( KColumn *bself ) delete reinterpret_cast( self ); return 0; -} \ No newline at end of file +} + +static +bool CC +KTextColumnLocked ( const KColumn *self ) +{ + return false; +} + +static +rc_t CC +KTextColumnVersion ( const KColumn *self, uint32_t *version ) +{ + *version = 0; + return 0; +} + +static +rc_t CC +KTextColumnByteOrder ( const KColumn *self, bool *reversed ) +{ + *reversed = false; + return 0; +} + +static +rc_t CC +KTextColumnIdRange ( const KColumn *self, int64_t *first, uint64_t *count ) +{ + *first = 0; + *count = 0; + return 0; +} + diff --git a/libs/kdbtext/column.hpp b/libs/kdbtext/column.hpp index 72a2b509d..53508d94b 100644 --- a/libs/kdbtext/column.hpp +++ b/libs/kdbtext/column.hpp @@ -30,8 +30,10 @@ #include #include +#include #include +#include typedef struct KTextColumn KTextColumn; struct KTextColumn @@ -57,9 +59,13 @@ namespace KDBText const std::string & getName() const { return m_name; } + std::pair< int64_t, uint64_t > idRange() const; // { first, last - first + 1 } + private: const KJsonObject * m_json = nullptr; const Table * m_parent = nullptr; std::string m_name; + + std::map< uint64_t, KDataBuffer > m_data; }; } diff --git a/test/kdbtext/test-column.cpp b/test/kdbtext/test-column.cpp index 040eebab5..92850294d 100644 --- a/test/kdbtext/test-column.cpp +++ b/test/kdbtext/test-column.cpp @@ -32,21 +32,32 @@ #include "../../libs/kdbtext/column.hpp" +#include +#include +#include + #include #include using namespace std; using namespace KDBText; -TEST_SUITE(KDBTextColumnTestSuite); +TEST_SUITE(KTextColumnTestSuite); + +const char * TestColumn = R"({"name":"col", + "data": + [ + {"row":1,"value":"AGCT"}, + {"row":2,"value":"AGCT"} + ]})"; -class KDBTextColumn_Fixture +class KTextColumn_Fixture { public: - KDBTextColumn_Fixture() + KTextColumn_Fixture() { } - ~KDBTextColumn_Fixture() + ~KTextColumn_Fixture() { delete m_col; KJsonValueWhack( m_json ); @@ -68,21 +79,141 @@ class KDBTextColumn_Fixture char m_error[1024] = {0}; }; -FIXTURE_TEST_CASE(KDBTextColumn_Make_Empty, KDBTextColumn_Fixture) +FIXTURE_TEST_CASE(KTextColumn_Make_Empty, KTextColumn_Fixture) { Setup(R"({})"); REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } -FIXTURE_TEST_CASE(KDBTextColumn_Make, KDBTextColumn_Fixture) +FIXTURE_TEST_CASE(KTextColumn_Make, KTextColumn_Fixture) { - Setup(R"({"name":"col"})"); + Setup(TestColumn); REQUIRE_RC( m_col -> inflate( m_error, sizeof m_error ) ); REQUIRE_EQ( string("col"), m_col->getName() ); } -//TODO: the rest +FIXTURE_TEST_CASE(KTextColumn_Make_DataNotArray, KTextColumn_Fixture) +{ + Setup(R"({"name":"col","data":{}})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KTextColumn_Make_CellNotObject, KTextColumn_Fixture) +{ + Setup(R"({"name":"col","data":[1]})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KTextColumn_CellMake_RowMissing, KTextColumn_Fixture) +{ + Setup(R"({"name":"col","data":[{}]})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KTextColumn_CellMake_ValueMissing, KTextColumn_Fixture) +{ + Setup(R"({"name":"col","data": [ {"row":"1"} ] })"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KTextColumn_IdRange, KTextColumn_Fixture) +{ + Setup(TestColumn); + auto r = m_col->idRange(); + REQUIRE_EQ( (int64_t)1, r . first ); + REQUIRE_EQ( (uint64_t)2, r . second ); +} + +// API + +const char * FullTable = R"({"type": "table", "name": "testtbl", + "columns":[ + { + "name":"col", + "data": + [ + {"row":1,"value":"AGCT"}, + {"row":2,"value":"AGCT"} + ] + } + ] +})"; + +class KTextColumn_ApiFixture +{ +public: + KTextColumn_ApiFixture() + { + } + ~KTextColumn_ApiFixture() + { + KColumnRelease( m_col ); + } + void Setup( const char * input, const char * col ) + { + try + { + const KDBManager * mgr = nullptr; + THROW_ON_RC( KDBManagerMakeText ( & mgr, input, m_error, sizeof m_error ) ); + const KTable * tbl; + THROW_ON_RC( KDBManagerOpenTableRead( mgr, & tbl, "%s", "testtbl" ) ); + THROW_ON_RC( KTableOpenColumnRead( tbl, & m_col, "%s", col ) ); + KTableRelease( tbl ); + KDBManagerRelease( mgr ); + } + catch(const std::exception& e) + { + std::cerr << e.what() << " with '" << m_error << "'" << endl; + throw; + } + + } + + const KColumn * m_col = nullptr; + char m_error[1024] = {0}; +}; + +FIXTURE_TEST_CASE(KColumn_AddRelease, KTextColumn_ApiFixture) +{ + Setup(FullTable, "col"); + + REQUIRE_RC( KColumnAddRef( m_col ) ); + REQUIRE_RC( KColumnRelease( m_col ) ); + // use valgrind to find any leaks +} + +FIXTURE_TEST_CASE(KColumn_Locked, KTextColumn_ApiFixture) +{ // always false for this library + Setup(FullTable, "col"); + REQUIRE( ! KColumnLocked( m_col ) ); +} +FIXTURE_TEST_CASE(KColumn_Version, KTextColumn_ApiFixture) +{ // always 0 for this library + Setup(FullTable, "col"); + uint32_t version = 99; + REQUIRE_RC( KColumnVersion( m_col, &version ) ); + REQUIRE_EQ( (uint32_t)0, version ); +} +FIXTURE_TEST_CASE(KColumn_ByteOrder, KTextColumn_ApiFixture) +{ // always false for this library + Setup(FullTable, "col"); + bool reversed = true; + REQUIRE_RC( KColumnByteOrder( m_col, &reversed ) ); + REQUIRE( ! reversed ); +} + +FIXTURE_TEST_CASE(KColumn_IdRange, KTextColumn_ApiFixture) +{ + Setup(FullTable, "col"); + int64_t first = 0; + uint64_t count = 0; + REQUIRE_RC( KColumnIdRange ( m_col, & first, & count ) ); + REQUIRE_EQ( (int64_t)1, first ); + REQUIRE_EQ( (uint64_t)2, count ); +} //////////////////////////////////////////// Main extern "C" @@ -110,7 +241,7 @@ const char UsageDefaultName[] = "Test_KDBText_Column"; rc_t CC KMain ( int argc, char *argv [] ) { KConfigDisableUserSettings(); - rc_t rc=KDBTextColumnTestSuite(argc, argv); + rc_t rc=KTextColumnTestSuite(argc, argv); return rc; } diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index 373ca81ca..cb6516d97 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -443,6 +443,7 @@ rc_t CC KMain ( int argc, char *argv [] ) "columns":[ { "name":"READ", + "type":"ascii", "metadata":null, "data": [ From ea9fbea2d4497eb77e0b171ae526b14f9368a2f2 Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Fri, 12 Jan 2024 13:06:16 -0500 Subject: [PATCH 29/42] VDB-5535: VdbBlast2naReaderData() fills entire output Packed2naRead array --- libs/blast/reference.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/blast/reference.c b/libs/blast/reference.c index 830c0efd3..66fe71729 100644 --- a/libs/blast/reference.c +++ b/libs/blast/reference.c @@ -928,7 +928,7 @@ static uint32_t _ReferencesData2na(References *self, self->eos = true; *status = eVdbBlastNoErr; /* end of set */ S - return 0; + return num_read; } rfd1 = rfd; rfd = &self->refs->rfd[self->rfdi]; @@ -1193,7 +1193,6 @@ static uint32_t _ReferencesData2na(References *self, ++self->read_id; } ++num_read; - break; } return num_read; } @@ -1272,6 +1271,9 @@ uint32_t _Core2naDataRef(struct Core2na *self, self->eos = true; } + if (r->eos) + self->eos = true; + if (self->eos) { return 0; } From dd6fa4851cca3ea2f90e2f6cbc3107852023c02f Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 12 Jan 2024 16:03:21 -0500 Subject: [PATCH 30/42] VDB-5533 saving work --- libs/kdbtext/CMakeLists.txt | 1 + libs/kdbtext/column.cpp | 209 ++++++++++++++++++++--- libs/kdbtext/column.hpp | 21 ++- libs/kdbtext/columnblob.cpp | 229 +++++++++++++++++++++++++ libs/kdbtext/columnblob.hpp | 57 +++++++ libs/kdbtext/table.cpp | 2 +- test/kdbtext/CMakeLists.txt | 1 + test/kdbtext/test-blob.cpp | 308 ++++++++++++++++++++++++++++++++++ test/kdbtext/test-column.cpp | 86 ++++++++-- test/kdbtext/test-manager.cpp | 6 +- test/kdbtext/test-table.cpp | 6 +- 11 files changed, 885 insertions(+), 41 deletions(-) create mode 100644 libs/kdbtext/columnblob.cpp create mode 100644 libs/kdbtext/columnblob.hpp create mode 100644 test/kdbtext/test-blob.cpp diff --git a/libs/kdbtext/CMakeLists.txt b/libs/kdbtext/CMakeLists.txt index 2c3abf5d2..879bad635 100644 --- a/libs/kdbtext/CMakeLists.txt +++ b/libs/kdbtext/CMakeLists.txt @@ -31,6 +31,7 @@ set( KDBTEXT_SRC index.cpp path.cpp metadata.cpp + columnblob.cpp ) GenerateStaticLibs( kdbtext "${KDBTEXT_SRC}" ) diff --git a/libs/kdbtext/column.cpp b/libs/kdbtext/column.cpp index dea1287b9..35aced3c4 100644 --- a/libs/kdbtext/column.cpp +++ b/libs/kdbtext/column.cpp @@ -26,6 +26,10 @@ #include "column.hpp" +#include "manager.hpp" +#include "metadata.hpp" +#include "columnblob.hpp" + #include #include @@ -43,11 +47,11 @@ static bool CC KTextColumnLocked ( const KColumn *self ); static rc_t CC KTextColumnVersion ( const KColumn *self, uint32_t *version ); static rc_t CC KTextColumnByteOrder ( const KColumn *self, bool *reversed ); static rc_t CC KTextColumnIdRange ( const KColumn *self, int64_t *first, uint64_t *count ); -// static rc_t CC KTextColumnFindFirstRowId ( const KColumn * self, int64_t * found, int64_t start ); -// static rc_t CC KTextColumnOpenManagerRead ( const KColumn *self, const KDBManager **mgr ); -// static rc_t CC KTextColumnOpenParentRead ( const KColumn *self, const KTable **tbl ); -// static rc_t CC KTextColumnOpenMetadataRead ( const KColumn *self, const KMetadata **metap ); -// static rc_t CC KTextColumnOpenBlobRead ( const KColumn *self, const KColumnBlob **blobp, int64_t id ); +static rc_t CC KTextColumnFindFirstRowId ( const KColumn * self, int64_t * found, int64_t start ); +static rc_t CC KTextColumnOpenManagerRead ( const KColumn *self, const KDBManager **mgr ); +static rc_t CC KTextColumnOpenParentRead ( const KColumn *self, const KTable **tbl ); +static rc_t CC KTextColumnOpenMetadataRead ( const KColumn *self, const KMetadata **metap ); +static rc_t CC KTextColumnOpenBlobRead ( const KColumn *self, const KColumnBlob **blobp, int64_t id ); static KColumn_vt KTextColumn_vt = { @@ -59,24 +63,32 @@ static KColumn_vt KTextColumn_vt = KTextColumnVersion, KTextColumnByteOrder, KTextColumnIdRange, - // KTextColumnFindFirstRowId, - // KTextColumnOpenManagerRead, - // KTextColumnOpenParentRead, - // KTextColumnOpenMetadataRead, - // KTextColumnOpenBlobRead + KTextColumnFindFirstRowId, + KTextColumnOpenManagerRead, + KTextColumnOpenParentRead, + KTextColumnOpenMetadataRead, + KTextColumnOpenBlobRead }; #define CAST() assert( bself->vt == &KTextColumn_vt ); Column * self = (Column *)bself -Column::Column( const KJsonObject * p_json, const Table * p_parent ) -: m_json ( p_json ), m_parent( p_parent ) +Column::Column( const KJsonObject * p_json, const Manager * p_mgr, const Table * p_parent ) +: m_mgr( p_mgr ), m_parent( p_parent ), m_json ( p_json ) { dad . vt = & KTextColumn_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::Column", "ctor", "db" ); + Manager::addRef( m_mgr ); } Column::~Column() { + Metadata::release( m_meta ); + Manager::release( m_mgr ); + + for( auto d : m_data ) + { + KDataBufferWhack( & d.second ); + } KRefcountWhack ( & dad . refcount, "KDBText::Column" ); } @@ -119,6 +131,22 @@ Column::inflate( char * p_error, size_t p_error_size ) return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); } + const KJsonValue * type = KJsonObjectGetMember ( m_json, "type" ); + if ( type != nullptr ) + { + const char * typeStr = nullptr; + rc = KJsonGetString ( type, & typeStr ); + if ( rc == 0 ) + { + m_type = typeStr; + } + } + else + { + string_printf ( p_error, p_error_size, nullptr, "Column type is missing" ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + // data const KJsonValue * data = KJsonObjectGetMember ( m_json, "data" ); if ( data != nullptr ) @@ -151,12 +179,31 @@ Column::inflate( char * p_error, size_t p_error_size ) return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); } - if ( m_data.find( id ) != m_data . end() ) + int64_t rowId; + rc = KJsonGetNumber ( id, &rowId ); + if ( rc == 0 ) { - string_printf ( p_error, p_error_size, nullptr, "Duplicate row id: %s", id.c_str() ); - return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); + if ( m_data.find( rowId ) != m_data . end() ) + { + string_printf ( p_error, p_error_size, nullptr, "Duplicate row id: %s", rowId ); + return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); + } + + const char * valueStr = nullptr; + rc = KJsonGetString ( value, & valueStr ); + if ( rc == 0 ) + { + KDataBuffer b; + KDataBufferMakeBytes( & b, strlen( valueStr ) + 1 ); + strcpy( (char*)b.base, valueStr ); + m_data [ rowId ] = b; + } + } + else + { // not an object + string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].row is not an integer", m_name.c_str(), i ); + return rc; } - // m_data [ id ] = value; } else { // not an object @@ -164,10 +211,30 @@ Column::inflate( char * p_error, size_t p_error_size ) return SILENT_RC( rcDB, rcColumn, rcCreating, rcParam, rcInvalid ); } } - } - //TBD + // metadata + const KJsonValue * meta = KJsonObjectGetMember ( m_json, "metadata" ); + if ( meta != nullptr ) + { + const KJsonObject * obj = KJsonValueToObject ( meta ); + if( obj != nullptr ) + { + Metadata * m = new Metadata( obj ); + rc = m -> inflate( p_error, p_error_size ); + if ( rc != 0 ) + { + delete m; + return rc; + } + m_meta = m; + } + else + { // not an object + string_printf ( p_error, p_error_size, nullptr, "%s.metadata is not an object", m_name.c_str() ); + return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + } + } return rc; } @@ -183,6 +250,25 @@ Column::idRange() const return make_pair( m_data.begin()->first, m_data.rbegin()->first - m_data.begin()->first + 1 ); } +int64_t +Column::findFirst( int64_t row ) const +{ + auto it = m_data . lower_bound( row ); + if ( it == m_data.end() ) + { + return 0; + } + return it -> first; +} + +const ColumnBlob * +Column::openBlob( int64_t id ) const +{ + return nullptr; +} + +// API + static rc_t CC KTextColumnWhack ( KColumn *bself ) @@ -218,10 +304,91 @@ KTextColumnByteOrder ( const KColumn *self, bool *reversed ) static rc_t CC -KTextColumnIdRange ( const KColumn *self, int64_t *first, uint64_t *count ) +KTextColumnIdRange ( const KColumn * bself, int64_t *first, uint64_t *count ) +{ + CAST(); + + auto p = self->idRange(); + + *first = p.first; + *count = p.second; + return 0; +} + +static +rc_t CC +KTextColumnFindFirstRowId ( const KColumn * bself, int64_t * found, int64_t start ) { - *first = 0; - *count = 0; + CAST(); + + *found = self -> findFirst( start ); + if ( *found == 0 ) + { + return SILENT_RC ( rcDB, rcColumn, rcSelecting, rcRow, rcNotFound ); + } + return 0; +} + +static +rc_t CC +KTextColumnOpenManagerRead ( const KColumn *bself, const KDBManager **mgr ) +{ + CAST(); + + const Manager * m = self -> getManager(); + if ( m != nullptr ) + { + Manager::addRef( m ); + } + + *mgr = (const KDBManager*)m; + return 0; } +static +rc_t CC +KTextColumnOpenParentRead ( const KColumn *bself, const KTable **tbl ) +{ + CAST(); + + const Table * p = self -> getParent(); + if ( p != nullptr ) + { + Table::addRef( p ); + } + + *tbl = (const KTable*) p; + + return 0; +} + +static +rc_t CC +KTextColumnOpenMetadataRead ( const KColumn *bself, const KMetadata **metap ) +{ + CAST(); + const Metadata * m = self->openMetadata(); + if ( m != nullptr ) + { + Metadata::addRef( m ); + *metap = (const KMetadata*)m; + return 0; + } + return SILENT_RC( rcDB, rcColumn, rcOpening, rcMetadata, rcNotFound ); +} + +static +rc_t CC +KTextColumnOpenBlobRead ( const KColumn *bself, const KColumnBlob **blobp, int64_t id ) +{ + CAST(); + const ColumnBlob * b = self->openBlob( id ); + if ( b != nullptr ) + { + ColumnBlob::addRef( b ); + *blobp = (const KColumnBlob*)b; + return 0; + } + return SILENT_RC( rcDB, rcColumn, rcOpening, rcBlob, rcNotFound ); +} diff --git a/libs/kdbtext/column.hpp b/libs/kdbtext/column.hpp index 53508d94b..13b468c36 100644 --- a/libs/kdbtext/column.hpp +++ b/libs/kdbtext/column.hpp @@ -44,6 +44,9 @@ struct KTextColumn namespace KDBText { class Table; + class Manager; + class Metadata; + class ColumnBlob; class Column : public KTextColumn { @@ -52,20 +55,32 @@ namespace KDBText static void release( const Column *); public: - Column( const KJsonObject * p_json, const Table * parent = nullptr ); + Column( const KJsonObject * p_json, const Manager * mgr = nullptr, const Table * parent = nullptr ); ~Column(); rc_t inflate( char * error, size_t error_size ); + const Manager * getManager() const { return m_mgr; } + const Table * getParent() const { return m_parent; } const std::string & getName() const { return m_name; } - std::pair< int64_t, uint64_t > idRange() const; // { first, last - first + 1 } + std::pair< int64_t, uint64_t > idRange() const; // { first, last - first + 1 }; { 0, 0 } if empty + + int64_t findFirst( int64_t row ) const; + + const Metadata * openMetadata() const { return m_meta; } + + const ColumnBlob * openBlob( int64_t id ) const; private: - const KJsonObject * m_json = nullptr; + const Manager * m_mgr = nullptr; const Table * m_parent = nullptr; + + const KJsonObject * m_json = nullptr; std::string m_name; + std::string m_type; std::map< uint64_t, KDataBuffer > m_data; + const Metadata * m_meta = nullptr; }; } diff --git a/libs/kdbtext/columnblob.cpp b/libs/kdbtext/columnblob.cpp new file mode 100644 index 000000000..57bebdc41 --- /dev/null +++ b/libs/kdbtext/columnblob.cpp @@ -0,0 +1,229 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#include "columnblob.hpp" + +#include + +using namespace KDBText; +using namespace std; + +/*-------------------------------------------------------------------------- + * KTextColumnBlob + * one or more rows of column data + */ + +static rc_t KTextColumnBlobWhack ( KColumnBlob *self ); +// static rc_t CC KTextColumnBlobRead ( const KColumnBlob *self, size_t offset, void *buffer, size_t bsize, size_t *num_read, size_t *remaining ); +// static rc_t CC KTextColumnBlobReadAll ( const KColumnBlob * self, KDataBuffer * buffer, KColumnBlobCSData * opt_cs_data, size_t cs_data_size ); +// static rc_t CC KTextColumnBlobValidate ( const KColumnBlob *self ); +// static rc_t CC KTextColumnBlobValidateBuffer ( const KColumnBlob * self, const KDataBuffer * buffer, const KColumnBlobCSData * cs_data, size_t cs_data_size ); +// static rc_t CC KTextColumnBlobIdRange ( const KColumnBlob *self, int64_t *first, uint32_t *count ); + +static KColumnBlob_vt KTextColumnBlob_vt = +{ + /* Public API */ + KTextColumnBlobWhack, + KColumnBlobBaseAddRef, + KColumnBlobBaseRelease, + // KTextColumnBlobRead, + // KTextColumnBlobReadAll, + // KTextColumnBlobValidate, + // KTextColumnBlobValidateBuffer, + // KTextColumnBlobIdRange +}; + +#define CAST() assert( bself->vt == &KTextColumnBlob_vt ); ColumnBlob * self = (ColumnBlob *)bself + +ColumnBlob::ColumnBlob( const KJsonObject * p_json ) +: m_json ( p_json ) +{ + dad . vt = & KTextColumnBlob_vt; + KRefcountInit ( & dad . refcount, 1, "KDBText::ColumnBlob", "ctor", "db" ); +} + +ColumnBlob::~ColumnBlob() +{ + KRefcountWhack ( & dad . refcount, "KDBText::ColumnBlob" ); +} + +void +ColumnBlob::addRef( const ColumnBlob * col ) +{ + if ( col != nullptr ) + { + KColumnBlobAddRef( (const KColumnBlob*) col ); + } +} + +void +ColumnBlob::release( const ColumnBlob * col ) +{ + if ( col != nullptr ) + { + KColumnBlobRelease( (const KColumnBlob*) col ); + } +} + +rc_t +ColumnBlob::inflate( char * p_error, size_t p_error_size ) +{ + rc_t rc = 0; + + // const KJsonValue * name = KJsonObjectGetMember ( m_json, "name" ); + // if ( name != nullptr ) + // { + // const char * nameStr = nullptr; + // rc = KJsonGetString ( name, & nameStr ); + // if ( rc == 0 ) + // { + // m_name = nameStr; + // } + // } + // else + // { + // string_printf ( p_error, p_error_size, nullptr, "ColumnBlob name is missing" ); + // return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + // } + + // const KJsonValue * type = KJsonObjectGetMember ( m_json, "type" ); + // if ( type != nullptr ) + // { + // const char * typeStr = nullptr; + // rc = KJsonGetString ( type, & typeStr ); + // if ( rc == 0 ) + // { + // m_type = typeStr; + // } + // } + // else + // { + // string_printf ( p_error, p_error_size, nullptr, "ColumnBlob type is missing" ); + // return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + // } + + // // data + // const KJsonValue * data = KJsonObjectGetMember ( m_json, "data" ); + // if ( data != nullptr ) + // { + // const KJsonArray * dataarr = KJsonValueToArray ( data ); + // if ( dataarr == nullptr ) + // { + // string_printf ( p_error, p_error_size, nullptr, "%s.data is not an array", m_name.c_str() ); + // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); + // } + + // uint32_t len = KJsonArrayGetLength ( dataarr ); + // for ( uint32_t i = 0; i < len; ++i ) + // { + // const KJsonValue * v = KJsonArrayGetElement ( dataarr, i ); + // assert( v != nullptr ); + // const KJsonObject * obj = KJsonValueToObject ( v ); + // if( obj != nullptr ) + // { + // const KJsonValue * id = KJsonObjectGetMember ( obj, "row" ); + // if ( id == nullptr ) + // { + // string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].row is missing", m_name.c_str(), i ); + // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); + // } + // const KJsonValue * value = KJsonObjectGetMember ( obj, "value" ); + // if ( value == nullptr ) + // { + // string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].value is missing", m_name.c_str(), i ); + // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); + // } + + // int64_t rowId; + // rc = KJsonGetNumber ( id, &rowId ); + // if ( rc == 0 ) + // { + // if ( m_data.find( rowId ) != m_data . end() ) + // { + // string_printf ( p_error, p_error_size, nullptr, "Duplicate row id: %s", rowId ); + // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); + // } + + // const char * valueStr = nullptr; + // rc = KJsonGetString ( value, & valueStr ); + // if ( rc == 0 ) + // { + // KDataBuffer b; + // KDataBufferMakeBytes( & b, strlen( valueStr ) + 1 ); + // strcpy( (char*)b.base, valueStr ); + // m_data [ rowId ] = b; + // } + // } + // else + // { // not an object + // string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].row is not an integer", m_name.c_str(), i ); + // return rc; + // } + // } + // else + // { // not an object + // string_printf ( p_error, p_error_size, nullptr, "%s.data[%i] is not an object", m_name.c_str(), i ); + // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); + // } + // } + // } + + // // metadata + // const KJsonValue * meta = KJsonObjectGetMember ( m_json, "metadata" ); + // if ( meta != nullptr ) + // { + // const KJsonObject * obj = KJsonValueToObject ( meta ); + // if( obj != nullptr ) + // { + // Metadata * m = new Metadata( obj ); + // rc = m -> inflate( p_error, p_error_size ); + // if ( rc != 0 ) + // { + // delete m; + // return rc; + // } + // m_meta = m; + // } + // else + // { // not an object + // string_printf ( p_error, p_error_size, nullptr, "%s.metadata is not an object", m_name.c_str() ); + // return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); + // } + // } + + return rc; +} + +// API + +static +rc_t +KTextColumnBlobWhack ( KColumnBlob *bself ) +{ + CAST(); + + return KColumnBlobBaseWhack ( bself ); +} diff --git a/libs/kdbtext/columnblob.hpp b/libs/kdbtext/columnblob.hpp new file mode 100644 index 000000000..c5cceecc9 --- /dev/null +++ b/libs/kdbtext/columnblob.hpp @@ -0,0 +1,57 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +#pragma once + +#include "../libs/kdb/columnblob-base.h" + +#include +#include + +typedef struct KTextBlob KTextBlob; +struct KTextBlob +{ + KColumnBlob dad; +}; + +namespace KDBText +{ + class ColumnBlob : public KTextBlob + { + public: + static void addRef( const ColumnBlob* ); + static void release( const ColumnBlob *); + + public: + ColumnBlob( const KJsonObject * p_json ); + ~ColumnBlob(); + + rc_t inflate( char * error, size_t error_size ); + + private: + const KJsonObject * m_json = nullptr; + }; +} diff --git a/libs/kdbtext/table.cpp b/libs/kdbtext/table.cpp index 780bce853..bdd229192 100644 --- a/libs/kdbtext/table.cpp +++ b/libs/kdbtext/table.cpp @@ -124,7 +124,7 @@ Table::openColumn( const string & name ) const auto j = m_columns.find( name ); if ( j != m_columns.end() ) { - Column * ret = new Column( j -> second, this ); + Column * ret = new Column( j -> second, m_mgr, this ); ret -> inflate( error, sizeof error ); return ret; } diff --git a/test/kdbtext/CMakeLists.txt b/test/kdbtext/CMakeLists.txt index 32c8d6aa1..1c9513268 100644 --- a/test/kdbtext/CMakeLists.txt +++ b/test/kdbtext/CMakeLists.txt @@ -40,3 +40,4 @@ AddExecutableTest( Test_KDBText_Column "test-column" "${LIBS}" ) AddExecutableTest( Test_KDBText_Table "test-table" "${LIBS}" ) AddExecutableTest( Test_KDBText_Database "test-database" "${LIBS}" ) AddExecutableTest( Test_KDBText_Manager "test-manager" "${LIBS}" ) +AddExecutableTest( Test_KDBText_Blob "test-blob" "${LIBS}" ) diff --git a/test/kdbtext/test-blob.cpp b/test/kdbtext/test-blob.cpp new file mode 100644 index 000000000..ae51ad66a --- /dev/null +++ b/test/kdbtext/test-blob.cpp @@ -0,0 +1,308 @@ +/*=========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +*/ + +/** +* Unit tests for KDBColumn for reading textual data +*/ + +#include + +#include "../../libs/kdbtext/columnblob.hpp" + +#include +#include + +using namespace std; +using namespace KDBText; + +TEST_SUITE(KTextColumnBlobTestSuite); + +const char * TestColumn = R"({"name":"col", + "type":"ascii", + "data": + [ + {"row":1,"value":"AGCT"}, + {"row":2,"value":"AGCT"} + ]})"; + +class KTextColumnBlob_Fixture +{ +public: + KTextColumnBlob_Fixture() + { + } + ~KTextColumnBlob_Fixture() + { + KJsonValueWhack( m_json ); + } + + void Setup( const char * input ) + { + THROW_ON_RC( KJsonValueMake ( & m_json, input, m_error, sizeof m_error ) ); + THROW_ON_FALSE( jsObject == KJsonGetValueType ( m_json ) ); + + const KJsonObject * json = KJsonValueToObject ( m_json ); + THROW_ON_FALSE( json != nullptr ); + + m_col = new Column( json, nullptr ); + } + + KJsonValue * m_json = nullptr; + Column * m_col = nullptr; + char m_error[1024] = {0}; +}; + +FIXTURE_TEST_CASE(KTextColumnBlob_Make_Empty, KTextColumnBlob_Fixture) +{ + Setup(R"({})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KTextColumnBlob_Make_TypeMissing, KTextColumnBlob_Fixture) +{ + Setup(R"({"name":"col"})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KTextColumnBlob_Make, KTextColumnBlob_Fixture) +{ + Setup(TestColumn); + REQUIRE_RC( m_col -> inflate( m_error, sizeof m_error ) ); + REQUIRE_EQ( string("col"), m_col->getName() ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_Make_DataNotArray, KTextColumnBlob_Fixture) +{ + Setup(R"({"name":"col","data":{}})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KTextColumnBlob_Make_CellNotObject, KTextColumnBlob_Fixture) +{ + Setup(R"({"name":"col","data":[1]})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KTextColumnBlob_CellMake_RowMissing, KTextColumnBlob_Fixture) +{ + Setup(R"({"name":"col","data":[{}]})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} +FIXTURE_TEST_CASE(KTextColumnBlob_CellMake_RowBad, KTextColumnBlob_Fixture) +{ + Setup(R"({"name":"col","data": [ {"row":"a","value":"q"} ] })"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KTextColumnBlob_CellMake_ValueMissing, KTextColumnBlob_Fixture) +{ + Setup(R"({"name":"col","data": [ {"row":"1"} ] })"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + +FIXTURE_TEST_CASE(KTextColumnBlob_IdRange, KTextColumnBlob_Fixture) +{ + Setup(TestColumn); + REQUIRE_RC( m_col -> inflate( m_error, sizeof m_error ) ); + auto r = m_col->idRange(); + REQUIRE_EQ( (int64_t)1, r . first ); + REQUIRE_EQ( (uint64_t)2, r . second ); +} + +// API + +const char * FullTable = R"({"type": "table", "name": "testtbl", + "columns":[ + { + "name":"col", + "type":"ascii", + "data": + [ + {"row":1,"value":"AGCT"}, + {"row":2,"value":"AGCT"}, + {"row":11,"value":"AGCT"}, + {"row":22,"value":"AGCT"} + ], + "metadata":{"name":"", "value":"blah"} + } + ] +})"; + +class KTextColumnBlob_ApiFixture +{ +public: + KTextColumnBlob_ApiFixture() + { + } + ~KTextColumnBlob_ApiFixture() + { + KColumnRelease( m_col ); + KTableRelease( m_tbl ); + KDBManagerRelease( m_mgr ); + } + void Setup( const char * input, const char * col ) + { + try + { + THROW_ON_RC( KDBManagerMakeText ( & m_mgr, input, m_error, sizeof m_error ) ); + THROW_ON_RC( KDBManagerOpenTableRead( m_mgr, & m_tbl, "%s", "testtbl" ) ); + THROW_ON_RC( KTableOpenColumnRead( m_tbl, & m_col, "%s", col ) ); + } + catch(const std::exception& e) + { + std::cerr << e.what() << " with '" << m_error << "'" << endl; + throw; + } + + } + + const KDBManager * m_mgr = nullptr; + const KTable * m_tbl = nullptr; + const KColumn * m_col = nullptr; + char m_error[1024] = {0}; +}; + +FIXTURE_TEST_CASE(KColumn_AddRelease, KTextColumnBlob_ApiFixture) +{ + Setup(FullTable, "col"); + + REQUIRE_RC( KColumnAddRef( m_col ) ); + REQUIRE_RC( KColumnRelease( m_col ) ); + // use valgrind to find any leaks +} + +FIXTURE_TEST_CASE(KColumn_Locked, KTextColumnBlob_ApiFixture) +{ // always false for this library + Setup(FullTable, "col"); + REQUIRE( ! KColumnLocked( m_col ) ); +} +FIXTURE_TEST_CASE(KColumn_Version, KTextColumnBlob_ApiFixture) +{ // always 0 for this library + Setup(FullTable, "col"); + uint32_t version = 99; + REQUIRE_RC( KColumnVersion( m_col, &version ) ); + REQUIRE_EQ( (uint32_t)0, version ); +} +FIXTURE_TEST_CASE(KColumn_ByteOrder, KTextColumnBlob_ApiFixture) +{ // always false for this library + Setup(FullTable, "col"); + bool reversed = true; + REQUIRE_RC( KColumnByteOrder( m_col, &reversed ) ); + REQUIRE( ! reversed ); +} + +FIXTURE_TEST_CASE(KColumn_IdRange, KTextColumnBlob_ApiFixture) +{ + Setup(FullTable, "col"); + int64_t first = 0; + uint64_t count = 0; + REQUIRE_RC( KColumnIdRange ( m_col, & first, & count ) ); + REQUIRE_EQ( (int64_t)1, first ); + REQUIRE_EQ( (uint64_t)22, count ); +} + +FIXTURE_TEST_CASE(KColumn_FindFirstRowId, KTextColumnBlob_ApiFixture) +{ + Setup(FullTable, "col"); + int64_t found = 0; + REQUIRE_RC( KColumnFindFirstRowId ( m_col, & found, 4 ) ); + REQUIRE_EQ( (int64_t)11, found ); +} + +FIXTURE_TEST_CASE(KColumn_OpenManagerRead, KTextColumnBlob_ApiFixture) +{ + Setup(FullTable, "col"); + const KDBManager * mgr = nullptr; + REQUIRE_RC( KColumnOpenManagerRead ( m_col, & mgr ) ); + REQUIRE_EQ( m_mgr, mgr ); + REQUIRE_RC( KDBManagerRelease( mgr ) ); +} + +FIXTURE_TEST_CASE(KColumn_OpenParentRead, KTextColumnBlob_ApiFixture) +{ + Setup(FullTable, "col"); + + const KTable * par = nullptr; + REQUIRE_RC( KColumnOpenParentRead( m_col, & par ) ); + REQUIRE_NOT_NULL( par ); + REQUIRE_EQ( m_tbl, par ); + KTableRelease( par ); +} + +FIXTURE_TEST_CASE(KColumn_OpenMetadataRead, KTextColumnBlob_ApiFixture) +{ + Setup(FullTable, "col"); + const KMetadata * m = nullptr; + REQUIRE_RC( KColumnOpenMetadataRead ( m_col, &m ) ); + REQUIRE_NOT_NULL( m ); + REQUIRE_RC( KMetadataRelease( m ) ); +} + +FIXTURE_TEST_CASE(KColumn_OpenBlobRead, KTextColumnBlob_ApiFixture) +{ + Setup(FullTable, "col"); + const KColumnBlob * blob = nullptr; + REQUIRE_RC( KColumnOpenBlobRead ( m_col, & blob, 11 ) ); + REQUIRE_NOT_NULL( blob ); + REQUIRE_RC( KColumnBlobRelease( blob ) ); +} + +//////////////////////////////////////////// Main +extern "C" +{ + +#include +#include + +ver_t CC KAppVersion ( void ) +{ + return 0x1000000; +} +rc_t CC UsageSummary (const char * progname) +{ + return 0; +} + +rc_t CC Usage ( const Args * args ) +{ + return 0; +} + +const char UsageDefaultName[] = "Test_KDBText_Column"; + +rc_t CC KMain ( int argc, char *argv [] ) +{ + KConfigDisableUserSettings(); + rc_t rc=KTextColumnBlobTestSuite(argc, argv); + return rc; +} + +} diff --git a/test/kdbtext/test-column.cpp b/test/kdbtext/test-column.cpp index 92850294d..cf34e1801 100644 --- a/test/kdbtext/test-column.cpp +++ b/test/kdbtext/test-column.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,7 @@ using namespace KDBText; TEST_SUITE(KTextColumnTestSuite); const char * TestColumn = R"({"name":"col", + "type":"ascii", "data": [ {"row":1,"value":"AGCT"}, @@ -85,6 +87,12 @@ FIXTURE_TEST_CASE(KTextColumn_Make_Empty, KTextColumn_Fixture) REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } +FIXTURE_TEST_CASE(KTextColumn_Make_TypeMissing, KTextColumn_Fixture) +{ + Setup(R"({"name":"col"})"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} FIXTURE_TEST_CASE(KTextColumn_Make, KTextColumn_Fixture) { @@ -112,6 +120,13 @@ FIXTURE_TEST_CASE(KTextColumn_CellMake_RowMissing, KTextColumn_Fixture) REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } +FIXTURE_TEST_CASE(KTextColumn_CellMake_RowBad, KTextColumn_Fixture) +{ + Setup(R"({"name":"col","data": [ {"row":"a","value":"q"} ] })"); + REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); + //cout << m_error << endl; +} + FIXTURE_TEST_CASE(KTextColumn_CellMake_ValueMissing, KTextColumn_Fixture) { Setup(R"({"name":"col","data": [ {"row":"1"} ] })"); @@ -122,6 +137,7 @@ FIXTURE_TEST_CASE(KTextColumn_CellMake_ValueMissing, KTextColumn_Fixture) FIXTURE_TEST_CASE(KTextColumn_IdRange, KTextColumn_Fixture) { Setup(TestColumn); + REQUIRE_RC( m_col -> inflate( m_error, sizeof m_error ) ); auto r = m_col->idRange(); REQUIRE_EQ( (int64_t)1, r . first ); REQUIRE_EQ( (uint64_t)2, r . second ); @@ -133,11 +149,15 @@ const char * FullTable = R"({"type": "table", "name": "testtbl", "columns":[ { "name":"col", + "type":"ascii", "data": [ {"row":1,"value":"AGCT"}, - {"row":2,"value":"AGCT"} - ] + {"row":2,"value":"AGCT"}, + {"row":11,"value":"AGCT"}, + {"row":22,"value":"AGCT"} + ], + "metadata":{"name":"", "value":"blah"} } ] })"; @@ -151,18 +171,16 @@ class KTextColumn_ApiFixture ~KTextColumn_ApiFixture() { KColumnRelease( m_col ); + KTableRelease( m_tbl ); + KDBManagerRelease( m_mgr ); } void Setup( const char * input, const char * col ) { try { - const KDBManager * mgr = nullptr; - THROW_ON_RC( KDBManagerMakeText ( & mgr, input, m_error, sizeof m_error ) ); - const KTable * tbl; - THROW_ON_RC( KDBManagerOpenTableRead( mgr, & tbl, "%s", "testtbl" ) ); - THROW_ON_RC( KTableOpenColumnRead( tbl, & m_col, "%s", col ) ); - KTableRelease( tbl ); - KDBManagerRelease( mgr ); + THROW_ON_RC( KDBManagerMakeText ( & m_mgr, input, m_error, sizeof m_error ) ); + THROW_ON_RC( KDBManagerOpenTableRead( m_mgr, & m_tbl, "%s", "testtbl" ) ); + THROW_ON_RC( KTableOpenColumnRead( m_tbl, & m_col, "%s", col ) ); } catch(const std::exception& e) { @@ -172,6 +190,8 @@ class KTextColumn_ApiFixture } + const KDBManager * m_mgr = nullptr; + const KTable * m_tbl = nullptr; const KColumn * m_col = nullptr; char m_error[1024] = {0}; }; @@ -212,7 +232,53 @@ FIXTURE_TEST_CASE(KColumn_IdRange, KTextColumn_ApiFixture) uint64_t count = 0; REQUIRE_RC( KColumnIdRange ( m_col, & first, & count ) ); REQUIRE_EQ( (int64_t)1, first ); - REQUIRE_EQ( (uint64_t)2, count ); + REQUIRE_EQ( (uint64_t)22, count ); +} + +FIXTURE_TEST_CASE(KColumn_FindFirstRowId, KTextColumn_ApiFixture) +{ + Setup(FullTable, "col"); + int64_t found = 0; + REQUIRE_RC( KColumnFindFirstRowId ( m_col, & found, 4 ) ); + REQUIRE_EQ( (int64_t)11, found ); +} + +FIXTURE_TEST_CASE(KColumn_OpenManagerRead, KTextColumn_ApiFixture) +{ + Setup(FullTable, "col"); + const KDBManager * mgr = nullptr; + REQUIRE_RC( KColumnOpenManagerRead ( m_col, & mgr ) ); + REQUIRE_EQ( m_mgr, mgr ); + REQUIRE_RC( KDBManagerRelease( mgr ) ); +} + +FIXTURE_TEST_CASE(KColumn_OpenParentRead, KTextColumn_ApiFixture) +{ + Setup(FullTable, "col"); + + const KTable * par = nullptr; + REQUIRE_RC( KColumnOpenParentRead( m_col, & par ) ); + REQUIRE_NOT_NULL( par ); + REQUIRE_EQ( m_tbl, par ); + KTableRelease( par ); +} + +FIXTURE_TEST_CASE(KColumn_OpenMetadataRead, KTextColumn_ApiFixture) +{ + Setup(FullTable, "col"); + const KMetadata * m = nullptr; + REQUIRE_RC( KColumnOpenMetadataRead ( m_col, &m ) ); + REQUIRE_NOT_NULL( m ); + REQUIRE_RC( KMetadataRelease( m ) ); +} + +FIXTURE_TEST_CASE(KColumn_OpenBlobRead, KTextColumn_ApiFixture) +{ + Setup(FullTable, "col"); + const KColumnBlob * blob = nullptr; + REQUIRE_RC( KColumnOpenBlobRead ( m_col, & blob, 11 ) ); + REQUIRE_NOT_NULL( blob ); + REQUIRE_RC( KColumnBlobRelease( blob ) ); } //////////////////////////////////////////// Main diff --git a/test/kdbtext/test-manager.cpp b/test/kdbtext/test-manager.cpp index cb6516d97..bed5ae61a 100644 --- a/test/kdbtext/test-manager.cpp +++ b/test/kdbtext/test-manager.cpp @@ -230,13 +230,13 @@ FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Table_Nested, KDBTextManager_Fixture FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_NotFound, KDBTextManager_Fixture) { - Setup( R"({ "type": "table", "name": "tbl1", "columns":[{"name":"col1"}] })" ); + Setup( R"({ "type": "table", "name": "tbl1", "columns":[{"name":"col1","type":"ascii"}] })" ); MakeVPath( "tbl1/col/notcol"); REQUIRE_EQ( (int)kptNotFound, KDBManagerPathTypeVP( m_mgr, m_path ) ); } FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_RootTable, KDBTextManager_Fixture) { - Setup( R"({ "type": "table", "name": "tbl1", "columns":[{"name":"col1"}] })" ); + Setup( R"({ "type": "table", "name": "tbl1", "columns":[{"name":"col1","type":"ascii"}] })" ); MakeVPath( "tbl1/col/col1"); REQUIRE_EQ( (int)kptColumn, KDBManagerPathTypeVP( m_mgr, m_path ) ); } @@ -245,7 +245,7 @@ FIXTURE_TEST_CASE(KDBTextManager_PathTypeVP_Column_Db, KDBTextManager_Fixture) Setup( R"({"type": "database","name": "testdb", "tables":[ { "type": "table", "name": "tbl1", - "columns":[{"name":"col1"}] + "columns":[{"name":"col1","type":"ascii"}] } ] })" ); diff --git a/test/kdbtext/test-table.cpp b/test/kdbtext/test-table.cpp index 1b78cfd28..59dd09707 100644 --- a/test/kdbtext/test-table.cpp +++ b/test/kdbtext/test-table.cpp @@ -84,7 +84,7 @@ class KTextTable_Fixture }; const char * FullTable = R"({"type": "table", "name": "testtbl", - "columns":[ {"name":"col1"},{"name":"col2"} ], + "columns":[ {"name":"col1","type":"ascii"},{"name":"col2","type":"ascii"} ], "indexes":[ {"name":"i1","text":[]}, {"name":"i2","text":[]} ], "metadata":{"name":"", "value":"blah"} })"; @@ -128,13 +128,13 @@ FIXTURE_TEST_CASE(KTextTable_Make_Flat, KTextTable_Fixture) FIXTURE_TEST_CASE(KTextTable_Make_ColumnsNoArray, KTextTable_Fixture) { - Setup(R"({"type": "table", "name": "testtbl","columns":{"name":"col1"}})"); + Setup(R"({"type": "table", "name": "testtbl","columns":{"name":"col1","type":"ascii"}})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } FIXTURE_TEST_CASE(KTextTable_Make_ColumnDuplicate, KTextTable_Fixture) { - Setup(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1"},{"name":"col1"}]})"); + Setup(R"({"type": "table", "name": "testtbl","columns":[{"name":"col1","type":"ascii"},{"name":"col1","type":"ascii"}]})"); REQUIRE_RC_FAIL( m_tbl -> inflate( m_error, sizeof m_error ) ); //cout << m_error << endl; } From 78640d3e4af493d6638b2a21c75bcee1367390e5 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Wed, 17 Jan 2024 13:51:47 -0500 Subject: [PATCH 31/42] VDB-5533 done --- libs/kdbtext/column.cpp | 6 +- libs/kdbtext/columnblob.cpp | 152 +------------------------ libs/kdbtext/columnblob.hpp | 14 +-- test/kdbtext/test-blob.cpp | 216 +----------------------------------- 4 files changed, 18 insertions(+), 370 deletions(-) diff --git a/libs/kdbtext/column.cpp b/libs/kdbtext/column.cpp index 35aced3c4..669202266 100644 --- a/libs/kdbtext/column.cpp +++ b/libs/kdbtext/column.cpp @@ -264,6 +264,11 @@ Column::findFirst( int64_t row ) const const ColumnBlob * Column::openBlob( int64_t id ) const { + auto it = m_data.find( id ); + if ( it != m_data.end() ) + { + return new ColumnBlob( it -> second . base, it -> second . elem_count, this, id, 1 ); + } return nullptr; } @@ -386,7 +391,6 @@ KTextColumnOpenBlobRead ( const KColumn *bself, const KColumnBlob **blobp, int64 const ColumnBlob * b = self->openBlob( id ); if ( b != nullptr ) { - ColumnBlob::addRef( b ); *blobp = (const KColumnBlob*)b; return 0; } diff --git a/libs/kdbtext/columnblob.cpp b/libs/kdbtext/columnblob.cpp index 57bebdc41..2202752a7 100644 --- a/libs/kdbtext/columnblob.cpp +++ b/libs/kdbtext/columnblob.cpp @@ -58,8 +58,7 @@ static KColumnBlob_vt KTextColumnBlob_vt = #define CAST() assert( bself->vt == &KTextColumnBlob_vt ); ColumnBlob * self = (ColumnBlob *)bself -ColumnBlob::ColumnBlob( const KJsonObject * p_json ) -: m_json ( p_json ) +ColumnBlob::ColumnBlob( const void * data, size_t size, const Column * col, int64_t id, uint64_t count ) { dad . vt = & KTextColumnBlob_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::ColumnBlob", "ctor", "db" ); @@ -70,160 +69,11 @@ ColumnBlob::~ColumnBlob() KRefcountWhack ( & dad . refcount, "KDBText::ColumnBlob" ); } -void -ColumnBlob::addRef( const ColumnBlob * col ) -{ - if ( col != nullptr ) - { - KColumnBlobAddRef( (const KColumnBlob*) col ); - } -} - -void -ColumnBlob::release( const ColumnBlob * col ) -{ - if ( col != nullptr ) - { - KColumnBlobRelease( (const KColumnBlob*) col ); - } -} - -rc_t -ColumnBlob::inflate( char * p_error, size_t p_error_size ) -{ - rc_t rc = 0; - - // const KJsonValue * name = KJsonObjectGetMember ( m_json, "name" ); - // if ( name != nullptr ) - // { - // const char * nameStr = nullptr; - // rc = KJsonGetString ( name, & nameStr ); - // if ( rc == 0 ) - // { - // m_name = nameStr; - // } - // } - // else - // { - // string_printf ( p_error, p_error_size, nullptr, "ColumnBlob name is missing" ); - // return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); - // } - - // const KJsonValue * type = KJsonObjectGetMember ( m_json, "type" ); - // if ( type != nullptr ) - // { - // const char * typeStr = nullptr; - // rc = KJsonGetString ( type, & typeStr ); - // if ( rc == 0 ) - // { - // m_type = typeStr; - // } - // } - // else - // { - // string_printf ( p_error, p_error_size, nullptr, "ColumnBlob type is missing" ); - // return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); - // } - - // // data - // const KJsonValue * data = KJsonObjectGetMember ( m_json, "data" ); - // if ( data != nullptr ) - // { - // const KJsonArray * dataarr = KJsonValueToArray ( data ); - // if ( dataarr == nullptr ) - // { - // string_printf ( p_error, p_error_size, nullptr, "%s.data is not an array", m_name.c_str() ); - // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); - // } - - // uint32_t len = KJsonArrayGetLength ( dataarr ); - // for ( uint32_t i = 0; i < len; ++i ) - // { - // const KJsonValue * v = KJsonArrayGetElement ( dataarr, i ); - // assert( v != nullptr ); - // const KJsonObject * obj = KJsonValueToObject ( v ); - // if( obj != nullptr ) - // { - // const KJsonValue * id = KJsonObjectGetMember ( obj, "row" ); - // if ( id == nullptr ) - // { - // string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].row is missing", m_name.c_str(), i ); - // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); - // } - // const KJsonValue * value = KJsonObjectGetMember ( obj, "value" ); - // if ( value == nullptr ) - // { - // string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].value is missing", m_name.c_str(), i ); - // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); - // } - - // int64_t rowId; - // rc = KJsonGetNumber ( id, &rowId ); - // if ( rc == 0 ) - // { - // if ( m_data.find( rowId ) != m_data . end() ) - // { - // string_printf ( p_error, p_error_size, nullptr, "Duplicate row id: %s", rowId ); - // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); - // } - - // const char * valueStr = nullptr; - // rc = KJsonGetString ( value, & valueStr ); - // if ( rc == 0 ) - // { - // KDataBuffer b; - // KDataBufferMakeBytes( & b, strlen( valueStr ) + 1 ); - // strcpy( (char*)b.base, valueStr ); - // m_data [ rowId ] = b; - // } - // } - // else - // { // not an object - // string_printf ( p_error, p_error_size, nullptr, "%s.data[%i].row is not an integer", m_name.c_str(), i ); - // return rc; - // } - // } - // else - // { // not an object - // string_printf ( p_error, p_error_size, nullptr, "%s.data[%i] is not an object", m_name.c_str(), i ); - // return SILENT_RC( rcDB, rcBlob, rcCreating, rcParam, rcInvalid ); - // } - // } - // } - - // // metadata - // const KJsonValue * meta = KJsonObjectGetMember ( m_json, "metadata" ); - // if ( meta != nullptr ) - // { - // const KJsonObject * obj = KJsonValueToObject ( meta ); - // if( obj != nullptr ) - // { - // Metadata * m = new Metadata( obj ); - // rc = m -> inflate( p_error, p_error_size ); - // if ( rc != 0 ) - // { - // delete m; - // return rc; - // } - // m_meta = m; - // } - // else - // { // not an object - // string_printf ( p_error, p_error_size, nullptr, "%s.metadata is not an object", m_name.c_str() ); - // return SILENT_RC( rcDB, rcDatabase, rcCreating, rcParam, rcInvalid ); - // } - // } - - return rc; -} - // API static rc_t KTextColumnBlobWhack ( KColumnBlob *bself ) { - CAST(); - return KColumnBlobBaseWhack ( bself ); } diff --git a/libs/kdbtext/columnblob.hpp b/libs/kdbtext/columnblob.hpp index c5cceecc9..5c731618d 100644 --- a/libs/kdbtext/columnblob.hpp +++ b/libs/kdbtext/columnblob.hpp @@ -28,9 +28,6 @@ #include "../libs/kdb/columnblob-base.h" -#include -#include - typedef struct KTextBlob KTextBlob; struct KTextBlob { @@ -39,6 +36,8 @@ struct KTextBlob namespace KDBText { + class Column; + class ColumnBlob : public KTextBlob { public: @@ -46,12 +45,13 @@ namespace KDBText static void release( const ColumnBlob *); public: - ColumnBlob( const KJsonObject * p_json ); + ColumnBlob( const void * data, size_t size, const Column * col, int64_t id, uint64_t count ); ~ColumnBlob(); - rc_t inflate( char * error, size_t error_size ); - private: - const KJsonObject * m_json = nullptr; + const void * data = nullptr; + const Column * m_parent = nullptr; + int64_t m_firstRow = 0; + uint64_t m_count = 0; }; } diff --git a/test/kdbtext/test-blob.cpp b/test/kdbtext/test-blob.cpp index ae51ad66a..729bf9ae4 100644 --- a/test/kdbtext/test-blob.cpp +++ b/test/kdbtext/test-blob.cpp @@ -32,9 +32,6 @@ #include "../../libs/kdbtext/columnblob.hpp" -#include -#include - using namespace std; using namespace KDBText; @@ -56,223 +53,20 @@ class KTextColumnBlob_Fixture } ~KTextColumnBlob_Fixture() { - KJsonValueWhack( m_json ); + delete m_blob; } - void Setup( const char * input ) + void Setup( const string & data = "abcdef" ) { - THROW_ON_RC( KJsonValueMake ( & m_json, input, m_error, sizeof m_error ) ); - THROW_ON_FALSE( jsObject == KJsonGetValueType ( m_json ) ); - - const KJsonObject * json = KJsonValueToObject ( m_json ); - THROW_ON_FALSE( json != nullptr ); - - m_col = new Column( json, nullptr ); + m_blob = new ColumnBlob( data.c_str(), data.size(), nullptr, 1, 1 ); } - KJsonValue * m_json = nullptr; - Column * m_col = nullptr; - char m_error[1024] = {0}; + ColumnBlob * m_blob = nullptr; }; FIXTURE_TEST_CASE(KTextColumnBlob_Make_Empty, KTextColumnBlob_Fixture) { - Setup(R"({})"); - REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); - //cout << m_error << endl; -} -FIXTURE_TEST_CASE(KTextColumnBlob_Make_TypeMissing, KTextColumnBlob_Fixture) -{ - Setup(R"({"name":"col"})"); - REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); - //cout << m_error << endl; -} - -FIXTURE_TEST_CASE(KTextColumnBlob_Make, KTextColumnBlob_Fixture) -{ - Setup(TestColumn); - REQUIRE_RC( m_col -> inflate( m_error, sizeof m_error ) ); - REQUIRE_EQ( string("col"), m_col->getName() ); -} - -FIXTURE_TEST_CASE(KTextColumnBlob_Make_DataNotArray, KTextColumnBlob_Fixture) -{ - Setup(R"({"name":"col","data":{}})"); - REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); - //cout << m_error << endl; -} - -FIXTURE_TEST_CASE(KTextColumnBlob_Make_CellNotObject, KTextColumnBlob_Fixture) -{ - Setup(R"({"name":"col","data":[1]})"); - REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); - //cout << m_error << endl; -} -FIXTURE_TEST_CASE(KTextColumnBlob_CellMake_RowMissing, KTextColumnBlob_Fixture) -{ - Setup(R"({"name":"col","data":[{}]})"); - REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); - //cout << m_error << endl; -} -FIXTURE_TEST_CASE(KTextColumnBlob_CellMake_RowBad, KTextColumnBlob_Fixture) -{ - Setup(R"({"name":"col","data": [ {"row":"a","value":"q"} ] })"); - REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); - //cout << m_error << endl; -} - -FIXTURE_TEST_CASE(KTextColumnBlob_CellMake_ValueMissing, KTextColumnBlob_Fixture) -{ - Setup(R"({"name":"col","data": [ {"row":"1"} ] })"); - REQUIRE_RC_FAIL( m_col -> inflate( m_error, sizeof m_error ) ); - //cout << m_error << endl; -} - -FIXTURE_TEST_CASE(KTextColumnBlob_IdRange, KTextColumnBlob_Fixture) -{ - Setup(TestColumn); - REQUIRE_RC( m_col -> inflate( m_error, sizeof m_error ) ); - auto r = m_col->idRange(); - REQUIRE_EQ( (int64_t)1, r . first ); - REQUIRE_EQ( (uint64_t)2, r . second ); -} - -// API - -const char * FullTable = R"({"type": "table", "name": "testtbl", - "columns":[ - { - "name":"col", - "type":"ascii", - "data": - [ - {"row":1,"value":"AGCT"}, - {"row":2,"value":"AGCT"}, - {"row":11,"value":"AGCT"}, - {"row":22,"value":"AGCT"} - ], - "metadata":{"name":"", "value":"blah"} - } - ] -})"; - -class KTextColumnBlob_ApiFixture -{ -public: - KTextColumnBlob_ApiFixture() - { - } - ~KTextColumnBlob_ApiFixture() - { - KColumnRelease( m_col ); - KTableRelease( m_tbl ); - KDBManagerRelease( m_mgr ); - } - void Setup( const char * input, const char * col ) - { - try - { - THROW_ON_RC( KDBManagerMakeText ( & m_mgr, input, m_error, sizeof m_error ) ); - THROW_ON_RC( KDBManagerOpenTableRead( m_mgr, & m_tbl, "%s", "testtbl" ) ); - THROW_ON_RC( KTableOpenColumnRead( m_tbl, & m_col, "%s", col ) ); - } - catch(const std::exception& e) - { - std::cerr << e.what() << " with '" << m_error << "'" << endl; - throw; - } - - } - - const KDBManager * m_mgr = nullptr; - const KTable * m_tbl = nullptr; - const KColumn * m_col = nullptr; - char m_error[1024] = {0}; -}; - -FIXTURE_TEST_CASE(KColumn_AddRelease, KTextColumnBlob_ApiFixture) -{ - Setup(FullTable, "col"); - - REQUIRE_RC( KColumnAddRef( m_col ) ); - REQUIRE_RC( KColumnRelease( m_col ) ); - // use valgrind to find any leaks -} - -FIXTURE_TEST_CASE(KColumn_Locked, KTextColumnBlob_ApiFixture) -{ // always false for this library - Setup(FullTable, "col"); - REQUIRE( ! KColumnLocked( m_col ) ); -} -FIXTURE_TEST_CASE(KColumn_Version, KTextColumnBlob_ApiFixture) -{ // always 0 for this library - Setup(FullTable, "col"); - uint32_t version = 99; - REQUIRE_RC( KColumnVersion( m_col, &version ) ); - REQUIRE_EQ( (uint32_t)0, version ); -} -FIXTURE_TEST_CASE(KColumn_ByteOrder, KTextColumnBlob_ApiFixture) -{ // always false for this library - Setup(FullTable, "col"); - bool reversed = true; - REQUIRE_RC( KColumnByteOrder( m_col, &reversed ) ); - REQUIRE( ! reversed ); -} - -FIXTURE_TEST_CASE(KColumn_IdRange, KTextColumnBlob_ApiFixture) -{ - Setup(FullTable, "col"); - int64_t first = 0; - uint64_t count = 0; - REQUIRE_RC( KColumnIdRange ( m_col, & first, & count ) ); - REQUIRE_EQ( (int64_t)1, first ); - REQUIRE_EQ( (uint64_t)22, count ); -} - -FIXTURE_TEST_CASE(KColumn_FindFirstRowId, KTextColumnBlob_ApiFixture) -{ - Setup(FullTable, "col"); - int64_t found = 0; - REQUIRE_RC( KColumnFindFirstRowId ( m_col, & found, 4 ) ); - REQUIRE_EQ( (int64_t)11, found ); -} - -FIXTURE_TEST_CASE(KColumn_OpenManagerRead, KTextColumnBlob_ApiFixture) -{ - Setup(FullTable, "col"); - const KDBManager * mgr = nullptr; - REQUIRE_RC( KColumnOpenManagerRead ( m_col, & mgr ) ); - REQUIRE_EQ( m_mgr, mgr ); - REQUIRE_RC( KDBManagerRelease( mgr ) ); -} - -FIXTURE_TEST_CASE(KColumn_OpenParentRead, KTextColumnBlob_ApiFixture) -{ - Setup(FullTable, "col"); - - const KTable * par = nullptr; - REQUIRE_RC( KColumnOpenParentRead( m_col, & par ) ); - REQUIRE_NOT_NULL( par ); - REQUIRE_EQ( m_tbl, par ); - KTableRelease( par ); -} - -FIXTURE_TEST_CASE(KColumn_OpenMetadataRead, KTextColumnBlob_ApiFixture) -{ - Setup(FullTable, "col"); - const KMetadata * m = nullptr; - REQUIRE_RC( KColumnOpenMetadataRead ( m_col, &m ) ); - REQUIRE_NOT_NULL( m ); - REQUIRE_RC( KMetadataRelease( m ) ); -} - -FIXTURE_TEST_CASE(KColumn_OpenBlobRead, KTextColumnBlob_ApiFixture) -{ - Setup(FullTable, "col"); - const KColumnBlob * blob = nullptr; - REQUIRE_RC( KColumnOpenBlobRead ( m_col, & blob, 11 ) ); - REQUIRE_NOT_NULL( blob ); - REQUIRE_RC( KColumnBlobRelease( blob ) ); + Setup(); } //////////////////////////////////////////// Main From 84cd91d428a9b64d9e4f77453f93b84a4575808c Mon Sep 17 00:00:00 2001 From: aboshkin Date: Wed, 17 Jan 2024 15:57:47 -0500 Subject: [PATCH 32/42] VDB-5541 saving work --- libs/kdbtext/columnblob.cpp | 43 ++++++++++++++-- libs/kdbtext/columnblob.hpp | 6 ++- test/kdbtext/test-blob.cpp | 98 ++++++++++++++++++++++++++++++++++--- 3 files changed, 135 insertions(+), 12 deletions(-) diff --git a/libs/kdbtext/columnblob.cpp b/libs/kdbtext/columnblob.cpp index 2202752a7..80ee8eaf6 100644 --- a/libs/kdbtext/columnblob.cpp +++ b/libs/kdbtext/columnblob.cpp @@ -27,6 +27,7 @@ #include "columnblob.hpp" #include +#include using namespace KDBText; using namespace std; @@ -37,7 +38,7 @@ using namespace std; */ static rc_t KTextColumnBlobWhack ( KColumnBlob *self ); -// static rc_t CC KTextColumnBlobRead ( const KColumnBlob *self, size_t offset, void *buffer, size_t bsize, size_t *num_read, size_t *remaining ); +static rc_t CC KTextColumnBlobRead ( const KColumnBlob *self, size_t offset, void *buffer, size_t bsize, size_t *num_read, size_t *remaining ); // static rc_t CC KTextColumnBlobReadAll ( const KColumnBlob * self, KDataBuffer * buffer, KColumnBlobCSData * opt_cs_data, size_t cs_data_size ); // static rc_t CC KTextColumnBlobValidate ( const KColumnBlob *self ); // static rc_t CC KTextColumnBlobValidateBuffer ( const KColumnBlob * self, const KDataBuffer * buffer, const KColumnBlobCSData * cs_data, size_t cs_data_size ); @@ -49,7 +50,7 @@ static KColumnBlob_vt KTextColumnBlob_vt = KTextColumnBlobWhack, KColumnBlobBaseAddRef, KColumnBlobBaseRelease, - // KTextColumnBlobRead, + KTextColumnBlobRead, // KTextColumnBlobReadAll, // KTextColumnBlobValidate, // KTextColumnBlobValidateBuffer, @@ -59,6 +60,11 @@ static KColumnBlob_vt KTextColumnBlob_vt = #define CAST() assert( bself->vt == &KTextColumnBlob_vt ); ColumnBlob * self = (ColumnBlob *)bself ColumnBlob::ColumnBlob( const void * data, size_t size, const Column * col, int64_t id, uint64_t count ) +: m_data ( data ), + m_size( size ), + m_parent( col ), + m_firstRow( id ), + m_count( count ) { dad . vt = & KTextColumnBlob_vt; KRefcountInit ( & dad . refcount, 1, "KDBText::ColumnBlob", "ctor", "db" ); @@ -75,5 +81,36 @@ static rc_t KTextColumnBlobWhack ( KColumnBlob *bself ) { - return KColumnBlobBaseWhack ( bself ); + CAST(); + + delete reinterpret_cast( self ); + return 0; +} + +static +rc_t CC +KTextColumnBlobRead ( const KColumnBlob *bself, size_t offset, void *buffer, size_t bsize, size_t *num_read, size_t *remaining ) +{ + CAST(); + + rc_t rc = 0; + if ( buffer == NULL ) + { + rc = SILENT_RC ( rcDB, rcBlob, rcReading, rcBuffer, rcNull ); + } + else if ( num_read == nullptr ) + { + rc = SILENT_RC ( rcDB, rcBlob, rcReading, rcParam, rcNull ); + } + else if ( offset > self -> getSize() ) + { + rc = SILENT_RC ( rcDB, rcBlob, rcReading, rcParam, rcExcessive ); + } + else + { + *num_read = self -> getSize() - offset; + memcpy( buffer, (const char*)(self -> getData()) + offset, *num_read ); + } + + return rc; } diff --git a/libs/kdbtext/columnblob.hpp b/libs/kdbtext/columnblob.hpp index 5c731618d..8ab29b8c0 100644 --- a/libs/kdbtext/columnblob.hpp +++ b/libs/kdbtext/columnblob.hpp @@ -48,8 +48,12 @@ namespace KDBText ColumnBlob( const void * data, size_t size, const Column * col, int64_t id, uint64_t count ); ~ColumnBlob(); + const void * getData() const { return m_data; } + const size_t getSize() const { return m_size; } + private: - const void * data = nullptr; + const void * m_data = nullptr; + size_t m_size = 0; const Column * m_parent = nullptr; int64_t m_firstRow = 0; uint64_t m_count = 0; diff --git a/test/kdbtext/test-blob.cpp b/test/kdbtext/test-blob.cpp index 729bf9ae4..6aa03ed8e 100644 --- a/test/kdbtext/test-blob.cpp +++ b/test/kdbtext/test-blob.cpp @@ -37,13 +37,7 @@ using namespace KDBText; TEST_SUITE(KTextColumnBlobTestSuite); -const char * TestColumn = R"({"name":"col", - "type":"ascii", - "data": - [ - {"row":1,"value":"AGCT"}, - {"row":2,"value":"AGCT"} - ]})"; +const string Data = "0123456789"; class KTextColumnBlob_Fixture { @@ -56,7 +50,7 @@ class KTextColumnBlob_Fixture delete m_blob; } - void Setup( const string & data = "abcdef" ) + void Setup( const string & data = Data ) { m_blob = new ColumnBlob( data.c_str(), data.size(), nullptr, 1, 1 ); } @@ -65,10 +59,98 @@ class KTextColumnBlob_Fixture }; FIXTURE_TEST_CASE(KTextColumnBlob_Make_Empty, KTextColumnBlob_Fixture) +{ + Setup(""); + REQUIRE_EQ( string(), string( (const char*) (m_blob -> getData()), m_blob -> getSize() ) ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_Make_Data, KTextColumnBlob_Fixture) +{ + Setup( Data ); + REQUIRE_EQ( Data, string( (const char*) (m_blob -> getData()), m_blob -> getSize() ) ); +} + +class KTextColumnBlob_ApiFixture +{ +public: + KTextColumnBlob_ApiFixture() + { + } + ~KTextColumnBlob_ApiFixture() + { + KColumnBlobRelease( m_blob ); + } + void Setup( const string & data = "abcdef" ) + { + m_blob = (const KColumnBlob*)new ColumnBlob( data.c_str(), data.size(), nullptr, 1, 1 ); + } + + const KColumnBlob * m_blob = nullptr; +}; + +FIXTURE_TEST_CASE(KTextColumnBlob_AddRelease, KTextColumnBlob_ApiFixture) { Setup(); + + REQUIRE_RC( KColumnBlobAddRef( m_blob ) ); + REQUIRE_RC( KColumnBlobRelease( m_blob ) ); + // use valgrind to find any leaks } +FIXTURE_TEST_CASE(KTextColumnBlob_BufferNull, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + + size_t num_read = 0; + size_t remaining = 0; + REQUIRE_RC_FAIL( KColumnBlobRead ( m_blob, 0, nullptr, 0, &num_read, &remaining ) ); +} +FIXTURE_TEST_CASE(KTextColumnBlob_NumReadNull, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + + char buffer[1024] = {0}; + size_t remaining = 0; + REQUIRE_RC_FAIL( KColumnBlobRead ( m_blob, 0, buffer, sizeof buffer, nullptr, &remaining ) ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_Read_From_0, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + + char buffer[1024] = {0}; + size_t num_read = 0; + size_t remaining = 0; + REQUIRE_RC( KColumnBlobRead ( m_blob, 0, buffer, sizeof buffer, &num_read, &remaining ) ); + REQUIRE_EQ( Data, string(buffer, num_read ) ); + REQUIRE_EQ( (size_t)0, remaining ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_Read_From_Offset, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + + char buffer[1024] = {0}; + size_t num_read = 0; + size_t remaining = 0; + const size_t Offset = 3; + REQUIRE_RC( KColumnBlobRead ( m_blob, Offset, buffer, sizeof buffer, &num_read, &remaining ) ); + REQUIRE_EQ( Data.substr( Offset ), string(buffer, num_read ) ); + REQUIRE_EQ( (size_t)0, remaining ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_Read_Offset_BeyondData, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + + char buffer[1024] = {0}; + size_t num_read = 0; + REQUIRE_RC_FAIL( KColumnBlobRead ( m_blob, Data.size() + 1, buffer, sizeof buffer, &num_read, nullptr ) ); +} + +//FIXTURE_TEST_CASE(KTextColumnBlob_Read_BufferTooShort, KTextColumnBlob_ApiFixture) + + //////////////////////////////////////////// Main extern "C" { From e162e357b40f35f66cb360150d055e5388f60558 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Thu, 18 Jan 2024 14:56:31 -0500 Subject: [PATCH 33/42] VDB-5541 done --- libs/kdbtext/columnblob.cpp | 115 +++++++++++++++++++++++++--- libs/kdbtext/columnblob.hpp | 4 + test/kdbtext/test-blob.cpp | 147 ++++++++++++++++++++++++++++++++---- 3 files changed, 243 insertions(+), 23 deletions(-) diff --git a/libs/kdbtext/columnblob.cpp b/libs/kdbtext/columnblob.cpp index 80ee8eaf6..5c9ba4686 100644 --- a/libs/kdbtext/columnblob.cpp +++ b/libs/kdbtext/columnblob.cpp @@ -28,6 +28,7 @@ #include #include +#include using namespace KDBText; using namespace std; @@ -39,10 +40,10 @@ using namespace std; static rc_t KTextColumnBlobWhack ( KColumnBlob *self ); static rc_t CC KTextColumnBlobRead ( const KColumnBlob *self, size_t offset, void *buffer, size_t bsize, size_t *num_read, size_t *remaining ); -// static rc_t CC KTextColumnBlobReadAll ( const KColumnBlob * self, KDataBuffer * buffer, KColumnBlobCSData * opt_cs_data, size_t cs_data_size ); -// static rc_t CC KTextColumnBlobValidate ( const KColumnBlob *self ); -// static rc_t CC KTextColumnBlobValidateBuffer ( const KColumnBlob * self, const KDataBuffer * buffer, const KColumnBlobCSData * cs_data, size_t cs_data_size ); -// static rc_t CC KTextColumnBlobIdRange ( const KColumnBlob *self, int64_t *first, uint32_t *count ); +static rc_t CC KTextColumnBlobReadAll ( const KColumnBlob * self, KDataBuffer * buffer, KColumnBlobCSData * opt_cs_data, size_t cs_data_size ); +static rc_t CC KTextColumnBlobValidate ( const KColumnBlob *self ); +static rc_t CC KTextColumnBlobValidateBuffer ( const KColumnBlob * self, const KDataBuffer * buffer, const KColumnBlobCSData * cs_data, size_t cs_data_size ); +static rc_t CC KTextColumnBlobIdRange ( const KColumnBlob *self, int64_t *first, uint32_t *count ); static KColumnBlob_vt KTextColumnBlob_vt = { @@ -51,10 +52,10 @@ static KColumnBlob_vt KTextColumnBlob_vt = KColumnBlobBaseAddRef, KColumnBlobBaseRelease, KTextColumnBlobRead, - // KTextColumnBlobReadAll, - // KTextColumnBlobValidate, - // KTextColumnBlobValidateBuffer, - // KTextColumnBlobIdRange + KTextColumnBlobReadAll, + KTextColumnBlobValidate, + KTextColumnBlobValidateBuffer, + KTextColumnBlobIdRange }; #define CAST() assert( bself->vt == &KTextColumnBlob_vt ); ColumnBlob * self = (ColumnBlob *)bself @@ -108,9 +109,103 @@ KTextColumnBlobRead ( const KColumnBlob *bself, size_t offset, void *buffer, siz } else { - *num_read = self -> getSize() - offset; - memcpy( buffer, (const char*)(self -> getData()) + offset, *num_read ); + size_t toRead = self -> getSize() - offset; + if ( toRead > bsize ) + { + * remaining = toRead - bsize; + toRead -= *remaining; + } + else + { + * remaining = 0; + } + memcpy( buffer, (const char*)(self -> getData()) + offset, toRead ); + *num_read = toRead; } return rc; } + +static +rc_t CC +KTextColumnBlobReadAll ( const KColumnBlob * bself, KDataBuffer * buffer, KColumnBlobCSData * opt_cs_data, size_t cs_data_size ) +{ + CAST(); + + if ( opt_cs_data != NULL ) + { + memset ( opt_cs_data, 0, cs_data_size ); // we do not populate checksum here + } + + rc_t rc = 0; + if ( buffer == NULL ) + { + rc = SILENT_RC ( rcDB, rcBlob, rcReading, rcParam, rcNull ); + } + else + { + rc = KDataBufferMakeBytes ( buffer, self->getSize() ); + if ( rc == 0 && self->getSize() > 0 ) + { + memcpy( buffer -> base, self -> getData(), self->getSize() ); + } + } + + return rc; +} + +static +rc_t CC +KTextColumnBlobValidate ( const KColumnBlob *self ) +{ + return 0; +} + +static +rc_t CC +KTextColumnBlobValidateBuffer ( const KColumnBlob * bself, const KDataBuffer * buffer, const KColumnBlobCSData * cs_data, size_t cs_data_size ) +{ + CAST(); + + if ( buffer == NULL ) + { + return SILENT_RC ( rcDB, rcBlob, rcValidating, rcParam, rcNull ); + } + if ( cs_data == NULL ) + { + return SILENT_RC ( rcDB, rcBlob, rcValidating, rcParam, rcNull ); + } + + // check the buffer's size + size_t bsize = KDataBufferBytes ( buffer ); + if ( bsize < self -> getSize() ) + { + return SILENT_RC ( rcDB, rcBlob, rcValidating, rcData, rcInsufficient ); + } + if ( bsize > self -> getSize() ) + { + return SILENT_RC ( rcDB, rcBlob, rcValidating, rcData, rcExcessive ); + } + + return 0; +} + +static +rc_t CC +KTextColumnBlobIdRange ( const KColumnBlob * bself, int64_t *first, uint32_t *count ) +{ + CAST(); + + if ( first == NULL ) + { + return SILENT_RC ( rcDB, rcBlob, rcAccessing, rcParam, rcNull ); + } + if ( count == NULL ) + { + return SILENT_RC ( rcDB, rcBlob, rcAccessing, rcParam, rcNull ); + } + + *first = self->getIdRange().first; + *count = self->getIdRange().second; + return 0; +} diff --git a/libs/kdbtext/columnblob.hpp b/libs/kdbtext/columnblob.hpp index 8ab29b8c0..6118c4c6b 100644 --- a/libs/kdbtext/columnblob.hpp +++ b/libs/kdbtext/columnblob.hpp @@ -28,6 +28,8 @@ #include "../libs/kdb/columnblob-base.h" +#include + typedef struct KTextBlob KTextBlob; struct KTextBlob { @@ -51,6 +53,8 @@ namespace KDBText const void * getData() const { return m_data; } const size_t getSize() const { return m_size; } + std::pair< int64_t, uint32_t > getIdRange() const{ return std::make_pair( m_firstRow, m_count ); } + private: const void * m_data = nullptr; size_t m_size = 0; diff --git a/test/kdbtext/test-blob.cpp b/test/kdbtext/test-blob.cpp index 6aa03ed8e..a685d563d 100644 --- a/test/kdbtext/test-blob.cpp +++ b/test/kdbtext/test-blob.cpp @@ -32,6 +32,9 @@ #include "../../libs/kdbtext/columnblob.hpp" +#include +#include + using namespace std; using namespace KDBText; @@ -52,7 +55,7 @@ class KTextColumnBlob_Fixture void Setup( const string & data = Data ) { - m_blob = new ColumnBlob( data.c_str(), data.size(), nullptr, 1, 1 ); + m_blob = new ColumnBlob( data.c_str(), data.size(), nullptr, 1, 2 ); } ColumnBlob * m_blob = nullptr; @@ -70,22 +73,34 @@ FIXTURE_TEST_CASE(KTextColumnBlob_Make_Data, KTextColumnBlob_Fixture) REQUIRE_EQ( Data, string( (const char*) (m_blob -> getData()), m_blob -> getSize() ) ); } +FIXTURE_TEST_CASE(KTextColumnBlob_GetIdRange, KTextColumnBlob_Fixture) +{ + Setup( Data ); + REQUIRE_EQ( Data, string( (const char*) (m_blob -> getData()), m_blob -> getSize() ) ); + REQUIRE_EQ( (int64_t)1, m_blob -> getIdRange().first ); + REQUIRE_EQ( (uint32_t)2, m_blob -> getIdRange().second ); +} + class KTextColumnBlob_ApiFixture { public: KTextColumnBlob_ApiFixture() { + KDataBufferMakeBytes( & m_buffer, 0 ); } ~KTextColumnBlob_ApiFixture() { + KDataBufferWhack( & m_buffer ); KColumnBlobRelease( m_blob ); } void Setup( const string & data = "abcdef" ) { - m_blob = (const KColumnBlob*)new ColumnBlob( data.c_str(), data.size(), nullptr, 1, 1 ); + m_blob = (const KColumnBlob*)new ColumnBlob( data.c_str(), data.size(), nullptr, 1, 2 ); } const KColumnBlob * m_blob = nullptr; + + KDataBuffer m_buffer; }; FIXTURE_TEST_CASE(KTextColumnBlob_AddRelease, KTextColumnBlob_ApiFixture) @@ -109,20 +124,20 @@ FIXTURE_TEST_CASE(KTextColumnBlob_NumReadNull, KTextColumnBlob_ApiFixture) { Setup( Data ); - char buffer[1024] = {0}; + char data[1024] = {0}; size_t remaining = 0; - REQUIRE_RC_FAIL( KColumnBlobRead ( m_blob, 0, buffer, sizeof buffer, nullptr, &remaining ) ); + REQUIRE_RC_FAIL( KColumnBlobRead ( m_blob, 0, data, sizeof data, nullptr, &remaining ) ); } FIXTURE_TEST_CASE(KTextColumnBlob_Read_From_0, KTextColumnBlob_ApiFixture) { Setup( Data ); - char buffer[1024] = {0}; + char data[1024] = {0}; size_t num_read = 0; size_t remaining = 0; - REQUIRE_RC( KColumnBlobRead ( m_blob, 0, buffer, sizeof buffer, &num_read, &remaining ) ); - REQUIRE_EQ( Data, string(buffer, num_read ) ); + REQUIRE_RC( KColumnBlobRead ( m_blob, 0, data, sizeof data, &num_read, &remaining ) ); + REQUIRE_EQ( Data, string(data, num_read ) ); REQUIRE_EQ( (size_t)0, remaining ); } @@ -130,12 +145,12 @@ FIXTURE_TEST_CASE(KTextColumnBlob_Read_From_Offset, KTextColumnBlob_ApiFixture) { Setup( Data ); - char buffer[1024] = {0}; + char data[1024] = {0}; size_t num_read = 0; size_t remaining = 0; const size_t Offset = 3; - REQUIRE_RC( KColumnBlobRead ( m_blob, Offset, buffer, sizeof buffer, &num_read, &remaining ) ); - REQUIRE_EQ( Data.substr( Offset ), string(buffer, num_read ) ); + REQUIRE_RC( KColumnBlobRead ( m_blob, Offset, data, sizeof data, &num_read, &remaining ) ); + REQUIRE_EQ( Data.substr( Offset ), string(data, num_read ) ); REQUIRE_EQ( (size_t)0, remaining ); } @@ -143,13 +158,119 @@ FIXTURE_TEST_CASE(KTextColumnBlob_Read_Offset_BeyondData, KTextColumnBlob_ApiFix { Setup( Data ); - char buffer[1024] = {0}; + char data[1024] = {0}; size_t num_read = 0; - REQUIRE_RC_FAIL( KColumnBlobRead ( m_blob, Data.size() + 1, buffer, sizeof buffer, &num_read, nullptr ) ); + REQUIRE_RC_FAIL( KColumnBlobRead ( m_blob, Data.size() + 1, data, sizeof data, &num_read, nullptr ) ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_Read_BufferTooShort, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + char data[4] = {0}; + size_t num_read = 0; + size_t remaining = 0; + REQUIRE_RC( KColumnBlobRead ( m_blob, 0, data, sizeof data, &num_read, &remaining ) ); + REQUIRE_EQ( sizeof data, num_read ); + REQUIRE_EQ( Data.size() - num_read, remaining ); + REQUIRE_EQ( Data.substr( 0, num_read ), string(data, num_read ) ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_ReadAll_BufferNull, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + REQUIRE_RC_FAIL( KColumnBlobReadAll ( m_blob, nullptr, nullptr, 0 ) ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_ReadAll_NoCS, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + REQUIRE_RC( KColumnBlobReadAll ( m_blob, & m_buffer, nullptr, 0 ) ); + REQUIRE_EQ( Data, string( (const char*)m_buffer.base, m_buffer.elem_count ) ); } -//FIXTURE_TEST_CASE(KTextColumnBlob_Read_BufferTooShort, KTextColumnBlob_ApiFixture) +FIXTURE_TEST_CASE(KTextColumnBlob_ReadAll_WithCS, KTextColumnBlob_ApiFixture) +{ // checksum data is set to all 0s + Setup( Data ); + KColumnBlobCSData cs0; + memset ( & cs0, 0, sizeof( KColumnBlobCSData ) ); + KColumnBlobCSData cs; + memset ( & cs, 1, sizeof( KColumnBlobCSData ) ); + + REQUIRE_RC( KColumnBlobReadAll ( m_blob, & m_buffer, & cs, sizeof( KColumnBlobCSData ) ) ); + REQUIRE_EQ( Data, string( (const char*)m_buffer.base, m_buffer.elem_count ) ); + REQUIRE_EQ( 0, memcmp( & cs0, & cs, sizeof( KColumnBlobCSData ) ) ); +} + +// always succeeds +FIXTURE_TEST_CASE(KTextColumnBlob_Validate, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + REQUIRE_RC( KColumnBlobValidate ( m_blob ) ); +} + +// only checks size +FIXTURE_TEST_CASE(KTextColumnBlob_ValidateBuffer_BufferNull, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + + KColumnBlobCSData cs; + REQUIRE_RC_FAIL( KColumnBlobValidateBuffer ( m_blob, nullptr, &cs, 0 ) ); +} +FIXTURE_TEST_CASE(KTextColumnBlob_ValidateBuffer_CsNull, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + REQUIRE_RC_FAIL( KColumnBlobValidateBuffer ( m_blob, &m_buffer, nullptr, 0 ) ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_ValidateBuffer_SizeUnder, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + KDataBufferMakeBytes( & m_buffer, Data.size() - 1 ) ; + KColumnBlobCSData cs; + + REQUIRE_RC_FAIL( KColumnBlobValidateBuffer ( m_blob, &m_buffer, &cs, 0 ) ); +} +FIXTURE_TEST_CASE(KTextColumnBlob_ValidateBuffer_SizeOver, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + KDataBufferMakeBytes( & m_buffer, Data.size() + 1 ) ; + KColumnBlobCSData cs; + + REQUIRE_RC_FAIL( KColumnBlobValidateBuffer ( m_blob, &m_buffer, &cs, 0 ) ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_ValidateBuffer, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + KDataBufferMakeBytes( & m_buffer, Data.size() ) ; + KColumnBlobCSData cs; + + REQUIRE_RC( KColumnBlobValidateBuffer ( m_blob, &m_buffer, &cs, 0 ) ); +} + +FIXTURE_TEST_CASE(KTextColumnBlob_IdRange_FirstNull, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + uint32_t count; + REQUIRE_RC_FAIL( KColumnBlobIdRange ( m_blob, nullptr, &count ) ); +} +FIXTURE_TEST_CASE(KTextColumnBlob_IdRange_CountNull, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + int64_t first; + REQUIRE_RC_FAIL( KColumnBlobIdRange ( m_blob, &first, nullptr ) ); +} +FIXTURE_TEST_CASE(KTextColumnBlob_IdRange, KTextColumnBlob_ApiFixture) +{ + Setup( Data ); + int64_t first = 0; + uint32_t count = 0; + REQUIRE_RC( KColumnBlobIdRange ( m_blob, &first, &count ) ); + REQUIRE_EQ( (int64_t)1, first ); + REQUIRE_EQ( (uint32_t)2, count ); +} +//KTextColumnBlobIdRange ( const KColumnBlob *self, int64_t *first, uint32_t *count ); //////////////////////////////////////////// Main extern "C" From 6c32b59587e88ca4329961e9a3bd0a502dbfaa2f Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 19 Jan 2024 09:07:42 -0500 Subject: [PATCH 34/42] fixing Windows --- libs/kdbtext/api-manager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/kdbtext/api-manager.cpp b/libs/kdbtext/api-manager.cpp index 1491848f2..8ebddbf0f 100644 --- a/libs/kdbtext/api-manager.cpp +++ b/libs/kdbtext/api-manager.cpp @@ -285,7 +285,6 @@ KTextManagerVPathOpenRemoteDBRead ( struct KDBManager const * self, struct KData return SILENT_RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid); } -LIB_EXPORT rc_t CC KDBManagerMakeText ( const KDBManager ** p_mgr, const char * input, char * error, size_t error_size ) { From e58abdb03fbd190a2e1723a7032d73ff20398ae6 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 19 Jan 2024 13:48:20 -0500 Subject: [PATCH 35/42] removing a call to memcpy --- libs/kdbtext/columnblob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/kdbtext/columnblob.cpp b/libs/kdbtext/columnblob.cpp index 5c9ba4686..5cb4b6d96 100644 --- a/libs/kdbtext/columnblob.cpp +++ b/libs/kdbtext/columnblob.cpp @@ -147,7 +147,7 @@ KTextColumnBlobReadAll ( const KColumnBlob * bself, KDataBuffer * buffer, KColum rc = KDataBufferMakeBytes ( buffer, self->getSize() ); if ( rc == 0 && self->getSize() > 0 ) { - memcpy( buffer -> base, self -> getData(), self->getSize() ); + memmove( buffer -> base, self -> getData(), self->getSize() ); } } From 963e4c970e94c7ba2c9e0b5a162700f7a056ad26 Mon Sep 17 00:00:00 2001 From: aboshkin Date: Fri, 19 Jan 2024 15:08:14 -0500 Subject: [PATCH 36/42] removed another memcpy --- libs/kdbtext/columnblob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/kdbtext/columnblob.cpp b/libs/kdbtext/columnblob.cpp index 5cb4b6d96..dc61bcfd1 100644 --- a/libs/kdbtext/columnblob.cpp +++ b/libs/kdbtext/columnblob.cpp @@ -119,7 +119,7 @@ KTextColumnBlobRead ( const KColumnBlob *bself, size_t offset, void *buffer, siz { * remaining = 0; } - memcpy( buffer, (const char*)(self -> getData()) + offset, toRead ); + memmove( buffer, (const char*)(self -> getData()) + offset, toRead ); *num_read = toRead; } From 7a3e51dbecd9175ef5550e94342084d3dec4083b Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Wed, 24 Jan 2024 11:28:34 -0500 Subject: [PATCH 37/42] VDB-5535: VdbBlast2naReaderData() can return incomplete Packed2naRead array when status == eVdbBlastNoErr or eVdbBlastCircularSequence --- libs/blast/reference.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/blast/reference.c b/libs/blast/reference.c index 66fe71729..066b01941 100644 --- a/libs/blast/reference.c +++ b/libs/blast/reference.c @@ -1193,6 +1193,9 @@ static uint32_t _ReferencesData2na(References *self, ++self->read_id; } ++num_read; + + if (*status == eVdbBlastNoErr || *status == eVdbBlastCircularSequence) + break; } return num_read; } From 03bd83d24438aff9d8600927a4a884bd1e564b93 Mon Sep 17 00:00:00 2001 From: Kenneth Durbrow Date: Thu, 25 Jan 2024 13:25:58 -0500 Subject: [PATCH 38/42] Return non-zero RC when there are no checksums --- libs/kdb/rcolumnblob.c | 60 ++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/libs/kdb/rcolumnblob.c b/libs/kdb/rcolumnblob.c index 038fa19eb..34b74eb46 100644 --- a/libs/kdb/rcolumnblob.c +++ b/libs/kdb/rcolumnblob.c @@ -177,7 +177,7 @@ KRColumnBlobIdRange ( const KColumnBlob *bself, int64_t *first, uint32_t *count * runs checksum validation on unmodified blob */ static -rc_t KColumnBlobValidateCRC32 ( const KRColumnBlob *self ) +rc_t validateCRC32 ( const KRColumnBlob *self ) { rc_t rc; const KRColumn *col = self -> col; @@ -222,7 +222,7 @@ rc_t KColumnBlobValidateCRC32 ( const KRColumnBlob *self ) } static -rc_t KColumnBlobValidateMD5 ( const KRColumnBlob *self ) +rc_t validateMD5 ( const KRColumnBlob *self ) { rc_t rc; const KRColumn *col = self -> col; @@ -274,15 +274,21 @@ rc_t CC KRColumnBlobValidate ( const KColumnBlob *bself ) { CAST(); - if ( self -> loc . u . blob . size != 0 ) switch ( self -> col -> checksum ) + + if ( self -> loc . u . blob . size == 0 ) + return 0; + + switch ( self -> col -> checksum ) { case kcsCRC32: - return KColumnBlobValidateCRC32 ( self ); + return validateCRC32 ( self ); case kcsMD5: - return KColumnBlobValidateMD5 ( self ); + return validateMD5 ( self ); + case kcsNone: + return SILENT_RC ( rcDB, rcBlob, rcValidating, rcChecksum, rcNotFound ); + default: + return RC ( rcDB, rcBlob, rcValidating, rcType, rcUnexpected ); } - - return 0; } /* ValidateBuffer @@ -293,34 +299,24 @@ KRColumnBlobValidate ( const KColumnBlob *bself ) * "cs_data" [ IN ] and "cs_data_size" [ IN ] - returned checksum data from ReadAll */ static -rc_t KColumnBlobValidateBufferCRC32 ( const void * buffer, size_t size, uint32_t cs ) +rc_t validateBufferCRC32 ( const void * buffer, size_t size, uint32_t cs ) { - uint32_t crc32 = CRC32 ( 0, buffer, size ); - - if ( cs != crc32 ) - return RC ( rcDB, rcBlob, rcValidating, rcBlob, rcCorrupt ); - - return 0; + uint32_t const crc32 = CRC32 ( 0, buffer, size ); + + return cs == crc32 ? 0 : RC ( rcDB, rcBlob, rcValidating, rcBlob, rcCorrupt ); } static -rc_t KColumnBlobValidateBufferMD5 ( const void * buffer, size_t size, const uint8_t cs [ 16 ] ) +rc_t validateBufferMD5 ( const void * buffer, size_t size, const uint8_t cs [ 16 ] ) { - MD5State md5; uint8_t digest [ 16 ]; + MD5State md5; MD5StateInit ( & md5 ); - - /* calculate checksum */ MD5StateAppend ( & md5, buffer, size ); - - /* finish MD5 digest */ MD5StateFinish ( & md5, digest ); - if ( memcmp ( cs, digest, sizeof digest ) != 0 ) - return RC ( rcDB, rcBlob, rcValidating, rcBlob, rcCorrupt ); - - return 0; + return memcmp ( cs, digest, sizeof digest ) == 0 ? 0 : RC ( rcDB, rcBlob, rcValidating, rcBlob, rcCorrupt ); } static @@ -340,19 +336,21 @@ KRColumnBlobValidateBuffer ( const KColumnBlob * bself, return RC ( rcDB, rcBlob, rcValidating, rcData, rcInsufficient ); if ( bsize > self -> loc . u . blob . size ) return RC ( rcDB, rcBlob, rcValidating, rcData, rcExcessive ); + if ( bsize == 0 ) + return 0; - if ( bsize != 0 ) switch ( self -> col -> checksum ) + switch ( self -> col -> checksum ) { - case kcsNone: - break; case kcsCRC32: - return KColumnBlobValidateBufferCRC32 ( buffer -> base, bsize, + return validateBufferCRC32 ( buffer -> base, bsize, self -> bswap ? bswap_32 ( cs_data -> crc32 ) : cs_data -> crc32 ); case kcsMD5: - return KColumnBlobValidateBufferMD5 ( buffer -> base, bsize, cs_data -> md5_digest ); + return validateBufferMD5 ( buffer -> base, bsize, cs_data -> md5_digest ); + case kcsNone: + return SILENT_RC ( rcDB, rcBlob, rcValidating, rcChecksum, rcNotFound ); + default: + return RC ( rcDB, rcBlob, rcValidating, rcType, rcUnexpected ); } - - return 0; } From 2e3bab65b5192ce54b6594f08f863d9a8cb5d325 Mon Sep 17 00:00:00 2001 From: Kenneth Durbrow Date: Thu, 25 Jan 2024 13:26:46 -0500 Subject: [PATCH 39/42] notify validator about missing checksums --- interfaces/kdb/consistency-check.h | 3 +-- libs/kdb/column-cc.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/interfaces/kdb/consistency-check.h b/interfaces/kdb/consistency-check.h index f77fa98cc..c794c8bda 100644 --- a/interfaces/kdb/consistency-check.h +++ b/interfaces/kdb/consistency-check.h @@ -89,7 +89,7 @@ struct CCReportInfoBlock { uint64_t start; uint64_t count; - + bool missingChecksum; } blob; struct ccrb_index_s @@ -99,7 +99,6 @@ struct CCReportInfoBlock uint64_t num_keys; uint64_t num_rows; uint64_t num_holes; - } index; struct ccrb_visit_s { diff --git a/libs/kdb/column-cc.c b/libs/kdb/column-cc.c index d440e431d..bc45648d8 100644 --- a/libs/kdb/column-cc.c +++ b/libs/kdb/column-cc.c @@ -145,6 +145,7 @@ rc_t KColumnCheckBlobs(const KColumn *self, uint64_t row; uint64_t rows; rc_t rc; + uint64_t nMissingChecksum = 0; rc = KColumnIdRange(self, &start, &rows); if (rc) { @@ -157,6 +158,7 @@ rc_t KColumnCheckBlobs(const KColumn *self, const KColumnBlob *blob; int64_t first; uint32_t count; + bool missingChecksum = false; rc = KColumnOpenBlobRead(self, &blob, row + start); if (rc) { @@ -181,20 +183,27 @@ rc_t KColumnCheckBlobs(const KColumn *self, rc = KColumnBlobValidate(blob); KColumnBlobRelease(blob); if (rc) { - nfo->info.done.rc = rc; - nfo->info.done.mesg = "contains bad data"; - nfo->type = ccrpt_Done; - return report(nfo, ctx); + if (GetRCState(rc) == (int)rcNotFound && GetRCObject(rc) == (int)rcChecksum) { + missingChecksum = true; + nMissingChecksum += 1; + } + else { + nfo->type = ccrpt_Done; + nfo->info.done.rc = rc; + nfo->info.done.mesg = "contains bad data"; + return report(nfo, ctx); + } } nfo->type = ccrpt_Blob; nfo->info.blob.start = first; nfo->info.blob.count = count; + nfo->info.blob.missingChecksum = missingChecksum; rc = report(nfo, ctx); row += count; } nfo->info.done.rc = 0; - nfo->info.done.mesg = "checksums ok"; + nfo->info.done.mesg = nMissingChecksum == 0 ? "checksums ok" : "checksums missing"; nfo->type = ccrpt_Done; rc = report(nfo, ctx); return rc; From 4c04e3557766c20f858c274d26472d5580324ccf Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Fri, 2 Feb 2024 12:18:33 -0500 Subject: [PATCH 40/42] VDB-5572, SYS-486324: fixed infinite loop when data access is bad --- libs/kns/tls.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/kns/tls.c b/libs/kns/tls.c index 6f3b9827f..624939ac1 100644 --- a/libs/kns/tls.c +++ b/libs/kns/tls.c @@ -20,7 +20,7 @@ * * Please cite the author in any work or product based on this material. * -* =========================================================================== +* =============================================================================$ * */ @@ -1338,7 +1338,7 @@ rc_t ktls_handshake ( KTLSStream *self ) --e; } - while ( ret != 0 ) + for ( int i = 0; ret != 0; ) { if ( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE ) @@ -1391,6 +1391,11 @@ rc_t ktls_handshake ( KTLSStream *self ) return rc; } ret = mbedtls_ssl_handshake( &self -> ssl ); + if (ret == MBEDTLS_ERR_SSL_WANT_WRITE && i++ > 99) { + // possible infinite loop on Mac and Bsd + //LOGERR(klogInt, 0, "ret== MBEDTLS_ERR_SSL_WANT_WRITE"); + return RC(rcKrypto, rcSocket, rcOpening, rcConnection, rcFailed); + } } return 0; From fd82ad120416427c21bb0d317136e95a2c50aa39 Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Thu, 15 Feb 2024 17:18:30 -0500 Subject: [PATCH 41/42] VDB-5562: 3.1.0 release --- build/Makefile.vers | 2 +- interfaces/klib/vdb_release_version.h | 2 +- libs/blast/blast-mgr.c | 2 +- libs/kdb/libkdb.vers.h | 2 +- libs/klib/release-vers.h | 2 +- libs/ncbi-vdb/libncbi-vdb.vers | 2 +- libs/vdb/libvdb.vers.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build/Makefile.vers b/build/Makefile.vers index f0c2d4dd1..1aa826851 100644 --- a/build/Makefile.vers +++ b/build/Makefile.vers @@ -23,4 +23,4 @@ # =========================================================================== # NCBI-VDB and library version -VERSION = 3.0.11 +VERSION = 3.1.0 diff --git a/interfaces/klib/vdb_release_version.h b/interfaces/klib/vdb_release_version.h index 888f0bcdc..831e84a83 100644 --- a/interfaces/klib/vdb_release_version.h +++ b/interfaces/klib/vdb_release_version.h @@ -26,6 +26,6 @@ * ============================================================================== */ -#define VDB_RELEASE_VERSION 0x0300000B +#define VDB_RELEASE_VERSION 0x03010000 #endif /* _h_klib_vdb_release_version_ */ diff --git a/libs/blast/blast-mgr.c b/libs/blast/blast-mgr.c index 98dec331c..d22583d4d 100644 --- a/libs/blast/blast-mgr.c +++ b/libs/blast/blast-mgr.c @@ -50,7 +50,7 @@ #include /* fprintf */ #include /* memset */ -#define TOOLKIT "sratoolkit3_0_11" +#define TOOLKIT "sratoolkit3_1_0" /******************************************************************************/ diff --git a/libs/kdb/libkdb.vers.h b/libs/kdb/libkdb.vers.h index 321ec2e7f..e8a839f04 100644 --- a/libs/kdb/libkdb.vers.h +++ b/libs/kdb/libkdb.vers.h @@ -26,4 +26,4 @@ #pragma once -#define LIBKDB_VERS 0x0300000B +#define LIBKDB_VERS 0x03010000 diff --git a/libs/klib/release-vers.h b/libs/klib/release-vers.h index 8a1eaa4a6..842fe64f8 100644 --- a/libs/klib/release-vers.h +++ b/libs/klib/release-vers.h @@ -43,7 +43,7 @@ * 'c' - release candidate * 'r' - final */ -#define RELEASE_TYPE 'd' +#define RELEASE_TYPE 'r' /* Revision of Version of current SRA Toolkit Release */ #define RELEASE_REVISION 0 diff --git a/libs/ncbi-vdb/libncbi-vdb.vers b/libs/ncbi-vdb/libncbi-vdb.vers index 778bf95c0..fd2a01863 100644 --- a/libs/ncbi-vdb/libncbi-vdb.vers +++ b/libs/ncbi-vdb/libncbi-vdb.vers @@ -1 +1 @@ -3.0.11 +3.1.0 diff --git a/libs/vdb/libvdb.vers.h b/libs/vdb/libvdb.vers.h index c86dd9868..5eb0968a2 100644 --- a/libs/vdb/libvdb.vers.h +++ b/libs/vdb/libvdb.vers.h @@ -24,4 +24,4 @@ * */ -#define LIBVDB_VERS 0x0300000B +#define LIBVDB_VERS 0x03010000 From 3867b12dca94aa79e725b758997f9563a47a1ca0 Mon Sep 17 00:00:00 2001 From: Andrew Klymenko Date: Wed, 21 Feb 2024 19:42:35 -0500 Subject: [PATCH 42/42] VDB-5562: 3.1.0 release --- CHANGES.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index bc9a71147..88f1d9378 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,15 @@ # NCBI External Developer Release: +## NCBI VDB 3.1.0 +**March 5, 2024** + + **blast**: fixed VdbBlast2naReaderData() for ReferenceSet fills entire output array + **cloud, kns, ngs-tools, sra-tools**: don't change global network timeouts when checking cloud location + **kdb, kdbmeta, sra-tools**: removed confusing warning in Windows debug build + **kns, ngs-tools, sra-tools**: fixed hanging on Mac and BSD when data access is unreliable + + ## NCBI VDB 3.0.10 **December 19, 2023**