diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 99203655..f42b13b0 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -34,7 +34,7 @@ The info below often helps, please fill it out if you're able to. :) - [ ] Windows: ( _version:_ ___ ) - [ ] Linux: ( _distro:_ ___ ) -- [ ] Mac OS: ( _version:_ ___ ) +- [ ] macOS: ( _version:_ ___ ) - [ ] Other: ___ #### What is your DB4S version? diff --git a/.travis.yml b/.travis.yml index 91d2c4a8..5f49424b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ matrix: before_install: - sudo apt-get update -qq -- sudo apt-get --force-yes install build-essential git-core cmake libsqlite3-dev qt5-default qttools5-dev-tools libsqlcipher-dev qtbase5-dev libantlr-dev libqt5scintilla2-dev libqcustomplot-dev qttools5-dev +- sudo apt-get --force-yes install build-essential git-core cmake libsqlite3-dev qt5-default qttools5-dev-tools libsqlcipher-dev qtbase5-dev libqt5scintilla2-dev libqcustomplot-dev qttools5-dev install: diff --git a/BUILDING.md b/BUILDING.md index 6b673d34..7ab1f24a 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -55,7 +55,7 @@ The same process works for building the code in any platform supported by Qt ```bash $ sudo apt install build-essential git-core cmake libsqlite3-dev qt5-default qttools5-dev-tools \ - libsqlcipher-dev qtbase5-dev libantlr-dev libqt5scintilla2-dev libqcustomplot-dev qttools5-dev + libsqlcipher-dev qtbase5-dev libqt5scintilla2-dev libqcustomplot-dev qttools5-dev $ git clone https://github.com/sqlitebrowser/sqlitebrowser $ cd sqlitebrowser $ mkdir build @@ -77,7 +77,7 @@ Done. :) `qt5-qtbase-devel` in the `dnf install` line below. ``` -$ sudo dnf install ant-antlr antlr-C++ cmake gcc-c++ git qt-devel qt5-linguist qwt-qt5-devel \ +$ sudo dnf install cmake gcc-c++ git qt-devel qt5-linguist qwt-qt5-devel \ sqlite-devel $ git clone https://github.com/sqlitebrowser/sqlitebrowser $ cd sqlitebrowser @@ -93,7 +93,7 @@ This should complete without errors, and `sqlitebrowser` should now be launch-ab ```bash -$ zypper in -y build git-core, libQt5Core5, libQt5Core5-32bit, libqt5-qtbase, libqt5-qtbase-devel, libqt5-qttools, libqt5-qttools-devel, build, gcc-c++, gcc, sqlite3-devel, libsqlite3-0, cmake, antlr-devel, sqlcipher-devel +$ zypper in -y build git-core, libQt5Core5, libQt5Core5-32bit, libqt5-qtbase, libqt5-qtbase-devel, libqt5-qttools, libqt5-qttools-devel, build, gcc-c++, gcc, sqlite3-devel, libsqlite3-0, cmake, sqlcipher-devel $ git clone https://github.com/sqlitebrowser/sqlitebrowser $ cd sqlitebrowser $ mkdir build diff --git a/CMakeLists.txt b/CMakeLists.txt index ab0ba28e..d9bb712b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,6 @@ endif() set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}") OPTION(ENABLE_TESTING "Enable the unit tests" OFF) -OPTION(FORCE_INTERNAL_ANTLR "Don't use the distribution's Antlr library even if there is one" OFF) OPTION(FORCE_INTERNAL_QSCINTILLA "Don't use the distribution's QScintilla library even if there is one" OFF) OPTION(FORCE_INTERNAL_QCUSTOMPLOT "Don't use distribution's QCustomPlot even if available" ON) OPTION(FORCE_INTERNAL_QHEXEDIT "Don't use distribution's QHexEdit even if available" ON) @@ -45,7 +44,7 @@ if(WIN32 AND MSVC) if(CMAKE_CL_64) # Paths for 64-bit windows builds set(OPENSSL_PATH "C:/dev/OpenSSL-Win64" CACHE PATH "OpenSSL Path") - set(QT5_PATH "C:/dev/Qt/5.11.3/msvc2017_64" CACHE PATH "Qt5 Path") + set(QT5_PATH "C:/dev/Qt/5.12.6/msvc2017_64" CACHE PATH "Qt5 Path") # Choose between SQLCipher or SQLite, depending whether # -Dsqlcipher=1 is passed on the command line @@ -72,9 +71,6 @@ endif() find_package(Qt5 REQUIRED COMPONENTS Concurrent Gui LinguistTools Network PrintSupport Test Widgets Xml) -if(NOT FORCE_INTERNAL_ANTLR) - find_package(Antlr2 QUIET) -endif() if(NOT FORCE_INTERNAL_QSCINTILLA) find_package(QScintilla 2.8.10 QUIET) endif() @@ -90,10 +86,6 @@ else() endif() set(JSON_DIR libs/json) -if(NOT ANTLR2_FOUND) - set(ANTLR_DIR libs/antlr-2.7.7) - add_subdirectory(${ANTLR_DIR}) -endif() if(NOT QSCINTILLA_FOUND) set(QSCINTILLA_DIR libs/qscintilla/Qt4Qt5) add_subdirectory(${QSCINTILLA_DIR}) @@ -123,11 +115,12 @@ set(SQLB_HDR src/sql/ObjectIdentifier.h src/csvparser.h src/sqlite.h - src/grammar/sqlite3TokenTypes.hpp - src/grammar/Sqlite3Lexer.hpp - src/grammar/Sqlite3Parser.hpp src/Data.h src/IconCache.h + src/sql/parser/ParserDriver.h + src/sql/parser/sqlite3_lexer.h + src/sql/parser/sqlite3_location.h + src/sql/parser/sqlite3_parser.hpp ) set(SQLB_MOC_HDR @@ -175,6 +168,8 @@ set(SQLB_MOC_HDR src/CondFormat.h src/RunSql.h src/ProxyDialog.h + src/SelectItemsPopup.h + src/TableBrowser.h ) set(SQLB_SRC @@ -202,8 +197,6 @@ set(SQLB_SRC src/docktextedit.cpp src/csvparser.cpp src/DbStructureModel.cpp - src/grammar/Sqlite3Lexer.cpp - src/grammar/Sqlite3Parser.cpp src/main.cpp src/Application.cpp src/CipherDialog.cpp @@ -230,6 +223,11 @@ set(SQLB_SRC src/RunSql.cpp src/ProxyDialog.cpp src/IconCache.cpp + src/SelectItemsPopup.cpp + src/TableBrowser.cpp + src/sql/parser/ParserDriver.cpp + src/sql/parser/sqlite3_lexer.cpp + src/sql/parser/sqlite3_parser.cpp ) set(SQLB_FORMS @@ -254,6 +252,8 @@ set(SQLB_FORMS src/FileExtensionManager.ui src/CondFormatManager.ui src/ProxyDialog.ui + src/SelectItemsPopup.ui + src/TableBrowser.ui ) set(SQLB_RESOURCES @@ -265,7 +265,8 @@ set(SQLB_RESOURCES ) set(SQLB_MISC - src/grammar/sqlite3.g + src/sql/parser/sqlite3_parser.yy + src/sql/parser/sqlite3_lexer.ll ) # Translation files @@ -394,11 +395,6 @@ if(QCUSTOMPLOT_FOUND) else() include_directories(${QCUSTOMPLOT_DIR}) endif() -if(ANTLR2_FOUND) - include_directories(${ANTLR2_INCLUDE_DIRS}) -else() - include_directories(${ANTLR_DIR}) -endif() if(QSCINTILLA_FOUND) include_directories(${QSCINTILLA_INCLUDE_DIR}) else() @@ -429,9 +425,6 @@ endif() if(NOT QCUSTOMPLOT_FOUND) add_dependencies(${PROJECT_NAME} qcustomplot) endif() -if(NOT ANTLR2_FOUND) - add_dependencies(${PROJECT_NAME} antlr) -endif() if(NOT QSCINTILLA_FOUND) add_dependencies(${PROJECT_NAME} qscintilla2) endif() @@ -442,9 +435,6 @@ endif() if(NOT QCUSTOMPLOT_FOUND) link_directories("${CMAKE_CURRENT_BINARY_DIR}/${QCUSTOMPLOT_DIR}") endif() -if(NOT ANTLR2_FOUND) - link_directories("${CMAKE_CURRENT_BINARY_DIR}/${ANTLR_DIR}") -endif() if(NOT QSCINTILLA_FOUND) link_directories("${CMAKE_CURRENT_BINARY_DIR}/${QSCINTILLA_DIR}") endif() @@ -467,11 +457,6 @@ if(QCUSTOMPLOT_FOUND) else() target_link_libraries(${PROJECT_NAME} qcustomplot) endif() -if(ANTLR2_FOUND) - target_link_libraries(${PROJECT_NAME} ${ANTLR2_LIBRARIES}) -else() - target_link_libraries(${PROJECT_NAME} antlr) -endif() if(QSCINTILLA_FOUND) target_link_libraries(${PROJECT_NAME} ${QSCINTILLA_LIBRARIES}) else() diff --git a/cmake/FindAntlr2.cmake b/cmake/FindAntlr2.cmake deleted file mode 100644 index 871b3221..00000000 --- a/cmake/FindAntlr2.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# - try to find Antlr v2 -# Once done this will define: -# -# ANTLR2_FOUND - system has antlr2 -# ANTLR2_INCLUDE_DIRS - the include directories for antlr2 -# ANTLR2_LIBRARIES - Link these to use antl2 -# ANTLR2_EXECUTABLE - The 'antlr' or 'runantlr' executable - -# Copyright (C) 2015, Pino Toscano, -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -find_library(ANTLR2_LIBRARY antlr) -set(ANTLR2_LIBRARIES "${ANTLR2_LIBRARY}") - -find_path(ANTLR2_INCLUDE_DIR antlr/AST.hpp) -set(ANTLR2_INCLUDE_DIRS "${ANTLR2_INCLUDE_DIR}") - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Antlr2 DEFAULT_MSG ANTLR2_LIBRARIES ANTLR2_INCLUDE_DIRS) - -find_program(ANTLR2_EXECUTABLE NAMES runantlr runantlr2 antlr) - -mark_as_advanced( - ANTLR2_INCLUDE_DIRS - ANTLR2_LIBRARIES - ANTLR2_EXECUTABLE -) diff --git a/distri/mime/packages/db4s-sqbpro.xml b/distri/mime/packages/db4s-sqbpro.xml new file mode 100644 index 00000000..013cb84a --- /dev/null +++ b/distri/mime/packages/db4s-sqbpro.xml @@ -0,0 +1,10 @@ + + + + DB Browser for SQLite project file + + + + + + diff --git a/distri/sqlitebrowser.desktop b/distri/sqlitebrowser.desktop index 4844c950..749f2ef0 100644 --- a/distri/sqlitebrowser.desktop +++ b/distri/sqlitebrowser.desktop @@ -3,10 +3,11 @@ Name=DB Browser for SQLite Comment=DB Browser for SQLite is a light GUI editor for SQLite databases Comment[de]=DB Browser for SQLite ist ein GUI-Editor für SQLite-Datenbanken Comment[fr]=Un éditeur graphique léger pour les bases de données SQLite +Comment[es]=«DB Browser for SQLite» es un editor gráfico de bases de datos SQLite Exec=sqlitebrowser %f Icon=sqlitebrowser Terminal=false X-MultipleArgs=false Type=Application Categories=Development;Utility;Database; -MimeType=application/sqlitebrowser;application/x-sqlitebrowser;application/x-sqlite2;application/x-sqlite3; +MimeType=application/vnd.db4s-project+xml;application/sqlitebrowser;application/x-sqlitebrowser;application/vnd.sqlite3;application/geopackage+sqlite3;application/x-sqlite2;application/x-sqlite3; diff --git a/installer/windows/product.wxs b/installer/windows/product.wxs index ae346da7..f95b3493 100644 --- a/installer/windows/product.wxs +++ b/installer/windows/product.wxs @@ -70,7 +70,6 @@ - @@ -149,9 +148,6 @@ - - - diff --git a/installer/windows/translations.wxs b/installer/windows/translations.wxs index 6c85bec3..9bdff437 100644 --- a/installer/windows/translations.wxs +++ b/installer/windows/translations.wxs @@ -29,6 +29,19 @@ + + + + + + + + + + + + + @@ -48,7 +61,6 @@ - @@ -56,7 +68,6 @@ - @@ -64,7 +75,6 @@ - @@ -72,7 +82,6 @@ - @@ -80,7 +89,6 @@ - @@ -88,7 +96,6 @@ - @@ -96,7 +103,6 @@ - @@ -107,7 +113,6 @@ - @@ -117,7 +122,6 @@ - @@ -128,7 +132,6 @@ - @@ -138,6 +141,19 @@ + + + + + + + + + + + + + @@ -157,7 +173,6 @@ - @@ -165,7 +180,6 @@ - @@ -173,7 +187,6 @@ - @@ -181,7 +194,6 @@ - @@ -189,7 +201,6 @@ - @@ -197,7 +208,6 @@ - @@ -205,7 +215,6 @@ - @@ -216,7 +225,6 @@ - @@ -226,7 +234,6 @@ - @@ -237,7 +244,6 @@ - diff --git a/installer/windows/variables.wxi b/installer/windows/variables.wxi index 5d22a465..c5565054 100644 --- a/installer/windows/variables.wxi +++ b/installer/windows/variables.wxi @@ -55,7 +55,7 @@ --> - + diff --git a/libs/antlr-2.7.7/AUTHORS b/libs/antlr-2.7.7/AUTHORS deleted file mode 100644 index 7bdc4852..00000000 --- a/libs/antlr-2.7.7/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Author: - Peter Wells diff --git a/libs/antlr-2.7.7/CMakeLists.txt b/libs/antlr-2.7.7/CMakeLists.txt deleted file mode 100644 index aa460fcb..00000000 --- a/libs/antlr-2.7.7/CMakeLists.txt +++ /dev/null @@ -1,91 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(ANTLR_SRC - src/ANTLRUtil.cpp - src/ASTFactory.cpp - src/ASTNULLType.cpp - src/ASTRefCount.cpp - src/BaseAST.cpp - src/BitSet.cpp - src/CharBuffer.cpp - src/CharScanner.cpp - src/CommonAST.cpp - src/CommonASTWithHiddenTokens.cpp - src/CommonHiddenStreamToken.cpp - src/CommonToken.cpp - src/InputBuffer.cpp - src/LLkParser.cpp - src/MismatchedCharException.cpp - src/MismatchedTokenException.cpp - src/NoViableAltException.cpp - src/NoViableAltForCharException.cpp - src/Parser.cpp - src/RecognitionException.cpp - src/String.cpp - src/Token.cpp - src/TokenBuffer.cpp - src/TokenRefCount.cpp - src/TokenStreamBasicFilter.cpp - src/TokenStreamHiddenTokenFilter.cpp - src/TokenStreamRewriteEngine.cpp - src/TokenStreamSelector.cpp - src/TreeParser.cpp - ) - -set(ANTLR_HDR - antlr/ANTLRException.hpp - antlr/ANTLRUtil.hpp - antlr/AST.hpp - antlr/ASTArray.hpp - antlr/ASTFactory.hpp - antlr/ASTNULLType.hpp - antlr/ASTPair.hpp - antlr/ASTRefCount.hpp - antlr/BaseAST.hpp - antlr/BitSet.hpp - antlr/CharBuffer.hpp - antlr/CharInputBuffer.hpp - antlr/CharScanner.hpp - antlr/CharStreamException.hpp - antlr/CharStreamIOException.hpp - antlr/CircularQueue.hpp - antlr/CommonAST.hpp - antlr/CommonASTWithHiddenTokens.hpp - antlr/CommonHiddenStreamToken.hpp - antlr/CommonToken.hpp - antlr/IOException.hpp - antlr/InputBuffer.hpp - antlr/LLkParser.hpp - antlr/LexerSharedInputState.hpp - antlr/MismatchedCharException.hpp - antlr/MismatchedTokenException.hpp - antlr/NoViableAltException.hpp - antlr/NoViableAltForCharException.hpp - antlr/Parser.hpp - antlr/ParserSharedInputState.hpp - antlr/RecognitionException.hpp - antlr/RefCount.hpp - antlr/SemanticException.hpp - antlr/String.hpp - antlr/Token.hpp - antlr/TokenBuffer.hpp - antlr/TokenRefCount.hpp - antlr/TokenStream.hpp - antlr/TokenStreamBasicFilter.hpp - antlr/TokenStreamException.hpp - antlr/TokenStreamHiddenTokenFilter.hpp - antlr/TokenStreamIOException.hpp - antlr/TokenStreamRecognitionException.hpp - antlr/TokenStreamRetryException.hpp - antlr/TokenStreamRewriteEngine.hpp - antlr/TokenStreamSelector.hpp - antlr/TokenWithIndex.hpp - antlr/TreeParser.hpp - antlr/TreeParserSharedInputState.hpp - antlr/config.hpp - ) - -include_directories(.) - -add_library(antlr ${ANTLR_SRC} ${ANTLR_HDR}) - diff --git a/libs/antlr-2.7.7/LICENSE.txt b/libs/antlr-2.7.7/LICENSE.txt deleted file mode 100644 index 0ec09a95..00000000 --- a/libs/antlr-2.7.7/LICENSE.txt +++ /dev/null @@ -1,31 +0,0 @@ - -SOFTWARE RIGHTS - -ANTLR 1989-2006 Developed by Terence Parr -Partially supported by University of San Francisco & jGuru.com - -We reserve no legal rights to the ANTLR--it is fully in the -public domain. An individual or company may do whatever -they wish with source code distributed with ANTLR or the -code generated by ANTLR, including the incorporation of -ANTLR, or its output, into commerical software. - -We encourage users to develop software with ANTLR. However, -we do ask that credit is given to us for developing -ANTLR. By "credit", we mean that if you use ANTLR or -incorporate any source code into one of your programs -(commercial product, research project, or otherwise) that -you acknowledge this fact somewhere in the documentation, -research report, etc... If you like ANTLR and have -developed a nice tool with the output, please mention that -you developed it using ANTLR. In addition, we ask that the -headers remain intact in our source code. As long as these -guidelines are kept, we expect to continue enhancing this -system and expect to make other tools available as they are -completed. - -The primary ANTLR guy: - -Terence Parr -parrt@cs.usfca.edu -parrt@antlr.org diff --git a/libs/antlr-2.7.7/README b/libs/antlr-2.7.7/README deleted file mode 100644 index f6e6089d..00000000 --- a/libs/antlr-2.7.7/README +++ /dev/null @@ -1,191 +0,0 @@ -ANTLR C++ Support Libraries Additional Notes - -1.1 Using Microsoft Visual C++ - -Currently this is still (or again) somewhat experimental. MSVC is not the -development platform and I don't have access to the compiler currently. -YMMV - -Make sure you compile the library *and* your project with the same -settings. (multithreaded/debug/etc.) - -Visual C++ 6 only is supported for static builds. Some hacking and STLPort -is needed to build a DLL (only for experts). - -Visual C++ 7.0 and 7.1 should support both static and DLL builds (DLL -builds might be broken). In general the main problem is getting the right -template instantiations into the DLL. For 7.0 you might have to tweak the -list in lib/cpp/src/dll.cpp. I'm told 7.1 does not need this. - -For a static build (works probably best) - -1. Create a win32 static library project. -2. Enable RTTI. (Run Time Type Information) -3. Add the source files from /antlr/lib/cpp/src to the project - (except dll.cpp) put /antlr/lib/cpp in the search path for - include files. - -For the DLL build (MSVC 7.0 tested) - -* Project settings ("create new project" dialogs) - - Win32 project - - Application Settings - - Application type - - DLL - - Additional options - - Export symbols -* Project properties (change defaults to) - - Configuration Properties - - C/C++ - - General - - Additional Include Directories - - drive:\antlr-2.7.2\lib\cpp - - Preprocessor - - Preprocessor Definitions - - WIN32;_DEBUG;_WINDOWS;_USRDLL;ANTLR_EXPORTS - - Code Generation - - Runtime Library - - Multi-threaded Debug DLL (/MDd) - - Enable Function-Level Linking: - - Yes - - Language - - Enable Run-Time Type Info - - Yes - - Precompiled Headers - - Create/Use Precompiled Headers - -NOTE: Do not use the antlr generated and support library in a multithreaded -way. It was not designed for a multithreaded environment. - -1.3 Building with GCJ - -NOTE: outdated the new Makefiles do not support this anymore. - -It is also possible to build a native binary of ANTLR. This is somewhat -experimental and can be enabled by giving the --enable-gcj option to -configure. You need a recent GCC to do this and even then the constructed -binary crashes on some platforms. - -2. Tested Compilers for this release - -Don't get worried if your favourite compiler is not mentioned here. Any -somewhat recent ISO compliant C++ compiler should have little trouble with -the runtime library. - -*NOTE* this section was not updated for the new configure script/Makefiles some of the things listed here to pass different flags to configure may not work anymore. Check INSTALL.txt or handedit generated scripts after configure. - -2.1 Solaris - -2.1.1 Sun Workshop 6.0 - -Identifies itself as: - - CC: Sun WorkShop 6 2000/08/30 C++ 5.1 Patch 109490-01 - -Compiles out of the box configure using: - - CXX=CC CC=cc AR=CC ARFLAGS="-xar -o" ./configure - -Use CC to make the archive to ensure bundling of template instances. Check -manpage for details. - -2.1.2 GCC - -Tested 3.0.4, 3.2.1, 3.2.3, 3.3.2, 3.4.0. - -All tested gcc are using a recent GNU binutils for linker and assembler. -You will probably run into trouble if you use the solaris -linker/assembler. - -2.2 Windows - -2.2.1 Visual C++ - -Visual C++ 6.0 reported to work well with static build. DLL build not -supported (reported to work when using STLPort in previous ANTLR versions). -I heart that in some cases there could be problems with precompiled headers -and the use of normal '/' in the #include directives (with service pack 5). - -Visual C++ 7.0 reported to work, might need some tweaks for DLL builds due -to some shuffling around in the code. - -Visual C++ 7.1 reported to work, might need some tweaks, see above. - -My current guess is that DLL builds are all over the line broken. A -workaround is to make a DLL from the complete generated parser including -the static ANTLR support library. - -2.2.2 Cygwin/MinGW - -Not expecting any big problems maybe some tweaks needed in configure. - -3. Old notes for a number of compilers - -3.1 SGI Irix 6.5.10 MIPSPro compiler - -You can't compile ANTLR with the MIPSPro compiler on anything < 6.5.10 -because SGI just fixed a big bug dealing with namespaces in that release. - -Note: To get it to compile do basically the following: - - CC=cc CXX=CC CXXFLAGS=-LANG:std ./configure --prefix=/usr/local/antlr - -Note probably dates back to 2.7.0-2.7.1 era. - -3.2 Sun CC 5 - -It may be you'll have to change one or two static_cast()'s to a -C-style cast. (think that's a compiler bug) - -Configure using: - - CXX=CC CC=cc RANLIB="CC -xar" ./configure - -The custom ranlib is needed to get the template instances into the archive. -Check manpages. Maybe the Sun CC 6 instructions above will work as well. - -3.3 GCC on some platforms (Alpha Tru64) - -The -pipe option not supported it seems. Configure using: - -CFLAGS="-W -Wall" ./configure - -Or remove the -pipe's from the generated scripts/Config.make. - -4. IT DOESN'T WORK!? - -4.1 Compile problems - -The ANTLR code uses some relatively new features of C++ which not all -compilers support yet (such as namespaces, and new style standard headers). - -At the moment, you may be able to work around the problem with a few nasty -tricks: - -Try creating some header files like 'iostream' just containing: - -#include - -and compile with an option to define away the word 'std', such as - -CC .... -Dstd= .... - -Also in the antlr subdirectory there's a file config.hpp. Tweak this one to -enable/disable the different bells and whistles used in the rest of the code. -Don't forget to submit those changes back to us (along with compiler info) -so we can incorporate them in our next release! - -4.2 Reporting problems - -When reporting problems please try to be as specific as possible e.g. -mention ANTLR release, and try to provide a clear and minimal example of -what goes wrong and what you expected. - -Bug reports can be done to Terence or the current subsystem maintainers as -mentioned in the doc directory. Another option is to use the mailing list -linked from http://www.antlr.org. - -Before reporting a problem you might want to try with a development -snapshot, there is a link to these in the File Sharing section of - -http://www.antlr.org. diff --git a/libs/antlr-2.7.7/TODO b/libs/antlr-2.7.7/TODO deleted file mode 100644 index 693ec995..00000000 --- a/libs/antlr-2.7.7/TODO +++ /dev/null @@ -1,83 +0,0 @@ -* ANTLR should issue a warning if you have protected rules and - filter == true or filter=IGNORE in a lexer? - This can be tackled by tracking rule references in a more general approach. - -* Have a look at the doc's. - -* Add allocators to the objects - -* Look more at exception handling - -* TreeParser.cpp around line 76 the MismatchedTokenException here does not - use ttype to improve it's errormessage. Would require changing a bit in - MismatchedTokenException.cpp - -* On Thu, Sep 21, 2000 at 12:33:48AM -0700, John Lambert wrote: - > 1) The literal EOF is not defined and causes the define of EOF_CHAR in - > CharScanner.hpp to fail. - - ANTLR with STL Port. Changing the EOF define to char_traits::eof() - breaks things for gcc-2.95.2. Fix this in next release portably. - http://www.egroups.com/message/antlr-interest/2520 - -* Fix heterogeneous AST stuff. It boils down to adding a method to AST - types that knows how to duplicate the sucker. - -> done clone() added. - Knowing one factory is not enough. - -> done in C++ have a superfactory. - Also look at having to set the astfactory by hand (this is not 100% necessary). - Double check generated code. - http://groups.yahoo.com/group/antlr-interest/message/2496 - -* Look at messageLog stuff Ross Bencina proposed. Looks good at first glance. - http://www.egroups.com/message/antlr-interest/2555 - -* Add RW_STL & CC 4.2 patch from Ulrich Teichert: - See my mailbox.. and these comments from Ross Bencina: - http://www.egroups.com/message/antlr-interest/2494 - -* in action.g (java and C++) ##.initialize / ##->initialize is not - recognized as an assigment to the root node. In the case ## is followed - by ./-> initialize transInfo.assignToRoot should be set to true. - Report by Matthew Ford (12 march 2001) - -* Add TokenLabelType option for generated lexers. Hmmm can already set token - factory. Then again.. you may run into a cast fest.. - -* Fix some #line counting oddities (Mike Barnett) - > nonterm - > { - > ## = #([TOK,"TOK"], - > ... Other stuff ... - > ); - > f(); - > } - generates wrong #line info need to fix action.g a bit better. - -* This one triggers a bug in antlr's codegen. - #perform_action = #( create_tau_ast(#p1->getLine(),#p1->getColumn()), #p1 ); - - #p1 are replaced by p1 in stead of p1_AST. It's really time to rewrite this - mess. - - Workaround: - - RefModest_AST tau = create_tau_ast(#p1->getLine(),#p1->getColumn()); - #perform_action = #( tau, #p1 ); - -* Unicode and related. - - The patch from Jean-Daniel Fekete is an approach. But has some issues. - + It is probably necessary to discern an 'internal' string/char type and - 'external' ones. The external ones are for the lexer input. The - 'internal ones' are for standard antlr error messages etc. Translators - from external to internal should be provided. - Hmm on second thought.. probably not really an issue. - + What should the lexer read? - - Unicode units from a 'unicode reader' in a sense this unicode reader - is a lexer itself. Just reading iconv/iconv_open manpages.. Maybe we - can hide this with iconv in the InputBuffer mechanisms? - - Interpret unicode ourselves. Ugh don't want to think of that right now. - we probably redo something that has been done. Only problem is that we - need something that's portable (C++ case) - + What changes are necessary in the rest of the code to support a wide - character set? Think most should be handled in/below the lexer level. diff --git a/libs/antlr-2.7.7/antlr.pro b/libs/antlr-2.7.7/antlr.pro deleted file mode 100644 index b2430e3b..00000000 --- a/libs/antlr-2.7.7/antlr.pro +++ /dev/null @@ -1,89 +0,0 @@ -TEMPLATE = lib - -CONFIG += staticlib -CONFIG += debug_and_release - -INCLUDEPATH += ./ - -HEADERS += \ - antlr/config.hpp \ - antlr/TreeParserSharedInputState.hpp \ - antlr/TreeParser.hpp \ - antlr/TokenWithIndex.hpp \ - antlr/TokenStreamSelector.hpp \ - antlr/TokenStreamRewriteEngine.hpp \ - antlr/TokenStreamRetryException.hpp \ - antlr/TokenStreamRecognitionException.hpp \ - antlr/TokenStreamIOException.hpp \ - antlr/TokenStreamHiddenTokenFilter.hpp \ - antlr/TokenStreamException.hpp \ - antlr/TokenStreamBasicFilter.hpp \ - antlr/TokenStream.hpp \ - antlr/TokenRefCount.hpp \ - antlr/TokenBuffer.hpp \ - antlr/Token.hpp \ - antlr/String.hpp \ - antlr/SemanticException.hpp \ - antlr/RefCount.hpp \ - antlr/RecognitionException.hpp \ - antlr/ParserSharedInputState.hpp \ - antlr/Parser.hpp \ - antlr/NoViableAltForCharException.hpp \ - antlr/NoViableAltException.hpp \ - antlr/MismatchedTokenException.hpp \ - antlr/MismatchedCharException.hpp \ - antlr/LexerSharedInputState.hpp \ - antlr/LLkParser.hpp \ - antlr/InputBuffer.hpp \ - antlr/IOException.hpp \ - antlr/CommonToken.hpp \ - antlr/CommonHiddenStreamToken.hpp \ - antlr/CommonASTWithHiddenTokens.hpp \ - antlr/CommonAST.hpp \ - antlr/CircularQueue.hpp \ - antlr/CharStreamIOException.hpp \ - antlr/CharStreamException.hpp \ - antlr/CharScanner.hpp \ - antlr/CharInputBuffer.hpp \ - antlr/CharBuffer.hpp \ - antlr/BitSet.hpp \ - antlr/BaseAST.hpp \ - antlr/ASTRefCount.hpp \ - antlr/ASTPair.hpp \ - antlr/ASTNULLType.hpp \ - antlr/ASTFactory.hpp \ - antlr/ASTArray.hpp \ - antlr/AST.hpp \ - antlr/ANTLRUtil.hpp \ - antlr/ANTLRException.hpp - -SOURCES += \ - src/TreeParser.cpp \ - src/TokenStreamSelector.cpp \ - src/TokenStreamRewriteEngine.cpp \ - src/TokenStreamHiddenTokenFilter.cpp \ - src/TokenStreamBasicFilter.cpp \ - src/TokenRefCount.cpp \ - src/TokenBuffer.cpp \ - src/Token.cpp \ - src/String.cpp \ - src/RecognitionException.cpp \ - src/Parser.cpp \ - src/NoViableAltForCharException.cpp \ - src/NoViableAltException.cpp \ - src/MismatchedTokenException.cpp \ - src/MismatchedCharException.cpp \ - src/LLkParser.cpp \ - src/InputBuffer.cpp \ - src/CommonToken.cpp \ - src/CommonHiddenStreamToken.cpp \ - src/CommonASTWithHiddenTokens.cpp \ - src/CommonAST.cpp \ - src/CharScanner.cpp \ - src/CharBuffer.cpp \ - src/BitSet.cpp \ - src/BaseAST.cpp \ - src/ASTRefCount.cpp \ - src/ASTNULLType.cpp \ - src/ASTFactory.cpp \ - src/ANTLRUtil.cpp diff --git a/libs/antlr-2.7.7/antlr/ANTLRException.hpp b/libs/antlr-2.7.7/antlr/ANTLRException.hpp deleted file mode 100644 index 71327be9..00000000 --- a/libs/antlr-2.7.7/antlr/ANTLRException.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef INC_ANTLRException_hpp__ -#define INC_ANTLRException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ANTLRException.hpp#2 $ - */ - -#include -#ifdef __MINGW32__ -#include -#endif -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API ANTLRException -{ -public: - /// Create ANTLR base exception without error message - ANTLRException() : text("") - { - } - /// Create ANTLR base exception with error message - ANTLRException(const ANTLR_USE_NAMESPACE(std)string& s) - : text(s) - { - } - virtual ~ANTLRException() throw() - { - } - - /** Return complete error message with line/column number info (if present) - * @note for your own exceptions override this one. Call getMessage from - * here to get the 'clean' error message stored in the text attribute. - */ - virtual ANTLR_USE_NAMESPACE(std)string toString() const - { - return text; - } - - /** Return error message without additional info (if present) - * @note when making your own exceptions classes override toString - * and call in toString getMessage which relays the text attribute - * from here. - */ - virtual ANTLR_USE_NAMESPACE(std)string getMessage() const - { - return text; - } -private: - ANTLR_USE_NAMESPACE(std)string text; -}; -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ANTLRException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/ANTLRUtil.hpp b/libs/antlr-2.7.7/antlr/ANTLRUtil.hpp deleted file mode 100644 index eeb7d064..00000000 --- a/libs/antlr-2.7.7/antlr/ANTLRUtil.hpp +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef INC_ANTLRUtil_hpp__ -#define INC_ANTLRUtil_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Eat whitespace from the input stream - * @param is the stream to read from - */ -ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is ); - -/** Read a string enclosed by '"' from a stream. Also handles escaping of \". - * Skips leading whitespace. - * @param in the istream to read from. - * @returns the string read from file exclusive the '"' - * @throws ios_base::failure if string is badly formatted - */ -ANTLR_USE_NAMESPACE(std)string read_string( ANTLR_USE_NAMESPACE(std)istream& in ); - -/* Read a ([A-Z][0-9][a-z]_)* kindoff thing. Skips leading whitespace. - * @param in the istream to read from. - */ -ANTLR_USE_NAMESPACE(std)string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in ); - -/** Read a attribute="value" thing. Leading whitespace is skipped. - * Between attribute and '=' no whitespace is allowed. After the '=' it is - * permitted. - * @param in the istream to read from. - * @param attribute string the attribute name is put in - * @param value string the value of the attribute is put in - * @throws ios_base::failure if something is fishy. E.g. malformed quoting - * or missing '=' - */ -void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in, - ANTLR_USE_NAMESPACE(std)string& attribute, - ANTLR_USE_NAMESPACE(std)string& value ); - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif diff --git a/libs/antlr-2.7.7/antlr/AST.hpp b/libs/antlr-2.7.7/antlr/AST.hpp deleted file mode 100644 index c47be5fd..00000000 --- a/libs/antlr-2.7.7/antlr/AST.hpp +++ /dev/null @@ -1,166 +0,0 @@ -#ifndef INC_AST_hpp__ -#define INC_AST_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/AST.hpp#2 $ - */ - -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -struct ASTRef; - -class ANTLR_API AST { -public: - AST() : ref(0) {} - AST(const AST&) : ref(0) {} - virtual ~AST() {} - - /// Return the type name for this AST node. (for XML output) - virtual const char* typeName( void ) const = 0; - /// Clone this AST node. - virtual RefAST clone( void ) const = 0; - /// Is node t equal to this in terms of token type and text? - virtual bool equals(RefAST t) const = 0; - /** Is t an exact structural and equals() match of this tree. The - * 'this' reference is considered the start of a sibling list. - */ - virtual bool equalsList(RefAST t) const = 0; - - /** Is 't' a subtree of this list? The siblings of the root are NOT ignored. - */ - virtual bool equalsListPartial(RefAST t) const = 0; - /** Is tree rooted at 'this' equal to 't'? The siblings of 'this' are - * ignored. - */ - virtual bool equalsTree(RefAST t) const = 0; - /** Is 't' a subtree of the tree rooted at 'this'? The siblings of - * 'this' are ignored. - */ - virtual bool equalsTreePartial(RefAST t) const = 0; - - /** Walk the tree looking for all exact subtree matches. Return - * a vector of RefAST that lets the caller walk the list - * of subtree roots found herein. - */ - virtual ANTLR_USE_NAMESPACE(std)vector findAll(RefAST t) = 0; - - /** Walk the tree looking for all subtrees. Return - * a vector of RefAST that lets the caller walk the list - * of subtree roots found herein. - */ - virtual ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST t) = 0; - - /// Add a node to the end of the child list for this node - virtual void addChild(RefAST c) = 0; - /// Get the number of children. Returns 0 if the node is a leaf - virtual size_t getNumberOfChildren() const = 0; - - /// Get the first child of this node; null if no children - virtual RefAST getFirstChild() const = 0; - /// Get the next sibling in line after this one - virtual RefAST getNextSibling() const = 0; - - /// Get the token text for this node - virtual ANTLR_USE_NAMESPACE(std)string getText() const = 0; - /// Get the token type for this node - virtual int getType() const = 0; - - /** Various initialization routines. Used by several factories to initialize - * an AST element. - */ - virtual void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) = 0; - virtual void initialize(RefAST t) = 0; - virtual void initialize(RefToken t) = 0; - -#ifdef ANTLR_SUPPORT_XML - /** initialize this node from the contents of a stream. - * @param in the stream to read the AST attributes from. - */ - virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ) = 0; -#endif - - /// Set the first child of a node. - virtual void setFirstChild(RefAST c) = 0; - /// Set the next sibling after this one. - virtual void setNextSibling(RefAST n) = 0; - - /// Set the token text for this node - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt) = 0; - /// Set the token type for this node - virtual void setType(int type) = 0; - - /// Return this AST node as a string - virtual ANTLR_USE_NAMESPACE(std)string toString() const = 0; - - /// Print out a child-sibling tree in LISP notation - virtual ANTLR_USE_NAMESPACE(std)string toStringList() const = 0; - virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const = 0; - -#ifdef ANTLR_SUPPORT_XML - /** get attributes of this node to 'out'. Override to customize XML - * output. - * @param out the stream to write the AST attributes to. - * @returns if a explicit closetag should be written - */ - virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const = 0; - - /** Print a symbol over ostream. Overload this one to customize the XML - * output for AST derived AST-types - * @param output stream - */ - virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const = 0; - - /** Dump AST contents in XML format to output stream. - * Works in conjunction with to_stream method. Overload that one is - * derived classes to customize behaviour. - * @param output stream to write to string to put the stuff in. - * @param ast RefAST object to write. - */ - friend ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast ); -#endif - -private: - friend struct ASTRef; - ASTRef* ref; - - AST(RefAST other); - AST& operator=(const AST& other); - AST& operator=(RefAST other); -}; - -#ifdef ANTLR_SUPPORT_XML -inline ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast ) -{ - ast->toStream(output); - return output; -} -#endif - -extern ANTLR_API RefAST nullAST; -extern ANTLR_API AST* const nullASTptr; - -#ifdef NEEDS_OPERATOR_LESS_THAN -// RK: apparently needed by MSVC and a SUN CC, up to and including -// 2.7.2 this was undefined ? -inline bool operator<( RefAST l, RefAST r ) -{ - return nullAST == l ? ( nullAST == r ? false : true ) : l->getType() < r->getType(); -} -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_AST_hpp__ diff --git a/libs/antlr-2.7.7/antlr/ASTArray.hpp b/libs/antlr-2.7.7/antlr/ASTArray.hpp deleted file mode 100644 index d667c33d..00000000 --- a/libs/antlr-2.7.7/antlr/ASTArray.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_ASTArray_hpp__ -#define INC_ASTArray_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTArray.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** ASTArray is a class that allows ANTLR to - * generate code that can create and initialize an array - * in one expression, like: - * (new ASTArray(3))->add(x)->add(y)->add(z) - */ -class ANTLR_API ASTArray { -public: - int size; // = 0; - ANTLR_USE_NAMESPACE(std)vector array; - - ASTArray(int capacity) - : size(0) - , array(capacity) - { - } - - ASTArray* add(RefAST node) - { - array[size++] = node; - return this; - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTArray_hpp__ diff --git a/libs/antlr-2.7.7/antlr/ASTFactory.hpp b/libs/antlr-2.7.7/antlr/ASTFactory.hpp deleted file mode 100644 index 9fdcc248..00000000 --- a/libs/antlr-2.7.7/antlr/ASTFactory.hpp +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef INC_ASTFactory_hpp__ -#define INC_ASTFactory_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTFactory.hpp#2 $ - */ - -#include -#include -#include -#include - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -// Using these extra types to appease MSVC -typedef RefAST (*factory_type_)(); -typedef ANTLR_USE_NAMESPACE(std)pair< const char*, factory_type_ > factory_descriptor_; -typedef ANTLR_USE_NAMESPACE(std)vector< factory_descriptor_* > factory_descriptor_list_; - -/** AST Super Factory shared by TreeParser and Parser. - * This super factory maintains a map of all AST node types to their respective - * AST factories. One instance should be shared among a parser/treeparser - * chain. - * - * @todo check all this code for possible use of references in - * stead of RefAST's. - */ -class ANTLR_API ASTFactory { -public: - typedef factory_type_ factory_type; - typedef factory_descriptor_ factory_descriptor; - typedef factory_descriptor_list_ factory_descriptor_list; -protected: - /* The mapping of AST node type to factory.. - */ - factory_descriptor default_factory_descriptor; - factory_descriptor_list nodeFactories; -public: - /// Make new factory. Per default (Ref)CommonAST instances are generated. - ASTFactory(); - /** Initialize factory with a non default node type. - * factory_node_name should be the name of the AST node type the factory - * generates. (should exist during the existance of this ASTFactory - * instance) - */ - ASTFactory( const char* factory_node_name, factory_type factory ); - /// Destroy factory - virtual ~ASTFactory(); - - /// Register a node factory for the node type type with name ast_name - void registerFactory( int type, const char* ast_name, factory_type factory ); - /// Set the maximum node (AST) type this factory may encounter - void setMaxNodeType( int type ); - - /// Add a child to the current AST - void addASTChild(ASTPair& currentAST, RefAST child); - /// Create new empty AST node. The right default type shou - virtual RefAST create(); - /// Create AST node of the right type for 'type' - RefAST create(int type); - /// Create AST node of the right type for 'type' and initialize with txt - RefAST create(int type, const ANTLR_USE_NAMESPACE(std)string& txt); - /// Create duplicate of tr - RefAST create(RefAST tr); - /// Create new AST node and initialize contents from a token. - RefAST create(RefToken tok); - /// Create new AST node and initialize contents from a stream. - RefAST create(const ANTLR_USE_NAMESPACE(std)string& txt, ANTLR_USE_NAMESPACE(std)istream& infile ); - /** Deep copy a single node. This function the new clone() methods in the - * AST interface. Returns a new RefAST(nullASTptr) if t is null. - */ - RefAST dup(RefAST t); - /// Duplicate tree including siblings of root. - RefAST dupList(RefAST t); - /** Duplicate a tree, assuming this is a root node of a tree-- - * duplicate that node and what's below; ignore siblings of root node. - */ - RefAST dupTree(RefAST t); - /** Make a tree from a list of nodes. The first element in the - * array is the root. If the root is null, then the tree is - * a simple list not a tree. Handles null children nodes correctly. - * For example, make(a, b, null, c) yields tree (a b c). make(null,a,b) - * yields tree (nil a b). - */ - RefAST make(ANTLR_USE_NAMESPACE(std)vector& nodes); - /** Make a tree from a list of nodes, where the nodes are contained - * in an ASTArray object. The ASTArray is deleted after use. - * @todo FIXME! I have a feeling we can get rid of this ugly ASTArray thing - */ - RefAST make(ASTArray* nodes); - /// Make an AST the root of current AST - void makeASTRoot(ASTPair& currentAST, RefAST root); - - /** Set a new default AST type. - * factory_node_name should be the name of the AST node type the factory - * generates. (should exist during the existance of this ASTFactory - * instance). - * Only change factory between parser runs. You might get unexpected results - * otherwise. - */ - void setASTNodeFactory( const char* factory_node_name, factory_type factory ); - -#ifdef ANTLR_SUPPORT_XML - /** Load a XML AST from stream. Make sure you have all the factories - * registered before use. - * @note this 'XML' stuff is quite rough still. YMMV. - */ - RefAST LoadAST( ANTLR_USE_NAMESPACE(std)istream& infile ); -#endif -protected: - void loadChildren( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ); - void loadSiblings( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ); - bool checkCloseTag( ANTLR_USE_NAMESPACE(std)istream& infile ); - -#ifdef ANTLR_VECTOR_HAS_AT - /// construct a node of 'type' - inline RefAST getNodeOfType( unsigned int type ) - { - return RefAST(nodeFactories.at(type)->second()); - } - /// get the name of the node 'type' - const char* getASTNodeType( unsigned int type ) - { - return nodeFactories.at(type)->first; - } - /// get the factory used for node 'type' - factory_type getASTNodeFactory( unsigned int type ) - { - return nodeFactories.at(type)->second; - } -#else - inline RefAST getNodeOfType( unsigned int type ) - { - return RefAST(nodeFactories[type]->second()); - } - /// get the name of the node 'type' - const char* getASTNodeType( unsigned int type ) - { - return nodeFactories[type]->first; - } - factory_type getASTNodeFactory( unsigned int type ) - { - return nodeFactories[type]->second; - } -#endif - -private: - // no copying and such.. - ASTFactory( const ASTFactory& ); - ASTFactory& operator=( const ASTFactory& ); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTFactory_hpp__ diff --git a/libs/antlr-2.7.7/antlr/ASTNULLType.hpp b/libs/antlr-2.7.7/antlr/ASTNULLType.hpp deleted file mode 100644 index ab8901a6..00000000 --- a/libs/antlr-2.7.7/antlr/ASTNULLType.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef INC_ASTNULLType_hpp__ -#define INC_ASTNULLType_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTNULLType.hpp#2 $ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** There is only one instance of this class **/ -class ANTLR_API ASTNULLType : public AST { -public: - const char* typeName( void ) const; - RefAST clone( void ) const; - - void addChild(RefAST c); - size_t getNumberOfChildren() const; - void setFirstChild(RefAST c); - void setNextSibling(RefAST n); - - bool equals(RefAST t) const; - bool equalsList(RefAST t) const; - bool equalsListPartial(RefAST t) const; - bool equalsTree(RefAST t) const; - bool equalsTreePartial(RefAST t) const; - - ANTLR_USE_NAMESPACE(std)vector findAll(RefAST tree); - ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST subtree); - - RefAST getFirstChild() const; - RefAST getNextSibling() const; - - ANTLR_USE_NAMESPACE(std)string getText() const; - int getType() const; - - void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt); - void initialize(RefAST t); - void initialize(RefToken t); - void initialize(ANTLR_USE_NAMESPACE(std)istream& infile); - - void setText(const ANTLR_USE_NAMESPACE(std)string& text); - void setType(int ttype); - ANTLR_USE_NAMESPACE(std)string toString() const; - ANTLR_USE_NAMESPACE(std)string toStringList() const; - ANTLR_USE_NAMESPACE(std)string toStringTree() const; - - bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; - void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTNULLType_hpp__ diff --git a/libs/antlr-2.7.7/antlr/ASTPair.hpp b/libs/antlr-2.7.7/antlr/ASTPair.hpp deleted file mode 100644 index ec542537..00000000 --- a/libs/antlr-2.7.7/antlr/ASTPair.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef INC_ASTPair_hpp__ -#define INC_ASTPair_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTPair.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** ASTPair: utility class used for manipulating a pair of ASTs - * representing the current AST root and current AST sibling. - * This exists to compensate for the lack of pointers or 'var' - * arguments in Java. - * - * OK, so we can do those things in C++, but it seems easier - * to stick with the Java way for now. - */ -class ANTLR_API ASTPair { -public: - RefAST root; // current root of tree - RefAST child; // current child to which siblings are added - - /** Make sure that child is the last sibling */ - void advanceChildToEnd() { - if (child) { - while (child->getNextSibling()) { - child = child->getNextSibling(); - } - } - } -// /** Copy an ASTPair. Don't call it clone() because we want type-safety */ -// ASTPair copy() { -// ASTPair tmp = new ASTPair(); -// tmp.root = root; -// tmp.child = child; -// return tmp; -// } - ANTLR_USE_NAMESPACE(std)string toString() const { - ANTLR_USE_NAMESPACE(std)string r = !root ? ANTLR_USE_NAMESPACE(std)string("null") : root->getText(); - ANTLR_USE_NAMESPACE(std)string c = !child ? ANTLR_USE_NAMESPACE(std)string("null") : child->getText(); - return "["+r+","+c+"]"; - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTPair_hpp__ diff --git a/libs/antlr-2.7.7/antlr/ASTRefCount.hpp b/libs/antlr-2.7.7/antlr/ASTRefCount.hpp deleted file mode 100644 index 293f2d5f..00000000 --- a/libs/antlr-2.7.7/antlr/ASTRefCount.hpp +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef INC_ASTRefCount_hpp__ -# define INC_ASTRefCount_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTRefCount.hpp#2 $ - */ - -# include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - - class AST; - -struct ANTLR_API ASTRef -{ - AST* const ptr; - unsigned int count; - - ASTRef(AST* p); - ~ASTRef(); - ASTRef* increment() - { - ++count; - return this; - } - bool decrement() - { - return (--count==0); - } - - static ASTRef* getRef(const AST* p); -private: - ASTRef( const ASTRef& ); - ASTRef& operator=( const ASTRef& ); -}; - -template - class ANTLR_API ASTRefCount -{ -private: - ASTRef* ref; - -public: - ASTRefCount(const AST* p=0) - : ref(p ? ASTRef::getRef(p) : 0) - { - } - ASTRefCount(const ASTRefCount& other) - : ref(other.ref ? other.ref->increment() : 0) - { - } - ~ASTRefCount() - { - if (ref && ref->decrement()) - delete ref; - } - ASTRefCount& operator=(AST* other) - { - ASTRef* tmp = ASTRef::getRef(other); - - if (ref && ref->decrement()) - delete ref; - - ref=tmp; - - return *this; - } - ASTRefCount& operator=(const ASTRefCount& other) - { - if( other.ref != ref ) - { - ASTRef* tmp = other.ref ? other.ref->increment() : 0; - - if (ref && ref->decrement()) - delete ref; - - ref=tmp; - } - return *this; - } - - operator T* () const { return ref ? static_cast(ref->ptr) : 0; } - T* operator->() const { return ref ? static_cast(ref->ptr) : 0; } - T* get() const { return ref ? static_cast(ref->ptr) : 0; } -}; - -typedef ASTRefCount RefAST; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTRefCount_hpp__ diff --git a/libs/antlr-2.7.7/antlr/BaseAST.hpp b/libs/antlr-2.7.7/antlr/BaseAST.hpp deleted file mode 100644 index f048f954..00000000 --- a/libs/antlr-2.7.7/antlr/BaseAST.hpp +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef INC_BaseAST_hpp__ -#define INC_BaseAST_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/BaseAST.hpp#2 $ - */ - -#include -#include - -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API BaseAST; -typedef ASTRefCount RefBaseAST; - -class ANTLR_API BaseAST : public AST { -public: - BaseAST() : AST() - { - } - BaseAST(const BaseAST& other) - : AST(other) - { - } - virtual ~BaseAST() - { - } - - /// Return the class name - virtual const char* typeName( void ) const = 0; - - /// Clone this AST node. - virtual RefAST clone( void ) const = 0; - - /// Is node t equal to this in terms of token type and text? - virtual bool equals(RefAST t) const; - - /** Is t an exact structural and equals() match of this tree. The - * 'this' reference is considered the start of a sibling list. - */ - virtual bool equalsList(RefAST t) const; - - /** Is 't' a subtree of this list? The siblings of the root are NOT ignored. - */ - virtual bool equalsListPartial(RefAST t) const; - - /** Is tree rooted at 'this' equal to 't'? The siblings of 'this' are - * ignored. - */ - virtual bool equalsTree(RefAST t) const; - - /** Is 't' a subtree of the tree rooted at 'this'? The siblings of - * 'this' are ignored. - */ - virtual bool equalsTreePartial(RefAST t) const; - - /** Walk the tree looking for all exact subtree matches. Return - * an ASTEnumerator that lets the caller walk the list - * of subtree roots found herein. - */ - virtual ANTLR_USE_NAMESPACE(std)vector findAll(RefAST t); - - /** Walk the tree looking for all subtrees. Return - * an ASTEnumerator that lets the caller walk the list - * of subtree roots found herein. - */ - virtual ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST t); - - /// Add a node to the end of the child list for this node - virtual void addChild(RefAST c) - { - if( !c ) - return; - - RefBaseAST tmp = down; - - if (tmp) - { - while (tmp->right) - tmp = tmp->right; - tmp->right = c; - } - else - down = c; - } - - /** Get the number of child nodes of this node (shallow e.g. not of the - * whole tree it spans). - */ - virtual size_t getNumberOfChildren() const; - - /// Get the first child of this node; null if no children - virtual RefAST getFirstChild() const - { - return RefAST(down); - } - /// Get the next sibling in line after this one - virtual RefAST getNextSibling() const - { - return RefAST(right); - } - - /// Get the token text for this node - virtual ANTLR_USE_NAMESPACE(std)string getText() const - { - return ""; - } - /// Get the token type for this node - virtual int getType() const - { - return 0; - } - - /// Remove all children - virtual void removeChildren() - { - down = static_cast(static_cast(nullAST)); - } - - /// Set the first child of a node. - virtual void setFirstChild(RefAST c) - { - down = static_cast(static_cast(c)); - } - - /// Set the next sibling after this one. - virtual void setNextSibling(RefAST n) - { - right = static_cast(static_cast(n)); - } - - /// Set the token text for this node - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& /*txt*/) - { - } - - /// Set the token type for this node - virtual void setType(int /*type*/) - { - } - -#ifdef ANTLR_SUPPORT_XML - /** print attributes of this node to 'out'. Override to customize XML - * output. - * @param out the stream to write the AST attributes to. - */ - virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const; - /** Write this subtree to a stream. Overload this one to customize the XML - * output for AST derived AST-types - * @param output stream - */ - virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; -#endif - - /// Return string representation for the AST - virtual ANTLR_USE_NAMESPACE(std)string toString() const - { - return getText(); - } - - /// Print out a child sibling tree in LISP notation - virtual ANTLR_USE_NAMESPACE(std)string toStringList() const; - virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const; -protected: - RefBaseAST down; - RefBaseAST right; -private: - void doWorkForFindAll(ANTLR_USE_NAMESPACE(std)vector& v, - RefAST target, - bool partialMatch); -}; - -/** Is node t equal to this in terms of token type and text? - */ -inline bool BaseAST::equals(RefAST t) const -{ - if (!t) - return false; - return ((getType() == t->getType()) && (getText() == t->getText())); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_BaseAST_hpp__ diff --git a/libs/antlr-2.7.7/antlr/BitSet.hpp b/libs/antlr-2.7.7/antlr/BitSet.hpp deleted file mode 100644 index e1869cf4..00000000 --- a/libs/antlr-2.7.7/antlr/BitSet.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef INC_BitSet_hpp__ -#define INC_BitSet_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/BitSet.hpp#2 $ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A BitSet to replace java.util.BitSet. - * Primary differences are that most set operators return new sets - * as opposed to oring and anding "in place". Further, a number of - * operations were added. I cannot contain a BitSet because there - * is no way to access the internal bits (which I need for speed) - * and, because it is final, I cannot subclass to add functionality. - * Consider defining set degree. Without access to the bits, I must - * call a method n times to test the ith bit...ack! - * - * Also seems like or() from util is wrong when size of incoming set is bigger - * than this.length. - * - * This is a C++ version of the Java class described above, with only - * a handful of the methods implemented, because we don't need the - * others at runtime. It's really just a wrapper around vector, - * which should probably be changed to a wrapper around bitset, once - * bitset is more widely available. - * - * @author Terence Parr, MageLang Institute - * @author
Pete Wells - */ -class ANTLR_API BitSet { -private: - ANTLR_USE_NAMESPACE(std)vector storage; - -public: - BitSet( unsigned int nbits=64 ); - BitSet( const unsigned long* bits_, unsigned int nlongs); - ~BitSet(); - - void add( unsigned int el ); - - bool member( unsigned int el ) const; - - ANTLR_USE_NAMESPACE(std)vector toArray() const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_BitSet_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CharBuffer.hpp b/libs/antlr-2.7.7/antlr/CharBuffer.hpp deleted file mode 100644 index 57ab3e67..00000000 --- a/libs/antlr-2.7.7/antlr/CharBuffer.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef INC_CharBuffer_hpp__ -#define INC_CharBuffer_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CharBuffer.hpp#2 $ - */ - -#include - -#include - -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**A Stream of characters fed to the lexer from a InputStream that can - * be rewound via mark()/rewind() methods. - *

- * A dynamic array is used to buffer up all the input characters. Normally, - * "k" characters are stored in the buffer. More characters may be stored - * during guess mode (testing syntactic predicate), or when LT(i>k) is - * referenced. - * Consumption of characters is deferred. In other words, reading the next - * character is not done by consume(), but deferred until needed by LA or LT. - *

- * - * @see antlr.CharQueue - */ - -class ANTLR_API CharBuffer : public InputBuffer { -public: - /// Create a character buffer - CharBuffer( ANTLR_USE_NAMESPACE(std)istream& input ); - /// Get the next character from the stream - int getChar(); - -protected: - // character source - ANTLR_USE_NAMESPACE(std)istream& input; - -private: - // NOTE: Unimplemented - CharBuffer(const CharBuffer& other); - CharBuffer& operator=(const CharBuffer& other); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CharBuffer_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CharInputBuffer.hpp b/libs/antlr-2.7.7/antlr/CharInputBuffer.hpp deleted file mode 100644 index ac2da0cb..00000000 --- a/libs/antlr-2.7.7/antlr/CharInputBuffer.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef INC_CharInputBuffer_hpp__ -# define INC_CharInputBuffer_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -# include -# include - -# ifdef HAS_NOT_CCTYPE_H -# include -# else -# include -# endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** CharInputBuffer.hpp provides an InputBuffer for plain character arrays (buffers). - */ -class CharInputBuffer : public InputBuffer -{ -public: - /** Construct a CharInputBuffer.hpp object with a char* buffer of 'size' - * if 'owner' is true, then the buffer will be delete[]-ed on destruction. - * @note it is assumed the buffer was allocated with new[]! - */ - CharInputBuffer( unsigned char* buf, size_t size, bool owner = false ) - : buffer(buf) - , ptr(buf) - , end(buf + size) - , delete_buffer(owner) - { - } - - /** Destructor - * @note If you're using malloced data, then you probably need to change - * this destructor. Or better use this class as template for your own. - */ - ~CharInputBuffer( void ) - { - if( delete_buffer && buffer ) - delete [] buffer; - } - - /** Reset the CharInputBuffer to initial state - * Called from LexerInputState::reset. - * @see LexerInputState - */ - virtual inline void reset( void ) - { - InputBuffer::reset(); - ptr = buffer; - } - - virtual int getChar( void ) - { - return (ptr < end) ? *ptr++ : EOF; - } - -protected: - unsigned char* buffer; ///< the buffer with data - unsigned char* ptr; ///< position ptr into the buffer - unsigned char* end; ///< end sentry for buffer - bool delete_buffer; ///< flag signifying if we have to delete the buffer -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif diff --git a/libs/antlr-2.7.7/antlr/CharScanner.hpp b/libs/antlr-2.7.7/antlr/CharScanner.hpp deleted file mode 100644 index df66447a..00000000 --- a/libs/antlr-2.7.7/antlr/CharScanner.hpp +++ /dev/null @@ -1,577 +0,0 @@ -#ifndef INC_CharScanner_hpp__ -#define INC_CharScanner_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp#2 $ - */ - -#include - -#include - -#ifdef HAS_NOT_CCTYPE_H -#include -#else -#include -#endif - -#if ( _MSC_VER == 1200 ) -// VC6 seems to need this -// note that this is not a standard C++ include file. -# include -#endif -#include - -#include -#include -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CharScanner; - -ANTLR_C_USING(tolower) - -#ifdef ANTLR_REALLY_NO_STRCASECMP -// Apparently, neither strcasecmp nor stricmp is standard, and Codewarrior -// on the mac has neither... -inline int strcasecmp(const char *s1, const char *s2) -{ - while (true) - { - char c1 = tolower(*s1++), - c2 = tolower(*s2++); - if (c1 < c2) return -1; - if (c1 > c2) return 1; - if (c1 == 0) return 0; - } -} -#else -#ifdef NO_STRCASECMP -ANTLR_C_USING(stricmp) -#else -#include -ANTLR_C_USING(strcasecmp) -#endif -#endif - -/** Functor for the literals map - */ -class ANTLR_API CharScannerLiteralsLess : public ANTLR_USE_NAMESPACE(std)binary_function { -private: - const CharScanner* scanner; -public: -#ifdef NO_TEMPLATE_PARTS - CharScannerLiteralsLess() {} // not really used, definition to appease MSVC -#endif - CharScannerLiteralsLess(const CharScanner* theScanner) - : scanner(theScanner) - { - } - bool operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const; -// defaults are good enough.. - // CharScannerLiteralsLess(const CharScannerLiteralsLess&); - // CharScannerLiteralsLess& operator=(const CharScannerLiteralsLess&); -}; - -/** Superclass of generated lexers - */ -class ANTLR_API CharScanner : public TokenStream { -protected: - typedef RefToken (*factory_type)(); -public: - CharScanner(InputBuffer& cb, bool case_sensitive ); - CharScanner(InputBuffer* cb, bool case_sensitive ); - CharScanner(const LexerSharedInputState& state, bool case_sensitive ); - - virtual ~CharScanner() - { - } - - virtual int LA(unsigned int i); - - virtual void append(char c) - { - if (saveConsumedInput) - { - size_t l = text.length(); - - if ((l%256) == 0) - text.reserve(l+256); - - text.replace(l,0,&c,1); - } - } - - virtual void append(const ANTLR_USE_NAMESPACE(std)string& s) - { - if( saveConsumedInput ) - text += s; - } - - virtual void commit() - { - inputState->getInput().commit(); - } - - /** called by the generated lexer to do error recovery, override to - * customize the behaviour. - */ - virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) - { - (void)ex; - consume(); - consumeUntil(tokenSet); - } - - virtual void consume() - { - if (inputState->guessing == 0) - { - int c = LA(1); - if (caseSensitive) - { - append(c); - } - else - { - // use input.LA(), not LA(), to get original case - // CharScanner.LA() would toLower it. - append(inputState->getInput().LA(1)); - } - - // RK: in a sense I don't like this automatic handling. - if (c == '\t') - tab(); - else - inputState->column++; - } - inputState->getInput().consume(); - } - - /** Consume chars until one matches the given char */ - virtual void consumeUntil(int c) - { - for(;;) - { - int la_1 = LA(1); - if( la_1 == EOF_CHAR || la_1 == c ) - break; - consume(); - } - } - - /** Consume chars until one matches the given set */ - virtual void consumeUntil(const BitSet& set) - { - for(;;) - { - int la_1 = LA(1); - if( la_1 == EOF_CHAR || set.member(la_1) ) - break; - consume(); - } - } - - /// Mark the current position and return a id for it - virtual unsigned int mark() - { - return inputState->getInput().mark(); - } - /// Rewind the scanner to a previously marked position - virtual void rewind(unsigned int pos) - { - inputState->getInput().rewind(pos); - } - - /// See if input contains character 'c' throw MismatchedCharException if not - virtual void match(int c) - { - int la_1 = LA(1); - if ( la_1 != c ) - throw MismatchedCharException(la_1, c, false, this); - consume(); - } - - /** See if input contains element from bitset b - * throw MismatchedCharException if not - */ - virtual void match(const BitSet& b) - { - int la_1 = LA(1); - - if ( !b.member(la_1) ) - throw MismatchedCharException( la_1, b, false, this ); - consume(); - } - - /** See if input contains string 's' throw MismatchedCharException if not - * @note the string cannot match EOF - */ - virtual void match( const char* s ) - { - while( *s != '\0' ) - { - // the & 0xFF is here to prevent sign extension lateron - int la_1 = LA(1), c = (*s++ & 0xFF); - - if ( la_1 != c ) - throw MismatchedCharException(la_1, c, false, this); - - consume(); - } - } - /** See if input contains string 's' throw MismatchedCharException if not - * @note the string cannot match EOF - */ - virtual void match(const ANTLR_USE_NAMESPACE(std)string& s) - { - size_t len = s.length(); - - for (size_t i = 0; i < len; i++) - { - // the & 0xFF is here to prevent sign extension lateron - int la_1 = LA(1), c = (s[i] & 0xFF); - - if ( la_1 != c ) - throw MismatchedCharException(la_1, c, false, this); - - consume(); - } - } - /** See if input does not contain character 'c' - * throw MismatchedCharException if not - */ - virtual void matchNot(int c) - { - int la_1 = LA(1); - - if ( la_1 == c ) - throw MismatchedCharException(la_1, c, true, this); - - consume(); - } - /** See if input contains character in range c1-c2 - * throw MismatchedCharException if not - */ - virtual void matchRange(int c1, int c2) - { - int la_1 = LA(1); - - if ( la_1 < c1 || la_1 > c2 ) - throw MismatchedCharException(la_1, c1, c2, false, this); - - consume(); - } - - virtual bool getCaseSensitive() const - { - return caseSensitive; - } - - virtual void setCaseSensitive(bool t) - { - caseSensitive = t; - } - - virtual bool getCaseSensitiveLiterals() const=0; - - /// Get the line the scanner currently is in (starts at 1) - virtual int getLine() const - { - return inputState->line; - } - - /// set the line number - virtual void setLine(int l) - { - inputState->line = l; - } - - /// Get the column the scanner currently is in (starts at 1) - virtual int getColumn() const - { - return inputState->column; - } - /// set the column number - virtual void setColumn(int c) - { - inputState->column = c; - } - - /// get the filename for the file currently used - virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const - { - return inputState->filename; - } - /// Set the filename the scanner is using (used in error messages) - virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f) - { - inputState->filename = f; - } - - virtual bool getCommitToPath() const - { - return commitToPath; - } - - virtual void setCommitToPath(bool commit) - { - commitToPath = commit; - } - - /** return a copy of the current text buffer */ - virtual const ANTLR_USE_NAMESPACE(std)string& getText() const - { - return text; - } - - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s) - { - text = s; - } - - virtual void resetText() - { - text = ""; - inputState->tokenStartColumn = inputState->column; - inputState->tokenStartLine = inputState->line; - } - - virtual RefToken getTokenObject() const - { - return _returnToken; - } - - /** Used to keep track of line breaks, needs to be called from - * within generated lexers when a \n \r is encountered. - */ - virtual void newline() - { - ++inputState->line; - inputState->column = 1; - } - - /** Advance the current column number by an appropriate amount according - * to the tabsize. This method needs to be explicitly called from the - * lexer rules encountering tabs. - */ - virtual void tab() - { - int c = getColumn(); - int nc = ( ((c-1)/tabsize) + 1) * tabsize + 1; // calculate tab stop - setColumn( nc ); - } - /// set the tabsize. Returns the old tabsize - int setTabsize( int size ) - { - int oldsize = tabsize; - tabsize = size; - return oldsize; - } - /// Return the tabsize used by the scanner - int getTabSize() const - { - return tabsize; - } - - /** Report exception errors caught in nextToken() */ - virtual void reportError(const RecognitionException& e); - - /** Parser error-reporting function can be overridden in subclass */ - virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); - - /** Parser warning-reporting function can be overridden in subclass */ - virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); - - virtual InputBuffer& getInputBuffer() - { - return inputState->getInput(); - } - - virtual LexerSharedInputState getInputState() - { - return inputState; - } - - /** set the input state for the lexer. - * @note state is a reference counted object, hence no reference */ - virtual void setInputState(LexerSharedInputState state) - { - inputState = state; - } - - /// Set the factory for created tokens - virtual void setTokenObjectFactory(factory_type factory) - { - tokenFactory = factory; - } - - /** Test the token text against the literals table - * Override this method to perform a different literals test - */ - virtual int testLiteralsTable(int ttype) const - { - ANTLR_USE_NAMESPACE(std)map::const_iterator i = literals.find(text); - if (i != literals.end()) - ttype = (*i).second; - return ttype; - } - - /** Test the text passed in against the literals table - * Override this method to perform a different literals test - * This is used primarily when you want to test a portion of - * a token - */ - virtual int testLiteralsTable(const ANTLR_USE_NAMESPACE(std)string& txt,int ttype) const - { - ANTLR_USE_NAMESPACE(std)map::const_iterator i = literals.find(txt); - if (i != literals.end()) - ttype = (*i).second; - return ttype; - } - - /// Override this method to get more specific case handling - virtual int toLower(int c) const - { - // test on EOF_CHAR for buggy (?) STLPort tolower (or HPUX tolower?) - // also VC++ 6.0 does this. (see fix 422 (is reverted by this fix) - // this one is more structural. Maybe make this configurable. - return (c == EOF_CHAR ? EOF_CHAR : tolower(c)); - } - - /** This method is called by YourLexer::nextToken() when the lexer has - * hit EOF condition. EOF is NOT a character. - * This method is not called if EOF is reached during - * syntactic predicate evaluation or during evaluation - * of normal lexical rules, which presumably would be - * an IOException. This traps the "normal" EOF condition. - * - * uponEOF() is called after the complete evaluation of - * the previous token and only if your parser asks - * for another token beyond that last non-EOF token. - * - * You might want to throw token or char stream exceptions - * like: "Heh, premature eof" or a retry stream exception - * ("I found the end of this file, go back to referencing file"). - */ - virtual void uponEOF() - { - } - - /// Methods used to change tracing behavior - virtual void traceIndent(); - virtual void traceIn(const char* rname); - virtual void traceOut(const char* rname); - -#ifndef NO_STATIC_CONSTS - static const int EOF_CHAR = EOF; -#else - enum { - EOF_CHAR = EOF - }; -#endif -protected: - ANTLR_USE_NAMESPACE(std)string text; ///< Text of current token - /// flag indicating wether consume saves characters - bool saveConsumedInput; - factory_type tokenFactory; ///< Factory for tokens - bool caseSensitive; ///< Is this lexer case sensitive - ANTLR_USE_NAMESPACE(std)map literals; // set by subclass - - RefToken _returnToken; ///< used to return tokens w/o using return val - - /// Input state, gives access to input stream, shared among different lexers - LexerSharedInputState inputState; - - /** Used during filter mode to indicate that path is desired. - * A subsequent scan error will report an error as usual - * if acceptPath=true; - */ - bool commitToPath; - - int tabsize; ///< tab size the scanner uses. - - /// Create a new RefToken of type t - virtual RefToken makeToken(int t) - { - RefToken tok = tokenFactory(); - tok->setType(t); - tok->setColumn(inputState->tokenStartColumn); - tok->setLine(inputState->tokenStartLine); - return tok; - } - - /** Tracer class, used when -traceLexer is passed to antlr - */ - class Tracer { - private: - CharScanner* parser; - const char* text; - - Tracer(const Tracer& other); // undefined - Tracer& operator=(const Tracer& other); // undefined - public: - Tracer( CharScanner* p,const char* t ) - : parser(p), text(t) - { - parser->traceIn(text); - } - ~Tracer() - { - parser->traceOut(text); - } - }; - - int traceDepth; -private: - CharScanner( const CharScanner& other ); // undefined - CharScanner& operator=( const CharScanner& other ); // undefined - -#ifndef NO_STATIC_CONSTS - static const int NO_CHAR = 0; -#else - enum { - NO_CHAR = 0 - }; -#endif -}; - -inline int CharScanner::LA(unsigned int i) -{ - int c = inputState->getInput().LA(i); - - if ( caseSensitive ) - return c; - else - return toLower(c); // VC 6 tolower bug caught in toLower. -} - -inline bool CharScannerLiteralsLess::operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const -{ - if (scanner->getCaseSensitiveLiterals()) - return ANTLR_USE_NAMESPACE(std)less()(x,y); - else - { -#ifdef NO_STRCASECMP - return (stricmp(x.c_str(),y.c_str())<0); -#else - return (strcasecmp(x.c_str(),y.c_str())<0); -#endif - } -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CharScanner_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CharStreamException.hpp b/libs/antlr-2.7.7/antlr/CharStreamException.hpp deleted file mode 100644 index ee7ad437..00000000 --- a/libs/antlr-2.7.7/antlr/CharStreamException.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef INC_CharStreamException_hpp__ -#define INC_CharStreamException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CharStreamException.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CharStreamException : public ANTLRException { -public: - CharStreamException(const ANTLR_USE_NAMESPACE(std)string& s) - : ANTLRException(s) {} - ~CharStreamException() throw() {} -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CharStreamException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CharStreamIOException.hpp b/libs/antlr-2.7.7/antlr/CharStreamIOException.hpp deleted file mode 100644 index ebbb0fd6..00000000 --- a/libs/antlr-2.7.7/antlr/CharStreamIOException.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef INC_CharStreamIOException_hpp__ -#define INC_CharStreamIOException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CharStreamIOException.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CharStreamIOException : public CharStreamException { -public: - ANTLR_USE_NAMESPACE(std)exception io; - - CharStreamIOException(ANTLR_USE_NAMESPACE(std)exception& e) - : CharStreamException(e.what()), io(e) {} - ~CharStreamIOException() throw() {} -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CharStreamIOException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CircularQueue.hpp b/libs/antlr-2.7.7/antlr/CircularQueue.hpp deleted file mode 100644 index a4d11549..00000000 --- a/libs/antlr-2.7.7/antlr/CircularQueue.hpp +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef INC_CircularQueue_hpp__ -#define INC_CircularQueue_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CircularQueue.hpp#2 $ - */ - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -// Resize every 5000 items -#define OFFSET_MAX_RESIZE 5000 - -template -class ANTLR_API CircularQueue { -public: - CircularQueue() - : storage() - , m_offset(0) - { - } - ~CircularQueue() - { - } - - /// Clear the queue - inline void clear( void ) - { - m_offset = 0; - storage.clear(); - } - - /// @todo this should use at or should have a check - inline T elementAt( size_t idx ) const - { - return storage[idx+m_offset]; - } - void removeFirst() - { - if (m_offset >= OFFSET_MAX_RESIZE) - { - storage.erase( storage.begin(), storage.begin() + m_offset + 1 ); - m_offset = 0; - } - else - ++m_offset; - } - inline void removeItems( size_t nb ) - { - // it would be nice if we would not get called with nb > entries - // (or to be precise when entries() == 0) - // This case is possible when lexer/parser::recover() calls - // consume+consumeUntil when the queue is empty. - // In recover the consume says to prepare to read another - // character/token. Then in the subsequent consumeUntil the - // LA() call will trigger - // syncConsume which calls this method *before* the same queue - // has been sufficiently filled. - if( nb > entries() ) - nb = entries(); - - if (m_offset >= OFFSET_MAX_RESIZE) - { - storage.erase( storage.begin(), storage.begin() + m_offset + nb ); - m_offset = 0; - } - else - m_offset += nb; - } - inline void append(const T& t) - { - storage.push_back(t); - } - inline size_t entries() const - { - return storage.size() - m_offset; - } - -private: - ANTLR_USE_NAMESPACE(std)vector storage; - size_t m_offset; - - CircularQueue(const CircularQueue&); - const CircularQueue& operator=(const CircularQueue&); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CircularQueue_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CommonAST.hpp b/libs/antlr-2.7.7/antlr/CommonAST.hpp deleted file mode 100644 index ab16aa2c..00000000 --- a/libs/antlr-2.7.7/antlr/CommonAST.hpp +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef INC_CommonAST_hpp__ -#define INC_CommonAST_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonAST.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CommonAST : public BaseAST { -public: - CommonAST() - : BaseAST() - , ttype( Token::INVALID_TYPE ) - , text() - { - } - - CommonAST( RefToken t ) - : BaseAST() - , ttype( t->getType() ) - , text( t->getText() ) - { - } - - CommonAST( const CommonAST& other ) - : BaseAST(other) - , ttype(other.ttype) - , text(other.text) - { - } - - virtual ~CommonAST() - { - } - - virtual const char* typeName( void ) const - { - return CommonAST::TYPE_NAME; - } - - /// Clone this AST node. - virtual RefAST clone( void ) const - { - CommonAST *ast = new CommonAST( *this ); - return RefAST(ast); - } - - virtual ANTLR_USE_NAMESPACE(std)string getText() const - { - return text; - } - virtual int getType() const - { - return ttype; - } - - virtual void initialize( int t, const ANTLR_USE_NAMESPACE(std)string& txt ) - { - setType(t); - setText(txt); - } - - virtual void initialize( RefAST t ) - { - setType(t->getType()); - setText(t->getText()); - } - virtual void initialize( RefToken t ) - { - setType(t->getType()); - setText(t->getText()); - } - -#ifdef ANTLR_SUPPORT_XML - virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ); -#endif - - virtual void setText( const ANTLR_USE_NAMESPACE(std)string& txt ) - { - text = txt; - } - virtual void setType( int type ) - { - ttype = type; - } - - static RefAST factory(); - - static const char* const TYPE_NAME; -protected: - int ttype; - ANTLR_USE_NAMESPACE(std)string text; -}; - -typedef ASTRefCount RefCommonAST; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonAST_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CommonASTWithHiddenTokens.hpp b/libs/antlr-2.7.7/antlr/CommonASTWithHiddenTokens.hpp deleted file mode 100644 index 8fa4d93a..00000000 --- a/libs/antlr-2.7.7/antlr/CommonASTWithHiddenTokens.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef INC_CommonASTWithHiddenTokens_hpp__ -#define INC_CommonASTWithHiddenTokens_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonASTWithHiddenTokens.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A CommonAST whose initialization copies hidden token - * information from the Token used to create a node. - */ -class ANTLR_API CommonASTWithHiddenTokens : public CommonAST { -public: - CommonASTWithHiddenTokens(); - virtual ~CommonASTWithHiddenTokens(); - virtual const char* typeName( void ) const - { - return CommonASTWithHiddenTokens::TYPE_NAME; - } - /// Clone this AST node. - virtual RefAST clone( void ) const; - - // Borland C++ builder seems to need the decl's of the first two... - virtual void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt); - virtual void initialize(RefAST t); - virtual void initialize(RefToken t); - - virtual RefToken getHiddenAfter() const - { - return hiddenAfter; - } - - virtual RefToken getHiddenBefore() const - { - return hiddenBefore; - } - - static RefAST factory(); - - static const char* const TYPE_NAME; -protected: - RefToken hiddenBefore,hiddenAfter; // references to hidden tokens -}; - -typedef ASTRefCount RefCommonASTWithHiddenTokens; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonASTWithHiddenTokens_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CommonHiddenStreamToken.hpp b/libs/antlr-2.7.7/antlr/CommonHiddenStreamToken.hpp deleted file mode 100644 index 30a7015e..00000000 --- a/libs/antlr-2.7.7/antlr/CommonHiddenStreamToken.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef INC_CommonHiddenStreamToken_hpp__ -#define INC_CommonHiddenStreamToken_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonHiddenStreamToken.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CommonHiddenStreamToken : public CommonToken { -protected: - RefToken hiddenBefore; - RefToken hiddenAfter; - -public: - CommonHiddenStreamToken(); - CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); - CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s); - - RefToken getHiddenAfter(); - RefToken getHiddenBefore(); - - static RefToken factory(); - - void setHiddenAfter(RefToken t); - void setHiddenBefore(RefToken t); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonHiddenStreamToken_hpp__ diff --git a/libs/antlr-2.7.7/antlr/CommonToken.hpp b/libs/antlr-2.7.7/antlr/CommonToken.hpp deleted file mode 100644 index 8a032d71..00000000 --- a/libs/antlr-2.7.7/antlr/CommonToken.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef INC_CommonToken_hpp__ -#define INC_CommonToken_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonToken.hpp#2 $ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CommonToken : public Token { -public: - CommonToken(); - CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); - CommonToken(const ANTLR_USE_NAMESPACE(std)string& s); - - /// return contents of token - virtual ANTLR_USE_NAMESPACE(std)string getText() const - { - return text; - } - - /// set contents of token - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s) - { - text = s; - } - - /** get the line the token is at (starting at 1) - * @see CharScanner::newline() - * @see CharScanner::tab() - */ - virtual int getLine() const - { - return line; - } - /** gt the column the token is at (starting at 1) - * @see CharScanner::newline() - * @see CharScanner::tab() - */ - virtual int getColumn() const - { - return col; - } - - /// set line for token - virtual void setLine(int l) - { - line = l; - } - /// set column for token - virtual void setColumn(int c) - { - col = c; - } - - virtual ANTLR_USE_NAMESPACE(std)string toString() const; - static RefToken factory(); - -protected: - // most tokens will want line and text information - int line; - int col; - ANTLR_USE_NAMESPACE(std)string text; - -private: - CommonToken(const CommonToken&); - const CommonToken& operator=(const CommonToken&); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonToken_hpp__ diff --git a/libs/antlr-2.7.7/antlr/IOException.hpp b/libs/antlr-2.7.7/antlr/IOException.hpp deleted file mode 100644 index ed87f8ac..00000000 --- a/libs/antlr-2.7.7/antlr/IOException.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_IOException_hpp__ -#define INC_IOException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Generic IOException used inside support code. (thrown by XML I/O routs) - * basically this is something I'm using since a lot of compilers don't - * support ios_base::failure. - */ -class ANTLR_API IOException : public ANTLRException -{ -public: - ANTLR_USE_NAMESPACE(std)exception io; - - IOException( ANTLR_USE_NAMESPACE(std)exception& e ) - : ANTLRException(e.what()) - { - } - IOException( const ANTLR_USE_NAMESPACE(std)string& mesg ) - : ANTLRException(mesg) - { - } - virtual ~IOException() throw() - { - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_IOException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/InputBuffer.hpp b/libs/antlr-2.7.7/antlr/InputBuffer.hpp deleted file mode 100644 index f557f40b..00000000 --- a/libs/antlr-2.7.7/antlr/InputBuffer.hpp +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef INC_InputBuffer_hpp__ -#define INC_InputBuffer_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/InputBuffer.hpp#2 $ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A Stream of characters fed to the lexer from a InputStream that can - * be rewound via mark()/rewind() methods. - *

- * A dynamic array is used to buffer up all the input characters. Normally, - * "k" characters are stored in the buffer. More characters may be stored during - * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. - * Consumption of characters is deferred. In other words, reading the next - * character is not done by conume(), but deferred until needed by LA or LT. - *

- * - * @see antlr.CharQueue - */ -class ANTLR_API InputBuffer { -public: - /** Create a character buffer */ - InputBuffer() - : nMarkers(0) - , markerOffset(0) - , numToConsume(0) - { - } - - virtual ~InputBuffer() - { - } - - /// Reset the input buffer to empty state - virtual inline void reset( void ) - { - nMarkers = 0; - markerOffset = 0; - numToConsume = 0; - queue.clear(); - } - - /** This method updates the state of the input buffer so that - * the text matched since the most recent mark() is no longer - * held by the buffer. So, you either do a mark/rewind for - * failed predicate or mark/commit to keep on parsing without - * rewinding the input. - */ - inline void commit( void ) - { - nMarkers--; - } - - /** Mark another character for deferred consumption */ - virtual inline void consume() - { - numToConsume++; - } - - /** Ensure that the character buffer is sufficiently full */ - virtual void fill(unsigned int amount); - - /** Override this in subclasses to get the next character */ - virtual int getChar()=0; - - /** Get a lookahead character */ - virtual inline int LA(unsigned int i) - { - fill(i); - return queue.elementAt(markerOffset + i - 1); - } - - /** Return an integer marker that can be used to rewind the buffer to - * its current state. - */ - virtual unsigned int mark(); - /// Are there any marks active in the InputBuffer - virtual inline bool isMarked() const - { - return (nMarkers != 0); - } - /** Rewind the character buffer to a marker. - * @param mark Marker returned previously from mark() - */ - virtual void rewind(unsigned int mark); - - /** Get the number of non-consumed characters - */ - virtual unsigned int entries() const; - - ANTLR_USE_NAMESPACE(std)string getLAChars() const; - - ANTLR_USE_NAMESPACE(std)string getMarkedChars() const; - -protected: - // char source - // leave to subclasses - - // Number of active markers - unsigned int nMarkers; // = 0; - - // Additional offset used when markers are active - unsigned int markerOffset; // = 0; - - // Number of calls to consume() since last LA() or LT() call - unsigned int numToConsume; // = 0; - - // Circular queue - CircularQueue queue; - - /** Sync up deferred consumption */ - void syncConsume(); - -private: - InputBuffer(const InputBuffer& other); - InputBuffer& operator=(const InputBuffer& other); -}; - -/** Sync up deferred consumption */ -inline void InputBuffer::syncConsume() { - if (numToConsume > 0) - { - if (nMarkers > 0) - markerOffset += numToConsume; - else - queue.removeItems( numToConsume ); - numToConsume = 0; - } -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_InputBuffer_hpp__ diff --git a/libs/antlr-2.7.7/antlr/LLkParser.hpp b/libs/antlr-2.7.7/antlr/LLkParser.hpp deleted file mode 100644 index ef9181a6..00000000 --- a/libs/antlr-2.7.7/antlr/LLkParser.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef INC_LLkParser_hpp__ -#define INC_LLkParser_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/LLkParser.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**An LL(k) parser. - * - * @see antlr.Token - * @see antlr.TokenBuffer - * @see antlr.LL1Parser - */ -class ANTLR_API LLkParser : public Parser { -public: - LLkParser(const ParserSharedInputState& lexer, int k_); - - LLkParser(TokenBuffer& tokenBuf, int k_); - - LLkParser(TokenStream& lexer, int k_); - - /** Consume another token from the input stream. Can only write sequentially! - * If you need 3 tokens ahead, you must consume() 3 times. - *

- * Note that it is possible to overwrite tokens that have not been matched. - * For example, calling consume() 3 times when k=2, means that the first token - * consumed will be overwritten with the 3rd. - */ - virtual inline void consume() - { - inputState->getInput().consume(); - } - - virtual inline int LA(unsigned int i) - { - return inputState->getInput().LA(i); - } - - virtual inline RefToken LT(unsigned int i) - { - return inputState->getInput().LT(i); - } -protected: - /// the lookahead this LL(k) parser is using. - int k; -private: - void trace(const char* ee, const char* rname); -public: - virtual void traceIn(const char* rname); - virtual void traceOut(const char* rname); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_LLkParser_hpp__ diff --git a/libs/antlr-2.7.7/antlr/LexerSharedInputState.hpp b/libs/antlr-2.7.7/antlr/LexerSharedInputState.hpp deleted file mode 100644 index ff082dc2..00000000 --- a/libs/antlr-2.7.7/antlr/LexerSharedInputState.hpp +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef INC_LexerSharedInputState_hpp__ -#define INC_LexerSharedInputState_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/LexerSharedInputState.hpp#2 $ - */ - -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object contains the data associated with an - * input stream of characters. Multiple lexers - * share a single LexerSharedInputState to lex - * the same input stream. - */ -class ANTLR_API LexerInputState { -public: - /** Construct a new LexerInputState - * @param inbuf the InputBuffer to read from. The object is deleted together - * with the LexerInputState object. - */ - LexerInputState(InputBuffer* inbuf) - : column(1) - , line(1) - , tokenStartColumn(1) - , tokenStartLine(1) - , guessing(0) - , filename("") - , input(inbuf) - , inputResponsible(true) - { - } - - /** Construct a new LexerInputState - * @param inbuf the InputBuffer to read from. - */ - LexerInputState(InputBuffer& inbuf) - : column(1) - , line(1) - , tokenStartColumn(1) - , tokenStartLine(1) - , guessing(0) - , filename("") - , input(&inbuf) - , inputResponsible(false) - { - } - - /** Construct a new LexerInputState - * @param in an istream to read from. - * @see antlr.CharBuffer - */ - LexerInputState(ANTLR_USE_NAMESPACE(std)istream& in) - : column(1) - , line(1) - , tokenStartColumn(1) - , tokenStartLine(1) - , guessing(0) - , filename("") - , input(new CharBuffer(in)) - , inputResponsible(true) - { - } - - /** Reset the LexerInputState with a specified stream and filename. - * This method is a hack, dunno what I was thinking when I added it. - * This should actually be done in a subclass. - * @deprecated - */ - virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in, const char* file = "" ) - { - column = 1; - line = 1; - tokenStartColumn = 1; - tokenStartLine = 1; - guessing = 0; - filename = file; - - if( input && inputResponsible ) - delete input; - - input = new CharBuffer(in); - inputResponsible = true; - } - - /** Reset the LexerInputState to initial state. - * The underlying InputBuffer is also reset. - */ - virtual void reset( void ) - { - column = 1; - line = 1; - tokenStartColumn = 1; - tokenStartLine = 1; - guessing = 0; - input->reset(); - } - - /** Set the file position of the SharedLexerInputState. - * @param line_ line number to be set - * @param column_ column number to be set - */ - void setPosition( int line_, int column_ ) - { - line = line_; - column = column_; - } - - virtual ~LexerInputState() - { - if (inputResponsible) - delete input; - } - - int column; - int line; - int tokenStartColumn; - int tokenStartLine; - int guessing; - /** What file (if known) caused the problem? */ - ANTLR_USE_NAMESPACE(std)string filename; - InputBuffer& getInput(); -private: - /// Input buffer we use - InputBuffer* input; - /// Who is responsible for cleaning up the InputBuffer? - bool inputResponsible; - - // we don't want these: - LexerInputState(const LexerInputState&); - LexerInputState& operator=(const LexerInputState&); -}; - -inline InputBuffer& LexerInputState::getInput() -{ - return *input; -} - -/// A reference counted LexerInputState object -typedef RefCount LexerSharedInputState; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_LexerSharedInputState_hpp__ diff --git a/libs/antlr-2.7.7/antlr/MismatchedCharException.hpp b/libs/antlr-2.7.7/antlr/MismatchedCharException.hpp deleted file mode 100644 index 45054129..00000000 --- a/libs/antlr-2.7.7/antlr/MismatchedCharException.hpp +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef INC_MismatchedCharException_hpp__ -#define INC_MismatchedCharException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/MismatchedCharException.hpp#2 $ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class CharScanner; - -class ANTLR_API MismatchedCharException : public RecognitionException { -public: - // Types of chars -#ifndef NO_STATIC_CONSTS - static const int CHAR = 1; - static const int NOT_CHAR = 2; - static const int RANGE = 3; - static const int NOT_RANGE = 4; - static const int SET = 5; - static const int NOT_SET = 6; -#else - enum { - CHAR = 1, - NOT_CHAR = 2, - RANGE = 3, - NOT_RANGE = 4, - SET = 5, - NOT_SET = 6 - }; -#endif - -public: - // One of the above - int mismatchType; - - // what was found on the input stream - int foundChar; - - // For CHAR/NOT_CHAR and RANGE/NOT_RANGE - int expecting; - - // For RANGE/NOT_RANGE (expecting is lower bound of range) - int upper; - - // For SET/NOT_SET - BitSet set; - -protected: - // who knows...they may want to ask scanner questions - CharScanner* scanner; - -public: - MismatchedCharException(); - - // Expected range / not range - MismatchedCharException( - int c, - int lower, - int upper_, - bool matchNot, - CharScanner* scanner_ - ); - - // Expected token / not token - MismatchedCharException( - int c, - int expecting_, - bool matchNot, - CharScanner* scanner_ - ); - - // Expected BitSet / not BitSet - MismatchedCharException( - int c, - BitSet set_, - bool matchNot, - CharScanner* scanner_ - ); - - ~MismatchedCharException() throw() {} - - /** - * Returns a clean error message (no line number/column information) - */ - ANTLR_USE_NAMESPACE(std)string getMessage() const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_MismatchedCharException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/MismatchedTokenException.hpp b/libs/antlr-2.7.7/antlr/MismatchedTokenException.hpp deleted file mode 100644 index 4631f50b..00000000 --- a/libs/antlr-2.7.7/antlr/MismatchedTokenException.hpp +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef INC_MismatchedTokenException_hpp__ -#define INC_MismatchedTokenException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/MismatchedTokenException.hpp#2 $ - */ - -#include -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API MismatchedTokenException : public RecognitionException { -public: - MismatchedTokenException(); - - /// Expected range / not range - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - int lower, - int upper_, - bool matchNot - ); - - // Expected token / not token - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - int expecting_, - bool matchNot - ); - - // Expected BitSet / not BitSet - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - BitSet set_, - bool matchNot - ); - - // Expected range / not range - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - int lower, - int upper_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ - ); - - // Expected token / not token - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - int expecting_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ - ); - - // Expected BitSet / not BitSet - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - BitSet set_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ - ); - ~MismatchedTokenException() throw() {} - - /** - * Returns a clean error message (no line number/column information) - */ - ANTLR_USE_NAMESPACE(std)string getMessage() const; - -public: - /// The token that was encountered - const RefToken token; - /// The offending AST node if tree walking - const RefAST node; - /// taken from node or token object - ANTLR_USE_NAMESPACE(std)string tokenText; - - /// Types of tokens -#ifndef NO_STATIC_CONSTS - static const int TOKEN = 1; - static const int NOT_TOKEN = 2; - static const int RANGE = 3; - static const int NOT_RANGE = 4; - static const int SET = 5; - static const int NOT_SET = 6; -#else - enum { - TOKEN = 1, - NOT_TOKEN = 2, - RANGE = 3, - NOT_RANGE = 4, - SET = 5, - NOT_SET = 6 - }; -#endif - -public: - /// One of the above - int mismatchType; - - /// For TOKEN/NOT_TOKEN and RANGE/NOT_RANGE - int expecting; - - /// For RANGE/NOT_RANGE (expecting is lower bound of range) - int upper; - - /// For SET/NOT_SET - BitSet set; - -private: - /// Token names array for formatting - const char* const* tokenNames; - /// Max number of tokens in tokenNames - const int numTokens; - /// Return token name for tokenType - ANTLR_USE_NAMESPACE(std)string tokenName(int tokenType) const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_MismatchedTokenException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/NoViableAltException.hpp b/libs/antlr-2.7.7/antlr/NoViableAltException.hpp deleted file mode 100644 index e3677ded..00000000 --- a/libs/antlr-2.7.7/antlr/NoViableAltException.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef INC_NoViableAltException_hpp__ -#define INC_NoViableAltException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/NoViableAltException.hpp#2 $ - */ - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API NoViableAltException : public RecognitionException { -public: - const RefToken token; - const RefAST node; // handles parsing and treeparsing - - NoViableAltException(RefAST t); - NoViableAltException(RefToken t,const ANTLR_USE_NAMESPACE(std)string& fileName_); - - ~NoViableAltException() throw() {} - - /** - * Returns a clean error message (no line number/column information) - */ - ANTLR_USE_NAMESPACE(std)string getMessage() const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_NoViableAltException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/NoViableAltForCharException.hpp b/libs/antlr-2.7.7/antlr/NoViableAltForCharException.hpp deleted file mode 100644 index d61c18b0..00000000 --- a/libs/antlr-2.7.7/antlr/NoViableAltForCharException.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef INC_NoViableAltForCharException_hpp__ -# define INC_NoViableAltForCharException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/NoViableAltForCharException.hpp#2 $ - */ - -# include -# include -# include - -# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr -{ -# endif - -class ANTLR_API NoViableAltForCharException : public RecognitionException -{ -public: - NoViableAltForCharException(int c, CharScanner* scanner); - NoViableAltForCharException(int c, const ANTLR_USE_NAMESPACE(std)string& fileName_, - int line_, int column_); - - virtual ~NoViableAltForCharException() throw() - { - } - - /// Returns a clean error message (no line number/column information) - ANTLR_USE_NAMESPACE(std)string getMessage() const; -protected: - int foundChar; -}; - -# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -# endif - -#endif //INC_NoViableAltForCharException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/Parser.hpp b/libs/antlr-2.7.7/antlr/Parser.hpp deleted file mode 100644 index 3eefab50..00000000 --- a/libs/antlr-2.7.7/antlr/Parser.hpp +++ /dev/null @@ -1,320 +0,0 @@ -#ifndef INC_Parser_hpp__ -#define INC_Parser_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/Parser.hpp#2 $ - */ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -extern bool DEBUG_PARSER; - -/** A generic ANTLR parser (LL(k) for k>=1) containing a bunch of - * utility routines useful at any lookahead depth. We distinguish between - * the LL(1) and LL(k) parsers because of efficiency. This may not be - * necessary in the near future. - * - * Each parser object contains the state of the parse including a lookahead - * cache (the form of which is determined by the subclass), whether or - * not the parser is in guess mode, where tokens come from, etc... - * - *

- * During guess mode, the current lookahead token(s) and token type(s) - * cache must be saved because the token stream may not have been informed - * to save the token (via mark) before the try block. - * Guessing is started by: - *

    - *
  1. saving the lookahead cache. - *
  2. marking the current position in the TokenBuffer. - *
  3. increasing the guessing level. - *
- * - * After guessing, the parser state is restored by: - *
    - *
  1. restoring the lookahead cache. - *
  2. rewinding the TokenBuffer. - *
  3. decreasing the guessing level. - *
- * - * @see antlr.Token - * @see antlr.TokenBuffer - * @see antlr.TokenStream - * @see antlr.LL1Parser - * @see antlr.LLkParser - * - * @todo add constructors with ASTFactory. - */ -class ANTLR_API Parser { -protected: - Parser(TokenBuffer& input) - : inputState(new ParserInputState(input)), astFactory(0), traceDepth(0) - { - } - Parser(TokenBuffer* input) - : inputState(new ParserInputState(input)), astFactory(0), traceDepth(0) - { - } - Parser(const ParserSharedInputState& state) - : inputState(state), astFactory(0), traceDepth(0) - { - } -public: - virtual ~Parser() - { - } - - /** Return the token type of the ith token of lookahead where i=1 - * is the current token being examined by the parser (i.e., it - * has not been matched yet). - */ - virtual int LA(unsigned int i)=0; - - /// Return the i-th token of lookahead - virtual RefToken LT(unsigned int i)=0; - - /** DEPRECATED! Specify the factory to be used during tree building. (Compulsory) - * Setting the factory is nowadays compulsory. - * @see setASTFactory - */ - virtual void setASTNodeFactory( ASTFactory *factory ) - { - astFactory = factory; - } - /** Specify the factory to be used during tree building. (Compulsory) - * Setting the factory is nowadays compulsory. - */ - virtual void setASTFactory( ASTFactory *factory ) - { - astFactory = factory; - } - /** Return a pointer to the ASTFactory used. - * So you might use it in subsequent treewalkers or to reload AST's - * from disk. - */ - virtual ASTFactory* getASTFactory() - { - return astFactory; - } - /** Get the root AST node of the generated AST. When using a custom AST type - * or heterogenous AST's, you'll have to convert it to the right type - * yourself. - */ - virtual RefAST getAST() = 0; - - /// Return the filename of the input file. - virtual inline ANTLR_USE_NAMESPACE(std)string getFilename() const - { - return inputState->filename; - } - /// Set the filename of the input file (used for error reporting). - virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f) - { - inputState->filename = f; - } - - virtual void setInputState(ParserSharedInputState state) - { - inputState = state; - } - virtual inline ParserSharedInputState getInputState() const - { - return inputState; - } - - /// Get another token object from the token stream - virtual void consume()=0; - /// Consume tokens until one matches the given token - virtual void consumeUntil(int tokenType) - { - while (LA(1) != Token::EOF_TYPE && LA(1) != tokenType) - consume(); - } - - /// Consume tokens until one matches the given token set - virtual void consumeUntil(const BitSet& set) - { - while (LA(1) != Token::EOF_TYPE && !set.member(LA(1))) - consume(); - } - - /** Make sure current lookahead symbol matches token type t. - * Throw an exception upon mismatch, which is catch by either the - * error handler or by the syntactic predicate. - */ - virtual void match(int t) - { - if ( DEBUG_PARSER ) - { - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "enter match(" << t << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; - } - if ( LA(1) != t ) - { - if ( DEBUG_PARSER ) - { - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << "!=" << t << ANTLR_USE_NAMESPACE(std)endl; - } - throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, false, getFilename()); - } - else - { - // mark token as consumed -- fetch next token deferred until LA/LT - consume(); - } - } - - virtual void matchNot(int t) - { - if ( LA(1)==t ) - { - // Throws inverted-sense exception - throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, true, getFilename()); - } - else - { - // mark token as consumed -- fetch next token deferred until LA/LT - consume(); - } - } - - /** Make sure current lookahead symbol matches the given set - * Throw an exception upon mismatch, which is catch by either the - * error handler or by the syntactic predicate. - */ - virtual void match(const BitSet& b) - { - if ( DEBUG_PARSER ) - { - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "enter match(" << "bitset" /*b.toString()*/ - << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; - } - if ( !b.member(LA(1)) ) - { - if ( DEBUG_PARSER ) - { - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << " not member of " - << "bitset" /*b.toString()*/ << ANTLR_USE_NAMESPACE(std)endl; - } - throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), b, false, getFilename()); - } - else - { - // mark token as consumed -- fetch next token deferred until LA/LT - consume(); - } - } - - /** Mark a spot in the input and return the position. - * Forwarded to TokenBuffer. - */ - virtual inline unsigned int mark() - { - return inputState->getInput().mark(); - } - /// rewind to a previously marked position - virtual inline void rewind(unsigned int pos) - { - inputState->getInput().rewind(pos); - } - /** called by the generated parser to do error recovery, override to - * customize the behaviour. - */ - virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) - { - (void)ex; - consume(); - consumeUntil(tokenSet); - } - - /// Parser error-reporting function can be overridden in subclass - virtual void reportError(const RecognitionException& ex); - /// Parser error-reporting function can be overridden in subclass - virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); - /// Parser warning-reporting function can be overridden in subclass - virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); - - /// get the token name for the token number 'num' - virtual const char* getTokenName(int num) const = 0; - /// get a vector with all token names - virtual const char* const* getTokenNames() const = 0; - /** Get the number of tokens defined. - * This one should be overridden in subclasses. - */ - virtual int getNumTokens(void) const = 0; - - /** Set or change the input token buffer */ -// void setTokenBuffer(TokenBuffer* t); - - virtual void traceIndent(); - virtual void traceIn(const char* rname); - virtual void traceOut(const char* rname); -protected: -// void setTokenNames(const char** tokenNames_); - - ParserSharedInputState inputState; - -// /// AST return value for a rule is squirreled away here -// RefAST returnAST; - - /// AST support code; parser and treeparser delegate to this object - ASTFactory *astFactory; - - // used to keep track of the indentation for the trace - int traceDepth; - - /** Utility class which allows tracing to work even when exceptions are - * thrown. - */ - class Tracer { /*{{{*/ - private: - Parser* parser; - const char* text; - public: - Tracer(Parser* p,const char * t) - : parser(p), text(t) - { - parser->traceIn(text); - } - ~Tracer() - { -#ifdef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION - // Only give trace if there's no uncaught exception.. - if(!ANTLR_USE_NAMESPACE(std)uncaught_exception()) -#endif - parser->traceOut(text); - } - private: - Tracer(const Tracer&); // undefined - const Tracer& operator=(const Tracer&); // undefined - /*}}}*/ - }; -private: - Parser(const Parser&); // undefined - const Parser& operator=(const Parser&); // undefined -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_Parser_hpp__ diff --git a/libs/antlr-2.7.7/antlr/ParserSharedInputState.hpp b/libs/antlr-2.7.7/antlr/ParserSharedInputState.hpp deleted file mode 100644 index d1f8d151..00000000 --- a/libs/antlr-2.7.7/antlr/ParserSharedInputState.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef INC_ParserSharedInputState_hpp__ -#define INC_ParserSharedInputState_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ParserSharedInputState.hpp#2 $ - */ - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object contains the data associated with an - * input stream of tokens. Multiple parsers - * share a single ParserSharedInputState to parse - * the same stream of tokens. - */ -class ANTLR_API ParserInputState { -public: - /** Construct a new ParserInputState - * @param in the TokenBuffer to read from. The object is deleted together - * with the ParserInputState object. - */ - ParserInputState( TokenBuffer* in ) - : guessing(0) - , filename() - , input(in) - , inputResponsible(true) - { - } - /** Construct a new ParserInputState - * @param in the TokenBuffer to read from. - */ - ParserInputState( TokenBuffer& in ) - : guessing(0) - , filename("") - , input(&in) - , inputResponsible(false) - { - } - - virtual ~ParserInputState() - { - if (inputResponsible) - delete input; - } - - TokenBuffer& getInput( void ) - { - return *input; - } - - /// Reset the ParserInputState and the underlying TokenBuffer - void reset( void ) - { - input->reset(); - guessing = 0; - } - -public: - /** Are we guessing (guessing>0)? */ - int guessing; - /** What file (if known) caused the problem? - * @todo wrap this one.. - */ - ANTLR_USE_NAMESPACE(std)string filename; -private: - /** Where to get token objects */ - TokenBuffer* input; - /// Do we need to free the TokenBuffer or is it owned by another.. - bool inputResponsible; - - // we don't want these: - ParserInputState(const ParserInputState&); - ParserInputState& operator=(const ParserInputState&); -}; - -/// A reference counted ParserInputState -typedef RefCount ParserSharedInputState; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ParserSharedInputState_hpp__ diff --git a/libs/antlr-2.7.7/antlr/RecognitionException.hpp b/libs/antlr-2.7.7/antlr/RecognitionException.hpp deleted file mode 100644 index c131831b..00000000 --- a/libs/antlr-2.7.7/antlr/RecognitionException.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef INC_RecognitionException_hpp__ -# define INC_RecognitionException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/RecognitionException.hpp#2 $ - */ - -# include -# include - -# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr -{ -# endif - class ANTLR_API RecognitionException : public ANTLRException - { - public: - RecognitionException(); - RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s); - RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s, - const ANTLR_USE_NAMESPACE(std)string& fileName, - int line, int column ); - - virtual ~RecognitionException() throw() - { - } - - /// Return file where mishap occurred. - virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() - { - return fileName; - } - /** - * @return the line number that this exception happened on. - */ - virtual int getLine() const throw() - { - return line; - } - /** - * @return the column number that this exception happened on. - */ - virtual int getColumn() const throw() - { - return column; - } - - /// Return complete error message with line/column number info (if present) - virtual ANTLR_USE_NAMESPACE(std)string toString() const; - - /// See what file/line/column info is present and return it as a string - virtual ANTLR_USE_NAMESPACE(std)string getFileLineColumnString() const; - protected: - ANTLR_USE_NAMESPACE(std)string fileName; // not used by treeparsers - int line; // not used by treeparsers - int column; // not used by treeparsers - }; - -# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -# endif - -#endif //INC_RecognitionException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/RefCount.hpp b/libs/antlr-2.7.7/antlr/RefCount.hpp deleted file mode 100644 index 4a98d92c..00000000 --- a/libs/antlr-2.7.7/antlr/RefCount.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef INC_RefCount_hpp__ -#define INC_RefCount_hpp__ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/RefCount.hpp#2 $ - */ - -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -template -class ANTLR_API RefCount { -private: - struct Ref { - T* const ptr; - unsigned int count; - - Ref(T* p) : ptr(p), count(1) {} - ~Ref() {delete ptr;} - Ref* increment() {++count;return this;} - bool decrement() {return (--count==0);} - private: - Ref(const Ref&); - Ref& operator=(const Ref&); - }* ref; - -public: - explicit RefCount(T* p = 0) - : ref(p ? new Ref(p) : 0) - { - } - RefCount(const RefCount& other) - : ref(other.ref ? other.ref->increment() : 0) - { - } - ~RefCount() - { - if (ref && ref->decrement()) - delete ref; - } - RefCount& operator=(const RefCount& other) - { - Ref* tmp = other.ref ? other.ref->increment() : 0; - if (ref && ref->decrement()) - delete ref; - ref = tmp; - return *this; - } - - operator T* () const - { - return ref ? ref->ptr : 0; - } - - T* operator->() const - { - return ref ? ref->ptr : 0; - } - - T* get() const - { - return ref ? ref->ptr : 0; - } - - template operator RefCount() - { - return RefCount(ref); - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_RefCount_hpp__ diff --git a/libs/antlr-2.7.7/antlr/SemanticException.hpp b/libs/antlr-2.7.7/antlr/SemanticException.hpp deleted file mode 100644 index c8e9ea39..00000000 --- a/libs/antlr-2.7.7/antlr/SemanticException.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef INC_SemanticException_hpp__ -#define INC_SemanticException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/SemanticException.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API SemanticException : public RecognitionException { -public: - SemanticException(const ANTLR_USE_NAMESPACE(std)string& s) - : RecognitionException(s) - { - } - SemanticException(const ANTLR_USE_NAMESPACE(std)string& s, - const ANTLR_USE_NAMESPACE(std)string& fileName_, - int line_,int column_) - : RecognitionException(s,fileName_,line_,column_) - { - } - - ~SemanticException() throw() - { - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_SemanticException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/String.hpp b/libs/antlr-2.7.7/antlr/String.hpp deleted file mode 100644 index b3da3c33..00000000 --- a/libs/antlr-2.7.7/antlr/String.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef INC_String_hpp__ -#define INC_String_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/String.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -ANTLR_API ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, const int rhs ); -ANTLR_API ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, size_t rhs ); - -ANTLR_API ANTLR_USE_NAMESPACE(std)string charName( int ch ); - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_String_hpp__ diff --git a/libs/antlr-2.7.7/antlr/Token.hpp b/libs/antlr-2.7.7/antlr/Token.hpp deleted file mode 100644 index 33406425..00000000 --- a/libs/antlr-2.7.7/antlr/Token.hpp +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef INC_Token_hpp__ -#define INC_Token_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/Token.hpp#2 $ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -struct TokenRef; - -/** A token is minimally a token type. Subclasses can add the text matched - * for the token and line info. - */ -class ANTLR_API Token -{ -public: - // constants -#ifndef NO_STATIC_CONSTS - static const int MIN_USER_TYPE = 4; - static const int NULL_TREE_LOOKAHEAD = 3; - static const int INVALID_TYPE = 0; - static const int EOF_TYPE = 1; - static const int SKIP = -1; -#else - enum { - MIN_USER_TYPE = 4, - NULL_TREE_LOOKAHEAD = 3, - INVALID_TYPE = 0, - EOF_TYPE = 1, - SKIP = -1 - }; -#endif - - Token() - : ref(0) - , type(INVALID_TYPE) - { - } - Token(int t) - : ref(0) - , type(t) - { - } - Token(int t, const ANTLR_USE_NAMESPACE(std)string& txt) - : ref(0) - , type(t) - { - setText(txt); - } - virtual ~Token() - { - } - - virtual int getColumn() const; - virtual int getLine() const; - virtual ANTLR_USE_NAMESPACE(std)string getText() const; - virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const; - virtual int getType() const; - - virtual void setColumn(int c); - - virtual void setLine(int l); - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& t); - virtual void setType(int t); - - virtual void setFilename( const std::string& file ); - - virtual ANTLR_USE_NAMESPACE(std)string toString() const; - -private: - friend struct TokenRef; - TokenRef* ref; - - int type; ///< the type of the token - - Token(RefToken other); - Token& operator=(const Token& other); - Token& operator=(RefToken other); - - Token(const Token&); -}; - -extern ANTLR_API RefToken nullToken; - -#ifdef NEEDS_OPERATOR_LESS_THAN -// RK: Added after 2.7.2 previously it was undefined. -// AL: what to return if l and/or r point to nullToken??? -inline bool operator<( RefToken l, RefToken r ) -{ - return nullToken == l ? ( nullToken == r ? false : true ) : l->getType() < r->getType(); -} -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_Token_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenBuffer.hpp b/libs/antlr-2.7.7/antlr/TokenBuffer.hpp deleted file mode 100644 index 948243f3..00000000 --- a/libs/antlr-2.7.7/antlr/TokenBuffer.hpp +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef INC_TokenBuffer_hpp__ -#define INC_TokenBuffer_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenBuffer.hpp#2 $ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**A Stream of Token objects fed to the parser from a TokenStream that can - * be rewound via mark()/rewind() methods. - *

- * A dynamic array is used to buffer up all the input tokens. Normally, - * "k" tokens are stored in the buffer. More tokens may be stored during - * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. - * Consumption of tokens is deferred. In other words, reading the next - * token is not done by conume(), but deferred until needed by LA or LT. - *

- * - * @todo: see if we can integrate this one with InputBuffer into one template - * or so. - * - * @see antlr.Token - * @see antlr.TokenStream - * @see antlr.TokenQueue - */ -class ANTLR_API TokenBuffer { -public: - /** Create a token buffer */ - TokenBuffer(TokenStream& input_); - virtual ~TokenBuffer(); - - /// Reset the input buffer to empty state - inline void reset( void ) - { - nMarkers = 0; - markerOffset = 0; - numToConsume = 0; - queue.clear(); - } - - /** Get a lookahead token value */ - int LA( unsigned int i ); - - /** Get a lookahead token */ - RefToken LT( unsigned int i ); - - /** Return an integer marker that can be used to rewind the buffer to - * its current state. - */ - unsigned int mark(); - - /**Rewind the token buffer to a marker. - * @param mark Marker returned previously from mark() - */ - void rewind(unsigned int mark); - - /** Mark another token for deferred consumption */ - inline void consume() - { - numToConsume++; - } - - /// Return the number of entries in the TokenBuffer - virtual unsigned int entries() const; - -private: - /** Ensure that the token buffer is sufficiently full */ - void fill(unsigned int amount); - /** Sync up deferred consumption */ - void syncConsume(); - -protected: - /// Token source - TokenStream& input; - - /// Number of active markers - unsigned int nMarkers; - - /// Additional offset used when markers are active - unsigned int markerOffset; - - /// Number of calls to consume() since last LA() or LT() call - unsigned int numToConsume; - - /// Circular queue with Tokens - CircularQueue queue; - -private: - TokenBuffer(const TokenBuffer& other); - const TokenBuffer& operator=(const TokenBuffer& other); -}; - -/** Sync up deferred consumption */ -inline void TokenBuffer::syncConsume() -{ - if (numToConsume > 0) - { - if (nMarkers > 0) - markerOffset += numToConsume; - else - queue.removeItems( numToConsume ); - - numToConsume = 0; - } -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenBuffer_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenRefCount.hpp b/libs/antlr-2.7.7/antlr/TokenRefCount.hpp deleted file mode 100644 index 9ccbb98c..00000000 --- a/libs/antlr-2.7.7/antlr/TokenRefCount.hpp +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef INC_TokenRefCount_hpp__ -# define INC_TokenRefCount_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -# include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class Token; - -struct ANTLR_API TokenRef -{ - Token* const ptr; - unsigned int count; - - TokenRef(Token* p); - ~TokenRef(); - TokenRef* increment() - { - ++count; - return this; - } - bool decrement() - { - return (--count==0); - } - - static TokenRef* getRef(const Token* p); -private: - TokenRef( const TokenRef& ); - TokenRef& operator=( const TokenRef& ); -}; - -template - class ANTLR_API TokenRefCount -{ -private: - TokenRef* ref; - -public: - TokenRefCount(const Token* p=0) - : ref(p ? TokenRef::getRef(p) : 0) - { - } - TokenRefCount(const TokenRefCount& other) - : ref(other.ref ? other.ref->increment() : 0) - { - } - ~TokenRefCount() - { - if (ref && ref->decrement()) - delete ref; - } - TokenRefCount& operator=(Token* other) - { - TokenRef* tmp = TokenRef::getRef(other); - - if (ref && ref->decrement()) - delete ref; - - ref=tmp; - - return *this; - } - TokenRefCount& operator=(const TokenRefCount& other) - { - if( other.ref != ref ) - { - TokenRef* tmp = other.ref ? other.ref->increment() : 0; - - if (ref && ref->decrement()) - delete ref; - - ref=tmp; - } - return *this; - } - - operator T* () const { return ref ? static_cast(ref->ptr) : 0; } - T* operator->() const { return ref ? static_cast(ref->ptr) : 0; } - T* get() const { return ref ? static_cast(ref->ptr) : 0; } -}; - -typedef TokenRefCount RefToken; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenRefCount_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenStream.hpp b/libs/antlr-2.7.7/antlr/TokenStream.hpp deleted file mode 100644 index 3bec5986..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStream.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef INC_TokenStream_hpp__ -#define INC_TokenStream_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStream.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This interface allows any object to pretend it is a stream - * of tokens. - * @author Terence Parr, MageLang Institute - */ -class ANTLR_API TokenStream { -public: - virtual RefToken nextToken()=0; - virtual ~TokenStream() - { - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStream_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenStreamBasicFilter.hpp b/libs/antlr-2.7.7/antlr/TokenStreamBasicFilter.hpp deleted file mode 100644 index 839f97e5..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStreamBasicFilter.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef INC_TokenStreamBasicFilter_hpp__ -#define INC_TokenStreamBasicFilter_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamBasicFilter.hpp#2 $ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object is a TokenStream that passes through all - * tokens except for those that you tell it to discard. - * There is no buffering of the tokens. - */ -class ANTLR_API TokenStreamBasicFilter : public TokenStream { - /** The set of token types to discard */ -protected: - BitSet discardMask; - - /** The input stream */ -protected: - TokenStream* input; - -public: - TokenStreamBasicFilter(TokenStream& input_); - - void discard(int ttype); - - void discard(const BitSet& mask); - - RefToken nextToken(); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamBasicFilter_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenStreamException.hpp b/libs/antlr-2.7.7/antlr/TokenStreamException.hpp deleted file mode 100644 index a3f4d548..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStreamException.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef INC_TokenStreamException_hpp__ -#define INC_TokenStreamException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamException.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Baseclass for exceptions thrown by classes implementing the TokenStream - * interface. - * @see TokenStream - */ -class ANTLR_API TokenStreamException : public ANTLRException { -public: - TokenStreamException() - : ANTLRException() - { - } - TokenStreamException(const ANTLR_USE_NAMESPACE(std)string& s) - : ANTLRException(s) - { - } - virtual ~TokenStreamException() throw() - { - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenStreamHiddenTokenFilter.hpp b/libs/antlr-2.7.7/antlr/TokenStreamHiddenTokenFilter.hpp deleted file mode 100644 index 7ab5c826..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStreamHiddenTokenFilter.hpp +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef INC_TokenStreamHiddenTokenFilter_hpp__ -#define INC_TokenStreamHiddenTokenFilter_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamHiddenTokenFilter.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**This object filters a token stream coming from a lexer - * or another TokenStream so that only certain token channels - * get transmitted to the parser. - * - * Any of the channels can be filtered off as "hidden" channels whose - * tokens can be accessed from the parser. - */ -class ANTLR_API TokenStreamHiddenTokenFilter : public TokenStreamBasicFilter { - // protected BitSet discardMask; -protected: - BitSet hideMask; - -private: - RefToken nextMonitoredToken; - -protected: - /** track tail of hidden list emanating from previous - * monitored token - */ - RefToken lastHiddenToken; - - RefToken firstHidden; // = null; - -public: - TokenStreamHiddenTokenFilter(TokenStream& input); - -protected: - void consume(); - -private: - void consumeFirst(); - -public: - BitSet getDiscardMask() const; - - /** Return a ptr to the hidden token appearing immediately after - * token t in the input stream. - */ - RefToken getHiddenAfter(RefToken t); - - /** Return a ptr to the hidden token appearing immediately before - * token t in the input stream. - */ - RefToken getHiddenBefore(RefToken t); - - BitSet getHideMask() const; - - /** Return the first hidden token if one appears - * before any monitored token. - */ - RefToken getInitialHiddenToken(); - - void hide(int m); - - void hide(const BitSet& mask); - -protected: - RefToken LA(int i); - -public: -/** Return the next monitored token. - * Test the token following the monitored token. - * If following is another monitored token, save it - * for the next invocation of nextToken (like a single - * lookahead token) and return it then. - * If following is unmonitored, nondiscarded (hidden) - * channel token, add it to the monitored token. - * - * Note: EOF must be a monitored Token. - */ - RefToken nextToken(); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamHiddenTokenFilter_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenStreamIOException.hpp b/libs/antlr-2.7.7/antlr/TokenStreamIOException.hpp deleted file mode 100644 index 29f508bf..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStreamIOException.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef INC_TokenStreamIOException_hpp__ -#define INC_TokenStreamIOException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamIOException.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class TokenStreamIOException : public TokenStreamException { -public: - TokenStreamIOException() - : TokenStreamException() - { - } - TokenStreamIOException(const ANTLR_USE_NAMESPACE(std)exception& e) - : TokenStreamException(e.what()) - , io(e) - { - } - ~TokenStreamIOException() throw() - { - } -private: - ANTLR_USE_NAMESPACE(std)exception io; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamIOException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenStreamRecognitionException.hpp b/libs/antlr-2.7.7/antlr/TokenStreamRecognitionException.hpp deleted file mode 100644 index 39685789..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStreamRecognitionException.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef INC_TokenStreamRecognitionException_hpp__ -#define INC_TokenStreamRecognitionException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamRecognitionException.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Exception thrown from generated lexers when there's no default error - * handler specified. - * @see TokenStream - */ -class TokenStreamRecognitionException : public TokenStreamException { -public: - TokenStreamRecognitionException(RecognitionException& re) - : TokenStreamException(re.getMessage()) - , recog(re) - { - } - virtual ~TokenStreamRecognitionException() throw() - { - } - virtual ANTLR_USE_NAMESPACE(std)string toString() const - { - return recog.getFileLineColumnString()+getMessage(); - } - - virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() - { - return recog.getFilename(); - } - virtual int getLine() const throw() - { - return recog.getLine(); - } - virtual int getColumn() const throw() - { - return recog.getColumn(); - } -private: - RecognitionException recog; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamRecognitionException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenStreamRetryException.hpp b/libs/antlr-2.7.7/antlr/TokenStreamRetryException.hpp deleted file mode 100644 index 7d17b3cd..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStreamRetryException.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef INC_TokenStreamRetryException_hpp__ -#define INC_TokenStreamRetryException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamRetryException.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class TokenStreamRetryException : public TokenStreamException { -public: - TokenStreamRetryException() {} - ~TokenStreamRetryException() throw() {} -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamRetryException_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenStreamRewriteEngine.hpp b/libs/antlr-2.7.7/antlr/TokenStreamRewriteEngine.hpp deleted file mode 100644 index 9fab08c2..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStreamRewriteEngine.hpp +++ /dev/null @@ -1,439 +0,0 @@ -#ifndef INC_TokenStreamRewriteEngine_hpp__ -#define INC_TokenStreamRewriteEngine_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This token stream tracks the *entire* token stream coming from - * a lexer, but does not pass on the whitespace (or whatever else - * you want to discard) to the parser. - * - * This class can then be asked for the ith token in the input stream. - * Useful for dumping out the input stream exactly after doing some - * augmentation or other manipulations. Tokens are index from 0..n-1 - * - * You can insert stuff, replace, and delete chunks. Note that the - * operations are done lazily--only if you convert the buffer to a - * String. This is very efficient because you are not moving data around - * all the time. As the buffer of tokens is converted to strings, the - * toString() method(s) check to see if there is an operation at the - * current index. If so, the operation is done and then normal String - * rendering continues on the buffer. This is like having multiple Turing - * machine instruction streams (programs) operating on a single input tape. :) - * - * Since the operations are done lazily at toString-time, operations do not - * screw up the token index values. That is, an insert operation at token - * index i does not change the index values for tokens i+1..n-1. - * - * Because operations never actually alter the buffer, you may always get - * the original token stream back without undoing anything. Since - * the instructions are queued up, you can easily simulate transactions and - * roll back any changes if there is an error just by removing instructions. - * For example, - * - * TokenStreamRewriteEngine rewriteEngine = - * new TokenStreamRewriteEngine(lexer); - * JavaRecognizer parser = new JavaRecognizer(rewriteEngine); - * ... - * rewriteEngine.insertAfter("pass1", t, "foobar");} - * rewriteEngine.insertAfter("pass2", u, "start");} - * System.out.println(rewriteEngine.toString("pass1")); - * System.out.println(rewriteEngine.toString("pass2")); - * - * You can also have multiple "instruction streams" and get multiple - * rewrites from a single pass over the input. Just name the instruction - * streams and use that name again when printing the buffer. This could be - * useful for generating a C file and also its header file--all from the - * same buffer. - * - * If you don't use named rewrite streams, a "default" stream is used. - * - * Terence Parr, parrt@cs.usfca.edu - * University of San Francisco - * February 2004 - */ -class TokenStreamRewriteEngine : public TokenStream -{ -public: - typedef ANTLR_USE_NAMESPACE(std)vector token_list; - static const char* DEFAULT_PROGRAM_NAME; -#ifndef NO_STATIC_CONSTS - static const size_t MIN_TOKEN_INDEX; - static const int PROGRAM_INIT_SIZE; -#else - enum { - MIN_TOKEN_INDEX = 0, - PROGRAM_INIT_SIZE = 100 - }; -#endif - - struct tokenToStream { - tokenToStream( ANTLR_USE_NAMESPACE(std)ostream& o ) : out(o) {} - template void operator() ( const T& t ) { - out << t->getText(); - } - ANTLR_USE_NAMESPACE(std)ostream& out; - }; - - class RewriteOperation { - protected: - RewriteOperation( size_t idx, const ANTLR_USE_NAMESPACE(std)string& txt ) - : index(idx), text(txt) - { - } - public: - virtual ~RewriteOperation() - { - } - /** Execute the rewrite operation by possibly adding to the buffer. - * Return the index of the next token to operate on. - */ - virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& /* out */ ) { - return index; - } - virtual size_t getIndex() const { - return index; - } - virtual const char* type() const { - return "RewriteOperation"; - } - protected: - size_t index; - ANTLR_USE_NAMESPACE(std)string text; - }; - - struct executeOperation { - ANTLR_USE_NAMESPACE(std)ostream& out; - executeOperation( ANTLR_USE_NAMESPACE(std)ostream& s ) : out(s) {} - void operator () ( RewriteOperation* t ) { - t->execute(out); - } - }; - - /// list of rewrite operations - typedef ANTLR_USE_NAMESPACE(std)list operation_list; - /// map program name to tuple - typedef ANTLR_USE_NAMESPACE(std)map program_map; - - class InsertBeforeOp : public RewriteOperation - { - public: - InsertBeforeOp( size_t index, const ANTLR_USE_NAMESPACE(std)string& text ) - : RewriteOperation(index, text) - { - } - virtual ~InsertBeforeOp() {} - virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& out ) - { - out << text; - return index; - } - virtual const char* type() const { - return "InsertBeforeOp"; - } - }; - - class ReplaceOp : public RewriteOperation - { - public: - ReplaceOp(size_t from, size_t to, ANTLR_USE_NAMESPACE(std)string text) - : RewriteOperation(from,text) - , lastIndex(to) - { - } - virtual ~ReplaceOp() {} - virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& out ) { - out << text; - return lastIndex+1; - } - virtual const char* type() const { - return "ReplaceOp"; - } - protected: - size_t lastIndex; - }; - - class DeleteOp : public ReplaceOp { - public: - DeleteOp(size_t from, size_t to) - : ReplaceOp(from,to,"") - { - } - virtual const char* type() const { - return "DeleteOp"; - } - }; - - TokenStreamRewriteEngine(TokenStream& upstream); - - TokenStreamRewriteEngine(TokenStream& upstream, size_t initialSize); - - RefToken nextToken( void ); - - void rollback(size_t instructionIndex) { - rollback(DEFAULT_PROGRAM_NAME, instructionIndex); - } - - /** Rollback the instruction stream for a program so that - * the indicated instruction (via instructionIndex) is no - * longer in the stream. UNTESTED! - */ - void rollback(const ANTLR_USE_NAMESPACE(std)string& programName, - size_t instructionIndex ); - - void deleteProgram() { - deleteProgram(DEFAULT_PROGRAM_NAME); - } - - /** Reset the program so that no instructions exist */ - void deleteProgram(const ANTLR_USE_NAMESPACE(std)string& programName) { - rollback(programName, MIN_TOKEN_INDEX); - } - - void insertAfter( RefTokenWithIndex t, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - insertAfter(DEFAULT_PROGRAM_NAME, t, text); - } - - void insertAfter(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { - insertAfter(DEFAULT_PROGRAM_NAME, index, text); - } - - void insertAfter( const ANTLR_USE_NAMESPACE(std)string& programName, - RefTokenWithIndex t, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - insertAfter(programName, t->getIndex(), text); - } - - void insertAfter( const ANTLR_USE_NAMESPACE(std)string& programName, - size_t index, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - // to insert after, just insert before next index (even if past end) - insertBefore(programName,index+1, text); - } - - void insertBefore( RefTokenWithIndex t, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - // std::cout << "insertBefore index " << t->getIndex() << " " << text << std::endl; - insertBefore(DEFAULT_PROGRAM_NAME, t, text); - } - - void insertBefore(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { - insertBefore(DEFAULT_PROGRAM_NAME, index, text); - } - - void insertBefore( const ANTLR_USE_NAMESPACE(std)string& programName, - RefTokenWithIndex t, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - insertBefore(programName, t->getIndex(), text); - } - - void insertBefore( const ANTLR_USE_NAMESPACE(std)string& programName, - size_t index, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - addToSortedRewriteList(programName, new InsertBeforeOp(index,text)); - } - - void replace(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) - { - replace(DEFAULT_PROGRAM_NAME, index, index, text); - } - - void replace( size_t from, size_t to, - const ANTLR_USE_NAMESPACE(std)string& text) - { - replace(DEFAULT_PROGRAM_NAME, from, to, text); - } - - void replace( RefTokenWithIndex indexT, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - replace(DEFAULT_PROGRAM_NAME, indexT->getIndex(), indexT->getIndex(), text); - } - - void replace( RefTokenWithIndex from, - RefTokenWithIndex to, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - replace(DEFAULT_PROGRAM_NAME, from, to, text); - } - - void replace(const ANTLR_USE_NAMESPACE(std)string& programName, - size_t from, size_t to, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - addToSortedRewriteList(programName,new ReplaceOp(from, to, text)); - } - - void replace( const ANTLR_USE_NAMESPACE(std)string& programName, - RefTokenWithIndex from, - RefTokenWithIndex to, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - replace(programName, - from->getIndex(), - to->getIndex(), - text); - } - - void remove(size_t index) { - remove(DEFAULT_PROGRAM_NAME, index, index); - } - - void remove(size_t from, size_t to) { - remove(DEFAULT_PROGRAM_NAME, from, to); - } - - void remove(RefTokenWithIndex indexT) { - remove(DEFAULT_PROGRAM_NAME, indexT, indexT); - } - - void remove(RefTokenWithIndex from, RefTokenWithIndex to) { - remove(DEFAULT_PROGRAM_NAME, from, to); - } - - void remove( const ANTLR_USE_NAMESPACE(std)string& programName, - size_t from, size_t to) - { - replace(programName,from,to,""); - } - - void remove( const ANTLR_USE_NAMESPACE(std)string& programName, - RefTokenWithIndex from, RefTokenWithIndex to ) - { - replace(programName,from,to,""); - } - - void discard(int ttype) { - discardMask.add(ttype); - } - - RefToken getToken( size_t i ) - { - return RefToken(tokens.at(i)); - } - - size_t getTokenStreamSize() const { - return tokens.size(); - } - - void originalToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { - ANTLR_USE_NAMESPACE(std)for_each( tokens.begin(), tokens.end(), tokenToStream(out) ); - } - - void originalToStream( ANTLR_USE_NAMESPACE(std)ostream& out, - size_t start, size_t end ) const; - - void toStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { - toStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); - } - - void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, - const ANTLR_USE_NAMESPACE(std)string& programName ) const - { - toStream( out, programName, MIN_TOKEN_INDEX, getTokenStreamSize()); - } - - void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, - size_t start, size_t end ) const - { - toStream(out, DEFAULT_PROGRAM_NAME, start, end); - } - - void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, - const ANTLR_USE_NAMESPACE(std)string& programName, - size_t firstToken, size_t lastToken ) const; - - void toDebugStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { - toDebugStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); - } - - void toDebugStream( ANTLR_USE_NAMESPACE(std)ostream& out, - size_t start, size_t end ) const; - - size_t getLastRewriteTokenIndex() const { - return getLastRewriteTokenIndex(DEFAULT_PROGRAM_NAME); - } - - /** Return the last index for the program named programName - * return 0 if the program does not exist or the program is empty. - * (Note this is different from the java implementation that returns -1) - */ - size_t getLastRewriteTokenIndex(const ANTLR_USE_NAMESPACE(std)string& programName) const { - program_map::const_iterator rewrites = programs.find(programName); - - if( rewrites == programs.end() ) - return 0; - - const operation_list& prog = rewrites->second; - if( !prog.empty() ) - { - operation_list::const_iterator last = prog.end(); - --last; - return (*last)->getIndex(); - } - return 0; - } - -protected: - /** If op.index > lastRewriteTokenIndexes, just add to the end. - * Otherwise, do linear */ - void addToSortedRewriteList(RewriteOperation* op) { - addToSortedRewriteList(DEFAULT_PROGRAM_NAME, op); - } - - void addToSortedRewriteList( const ANTLR_USE_NAMESPACE(std)string& programName, - RewriteOperation* op ); - -protected: - /** Who do we suck tokens from? */ - TokenStream& stream; - /** track index of tokens */ - size_t index; - - /** Track the incoming list of tokens */ - token_list tokens; - - /** You may have multiple, named streams of rewrite operations. - * I'm calling these things "programs." - * Maps String (name) -> rewrite (List) - */ - program_map programs; - - /** Which (whitespace) token(s) to throw out */ - BitSet discardMask; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif diff --git a/libs/antlr-2.7.7/antlr/TokenStreamSelector.hpp b/libs/antlr-2.7.7/antlr/TokenStreamSelector.hpp deleted file mode 100644 index 4d4dd577..00000000 --- a/libs/antlr-2.7.7/antlr/TokenStreamSelector.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef INC_TokenStreamSelector_hpp__ -#define INC_TokenStreamSelector_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamSelector.hpp#2 $ - */ - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A token stream MUX (multiplexor) knows about n token streams - * and can multiplex them onto the same channel for use by token - * stream consumer like a parser. This is a way to have multiple - * lexers break up the same input stream for a single parser. - * Or, you can have multiple instances of the same lexer handle - * multiple input streams; this works great for includes. - */ -class ANTLR_API TokenStreamSelector : public TokenStream { -protected: - /** The set of inputs to the MUX */ -#ifdef OS_NO_ALLOCATOR - typedef ANTLR_USE_NAMESPACE(std)less lessp; - typedef ANTLR_USE_NAMESPACE(std)map inputStreamNames_coll; -#else - typedef ANTLR_USE_NAMESPACE(std)map inputStreamNames_coll; -#endif - inputStreamNames_coll inputStreamNames; - - /** The currently-selected token stream input */ - TokenStream* input; - - /** Used to track stack of input streams */ -#ifdef OS_NO_ALLOCATOR - typedef ANTLR_USE_NAMESPACE(std)stack > streamStack_coll; -#else - typedef ANTLR_USE_NAMESPACE(std)stack streamStack_coll; -#endif - streamStack_coll streamStack; - -public: - TokenStreamSelector(); - ~TokenStreamSelector(); - - void addInputStream(TokenStream* stream, const ANTLR_USE_NAMESPACE(std)string& key); - - /// Return the stream from which tokens are being pulled at the moment. - TokenStream* getCurrentStream() const; - - TokenStream* getStream(const ANTLR_USE_NAMESPACE(std)string& sname) const; - - RefToken nextToken(); - - TokenStream* pop(); - - void push(TokenStream* stream); - - void push(const ANTLR_USE_NAMESPACE(std)string& sname); - - /** Abort recognition of current Token and try again. - * A stream can push a new stream (for include files - * for example, and then retry(), which will cause - * the current stream to abort back to this.nextToken(). - * this.nextToken() then asks for a token from the - * current stream, which is the new "substream." - */ - void retry(); - - /** Set the stream without pushing old stream */ - void select(TokenStream* stream); - - void select(const ANTLR_USE_NAMESPACE(std)string& sname); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamSelector_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TokenWithIndex.hpp b/libs/antlr-2.7.7/antlr/TokenWithIndex.hpp deleted file mode 100644 index e4a3e37e..00000000 --- a/libs/antlr-2.7.7/antlr/TokenWithIndex.hpp +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef INC_TokenWithIndex_hpp__ -#define INC_TokenWithIndex_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API TokenWithIndex : public ANTLR_USE_NAMESPACE(antlr)CommonToken { -public: - // static size_t count; - TokenWithIndex() : CommonToken(), index(0) - { - // std::cout << __PRETTY_FUNCTION__ << std::endl; - // count++; - } - TokenWithIndex(int t, const ANTLR_USE_NAMESPACE(std)string& txt) - : CommonToken(t,txt) - , index(0) - { - // std::cout << __PRETTY_FUNCTION__ << std::endl; - // count++; - } - TokenWithIndex(const ANTLR_USE_NAMESPACE(std)string& s) - : CommonToken(s) - , index(0) - { - // std::cout << __PRETTY_FUNCTION__ << std::endl; - // count++; - } - ~TokenWithIndex() - { - // count--; - } - void setIndex( size_t idx ) - { - index = idx; - } - size_t getIndex( void ) const - { - return index; - } - - ANTLR_USE_NAMESPACE(std)string toString() const - { - return ANTLR_USE_NAMESPACE(std)string("[")+ - index+ - ":\""+ - getText()+"\",<"+ - getType()+">,line="+ - getLine()+",column="+ - getColumn()+"]"; - } - - static RefToken factory() - { - return RefToken(new TokenWithIndex()); - } - -protected: - size_t index; - -private: - TokenWithIndex(const TokenWithIndex&); - const TokenWithIndex& operator=(const TokenWithIndex&); -}; - -typedef TokenRefCount RefTokenWithIndex; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonToken_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TreeParser.hpp b/libs/antlr-2.7.7/antlr/TreeParser.hpp deleted file mode 100644 index b7dc5486..00000000 --- a/libs/antlr-2.7.7/antlr/TreeParser.hpp +++ /dev/null @@ -1,155 +0,0 @@ -#ifndef INC_TreeParser_hpp__ -#define INC_TreeParser_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TreeParser.hpp#2 $ - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API TreeParser { -public: - TreeParser() - : astFactory(0) - , inputState(new TreeParserInputState()) - , traceDepth(0) - { - } - - TreeParser(const TreeParserSharedInputState& state) - : astFactory(0) - , inputState(state) - , traceDepth(0) - { - } - - virtual ~TreeParser() - { - } - - /// Get the AST return value squirreled away in the parser - virtual RefAST getAST() = 0; - - /** Make sure current lookahead symbol matches the given set - * Throw an exception upon mismatch, which is caught by either the - * error handler or by a syntactic predicate. - */ - virtual void match(RefAST t, const BitSet& b) - { - if ( !t || t==ASTNULL || !b.member(t->getType()) ) - throw MismatchedTokenException( getTokenNames(), getNumTokens(), - t, b, false ); - } - - /** Specify the AST factory to be used during tree building. (Compulsory) - * Setting the factory is compulsory (if you intend to modify - * the tree in the treeparser). The AST Factory is shared between - * parser (who builds the initial AST) and treeparser. - * @see Parser::getASTFactory() - */ - virtual void setASTFactory(ASTFactory* factory) - { - astFactory = factory; - } - /// Return pointer to ASTFactory - virtual ASTFactory* getASTFactory() const - { - return astFactory; - } - /// Get the name for token 'num' - virtual const char* getTokenName(int num) const = 0; - /// Return the number of tokens defined - virtual int getNumTokens() const = 0; - /// Return an array of getNumTokens() token names - virtual const char* const* getTokenNames() const = 0; - - /// Parser error-reporting function can be overridden in subclass - virtual void reportError(const RecognitionException& ex); - /// Parser error-reporting function can be overridden in subclass - virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); - /// Parser warning-reporting function can be overridden in subclass - virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); - - /// These are used during when traceTreeParser commandline option is passed. - virtual void traceIndent(); - virtual void traceIn(const char* rname, RefAST t); - virtual void traceOut(const char* rname, RefAST t); - - /** The AST Null object; the parsing cursor is set to this when - * it is found to be null. This way, we can test the - * token type of a node without having to have tests for 0 - * everywhere. - */ - static RefAST ASTNULL; - -protected: - virtual void match(RefAST t, int ttype) - { - if (!t || t == ASTNULL || t->getType() != ttype ) - throw MismatchedTokenException( getTokenNames(), getNumTokens(), - t, ttype, false ); - } - - virtual void matchNot(RefAST t, int ttype) - { - if ( !t || t == ASTNULL || t->getType() == ttype ) - throw MismatchedTokenException( getTokenNames(), getNumTokens(), - t, ttype, true ); - } - - /** AST support code; parser and treeparser delegate to this object */ - ASTFactory* astFactory; - - /// The input state of this tree parser. - TreeParserSharedInputState inputState; - - /** Used to keep track of indent depth with -traceTreeParser */ - int traceDepth; - - /** Utility class which allows tracing to work even when exceptions are - * thrown. - */ - class Tracer { - private: - TreeParser* parser; - const char* text; - RefAST tree; - public: - Tracer(TreeParser* p, const char* t, RefAST a) - : parser(p), text(t), tree(a) - { - parser->traceIn(text,tree); - } - ~Tracer() - { - parser->traceOut(text,tree); - } - private: - Tracer(const Tracer&); // undefined - const Tracer& operator=(const Tracer&); // undefined - }; - -private: - // no copying of treeparser instantiations... - TreeParser(const TreeParser& other); - TreeParser& operator=(const TreeParser& other); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TreeParser_hpp__ diff --git a/libs/antlr-2.7.7/antlr/TreeParserSharedInputState.hpp b/libs/antlr-2.7.7/antlr/TreeParserSharedInputState.hpp deleted file mode 100644 index 5e7c4c28..00000000 --- a/libs/antlr-2.7.7/antlr/TreeParserSharedInputState.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_TreeParserSharedInputState_hpp__ -#define INC_TreeParserSharedInputState_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TreeParserSharedInputState.hpp#2 $ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object contains the data associated with an - * input AST. Multiple parsers - * share a single TreeParserSharedInputState to parse - * the same tree or to have the parser walk multiple - * trees. - */ -class ANTLR_API TreeParserInputState { -public: - TreeParserInputState() : guessing(0) {} - virtual ~TreeParserInputState() {} - -public: - /** Are we guessing (guessing>0)? */ - int guessing; //= 0; - -private: - // we don't want these: - TreeParserInputState(const TreeParserInputState&); - TreeParserInputState& operator=(const TreeParserInputState&); -}; - -typedef RefCount TreeParserSharedInputState; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TreeParserSharedInputState_hpp__ diff --git a/libs/antlr-2.7.7/antlr/config.hpp b/libs/antlr-2.7.7/antlr/config.hpp deleted file mode 100644 index e3369509..00000000 --- a/libs/antlr-2.7.7/antlr/config.hpp +++ /dev/null @@ -1,290 +0,0 @@ -#ifndef INC_config_hpp__ -#define INC_config_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/config.hpp#2 $ - */ - -/* - * Just a simple configuration file to differentiate between the - * various compilers used and reconfigure stuff for any oddities of the - * compiler in question. - * - * These are the defaults. Per compiler these are amended. - */ -#define ANTLR_USE_NAMESPACE(_x_) _x_:: -#define ANTLR_USING_NAMESPACE(_x_) using namespace _x_; -#define ANTLR_CXX_SUPPORTS_NAMESPACE 1 -#define ANTLR_C_USING(_x_) -#define ANTLR_API -#ifndef CUSTOM_API -# define CUSTOM_API -#endif -#define ANTLR_IOS_BASE ios_base -/** define if cctype functions/macros need a std:: prefix. A lot of compilers - * define these as macros, in which case something barfs. - */ -#define ANTLR_CCTYPE_NEEDS_STD - -/// Define if C++ compiler supports std::uncaught_exception -#define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION - -#define ANTLR_ATOI_IN_STD - -/******************************************************************************/ -/*{{{ Microsoft Visual C++ */ -// NOTE: If you provide patches for a specific MSVC version guard them for -// the specific version!!!! -// _MSC_VER == 1100 for Microsoft Visual C++ 5.0 -// _MSC_VER == 1200 for Microsoft Visual C++ 6.0 -// _MSC_VER == 1300 for Microsoft Visual C++ 7.0 -#if defined(_MSC_VER) - -# if _MSC_VER < 1300 -# define NOMINMAX -# pragma warning(disable : 4786) -# define min _cpp_min -# endif - -// This warning really gets on my nerves. -// It's the one about symbol longer than 256 chars, and it happens -// all the time with STL. -# pragma warning( disable : 4786 4231 ) -// this shuts up some DLL interface warnings for STL -# pragma warning( disable : 4251 ) - -# ifdef ANTLR_CXX_USE_STLPORT -# undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION -# endif - -# if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) ) -# error "DLL Build not supported on these MSVC versions." -// see comment in lib/cpp/src/dll.cpp -# endif - -// For the DLL support originally contributed by Stephen Naughton -// If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined -// If you are building the DLL define ANTLR_EXPORTS -// If you are compiling code to be used with the DLL define ANTLR_IMPORTS -# ifdef ANTLR_EXPORTS -# undef ANTLR_API -# define ANTLR_API __declspec(dllexport) -# endif - -# ifdef ANTLR_IMPORTS -# undef ANTLR_API -# define ANTLR_API __declspec(dllimport) -# endif - -# if ( _MSC_VER < 1200 ) -// supposedly only for MSVC5 and before... -// Using vector requires operator<(X,X) to be defined -# define NEEDS_OPERATOR_LESS_THAN -# endif - -// VC6 -# if ( _MSC_VER == 1200 ) -# undef ANTLR_ATOI_IN_STD -# endif - -# if ( _MSC_VER < 1310 ) -// Supposedly only for MSVC7 and before... -// Not allowed to put 'static const int XXX=20;' in a class definition -# define NO_STATIC_CONSTS -# define NO_TEMPLATE_PARTS -# endif - -// No strcasecmp in the C library (so use stricmp instead) -// - Anyone know which is in which standard? -# define NO_STRCASECMP -# undef ANTLR_CCTYPE_NEEDS_STD -# define NO_STATIC_CONSTS -#endif // End of Microsoft Visual C++ - -/*}}}*/ -/******************************************************************************/ -/*{{{ SunPro Compiler (Using OBJECTSPACE STL) - *****************************************************************************/ -#ifdef __SUNPRO_CC - -# if (__SUNPRO_CC >= 0x500) - -# define NEEDS_OPERATOR_LESS_THAN -# define NO_TEMPLATE_PARTS - -# else - -# undef namespace -# define namespace - -# if (__SUNPRO_CC == 0x420) - -/* This code is specif to SunWspro Compiler 4.2, and will compile with - the objectspace 2.1 toolkit for Solaris2.6 */ -# define HAS_NOT_CASSERT_H -# define HAS_NOT_CSTRING_H -# define HAS_NOT_CCTYPE_H -# define HAS_NOT_CSTDIO_H -# define HAS_OSTREAM_H - -/* #define OS_SOLARIS_2_6 - #define OS_NO_WSTRING - #define OS_NO_ALLOCATORS - #define OS_MULTI_THREADED - #define OS_SOLARIS_NATIVE - #define OS_REALTIME - #define __OSVERSION__=5 - #define SVR4 - */ - -// ObjectSpace + some specific templates constructions with stl. -/* #define OS_NO_ALLOCATOR */ - -// This great compiler does not have the namespace feature. -# undef ANTLR_USE_NAMESPACE -# define ANTLR_USE_NAMESPACE(_x_) -# undef ANTLR_USING_NAMESPACE -# define ANTLR_USING_NAMESPACE(_x_) -# undef ANTLR_CXX_SUPPORTS_NAMESPACE -# endif // End __SUNPRO_CC == 0x420 - -# undef explicit -# define explicit - -# define exception os_exception -# define bad_exception os_bad_exception - -// Not allowed to put 'static const int XXX=20;' in a class definition -# define NO_STATIC_CONSTS -// Using vector requires operator<(X,X) to be defined -# define NEEDS_OPERATOR_LESS_THAN - -# endif - -# undef ANTLR_CCTYPE_NEEDS_STD - -#endif // end __SUNPRO_CC -/*}}}*/ -/*****************************************************************************/ -/*{{{ Inprise C++ Builder 3.0 - *****************************************************************************/ -#ifdef __BCPLUSPLUS__ -# define NO_TEMPLATE_PARTS -# define NO_STRCASECMP -# undef ANTLR_CCTYPE_NEEDS_STD -#endif // End of C++ Builder 3.0 -/*}}}*/ -/*****************************************************************************/ -/*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library ) - *****************************************************************************/ -#ifdef __IBMCPP__ - -// No strcasecmp in the C library (so use stricmp instead) -// - Anyone know which is in which standard? -#if (defined(_AIX) && (__IBMCPP__ >= 600)) -# define NO_STATIC_CONSTS -#else -# define NO_STRCASECMP -# undef ANTLR_CCTYPE_NEEDS_STD -#endif - -#endif // end IBM VisualAge C++ -/*}}}*/ -/*****************************************************************************/ -/*{{{ Metrowerks Codewarrior - *****************************************************************************/ -#ifdef __MWERKS__ -# if (__MWERKS__ <= 0x2201) -# define NO_TEMPLATE_PARTS -# endif - -// CW 6.0 and 7.0 still do not have it. -# define ANTLR_REALLY_NO_STRCASECMP - -# undef ANTLR_C_USING -# define ANTLR_C_USING(_x_) using std:: ## _x_; - -# define ANTLR_CCTYPE_NEEDS_STD -# undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION - -#endif // End of Metrowerks Codewarrior -/*}}}*/ -/*****************************************************************************/ -/*{{{ SGI Irix 6.5.10 MIPSPro compiler - *****************************************************************************/ -// (contributed by Anna Winkler) -// Note: you can't compile ANTLR with the MIPSPro compiler on -// anything < 6.5.10 because SGI just fixed a big bug dealing with -// namespaces in that release. -#ifdef __sgi -# define HAS_NOT_CCTYPE_H -# define HAS_NOT_CSTRING_H -# define HAS_NOT_CSTDIO_H -# undef ANTLR_CCTYPE_NEEDS_STD -#endif // End IRIX MIPSPro -/*}}}*/ -/*****************************************************************************/ -/*{{{ G++ in various incarnations - *****************************************************************************/ -// With the gcc-2.95 and 3.0 being in the near future we should start handling -// incompatabilities between the various libstdc++'s. -#if defined(__GNUC__) || defined(__GNUG__) -// gcc 2 branch.. -# if (__GNUC__ == 2 ) -# if (__GNUC_MINOR__ <= 8 ) -# undef ANTLR_USE_NAMESPACE -# define ANTLR_USE_NAMESPACE(_x_) -# undef ANTLR_USING_NAMESPACE -# define ANTLR_USING_NAMESPACE(_x_) -# undef ANTLR_CXX_SUPPORTS_NAMESPACE -# endif -# if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 ) -# undef ANTLR_IOS_BASE -# define ANTLR_IOS_BASE ios -# undef ANTLR_CCTYPE_NEEDS_STD -// compiling with -ansi ? -# ifdef __STRICT_ANSI__ -# undef ANTLR_REALLY_NO_STRCASECMP -# define ANTLR_REALLY_NO_STRCASECMP -# endif -# else -// experimental .96 .97 branches.. -# undef ANTLR_CCTYPE_NEEDS_STD -# endif -# endif -#endif // ! __GNUC__ -/*}}}*/ -/*****************************************************************************/ -/*{{{ Digital CXX (Tru64) - *****************************************************************************/ -#ifdef __DECCXX -#define __USE_STD_IOSTREAM -#endif -/*}}}*/ -/*****************************************************************************/ -#ifdef __BORLANDC__ -# if __BORLANDC__ >= 560 -# include -# include -# define ANTLR_CCTYPE_NEEDS_STD -# else -# error "sorry, compiler is too old - consider an update." -# endif -#endif - -// Redefine these for backwards compatability.. -#undef ANTLR_BEGIN_NAMESPACE -#undef ANTLR_END_NAMESPACE - -#if ANTLR_CXX_SUPPORTS_NAMESPACE == 1 -# define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ { -# define ANTLR_END_NAMESPACE } -#else -# define ANTLR_BEGIN_NAMESPACE(_x_) -# define ANTLR_END_NAMESPACE -#endif - -#endif //INC_config_hpp__ diff --git a/libs/antlr-2.7.7/doxygen.cfg b/libs/antlr-2.7.7/doxygen.cfg deleted file mode 100644 index c88da52c..00000000 --- a/libs/antlr-2.7.7/doxygen.cfg +++ /dev/null @@ -1,101 +0,0 @@ -# -# Doxygen config file for ANTLR's C++ support libraries. -# -# Thanks to Bill Zheng for parts of this. -# -PROJECT_NAME = "ANTLR Support Libraries 2.7.1+" -# Input files: -INPUT = antlr src -RECURSIVE = YES -FILE_PATTERNS = *.cpp *.h *.hpp -JAVADOC_AUTOBRIEF = NO - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. -MACRO_EXPANSION = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. -INCLUDE_PATH = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. -PREDEFINED = "ANTLR_USE_NAMESPACE(_x_)=_x_::" \ - "ANTLR_USING_NAMESPACE(_x_)=using namespace _x_;" \ - "ANTLR_C_USING(_x_)=" \ - "ANTLR_API=" - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED tag. -EXPAND_ONLY_PREDEF = YES - -# Output options -OUTPUT_DIRECTORY = gen_doc -PAPER_TYPE = a4wide -#PAPER_TYPE = a4 -TAB_SIZE = 3 -CASE_SENSE_NAMES = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -REPEAT_BRIEF = YES - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. -INTERNAL_DOCS = NO - -# if the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# reimplements. -INHERIT_DOCS = YES - -# if the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. -INLINE_INFO = YES - -# Dot and friends... -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -EXTRACT_ALL = YES -EXTRACT_STATIC = YES -EXTRACT_PRIVATE = YES -# HTML output and friends... -GENERATE_HTML = YES -# Tree view gives too much trouble with various browsers. -GENERATE_TREEVIEW = NO -# Latex output and friends... -GENERATE_LATEX = NO -PDF_HYPERLINKS = YES -GENERATE_MAN = NO -GENERATE_RTF = NO -# Control of convenience stuff -GENERATE_TODOLIST = YES -# Control over warnings etc. Unset EXTRACT_ALL to get this to work -WARN_IF_UNDOCUMENTED = YES -WARNINGS = YES -QUIET = YES diff --git a/libs/antlr-2.7.7/src/ANTLRUtil.cpp b/libs/antlr-2.7.7/src/ANTLRUtil.cpp deleted file mode 100644 index 489ac590..00000000 --- a/libs/antlr-2.7.7/src/ANTLRUtil.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -#include -#include - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Eat whitespace from the input stream - * @param is the stream to read from - */ -ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is ) -{ - char c; - while( is.get(c) ) - { -#ifdef ANTLR_CCTYPE_NEEDS_STD - if( !ANTLR_USE_NAMESPACE(std)isspace(c) ) -#else - if( !isspace(c) ) -#endif - { - is.putback(c); - break; - } - } - return is; -} - -/** Read a string enclosed by '"' from a stream. Also handles escaping of \". - * Skips leading whitespace. - * @param in the istream to read from. - * @returns the string read from file exclusive the '"' - * @throws IOException if string is badly formatted - */ -ANTLR_USE_NAMESPACE(std)string read_string( ANTLR_USE_NAMESPACE(std)istream& in ) -{ - char ch; - ANTLR_USE_NAMESPACE(std)string ret(""); - // States for a simple state machine... - enum { START, READING, ESCAPE, FINISHED }; - int state = START; - - eatwhite(in); - - while( state != FINISHED && in.get(ch) ) - { - switch( state ) - { - case START: - // start state: check wether starting with " then switch to READING - if( ch != '"' ) - throw IOException("string must start with '\"'"); - state = READING; - continue; - case READING: - // reading state: look out for escape sequences and closing " - if( ch == '\\' ) // got escape sequence - { - state = ESCAPE; - continue; - } - if( ch == '"' ) // close quote -> stop - { - state = FINISHED; - continue; - } - ret += ch; // else append... - continue; - case ESCAPE: - switch(ch) - { - case '\\': - ret += ch; - state = READING; - continue; - case '"': - ret += ch; - state = READING; - continue; - case '0': - ret += '\0'; - state = READING; - continue; - default: // unrecognized escape is not mapped - ret += '\\'; - ret += ch; - state = READING; - continue; - } - } - } - if( state != FINISHED ) - throw IOException("badly formatted string: "+ret); - - return ret; -} - -/* Read a ([A-Z][0-9][a-z]_)* kindoff thing. Skips leading whitespace. - * @param in the istream to read from. - */ -ANTLR_USE_NAMESPACE(std)string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in ) -{ - char ch; - ANTLR_USE_NAMESPACE(std)string ret(""); - - eatwhite(in); - - while( in.get(ch) ) - { -#ifdef ANTLR_CCTYPE_NEEDS_STD - if( ANTLR_USE_NAMESPACE(std)isupper(ch) || - ANTLR_USE_NAMESPACE(std)islower(ch) || - ANTLR_USE_NAMESPACE(std)isdigit(ch) || - ch == '_' ) -#else - if( isupper(ch) || islower(ch) || isdigit(ch) || ch == '_' ) -#endif - ret += ch; - else - { - in.putback(ch); - break; - } - } - return ret; -} - -/** Read a attribute="value" thing. Leading whitespace is skipped. - * Between attribute and '=' no whitespace is allowed. After the '=' it is - * permitted. - * @param in the istream to read from. - * @param attribute string the attribute name is put in - * @param value string the value of the attribute is put in - * @throws IOException if something is fishy. E.g. malformed quoting - * or missing '=' - */ -void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in, - ANTLR_USE_NAMESPACE(std)string& attribute, - ANTLR_USE_NAMESPACE(std)string& value ) -{ - attribute = read_identifier(in); - - char ch; - if( in.get(ch) && ch == '=' ) - value = read_string(in); - else - throw IOException("invalid attribute=value thing "+attribute); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/ASTFactory.cpp b/libs/antlr-2.7.7/src/ASTFactory.cpp deleted file mode 100644 index 29451a40..00000000 --- a/libs/antlr-2.7.7/src/ASTFactory.cpp +++ /dev/null @@ -1,504 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/ASTFactory.cpp#2 $ - */ - -#include "antlr/CommonAST.hpp" -#include "antlr/ANTLRException.hpp" -#include "antlr/IOException.hpp" -#include "antlr/ASTFactory.hpp" -#include "antlr/ANTLRUtil.hpp" - -#include -#include - -using namespace std; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** AST Support code shared by TreeParser and Parser. - * We use delegation to share code (and have only one - * bit of code to maintain) rather than subclassing - * or superclassing (forces AST support code to be - * loaded even when you don't want to do AST stuff). - * - * This class collects all factories of AST types used inside the code. - * New AST node types are registered with the registerFactory method. - * On creation of an ASTFactory object a default AST node factory may be - * specified. - * - * When registering types gaps between different types are filled with entries - * for the default factory. - */ - -/// Initialize factory -ASTFactory::ASTFactory() -: default_factory_descriptor(ANTLR_USE_NAMESPACE(std)make_pair(CommonAST::TYPE_NAME,&CommonAST::factory)) -{ - nodeFactories.resize( Token::MIN_USER_TYPE, &default_factory_descriptor ); -} - -/** Initialize factory with a non default node type. - * factory_node_name should be the name of the AST node type the factory - * generates. (should exist during the existance of this ASTFactory instance) - */ -ASTFactory::ASTFactory( const char* factory_node_name, factory_type fact ) -: default_factory_descriptor(ANTLR_USE_NAMESPACE(std)make_pair(factory_node_name, fact)) -{ - nodeFactories.resize( Token::MIN_USER_TYPE, &default_factory_descriptor ); -} - -/// Delete ASTFactory -ASTFactory::~ASTFactory() -{ - factory_descriptor_list::iterator i = nodeFactories.begin(); - - while( i != nodeFactories.end() ) - { - if( *i != &default_factory_descriptor ) - delete *i; - i++; - } -} - -/// Register a factory for a given AST type -void ASTFactory::registerFactory( int type, const char* ast_name, factory_type factory ) -{ - // check validity of arguments... - if( type < Token::MIN_USER_TYPE ) - throw ANTLRException("Internal parser error invalid type passed to RegisterFactory"); - if( factory == 0 ) - throw ANTLRException("Internal parser error 0 factory passed to RegisterFactory"); - - // resize up to and including 'type' and initalize any gaps to default - // factory. - if( nodeFactories.size() < (static_cast(type)+1) ) - nodeFactories.resize( type+1, &default_factory_descriptor ); - - // And add new thing.. - nodeFactories[type] = new ANTLR_USE_NAMESPACE(std)pair( ast_name, factory ); -} - -void ASTFactory::setMaxNodeType( int type ) -{ - if( nodeFactories.size() < (static_cast(type)+1) ) - nodeFactories.resize( type+1, &default_factory_descriptor ); -} - -/** Create a new empty AST node; if the user did not specify - * an AST node type, then create a default one: CommonAST. - */ -RefAST ASTFactory::create() -{ - RefAST node = nodeFactories[0]->second(); - node->setType(Token::INVALID_TYPE); - return node; -} - -RefAST ASTFactory::create(int type) -{ - RefAST t = nodeFactories[type]->second(); - t->initialize(type,""); - return t; -} - -RefAST ASTFactory::create(int type, const ANTLR_USE_NAMESPACE(std)string& txt) -{ - RefAST t = nodeFactories[type]->second(); - t->initialize(type,txt); - return t; -} - -#ifdef ANTLR_SUPPORT_XML -RefAST ASTFactory::create(const ANTLR_USE_NAMESPACE(std)string& type_name, ANTLR_USE_NAMESPACE(std)istream& infile ) -{ - factory_descriptor_list::iterator fact = nodeFactories.begin(); - - while( fact != nodeFactories.end() ) - { - if( type_name == (*fact)->first ) - { - RefAST t = (*fact)->second(); - t->initialize(infile); - return t; - } - fact++; - } - - string error = "ASTFactory::create: Unknown AST type '" + type_name + "'"; - throw ANTLRException(error); -} -#endif - -/** Create a new empty AST node; if the user did not specify - * an AST node type, then create a default one: CommonAST. - */ -RefAST ASTFactory::create(RefAST tr) -{ - if (!tr) - return nullAST; - -// cout << "create(tr)" << endl; - - RefAST t = nodeFactories[tr->getType()]->second(); - t->initialize(tr); - return t; -} - -RefAST ASTFactory::create(RefToken tok) -{ -// cout << "create( tok="<< tok->getType() << ", " << tok->getText() << ")" << nodeFactories.size() << endl; - RefAST t = nodeFactories[tok->getType()]->second(); - t->initialize(tok); - return t; -} - -/** Add a child to the current AST */ -void ASTFactory::addASTChild(ASTPair& currentAST, RefAST child) -{ - if (child) - { - if (!currentAST.root) - { - // Make new child the current root - currentAST.root = child; - } - else - { - if (!currentAST.child) - { - // Add new child to current root - currentAST.root->setFirstChild(child); - } - else - { - currentAST.child->setNextSibling(child); - } - } - // Make new child the current child - currentAST.child = child; - currentAST.advanceChildToEnd(); - } -} - -/** Deep copy a single node. This function the new clone() methods in the AST - * interface. Returns nullAST if t is null. - */ -RefAST ASTFactory::dup(RefAST t) -{ - if( t ) - return t->clone(); - else - return RefAST(nullASTptr); -} - -/** Duplicate tree including siblings of root. */ -RefAST ASTFactory::dupList(RefAST t) -{ - RefAST result = dupTree(t); // if t == null, then result==null - RefAST nt = result; - - while( t ) - { // for each sibling of the root - t = t->getNextSibling(); - nt->setNextSibling(dupTree(t)); // dup each subtree, building new tree - nt = nt->getNextSibling(); - } - return result; -} - -/** Duplicate a tree, assuming this is a root node of a tree - * duplicate that node and what's below; ignore siblings of root node. - */ -RefAST ASTFactory::dupTree(RefAST t) -{ - RefAST result = dup(t); // make copy of root - // copy all children of root. - if( t ) - result->setFirstChild( dupList(t->getFirstChild()) ); - return result; -} - -/** Make a tree from a list of nodes. The first element in the - * array is the root. If the root is null, then the tree is - * a simple list not a tree. Handles null children nodes correctly. - * For example, make(a, b, null, c) yields tree (a b c). make(null,a,b) - * yields tree (nil a b). - */ -RefAST ASTFactory::make(ANTLR_USE_NAMESPACE(std)vector& nodes) -{ - if ( nodes.size() == 0 ) - return RefAST(nullASTptr); - - RefAST root = nodes[0]; - RefAST tail = RefAST(nullASTptr); - - if( root ) - root->setFirstChild(RefAST(nullASTptr)); // don't leave any old pointers set - - // link in children; - for( unsigned int i = 1; i < nodes.size(); i++ ) - { - if ( nodes[i] == 0 ) // ignore null nodes - continue; - - if ( root == 0 ) // Set the root and set it up for a flat list - root = tail = nodes[i]; - else if ( tail == 0 ) - { - root->setFirstChild(nodes[i]); - tail = root->getFirstChild(); - } - else - { - tail->setNextSibling(nodes[i]); - tail = tail->getNextSibling(); - } - - if( tail ) // RK: I cannot fathom why this missing check didn't bite anyone else... - { - // Chase tail to last sibling - while (tail->getNextSibling()) - tail = tail->getNextSibling(); - } - } - - return root; -} - -/** Make a tree from a list of nodes, where the nodes are contained - * in an ASTArray object - */ -RefAST ASTFactory::make(ASTArray* nodes) -{ - RefAST ret = make(nodes->array); - delete nodes; - return ret; -} - -/// Make an AST the root of current AST -void ASTFactory::makeASTRoot( ASTPair& currentAST, RefAST root ) -{ - if (root) - { - // Add the current root as a child of new root - root->addChild(currentAST.root); - // The new current child is the last sibling of the old root - currentAST.child = currentAST.root; - currentAST.advanceChildToEnd(); - // Set the new root - currentAST.root = root; - } -} - -void ASTFactory::setASTNodeFactory( const char* factory_node_name, - factory_type factory ) -{ - default_factory_descriptor.first = factory_node_name; - default_factory_descriptor.second = factory; -} - -#ifdef ANTLR_SUPPORT_XML -bool ASTFactory::checkCloseTag( ANTLR_USE_NAMESPACE(std)istream& in ) -{ - char ch; - - if( in.get(ch) ) - { - if( ch == '<' ) - { - char ch2; - if( in.get(ch2) ) - { - if( ch2 == '/' ) - { - in.putback(ch2); - in.putback(ch); - return true; - } - in.putback(ch2); - in.putback(ch); - return false; - } - } - in.putback(ch); - return false; - } - return false; -} - -void ASTFactory::loadChildren( ANTLR_USE_NAMESPACE(std)istream& infile, - RefAST current ) -{ - char ch; - - for(;;) // for all children of this node.... - { - eatwhite(infile); - - infile.get(ch); // '<' - if( ch != '<' ) - { - string error = "Invalid XML file... no '<' found ("; - error += ch + ")"; - throw IOException(error); - } - - infile.get(ch); // / or text.... - - if( ch == '/' ) // check for close tag... - { - string temp; - - // read until '>' and see if it matches the open tag... if not trouble - temp = read_identifier( infile ); - - if( strcmp(temp.c_str(), current->typeName() ) != 0 ) - { - string error = "Invalid XML file... close tag does not match start tag: "; - error += current->typeName(); - error += " closed by " + temp; - throw IOException(error); - } - - infile.get(ch); // must be a '>' - - if( ch != '>' ) - { - string error = "Invalid XML file... no '>' found ("; - error += ch + ")"; - throw IOException(error); - } - // close tag => exit loop - break; - } - - // put our 'look ahead' back where it came from - infile.putback(ch); - infile.putback('<'); - - // and recurse into the tree... - RefAST child = LoadAST(infile); - - current->addChild( child ); - } -} - -void ASTFactory::loadSiblings(ANTLR_USE_NAMESPACE(std)istream& infile, - RefAST current ) -{ - for(;;) - { - eatwhite(infile); - - if( infile.eof() ) - break; - - if( checkCloseTag(infile) ) - break; - - RefAST sibling = LoadAST(infile); - current->setNextSibling(sibling); - } -} - -RefAST ASTFactory::LoadAST( ANTLR_USE_NAMESPACE(std)istream& infile ) -{ - RefAST current = nullAST; - char ch; - - eatwhite(infile); - - if( !infile.get(ch) ) - return nullAST; - - if( ch != '<' ) - { - string error = "Invalid XML file... no '<' found ("; - error += ch + ")"; - throw IOException(error); - } - - string ast_type = read_identifier(infile); - - // create the ast of type 'ast_type' - current = create( ast_type, infile ); - if( current == nullAST ) - { - string error = "Unsuported AST type: " + ast_type; - throw IOException(error); - } - - eatwhite(infile); - - infile.get(ch); - - // now if we have a '/' here it's a single node. If it's a '>' we get - // a tree with children - - if( ch == '/' ) - { - infile.get(ch); // get the closing '>' - if( ch != '>' ) - { - string error = "Invalid XML file... no '>' found after '/' ("; - error += ch + ")"; - throw IOException(error); - } - - // get the rest on this level - loadSiblings( infile, current ); - - return current; - } - - // and finaly see if we got the close tag... - if( ch != '>' ) - { - string error = "Invalid XML file... no '>' found ("; - error += ch + ")"; - throw IOException(error); - } - - // handle the ones below this level.. - loadChildren( infile, current ); - - // load the rest on this level... - loadSiblings( infile, current ); - - return current; -} -#endif // ANTLR_SUPPORT_XML - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -/* Heterogeneous AST/XML-I/O ramblings... - * - * So there is some heterogeneous AST support.... - * basically in the code generators a new custom ast is generated without - * going throug the factory. It also expects the RefXAST to be defined. - * - * Is it maybe better to register all AST types with the ASTFactory class - * together with the respective factory methods. - * - * More and more I get the impression that hetero ast was a kindoff hack - * on top of ANTLR's normal AST system. - * - * The heteroast stuff will generate trouble for all astFactory.create( ... ) - * invocations. Most of this is handled via getASTCreateString methods in the - * codegenerator. At the moment getASTCreateString(GrammarAtom, String) has - * slightly to little info to do it's job (ok the hack that is in now - * works, but it's an ugly hack) - * - * An extra caveat is the 'nice' action.g thing. Which also judiciously calls - * getASTCreateString methods because it handles the #( ... ) syntax. - * And converts that to ASTFactory calls. - * - * - */ diff --git a/libs/antlr-2.7.7/src/ASTNULLType.cpp b/libs/antlr-2.7.7/src/ASTNULLType.cpp deleted file mode 100644 index 9e5426cb..00000000 --- a/libs/antlr-2.7.7/src/ASTNULLType.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -#include "antlr/config.hpp" -#include "antlr/AST.hpp" -#include "antlr/ASTNULLType.hpp" - -#include - -ANTLR_USING_NAMESPACE(std) - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -RefAST ASTNULLType::clone( void ) const -{ - return RefAST(this); -} - -void ASTNULLType::addChild( RefAST ) -{ -} - -size_t ASTNULLType::getNumberOfChildren() const -{ - return 0; -} - -bool ASTNULLType::equals( RefAST ) const -{ - return false; -} - -bool ASTNULLType::equalsList( RefAST ) const -{ - return false; -} - -bool ASTNULLType::equalsListPartial( RefAST ) const -{ - return false; -} - -bool ASTNULLType::equalsTree( RefAST ) const -{ - return false; -} - -bool ASTNULLType::equalsTreePartial( RefAST ) const -{ - return false; -} - -vector ASTNULLType::findAll( RefAST ) -{ - return vector(); -} - -vector ASTNULLType::findAllPartial( RefAST ) -{ - return vector(); -} - -RefAST ASTNULLType::getFirstChild() const -{ - return this; -} - -RefAST ASTNULLType::getNextSibling() const -{ - return this; -} - -string ASTNULLType::getText() const -{ - return ""; -} - -int ASTNULLType::getType() const -{ - return Token::NULL_TREE_LOOKAHEAD; -} - -void ASTNULLType::initialize( int, const string& ) -{ -} - -void ASTNULLType::initialize( RefAST ) -{ -} - -void ASTNULLType::initialize( RefToken ) -{ -} - -#ifdef ANTLR_SUPPORT_XML -void ASTNULLType::initialize( istream& ) -{ -} -#endif - -void ASTNULLType::setFirstChild( RefAST ) -{ -} - -void ASTNULLType::setNextSibling( RefAST ) -{ -} - -void ASTNULLType::setText( const string& ) -{ -} - -void ASTNULLType::setType( int ) -{ -} - -string ASTNULLType::toString() const -{ - return getText(); -} - -string ASTNULLType::toStringList() const -{ - return getText(); -} - -string ASTNULLType::toStringTree() const -{ - return getText(); -} - -#ifdef ANTLR_SUPPORT_XML -bool ASTNULLType::attributesToStream( ostream& ) const -{ - return false; -} - -void ASTNULLType::toStream( ostream& out ) const -{ - out << "" << endl; -} -#endif - -const char* ASTNULLType::typeName( void ) const -{ - return "ASTNULLType"; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/ASTRefCount.cpp b/libs/antlr-2.7.7/src/ASTRefCount.cpp deleted file mode 100644 index 340005bc..00000000 --- a/libs/antlr-2.7.7/src/ASTRefCount.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/ASTRefCount.cpp#2 $ - */ -#include "antlr/ASTRefCount.hpp" -#include "antlr/AST.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -ASTRef::ASTRef(AST* p) -: ptr(p), count(1) -{ - if (p && !p->ref) - p->ref = this; -} - -ASTRef::~ASTRef() -{ - delete ptr; -} - -ASTRef* ASTRef::getRef(const AST* p) -{ - if (p) { - AST* pp = const_cast(p); - if (pp->ref) - return pp->ref->increment(); - else - return new ASTRef(pp); - } else - return 0; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/BaseAST.cpp b/libs/antlr-2.7.7/src/BaseAST.cpp deleted file mode 100644 index 397933b3..00000000 --- a/libs/antlr-2.7.7/src/BaseAST.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/BaseAST.cpp#2 $ - */ - -#include "antlr/config.hpp" - -#include - -#include "antlr/AST.hpp" -#include "antlr/BaseAST.hpp" - -ANTLR_USING_NAMESPACE(std) -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -size_t BaseAST::getNumberOfChildren() const -{ - RefBaseAST t = this->down; - size_t n = 0; - if( t ) - { - n = 1; - while( t->right ) - { - t = t->right; - n++; - } - return n; - } - return n; -} - -void BaseAST::doWorkForFindAll( - ANTLR_USE_NAMESPACE(std)vector& v, - RefAST target,bool partialMatch) -{ - // Start walking sibling lists, looking for matches. - for (RefAST sibling=this; - sibling; - sibling=sibling->getNextSibling()) - { - if ( (partialMatch && sibling->equalsTreePartial(target)) || - (!partialMatch && sibling->equalsTree(target)) ) { - v.push_back(sibling); - } - // regardless of match or not, check any children for matches - if ( sibling->getFirstChild() ) { - RefBaseAST(sibling->getFirstChild())->doWorkForFindAll(v, target, partialMatch); - } - } -} - -/** Is t an exact structural and equals() match of this tree. The - * 'this' reference is considered the start of a sibling list. - */ -bool BaseAST::equalsList(RefAST t) const -{ - // the empty tree is not a match of any non-null tree. - if (!t) - return false; - - // Otherwise, start walking sibling lists. First mismatch, return false. - RefAST sibling=this; - for (;sibling && t; - sibling=sibling->getNextSibling(), t=t->getNextSibling()) { - // as a quick optimization, check roots first. - if (!sibling->equals(t)) - return false; - // if roots match, do full list match test on children. - if (sibling->getFirstChild()) { - if (!sibling->getFirstChild()->equalsList(t->getFirstChild())) - return false; - } - // sibling has no kids, make sure t doesn't either - else if (t->getFirstChild()) - return false; - } - - if (!sibling && !t) - return true; - - // one sibling list has more than the other - return false; -} - -/** Is 'sub' a subtree of this list? - * The siblings of the root are NOT ignored. - */ -bool BaseAST::equalsListPartial(RefAST sub) const -{ - // the empty tree is always a subset of any tree. - if (!sub) - return true; - - // Otherwise, start walking sibling lists. First mismatch, return false. - RefAST sibling=this; - for (;sibling && sub; - sibling=sibling->getNextSibling(), sub=sub->getNextSibling()) { - // as a quick optimization, check roots first. - if (!sibling->equals(sub)) - return false; - // if roots match, do partial list match test on children. - if (sibling->getFirstChild()) - if (!sibling->getFirstChild()->equalsListPartial(sub->getFirstChild())) - return false; - } - - if (!sibling && sub) - // nothing left to match in this tree, but subtree has more - return false; - - // either both are null or sibling has more, but subtree doesn't - return true; -} - -/** Is tree rooted at 'this' equal to 't'? The siblings - * of 'this' are ignored. - */ -bool BaseAST::equalsTree(RefAST t) const -{ - // check roots first - if (!equals(t)) - return false; - // if roots match, do full list match test on children. - if (getFirstChild()) { - if (!getFirstChild()->equalsList(t->getFirstChild())) - return false; - } - // sibling has no kids, make sure t doesn't either - else if (t->getFirstChild()) - return false; - - return true; -} - -/** Is 'sub' a subtree of the tree rooted at 'this'? The siblings - * of 'this' are ignored. - */ -bool BaseAST::equalsTreePartial(RefAST sub) const -{ - // the empty tree is always a subset of any tree. - if (!sub) - return true; - - // check roots first - if (!equals(sub)) - return false; - // if roots match, do full list partial match test on children. - if (getFirstChild()) - if (!getFirstChild()->equalsListPartial(sub->getFirstChild())) - return false; - - return true; -} - -/** Walk the tree looking for all exact subtree matches. Return - * an ASTEnumerator that lets the caller walk the list - * of subtree roots found herein. - */ -ANTLR_USE_NAMESPACE(std)vector BaseAST::findAll(RefAST target) -{ - ANTLR_USE_NAMESPACE(std)vector roots; - - // the empty tree cannot result in an enumeration - if (target) { - doWorkForFindAll(roots,target,false); // find all matches recursively - } - - return roots; -} - -/** Walk the tree looking for all subtrees. Return - * an ASTEnumerator that lets the caller walk the list - * of subtree roots found herein. - */ -ANTLR_USE_NAMESPACE(std)vector BaseAST::findAllPartial(RefAST target) -{ - ANTLR_USE_NAMESPACE(std)vector roots; - - // the empty tree cannot result in an enumeration - if (target) - doWorkForFindAll(roots,target,true); // find all matches recursively - - return roots; -} - -ANTLR_USE_NAMESPACE(std)string BaseAST::toStringList() const -{ - ANTLR_USE_NAMESPACE(std)string ts=""; - - if (getFirstChild()) - { - ts+=" ( "; - ts+=toString(); - ts+=getFirstChild()->toStringList(); - ts+=" )"; - } - else - { - ts+=" "; - ts+=toString(); - } - - if (getNextSibling()) - ts+=getNextSibling()->toStringList(); - - return ts; -} - -ANTLR_USE_NAMESPACE(std)string BaseAST::toStringTree() const -{ - ANTLR_USE_NAMESPACE(std)string ts = ""; - - if (getFirstChild()) - { - ts+=" ( "; - ts+=toString(); - ts+=getFirstChild()->toStringList(); - ts+=" )"; - } - else - { - ts+=" "; - ts+=toString(); - } - return ts; -} - -#ifdef ANTLR_SUPPORT_XML -/* This whole XML output stuff needs a little bit more thought - * I'd like to store extra XML data in the node. e.g. for custom ast's - * with for instance symboltable references. This - * should be more pluggable.. - * @returns boolean value indicating wether a closetag should be produced. - */ -bool BaseAST::attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const -{ - out << "text=\"" << this->getText() - << "\" type=\"" << this->getType() << "\""; - - return false; -} - -void BaseAST::toStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const -{ - for( RefAST node = this; node != 0; node = node->getNextSibling() ) - { - out << "<" << this->typeName() << " "; - - // Write out attributes and if there is extra data... - bool need_close_tag = node->attributesToStream( out ); - - if( need_close_tag ) - { - // got children so write them... - if( node->getFirstChild() != 0 ) - node->getFirstChild()->toStream( out ); - - // and a closing tag.. - out << "typeName() << ">" << endl; - } - } -} -#endif - -// this is nasty, but it makes the code generation easier -ANTLR_API RefAST nullAST; - -#if defined(_MSC_VER) && !defined(__ICL) // Microsoft Visual C++ -extern ANTLR_API AST* const nullASTptr = 0; -#else -ANTLR_API AST* const nullASTptr = 0; -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/BitSet.cpp b/libs/antlr-2.7.7/src/BitSet.cpp deleted file mode 100644 index d2808134..00000000 --- a/libs/antlr-2.7.7/src/BitSet.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/BitSet.cpp#2 $ - */ -#include "antlr/BitSet.hpp" -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -BitSet::BitSet(unsigned int nbits) -: storage(nbits) -{ - for (unsigned int i = 0; i < nbits ; i++ ) - storage[i] = false; -} - -BitSet::BitSet( const unsigned long* bits_, unsigned int nlongs ) -: storage(nlongs*32) -{ - for ( unsigned int i = 0 ; i < (nlongs * 32); i++) - storage[i] = (bits_[i>>5] & (1UL << (i&31))) ? true : false; -} - -BitSet::~BitSet() -{ -} - -void BitSet::add(unsigned int el) -{ - if( el >= storage.size() ) - storage.resize( el+1, false ); - - storage[el] = true; -} - -bool BitSet::member(unsigned int el) const -{ - if ( el >= storage.size()) - return false; - - return storage[el]; -} - -ANTLR_USE_NAMESPACE(std)vector BitSet::toArray() const -{ - ANTLR_USE_NAMESPACE(std)vector elems; - for (unsigned int i = 0; i < storage.size(); i++) - { - if (storage[i]) - elems.push_back(i); - } - - return elems; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/CharBuffer.cpp b/libs/antlr-2.7.7/src/CharBuffer.cpp deleted file mode 100644 index 5e1a71e0..00000000 --- a/libs/antlr-2.7.7/src/CharBuffer.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CharBuffer.cpp#2 $ - */ - -#include "antlr/CharBuffer.hpp" -#include - -//#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/* RK: Per default istream does not throw exceptions. This can be - * enabled with: - * stream.exceptions(ios_base::badbit|ios_base::failbit|ios_base::eofbit); - * - * We could try catching the bad/fail stuff. But handling eof via this is - * not a good idea. EOF is best handled as a 'normal' character. - * - * So this does not work yet with gcc... Comment it until I get to a platform - * that does.. - */ - -/** Create a character buffer. Enable fail and bad exceptions, if supported - * by platform. */ -CharBuffer::CharBuffer(ANTLR_USE_NAMESPACE(std)istream& input_) -: input(input_) -{ -// input.exceptions(ANTLR_USE_NAMESPACE(std)ios_base::badbit| -// ANTLR_USE_NAMESPACE(std)ios_base::failbit); -} - -/** Get the next character from the stream. May throw CharStreamIOException - * when something bad happens (not EOF) (if supported by platform). - */ -int CharBuffer::getChar() -{ -// try { - return input.get(); -// } -// catch (ANTLR_USE_NAMESPACE(std)ios_base::failure& e) { -// throw CharStreamIOException(e); -// } -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/CharScanner.cpp b/libs/antlr-2.7.7/src/CharScanner.cpp deleted file mode 100644 index 6d243139..00000000 --- a/libs/antlr-2.7.7/src/CharScanner.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CharScanner.cpp#2 $ - */ - -#include - -#include "antlr/CharScanner.hpp" -#include "antlr/CommonToken.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif -ANTLR_C_USING(exit) - -CharScanner::CharScanner(InputBuffer& cb, bool case_sensitive ) - : saveConsumedInput(true) //, caseSensitiveLiterals(true) - , caseSensitive(case_sensitive) - , literals(CharScannerLiteralsLess(this)) - , inputState(new LexerInputState(cb)) - , commitToPath(false) - , tabsize(8) - , traceDepth(0) -{ - setTokenObjectFactory(&CommonToken::factory); -} - -CharScanner::CharScanner(InputBuffer* cb, bool case_sensitive ) - : saveConsumedInput(true) //, caseSensitiveLiterals(true) - , caseSensitive(case_sensitive) - , literals(CharScannerLiteralsLess(this)) - , inputState(new LexerInputState(cb)) - , commitToPath(false) - , tabsize(8) - , traceDepth(0) -{ - setTokenObjectFactory(&CommonToken::factory); -} - -CharScanner::CharScanner( const LexerSharedInputState& state, bool case_sensitive ) - : saveConsumedInput(true) //, caseSensitiveLiterals(true) - , caseSensitive(case_sensitive) - , literals(CharScannerLiteralsLess(this)) - , inputState(state) - , commitToPath(false) - , tabsize(8) - , traceDepth(0) -{ - setTokenObjectFactory(&CommonToken::factory); -} - -/** Report exception errors caught in nextToken() */ -void CharScanner::reportError(const RecognitionException& ex) -{ - ANTLR_USE_NAMESPACE(std)cerr << ex.toString().c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -/** Parser error-reporting function can be overridden in subclass */ -void CharScanner::reportError(const ANTLR_USE_NAMESPACE(std)string& s) -{ - if (getFilename() == "") - ANTLR_USE_NAMESPACE(std)cerr << "error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; - else - ANTLR_USE_NAMESPACE(std)cerr << getFilename().c_str() << ": error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -/** Parser warning-reporting function can be overridden in subclass */ -void CharScanner::reportWarning(const ANTLR_USE_NAMESPACE(std)string& s) -{ - if (getFilename() == "") - ANTLR_USE_NAMESPACE(std)cerr << "warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; - else - ANTLR_USE_NAMESPACE(std)cerr << getFilename().c_str() << ": warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -void CharScanner::traceIndent() -{ - for( int i = 0; i < traceDepth; i++ ) - ANTLR_USE_NAMESPACE(std)cout << " "; -} - -void CharScanner::traceIn(const char* rname) -{ - traceDepth++; - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "> lexer " << rname - << "; c==" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; -} - -void CharScanner::traceOut(const char* rname) -{ - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "< lexer " << rname - << "; c==" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; - traceDepth--; -} - -#ifndef NO_STATIC_CONSTS -const int CharScanner::NO_CHAR; -const int CharScanner::EOF_CHAR; -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/CommonAST.cpp b/libs/antlr-2.7.7/src/CommonAST.cpp deleted file mode 100644 index 69d9ee91..00000000 --- a/libs/antlr-2.7.7/src/CommonAST.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonAST.cpp#2 $ - */ -#include "antlr/config.hpp" - -#include -#include - -#include "antlr/CommonAST.hpp" -#include "antlr/ANTLRUtil.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -const char* const CommonAST::TYPE_NAME = "CommonAST"; - -#ifdef ANTLR_SUPPORT_XML -void CommonAST::initialize( ANTLR_USE_NAMESPACE(std)istream& in ) -{ - ANTLR_USE_NAMESPACE(std)string t1, t2, text; - - // text - read_AttributeNValue( in, t1, text ); - - read_AttributeNValue( in, t1, t2 ); -#ifdef ANTLR_ATOI_IN_STD - int type = ANTLR_USE_NAMESPACE(std)atoi(t2.c_str()); -#else - int type = atoi(t2.c_str()); -#endif - - // initialize first part of AST. - this->initialize( type, text ); -} -#endif - -RefAST CommonAST::factory() -{ - return RefAST(new CommonAST); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/CommonASTWithHiddenTokens.cpp b/libs/antlr-2.7.7/src/CommonASTWithHiddenTokens.cpp deleted file mode 100644 index db2377bb..00000000 --- a/libs/antlr-2.7.7/src/CommonASTWithHiddenTokens.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonASTWithHiddenTokens.cpp#2 $ - */ -#include "antlr/config.hpp" -#include "antlr/AST.hpp" -#include "antlr/BaseAST.hpp" -#include "antlr/CommonAST.hpp" -#include "antlr/CommonASTWithHiddenTokens.hpp" -#include "antlr/CommonHiddenStreamToken.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -const char* const CommonASTWithHiddenTokens::TYPE_NAME = "CommonASTWithHiddenTokens"; -// RK: Do not put constructor and destructor into the header file here.. -// this triggers something very obscure in gcc 2.95.3 (and 3.0) -// missing vtables and stuff. -// Although this may be a problem with with binutils. -CommonASTWithHiddenTokens::CommonASTWithHiddenTokens() -: CommonAST() -{ -} - -CommonASTWithHiddenTokens::~CommonASTWithHiddenTokens() -{ -} - -void CommonASTWithHiddenTokens::initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt) -{ - CommonAST::initialize(t,txt); -} - -void CommonASTWithHiddenTokens::initialize(RefAST t) -{ - CommonAST::initialize(t); - hiddenBefore = RefCommonASTWithHiddenTokens(t)->getHiddenBefore(); - hiddenAfter = RefCommonASTWithHiddenTokens(t)->getHiddenAfter(); -} - -void CommonASTWithHiddenTokens::initialize(RefToken t) -{ - CommonAST::initialize(t); - hiddenBefore = static_cast(t.get())->getHiddenBefore(); - hiddenAfter = static_cast(t.get())->getHiddenAfter(); -} - -RefAST CommonASTWithHiddenTokens::factory() -{ - return RefAST(new CommonASTWithHiddenTokens); -} - -RefAST CommonASTWithHiddenTokens::clone( void ) const -{ - CommonASTWithHiddenTokens *ast = new CommonASTWithHiddenTokens( *this ); - return RefAST(ast); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/CommonHiddenStreamToken.cpp b/libs/antlr-2.7.7/src/CommonHiddenStreamToken.cpp deleted file mode 100644 index adf386bc..00000000 --- a/libs/antlr-2.7.7/src/CommonHiddenStreamToken.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonHiddenStreamToken.cpp#2 $ - */ -#include "antlr/CommonHiddenStreamToken.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -CommonHiddenStreamToken::CommonHiddenStreamToken() -: CommonToken() -{ -} - -CommonHiddenStreamToken::CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt) -: CommonToken(t,txt) -{ -} - -CommonHiddenStreamToken::CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s) -: CommonToken(s) -{ -} - -RefToken CommonHiddenStreamToken::getHiddenAfter() -{ - return hiddenAfter; -} - -RefToken CommonHiddenStreamToken::getHiddenBefore() -{ - return hiddenBefore; -} - -RefToken CommonHiddenStreamToken::factory() -{ - return RefToken(new CommonHiddenStreamToken); -} - -void CommonHiddenStreamToken::setHiddenAfter(RefToken t) -{ - hiddenAfter = t; -} - -void CommonHiddenStreamToken::setHiddenBefore(RefToken t) -{ - hiddenBefore = t; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/CommonToken.cpp b/libs/antlr-2.7.7/src/CommonToken.cpp deleted file mode 100644 index d49a0e28..00000000 --- a/libs/antlr-2.7.7/src/CommonToken.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonToken.cpp#2 $ - */ - -#include "antlr/CommonToken.hpp" -#include "antlr/String.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -CommonToken::CommonToken() : Token(), line(1), col(1), text("") -{} - -CommonToken::CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt) -: Token(t) -, line(1) -, col(1) -, text(txt) -{} - -CommonToken::CommonToken(const ANTLR_USE_NAMESPACE(std)string& s) -: Token() -, line(1) -, col(1) -, text(s) -{} - -ANTLR_USE_NAMESPACE(std)string CommonToken::toString() const -{ - return "[\""+getText()+"\",<"+getType()+">,line="+getLine()+",column="+getColumn()+"]"; -} - -RefToken CommonToken::factory() -{ - return RefToken(new CommonToken); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/InputBuffer.cpp b/libs/antlr-2.7.7/src/InputBuffer.cpp deleted file mode 100644 index bf34e5dd..00000000 --- a/libs/antlr-2.7.7/src/InputBuffer.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/InputBuffer.cpp#2 $ - */ - -#include "antlr/config.hpp" -#include "antlr/InputBuffer.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Ensure that the character buffer is sufficiently full */ -void InputBuffer::fill(unsigned int amount) -{ - syncConsume(); - // Fill the buffer sufficiently to hold needed characters - while (queue.entries() < amount + markerOffset) - { - // Append the next character - queue.append(getChar()); - } -} - -/** get the current lookahead characters as a string - * @warning it may treat 0 and EOF values wrong - */ -ANTLR_USE_NAMESPACE(std)string InputBuffer::getLAChars( void ) const -{ - ANTLR_USE_NAMESPACE(std)string ret; - - for(unsigned int i = markerOffset; i < queue.entries(); i++) - ret += queue.elementAt(i); - - return ret; -} - -/** get the current marked characters as a string - * @warning it may treat 0 and EOF values wrong - */ -ANTLR_USE_NAMESPACE(std)string InputBuffer::getMarkedChars( void ) const -{ - ANTLR_USE_NAMESPACE(std)string ret; - - for(unsigned int i = 0; i < markerOffset; i++) - ret += queue.elementAt(i); - - return ret; -} - -/** Return an integer marker that can be used to rewind the buffer to - * its current state. - */ -unsigned int InputBuffer::mark() -{ - syncConsume(); - nMarkers++; - return markerOffset; -} - -/** Rewind the character buffer to a marker. - * @param mark Marker returned previously from mark() - */ -void InputBuffer::rewind(unsigned int mark) -{ - syncConsume(); - markerOffset = mark; - nMarkers--; -} - -unsigned int InputBuffer::entries() const -{ - //assert(queue.entries() >= markerOffset); - return queue.entries() - markerOffset; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/LLkParser.cpp b/libs/antlr-2.7.7/src/LLkParser.cpp deleted file mode 100644 index 39926dc1..00000000 --- a/libs/antlr-2.7.7/src/LLkParser.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/LLkParser.cpp#2 $ - */ - -#include "antlr/LLkParser.hpp" -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -ANTLR_USING_NAMESPACE(std) - -/**An LL(k) parser. - * - * @see antlr.Token - * @see antlr.TokenBuffer - * @see antlr.LL1Parser - */ - -// LLkParser(int k_); - -LLkParser::LLkParser(const ParserSharedInputState& state, int k_) -: Parser(state), k(k_) -{ -} - -LLkParser::LLkParser(TokenBuffer& tokenBuf, int k_) -: Parser(tokenBuf), k(k_) -{ -} - -LLkParser::LLkParser(TokenStream& lexer, int k_) -: Parser(new TokenBuffer(lexer)), k(k_) -{ -} - -void LLkParser::trace(const char* ee, const char* rname) -{ - traceIndent(); - - cout << ee << rname << ((inputState->guessing>0)?"; [guessing]":"; "); - - for (int i = 1; i <= k; i++) - { - if (i != 1) { - cout << ", "; - } - cout << "LA(" << i << ")=="; - - string temp; - - try { - temp = LT(i)->getText().c_str(); - } - catch( ANTLRException& ae ) - { - temp = "[error: "; - temp += ae.toString(); - temp += ']'; - } - cout << temp; - } - - cout << endl; -} - -void LLkParser::traceIn(const char* rname) -{ - traceDepth++; - trace("> ",rname); -} - -void LLkParser::traceOut(const char* rname) -{ - trace("< ",rname); - traceDepth--; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/MismatchedCharException.cpp b/libs/antlr-2.7.7/src/MismatchedCharException.cpp deleted file mode 100644 index 6ca66e06..00000000 --- a/libs/antlr-2.7.7/src/MismatchedCharException.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/MismatchedCharException.cpp#2 $ - */ - -#include "antlr/CharScanner.hpp" -#include "antlr/MismatchedCharException.hpp" -#include "antlr/String.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -MismatchedCharException::MismatchedCharException() - : RecognitionException("Mismatched char") -{} - -// Expected range / not range -MismatchedCharException::MismatchedCharException( - int c, - int lower, - int upper_, - bool matchNot, - CharScanner* scanner_ -) : RecognitionException("Mismatched char", - scanner_->getFilename(), - scanner_->getLine(), scanner_->getColumn()) - , mismatchType(matchNot ? NOT_RANGE : RANGE) - , foundChar(c) - , expecting(lower) - , upper(upper_) - , scanner(scanner_) -{ -} - -// Expected token / not token -MismatchedCharException::MismatchedCharException( - int c, - int expecting_, - bool matchNot, - CharScanner* scanner_ -) : RecognitionException("Mismatched char", - scanner_->getFilename(), - scanner_->getLine(), scanner_->getColumn()) - , mismatchType(matchNot ? NOT_CHAR : CHAR) - , foundChar(c) - , expecting(expecting_) - , scanner(scanner_) -{ -} - -// Expected BitSet / not BitSet -MismatchedCharException::MismatchedCharException( - int c, - BitSet set_, - bool matchNot, - CharScanner* scanner_ -) : RecognitionException("Mismatched char", - scanner_->getFilename(), - scanner_->getLine(), scanner_->getColumn()) - , mismatchType(matchNot ? NOT_SET : SET) - , foundChar(c) - , set(set_) - , scanner(scanner_) -{ -} - -ANTLR_USE_NAMESPACE(std)string MismatchedCharException::getMessage() const -{ - ANTLR_USE_NAMESPACE(std)string s; - - switch (mismatchType) { - case CHAR : - s += "expecting '" + charName(expecting) + "', found '" + charName(foundChar) + "'"; - break; - case NOT_CHAR : - s += "expecting anything but '" + charName(expecting) + "'; got it anyway"; - break; - case RANGE : - s += "expecting token in range: '" + charName(expecting) + "'..'" + charName(upper) + "', found '" + charName(foundChar) + "'"; - break; - case NOT_RANGE : - s += "expecting token NOT in range: " + charName(expecting) + "'..'" + charName(upper) + "', found '" + charName(foundChar) + "'"; - break; - case SET : - case NOT_SET : - { - s += ANTLR_USE_NAMESPACE(std)string("expecting ") + (mismatchType == NOT_SET ? "NOT " : "") + "one of ("; - ANTLR_USE_NAMESPACE(std)vector elems = set.toArray(); - for ( unsigned int i = 0; i < elems.size(); i++ ) - { - s += " '"; - s += charName(elems[i]); - s += "'"; - } - s += "), found '" + charName(foundChar) + "'"; - } - break; - default : - s += RecognitionException::getMessage(); - break; - } - - return s; -} - -#ifndef NO_STATIC_CONSTS -const int MismatchedCharException::CHAR; -const int MismatchedCharException::NOT_CHAR; -const int MismatchedCharException::RANGE; -const int MismatchedCharException::NOT_RANGE; -const int MismatchedCharException::SET; -const int MismatchedCharException::NOT_SET; -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/MismatchedTokenException.cpp b/libs/antlr-2.7.7/src/MismatchedTokenException.cpp deleted file mode 100644 index 8fae8f07..00000000 --- a/libs/antlr-2.7.7/src/MismatchedTokenException.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/MismatchedTokenException.cpp#2 $ - */ - -#include "antlr/MismatchedTokenException.hpp" -#include "antlr/String.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -MismatchedTokenException::MismatchedTokenException() - : RecognitionException("Mismatched Token: expecting any AST node","",-1,-1) - , token(0) - , node(nullASTptr) - , tokenNames(0) - , numTokens(0) -{ -} - -// Expected range / not range -MismatchedTokenException::MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - int lower, - int upper_, - bool matchNot -) : RecognitionException("Mismatched Token","",-1,-1) - , token(0) - , node(node_) - , tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("")) ) - , mismatchType(matchNot ? NOT_RANGE : RANGE) - , expecting(lower) - , upper(upper_) - , tokenNames(tokenNames_) - , numTokens(numTokens_) -{ -} - -// Expected token / not token -MismatchedTokenException::MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - int expecting_, - bool matchNot -) : RecognitionException("Mismatched Token","",-1,-1) - , token(0) - , node(node_) - , tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("")) ) - , mismatchType(matchNot ? NOT_TOKEN : TOKEN) - , expecting(expecting_) - , tokenNames(tokenNames_) - , numTokens(numTokens_) -{ -} - -// Expected BitSet / not BitSet -MismatchedTokenException::MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - BitSet set_, - bool matchNot -) : RecognitionException("Mismatched Token","",-1,-1) - , token(0) - , node(node_) - , tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("")) ) - , mismatchType(matchNot ? NOT_SET : SET) - , set(set_) - , tokenNames(tokenNames_) - , numTokens(numTokens_) -{ -} - -// Expected range / not range -MismatchedTokenException::MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - int lower, - int upper_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ -) : RecognitionException("Mismatched Token",fileName_,token_->getLine(),token_->getColumn()) - , token(token_) - , node(nullASTptr) - , tokenText(token_->getText()) - , mismatchType(matchNot ? NOT_RANGE : RANGE) - , expecting(lower) - , upper(upper_) - , tokenNames(tokenNames_) - , numTokens(numTokens_) -{ -} - -// Expected token / not token -MismatchedTokenException::MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - int expecting_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ -) : RecognitionException("Mismatched Token",fileName_,token_->getLine(),token_->getColumn()) - , token(token_) - , node(nullASTptr) - , tokenText(token_->getText()) - , mismatchType(matchNot ? NOT_TOKEN : TOKEN) - , expecting(expecting_) - , tokenNames(tokenNames_) - , numTokens(numTokens_) -{ -} - -// Expected BitSet / not BitSet -MismatchedTokenException::MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - BitSet set_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ -) : RecognitionException("Mismatched Token",fileName_,token_->getLine(),token_->getColumn()) - , token(token_) - , node(nullASTptr) - , tokenText(token_->getText()) - , mismatchType(matchNot ? NOT_SET : SET) - , set(set_) - , tokenNames(tokenNames_) - , numTokens(numTokens_) -{ -} - -ANTLR_USE_NAMESPACE(std)string MismatchedTokenException::getMessage() const -{ - ANTLR_USE_NAMESPACE(std)string s; - switch (mismatchType) { - case TOKEN: - s += "expecting " + tokenName(expecting) + ", found '" + tokenText + "'"; - break; - case NOT_TOKEN: - s += "expecting anything but " + tokenName(expecting) + "; got it anyway"; - break; - case RANGE: - s += "expecting token in range: " + tokenName(expecting) + ".." + tokenName(upper) + ", found '" + tokenText + "'"; - break; - case NOT_RANGE: - s += "expecting token NOT in range: " + tokenName(expecting) + ".." + tokenName(upper) + ", found '" + tokenText + "'"; - break; - case SET: - case NOT_SET: - { - s += ANTLR_USE_NAMESPACE(std)string("expecting ") + (mismatchType == NOT_SET ? "NOT " : "") + "one of ("; - ANTLR_USE_NAMESPACE(std)vector elems = set.toArray(); - for ( unsigned int i = 0; i < elems.size(); i++ ) - { - s += " "; - s += tokenName(elems[i]); - } - s += "), found '" + tokenText + "'"; - } - break; - default: - s = RecognitionException::getMessage(); - break; - } - return s; -} - -ANTLR_USE_NAMESPACE(std)string MismatchedTokenException::tokenName(int tokenType) const -{ - if (tokenType == Token::INVALID_TYPE) - return ""; - else if (tokenType < 0 || tokenType >= numTokens) - return ANTLR_USE_NAMESPACE(std)string("<") + tokenType + ">"; - else - return tokenNames[tokenType]; -} - -#ifndef NO_STATIC_CONSTS -const int MismatchedTokenException::TOKEN; -const int MismatchedTokenException::NOT_TOKEN; -const int MismatchedTokenException::RANGE; -const int MismatchedTokenException::NOT_RANGE; -const int MismatchedTokenException::SET; -const int MismatchedTokenException::NOT_SET; -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/NoViableAltException.cpp b/libs/antlr-2.7.7/src/NoViableAltException.cpp deleted file mode 100644 index a41779d6..00000000 --- a/libs/antlr-2.7.7/src/NoViableAltException.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/NoViableAltException.cpp#2 $ - */ - -#include "antlr/NoViableAltException.hpp" -#include "antlr/String.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -ANTLR_USING_NAMESPACE(std) - -NoViableAltException::NoViableAltException(RefAST t) - : RecognitionException("NoViableAlt","",-1,-1), - token(0), node(t) -{ -} - -NoViableAltException::NoViableAltException( - RefToken t, - const ANTLR_USE_NAMESPACE(std)string& fileName_ -) : RecognitionException("NoViableAlt",fileName_,t->getLine(),t->getColumn()), - token(t), node(nullASTptr) -{ -} - -ANTLR_USE_NAMESPACE(std)string NoViableAltException::getMessage() const -{ - if (token) - { - if( token->getType() == Token::EOF_TYPE ) - return string("unexpected end of file"); - else if( token->getType() == Token::NULL_TREE_LOOKAHEAD ) - return string("unexpected end of tree"); - else - return string("unexpected token: ")+token->getText(); - } - - // must a tree parser error if token==null - if (!node) - return "unexpected end of subtree"; - - return string("unexpected AST node: ")+node->toString(); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/NoViableAltForCharException.cpp b/libs/antlr-2.7.7/src/NoViableAltForCharException.cpp deleted file mode 100644 index 0b2cf2d5..00000000 --- a/libs/antlr-2.7.7/src/NoViableAltForCharException.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/NoViableAltForCharException.cpp#2 $ - */ - -#include "antlr/NoViableAltForCharException.hpp" -#include "antlr/String.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -NoViableAltForCharException::NoViableAltForCharException(int c, CharScanner* scanner) - : RecognitionException("NoViableAlt", - scanner->getFilename(), - scanner->getLine(),scanner->getColumn()), - foundChar(c) -{ -} - -NoViableAltForCharException::NoViableAltForCharException( - int c, - const ANTLR_USE_NAMESPACE(std)string& fileName_, - int line_, int column_) - : RecognitionException("NoViableAlt",fileName_,line_,column_), - foundChar(c) -{ -} - -ANTLR_USE_NAMESPACE(std)string NoViableAltForCharException::getMessage() const -{ - return ANTLR_USE_NAMESPACE(std)string("unexpected char: ")+charName(foundChar); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/Parser.cpp b/libs/antlr-2.7.7/src/Parser.cpp deleted file mode 100644 index 02a68e72..00000000 --- a/libs/antlr-2.7.7/src/Parser.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/Parser.cpp#2 $ - */ - -#include "antlr/Parser.hpp" - -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A generic ANTLR parser (LL(k) for k>=1) containing a bunch of - * utility routines useful at any lookahead depth. We distinguish between - * the LL(1) and LL(k) parsers because of efficiency. This may not be - * necessary in the near future. - * - * Each parser object contains the state of the parse including a lookahead - * cache (the form of which is determined by the subclass), whether or - * not the parser is in guess mode, where tokens come from, etc... - * - *

- * During guess mode, the current lookahead token(s) and token type(s) - * cache must be saved because the token stream may not have been informed - * to save the token (via mark) before the try block. - * Guessing is started by: - *

    - *
  1. saving the lookahead cache. - *
  2. marking the current position in the TokenBuffer. - *
  3. increasing the guessing level. - *
- * - * After guessing, the parser state is restored by: - *
    - *
  1. restoring the lookahead cache. - *
  2. rewinding the TokenBuffer. - *
  3. decreasing the guessing level. - *
- * - * @see antlr.Token - * @see antlr.TokenBuffer - * @see antlr.TokenStream - * @see antlr.LL1Parser - * @see antlr.LLkParser - */ - -bool DEBUG_PARSER = false; - -/** Parser error-reporting function can be overridden in subclass */ -void Parser::reportError(const RecognitionException& ex) -{ - ANTLR_USE_NAMESPACE(std)cerr << ex.toString().c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -/** Parser error-reporting function can be overridden in subclass */ -void Parser::reportError(const ANTLR_USE_NAMESPACE(std)string& s) -{ - if ( getFilename()=="" ) - ANTLR_USE_NAMESPACE(std)cerr << "error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; - else - ANTLR_USE_NAMESPACE(std)cerr << getFilename().c_str() << ": error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -/** Parser warning-reporting function can be overridden in subclass */ -void Parser::reportWarning(const ANTLR_USE_NAMESPACE(std)string& s) -{ - if ( getFilename()=="" ) - ANTLR_USE_NAMESPACE(std)cerr << "warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; - else - ANTLR_USE_NAMESPACE(std)cerr << getFilename().c_str() << ": warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -/** Set or change the input token buffer */ -// void setTokenBuffer(TokenBuffer* t); - -void Parser::traceIndent() -{ - for( int i = 0; i < traceDepth; i++ ) - ANTLR_USE_NAMESPACE(std)cout << " "; -} - -void Parser::traceIn(const char* rname) -{ - traceDepth++; - - for( int i = 0; i < traceDepth; i++ ) - ANTLR_USE_NAMESPACE(std)cout << " "; - - ANTLR_USE_NAMESPACE(std)cout << "> " << rname - << "; LA(1)==" << LT(1)->getText().c_str() - << ((inputState->guessing>0)?" [guessing]":"") - << ANTLR_USE_NAMESPACE(std)endl; -} - -void Parser::traceOut(const char* rname) -{ - for( int i = 0; i < traceDepth; i++ ) - ANTLR_USE_NAMESPACE(std)cout << " "; - - ANTLR_USE_NAMESPACE(std)cout << "< " << rname - << "; LA(1)==" << LT(1)->getText().c_str() - << ((inputState->guessing>0)?" [guessing]":"") - << ANTLR_USE_NAMESPACE(std)endl; - - traceDepth--; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/RecognitionException.cpp b/libs/antlr-2.7.7/src/RecognitionException.cpp deleted file mode 100644 index c078c5c6..00000000 --- a/libs/antlr-2.7.7/src/RecognitionException.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/RecognitionException.cpp#2 $ - */ - -#include "antlr/RecognitionException.hpp" -#include "antlr/String.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -RecognitionException::RecognitionException() -: ANTLRException("parsing error") -, line(-1) -, column(-1) -{ -} - -RecognitionException::RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s) -: ANTLRException(s) -, line(-1) -, column(-1) -{ -} - -RecognitionException::RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s, - const ANTLR_USE_NAMESPACE(std)string& fileName_, - int line_,int column_) -: ANTLRException(s) -, fileName(fileName_) -, line(line_) -, column(column_) -{ -} - -ANTLR_USE_NAMESPACE(std)string RecognitionException::getFileLineColumnString() const -{ - ANTLR_USE_NAMESPACE(std)string fileLineColumnString; - - if ( fileName.length() > 0 ) - fileLineColumnString = fileName + ":"; - - if ( line != -1 ) - { - if ( fileName.length() == 0 ) - fileLineColumnString = fileLineColumnString + "line "; - - fileLineColumnString = fileLineColumnString + line; - - if ( column != -1 ) - fileLineColumnString = fileLineColumnString + ":" + column; - - fileLineColumnString = fileLineColumnString + ":"; - } - - fileLineColumnString = fileLineColumnString + " "; - - return fileLineColumnString; -} - -ANTLR_USE_NAMESPACE(std)string RecognitionException::toString() const -{ - return getFileLineColumnString()+getMessage(); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/String.cpp b/libs/antlr-2.7.7/src/String.cpp deleted file mode 100644 index e07b5fb5..00000000 --- a/libs/antlr-2.7.7/src/String.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/String.cpp#2 $ - */ - -#include "antlr/String.hpp" - -#include - -#ifdef HAS_NOT_CSTDIO_H -#include -#else -#include -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -// wh: hack for Borland C++ 5.6 -#if __BORLANDC__ - using std::sprintf; -#endif - - -// RK: should be using snprintf actually... (or stringstream) -ANTLR_C_USING(sprintf) - -ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, const int rhs ) -{ - char tmp[100]; - sprintf(tmp,"%d",rhs); - return lhs+tmp; -} - -ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, size_t rhs ) -{ - char tmp[100]; - sprintf(tmp,"%zu",rhs); - return lhs+tmp; -} - -/** Convert character to readable string - */ -ANTLR_USE_NAMESPACE(std)string charName(int ch) -{ - if (ch == EOF) - return "EOF"; - else - { - ANTLR_USE_NAMESPACE(std)string s; - - // when you think you've seen it all.. an isprint that crashes... - ch = ch & 0xFF; -#ifdef ANTLR_CCTYPE_NEEDS_STD - if( ANTLR_USE_NAMESPACE(std)isprint( ch ) ) -#else - if( isprint( ch ) ) -#endif - { - s.append("'"); - s += ch; - s.append("'"); -// s += "'"+ch+"'"; - } - else - { - s += "0x"; - - unsigned int t = ch >> 4; - if( t < 10 ) - s += t | 0x30; - else - s += t + 0x37; - t = ch & 0xF; - if( t < 10 ) - s += t | 0x30; - else - s += t + 0x37; - } - return s; - } -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/Token.cpp b/libs/antlr-2.7.7/src/Token.cpp deleted file mode 100644 index 8104813f..00000000 --- a/libs/antlr-2.7.7/src/Token.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/Token.cpp#2 $ - */ - -#include "antlr/Token.hpp" -#include "antlr/String.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -int Token::getColumn() const -{ - return 0; -} - -int Token::getLine() const -{ - return 0; -} - -ANTLR_USE_NAMESPACE(std)string Token::getText() const -{ - return ""; -} - -int Token::getType() const -{ - return type; -} - -void Token::setColumn(int) -{ -} - -void Token::setLine(int) -{ -} - -void Token::setText(const ANTLR_USE_NAMESPACE(std)string&) -{ -} - -void Token::setType(int t) -{ - type = t; -} - -void Token::setFilename(const ANTLR_USE_NAMESPACE(std)string&) -{ -} - -ANTLR_USE_NAMESPACE(std)string emptyString(""); - -const ANTLR_USE_NAMESPACE(std)string& Token::getFilename() const -{ - return emptyString; -} - -ANTLR_USE_NAMESPACE(std)string Token::toString() const -{ - return "[\""+getText()+"\",<"+type+">]"; -} - -ANTLR_API RefToken nullToken; - -#ifndef NO_STATIC_CONSTS -const int Token::MIN_USER_TYPE; -const int Token::NULL_TREE_LOOKAHEAD; -const int Token::INVALID_TYPE; -const int Token::EOF_TYPE; -const int Token::SKIP; -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/TokenBuffer.cpp b/libs/antlr-2.7.7/src/TokenBuffer.cpp deleted file mode 100644 index 96e4ada5..00000000 --- a/libs/antlr-2.7.7/src/TokenBuffer.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TokenBuffer.cpp#2 $ - */ - -#include "antlr/TokenBuffer.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**A Stream of Token objects fed to the parser from a TokenStream that can - * be rewound via mark()/rewind() methods. - *

- * A dynamic array is used to buffer up all the input tokens. Normally, - * "k" tokens are stored in the buffer. More tokens may be stored during - * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. - * Consumption of tokens is deferred. In other words, reading the next - * token is not done by conume(), but deferred until needed by LA or LT. - *

- * - * @see antlr.Token - * @see antlr.TokenStream - * @see antlr.TokenQueue - */ - -/** Create a token buffer */ -TokenBuffer::TokenBuffer( TokenStream& inp ) -: input(inp) -, nMarkers(0) -, markerOffset(0) -, numToConsume(0) -{ -} - -TokenBuffer::~TokenBuffer( void ) -{ -} - -/** Ensure that the token buffer is sufficiently full */ -void TokenBuffer::fill(unsigned int amount) -{ - syncConsume(); - // Fill the buffer sufficiently to hold needed tokens - while (queue.entries() < (amount + markerOffset)) - { - // Append the next token - queue.append(input.nextToken()); - } -} - -/** Get a lookahead token value */ -int TokenBuffer::LA(unsigned int i) -{ - fill(i); - return queue.elementAt(markerOffset+i-1)->getType(); -} - -/** Get a lookahead token */ -RefToken TokenBuffer::LT(unsigned int i) -{ - fill(i); - return queue.elementAt(markerOffset+i-1); -} - -/** Return an integer marker that can be used to rewind the buffer to - * its current state. - */ -unsigned int TokenBuffer::mark() -{ - syncConsume(); - nMarkers++; - return markerOffset; -} - -/**Rewind the token buffer to a marker. - * @param mark Marker returned previously from mark() - */ -void TokenBuffer::rewind(unsigned int mark) -{ - syncConsume(); - markerOffset=mark; - nMarkers--; -} - -/// Get number of non-consumed tokens -unsigned int TokenBuffer::entries() const -{ - return queue.entries() - markerOffset; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE - } -#endif diff --git a/libs/antlr-2.7.7/src/TokenRefCount.cpp b/libs/antlr-2.7.7/src/TokenRefCount.cpp deleted file mode 100644 index 0afb0f84..00000000 --- a/libs/antlr-2.7.7/src/TokenRefCount.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ -#include "antlr/TokenRefCount.hpp" -#include "antlr/Token.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -TokenRef::TokenRef(Token* p) -: ptr(p), count(1) -{ - if (p && !p->ref) - p->ref = this; -} - -TokenRef::~TokenRef() -{ - delete ptr; -} - -TokenRef* TokenRef::getRef(const Token* p) -{ - if (p) { - Token* pp = const_cast(p); - if (pp->ref) - return pp->ref->increment(); - else - return new TokenRef(pp); - } else - return 0; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/TokenStreamBasicFilter.cpp b/libs/antlr-2.7.7/src/TokenStreamBasicFilter.cpp deleted file mode 100644 index af306895..00000000 --- a/libs/antlr-2.7.7/src/TokenStreamBasicFilter.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TokenStreamBasicFilter.cpp#2 $ - */ -#include "antlr/TokenStreamBasicFilter.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object is a TokenStream that passes through all - * tokens except for those that you tell it to discard. - * There is no buffering of the tokens. - */ -TokenStreamBasicFilter::TokenStreamBasicFilter(TokenStream& input_) -: input(&input_) -{ -} - -void TokenStreamBasicFilter::discard(int ttype) -{ - discardMask.add(ttype); -} - -void TokenStreamBasicFilter::discard(const BitSet& mask) -{ - discardMask = mask; -} - -RefToken TokenStreamBasicFilter::nextToken() -{ - RefToken tok = input->nextToken(); - while ( tok && discardMask.member(tok->getType()) ) { - tok = input->nextToken(); - } - return tok; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/TokenStreamHiddenTokenFilter.cpp b/libs/antlr-2.7.7/src/TokenStreamHiddenTokenFilter.cpp deleted file mode 100644 index 2c3b69d0..00000000 --- a/libs/antlr-2.7.7/src/TokenStreamHiddenTokenFilter.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TokenStreamHiddenTokenFilter.cpp#2 $ - */ -#include "antlr/TokenStreamHiddenTokenFilter.hpp" -#include "antlr/CommonHiddenStreamToken.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**This object filters a token stream coming from a lexer - * or another TokenStream so that only certain token channels - * get transmitted to the parser. - * - * Any of the channels can be filtered off as "hidden" channels whose - * tokens can be accessed from the parser. - */ - -TokenStreamHiddenTokenFilter::TokenStreamHiddenTokenFilter(TokenStream& input) -: TokenStreamBasicFilter(input) -{ -} - -void TokenStreamHiddenTokenFilter::consume() -{ - nextMonitoredToken = input->nextToken(); -} - -void TokenStreamHiddenTokenFilter::consumeFirst() -{ - consume(); - - // Handle situation where hidden or discarded tokens - // appear first in input stream - RefToken p; - // while hidden or discarded scarf tokens - while ( hideMask.member(LA(1)->getType()) || discardMask.member(LA(1)->getType()) ) { - if ( hideMask.member(LA(1)->getType()) ) { - if ( !p ) { - p = LA(1); - } - else { - static_cast(p.get())->setHiddenAfter(LA(1)); - static_cast(LA(1).get())->setHiddenBefore(p); // double-link - p = LA(1); - } - lastHiddenToken = p; - if (!firstHidden) - firstHidden = p; // record hidden token if first - } - consume(); - } -} - -BitSet TokenStreamHiddenTokenFilter::getDiscardMask() const -{ - return discardMask; -} - -/** Return a ptr to the hidden token appearing immediately after - * token t in the input stream. - */ -RefToken TokenStreamHiddenTokenFilter::getHiddenAfter(RefToken t) -{ - return static_cast(t.get())->getHiddenAfter(); -} - -/** Return a ptr to the hidden token appearing immediately before - * token t in the input stream. - */ -RefToken TokenStreamHiddenTokenFilter::getHiddenBefore(RefToken t) -{ - return static_cast(t.get())->getHiddenBefore(); -} - -BitSet TokenStreamHiddenTokenFilter::getHideMask() const -{ - return hideMask; -} - -/** Return the first hidden token if one appears - * before any monitored token. - */ -RefToken TokenStreamHiddenTokenFilter::getInitialHiddenToken() -{ - return firstHidden; -} - -void TokenStreamHiddenTokenFilter::hide(int m) -{ - hideMask.add(m); -} - -void TokenStreamHiddenTokenFilter::hide(const BitSet& mask) -{ - hideMask = mask; -} - -RefToken TokenStreamHiddenTokenFilter::LA(int) -{ - return nextMonitoredToken; -} - -/** Return the next monitored token. -* Test the token following the monitored token. -* If following is another monitored token, save it -* for the next invocation of nextToken (like a single -* lookahead token) and return it then. -* If following is unmonitored, nondiscarded (hidden) -* channel token, add it to the monitored token. -* -* Note: EOF must be a monitored Token. -*/ -RefToken TokenStreamHiddenTokenFilter::nextToken() -{ - // handle an initial condition; don't want to get lookahead - // token of this splitter until first call to nextToken - if ( !LA(1) ) { - consumeFirst(); - } - - // we always consume hidden tokens after monitored, thus, - // upon entry LA(1) is a monitored token. - RefToken monitored = LA(1); - // point to hidden tokens found during last invocation - static_cast(monitored.get())->setHiddenBefore(lastHiddenToken); - lastHiddenToken = nullToken; - - // Look for hidden tokens, hook them into list emanating - // from the monitored tokens. - consume(); - RefToken p = monitored; - // while hidden or discarded scarf tokens - while ( hideMask.member(LA(1)->getType()) || discardMask.member(LA(1)->getType()) ) { - if ( hideMask.member(LA(1)->getType()) ) { - // attach the hidden token to the monitored in a chain - // link forwards - static_cast(p.get())->setHiddenAfter(LA(1)); - // link backwards - if (p != monitored) { //hidden cannot point to monitored tokens - static_cast(LA(1).get())->setHiddenBefore(p); - } - p = lastHiddenToken = LA(1); - } - consume(); - } - return monitored; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/TokenStreamRewriteEngine.cpp b/libs/antlr-2.7.7/src/TokenStreamRewriteEngine.cpp deleted file mode 100644 index c2411622..00000000 --- a/libs/antlr-2.7.7/src/TokenStreamRewriteEngine.cpp +++ /dev/null @@ -1,214 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -#ifndef NO_STATIC_CONSTS -const size_t TokenStreamRewriteEngine::MIN_TOKEN_INDEX = 0; -const int TokenStreamRewriteEngine::PROGRAM_INIT_SIZE = 100; -#endif - -const char* TokenStreamRewriteEngine::DEFAULT_PROGRAM_NAME = "default"; - -namespace { - - struct compareOperationIndex { - typedef TokenStreamRewriteEngine::RewriteOperation RewriteOperation; - bool operator() ( const RewriteOperation* a, const RewriteOperation* b ) const - { - return a->getIndex() < b->getIndex(); - } - }; - struct dumpTokenWithIndex { - dumpTokenWithIndex( ANTLR_USE_NAMESPACE(std)ostream& o ) : out(o) {} - void operator() ( const RefTokenWithIndex& t ) { - out << "[txt='" << t->getText() << "' tp=" << t->getType() << " idx=" << t->getIndex() << "]\n"; - } - ANTLR_USE_NAMESPACE(std)ostream& out; - }; -} - -TokenStreamRewriteEngine::TokenStreamRewriteEngine(TokenStream& upstream) -: stream(upstream) -, index(MIN_TOKEN_INDEX) -, tokens() -, programs() -, discardMask() -{ -} - -TokenStreamRewriteEngine::TokenStreamRewriteEngine(TokenStream& upstream, size_t initialSize ) -: stream(upstream) -, index(MIN_TOKEN_INDEX) -, tokens(initialSize) -, programs() -, discardMask() -{ -} - -RefToken TokenStreamRewriteEngine::nextToken( void ) -{ - RefTokenWithIndex t; - // suck tokens until end of stream or we find a non-discarded token - do { - t = RefTokenWithIndex(stream.nextToken()); - if ( t ) - { - t->setIndex(index); // what is t's index in list? - if ( t->getType() != Token::EOF_TYPE ) { - tokens.push_back(t); // track all tokens except EOF - } - index++; // move to next position - } - } while ( t && discardMask.member(t->getType()) ); - return RefToken(t); -} - -void TokenStreamRewriteEngine::rollback( const std::string& programName, - size_t instructionIndex ) -{ - program_map::iterator rewrite = programs.find(programName); - if( rewrite != programs.end() ) - { - operation_list& prog = rewrite->second; - operation_list::iterator - j = prog.begin(), - end = prog.end(); - - std::advance(j,instructionIndex); - if( j != end ) - prog.erase(j, end); - } -} - -void TokenStreamRewriteEngine::originalToStream( std::ostream& out, - size_t start, - size_t end ) const -{ - token_list::const_iterator s = tokens.begin(); - std::advance( s, start ); - token_list::const_iterator e = s; - std::advance( e, end-start ); - std::for_each( s, e, tokenToStream(out) ); -} - -void TokenStreamRewriteEngine::toStream( std::ostream& out, - const std::string& programName, - size_t firstToken, - size_t lastToken ) const -{ - if( tokens.size() == 0 ) - return; - - program_map::const_iterator rewriter = programs.find(programName); - - if ( rewriter == programs.end() ) - return; - - // get the prog and some iterators in it... - const operation_list& prog = rewriter->second; - operation_list::const_iterator - rewriteOpIndex = prog.begin(), - rewriteOpEnd = prog.end(); - - size_t tokenCursor = firstToken; - // make sure we don't run out of the tokens we have... - if( lastToken > (tokens.size() - 1) ) - lastToken = tokens.size() - 1; - - while ( tokenCursor <= lastToken ) - { - // std::cout << "tokenCursor = " << tokenCursor << " first prog index = " << (*rewriteOpIndex)->getIndex() << std::endl; - - if( rewriteOpIndex != rewriteOpEnd ) - { - size_t up_to_here = std::min(lastToken,(*rewriteOpIndex)->getIndex()); - while( tokenCursor < up_to_here ) - out << tokens[tokenCursor++]->getText(); - } - while ( rewriteOpIndex != rewriteOpEnd && - tokenCursor == (*rewriteOpIndex)->getIndex() && - tokenCursor <= lastToken ) - { - tokenCursor = (*rewriteOpIndex)->execute(out); - ++rewriteOpIndex; - } - if( tokenCursor <= lastToken ) - out << tokens[tokenCursor++]->getText(); - } - // std::cout << "Handling tail operations # left = " << std::distance(rewriteOpIndex,rewriteOpEnd) << std::endl; - // now see if there are operations (append) beyond last token index - std::for_each( rewriteOpIndex, rewriteOpEnd, executeOperation(out) ); - rewriteOpIndex = rewriteOpEnd; -} - -void TokenStreamRewriteEngine::toDebugStream( std::ostream& out, - size_t start, - size_t end ) const -{ - token_list::const_iterator s = tokens.begin(); - std::advance( s, start ); - token_list::const_iterator e = s; - std::advance( e, end-start ); - std::for_each( s, e, dumpTokenWithIndex(out) ); -} - -void TokenStreamRewriteEngine::addToSortedRewriteList( const std::string& programName, - RewriteOperation* op ) -{ - program_map::iterator rewrites = programs.find(programName); - // check if we got the program already.. - if ( rewrites == programs.end() ) - { - // no prog make a new one... - operation_list ops; - ops.push_back(op); - programs.insert(std::make_pair(programName,ops)); - return; - } - operation_list& prog = rewrites->second; - - if( prog.empty() ) - { - prog.push_back(op); - return; - } - - operation_list::iterator i, end = prog.end(); - i = end; - --i; - // if at or beyond last op's index, just append - if ( op->getIndex() >= (*i)->getIndex() ) { - prog.push_back(op); // append to list of operations - return; - } - i = prog.begin(); - - if( i != end ) - { - operation_list::iterator pos = std::upper_bound( i, end, op, compareOperationIndex() ); - prog.insert(pos,op); - } - else - prog.push_back(op); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/TokenStreamSelector.cpp b/libs/antlr-2.7.7/src/TokenStreamSelector.cpp deleted file mode 100644 index 254a9a9f..00000000 --- a/libs/antlr-2.7.7/src/TokenStreamSelector.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TokenStreamSelector.cpp#2 $ - */ -#include "antlr/TokenStreamSelector.hpp" -#include "antlr/TokenStreamRetryException.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A token stream MUX (multiplexor) knows about n token streams - * and can multiplex them onto the same channel for use by token - * stream consumer like a parser. This is a way to have multiple - * lexers break up the same input stream for a single parser. - * Or, you can have multiple instances of the same lexer handle - * multiple input streams; this works great for includes. - */ - -TokenStreamSelector::TokenStreamSelector() -: input(0) -{ -} - -TokenStreamSelector::~TokenStreamSelector() -{ -} - -void TokenStreamSelector::addInputStream(TokenStream* stream, const ANTLR_USE_NAMESPACE(std)string& key) -{ - inputStreamNames[key] = stream; -} - -TokenStream* TokenStreamSelector::getCurrentStream() const -{ - return input; -} - -TokenStream* TokenStreamSelector::getStream(const ANTLR_USE_NAMESPACE(std)string& sname) const -{ - inputStreamNames_coll::const_iterator i = inputStreamNames.find(sname); - if (i == inputStreamNames.end()) { - throw ANTLR_USE_NAMESPACE(std)string("TokenStream ")+sname+" not found"; - } - return (*i).second; -} - -RefToken TokenStreamSelector::nextToken() -{ - // keep looking for a token until you don't - // get a retry exception - for (;;) { - try { - return input->nextToken(); - } - catch (TokenStreamRetryException&) { - // just retry "forever" - } - } -} - -TokenStream* TokenStreamSelector::pop() -{ - TokenStream* stream = streamStack.top(); - streamStack.pop(); - select(stream); - return stream; -} - -void TokenStreamSelector::push(TokenStream* stream) -{ - streamStack.push(input); - select(stream); -} - -void TokenStreamSelector::push(const ANTLR_USE_NAMESPACE(std)string& sname) -{ - streamStack.push(input); - select(sname); -} - -void TokenStreamSelector::retry() -{ - throw TokenStreamRetryException(); -} - -/** Set the stream without pushing old stream */ -void TokenStreamSelector::select(TokenStream* stream) -{ - input = stream; -} - -void TokenStreamSelector::select(const ANTLR_USE_NAMESPACE(std)string& sname) -{ - inputStreamNames_coll::const_iterator i = inputStreamNames.find(sname); - if (i == inputStreamNames.end()) { - throw ANTLR_USE_NAMESPACE(std)string("TokenStream ")+sname+" not found"; - } - input = (*i).second; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - diff --git a/libs/antlr-2.7.7/src/TreeParser.cpp b/libs/antlr-2.7.7/src/TreeParser.cpp deleted file mode 100644 index 7abdef41..00000000 --- a/libs/antlr-2.7.7/src/TreeParser.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TreeParser.cpp#2 $ - */ - -#include "antlr/TreeParser.hpp" -#include "antlr/ASTNULLType.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** The AST Null object; the parsing cursor is set to this when - * it is found to be null. This way, we can test the - * token type of a node without having to have tests for null - * everywhere. - */ -RefAST TreeParser::ASTNULL(new ASTNULLType); - -/** Parser error-reporting function can be overridden in subclass */ -void TreeParser::reportError(const RecognitionException& ex) -{ - ANTLR_USE_NAMESPACE(std)cerr << ex.toString().c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -/** Parser error-reporting function can be overridden in subclass */ -void TreeParser::reportError(const ANTLR_USE_NAMESPACE(std)string& s) -{ - ANTLR_USE_NAMESPACE(std)cerr << "error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -/** Parser warning-reporting function can be overridden in subclass */ -void TreeParser::reportWarning(const ANTLR_USE_NAMESPACE(std)string& s) -{ - ANTLR_USE_NAMESPACE(std)cerr << "warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; -} - -/** Procedure to write out an indent for traceIn and traceOut */ -void TreeParser::traceIndent() -{ - for( int i = 0; i < traceDepth; i++ ) - ANTLR_USE_NAMESPACE(std)cout << " "; -} - -void TreeParser::traceIn(const char* rname, RefAST t) -{ - traceDepth++; - traceIndent(); - - ANTLR_USE_NAMESPACE(std)cout << "> " << rname - << "(" << (t ? t->toString().c_str() : "null") << ")" - << ((inputState->guessing>0)?" [guessing]":"") - << ANTLR_USE_NAMESPACE(std)endl; -} - -void TreeParser::traceOut(const char* rname, RefAST t) -{ - traceIndent(); - - ANTLR_USE_NAMESPACE(std)cout << "< " << rname - << "(" << (t ? t->toString().c_str() : "null") << ")" - << ((inputState->guessing>0)?" [guessing]":"") - << ANTLR_USE_NAMESPACE(std)endl; - - traceDepth--; -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif diff --git a/libs/antlr-2.7.7/src/dll.cpp b/libs/antlr-2.7.7/src/dll.cpp deleted file mode 100644 index 020a9d8a..00000000 --- a/libs/antlr-2.7.7/src/dll.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -/* - * DLL stub for MSVC++. Based upon versions of Stephen Naughton and Michael - * T. Richter - */ - -// RK: Uncommented by instruction of Alexander Lenski -//#if _MSC_VER > 1000 -//# pragma once -//#endif // _MSC_VER > 1000 - -// Exclude rarely-used stuff from Windows headers -#define WIN32_LEAN_AND_MEAN - -#include - -#if defined( _MSC_VER ) && ( _MSC_VER < 1300 ) -# error "DLL Build not supported on old MSVC's" -// Ok it seems to be possible with STLPort in stead of the vanilla MSVC STL -// implementation. This needs some work though. (and don't try it if you're -// not that familiar with compilers/building C++ DLL's in windows) -#endif - -#include -#include "antlr/config.hpp" -#include "antlr/Token.hpp" -#include "antlr/CircularQueue.hpp" - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -// Take care of necessary implicit instantiations of templates from STL - -// This should take care of MSVC 7.0 -#if defined( _MSC_VER ) && ( _MSC_VER == 1300 ) - -// these come from AST.hpp -template class ANTLR_API ASTRefCount< AST >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< RefAST >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< RefAST >; -//template ANTLR_API int operator<( ASTRefCount< AST >, ASTRefCount< AST > ); - -// ASTFactory.hpp -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< factory_descriptor_* >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const char*, factory_type_ > >; -template struct ANTLR_API ANTLR_USE_NAMESPACE(std)pair< const char*, factory_type_ >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Vector_val< factory_descriptor_*, ANTLR_USE_NAMESPACE(std)allocator< factory_descriptor_* > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< factory_descriptor_* >; - -// BitSet.hpp -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< bool >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Vector_val< bool, ANTLR_USE_NAMESPACE(std)allocator< bool > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< bool >; - -// CharScanner.hpp -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, int > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Tree_nod< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >, false > >::_Node >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Tree_ptr< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >, false > >::_Nodeptr >; -template struct ANTLR_API ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, int >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_nod< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_ptr< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_val< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)map< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess >; - -// CircularQueue.hpp -// RK: it might well be that a load of these ints need to be unsigned ints -// (made some more stuff unsigned) -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< int >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Vector_val< int, ANTLR_USE_NAMESPACE(std)allocator< int > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< int >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< int, ANTLR_USE_NAMESPACE(std)allocator< int > >; -// template ANTLR_API inline int CircularQueue< int >::entries() const; - -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< RefToken >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Vector_val< RefToken, ANTLR_USE_NAMESPACE(std)allocator< RefToken > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< RefToken >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< RefToken, ANTLR_USE_NAMESPACE(std)allocator< RefToken > >; -// template ANTLR_API inline int CircularQueue< RefToken >::entries() const; - -// CommonAST.hpp -template class ANTLR_API ASTRefCount< CommonAST >; - -// CommonASTWithHiddenTokenTypes.hpp -template class ANTLR_API ASTRefCount< CommonASTWithHiddenTokens >; - -// LexerSharedInputState.hpp -template class ANTLR_API RefCount< LexerInputState >; - -// ParserSharedInputState.hpp -template class ANTLR_API RefCount< ParserInputState >; - -// TokenStreamSelector.hpp -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, TokenStream* > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Tree_nod< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >, false > >::_Node >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Tree_ptr< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >, false > >::_Nodeptr >; -template struct ANTLR_API ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, TokenStream* >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_nod< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_ptr< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_val< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)map< ANTLR_USE_NAMESPACE(std)string, TokenStream* >; - -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< TokenStream* >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Deque_map< TokenStream* , ANTLR_USE_NAMESPACE(std)allocator< TokenStream* > >::_Tptr >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Deque_map< TokenStream*, ANTLR_USE_NAMESPACE(std)allocator< TokenStream* > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Deque_val< TokenStream*, ANTLR_USE_NAMESPACE(std)allocator< TokenStream* > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)deque< TokenStream*, ANTLR_USE_NAMESPACE(std)allocator< TokenStream* > >; -template class ANTLR_API ANTLR_USE_NAMESPACE(std)stack< TokenStream*, ANTLR_USE_NAMESPACE(std)deque >; - -#elif defined( _MSC_VER ) && ( _MSC_VER == 1310 ) -// Instantiations for MSVC 7.1 -template class ANTLR_API CircularQueue< int >; -template class ANTLR_API CircularQueue< RefToken >; - -// #else future msvc's - -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) -{ - return TRUE; -} diff --git a/libs/json/json.pro b/libs/json/json.pro index e0fe2ea6..4ae53374 100644 --- a/libs/json/json.pro +++ b/libs/json/json.pro @@ -1,6 +1,5 @@ -TEMPLATE = lib +TEMPLATE = subdirs -CONFIG += staticlib CONFIG += debug_and_release HEADERS += \ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 9e7db11b..9465734f 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -50,7 +50,6 @@ - qttools5-dev-tools - libsqlite3-dev - cmake - - libantlr-dev - libsqlcipher-dev - libqcustomplot-dev # - libx11-xcb1 diff --git a/sqlitebrowser.pro b/sqlitebrowser.pro index c61bdbb9..0c552b35 100644 --- a/sqlitebrowser.pro +++ b/sqlitebrowser.pro @@ -2,8 +2,7 @@ TEMPLATE = subdirs CONFIG += debug_and_release -SUBDIRS = libs/antlr-2.7.7/antlr.pro \ - libs/qhexedit/qhexedit.pro \ +SUBDIRS = libs/qhexedit/qhexedit.pro \ libs/qcustomplot-source/qcustomplot.pro \ libs/qscintilla/Qt4Qt5/qscintilla.pro \ libs/json/json.pro \ diff --git a/src/AddRecordDialog.cpp b/src/AddRecordDialog.cpp index 190d1c55..1f86b6c3 100644 --- a/src/AddRecordDialog.cpp +++ b/src/AddRecordDialog.cpp @@ -82,7 +82,7 @@ public: void setEditorData(QWidget *editor, const QModelIndex &index) const override { - NullLineEdit* lineEditor = dynamic_cast(editor); + NullLineEdit* lineEditor = static_cast(editor); // Set the editor in the null state (unless the user has actually written NULL) if (index.model()->data(index, Qt::UserRole).isNull() && index.model()->data(index, Qt::DisplayRole) == Settings::getValue("databrowser", "null_text")) @@ -94,7 +94,7 @@ public: } void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override { - NullLineEdit* lineEditor = dynamic_cast(editor); + NullLineEdit* lineEditor = static_cast(editor); // Restore NULL text (unless the user has already modified the value) if (lineEditor->isNull() && !lineEditor->isModified()) { model->setData(index, Settings::getValue("databrowser", "null_text"), Qt::DisplayRole); @@ -121,7 +121,7 @@ AddRecordDialog::AddRecordDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& { // Create UI ui->setupUi(this); - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(itemChanged(QTreeWidgetItem*,int))); + connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &AddRecordDialog::itemChanged); populateFields(); @@ -163,10 +163,8 @@ void AddRecordDialog::setDefaultsStyle(QTreeWidgetItem* item) void AddRecordDialog::populateFields() { - // disconnect the itemChanged signal or the SQL text will - // be updated while filling the treewidget. - disconnect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), - this,SLOT(itemChanged(QTreeWidgetItem*,int))); + // Block the itemChanged signal or the SQL text will be updated while filling the treewidget. + ui->treeWidget->blockSignals(true); ui->treeWidget->clear(); @@ -182,6 +180,7 @@ void AddRecordDialog::populateFields() sqlb::FieldVector fields; std::vector fks; sqlb::StringVector pk; + bool auto_increment = false; // Initialize fields, fks and pk differently depending on whether it's a table or a view. const sqlb::ObjectPtr obj = pdb.getObjectByName(curTable); @@ -191,7 +190,13 @@ void AddRecordDialog::populateFields() fields = m_table->fields; for(const sqlb::Field& f : fields) fks.push_back(m_table->constraint({f.name()}, sqlb::Constraint::ForeignKeyConstraintType)); - pk = m_table->primaryKey(); + + const auto pk_constraint = m_table->primaryKey(); + if(pk_constraint) + { + pk = pk_constraint->columnList(); + auto_increment = pk_constraint->autoIncrement(); + } } else { sqlb::ViewPtr m_view = pdb.getObjectByName(curTable); fields = m_view->fields; @@ -208,7 +213,7 @@ void AddRecordDialog::populateFields() tbitem->setText(kName, QString::fromStdString(f.name())); tbitem->setText(kType, QString::fromStdString(f.type())); - tbitem->setData(kType, Qt::UserRole, QString::fromStdString(f.affinity())); + tbitem->setData(kType, Qt::UserRole, f.affinity()); // NOT NULL fields are indicated in bold. if (f.notnull()) { @@ -223,10 +228,9 @@ void AddRecordDialog::populateFields() else tbitem->setIcon(kName, QIcon(":/icons/field")); - QString defaultValue = QString::fromStdString(f.defaultValue()); QString toolTip; - if (f.autoIncrement()) + if (auto_increment && contains(pk, f.name())) toolTip.append(tr("Auto-increment\n")); if (f.unique()) @@ -243,9 +247,10 @@ void AddRecordDialog::populateFields() // Display Role is used for displaying the default values. // Only when they are changed, the User Role is updated and then used in the INSERT query. - if (!defaultValue.isEmpty()) { - tbitem->setData(kValue, Qt::DisplayRole, QString::fromStdString(f.defaultValue())); - toolTip.append(tr("Default value:\t %1\n").arg (defaultValue)); + if (!f.defaultValue().empty()) { + QString defaultValue = QString::fromStdString(f.defaultValue()); + tbitem->setData(kValue, Qt::DisplayRole, defaultValue); + toolTip.append(tr("Default value:\t %1\n").arg(defaultValue)); } else tbitem->setData(kValue, Qt::DisplayRole, Settings::getValue("databrowser", "null_text")); @@ -260,13 +265,13 @@ void AddRecordDialog::populateFields() updateSqlText(); - // and reconnect - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(itemChanged(QTreeWidgetItem*,int))); + // Enable signals from tree widget + ui->treeWidget->blockSignals(false); } void AddRecordDialog::accept() { - if(!pdb.executeSQL(ui->sqlTextEdit->text())) + if(!pdb.executeSQL(ui->sqlTextEdit->text().toStdString())) { QMessageBox::warning( this, @@ -298,10 +303,10 @@ void AddRecordDialog::updateSqlText() fields << sqlb::escapeIdentifier(item->text(kName)); value.toDouble(&isNumeric); // If it has a numeric format and has no text affinity, do not quote it. - if (isNumeric && item->data(kType, Qt::UserRole).toString() != "TEXT") + if (isNumeric && item->data(kType, Qt::UserRole).toInt() != sqlb::Field::TextAffinity) vals << value.toString(); else - vals << QString("'%1'").arg(value.toString().replace("'", "''")); + vals << sqlb::escapeString(value.toString()); } } diff --git a/src/Application.cpp b/src/Application.cpp index 9bd7dc61..66b980f2 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "Application.h" #include "MainWindow.h" @@ -152,7 +153,7 @@ Application::Application(int& argc, char** argv) : // Show main window m_mainWindow = new MainWindow(); m_mainWindow->show(); - connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit())); + connect(this, &Application::lastWindowClosed, this, &Application::quit); // Open database if one was specified if(fileToOpen.size()) @@ -174,7 +175,7 @@ Application::Application(int& argc, char** argv) : // Jump to table if the -t/--table parameter was set if(!tableToBrowse.isEmpty()) - m_mainWindow->switchToBrowseDataTab(tableToBrowse); + m_mainWindow->switchToBrowseDataTab(sqlb::ObjectIdentifier("main", tableToBrowse.toStdString())); } } } @@ -203,8 +204,31 @@ QString Application::versionString() // date in order to avoid confusion about what is more important, version number or build date, and about different // build dates for the same version. This also should help making release builds reproducible out of the box. #if PATCH_VERSION >= 99 - return QString("%1 (%2)").arg(APP_VERSION).arg(__DATE__); + return QString("%1 (%2)").arg(APP_VERSION, __DATE__); #else return QString("%1").arg(APP_VERSION); #endif } + +// Functions for documenting the shortcuts in the user interface using native names +static QString shortcutsTip(const QList& keys) +{ + QString tip; + + if (!keys.isEmpty()) { + tip = " ["; + + for (const auto& shortcut : keys) + tip.append(shortcut.toString(QKeySequence::NativeText) + ", "); + tip.chop(2); + + tip.append("]"); + } + return tip; +} + +void addShortcutsTooltip(QAction* action, const QList& extraKeys) +{ + if (!action->shortcuts().isEmpty() || !extraKeys.isEmpty()) + action->setToolTip(action->toolTip() + shortcutsTip(action->shortcuts() + extraKeys)); +} diff --git a/src/Application.h b/src/Application.h index c4cab965..2c72615c 100644 --- a/src/Application.h +++ b/src/Application.h @@ -2,9 +2,12 @@ #define APPLICATION_H #include +#include + +class QAction; +class QTranslator; class MainWindow; -class QTranslator; class Application : public QApplication { @@ -14,7 +17,7 @@ public: explicit Application(int& argc, char** argv); ~Application() override; - bool dontShowMainWindow() { return m_dontShowMainWindow; } + bool dontShowMainWindow() const { return m_dontShowMainWindow; } MainWindow* mainWindow() { return m_mainWindow; } @@ -30,4 +33,6 @@ private: QTranslator* m_translatorApp; }; +void addShortcutsTooltip(QAction* action, const QList& extraKeys = QList()); + #endif diff --git a/src/CipherDialog.cpp b/src/CipherDialog.cpp index 7fdff133..6b009619 100644 --- a/src/CipherDialog.cpp +++ b/src/CipherDialog.cpp @@ -3,7 +3,7 @@ #include "sqlitedb.h" #include -#include +#include #include @@ -11,7 +11,7 @@ CipherDialog::CipherDialog(QWidget* parent, bool encrypt) : QDialog(parent), ui(new Ui::CipherDialog), encryptMode(encrypt), - rawKeyValidator(new QRegExpValidator(QRegExp("0x[a-fA-F0-9]+"))) + rawKeyValidator(new QRegularExpressionValidator(QRegularExpression("\\A(0x[a-fA-F0-9]+)\\Z"))) { ui->setupUi(this); @@ -61,7 +61,7 @@ CipherDialog::~CipherDialog() CipherSettings CipherDialog::getCipherSettings() const { CipherSettings::KeyFormats keyFormat = CipherSettings::getKeyFormat(ui->comboKeyFormat->currentIndex()); - QString password = ui->editPassword->text(); + std::string password = ui->editPassword->text().toStdString(); int pageSize = ui->comboPageSize->itemData(ui->comboPageSize->currentIndex()).toInt(); CipherSettings cipherSettings; @@ -70,8 +70,9 @@ CipherSettings CipherDialog::getCipherSettings() const cipherSettings.setPassword(password); cipherSettings.setPageSize(pageSize); cipherSettings.setKdfIterations(ui->spinKdfIterations->value()); - cipherSettings.setHmacAlgorithm(QString("HMAC_") + ui->comboHmacAlgorithm->currentText()); - cipherSettings.setKdfAlgorithm(QString("PBKDF2_HMAC_") + ui->comboKdfAlgorithm->currentText()); + cipherSettings.setHmacAlgorithm("HMAC_" + ui->comboHmacAlgorithm->currentText().toStdString()); + cipherSettings.setKdfAlgorithm("PBKDF2_HMAC_" + ui->comboKdfAlgorithm->currentText().toStdString()); + cipherSettings.setPlaintextHeaderSize(ui->plaintextHeaderSize->value()); return cipherSettings; } @@ -113,22 +114,26 @@ void CipherDialog::toggleEncryptionSettings() ui->spinKdfIterations->setValue(64000); ui->comboHmacAlgorithm->setCurrentText("SHA1"); ui->comboKdfAlgorithm->setCurrentText("SHA1"); + ui->plaintextHeaderSize->setValue(0); ui->comboPageSize->setEnabled(false); ui->spinKdfIterations->setEnabled(false); ui->comboHmacAlgorithm->setEnabled(false); ui->comboKdfAlgorithm->setEnabled(false); + ui->plaintextHeaderSize->setEnabled(false); } else if(ui->radioEncryptionSqlCipher4->isChecked()) { // SQLCipher4 ui->comboPageSize->setCurrentText(QLocale().toString(4096)); ui->spinKdfIterations->setValue(256000); ui->comboHmacAlgorithm->setCurrentText("SHA512"); ui->comboKdfAlgorithm->setCurrentText("SHA512"); + ui->plaintextHeaderSize->setValue(0); ui->comboPageSize->setEnabled(false); ui->spinKdfIterations->setEnabled(false); ui->comboHmacAlgorithm->setEnabled(false); ui->comboKdfAlgorithm->setEnabled(false); + ui->plaintextHeaderSize->setEnabled(false); } else if(ui->radioEncryptionCustom->isChecked()) { // Custom @@ -136,5 +141,6 @@ void CipherDialog::toggleEncryptionSettings() ui->spinKdfIterations->setEnabled(true); ui->comboHmacAlgorithm->setEnabled(true); ui->comboKdfAlgorithm->setEnabled(true); + ui->plaintextHeaderSize->setEnabled(true); } } diff --git a/src/CipherDialog.h b/src/CipherDialog.h index 50fccae6..ac7adc97 100644 --- a/src/CipherDialog.h +++ b/src/CipherDialog.h @@ -5,7 +5,7 @@ #include "CipherSettings.h" -class QRegExpValidator; +class QRegularExpressionValidator; namespace Ui { class CipherDialog; @@ -26,7 +26,7 @@ public: private: Ui::CipherDialog* ui; bool encryptMode; - QRegExpValidator* rawKeyValidator; + QRegularExpressionValidator* rawKeyValidator; private slots: void checkInputFields(); diff --git a/src/CipherDialog.ui b/src/CipherDialog.ui index 4a4d18ad..00c1d289 100644 --- a/src/CipherDialog.ui +++ b/src/CipherDialog.ui @@ -218,6 +218,26 @@ + + + + Plaintext Header Size + + + plaintextHeaderSize + + + + + + + 0 + + + 1000000 + + + @@ -243,6 +263,7 @@ spinKdfIterations comboHmacAlgorithm comboKdfAlgorithm + plaintextHeaderSize diff --git a/src/CipherSettings.cpp b/src/CipherSettings.cpp index fa1acfeb..f7e32155 100644 --- a/src/CipherSettings.cpp +++ b/src/CipherSettings.cpp @@ -1,52 +1,25 @@ #include "CipherSettings.h" +#include "sqlitedb.h" CipherSettings::CipherSettings() : keyFormat(Passphrase), pageSize(0), - kdfIterations(0) + kdfIterations(0), + plaintextHeaderSize(0) { } -CipherSettings::KeyFormats CipherSettings::getKeyFormat() const -{ - return keyFormat; -} - -void CipherSettings::setKeyFormat(const KeyFormats &value) -{ - keyFormat = value; -} - -QString CipherSettings::getPassword() const +std::string CipherSettings::getPassword() const { if(keyFormat == Passphrase) { - QString tempPassword = password; - - tempPassword.replace("'", "''"); - - return QString("'%1'").arg(tempPassword); + return sqlb::escapeString(password); } else { // Remove the '0x' part at the beginning - return QString("\"x'%1'\"").arg(password.mid(2)); + return "\"x'" + password.substr(2) + "'\""; } } -void CipherSettings::setPassword(const QString &value) -{ - password = value; -} - -int CipherSettings::getPageSize() const -{ - return pageSize; -} - -void CipherSettings::setPageSize(int value) -{ - pageSize = value; -} - CipherSettings::KeyFormats CipherSettings::getKeyFormat(int rawKeyFormat) { return static_cast(rawKeyFormat); diff --git a/src/CipherSettings.h b/src/CipherSettings.h index 139b043a..54b8ecd4 100644 --- a/src/CipherSettings.h +++ b/src/CipherSettings.h @@ -1,7 +1,7 @@ #ifndef CIPHERSETTINGS_H #define CIPHERSETTINGS_H -#include +#include class CipherSettings { @@ -14,33 +14,37 @@ public: RawKey }; - KeyFormats getKeyFormat() const; - void setKeyFormat(const KeyFormats &value); + KeyFormats getKeyFormat() const { return keyFormat; } + void setKeyFormat(const KeyFormats &value) { keyFormat = value; } - QString getPassword() const; - void setPassword(const QString &value); + std::string getPassword() const; + void setPassword(const std::string& value) { password = value; } - int getPageSize() const; - void setPageSize(int value); + int getPageSize() const { return pageSize; } + void setPageSize(int value) { pageSize = value; } int getKdfIterations() const { return kdfIterations; } void setKdfIterations(int value) { kdfIterations = value; } - QString getHmacAlgorithm() const { return hmacAlgorithm; } - void setHmacAlgorithm(const QString &value) { hmacAlgorithm = value; } + int getPlaintextHeaderSize() const { return plaintextHeaderSize; } + void setPlaintextHeaderSize(int value) { plaintextHeaderSize = value; } - QString getKdfAlgorithm() const { return kdfAlgorithm; } - void setKdfAlgorithm(const QString &value) { kdfAlgorithm = value; } + std::string getHmacAlgorithm() const { return hmacAlgorithm; } + void setHmacAlgorithm(const std::string& value) { hmacAlgorithm = value; } + + std::string getKdfAlgorithm() const { return kdfAlgorithm; } + void setKdfAlgorithm(const std::string& value) { kdfAlgorithm = value; } static KeyFormats getKeyFormat(int rawKeyFormat); private: KeyFormats keyFormat; - QString password; + std::string password; int pageSize; int kdfIterations; - QString hmacAlgorithm; - QString kdfAlgorithm; + int plaintextHeaderSize; + std::string hmacAlgorithm; + std::string kdfAlgorithm; }; #endif // CIPHERSETTINGS_H diff --git a/src/ColumnDisplayFormatDialog.cpp b/src/ColumnDisplayFormatDialog.cpp index 5ec19cc8..ac67f1f0 100644 --- a/src/ColumnDisplayFormatDialog.cpp +++ b/src/ColumnDisplayFormatDialog.cpp @@ -105,18 +105,18 @@ void ColumnDisplayFormatDialog::accept() // Users could still devise a way to break this, but this is considered good enough for letting them know about simple incorrect // cases. if(!(ui->editDisplayFormat->text() == sqlb::escapeIdentifier(column_name) || - ui->editDisplayFormat->text().contains(QRegExp("[a-z]+[a-z_0-9]* *\\(.*" + QRegExp::escape(sqlb::escapeIdentifier(column_name)) + ".*\\)", Qt::CaseInsensitive)))) + ui->editDisplayFormat->text().contains(QRegularExpression("[a-z]+[a-z_0-9]* *\\(.*" + QRegularExpression::escape(sqlb::escapeIdentifier(column_name)) + ".*\\)", QRegularExpression::CaseInsensitiveOption)))) errorMessage = tr("Custom display format must contain a function call applied to %1").arg(sqlb::escapeIdentifier(column_name)); else { // Execute a query using the display format and check that it only returns one column. int customNumberColumns = 0; - DBBrowserDB::execCallback callback = [&customNumberColumns](int numberColumns, QStringList, QStringList) -> bool { + DBBrowserDB::execCallback callback = [&customNumberColumns](int numberColumns, std::vector, std::vector) -> bool { customNumberColumns = numberColumns; // Return false so the query is not aborted and no error is reported. return false; }; - if(!pdb.executeSQL(QString("SELECT %1 FROM %2 LIMIT 1").arg(ui->editDisplayFormat->text(), QString::fromStdString(curTable.toString())), + if(!pdb.executeSQL("SELECT " + ui->editDisplayFormat->text().toStdString() + " FROM " + curTable.toString() + " LIMIT 1", false, true, callback)) errorMessage = tr("Error in custom display format. Message from database engine:\n\n%1").arg(pdb.lastError()); else if(customNumberColumns != 1) diff --git a/src/CondFormat.cpp b/src/CondFormat.cpp index 1f963576..05970266 100644 --- a/src/CondFormat.cpp +++ b/src/CondFormat.cpp @@ -1,18 +1,61 @@ #include "CondFormat.h" #include "Settings.h" #include "Data.h" +#include "sqlitedb.h" -CondFormat::CondFormat(const QString& filter, const QColor& foreground, const QColor& background, const QString& encoding) +#include + +CondFormat::Alignment CondFormat::fromCombinedAlignment(Qt::Alignment align) +{ + if (align.testFlag(Qt::AlignLeft)) + return AlignLeft; + if (align.testFlag(Qt::AlignRight)) + return AlignRight; + if (align.testFlag(Qt::AlignCenter)) + return AlignCenter; + if (align.testFlag(Qt::AlignJustify)) + return AlignJustify; + + return AlignLeft; +} + +CondFormat::CondFormat(const QString& filter, + const QColor& foreground, + const QColor& background, + const QFont& font, + const Alignment alignment, + const QString& encoding) : m_filter(filter), m_bgColor(background), - m_fgColor(foreground) + m_fgColor(foreground), + m_font(font), + m_align(alignment) { if (!filter.isEmpty()) m_sqlCondition = filterToSqlCondition(filter, encoding); } -QString CondFormat::filterToSqlCondition(const QString& value, const QString& encoding) +CondFormat::CondFormat(const QString& filter, + const QAbstractTableModel* model, + const QModelIndex index, + const QString& encoding) + : m_filter(filter) { + + if (!filter.isEmpty()) + m_sqlCondition = filterToSqlCondition(filter, encoding); + + m_bgColor = QColor(model->data(index, Qt::BackgroundRole).toString()); + m_fgColor = QColor(model->data(index, Qt::ForegroundRole).toString()); + m_align = fromCombinedAlignment(Qt::Alignment(model->data(index, Qt::TextAlignmentRole).toInt())); + m_font.fromString(model->data(index, Qt::FontRole).toString()); +} + +std::string CondFormat::filterToSqlCondition(const QString& value, const QString& encoding) +{ + if(value.isEmpty()) + return {}; + // Check for any special comparison operators at the beginning of the value string. If there are none default to LIKE. QString op = "LIKE"; QString val, val2; @@ -52,13 +95,13 @@ QString CondFormat::filterToSqlCondition(const QString& value, const QString& en numeric = true; val = "''"; } else { - value.mid(2).toFloat(&numeric); + value.midRef(2).toFloat(&numeric); op = value.left(2); val = value.mid(2); } } else if(value.left(1) == ">" || value.left(1) == "<") { - value.mid(1).toFloat(&numeric); - op = value.left(1); + value.midRef(1).toFloat(&numeric); + op = value.at(0); val = value.mid(1); } else if(value.left(1) == "=") { val = value.mid(1); @@ -74,7 +117,7 @@ QString CondFormat::filterToSqlCondition(const QString& value, const QString& en op = "IS"; numeric = true; } - } else if(value.left(1) == "/" && value.right(1) == "/" && value.length() > 2) { + } else if(value.left(1) == "/" && value.right(1) == "/" && value.size() > 2) { val = value.mid(1, value.length() - 2); op = "REGEXP"; numeric = false; @@ -101,17 +144,33 @@ QString CondFormat::filterToSqlCondition(const QString& value, const QString& en if(val.isEmpty()) val = value; - if(val == "" || val == "%" || val == "%%") - return QString(); + if(val.isEmpty() || val == "%" || val == "%%") + return {}; else { // Quote and escape value, but only if it's not numeric and not the empty string sequence if(!numeric && val != "''") - val = QString("'%1'").arg(val.replace("'", "''")); + val = sqlb::escapeString(val); QString whereClause(op + " " + QString(encodeString(val.toUtf8(), encoding))); if (!val2.isEmpty()) whereClause += " AND " + QString(encodeString(val2.toUtf8(), encoding)); whereClause += " " + escape; - return whereClause; + return whereClause.toStdString(); } } + +Qt::AlignmentFlag CondFormat::alignmentFlag() const +{ + switch (m_align) { + case AlignLeft: + return Qt::AlignLeft; + case AlignCenter: + return Qt::AlignCenter; + case AlignRight: + return Qt::AlignRight; + case AlignJustify: + return Qt::AlignJustify; + } + + return Qt::AlignLeft; +} diff --git a/src/CondFormat.h b/src/CondFormat.h index 20a81346..3541fd86 100644 --- a/src/CondFormat.h +++ b/src/CondFormat.h @@ -3,28 +3,79 @@ #include #include +#include +#include + +class QAbstractTableModel; // Conditional formatting for given format to table cells based on a specified condition. class CondFormat { public: - CondFormat() {} - explicit CondFormat(const QString& filter, const QColor& foreground, const QColor& background, const QString& encoding = QString()); - static QString filterToSqlCondition(const QString& value, const QString& encoding = QString()); + enum Alignment { + AlignLeft = 0, + AlignRight, + AlignCenter, + AlignJustify + }; + + // List of alignment texts. Order must be as Alignment definition above. + static QStringList alignmentTexts() { + return {QObject::tr("Left"), QObject::tr("Right"), QObject::tr("Center"), QObject::tr("Justify")}; + } + + // Get alignment from combined Qt alignment (note that this will lose any combination of our Alignment enum + // with other values present in the flag (e.g. vertical alignment). + static Alignment fromCombinedAlignment(Qt::Alignment align); + + CondFormat() {} + CondFormat(const QString& filter, + const QColor& foreground, + const QColor& background, + const QFont& font, + const Alignment alignment = AlignLeft, + const QString& encoding = QString()); + + // Create a new CondFormat from values obtained from the model + CondFormat(const QString& filter, + const QAbstractTableModel* model, + const QModelIndex index, + const QString& encoding = QString()); + + static std::string filterToSqlCondition(const QString& value, const QString& encoding = QString()); private: - QString m_sqlCondition; + std::string m_sqlCondition; QString m_filter; QColor m_bgColor; QColor m_fgColor; + QFont m_font; + Alignment m_align; public: - QString sqlCondition() const { return m_sqlCondition; } + std::string sqlCondition() const { return m_sqlCondition; } QString filter() const { return m_filter; } + QColor backgroundColor() const { return m_bgColor; } QColor foregroundColor() const { return m_fgColor; } + void setBackgroundColor(QColor color) { m_bgColor = color; } + void setForegroundColor(QColor color) { m_fgColor = color; } + bool isBold() const { return m_font.bold(); } + bool isItalic() const { return m_font.italic(); } + bool isUnderline() const { return m_font.underline(); } + void setBold(bool value) { m_font.setBold(value); } + void setItalic(bool value) { m_font.setItalic(value); } + void setUnderline(bool value) { m_font.setUnderline(value); } + + QFont font() const { return m_font; } + void setFontFamily(const QString &family) { m_font.setFamily(family); } + void setFontPointSize(int pointSize) { m_font.setPointSize(pointSize); } + + Alignment alignment() const { return m_align; } + void setAlignment(Alignment value) { m_align = value; } + Qt::AlignmentFlag alignmentFlag() const; }; #endif // CONDFORMAT_H diff --git a/src/CondFormatManager.cpp b/src/CondFormatManager.cpp index 15bfe346..93367c76 100644 --- a/src/CondFormatManager.cpp +++ b/src/CondFormatManager.cpp @@ -2,12 +2,38 @@ #include "ui_CondFormatManager.h" #include "CondFormat.h" #include "Settings.h" +#include "FilterLineEdit.h" #include #include #include #include #include +#include +#include +#include +#include + +// Styled Item Delegate for non-editable columns (all except Condition) +class DefaultDelegate: public QStyledItemDelegate { +public: + explicit DefaultDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {} + QWidget* createEditor(QWidget* /* parent */, const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const override { + return nullptr; + } +}; + +// Styled Item Delegate for the Condition column as a filter line editor. +class FilterEditDelegate: public QStyledItemDelegate { + +public: + explicit FilterEditDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {} + QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const override { + FilterLineEdit* filterEditor = new FilterLineEdit(parent); + filterEditor->setConditionFormatContextMenuEnabled(false); + return filterEditor; + } +}; CondFormatManager::CondFormatManager(const std::vector& condFormats, const QString& encoding, QWidget *parent) : QDialog(parent), @@ -20,13 +46,21 @@ CondFormatManager::CondFormatManager(const std::vector& condFormats, for(const CondFormat& aCondFormat : condFormats) addItem(aCondFormat); + // Make condition editable as a filter line editor. ui->tableCondFormats->setEditTriggers(QAbstractItemView::AllEditTriggers); + ui->tableCondFormats->setItemDelegateForColumn(ColumnFilter, new FilterEditDelegate(this)); - connect(ui->buttonAdd, SIGNAL(clicked(bool)), this, SLOT(addNewItem())); - connect(ui->buttonRemove, SIGNAL(clicked(bool)), this, SLOT(removeItem())); + // Make columns not text-editable, except for the condition. + for(int col = ColumnForeground; col < ColumnFilter; ++col) { + ui->tableCondFormats->setItemDelegateForColumn(col, new DefaultDelegate(this)); + ui->tableCondFormats->resizeColumnToContents(col); + } - connect(ui->buttonDown, SIGNAL(clicked(bool)), this, SLOT(downItem())); - connect(ui->buttonUp, SIGNAL(clicked(bool)), this, SLOT(upItem())); + connect(ui->buttonAdd, &QToolButton::clicked, this, &CondFormatManager::addNewItem); + connect(ui->buttonRemove, &QToolButton::clicked, this, &CondFormatManager::removeItem); + + connect(ui->buttonDown, &QToolButton::clicked, this, &CondFormatManager::downItem); + connect(ui->buttonUp, &QToolButton::clicked, this, &CondFormatManager::upItem); connect(ui->tableCondFormats, &QTreeWidget::itemClicked, this, &CondFormatManager::itemClicked); } @@ -38,8 +72,18 @@ CondFormatManager::~CondFormatManager() void CondFormatManager::addNewItem() { + // Clear focus from the current widget, so if there is some input, it is saved now. + QWidget* currentWidget = ui->tableCondFormats->itemWidget(ui->tableCondFormats->currentItem(), ColumnFilter); + if (currentWidget != nullptr) + currentWidget->clearFocus(); + + QFont font = QFont(Settings::getValue("databrowser", "font").toString()); + font.setPointSize(Settings::getValue("databrowser", "fontsize").toInt()); + CondFormat newCondFormat("", QColor(Settings::getValue("databrowser", "reg_fg_colour").toString()), m_condFormatPalette.nextSerialColor(Palette::appHasDarkTheme()), + font, + CondFormat::AlignLeft, m_encoding); addItem(newCondFormat); } @@ -47,15 +91,38 @@ void CondFormatManager::addNewItem() void CondFormatManager::addItem(const CondFormat& aCondFormat) { int i = ui->tableCondFormats->topLevelItemCount(); - QTreeWidgetItem *newItem = new QTreeWidgetItem({"", "", aCondFormat.filter()}); + QTreeWidgetItem *newItem = new QTreeWidgetItem(ui->tableCondFormats); + newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable); + newItem->setForeground(ColumnForeground, aCondFormat.foregroundColor()); newItem->setBackground(ColumnForeground, aCondFormat.foregroundColor()); newItem->setForeground(ColumnBackground, aCondFormat.backgroundColor()); newItem->setBackground(ColumnBackground, aCondFormat.backgroundColor()); newItem->setToolTip(ColumnBackground, tr("Click to select color")); newItem->setToolTip(ColumnForeground, tr("Click to select color")); + + QFontComboBox* fontCombo = new QFontComboBox(ui->tableCondFormats); + fontCombo->setCurrentFont(aCondFormat.font()); + // Avoid that the font combo box gets too wide and work around a possible Qt bug where the box overlaps the next column. + fontCombo->setMaximumWidth(150); + ui->tableCondFormats->setItemWidget(newItem, ColumnFont, fontCombo); + + QSpinBox* sizeBox = new QSpinBox(ui->tableCondFormats); + sizeBox->setMinimum(1); + sizeBox->setValue(aCondFormat.font().pointSize()); + ui->tableCondFormats->setItemWidget(newItem, ColumnSize, sizeBox); + + newItem->setCheckState(ColumnBold, aCondFormat.isBold() ? Qt::Checked : Qt::Unchecked); + newItem->setCheckState(ColumnItalic, aCondFormat.isItalic() ? Qt::Checked : Qt::Unchecked); + newItem->setCheckState(ColumnUnderline, aCondFormat.isUnderline() ? Qt::Checked : Qt::Unchecked); + + QComboBox* alignCombo = new QComboBox(ui->tableCondFormats); + alignCombo->addItems(CondFormat::alignmentTexts()); + alignCombo->setCurrentIndex(aCondFormat.alignment()); + ui->tableCondFormats->setItemWidget(newItem, ColumnAlignment, alignCombo); + + newItem->setText(ColumnFilter, aCondFormat.filter()); ui->tableCondFormats->insertTopLevelItem(i, newItem); - ui->tableCondFormats->openPersistentEditor(newItem, ColumnFilter); } void CondFormatManager::removeItem() @@ -64,48 +131,79 @@ void CondFormatManager::removeItem() delete item; } -void CondFormatManager::upItem() +void CondFormatManager::moveItem(int offset) { if (!ui->tableCondFormats->currentIndex().isValid()) return; int selectedRow = ui->tableCondFormats->currentIndex().row(); - if(selectedRow == 0) + int newRow = selectedRow + offset; + if(newRow < 0 || newRow >= ui->tableCondFormats->topLevelItemCount()) return; - QTreeWidgetItem* item; + QTreeWidgetItem* item = ui->tableCondFormats->topLevelItem(selectedRow); + + // Rescue widgets, since they will be deleted, and add them later. + QFontComboBox* fontCombo = qobject_cast(ui->tableCondFormats->itemWidget(item, ColumnFont)); + QFontComboBox* fontCombo2 = new QFontComboBox(ui->tableCondFormats); + fontCombo2->setCurrentFont(fontCombo->currentFont()); + + QSpinBox* sizeBox = qobject_cast(ui->tableCondFormats->itemWidget(item, ColumnSize)); + QSpinBox* sizeBox2 = new QSpinBox(ui->tableCondFormats); + sizeBox2->setValue(sizeBox->value()); + sizeBox2->setMinimum(sizeBox->minimum()); + + QComboBox* alignCombo = qobject_cast(ui->tableCondFormats->itemWidget(item, ColumnAlignment)); + QComboBox* alignCombo2 = new QComboBox(ui->tableCondFormats); + alignCombo2->addItems(CondFormat::alignmentTexts()); + alignCombo2->setCurrentIndex(alignCombo->currentIndex()); + item = ui->tableCondFormats->takeTopLevelItem(selectedRow); - ui->tableCondFormats->insertTopLevelItem(selectedRow-1, item); - ui->tableCondFormats->openPersistentEditor(item, ColumnFilter); - ui->tableCondFormats->setCurrentIndex(ui->tableCondFormats->currentIndex().sibling(selectedRow-1, + ui->tableCondFormats->insertTopLevelItem(newRow, item); + + // Restore widgets and state + ui->tableCondFormats->setItemWidget(item, ColumnFont, fontCombo2); + ui->tableCondFormats->setItemWidget(item, ColumnSize, sizeBox2); + ui->tableCondFormats->setItemWidget(item, ColumnAlignment, alignCombo2); + ui->tableCondFormats->setCurrentIndex(ui->tableCondFormats->currentIndex().sibling(newRow, ui->tableCondFormats->currentIndex().column())); + // This is added so the widgets are readjusted. Otherwise they can be misplaced when moving an item to the top. + ui->tableCondFormats->adjustSize(); +} + +void CondFormatManager::upItem() +{ + moveItem(-1); } void CondFormatManager::downItem() { - if (!ui->tableCondFormats->currentIndex().isValid()) return; - - int selectedRow = ui->tableCondFormats->currentIndex().row(); - if(selectedRow == ui->tableCondFormats->topLevelItemCount() - 1) - return; - - QTreeWidgetItem* item; - item = ui->tableCondFormats->takeTopLevelItem(selectedRow); - ui->tableCondFormats->insertTopLevelItem(selectedRow+1, item); - ui->tableCondFormats->openPersistentEditor(item, ColumnFilter); - ui->tableCondFormats->setCurrentIndex(ui->tableCondFormats->currentIndex().sibling(selectedRow+1, - ui->tableCondFormats->currentIndex().column())); + moveItem(+1); } -std::vector CondFormatManager::getCondFormats() +std::vector CondFormatManager::getCondFormats() const { std::vector result; + for (int i = 0; i < ui->tableCondFormats->topLevelItemCount(); ++i) { QTreeWidgetItem* item = ui->tableCondFormats->topLevelItem(i); + + QFontComboBox* fontCombo = qobject_cast(ui->tableCondFormats->itemWidget(item, ColumnFont)); + QSpinBox* sizeBox = qobject_cast(ui->tableCondFormats->itemWidget(item, ColumnSize)); + QFont font = fontCombo->currentFont(); + font.setPointSize(sizeBox->value()); + font.setBold(item->checkState(ColumnBold) == Qt::Checked); + font.setItalic(item->checkState(ColumnItalic) == Qt::Checked); + font.setUnderline(item->checkState(ColumnUnderline) == Qt::Checked); + QComboBox* alignCombo = qobject_cast(ui->tableCondFormats->itemWidget(item, ColumnAlignment)); + result.emplace_back(item->text(ColumnFilter), item->background(ColumnForeground).color(), - item->background(ColumnBackground).color(), m_encoding); + item->background(ColumnBackground).color(), + font, + static_cast(alignCombo->currentIndex()), + m_encoding); } return result; } @@ -114,17 +212,21 @@ std::vector CondFormatManager::getCondFormats() void CondFormatManager::itemClicked(QTreeWidgetItem* item, int column) { switch (column) { - case ColumnForeground: - case ColumnBackground: { - QColor color = QColorDialog::getColor(item->background(column).color(), this); - if(color.isValid()) { - item->setTextColor(column, color); - item->setBackgroundColor(column, color); - item->setToolTip(column, tr("Click to select color")); - } - break; - } - case ColumnFilter: + case ColumnForeground: + case ColumnBackground: { + QColor color = QColorDialog::getColor(item->background(column).color(), this); + if(color.isValid()) { + item->setTextColor(column, color); + item->setBackgroundColor(column, color); + } + break; + } + case ColumnBold: + case ColumnItalic: + case ColumnUnderline: + item->setCheckState(column, item->checkState(column) != Qt::Checked ? Qt::Checked : Qt::Unchecked); + break; + default: // Nothing to do break; } diff --git a/src/CondFormatManager.h b/src/CondFormatManager.h index 429c16f4..bf0e284d 100644 --- a/src/CondFormatManager.h +++ b/src/CondFormatManager.h @@ -22,22 +22,29 @@ public: explicit CondFormatManager(const std::vector& condFormats, const QString& encoding, QWidget *parent = nullptr); ~CondFormatManager() override; - std::vector getCondFormats(); + std::vector getCondFormats() const; private: enum Columns { ColumnForeground = 0, - ColumnBackground = 1, - ColumnFilter = 2 + ColumnBackground, + ColumnFont, + ColumnSize, + ColumnBold, + ColumnItalic, + ColumnUnderline, + ColumnAlignment, + ColumnFilter }; Ui::CondFormatManager *ui; std::vector m_condFormats; Palette m_condFormatPalette; QString m_encoding; - + private slots: void addNewItem(); void addItem(const CondFormat& aCondFormat); void removeItem(); + void moveItem(int offset); void upItem(); void downItem(); void on_buttonBox_clicked(QAbstractButton* button); diff --git a/src/CondFormatManager.ui b/src/CondFormatManager.ui index 319dd725..41ead4de 100644 --- a/src/CondFormatManager.ui +++ b/src/CondFormatManager.ui @@ -6,8 +6,8 @@ 0 0 - 578 - 463 + 750 + 400 @@ -17,7 +17,7 @@ - This dialog allows creating and editing conditional formats, where the cell text and background will be colored based on one or more conditions. Conditional formats can be moved up and down, where those at higher rows take precedence over those at lower. + This dialog allows creating and editing conditional formats. Each cell style will be selected by the first accomplished condition for that cell data. Conditional formats can be moved up and down, where those at higher rows take precedence over those at lower. Syntax for conditions is the same as for filters and an empty condition applies to all values. true @@ -150,19 +150,76 @@ false - - 150 + + 25 + Foreground + + Text color + Background + + Background color + + + Font + + + + + Size + + + + + + + + Bold + + + + :/icons/text_bold.png:/icons/text_bold.png + + + + + + + + Italic + + + + :/icons/text_italic.png:/icons/text_italic.png + + + + + + + + Underline + + + + :/icons/text_underline.png:/icons/text_underline.png + + + + + Alignment + + Condition diff --git a/src/Data.cpp b/src/Data.cpp index ffda72e4..b3310c91 100644 --- a/src/Data.cpp +++ b/src/Data.cpp @@ -1,6 +1,9 @@ #include "Data.h" +#include +#include #include + #include // Note that these aren't all possible BOMs. But they are probably the most common ones. @@ -33,7 +36,7 @@ bool isTextOnly(QByteArray data, const QString& encoding, bool quickTest) QTextCodec::ConverterState state; QTextCodec *codec = encoding.isEmpty()? QTextCodec::codecForName("UTF-8") : QTextCodec::codecForName(encoding.toUtf8()); - const QString text = codec->toUnicode(data.constData(), testSize, &state); + codec->toUnicode(data.constData(), testSize, &state); return state.invalidChars == 0; } else { // Convert to Unicode if necessary @@ -53,6 +56,8 @@ bool containsRightToLeft(const QString& text) { case QChar::DirRLO: case QChar::DirRLI: return true; + default: + break; } } return false; @@ -88,6 +93,19 @@ QByteArray removeBom(QByteArray& data) } } +QString isImageData(const QByteArray& data) +{ + // Check if it's an image. First do a quick test by calling canRead() which only checks the first couple of bytes or so. Only if + // that returned true, do a more sophisticated test of the data. This way we get both, good performance and proper data checking. + QBuffer imageBuffer(const_cast(&data)); + QImageReader readerBuffer(&imageBuffer); + QString imageFormat = readerBuffer.format(); + if(readerBuffer.canRead() && !readerBuffer.read().isNull()) + return imageFormat; + else + return QString(); +} + QStringList toStringList(const QList& list) { QStringList strings; for (const QByteArray &item : list) { @@ -111,3 +129,19 @@ QByteArray decodeString(const QByteArray& str, const QString& encoding) else return QTextCodec::codecForName(encoding.toUtf8())->toUnicode(str).toUtf8(); } + +QString humanReadableSize(unsigned long byteCount) +{ + static const std::vector units = {"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB"}; + + double size = static_cast(byteCount); + for(const QString& unit : units) + { + if(size < 1024.0) + return QString::number(size, 'f', 2) + " " + unit; + + size /= 1024.0; + } + + return QString::number(size, 'f', 2) + " YiB"; +} diff --git a/src/Data.h b/src/Data.h index a725d196..dbf07954 100644 --- a/src/Data.h +++ b/src/Data.h @@ -21,10 +21,15 @@ bool startsWithBom(const QByteArray& data); // with a BOM an empty byte array is returned and the original data is not modified. QByteArray removeBom(QByteArray& data); +// Check if a byte array contains an image. Returns the name of the image format for images or a null string for non-image data. +QString isImageData(const QByteArray& data); + QStringList toStringList(const QList& list); QByteArray encodeString(const QByteArray& str, const QString& encoding); QByteArray decodeString(const QByteArray& str, const QString& encoding); +QString humanReadableSize(unsigned long byteCount); + #endif diff --git a/src/DbStructureModel.cpp b/src/DbStructureModel.cpp index 32e31dab..22c21576 100644 --- a/src/DbStructureModel.cpp +++ b/src/DbStructureModel.cpp @@ -1,5 +1,5 @@ #include "DbStructureModel.h" -#include +#include "IconCache.h" #include "sqlitedb.h" #include "sqlitetablemodel.h" #include "Settings.h" @@ -14,6 +14,7 @@ DbStructureModel::DbStructureModel(DBBrowserDB& db, QObject* parent) : QAbstractItemModel(parent), m_db(db), + browsablesRootItem(nullptr), m_dropQualifiedNames(false), m_dropEnquotedNames(false) { @@ -21,7 +22,6 @@ DbStructureModel::DbStructureModel(DBBrowserDB& db, QObject* parent) QStringList header; header << tr("Name") << tr("Object") << tr("Type") << tr("Schema") << tr("Database"); rootItem = new QTreeWidgetItem(header); - browsablesRootItem = nullptr; } DbStructureModel::~DbStructureModel() @@ -52,7 +52,7 @@ QVariant DbStructureModel::data(const QModelIndex& index, int role) const if(index.column() == ColumnName && item->parent() == browsablesRootItem) return QString::fromStdString(sqlb::ObjectIdentifier(item->text(ColumnSchema).toStdString(), item->text(ColumnName).toStdString()).toDisplayString()); else - return Settings::getValue("db", "hideschemalinebreaks").toBool() ? item->text(index.column()).replace("\n", " ").simplified() : item->text(index.column()); + return Settings::getValue("db", "hideschemalinebreaks").toBool() ? item->text(index.column()).simplified() : item->text(index.column()); case Qt::EditRole: return item->text(index.column()); case Qt::ToolTipRole: { @@ -341,8 +341,9 @@ void DbStructureModel::buildTree(QTreeWidgetItem* parent, const std::string& sch itemTriggers->setText(ColumnName, tr("Triggers (%1)").arg(calc_number_of_objects_by_type(objmap, "trigger"))); typeToParentItem.insert({"trigger", itemTriggers}); - // Get all database objects and sort them by their name - std::map dbobjs; + // Get all database objects and sort them by their name. + // This needs to be a multimap because SQLite allows views and triggers with the same name which means that names can appear twice. + std::multimap dbobjs; for(const auto& it : objmap) dbobjs.insert({it.second->name(), it.second}); @@ -364,7 +365,12 @@ void DbStructureModel::buildTree(QTreeWidgetItem* parent, const std::string& sch { sqlb::StringVector pk_columns; if(it->type() == sqlb::Object::Types::Table) - pk_columns = std::dynamic_pointer_cast(it)->primaryKey(); + { + const auto pk = std::dynamic_pointer_cast(it)->primaryKey(); + if(pk) + pk_columns = pk->columnList(); + } + for(const sqlb::FieldInfo& field : fieldList) { QTreeWidgetItem *fldItem = new QTreeWidgetItem(item); diff --git a/src/EditDialog.cpp b/src/EditDialog.cpp index 64f8499f..de749336 100644 --- a/src/EditDialog.cpp +++ b/src/EditDialog.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -20,6 +19,7 @@ #include #include #include +#include #include #include @@ -29,7 +29,7 @@ using json = nlohmann::json; EditDialog::EditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::EditDialog), - currentIndex(QModelIndex()), + m_currentIndex(QModelIndex()), dataSource(SciBuffer), dataType(Null), isReadOnly(true) @@ -50,12 +50,12 @@ EditDialog::EditDialog(QWidget* parent) sciLayout->addWidget(sciEdit); QShortcut* ins = new QShortcut(QKeySequence(Qt::Key_Insert), this); - connect(ins, SIGNAL(activated()), this, SLOT(toggleOverwriteMode())); + connect(ins, &QShortcut::activated, this, &EditDialog::toggleOverwriteMode); - connect(sciEdit, SIGNAL(textChanged()), this, SLOT(updateApplyButton())); - connect(sciEdit, SIGNAL(textChanged()), this, SLOT(editTextChanged())); - connect(ui->qtEdit, SIGNAL(textChanged()), this, SLOT(updateApplyButton())); - connect(hexEdit, SIGNAL(dataChanged()), this, SLOT(updateApplyButton())); + connect(sciEdit, &DockTextEdit::textChanged, this, &EditDialog::updateApplyButton); + connect(sciEdit, &DockTextEdit::textChanged, this, &EditDialog::editTextChanged); + connect(ui->qtEdit, &QTextEdit::textChanged, this, &EditDialog::updateApplyButton); + connect(hexEdit, &QHexEdit::dataChanged, this, &EditDialog::updateApplyButton); // Create shortcuts for the widgets that doesn't have its own print action or printing mechanism. QShortcut* shortcutPrint = new QShortcut(QKeySequence::Print, this, nullptr, nullptr, Qt::WidgetShortcut); @@ -66,6 +66,30 @@ EditDialog::EditDialog(QWidget* parent) ui->editorBinary->addAction(ui->actionPrint); ui->editorBinary->addAction(ui->actionCopyHexAscii); + // Set up popup menus + QMenu* popupImportFileMenu = new QMenu(this); + popupImportFileMenu->addAction(ui->actionImportInMenu); + popupImportFileMenu->addAction(ui->actionImportAsLink); + ui->actionImport->setMenu(popupImportFileMenu); + + connect(ui->actionImportAsLink, &QAction::triggered, this, [&]() { + importData(/* asLink */ true); + }); + + connect(ui->actionOpenInApp, &QAction::triggered, this, [&]() { + switch (dataSource) { + case SciBuffer: + emit requestUrlOrFileOpen(sciEdit->text()); + break; + case QtBuffer: + emit requestUrlOrFileOpen(ui->qtEdit->toPlainText()); + break; + default: + return; + } + }); + connect(ui->actionOpenInExternal, &QAction::triggered, this, &EditDialog::openDataWithExternal); + mustIndentAndCompact = Settings::getValue("databrowser", "indent_compact").toBool(); ui->actionIndent->setChecked(mustIndentAndCompact); @@ -86,7 +110,7 @@ EditDialog::~EditDialog() void EditDialog::setCurrentIndex(const QModelIndex& idx) { - currentIndex = QPersistentModelIndex(idx); + m_currentIndex = QPersistentModelIndex(idx); QByteArray bArrData = idx.data(Qt::EditRole).toByteArray(); loadData(bArrData); @@ -117,7 +141,6 @@ void EditDialog::reject() void EditDialog::loadData(const QByteArray& bArrdata) { QImage img; - QString textData; // Clear previously removed BOM removedBom.clear(); @@ -312,7 +335,7 @@ void EditDialog::loadData(const QByteArray& bArrdata) } } -void EditDialog::importData() +void EditDialog::importData(bool asLink) { // Get list of supported image file formats to include them in the file dialog filter QString image_formats; @@ -365,16 +388,22 @@ void EditDialog::importData() ); if(QFile::exists(fileName)) { - QFile file(fileName); - if(file.open(QIODevice::ReadOnly)) - { - QByteArray d = file.readAll(); - loadData(d); - file.close(); + if(asLink) { + QByteArray fileNameBa = fileName.toUtf8(); + loadData(fileNameBa); + updateCellInfoAndMode(fileNameBa); + } else { + QFile file(fileName); + if(file.open(QIODevice::ReadOnly)) + { + QByteArray d = file.readAll(); + loadData(d); + file.close(); - // Update the cell data info in the bottom left of the Edit Cell - // and update mode (if required) to the just imported data type. - updateCellInfoAndMode(d); + // Update the cell data info in the bottom left of the Edit Cell + // and update mode (if required) to the just imported data type. + updateCellInfoAndMode(d); + } } } } @@ -502,11 +531,11 @@ bool EditDialog::promptInvalidData(const QString& data_type, const QString& erro void EditDialog::accept() { - if(!currentIndex.isValid()) + if(!m_currentIndex.isValid()) return; if (dataType == Null) { - emit recordTextUpdated(currentIndex, hexEdit->data(), true); + emit recordTextUpdated(m_currentIndex, hexEdit->data(), true); return; } @@ -526,7 +555,7 @@ void EditDialog::accept() { sciEdit->clearErrorIndicators(); - QString oldData = currentIndex.data(Qt::EditRole).toString(); + QString oldData = m_currentIndex.data(Qt::EditRole).toString(); QString newData; bool proceed = true; @@ -553,12 +582,12 @@ void EditDialog::accept() if (proceed) // The data is different, so commit it back to the database - emit recordTextUpdated(currentIndex, newData.toUtf8(), false); + emit recordTextUpdated(m_currentIndex, newData.toUtf8(), false); } break; case DockTextEdit::XML: { - QString oldData = currentIndex.data(Qt::EditRole).toString(); + QString oldData = m_currentIndex.data(Qt::EditRole).toString(); QString newData; QDomDocument xmlDoc; @@ -583,27 +612,27 @@ void EditDialog::accept() } if (proceed) // The data is different, so commit it back to the database - emit recordTextUpdated(currentIndex, newData.toUtf8(), false); + emit recordTextUpdated(m_currentIndex, newData.toUtf8(), false); } break; } break; case HexBuffer: // The data source is the hex widget buffer, thus binary data - QByteArray oldData = currentIndex.data(Qt::EditRole).toByteArray(); + QByteArray oldData = m_currentIndex.data(Qt::EditRole).toByteArray(); QByteArray newData = hexEdit->data(); if (newData != oldData) - emit recordTextUpdated(currentIndex, newData, true); + emit recordTextUpdated(m_currentIndex, newData, true); break; } if (!newTextData.isEmpty()) { - QString oldData = currentIndex.data(Qt::EditRole).toString(); + QString oldData = m_currentIndex.data(Qt::EditRole).toString(); // Check first for null case, otherwise empty strings cannot overwrite NULL values - if ((currentIndex.data(Qt::EditRole).isNull() && dataType != Null) || oldData != newTextData) + if ((m_currentIndex.data(Qt::EditRole).isNull() && dataType != Null) || oldData != newTextData) // The data is different, so commit it back to the database - emit recordTextUpdated(currentIndex, removedBom + newTextData.toUtf8(), false); + emit recordTextUpdated(m_currentIndex, removedBom + newTextData.toUtf8(), false); } } @@ -629,10 +658,12 @@ void EditDialog::setDataInBuffer(const QByteArray& bArrdata, DataSources source) // We don't want this when the QtBuffer has been automatically switched due to the insertion of RTL text, // (detected through the state of the apply button) otherwise that would break the typing flow of the user. if (!isReadOnly) + { if (!ui->buttonApply->isEnabled()) ui->qtEdit->selectAll(); else ui->qtEdit->moveCursor(QTextCursor::End); + } ui->qtEdit->setEnabled(true); break; } @@ -841,11 +872,11 @@ void EditDialog::setMustIndentAndCompact(bool enable) if (ui->buttonApply->isEnabled()) { setDataInBuffer(sciEdit->text().toUtf8(), SciBuffer); } else - setCurrentIndex(currentIndex); + setCurrentIndex(m_currentIndex); } // Determine the type of data in the cell -int EditDialog::checkDataType(const QByteArray& bArrdata) +int EditDialog::checkDataType(const QByteArray& bArrdata) const { QByteArray cellData = bArrdata; @@ -854,12 +885,9 @@ int EditDialog::checkDataType(const QByteArray& bArrdata) return Null; } - // Check if it's an image. First do a quick test by calling canRead() which only checks the first couple of bytes or so. Only if - // that returned true, do a more sophisticated test of the data. This way we get both, good performance and proper data checking. - QBuffer imageBuffer(&cellData); - QImageReader readerBuffer(&imageBuffer); - QString imageFormat = readerBuffer.format(); - if(readerBuffer.canRead() && !readerBuffer.read().isNull()) + // Check if it's an image + QString imageFormat = isImageData(cellData); + if(!imageFormat.isNull()) return imageFormat == "svg" ? SVG : Image; // Check if it's text only @@ -868,7 +896,8 @@ int EditDialog::checkDataType(const QByteArray& bArrdata) if (cellData.startsWith("qtEdit->setFocus(); ui->qtEdit->selectAll(); + break; case HexEditor: hexEdit->setFocus(); break; @@ -991,7 +1021,7 @@ void EditDialog::updateCellInfoAndMode(const QByteArray& bArrdata) // Display the image dimensions and size QSize imageDimensions = imageReader.size(); - int imageSize = cellData.size(); + unsigned int imageSize = static_cast(cellData.size()); QString labelSizeText = tr("%1x%2 pixel(s)").arg(imageDimensions.width()).arg(imageDimensions.height()) + ", " + humanReadableSize(imageSize); @@ -1040,28 +1070,6 @@ void EditDialog::updateCellInfoAndMode(const QByteArray& bArrdata) } } -QString EditDialog::humanReadableSize(double byteCount) const -{ - QStringList units; - units << "" << "Ki" << "Mi" << "Gi" << "Ti" << "Pi" << "Ei" << "Zi"; - - for(const QString& unit : units) - { - if(fabs(byteCount) < 1024.0) - { - QString size = QString::number(byteCount, 'f', 2); - return size + " " + unit + "B"; - } - - byteCount /= 1024.0; - } - - QString yiUnit = "Yi"; - QString size = QString::number(byteCount, 'f', 2); - - return size + " " + yiUnit + "B"; -} - void EditDialog::reloadSettings() { // Set the (SQL) editor font for hex editor, since it needs a @@ -1115,29 +1123,28 @@ void EditDialog::openPrintDialog() QPrinter printer; QPrintPreviewDialog *dialog = new QPrintPreviewDialog(&printer); - QTextDocument *document = new QTextDocument(); - switch (dataSource) { - case SciBuffer: - // This case isn't really expected because the Scintilla widget has it's own printing slot - document->setPlainText(sciEdit->text()); - break; - case HexBuffer: - document->setPlainText(hexEdit->toReadableString()); - document->setDefaultFont(hexEdit->font()); - break; - case QtBuffer: - document->setPlainText(ui->qtEdit->toPlainText()); - break; - } + connect(dialog, &QPrintPreviewDialog::paintRequested, [this](QPrinter *previewPrinter) { + QTextDocument document; + switch (dataSource) { + case SciBuffer: + // This case isn't really expected because the Scintilla widget has it's own printing slot + document.setPlainText(sciEdit->text()); + break; + case HexBuffer: + document.setPlainText(hexEdit->toReadableString()); + document.setDefaultFont(hexEdit->font()); + break; + case QtBuffer: + document.setPlainText(ui->qtEdit->toPlainText()); + break; + } - connect(dialog, &QPrintPreviewDialog::paintRequested, [&](QPrinter *previewPrinter) { - document->print(previewPrinter); + document.print(previewPrinter); }); dialog->exec(); - delete dialog; - delete document; + } void EditDialog::openPrintImageDialog() @@ -1171,3 +1178,73 @@ void EditDialog::setWordWrapping(bool value) sciEdit->setWrapMode(value ? QsciScintilla::WrapWord : QsciScintilla::WrapNone); ui->qtEdit->setWordWrapMode(value ? QTextOption::WrapAtWordBoundaryOrAnywhere : QTextOption::NoWrap); } + +void EditDialog::openDataWithExternal() +{ + QString extension; + switch (dataType) { + case Image: { + // Images get special treatment. + // Determine the likely filename extension. + QByteArray cellData = hexEdit->data(); + QBuffer imageBuffer(&cellData); + QImageReader imageReader(&imageBuffer); + extension = imageReader.format().toLower().prepend("."); + break; + } + case Binary: + extension = FILE_EXT_BIN_DEFAULT; + break; + case RtlText: + case Text: + if (ui->comboMode->currentIndex() == XmlEditor) + extension = FILE_EXT_XML_DEFAULT; + else + extension = FILE_EXT_TXT_DEFAULT; + break; + case JSON: + extension = FILE_EXT_JSON_DEFAULT; + break; + case SVG: + extension = FILE_EXT_SVG_DEFAULT; + break; + case XML: + extension = FILE_EXT_XML_DEFAULT; + break; + case Null: + return; + } + QTemporaryFile file (QDir::tempPath() + QString("/DB4S-XXXXXX") + extension); + + if(file.open()) + { + switch (dataSource) { + case HexBuffer: + file.write(hexEdit->data()); + break; + case SciBuffer: + file.write(sciEdit->text().toUtf8()); + break; + case QtBuffer: + file.write(ui->qtEdit->toPlainText().toUtf8()); + break; + } + file.close(); + + emit requestUrlOrFileOpen(file.fileName()); + + QMessageBox::StandardButton reply = QMessageBox::information + (nullptr, + QApplication::applicationName(), + tr("The data has been saved to a temporary file and has been opened with the default application." + "You can edit now the file and when your are ready, you can apply the saved new data to the cell editor or cancel any changes."), + QMessageBox::Apply | QMessageBox::Cancel); + + QFile readFile(file.fileName()); + if(reply == QMessageBox::Apply && readFile.open(QIODevice::ReadOnly)){ + QByteArray d = readFile.readAll(); + loadData(d); + readFile.close(); + } + } +} diff --git a/src/EditDialog.h b/src/EditDialog.h index e029f658..7144a6f0 100644 --- a/src/EditDialog.h +++ b/src/EditDialog.h @@ -20,6 +20,7 @@ public: ~EditDialog() override; void setCurrentIndex(const QModelIndex& idx); + QPersistentModelIndex currentIndex() { return m_currentIndex; }; public slots: void setFocus(); @@ -31,7 +32,7 @@ protected: void showEvent(QShowEvent* ev) override; private slots: - void importData(); + void importData(bool asLink = false); void exportData(); void setNull(); void updateApplyButton(); @@ -50,12 +51,13 @@ private slots: signals: void recordTextUpdated(const QPersistentModelIndex& idx, const QByteArray& bArrdata, bool isBlob); + void requestUrlOrFileOpen(const QString& urlString); private: Ui::EditDialog* ui; QHexEdit* hexEdit; DockTextEdit* sciEdit; - QPersistentModelIndex currentIndex; + QPersistentModelIndex m_currentIndex; int dataSource; int dataType; bool isReadOnly; @@ -94,11 +96,11 @@ private: XmlEditor = 5 }; - int checkDataType(const QByteArray& bArrdata); - QString humanReadableSize(double byteCount) const; + int checkDataType(const QByteArray& bArrdata) const; bool promptInvalidData(const QString& data_type, const QString& errorString); void setDataInBuffer(const QByteArray& bArrdata, DataSources source); void setStackCurrentIndex(int editMode); + void openDataWithExternal(); }; #endif diff --git a/src/EditDialog.ui b/src/EditDialog.ui index aa3fc552..a1aab0fe 100644 --- a/src/EditDialog.ui +++ b/src/EditDialog.ui @@ -124,6 +124,8 @@ + + @@ -175,8 +177,8 @@ Errors are indicated with a red squiggle underline. 0 0 - 598 - 264 + 84 + 35 @@ -402,6 +404,63 @@ Errors are indicated with a red squiggle underline. Wrap lines on word boundaries + + + + :/icons/open_in_app:/icons/open_in_app + + + Open in default application or browser + + + Open in application + + + Open in default application or browser + + + The value is interpreted as a file or URL and opened in the default application or web browser. + + + + + + :/icons/document_link:/icons/document_link + + + Save file reference... + + + Save reference to file + + + + + + :/icons/document_open:/icons/document_open + + + &Import... + + + Import from file + + + Opens a file dialog used to import any kind of data to this database cell. + + + + + + :/icons/open_data_in_app:/icons/open_data_in_app + + + Open in external application + + + Open in external application + + comboMode @@ -604,6 +663,22 @@ Errors are indicated with a red squiggle underline. + + actionImportInMenu + triggered() + EditDialog + importData() + + + -1 + -1 + + + 308 + 190 + + + importData() diff --git a/src/EditIndexDialog.cpp b/src/EditIndexDialog.cpp index 5728c1b3..d8449b71 100644 --- a/src/EditIndexDialog.cpp +++ b/src/EditIndexDialog.cpp @@ -1,6 +1,7 @@ #include "EditIndexDialog.h" #include "ui_EditIndexDialog.h" #include "sqlitedb.h" +#include "IconCache.h" #include #include @@ -43,7 +44,7 @@ EditIndexDialog::EditIndexDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& } ui->comboTableName->blockSignals(true); for(auto it=dbobjs.cbegin();it!=dbobjs.cend();++it) - ui->comboTableName->addItem(QIcon(QString(":icons/table")), QString::fromStdString(it->first), QString::fromStdString(it->second.toSerialised())); + ui->comboTableName->addItem(IconCache::get("table"), QString::fromStdString(it->first), QString::fromStdString(it->second.toSerialised())); ui->comboTableName->blockSignals(false); QHeaderView *tableHeaderView = ui->tableIndexColumns->horizontalHeader(); @@ -263,7 +264,7 @@ void EditIndexDialog::accept() // When editing an index, delete the old one first if(!newIndex) { - if(!pdb.executeSQL(QString("DROP INDEX IF EXISTS %1;").arg(QString::fromStdString(curIndex.toString())))) + if(!pdb.executeSQL("DROP INDEX IF EXISTS " + curIndex.toString())) { QMessageBox::warning(this, qApp->applicationName(), tr("Deleting the old index failed:\n%1").arg(pdb.lastError())); return; @@ -271,7 +272,7 @@ void EditIndexDialog::accept() } // Create the new index in the schema of the selected table - if(pdb.executeSQL(QString::fromStdString(index.sql(sqlb::ObjectIdentifier(ui->comboTableName->currentData().toString().toStdString()).schema())))) + if(pdb.executeSQL(index.sql(sqlb::ObjectIdentifier(ui->comboTableName->currentData().toString().toStdString()).schema()))) QDialog::accept(); else QMessageBox::warning(this, QApplication::applicationName(), tr("Creating the index failed:\n%1").arg(pdb.lastError())); diff --git a/src/EditIndexDialog.h b/src/EditIndexDialog.h index 2b6c7ba8..79fa2ae7 100644 --- a/src/EditIndexDialog.h +++ b/src/EditIndexDialog.h @@ -39,7 +39,7 @@ private: sqlb::Index index; bool newIndex; Ui::EditIndexDialog* ui; - QString m_sRestorePointName; + std::string m_sRestorePointName; void updateColumnLists(); void updateSqlText(); diff --git a/src/EditTableDialog.cpp b/src/EditTableDialog.cpp index 2158dbb7..02a23030 100644 --- a/src/EditTableDialog.cpp +++ b/src/EditTableDialog.cpp @@ -4,14 +4,19 @@ #include "ui_EditTableDialog.h" #include "sqlitetablemodel.h" #include "sqlitedb.h" +#include "SelectItemsPopup.h" -#include -#include #include #include #include +#include +#include +#include + #include +Q_DECLARE_METATYPE(sqlb::ConstraintPtr) + EditTableDialog::EditTableDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& tableName, bool createTable, QWidget* parent) : QDialog(parent), ui(new Ui::EditTableDialog), @@ -24,16 +29,35 @@ EditTableDialog::EditTableDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& // Create UI ui->setupUi(this); ui->widgetExtension->setVisible(false); - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(itemChanged(QTreeWidgetItem*,int))); - - // TODO Remove this one we have added support for these buttons - ui->buttonAddConstraint->setVisible(false); - ui->buttonRemoveConstraint->setVisible(false); + connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &EditTableDialog::fieldItemChanged); + connect(ui->tableConstraints, &QTableWidget::itemChanged, this, &EditTableDialog::constraintItemChanged); // Set item delegate for foreign key column m_fkEditorDelegate = new ForeignKeyEditorDelegate(db, m_table, this); ui->treeWidget->setItemDelegateForColumn(kForeignKey, m_fkEditorDelegate); + // Set up popup menu for adding constraints + QMenu* constraint_menu = new QMenu(this); + constraint_menu->addAction(ui->actionAddPrimaryKey); + constraint_menu->addAction(ui->actionAddForeignKey); + constraint_menu->addAction(ui->actionAddUniqueConstraint); + constraint_menu->addAction(ui->actionAddCheckConstraint); + connect(ui->actionAddPrimaryKey, &QAction::triggered, [this]() { addConstraint(sqlb::Constraint::PrimaryKeyConstraintType); }); + connect(ui->actionAddForeignKey, &QAction::triggered, [this]() { addConstraint(sqlb::Constraint::ForeignKeyConstraintType); }); + connect(ui->actionAddUniqueConstraint, &QAction::triggered, [this]() { addConstraint(sqlb::Constraint::UniqueConstraintType); }); + connect(ui->actionAddCheckConstraint, &QAction::triggered, [this]() { addConstraint(sqlb::Constraint::CheckConstraintType); }); + ui->buttonAddConstraint->setMenu(constraint_menu); + + // Get list of all collations + db.executeSQL("PRAGMA collation_list;", false, true, [this](int column_count, std::vector columns, std::vector) -> bool { + if(column_count >= 2) + m_collationList.push_back(columns.at(1)); + return false; + }); + if(!m_collationList.contains("")) + m_collationList.push_back(""); + m_collationList.sort(); + // Editing an existing table? if(m_bNewTable == false) { @@ -65,6 +89,12 @@ EditTableDialog::EditTableDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& ui->labelEditWarning->setVisible(false); } + // Enable/disable remove constraint button depending on whether a constraint is selected + connect(ui->tableConstraints, &QTableWidget::itemSelectionChanged, [this]() { + bool hasSelection = ui->tableConstraints->selectionModel()->hasSelection(); + ui->buttonRemoveConstraint->setEnabled(hasSelection); + }); + // And create a savepoint pdb.setSavepoint(m_sRestorePointName); @@ -72,7 +102,48 @@ EditTableDialog::EditTableDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& ui->editTableName->setText(QString::fromStdString(curTable.name())); updateColumnWidth(); + // Allow editing of constraint columns by double clicking the columns column of the constraints table + connect(ui->tableConstraints, &QTableWidget::itemDoubleClicked, [this](QTableWidgetItem* item) { + // Check whether the double clicked item is in the columns column + if(item->column() == kConstraintColumns) + { + sqlb::ConstraintPtr constraint = ui->tableConstraints->item(item->row(), kConstraintColumns)->data(Qt::UserRole).value(); + + // Do not allow editing the columns list of a CHECK constraint because CHECK constraints are independent of column lists + if(constraint->type() == sqlb::Constraint::CheckConstraintType) + return; + + // Show the select items popup dialog + SelectItemsPopup* dialog = new SelectItemsPopup(m_table.fieldNames(), item->data(Qt::UserRole).value()->columnList(), this); + QRect item_rect = ui->tableConstraints->visualItemRect(item); + dialog->move(ui->tableConstraints->mapToGlobal(QPoint(ui->tableConstraints->x() + item_rect.x(), + ui->tableConstraints->y() + item_rect.y() + item_rect.height() / 2))); + dialog->show(); + + // When clicking the Apply button in the popup dialog, save the new columns list + connect(dialog, &SelectItemsPopup::accepted, [this, dialog, constraint]() { + // Check if column selection changed at all + sqlb::StringVector new_columns = dialog->selectedItems(); + if(constraint->columnList() != new_columns) + { + // Remove the constraint with the old columns and add a new one with the new columns + m_table.removeConstraint(constraint); + constraint->setColumnList(new_columns); + m_table.addConstraint(constraint); + + // Update the UI + populateFields(); + populateConstraints(); + updateSqlText(); + } + }); + } + }); + + // (De-)activate fields checkInput(); + + ui->sqlTextEdit->setReadOnly(true); } EditTableDialog::~EditTableDialog() @@ -111,14 +182,12 @@ void EditTableDialog::updateColumnWidth() void EditTableDialog::populateFields() { - // disconnect the itemChanged signal or the table item will - // be updated while filling the treewidget - disconnect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), - this,SLOT(itemChanged(QTreeWidgetItem*,int))); + // Disable the itemChanged signal or the table item will be updated while filling the treewidget + ui->treeWidget->blockSignals(true); ui->treeWidget->clear(); const auto& fields = m_table.fields; - sqlb::StringVector pk = m_table.primaryKey(); + const auto pk = m_table.primaryKey(); for(const sqlb::Field& f : fields) { QTreeWidgetItem *tbitem = new QTreeWidgetItem(ui->treeWidget); @@ -137,12 +206,12 @@ void EditTableDialog::populateFields() } typeBox->setCurrentIndex(index); typeBox->installEventFilter(this); - connect(typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypes())); + connect(typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypeAndCollation())); ui->treeWidget->setItemWidget(tbitem, kType, typeBox); tbitem->setCheckState(kNotNull, f.notnull() ? Qt::Checked : Qt::Unchecked); - tbitem->setCheckState(kPrimaryKey, contains(pk, f.name()) ? Qt::Checked : Qt::Unchecked); - tbitem->setCheckState(kAutoIncrement, f.autoIncrement() ? Qt::Checked : Qt::Unchecked); + tbitem->setCheckState(kPrimaryKey, pk && contains(pk->columnList(), f.name()) ? Qt::Checked : Qt::Unchecked); + tbitem->setCheckState(kAutoIncrement, pk && pk->autoIncrement() && contains(pk->columnList(), f.name()) ? Qt::Checked : Qt::Unchecked); tbitem->setCheckState(kUnique, f.unique() ? Qt::Checked : Qt::Unchecked); // For the default value check if it is surrounded by parentheses and if that's the case @@ -155,6 +224,21 @@ void EditTableDialog::populateFields() tbitem->setText(kCheck, QString::fromStdString(f.check())); + QComboBox* collationBox = new QComboBox(ui->treeWidget); + collationBox->setProperty("column", QString::fromStdString(f.name())); + collationBox->addItems(m_collationList); + index = collationBox->findText(QString::fromStdString(f.collation()), Qt::MatchCaseSensitive); + if(index == -1) + { + // some non-existing collation + collationBox->addItem(QString::fromStdString(f.collation())); + index = collationBox->count() - 1; + } + collationBox->setCurrentIndex(index); + collationBox->installEventFilter(this); + connect(collationBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypeAndCollation())); + ui->treeWidget->setItemWidget(tbitem, kCollation, collationBox); + auto fk = std::dynamic_pointer_cast(m_table.constraint({f.name()}, sqlb::Constraint::ForeignKeyConstraintType)); if(fk) tbitem->setText(kForeignKey, QString::fromStdString(fk->toString())); @@ -162,60 +246,75 @@ void EditTableDialog::populateFields() } // and reconnect - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(itemChanged(QTreeWidgetItem*,int))); + ui->treeWidget->blockSignals(false); } void EditTableDialog::populateConstraints() { + // Disable the itemChanged signal or the table item will be updated while filling the treewidget + ui->tableConstraints->blockSignals(true); + const auto& constraints = m_table.allConstraints(); - ui->tableConstraints->blockSignals(true); ui->tableConstraints->setRowCount(static_cast(constraints.size())); int row = 0; - for(const auto& pair : constraints) + for(const auto& constraint : constraints) { - const auto& columns = pair.first; - const auto& constraint = pair.second; + const auto columns = constraint->columnList(); // Columns QTableWidgetItem* column = new QTableWidgetItem(QString::fromStdString(sqlb::joinStringVector(columns, ","))); column->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + column->setData(Qt::UserRole, QVariant::fromValue(constraint)); // Remember address of constraint object. This is used for modifying it later ui->tableConstraints->setItem(row, kConstraintColumns, column); // Type QComboBox* type = new QComboBox(this); - type->addItem(tr("Primary Key")); + type->addItem(tr("Primary Key")); // NOTE: The order of the items here have to match the order in the sqlb::Constraint::ConstraintTypes enum! type->addItem(tr("Unique")); type->addItem(tr("Foreign Key")); type->addItem(tr("Check")); - switch(constraint->type()) - { - case sqlb::Constraint::PrimaryKeyConstraintType: - type->setCurrentIndex(0); - break; - case sqlb::Constraint::UniqueConstraintType: - type->setCurrentIndex(1); - break; - case sqlb::Constraint::ForeignKeyConstraintType: - type->setCurrentIndex(2); - break; - case sqlb::Constraint::CheckConstraintType: - type->setCurrentIndex(3); - break; - default: - type->addItem(tr("Unknown")); - type->setCurrentIndex(type->count()-1); - } + type->setCurrentIndex(constraint->type()); + connect(type, static_cast(&QComboBox::currentIndexChanged), [this, type, constraint](int index) { + // Handle change of constraint type. Effectively this means removing the old constraint and replacing it by an entirely new one. + // Only the column list and the name can be migrated to the new constraint. + + // Make sure there is only one primary key at a time + if(index == 0 && m_table.primaryKey()) + { + QMessageBox::warning(this, qApp->applicationName(), tr("There can only be one primary key for each table. Please modify the existing primary " + "key instead.")); + + // Set combo box back to original constraint type + type->blockSignals(true); + type->setCurrentIndex(constraint->type()); + type->blockSignals(false); + return; + } + + // Create new constraint depending on selected type + sqlb::ConstraintPtr new_constraint = sqlb::Constraint::makeConstraint(static_cast(index)); + new_constraint->setName(constraint->name()); + new_constraint->setColumnList(constraint->columnList()); + + // Replace old by new constraint + m_table.replaceConstraint(constraint, new_constraint); + + // Update SQL and view + populateFields(); + populateConstraints(); + updateSqlText(); + }); ui->tableConstraints->setCellWidget(row, kConstraintType, type); // Name QTableWidgetItem* name = new QTableWidgetItem(QString::fromStdString(constraint->name())); - name->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled /* TODO | Qt::ItemIsEditable */); + name->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); ui->tableConstraints->setItem(row, kConstraintName, name); // SQL - QTableWidgetItem* sql = new QTableWidgetItem(QString::fromStdString(constraint->toSql(columns))); - name->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + QTableWidgetItem* sql = new QTableWidgetItem(QString::fromStdString(constraint->toSql())); + sql->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableConstraints->setItem(row, kConstraintSql, sql); row++; @@ -231,7 +330,7 @@ void EditTableDialog::accept() if(m_bNewTable) { // Creation of new table - if(!pdb.executeSQL(QString::fromStdString(m_table.sql(ui->comboSchema->currentText().toStdString())))) + if(!pdb.executeSQL(m_table.sql(ui->comboSchema->currentText().toStdString()))) { QMessageBox::warning( this, @@ -277,7 +376,6 @@ void EditTableDialog::checkInput() if (normTableName != m_table.name()) { const std::string oldTableName = m_table.name(); m_table.setName(normTableName); - m_fkEditorDelegate->updateTablesList(oldTableName); // update fk's that refer to table itself recursively const auto& fields = m_table.fields; @@ -294,19 +392,33 @@ void EditTableDialog::checkInput() ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid); } -void EditTableDialog::updateTypes(QObject *object) +void EditTableDialog::updateTypeAndCollation(QObject* object) { - QComboBox* typeBox = qobject_cast(object); - if(typeBox) + // Get sender combo box and retrieve field name from it + QComboBox* combo = qobject_cast(object); + if(!combo) + return; + QString column = combo->property("column").toString(); + + // Get type *and* collation combo box for this field + auto item = ui->treeWidget->findItems(column, Qt::MatchExactly, kName); + if(item.size() != 1) + return; + QComboBox* typeBox = qobject_cast(ui->treeWidget->itemWidget(item.front(), kType)); + QComboBox* collationBox = qobject_cast(ui->treeWidget->itemWidget(item.front(), kCollation)); + + // Update table + if(typeBox && collationBox) { QString type = typeBox->currentText(); - std::string column = typeBox->property("column").toString().toStdString(); + QString collation = collationBox->currentText(); for(size_t index=0; index < m_table.fields.size(); ++index) { - if(m_table.fields.at(index).name() == column) + if(m_table.fields.at(index).name() == column.toStdString()) { m_table.fields.at(index).setType(type.toStdString()); + m_table.fields.at(index).setCollation(collation.toStdString()); break; } } @@ -315,21 +427,21 @@ void EditTableDialog::updateTypes(QObject *object) } } -void EditTableDialog::updateTypes() +void EditTableDialog::updateTypeAndCollation() { - updateTypes(sender()); + updateTypeAndCollation(sender()); } bool EditTableDialog::eventFilter(QObject *object, QEvent *event) { if(event->type() == QEvent::FocusOut) { - updateTypes(object); + updateTypeAndCollation(object); } return false; } -void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) +void EditTableDialog::fieldItemChanged(QTreeWidgetItem *item, int column) { size_t index = static_cast(ui->treeWidget->indexOfTopLevelItem(item)); if(index < m_table.fields.size()) @@ -362,20 +474,20 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) // When editing an exiting table, check if any foreign keys would cause trouble in case this name is edited if(!m_bNewTable) { - sqlb::StringVector pk = m_table.primaryKey(); + const auto pk = m_table.primaryKey(); const auto tables = pdb.schemata[curTable.schema()].equal_range("table"); for(auto it=tables.first;it!=tables.second;++it) { const sqlb::ObjectPtr& fkobj = it->second; - auto fks = std::dynamic_pointer_cast(fkobj)->constraints(sqlb::StringVector(), sqlb::Constraint::ForeignKeyConstraintType); + auto fks = std::dynamic_pointer_cast(fkobj)->constraints({}, sqlb::Constraint::ForeignKeyConstraintType); for(const sqlb::ConstraintPtr& fkptr : fks) { auto fk = std::dynamic_pointer_cast(fkptr); if(fk->table() == m_table.name()) { - if(contains(fk->columns(), field.name()) || contains(pk, field.name())) + if(contains(fk->columns(), field.name()) || (pk && contains(pk->columnList(), field.name()))) { QMessageBox::warning(this, qApp->applicationName(), tr("This column is referenced in a foreign key in table %1 and thus " "its name cannot be changed.") @@ -394,6 +506,7 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) field.setName(item->text(column).toStdString()); m_table.renameKeyInAllConstraints(oldFieldName.toStdString(), item->text(column).toStdString()); qobject_cast(ui->treeWidget->itemWidget(item, kType))->setProperty("column", item->text(column)); + qobject_cast(ui->treeWidget->itemWidget(item, kCollation))->setProperty("column", item->text(column)); // Update the field name in the map of old column names to new column names if(!m_bNewTable) @@ -409,28 +522,29 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) populateConstraints(); } break; case kType: - // see updateTypes() SLOT + case kCollation: + // see updateTypeAndCollation() SLOT break; case kPrimaryKey: { // Check if there already is a primary key - if(m_table.constraint(sqlb::StringVector(), sqlb::Constraint::PrimaryKeyConstraintType)) + auto pk = m_table.primaryKey(); + if(pk) { // There already is a primary key for this table. So edit that one as there always can only be one primary key anyway. - sqlb::StringVector& pk = m_table.primaryKeyRef(); if(item->checkState(column) == Qt::Checked) { - pk.push_back(field.name()); + pk->addToColumnList(field.name()); } else { - pk.erase(std::remove(pk.begin(), pk.end(), field.name()), pk.end()); + pk->removeFromColumnList(field.name()); // If this is now a primary key constraint without any columns, remove it entirely - if(pk.empty()) + if(pk->columnList().empty()) m_table.removeConstraints({}, sqlb::Constraint::PrimaryKeyConstraintType); } } else if(item->checkState(column) == Qt::Checked) { // There is no primary key in the table yet. This means we need to add a default one. - m_table.addConstraint({field.name()}, sqlb::ConstraintPtr(new sqlb::PrimaryKeyConstraint())); + m_table.addConstraint(sqlb::ConstraintPtr(new sqlb::PrimaryKeyConstraint({field.name()}))); } if(item->checkState(column) == Qt::Checked) @@ -459,10 +573,10 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) // we need to check for this case and cancel here. Maybe we can think of some way to modify the INSERT INTO ... SELECT statement // to at least replace all troublesome NULL values by the default value SqliteTableModel m(pdb, this); - m.setQuery(QString("SELECT COUNT(%1) FROM %2 WHERE coalesce(NULL,%3) IS NULL;") - .arg(QString::fromStdString(sqlb::joinStringVector(sqlb::escapeIdentifier(pdb.getObjectByName(curTable)->rowidColumns()), ","))) - .arg(QString::fromStdString(curTable.toString())) - .arg(QString::fromStdString(sqlb::escapeIdentifier(field.name())))); + m.setQuery(QString("SELECT COUNT(%1) FROM %2 WHERE coalesce(NULL,%3) IS NULL;").arg( + QString::fromStdString(sqlb::joinStringVector(sqlb::escapeIdentifier(pdb.getObjectByName(curTable)->rowidColumns()), ",")), + QString::fromStdString(curTable.toString()), + QString::fromStdString(sqlb::escapeIdentifier(field.name())))); if(!m.completeCache()) { // If we couldn't load all data because the cancel button was clicked, just unset the checkbox again and stop. @@ -490,10 +604,10 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) if(!m_bNewTable) { SqliteTableModel m(pdb, this); - m.setQuery(QString("SELECT COUNT(*) FROM %1 WHERE %2 <> CAST(%3 AS INTEGER);") - .arg(QString::fromStdString(curTable.toString())) - .arg(QString::fromStdString(sqlb::escapeIdentifier(field.name()))) - .arg(QString::fromStdString(sqlb::escapeIdentifier(field.name())))); + m.setQuery(QString("SELECT COUNT(*) FROM %1 WHERE %2 <> CAST(%3 AS INTEGER);").arg( + QString::fromStdString(curTable.toString()), + QString::fromStdString(sqlb::escapeIdentifier(field.name())), + QString::fromStdString(sqlb::escapeIdentifier(field.name())))); if(!m.completeCache()) { // If we couldn't load all data because the cancel button was clicked, just unset the checkbox again and stop. @@ -527,7 +641,8 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) } } } - field.setAutoIncrement(ischecked); + if(m_table.primaryKey()) + m_table.primaryKey()->setAutoIncrement(ischecked); } break; case kUnique: @@ -537,7 +652,9 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) { // Because our renameColumn() function fails when setting a column to unique when it already contains the same values SqliteTableModel m(pdb, this); - m.setQuery(QString("SELECT COUNT(%2) FROM %1;").arg(QString::fromStdString(curTable.toString())).arg(QString::fromStdString(sqlb::escapeIdentifier(field.name())))); + m.setQuery(QString("SELECT COUNT(%2) FROM %1;").arg( + QString::fromStdString(curTable.toString()), + QString::fromStdString(sqlb::escapeIdentifier(field.name())))); if(!m.completeCache()) { // If we couldn't load all data because the cancel button was clicked, just unset the checkbox again and stop. @@ -545,7 +662,9 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) return; } int rowcount = m.data(m.index(0, 0)).toInt(); - m.setQuery(QString("SELECT COUNT(DISTINCT %2) FROM %1;").arg(QString::fromStdString(curTable.toString())).arg(QString::fromStdString(sqlb::escapeIdentifier(field.name())))); + m.setQuery(QString("SELECT COUNT(DISTINCT %2) FROM %1;").arg( + QString::fromStdString(curTable.toString()), + QString::fromStdString(sqlb::escapeIdentifier(field.name())))); if(!m.completeCache()) { // If we couldn't load all data because the cancel button was clicked, just unset the checkbox again and stop. @@ -586,7 +705,7 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) { new_value = new_value.trimmed().mid(1); // Leave the brackets as they are needed for a valid SQL expression } else { - new_value = QString("'%1'").arg(new_value.replace("'", "''")); + new_value = sqlb::escapeString(new_value); item->setText(column, new_value); } } @@ -607,6 +726,24 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) checkInput(); } +void EditTableDialog::constraintItemChanged(QTableWidgetItem* item) +{ + // Find modified constraint + sqlb::ConstraintPtr constraint = ui->tableConstraints->item(item->row(), kConstraintColumns)->data(Qt::UserRole).value(); + + // Which column has been modified? + switch(item->column()) + { + case kConstraintName: + constraint->setName(item->text().toStdString()); + break; + } + + // Update SQL + ui->tableConstraints->item(item->row(), kConstraintSql)->setText(QString::fromStdString(constraint->toSql())); + checkInput(); +} + void EditTableDialog::addField() { QTreeWidgetItem *tbitem = new QTreeWidgetItem(ui->treeWidget); @@ -639,7 +776,15 @@ void EditTableDialog::addField() ui->treeWidget->setItemWidget(tbitem, kType, typeBox); typeBox->installEventFilter(this); - connect(typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypes())); + connect(typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypeAndCollation())); + + QComboBox* collationBox = new QComboBox(ui->treeWidget); + collationBox->setProperty("column", tbitem->text(kName)); + collationBox->addItems(m_collationList); + collationBox->setCurrentIndex(collationBox->findText("")); + ui->treeWidget->setItemWidget(tbitem, kCollation, collationBox); + collationBox->installEventFilter(this); + connect(collationBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypeAndCollation())); tbitem->setCheckState(kNotNull, Qt::Unchecked); tbitem->setCheckState(kPrimaryKey, Qt::Unchecked); @@ -706,46 +851,77 @@ void EditTableDialog::fieldSelectionChanged() if(hasSelection) { ui->buttonMoveUp->setEnabled(ui->treeWidget->selectionModel()->currentIndex().row() != 0); + ui->buttonMoveTop->setEnabled(ui->buttonMoveUp->isEnabled()); ui->buttonMoveDown->setEnabled(ui->treeWidget->selectionModel()->currentIndex().row() != ui->treeWidget->topLevelItemCount() - 1); + ui->buttonMoveBottom->setEnabled(ui->buttonMoveDown->isEnabled()); } } void EditTableDialog::moveUp() { - moveCurrentField(false); + moveCurrentField(MoveUp); } void EditTableDialog::moveDown() { - moveCurrentField(true); + moveCurrentField(MoveDown); } -void EditTableDialog::moveCurrentField(bool down) +void EditTableDialog::moveTop() +{ + moveCurrentField(MoveTop); +} + +void EditTableDialog::moveBottom() +{ + moveCurrentField(MoveBottom); +} + +void EditTableDialog::moveCurrentField(MoveFieldDirection dir) { int currentRow = ui->treeWidget->currentIndex().row(); - int newRow = currentRow + (down ? 1 : -1); + int newRow; + if(dir == MoveUp) + newRow = currentRow - 1; + else if(dir == MoveDown) + newRow = currentRow + 1; + else if(dir == MoveTop) + newRow = 0; + else if(dir == MoveBottom) + newRow = ui->treeWidget->topLevelItemCount() - 1; + else + return; - // Save the combobox first by making a copy - QComboBox* oldCombo = qobject_cast(ui->treeWidget->itemWidget(ui->treeWidget->topLevelItem(currentRow), kType)); - QComboBox* newCombo = new QComboBox(ui->treeWidget); - newCombo->setProperty("column", oldCombo->property("column")); - newCombo->installEventFilter(this); - connect(newCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypes())); - newCombo->setEditable(true); - for(int i=0; i < oldCombo->count(); ++i) - newCombo->addItem(oldCombo->itemText(i)); - newCombo->setCurrentIndex(oldCombo->currentIndex()); + // Save the comboboxes first by making copies + QComboBox* newCombo[2]; + for(int c=0;c<2;c++) + { + int column = (c == 0 ? kType : kCollation); + + QComboBox* oldCombo = qobject_cast(ui->treeWidget->itemWidget(ui->treeWidget->topLevelItem(currentRow), column)); + newCombo[c] = new QComboBox(ui->treeWidget); + newCombo[c]->setProperty("column", oldCombo->property("column")); + newCombo[c]->installEventFilter(this); + connect(newCombo[c], SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypeAndCollation())); + newCombo[c]->setEditable(oldCombo->isEditable()); + for(int i=0; i < oldCombo->count(); ++i) + newCombo[c]->addItem(oldCombo->itemText(i)); + newCombo[c]->setCurrentIndex(oldCombo->currentIndex()); + } // Now, just remove the item and insert it at it's new position, then restore the combobox QTreeWidgetItem* item = ui->treeWidget->takeTopLevelItem(currentRow); ui->treeWidget->insertTopLevelItem(newRow, item); - ui->treeWidget->setItemWidget(item, kType, newCombo); + ui->treeWidget->setItemWidget(item, kType, newCombo[0]); + ui->treeWidget->setItemWidget(item, kCollation, newCombo[1]); // Select the old item at its new position ui->treeWidget->setCurrentIndex(ui->treeWidget->currentIndex().sibling(newRow, 0)); // Finally update the table SQL - std::swap(m_table.fields[static_cast(newRow)], m_table.fields[static_cast(currentRow)]); + sqlb::Field temp = m_table.fields[static_cast(currentRow)]; + m_table.fields.erase(m_table.fields.begin() + currentRow); + m_table.fields.insert(m_table.fields.begin() + newRow, temp); // Update the SQL preview updateSqlText(); @@ -756,24 +932,20 @@ void EditTableDialog::setWithoutRowid(bool without_rowid) if(without_rowid) { // Before setting the without rowid flag, first perform a check to see if the table meets all the required criteria for without rowid tables - auto pks = m_table.primaryKey(); - for(const auto& pk_name : pks) + const auto pk = m_table.primaryKey(); + if(!pk || pk->autoIncrement()) { - auto pk = sqlb::findField(m_table, pk_name); - if(pk == m_table.fields.end() || pk->autoIncrement()) - { - QMessageBox::information(this, QApplication::applicationName(), - tr("Please add a field which meets the following criteria before setting the without rowid flag:\n" - " - Primary key flag set\n" - " - Auto increment disabled")); + QMessageBox::information(this, QApplication::applicationName(), + tr("Please add a field which meets the following criteria before setting the without rowid flag:\n" + " - Primary key flag set\n" + " - Auto increment disabled")); - // Reset checkbox state to unchecked. Block any signals while doing this in order to avoid an extra call to - // this function being triggered. - ui->checkWithoutRowid->blockSignals(true); - ui->checkWithoutRowid->setChecked(false); - ui->checkWithoutRowid->blockSignals(false); - return; - } + // Reset checkbox state to unchecked. Block any signals while doing this in order to avoid an extra call to + // this function being triggered. + ui->checkWithoutRowid->blockSignals(true); + ui->checkWithoutRowid->setChecked(false); + ui->checkWithoutRowid->blockSignals(false); + return; } // If it does, set the without rowid flag of the table @@ -792,3 +964,45 @@ void EditTableDialog::changeSchema(const QString& /*schema*/) // Update the SQL preview updateSqlText(); } + +void EditTableDialog::removeConstraint() +{ + // Is there any item selected to delete? + if(!ui->tableConstraints->currentItem()) + return; + + // Find constraint to delete + int row = ui->tableConstraints->currentRow(); + sqlb::ConstraintPtr constraint = ui->tableConstraints->item(row, kConstraintColumns)->data(Qt::UserRole).value(); + + // Remove the constraint. If there is more than one constraint with this combination of columns and constraint type, only delete the first one. + m_table.removeConstraint(constraint); + ui->tableConstraints->removeRow(ui->tableConstraints->currentRow()); + + // Update SQL and view + updateSqlText(); + populateFields(); +} + +void EditTableDialog::addConstraint(sqlb::Constraint::ConstraintTypes type) +{ + // There can only be one primary key + if(type == sqlb::Constraint::PrimaryKeyConstraintType) + { + if(m_table.primaryKey()) + { + QMessageBox::information(this, qApp->applicationName(), tr("There can only be one primary key for each table. Please modify the existing primary " + "key instead.")); + return; + } + } + + // Create new constraint + sqlb::ConstraintPtr constraint = sqlb::Constraint::makeConstraint(type); + m_table.addConstraint(constraint); + + // Update SQL and view + populateFields(); + populateConstraints(); + updateSqlText(); +} diff --git a/src/EditTableDialog.h b/src/EditTableDialog.h index 5641ed00..7c7191af 100644 --- a/src/EditTableDialog.h +++ b/src/EditTableDialog.h @@ -9,9 +9,11 @@ #include class DBBrowserDB; -class QTreeWidgetItem; class ForeignKeyEditorDelegate; +class QTableWidgetItem; +class QTreeWidgetItem; + namespace Ui { class EditTableDialog; } @@ -37,7 +39,8 @@ private: kUnique = 5, kDefault = 6, kCheck = 7, - kForeignKey = 8 + kCollation = 8, + kForeignKey = 9 }; enum ConstraintColumns { @@ -47,10 +50,18 @@ private: kConstraintSql = 3 }; + enum MoveFieldDirection + { + MoveUp, + MoveDown, + MoveTop, + MoveBottom + }; + void updateColumnWidth(); void updateSqlText(); - void moveCurrentField(bool down); + void moveCurrentField(MoveFieldDirection dir); private slots: void populateFields(); @@ -61,14 +72,19 @@ private slots: void accept() override; void reject() override; void checkInput(); - void itemChanged(QTreeWidgetItem* item, int column); - void updateTypes(QObject *object); + void fieldItemChanged(QTreeWidgetItem* item, int column); + void constraintItemChanged(QTableWidgetItem* item); + void updateTypeAndCollation(QObject *object); bool eventFilter(QObject *object, QEvent *event) override; - void updateTypes(); + void updateTypeAndCollation(); void moveUp(); void moveDown(); + void moveTop(); + void moveBottom(); void setWithoutRowid(bool without_rowid); void changeSchema(const QString& schema); + void removeConstraint(); + void addConstraint(sqlb::Constraint::ConstraintTypes type); private: Ui::EditTableDialog* ui; @@ -78,7 +94,8 @@ private: std::map trackColumns; sqlb::Table m_table; bool m_bNewTable; - QString m_sRestorePointName; + std::string m_sRestorePointName; + QStringList m_collationList; }; #endif diff --git a/src/EditTableDialog.ui b/src/EditTableDialog.ui index 987d9d36..a4cf5053 100644 --- a/src/EditTableDialog.ui +++ b/src/EditTableDialog.ui @@ -6,7 +6,7 @@ 0 0 - 650 + 652 600 @@ -111,7 +111,7 @@ - Add field + Add @@ -131,7 +131,7 @@ false - Remove field + Remove @@ -145,13 +145,36 @@ + + + + false + + + Move to top + + + + :/icons/arrow_top:/icons/arrow_top + + + Qt::ToolButtonTextBesideIcon + + + true + + + Qt::NoArrow + + + false - Move field up + Move up @@ -171,7 +194,7 @@ false - Move field down + Move down @@ -185,6 +208,26 @@ + + + + false + + + Move to bottom + + + + :/icons/arrow_bottom:/icons/arrow_bottom + + + Qt::ToolButtonTextBesideIcon + + + true + + + @@ -275,6 +318,11 @@ Check constraint + + + Collation + + Foreign Key @@ -300,6 +348,9 @@ :/icons/field_add:/icons/field_add + + QToolButton::InstantPopup + Qt::ToolButtonTextBesideIcon @@ -401,6 +452,46 @@ + + + + :/icons/field_key:/icons/field_key + + + Primary Key + + + Add a primary key constraint + + + + + + :/icons/field_fk:/icons/field_fk + + + Foreign Key + + + Add a foreign key constraint + + + + + Unique + + + Add a unique constraint + + + + + Check + + + Add a check constraint + + @@ -415,12 +506,18 @@ buttonMore comboSchema checkWithoutRowid + groupDefinition addFieldButton removeFieldButton + buttonMoveTop buttonMoveUp buttonMoveDown + buttonMoveBottom treeWidget sqlTextEdit + buttonAddConstraint + buttonRemoveConstraint + tableConstraints @@ -481,8 +578,8 @@ addField() - 94 - 253 + 78 + 255 79 @@ -497,8 +594,8 @@ removeField() - 222 - 253 + 167 + 255 249 @@ -565,8 +662,8 @@ 78 - 117 - 176 + 138 + 172 @@ -577,8 +674,8 @@ setWithoutRowid(bool) - 344 - 143 + 485 + 160 324 @@ -609,8 +706,8 @@ changeSchema(QString) - 186 - 155 + 327 + 139 647 @@ -618,6 +715,54 @@ + + buttonRemoveConstraint + clicked() + EditTableDialog + removeConstraint() + + + 295 + 255 + + + 647 + 157 + + + + + buttonMoveTop + clicked() + EditTableDialog + moveTop() + + + 207 + 240 + + + 202 + 190 + + + + + buttonMoveBottom + clicked() + EditTableDialog + moveBottom() + + + 530 + 246 + + + 400 + 186 + + + fieldSelectionChanged() @@ -630,5 +775,8 @@ moveDown() setWithoutRowid(bool) changeSchema(QString) + removeConstraint() + moveTop() + moveBottom() diff --git a/src/ExportDataDialog.cpp b/src/ExportDataDialog.cpp index 6fabb034..6d2e3820 100644 --- a/src/ExportDataDialog.cpp +++ b/src/ExportDataDialog.cpp @@ -4,6 +4,7 @@ #include "Settings.h" #include "sqlite.h" #include "FileDialog.h" +#include "IconCache.h" #include #include @@ -13,7 +14,7 @@ using json = nlohmann::json; -ExportDataDialog::ExportDataDialog(DBBrowserDB& db, ExportFormats format, QWidget* parent, const QString& query, const sqlb::ObjectIdentifier& selection) +ExportDataDialog::ExportDataDialog(DBBrowserDB& db, ExportFormats format, QWidget* parent, const std::string& query, const sqlb::ObjectIdentifier& selection) : QDialog(parent), ui(new Ui::ExportDataDialog), pdb(db), @@ -40,7 +41,7 @@ ExportDataDialog::ExportDataDialog(DBBrowserDB& db, ExportFormats format, QWidge showCustomCharEdits(); // If a SQL query was specified hide the table combo box. If not fill it with tables to export - if(query.isEmpty()) + if(query.empty()) { // Get list of tables to export for(const auto& it : pdb.schemata) @@ -56,7 +57,7 @@ ExportDataDialog::ExportDataDialog(DBBrowserDB& db, ExportFormats format, QWidge for(const auto& jt : objects) { sqlb::ObjectIdentifier obj(it.first, jt.second->name()); - QListWidgetItem* item = new QListWidgetItem(QIcon(QString(":icons/%1").arg(QString::fromStdString(sqlb::Object::typeToString(jt.second->type())))), QString::fromStdString(obj.toDisplayString())); + QListWidgetItem* item = new QListWidgetItem(IconCache::get(sqlb::Object::typeToString(jt.second->type())), QString::fromStdString(obj.toDisplayString())); item->setData(Qt::UserRole, QString::fromStdString(obj.toSerialised())); ui->listTables->addItem(item); } @@ -90,7 +91,7 @@ ExportDataDialog::~ExportDataDialog() delete ui; } -bool ExportDataDialog::exportQuery(const QString& sQuery, const QString& sFilename) +bool ExportDataDialog::exportQuery(const std::string& sQuery, const QString& sFilename) { switch(m_format) { @@ -103,7 +104,7 @@ bool ExportDataDialog::exportQuery(const QString& sQuery, const QString& sFilena return false; } -bool ExportDataDialog::exportQueryCsv(const QString& sQuery, const QString& sFilename) +bool ExportDataDialog::exportQueryCsv(const std::string& sQuery, const QString& sFilename) { // Prepare the quote and separating characters QChar quoteChar = currentQuoteChar(); @@ -121,11 +122,10 @@ bool ExportDataDialog::exportQueryCsv(const QString& sQuery, const QString& sFil // Open text stream to the file QTextStream stream(&file); - QByteArray utf8Query = sQuery.toUtf8(); - sqlite3_stmt *stmt; - auto pDb = pdb.get(tr("exporting CSV")); - int status = sqlite3_prepare_v2(pDb.get(), utf8Query.data(), utf8Query.size(), &stmt, nullptr); + + sqlite3_stmt* stmt; + int status = sqlite3_prepare_v2(pDb.get(), sQuery.c_str(), static_cast(sQuery.size()), &stmt, nullptr); if(SQLITE_OK == status) { if(ui->checkHeader->isChecked()) @@ -199,17 +199,16 @@ bool ExportDataDialog::exportQueryCsv(const QString& sQuery, const QString& sFil return true; } -bool ExportDataDialog::exportQueryJson(const QString& sQuery, const QString& sFilename) +bool ExportDataDialog::exportQueryJson(const std::string& sQuery, const QString& sFilename) { // Open file QFile file(sFilename); if(file.open(QIODevice::WriteOnly)) { - QByteArray utf8Query = sQuery.toUtf8(); - sqlite3_stmt *stmt; - auto pDb = pdb.get(tr("exporting JSON")); - int status = sqlite3_prepare_v2(pDb.get(), utf8Query.data(), utf8Query.size(), &stmt, nullptr); + + sqlite3_stmt* stmt; + int status = sqlite3_prepare_v2(pDb.get(), sQuery.c_str(), static_cast(sQuery.size()), &stmt, nullptr); json json_table; @@ -316,7 +315,7 @@ void ExportDataDialog::accept() break; } - if(!m_sQuery.isEmpty()) + if(!m_sQuery.empty()) { // called from sqlexecute query tab QString sFilename = FileDialog::getSaveFileName( @@ -382,7 +381,7 @@ void ExportDataDialog::accept() { // if we are called from execute sql tab, query is already set // and we only export 1 select - QString sQuery = QString("SELECT * FROM %1;").arg(QString::fromStdString(sqlb::ObjectIdentifier(selectedItems.at(i)->data(Qt::UserRole).toString().toStdString()).toString())); + std::string sQuery = "SELECT * FROM " + sqlb::ObjectIdentifier(selectedItems.at(i)->data(Qt::UserRole).toString().toStdString()).toString() + ";"; exportQuery(sQuery, filenames.at(i)); } } diff --git a/src/ExportDataDialog.h b/src/ExportDataDialog.h index 63cb3e1e..3b697a7b 100644 --- a/src/ExportDataDialog.h +++ b/src/ExportDataDialog.h @@ -23,7 +23,7 @@ public: }; explicit ExportDataDialog(DBBrowserDB& db, ExportFormats format, QWidget* parent = nullptr, - const QString& query = "", const sqlb::ObjectIdentifier& selection = sqlb::ObjectIdentifier()); + const std::string& query = {}, const sqlb::ObjectIdentifier& selection = sqlb::ObjectIdentifier()); ~ExportDataDialog() override; private slots: @@ -40,9 +40,9 @@ private: void setNewLineString(const QString& s); QString currentNewLineString() const; - bool exportQuery(const QString& sQuery, const QString& sFilename); - bool exportQueryCsv(const QString& sQuery, const QString& sFilename); - bool exportQueryJson(const QString& sQuery, const QString& sFilename); + bool exportQuery(const std::string& sQuery, const QString& sFilename); + bool exportQueryCsv(const std::string& sQuery, const QString& sFilename); + bool exportQueryJson(const std::string& sQuery, const QString& sFilename); private: Ui::ExportDataDialog* ui; @@ -50,7 +50,7 @@ private: ExportFormats m_format; - QString m_sQuery; + std::string m_sQuery; }; #endif diff --git a/src/ExportSqlDialog.cpp b/src/ExportSqlDialog.cpp index fa3bcfc8..6e9b510c 100644 --- a/src/ExportSqlDialog.cpp +++ b/src/ExportSqlDialog.cpp @@ -3,6 +3,7 @@ #include "sqlitedb.h" #include "FileDialog.h" #include "Settings.h" +#include "IconCache.h" #include #include @@ -30,7 +31,7 @@ ExportSqlDialog::ExportSqlDialog(DBBrowserDB* db, QWidget* parent, const QString // Get list of tables to export const auto objects = pdb->schemata["main"].equal_range("table"); for(auto it=objects.first;it!=objects.second;++it) - ui->listTables->addItem(new QListWidgetItem(QIcon(QString(":icons/%1").arg(QString::fromStdString(sqlb::Object::typeToString(it->second->type())))), QString::fromStdString(it->second->name()))); + ui->listTables->addItem(new QListWidgetItem(IconCache::get(sqlb::Object::typeToString(it->second->type())), QString::fromStdString(it->second->name()))); // Sort list of tables and select the table specified in the // selection parameter or all tables if table not specified @@ -80,7 +81,7 @@ void ExportSqlDialog::accept() if(selectedItems.count() == 1) // One table -> Suggest table name defaultFileName = selectedItems.at(0)->text() + FILE_EXT_SQL_DEFAULT; else if(selectedItems.count() == ui->listTables->count()) // All tables -> Suggest database name - defaultFileName = pdb->currentFile() + FILE_EXT_SQL_DEFAULT;; + defaultFileName = pdb->currentFile() + FILE_EXT_SQL_DEFAULT; QString fileName = FileDialog::getSaveFileName( CreateSQLFile, @@ -96,9 +97,9 @@ void ExportSqlDialog::accept() Settings::setValue("exportsql", "insertmultiple", ui->checkMultiple->isChecked()); Settings::setValue("exportsql", "oldschema", ui->comboOldSchema->currentIndex()); - QStringList tables; + std::vector tables; for(const QListWidgetItem* item : ui->listTables->selectedItems()) - tables.push_back(item->text()); + tables.push_back(item->text().toStdString()); // Check what to export. The indices here depend on the order of the items in the combobox in the ui file bool exportSchema = ui->comboWhat->currentIndex() == ExportEverything || ui->comboWhat->currentIndex() == ExportSchemaOnly; diff --git a/src/ExportSqlDialog.h b/src/ExportSqlDialog.h index 6fc3363f..1e585b2c 100644 --- a/src/ExportSqlDialog.h +++ b/src/ExportSqlDialog.h @@ -14,7 +14,7 @@ class ExportSqlDialog : public QDialog Q_OBJECT public: - explicit ExportSqlDialog(DBBrowserDB* db, QWidget* parent = nullptr, const QString& selection = ""); + explicit ExportSqlDialog(DBBrowserDB* db, QWidget* parent = nullptr, const QString& selection = QString()); ~ExportSqlDialog() override; private slots: diff --git a/src/ExtendedScintilla.cpp b/src/ExtendedScintilla.cpp index 413bf526..1b332d55 100644 --- a/src/ExtendedScintilla.cpp +++ b/src/ExtendedScintilla.cpp @@ -22,6 +22,7 @@ ExtendedScintilla::ExtendedScintilla(QWidget* parent) : QsciScintilla(parent), + showErrorIndicators(true), findReplaceDialog(new FindReplaceDialog(this)) { // This class does not set any lexer, that must be done in the child classes. @@ -55,13 +56,13 @@ ExtendedScintilla::ExtendedScintilla(QWidget* parent) : setWrapVisualFlags(QsciScintilla::WrapFlagByBorder); // Connect signals - connect(this, SIGNAL(linesChanged()), this, SLOT(updateLineNumberAreaWidth())); + connect(this, &ExtendedScintilla::linesChanged, this, &ExtendedScintilla::updateLineNumberAreaWidth); // The shortcuts are constrained to the Widget context so they do not conflict with other SqlTextEdit widgets in the Main Window. QShortcut* shortcutFindReplace = new QShortcut(QKeySequence(tr("Ctrl+H")), this, nullptr, nullptr, Qt::WidgetShortcut); - connect(shortcutFindReplace, SIGNAL(activated()), this, SLOT(openFindReplaceDialog())); + connect(shortcutFindReplace, &QShortcut::activated, this, &ExtendedScintilla::openFindReplaceDialog); shortcutFind = new QShortcut(QKeySequence(tr("Ctrl+F")), this, nullptr, nullptr, Qt::WidgetShortcut); - connect(shortcutFind, SIGNAL(activated()), this, SLOT(openFindDialog())); + connect(shortcutFind, &QShortcut::activated, this, &ExtendedScintilla::openFindDialog); #ifdef Q_OS_MACX // Alt+Backspace on Mac is expected to delete one word to the left, @@ -78,11 +79,7 @@ ExtendedScintilla::ExtendedScintilla(QWidget* parent) : // Prepare for adding the find/replace option to the QScintilla context menu setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint &))); -} - -ExtendedScintilla::~ExtendedScintilla() -{ + connect(this, &ExtendedScintilla::customContextMenuRequested, this, &ExtendedScintilla::showContextMenu); } void ExtendedScintilla::updateLineNumberAreaWidth() @@ -244,7 +241,8 @@ bool ExtendedScintilla::findText(QString text, bool regexp, bool caseSensitive, } return findFirst(text, regexp, caseSensitive, words, wrap, forward, - /* line */ -1, /* index */ -1, /* show */ true, /* posix */ true); + /* line */ -1, /* index */ -1, + /* show */ true, /* posix */ true, /* cxx11 */ true); } void ExtendedScintilla::setEnabledFindDialog(bool value) diff --git a/src/ExtendedScintilla.h b/src/ExtendedScintilla.h index e5731e81..6eca7de3 100644 --- a/src/ExtendedScintilla.h +++ b/src/ExtendedScintilla.h @@ -16,7 +16,6 @@ class ExtendedScintilla : public QsciScintilla public: explicit ExtendedScintilla(QWidget *parent = nullptr); - ~ExtendedScintilla() override; bool findText(QString text, bool regexp, bool caseSensitive, bool words, bool wrap, bool forward); void setEnabledFindDialog(bool value); diff --git a/src/ExtendedTableWidget.cpp b/src/ExtendedTableWidget.cpp index 36bd532a..83366cd4 100644 --- a/src/ExtendedTableWidget.cpp +++ b/src/ExtendedTableWidget.cpp @@ -4,6 +4,7 @@ #include "sql/sqlitetypes.h" #include "Settings.h" #include "sqlitedb.h" +#include "CondFormat.h" #include #include @@ -22,6 +23,7 @@ #include #include #include +#include #include @@ -127,7 +129,7 @@ QWidget* ExtendedTableWidgetEditorDelegate::createEditor(QWidget* parent, const { SqliteTableModel* m = qobject_cast(const_cast(index.model())); - sqlb::ForeignKeyClause fk = m->getForeignKeyClause(index.column()-1); + sqlb::ForeignKeyClause fk = m->getForeignKeyClause(static_cast(index.column()-1)); if(fk.isSet()) { @@ -137,19 +139,19 @@ QWidget* ExtendedTableWidgetEditorDelegate::createEditor(QWidget* parent, const // If no column name is set, assume the primary key is meant if(fk.columns().empty()) { sqlb::TablePtr obj = m->db().getObjectByName(foreignTable); - column = obj->primaryKey().front(); + column = obj->primaryKey()->columnList().front(); } else column = fk.columns().at(0); sqlb::TablePtr currentTable = m->db().getObjectByName(m->currentTableName()); - QString query = QString("SELECT %1 FROM %2").arg(QString::fromStdString(sqlb::escapeIdentifier(column))).arg(QString::fromStdString(foreignTable.toString())); + QString query = QString("SELECT %1 FROM %2").arg(QString::fromStdString(sqlb::escapeIdentifier(column)), QString::fromStdString(foreignTable.toString())); // if the current column of the current table does NOT have not-null constraint, // the NULL is united to the query to get the possible values in the combo-box. if (!currentTable->fields.at(static_cast(index.column())-1).notnull()) query.append (" UNION SELECT NULL"); - SqliteTableModel* fkModel = new SqliteTableModel(m->db(), parent, m->chunkSize(), m->encoding()); + SqliteTableModel* fkModel = new SqliteTableModel(m->db(), parent, m->encoding()); fkModel->setQuery(query); QComboBox* combo = new QComboBox(parent); @@ -227,13 +229,17 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) : // Force ScrollPerItem, so scrolling shows all table rows setVerticalScrollMode(ExtendedTableWidget::ScrollPerItem); - connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(vscrollbarChanged(int))); - connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(cellClicked(QModelIndex))); + connect(verticalScrollBar(), &QScrollBar::valueChanged, this, &ExtendedTableWidget::vscrollbarChanged); + connect(this, &ExtendedTableWidget::clicked, this, &ExtendedTableWidget::cellClicked); // Set up filter row m_tableHeader = new FilterTableHeader(this); setHorizontalHeader(m_tableHeader); + // Disconnect clicking in header to select column, since we will use it for sorting. + // Note that, in order to work, this cannot be converted to the standard C++11 format. + disconnect(m_tableHeader, SIGNAL(sectionPressed(int)),this, SLOT(selectColumn(int))); + // Set up vertical header context menu verticalHeader()->setContextMenuPolicy(Qt::CustomContextMenu); @@ -360,8 +366,7 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) : }); connect(nullAction, &QAction::triggered, [&]() { - for(const QModelIndex& index : selectedIndexes()) - model()->setData(index, QVariant()); + setToNull(selectedIndexes()); }); connect(copyAction, &QAction::triggered, [&]() { copy(false, false); @@ -379,6 +384,20 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) : openPrintDialog(); }); + // Add spreadsheet shortcuts for selecting entire columns or entire rows. + QShortcut* selectColumnShortcut = new QShortcut(QKeySequence("Ctrl+Space"), this); + connect(selectColumnShortcut, &QShortcut::activated, [this]() { + if(!hasFocus() || selectionModel()->selectedIndexes().isEmpty()) + return; + selectionModel()->select(QItemSelection(selectionModel()->selectedIndexes().first(), selectionModel()->selectedIndexes().last()), QItemSelectionModel::Select | QItemSelectionModel::Columns); + }); + QShortcut* selectRowShortcut = new QShortcut(QKeySequence("Shift+Space"), this); + connect(selectRowShortcut, &QShortcut::activated, [this]() { + if(!hasFocus() || selectionModel()->selectedIndexes().isEmpty()) + return; + selectionModel()->select(QItemSelection(selectionModel()->selectedIndexes().first(), selectionModel()->selectedIndexes().last()), QItemSelectionModel::Select | QItemSelectionModel::Rows); + }); + #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) && QT_VERSION < QT_VERSION_CHECK(5, 12, 3) // This work arounds QTBUG-73721 and it is applied only for the affected version range. setWordWrap(false); @@ -467,8 +486,6 @@ void ExtendedTableWidget::copyMimeData(const QModelIndexList& fromIndices, QMime int currentRow = indices.first().row(); - const QString fieldSepHtml = ""; - const QString rowSepHtml = ""; const QString fieldSepText = "\t"; #ifdef Q_OS_WIN const QString rowSepText = "\r\n"; @@ -482,7 +499,7 @@ void ExtendedTableWidget::copyMimeData(const QModelIndexList& fromIndices, QMime htmlResult.append(""); int firstColumn = indices.front().column(); for(int i = firstColumn; i <= indices.back().column(); i++) { - QByteArray headerText = model()->headerData(i, Qt::Horizontal, Qt::DisplayRole).toByteArray(); + QByteArray headerText = model()->headerData(i, Qt::Horizontal, Qt::EditRole).toByteArray(); if (i != firstColumn) { result.append(fieldSepText); htmlResult.append(""); @@ -500,17 +517,37 @@ void ExtendedTableWidget::copyMimeData(const QModelIndexList& fromIndices, QMime // Table data rows for(const QModelIndex& index : indices) { + QFont font; + font.fromString(index.data(Qt::FontRole).toString()); + const QString fontStyle(font.italic() ? "italic" : "normal"); + const QString fontWeigth(font.bold() ? "bold" : "normal"); + const QString fontDecoration(font.underline() ? " text-decoration: underline;" : ""); + const QColor bgColor(index.data(Qt::BackgroundRole).toString()); + const QColor fgColor(index.data(Qt::ForegroundRole).toString()); + const Qt::Alignment align(index.data(Qt::TextAlignmentRole).toInt()); + const QString textAlign(CondFormat::alignmentTexts().at(CondFormat::fromCombinedAlignment(align)).toLower()); + const QString style = QString("font-family: '%1'; font-size: %2pt; font-style: %3; font-weight: %4;%5 " + "background-color: %6; color: %7; text-align: %8").arg( + font.family().toHtmlEscaped(), + QString::number(font.pointSize()), + fontStyle, + fontWeigth, + fontDecoration, + bgColor.name(), + fgColor.name(), + textAlign); + // Separators. For first cell, only opening table row tags must be added for the HTML and nothing for the text version. if (indices.first() == index) { - htmlResult.append(""); + htmlResult.append(QString("").arg(style)); sqlResult.append(sqlInsertStatement); } else if (index.row() != currentRow) { result.append(rowSepText); - htmlResult.append(rowSepHtml); + htmlResult.append(QString("").arg(style)); sqlResult.append(");" + rowSepText + sqlInsertStatement); } else { result.append(fieldSepText); - htmlResult.append(fieldSepHtml); + htmlResult.append(QString("").arg(style)); sqlResult.append(", "); } currentRow = index.row(); @@ -544,7 +581,7 @@ void ExtendedTableWidget::copyMimeData(const QModelIndexList& fromIndices, QMime htmlResult.append(QString(text).toHtmlEscaped()); result.append(text); - sqlResult.append("'" + text.replace("'", "''") + "'"); + sqlResult.append(sqlb::escapeString(text)); } else // Table cell data: binary. Save as BLOB literal in SQL sqlResult.append( "X'" + bArrdata.toByteArray().toHex() + "'" ); @@ -776,8 +813,7 @@ void ExtendedTableWidget::keyPressEvent(QKeyEvent* event) if(event->modifiers().testFlag(Qt::AltModifier)) { // When pressing Alt+Delete set the value to NULL - for(const QModelIndex& index : selectedIndexes()) - model()->setData(index, QVariant()); + setToNull(selectedIndexes()); } else { // When pressing Delete only set the value to empty string for(const QModelIndex& index : selectedIndexes()) @@ -841,26 +877,42 @@ int ExtendedTableWidget::numVisibleRows() const return row_bottom - row_top; } -std::unordered_set ExtendedTableWidget::selectedCols() const +std::unordered_set ExtendedTableWidget::selectedCols() const { - std::unordered_set selectedCols; - for(const QModelIndex & idx : selectedIndexes()) - selectedCols.insert(idx.column()); + std::unordered_set selectedCols; + for(const auto& idx : selectionModel()->selectedColumns()) + selectedCols.insert(static_cast(idx.column())); return selectedCols; } +std::unordered_set ExtendedTableWidget::colsInSelection() const +{ + std::unordered_set colsInSelection; + for(const QModelIndex & idx : selectedIndexes()) + colsInSelection.insert(static_cast(idx.column())); + return colsInSelection; +} + void ExtendedTableWidget::cellClicked(const QModelIndex& index) { // If Ctrl-Shift is pressed try to jump to the row referenced by the foreign key of the clicked cell if(qApp->keyboardModifiers().testFlag(Qt::ControlModifier) && qApp->keyboardModifiers().testFlag(Qt::ShiftModifier) && model()) { SqliteTableModel* m = qobject_cast(model()); - sqlb::ForeignKeyClause fk = m->getForeignKeyClause(index.column()-1); + sqlb::ForeignKeyClause fk = m->getForeignKeyClause(static_cast(index.column()-1)); if(fk.isSet()) emit foreignKeyClicked(sqlb::ObjectIdentifier(m->currentTableName().schema(), fk.table()), - fk.columns().size() ? QString::fromStdString(fk.columns().at(0)) : "", + fk.columns().size() ? fk.columns().at(0) : "", m->data(index, Qt::EditRole).toByteArray()); + else { + // If this column does not have a foreign-key, try to interpret it as a filename/URL and open it in external application. + + // TODO: Qt is doing a contiguous selection when Control+Click is pressed. It should be disabled, but at least moving the + // current index gives better result. + setCurrentIndex(index); + emit requestUrlOrFileOpen(model()->data(index, Qt::EditRole).toString()); + } } } @@ -967,20 +1019,18 @@ void ExtendedTableWidget::openPrintDialog() // the table with headers. We can then print it using an HTML text document. copyMimeData(indices, mimeData, true, false); - QTextDocument *document = new QTextDocument(); - document->setHtml(mimeData->html()); - QPrinter printer; QPrintPreviewDialog *dialog = new QPrintPreviewDialog(&printer); - connect(dialog, &QPrintPreviewDialog::paintRequested, [&](QPrinter *previewPrinter) { - document->print(previewPrinter); + connect(dialog, &QPrintPreviewDialog::paintRequested, [mimeData](QPrinter *previewPrinter) { + QTextDocument document; + document.setHtml(mimeData->html()); + document.print(previewPrinter); }); dialog->exec(); delete dialog; - delete document; delete mimeData; } @@ -997,3 +1047,30 @@ void ExtendedTableWidget::sortByColumns(const std::vector& c else sqlite_model->sort(columns); } + +void ExtendedTableWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) +{ + QTableView::currentChanged(current, previous); + emit currentIndexChanged(current, previous); +} + +void ExtendedTableWidget::setToNull(const QModelIndexList& indices) +{ + SqliteTableModel* m = qobject_cast(const_cast(model())); + sqlb::TablePtr currentTable = m->db().getObjectByName(m->currentTableName()); + + // Check if some column in the selection has a NOT NULL constraint, before trying to update the cells. + if(currentTable) + for(const QModelIndex& index : indices) { + const sqlb::Field& field = currentTable->fields.at(static_cast(index.column())-1); + if(field.notnull()) { + QMessageBox::warning(nullptr, qApp->applicationName(), + tr("Cannot set selection to NULL. Column %1 has a NOT NULL constraint."). + arg(QString::fromStdString(field.name()))); + return; + } + } + + for(const QModelIndex& index : indices) + model()->setData(index, QVariant()); +} diff --git a/src/ExtendedTableWidget.h b/src/ExtendedTableWidget.h index 86d650f7..f97bc782 100644 --- a/src/ExtendedTableWidget.h +++ b/src/ExtendedTableWidget.h @@ -52,7 +52,11 @@ public: FilterTableHeader* filterHeader() { return m_tableHeader; } public: - std::unordered_set selectedCols() const; + // Get set of selected columns (all cells in column has to be selected) + std::unordered_set selectedCols() const; + // Get set of columns traversed by selection (only some cells in column has to be selected) + std::unordered_set colsInSelection() const; + int numVisibleRows() const; void sortByColumns(const std::vector& columns); @@ -65,20 +69,24 @@ public slots: void openPrintDialog(); signals: - void foreignKeyClicked(const sqlb::ObjectIdentifier& table, const QString& column, const QByteArray& value); + void foreignKeyClicked(const sqlb::ObjectIdentifier& table, const std::string& column, const QByteArray& value); void switchTable(bool next); // 'next' parameter is set to true if next table should be selected and to false if previous table should be selected void openFileFromDropEvent(QString); void selectedRowsToBeDeleted(); void editCondFormats(int column); + void currentIndexChanged(const QModelIndex ¤t, const QModelIndex &previous); + void requestUrlOrFileOpen(const QString& urlString); private: void copyMimeData(const QModelIndexList& fromIndices, QMimeData* mimeData, const bool withHeaders, const bool inSQL); void copy(const bool withHeaders, const bool inSQL); void paste(); - void useAsFilter(const QString& filterOperator, bool binary = false, const QString& operatorSuffix = ""); + void useAsFilter(const QString& filterOperator, bool binary = false, const QString& operatorSuffix = QString()); void duplicateUpperCell(); + void setToNull(const QModelIndexList& indices); + static std::vector> m_buffer; static QString m_generatorStamp; @@ -92,6 +100,7 @@ protected: void dragEnterEvent(QDragEnterEvent* event) override; void dragMoveEvent(QDragMoveEvent* event) override; void dropEvent(QDropEvent* event) override; + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override; FilterTableHeader* m_tableHeader; QMenu* m_contextMenu; diff --git a/src/FileDialog.cpp b/src/FileDialog.cpp index 721fcb9a..6f96293b 100644 --- a/src/FileDialog.cpp +++ b/src/FileDialog.cpp @@ -53,7 +53,7 @@ QString FileDialog::getFileDialogPath(const FileDialogTypes dialogType) case 1: // Always use this locations return Settings::getValue("db", "defaultlocation").toString(); default: - return ""; + return QString(); } } diff --git a/src/FileDialog.h b/src/FileDialog.h index bc26935a..6b4999fd 100644 --- a/src/FileDialog.h +++ b/src/FileDialog.h @@ -25,12 +25,14 @@ static const QString FILE_FILTER_ALL(QObject::tr("All Files (*)")); // Text Files Extensions Filter static const QString FILE_FILTER_TXT(QObject::tr("Text Files (*.txt)")); +static const QString FILE_EXT_TXT_DEFAULT(".txt"); // Comma,Tab,or Delimiter-Separated Values File Extensions Filter static const QString FILE_FILTER_CSV(QObject::tr("Comma-Separated Values Files (*.csv)")); static const QString FILE_EXT_CSV_DEFAULT(".csv"); static const QString FILE_FILTER_TSV(QObject::tr("Tab-Separated Values Files (*.tsv)")); static const QString FILE_FILTER_DSV(QObject::tr("Delimiter-Separated Values Files (*.dsv)")); +static const QString FILE_FILTER_DAT(QObject::tr("Concordance DAT files (*.dat)")); // JSON File Extensions Filter static const QString FILE_FILTER_JSON(QObject::tr("JSON Files (*.json *.js)")); @@ -38,12 +40,15 @@ static const QString FILE_EXT_JSON_DEFAULT(".json"); // XML File Extensions Filter static const QString FILE_FILTER_XML(QObject::tr("XML Files (*.xml)")); +static const QString FILE_EXT_XML_DEFAULT(".xml"); // Binary File Extensions Filter static const QString FILE_FILTER_BIN(QObject::tr("Binary Files (*.bin *.dat)")); +static const QString FILE_EXT_BIN_DEFAULT(".bin"); // Scalar Vector Graphics File Extensions Filter static const QString FILE_FILTER_SVG(QObject::tr("SVG Files (*.svg)")); +static const QString FILE_EXT_SVG_DEFAULT(".svg"); // Hex-Dump File Extension Filter static const QString FILE_FILTER_HEX(QObject::tr("Hex Dump Files (*.dat *.bin)")); diff --git a/src/FileExtensionManager.cpp b/src/FileExtensionManager.cpp index 9d12d587..71ce8eba 100644 --- a/src/FileExtensionManager.cpp +++ b/src/FileExtensionManager.cpp @@ -92,12 +92,12 @@ void FileExtensionManager::downItem() ui->tableExtensions->selectRow(selectedRow+1); } -QStringList FileExtensionManager::getDBFileExtensions() +QStringList FileExtensionManager::getDBFileExtensions() const { QStringList result; for (int i = 0; i < ui->tableExtensions->rowCount(); ++i) { - result.append(QString("%1 (%2)").arg(ui->tableExtensions->item(i, 0)->text()).arg(ui->tableExtensions->item(i, 1)->text())); + result.append(QString("%1 (%2)").arg(ui->tableExtensions->item(i, 0)->text(), ui->tableExtensions->item(i, 1)->text())); } return result; } diff --git a/src/FileExtensionManager.h b/src/FileExtensionManager.h index 6b8d7bec..7e0156e3 100644 --- a/src/FileExtensionManager.h +++ b/src/FileExtensionManager.h @@ -15,7 +15,7 @@ public: explicit FileExtensionManager(QStringList init, QWidget *parent = nullptr); ~FileExtensionManager() override; - QStringList getDBFileExtensions(); + QStringList getDBFileExtensions() const; private: Ui::FileExtensionManager *ui; diff --git a/src/FilterLineEdit.cpp b/src/FilterLineEdit.cpp index 384e3077..63ed1239 100644 --- a/src/FilterLineEdit.cpp +++ b/src/FilterLineEdit.cpp @@ -19,8 +19,8 @@ FilterLineEdit::FilterLineEdit(QWidget* parent, std::vector* fi // delayedSignalTimerTriggered() method which then stops the timer and emits the delayed signal. delaySignalTimer = new QTimer(this); delaySignalTimer->setInterval(Settings::getValue("databrowser", "filter_delay").toInt()); // This is the milliseconds of not-typing we want to wait before triggering - connect(this, SIGNAL(textChanged(QString)), delaySignalTimer, SLOT(start())); - connect(delaySignalTimer, SIGNAL(timeout()), this, SLOT(delayedSignalTimerTriggered())); + connect(this, &FilterLineEdit::textChanged, delaySignalTimer, static_cast(&QTimer::start)); + connect(delaySignalTimer, &QTimer::timeout, this, &FilterLineEdit::delayedSignalTimerTriggered); setWhatsThis(tr("These input fields allow you to perform quick filters in the currently selected table.\n" "By default, the rows containing the input text are filtered out.\n" @@ -37,11 +37,11 @@ FilterLineEdit::FilterLineEdit(QWidget* parent, std::vector* fi // Immediately emit the delayed filter value changed signal if the user presses the enter or the return key or // the line edit widget loses focus - connect(this, SIGNAL(editingFinished()), this, SLOT(delayedSignalTimerTriggered())); + connect(this, &FilterLineEdit::editingFinished, this, &FilterLineEdit::delayedSignalTimerTriggered); // Prepare for adding the What's This information and filter helper actions to the context menu setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint &))); + connect(this, &FilterLineEdit::customContextMenuRequested, this, &FilterLineEdit::showContextMenu); } void FilterLineEdit::delayedSignalTimerTriggered() @@ -65,13 +65,13 @@ void FilterLineEdit::keyReleaseEvent(QKeyEvent* event) { if(event->key() == Qt::Key_Tab) { - if(columnNumber < filterList->size() - 1) + if(filterList && columnNumber < filterList->size() - 1) { filterList->at(columnNumber + 1)->setFocus(); event->accept(); } } else if(event->key() == Qt::Key_Backtab) { - if(columnNumber > 0) + if(filterList && columnNumber > 0) { filterList->at(columnNumber - 1)->setFocus(); event->accept(); @@ -109,24 +109,6 @@ void FilterLineEdit::showContextMenu(const QPoint &pos) QMenu* editContextMenu = createStandardContextMenu(); editContextMenu->addSeparator(); - QAction* conditionalFormatAction; - if (text().isEmpty()) { - conditionalFormatAction = new QAction(QIcon(":/icons/clear_cond_formats"), tr("Clear All Conditional Formats"), editContextMenu); - connect(conditionalFormatAction, &QAction::triggered, [&]() { - emit clearAllCondFormats(); - }); - } else { - conditionalFormatAction = new QAction(QIcon(":/icons/cond_formats"), tr("Use for Conditional Format"), editContextMenu); - connect(conditionalFormatAction, &QAction::triggered, [&]() { - emit addFilterAsCondFormat(text()); - }); - } - QAction* editCondFormatsAction = new QAction(QIcon(":/icons/edit_cond_formats"), tr("Edit Conditional Formats..."), editContextMenu); - connect(editCondFormatsAction, &QAction::triggered, [&]() { - emit editCondFormats(); - }); - editContextMenu->addSeparator(); - QMenu* filterMenu = editContextMenu->addMenu(tr("Set Filter Expression")); QAction* whatsThisAction = new QAction(QIcon(":/icons/whatis"), tr("What's This?"), editContextMenu); @@ -192,8 +174,31 @@ void FilterLineEdit::showContextMenu(const QPoint &pos) setFilterHelper(QString ("/"), QString ("/")); }); - editContextMenu->addAction(conditionalFormatAction); - editContextMenu->addAction(editCondFormatsAction); + + if(!no_conditional_format) + { + QAction* conditionalFormatAction; + if (text().isEmpty()) { + conditionalFormatAction = new QAction(QIcon(":/icons/clear_cond_formats"), tr("Clear All Conditional Formats"), editContextMenu); + connect(conditionalFormatAction, &QAction::triggered, [&]() { + emit clearAllCondFormats(); + }); + } else { + conditionalFormatAction = new QAction(QIcon(":/icons/add_cond_format"), tr("Use for Conditional Format"), editContextMenu); + connect(conditionalFormatAction, &QAction::triggered, [&]() { + emit addFilterAsCondFormat(text()); + }); + } + QAction* editCondFormatsAction = new QAction(QIcon(":/icons/edit_cond_formats"), tr("Edit Conditional Formats..."), editContextMenu); + connect(editCondFormatsAction, &QAction::triggered, [&]() { + emit editCondFormats(); + }); + editContextMenu->addSeparator(); + + editContextMenu->addAction(conditionalFormatAction); + editContextMenu->addAction(editCondFormatsAction); + } + filterMenu->addAction(whatsThisAction); filterMenu->addSeparator(); diff --git a/src/FilterLineEdit.h b/src/FilterLineEdit.h index 832f5d59..1e6d205c 100644 --- a/src/FilterLineEdit.h +++ b/src/FilterLineEdit.h @@ -12,12 +12,14 @@ class FilterLineEdit : public QLineEdit Q_OBJECT public: - explicit FilterLineEdit(QWidget* parent, std::vector* filters, size_t columnnum); + explicit FilterLineEdit(QWidget* parent, std::vector* filters = nullptr, size_t columnnum = 0); // Override methods for programatically changing the value of the line edit void clear(); void setText(const QString& text); + void setConditionFormatContextMenuEnabled(bool enable) { no_conditional_format = !enable; } + private slots: void delayedSignalTimerTriggered(); @@ -29,13 +31,14 @@ signals: protected: void keyReleaseEvent(QKeyEvent* event) override; - void setFilterHelper(const QString& filterOperator, const QString& operatorSuffix = ""); + void setFilterHelper(const QString& filterOperator, const QString& operatorSuffix = QString()); private: std::vector* filterList; size_t columnNumber; QTimer* delaySignalTimer; QString lastValue; + bool no_conditional_format; private slots: void showContextMenu(const QPoint &pos); diff --git a/src/FilterTableHeader.cpp b/src/FilterTableHeader.cpp index 9e4d4bac..0149e39e 100644 --- a/src/FilterTableHeader.cpp +++ b/src/FilterTableHeader.cpp @@ -10,13 +10,20 @@ FilterTableHeader::FilterTableHeader(QTableView* parent) : { // Activate the click signals to allow sorting setSectionsClickable(true); + // But use our own indicators allowing multi-column sorting setSortIndicatorShown(false); + // Make sure to not automatically resize the columns according to the contents + setSectionResizeMode(QHeaderView::Interactive); + + // Highlight column headers of selected cells to emulate spreadsheet behaviour + setHighlightSections(true); + // Do some connects: Basically just resize and reposition the input widgets whenever anything changes - connect(this, SIGNAL(sectionResized(int,int,int)), this, SLOT(adjustPositions())); - connect(parent->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjustPositions())); - connect(parent->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjustPositions())); + connect(this, &FilterTableHeader::sectionResized, this, &FilterTableHeader::adjustPositions); + connect(parent->horizontalScrollBar(), &QScrollBar::valueChanged, this, &FilterTableHeader::adjustPositions); + connect(parent->verticalScrollBar(), &QScrollBar::valueChanged, this, &FilterTableHeader::adjustPositions); // Set custom context menu handling setContextMenuPolicy(Qt::CustomContextMenu); @@ -36,10 +43,10 @@ void FilterTableHeader::generateFilters(size_t number, bool showFirst) l->setVisible(false); else l->setVisible(true); - connect(l, SIGNAL(delayedTextChanged(QString)), this, SLOT(inputChanged(QString))); - connect(l, SIGNAL(addFilterAsCondFormat(QString)), this, SLOT(addFilterAsCondFormat(QString))); - connect(l, SIGNAL(clearAllCondFormats()), this, SLOT(clearAllCondFormats())); - connect(l, SIGNAL(editCondFormats()), this, SLOT(editCondFormats())); + connect(l, &FilterLineEdit::delayedTextChanged, this, &FilterTableHeader::inputChanged); + connect(l, &FilterLineEdit::addFilterAsCondFormat, this, &FilterTableHeader::addFilterAsCondFormat); + connect(l, &FilterLineEdit::clearAllCondFormats, this, &FilterTableHeader::clearAllCondFormats); + connect(l, &FilterLineEdit::editCondFormats, this, &FilterTableHeader::editCondFormats); filterWidgets.push_back(l); } @@ -89,25 +96,25 @@ void FilterTableHeader::adjustPositions() void FilterTableHeader::inputChanged(const QString& new_value) { // Just get the column number and the new value and send them to anybody interested in filter changes - emit filterChanged(sender()->property("column").toInt(), new_value); + emit filterChanged(sender()->property("column").toUInt(), new_value); } void FilterTableHeader::addFilterAsCondFormat(const QString& filter) { // Just get the column number and the new value and send them to anybody interested in new conditional formatting - emit addCondFormat(sender()->property("column").toInt(), filter); + emit addCondFormat(sender()->property("column").toUInt(), filter); } void FilterTableHeader::clearAllCondFormats() { // Just get the column number and send it to anybody responsible or interested in clearing conditional formatting - emit clearAllCondFormats(sender()->property("column").toInt()); + emit allCondFormatsCleared(sender()->property("column").toUInt()); } void FilterTableHeader::editCondFormats() { // Just get the column number and the new value and send them to anybody interested in editting conditional formatting - emit editCondFormats(sender()->property("column").toInt()); + emit condFormatsEdited(sender()->property("column").toUInt()); } void FilterTableHeader::clearFilters() diff --git a/src/FilterTableHeader.h b/src/FilterTableHeader.h index 961fdc82..ef64eaf2 100644 --- a/src/FilterTableHeader.h +++ b/src/FilterTableHeader.h @@ -23,10 +23,10 @@ public slots: void setFilter(size_t column, const QString& value); signals: - void filterChanged(int column, QString value); - void addCondFormat(int column, QString filter); - void clearAllCondFormats(int column); - void editCondFormats(int column); + void filterChanged(size_t column, QString value); + void addCondFormat(size_t column, QString filter); + void allCondFormatsCleared(size_t column); + void condFormatsEdited(size_t column); protected: void updateGeometries() override; diff --git a/src/FindReplaceDialog.cpp b/src/FindReplaceDialog.cpp index f0ecbfd6..18a9c05f 100644 --- a/src/FindReplaceDialog.cpp +++ b/src/FindReplaceDialog.cpp @@ -7,11 +7,11 @@ FindReplaceDialog::FindReplaceDialog(QWidget* parent) : QDialog(parent), ui(new Ui::FindReplaceDialog), + foundIndicatorNumber(0), findInProgress(false) { // Create UI ui->setupUi(this); - } FindReplaceDialog::~FindReplaceDialog() @@ -33,8 +33,8 @@ void FindReplaceDialog::setExtendedScintilla(ExtendedScintilla* scintilla) ui->replaceButton->setEnabled(isWriteable); ui->replaceAllButton->setEnabled(isWriteable); - connect(m_scintilla, SIGNAL(destroyed()), this, SLOT(hide())); - connect(ui->findText, SIGNAL(editingFinished()), this, SLOT(cancelFind())); + connect(m_scintilla, &ExtendedScintilla::destroyed, this, &FindReplaceDialog::hide); + connect(ui->findText, &QLineEdit::editingFinished, this, &FindReplaceDialog::cancelFind); connect(ui->regexpCheckBox, &QCheckBox::toggled, this, &FindReplaceDialog::cancelFind); connect(ui->caseCheckBox, &QCheckBox::toggled, this, &FindReplaceDialog::cancelFind); connect(ui->wholeWordsCheckBox, &QCheckBox::toggled, this, &FindReplaceDialog::cancelFind); @@ -54,7 +54,8 @@ bool FindReplaceDialog::findFirst(bool wrap, bool forward) ui->wholeWordsCheckBox->isChecked(), forward, /* show */ true, - /* posix */ true); + /* posix */ true, + /* cxx11 */ true); else return m_scintilla->findFirst (ui->findText->text(), @@ -66,7 +67,8 @@ bool FindReplaceDialog::findFirst(bool wrap, bool forward) /* line */ -1, /* index */ -1, /* show */ true, - /* posix */ true); + /* posix */ true, + /* cxx11 */ true); } bool FindReplaceDialog::findNext() diff --git a/src/ForeignKeyEditorDelegate.cpp b/src/ForeignKeyEditorDelegate.cpp index c61c5303..dd8bfc44 100644 --- a/src/ForeignKeyEditorDelegate.cpp +++ b/src/ForeignKeyEditorDelegate.cpp @@ -61,10 +61,10 @@ public: if (!id.isEmpty()) id = QString("(%1)").arg(sqlb::escapeIdentifier(id)); - return QString("%1%2 %3") - .arg(table) - .arg(id) - .arg(clauses) + return QString("%1%2 %3").arg( + table, + id, + clauses) .trimmed(); } @@ -85,7 +85,8 @@ ForeignKeyEditorDelegate::ForeignKeyEditorDelegate(const DBBrowserDB& db, sqlb:: { for(const auto& jt : it.second) { - if(jt.second->type() == sqlb::Object::Types::Table) + // Don't insert the current table into the list. The name and fields of the current table are always taken from the m_table reference + if(jt.second->type() == sqlb::Object::Types::Table && jt.second->name() != m_table.name()) m_tablesIds.insert({jt.second->name(), std::dynamic_pointer_cast(jt.second)->fieldNames()}); } } @@ -105,14 +106,25 @@ QWidget* ForeignKeyEditorDelegate::createEditor(QWidget* parent, const QStyleOpt QComboBox* box = editor->idsComboBox; box->clear(); box->addItem(QString()); // for those heroes who don't like to specify key explicitly - for(const auto& n : m_tablesIds[tableName.toStdString()]) - box->addItem(QString::fromStdString(n)); + + // For recursive foreign keys get the field list from the m_table reference. For other foreign keys from the prepared field lists. + if(tableName.toStdString() == m_table.name()) + { + for(const auto& n : m_table.fieldNames()) + box->addItem(QString::fromStdString(n)); + } else { + for(const auto& n : m_tablesIds[tableName.toStdString()]) + box->addItem(QString::fromStdString(n)); + } + + box->setCurrentIndex(0); }); editor->tablesComboBox->clear(); for(const auto& i : m_tablesIds) editor->tablesComboBox->addItem(QString::fromStdString(i.first)); + editor->tablesComboBox->addItem(QString::fromStdString(m_table.name())); // For recursive foreign keys return editor; } @@ -153,6 +165,7 @@ void ForeignKeyEditorDelegate::setModelData(QWidget* editor, QAbstractItemModel* const QString clause = fkEditor->clauseEdit->text(); fk->setTable(table.toStdString()); + fk->setColumnList({ field.name() }); if (!id.empty()) fk->setColumns({id}); @@ -161,7 +174,7 @@ void ForeignKeyEditorDelegate::setModelData(QWidget* editor, QAbstractItemModel* fk->setConstraint(clause.toStdString()); } - m_table.setConstraint({field.name()}, sqlb::ConstraintPtr(fk)); + m_table.setConstraint(sqlb::ConstraintPtr(fk)); } model->setData(index, sql); @@ -174,12 +187,4 @@ void ForeignKeyEditorDelegate::updateEditorGeometry(QWidget* editor, const QStyl editor->setGeometry(option.rect); } -void ForeignKeyEditorDelegate::updateTablesList(const std::string& oldTableName) -{ - // this is used for recursive table constraints when - // table column references column within same table - m_tablesIds.erase(oldTableName); - m_tablesIds.insert({m_table.name(), m_table.fieldNames()}); -} - #include "ForeignKeyEditorDelegate.moc" diff --git a/src/ForeignKeyEditorDelegate.h b/src/ForeignKeyEditorDelegate.h index 8f6560a6..076706a9 100644 --- a/src/ForeignKeyEditorDelegate.h +++ b/src/ForeignKeyEditorDelegate.h @@ -25,8 +25,6 @@ public: void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override; - void updateTablesList(const std::string& oldTableName); - private: const DBBrowserDB& m_db; sqlb::Table& m_table; diff --git a/src/ImportCsvDialog.cpp b/src/ImportCsvDialog.cpp index 0ac5feb4..eb508384 100644 --- a/src/ImportCsvDialog.cpp +++ b/src/ImportCsvDialog.cpp @@ -26,7 +26,7 @@ #include #endif -ImportCsvDialog::ImportCsvDialog(const QStringList &filenames, DBBrowserDB* db, QWidget* parent) +ImportCsvDialog::ImportCsvDialog(const std::vector& filenames, DBBrowserDB* db, QWidget* parent) : QDialog(parent), ui(new Ui::ImportCsvDialog), csvFilenames(filenames), @@ -39,7 +39,7 @@ ImportCsvDialog::ImportCsvDialog(const QStringList &filenames, DBBrowserDB* db, // Get the actual file name out of the provided path and use it as the default table name for import // For importing several files at once, the fields have to be the same so we can safely use the first - QFileInfo file(filenames.first()); + QFileInfo file(filenames.front()); ui->editName->setText(file.baseName()); // Create a list of all available encodings and create an auto completion list from them @@ -70,21 +70,21 @@ ImportCsvDialog::ImportCsvDialog(const QStringList &filenames, DBBrowserDB* db, ui->comboEncoding->blockSignals(false); // Prepare and show interface depending on how many files are selected - if (csvFilenames.length() > 1) + if (csvFilenames.size() > 1) { ui->separateTables->setVisible(true); ui->checkBoxSeparateTables->setVisible(true); ui->filePickerBlock->setVisible(true); selectFiles(); } - else if (csvFilenames.length() == 1) + else if (csvFilenames.size() == 1) { ui->separateTables->setVisible(false); ui->checkBoxSeparateTables->setVisible(false); ui->filePickerBlock->setVisible(false); } - selectedFile = csvFilenames.first(); + selectedFile = csvFilenames.front(); updatePreview(); checkInput(); } @@ -99,7 +99,7 @@ void rollback( ImportCsvDialog* dialog, DBBrowserDB* pdb, DBBrowserDB::db_pointer_type* db_ptr, - const QString& savepointName, + const std::string& savepointName, size_t nRecord, const QString& message) { @@ -124,24 +124,19 @@ class CSVImportProgress : public CSVProgress { public: explicit CSVImportProgress(int64_t filesize) - : totalFileSize(filesize) + : m_pProgressDlg(new QProgressDialog( + QObject::tr("Importing CSV file..."), + QObject::tr("Cancel"), + 0, + 10000)), + totalFileSize(filesize) { - m_pProgressDlg = new QProgressDialog( - QObject::tr("Importing CSV file..."), - QObject::tr("Cancel"), - 0, - 10000); m_pProgressDlg->setWindowModality(Qt::ApplicationModal); } CSVImportProgress(const CSVImportProgress&) = delete; bool operator=(const CSVImportProgress&) = delete; - ~CSVImportProgress() override - { - delete m_pProgressDlg; - } - void start() override { m_pProgressDlg->show(); @@ -161,7 +156,7 @@ public: } private: - QProgressDialog* m_pProgressDlg; + std::unique_ptr m_pProgressDlg; int64_t totalFileSize; }; @@ -212,7 +207,7 @@ void ImportCsvDialog::accept() return; } } else { - importCsv(csvFilenames.first()); + importCsv(csvFilenames.front()); } QApplication::restoreOverrideCursor(); // restore original cursor @@ -222,8 +217,11 @@ void ImportCsvDialog::accept() void ImportCsvDialog::updatePreview() { // Show/hide custom quote/separator input fields - ui->editCustomQuote->setVisible(ui->comboQuote->currentIndex() == ui->comboQuote->count()-1); - ui->editCustomSeparator->setVisible(ui->comboSeparator->currentIndex() == ui->comboSeparator->count()-1); + ui->editCustomQuote->setVisible(ui->comboQuote->currentIndex() == ui->comboQuote->count() - OtherPrintable); + ui->editCustomSeparator->setVisible(ui->comboSeparator->currentIndex() == ui->comboSeparator->count() - OtherPrintable); + ui->spinBoxQuote->setVisible(ui->comboQuote->currentIndex() == ui->comboQuote->count() - OtherCode); + ui->spinBoxSeparator->setVisible(ui->comboSeparator->currentIndex() == ui->comboSeparator->count() - OtherCode); + ui->editCustomEncoding->setVisible(ui->comboEncoding->currentIndex() == ui->comboEncoding->count()-1); // Reset preview widget @@ -305,7 +303,7 @@ void ImportCsvDialog::checkInput() void ImportCsvDialog::selectFiles() { - for (auto fileName : csvFilenames) { + for (const auto& fileName : csvFilenames) { auto fInfo = QFileInfo(fileName); auto item = new QListWidgetItem(); item->setText(fileName); @@ -368,7 +366,7 @@ void ImportCsvDialog::matchSimilar() checkInput(); } -CSVParser::ParserResult ImportCsvDialog::parseCSV(const QString &fileName, std::function rowFunction, size_t count) +CSVParser::ParserResult ImportCsvDialog::parseCSV(const QString &fileName, std::function rowFunction, size_t count) const { // Parse all csv data QFile file(fileName); @@ -386,7 +384,7 @@ CSVParser::ParserResult ImportCsvDialog::parseCSV(const QString &fileName, std:: return csv.parse(rowFunction, tstream, count); } -sqlb::FieldVector ImportCsvDialog::generateFieldList(const QString& filename) +sqlb::FieldVector ImportCsvDialog::generateFieldList(const QString& filename) const { sqlb::FieldVector fieldList; // List of fields in the file @@ -395,28 +393,28 @@ sqlb::FieldVector ImportCsvDialog::generateFieldList(const QString& filename) // Has this row more columns than the previous one? Then add more fields to the field list as necessary. for(size_t i=fieldList.size();icheckboxHeader->isChecked()) { // Take field name from CSV and remove invalid characters - fieldname = QString::fromUtf8(rowData.fields[i].data, static_cast(rowData.fields[i].data_length)); - fieldname.replace("`", ""); - fieldname.replace(" ", ""); - fieldname.replace('"', ""); - fieldname.replace("'",""); - fieldname.replace(",",""); - fieldname.replace(";",""); + fieldname = std::string(rowData.fields[i].data, rowData.fields[i].data_length); + fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), '`'), fieldname.end()); + fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), ' '), fieldname.end()); + fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), '"'), fieldname.end()); + fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), '\''), fieldname.end()); + fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), ','), fieldname.end()); + fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), ';'), fieldname.end()); } // If we don't have a field name by now, generate one - if(fieldname.isEmpty()) - fieldname = QString("field%1").arg(i+1); + if(fieldname.empty()) + fieldname = "field" + std::to_string(i + 1); // Add field to the column list. For now we set the data type to nothing but this might be overwritten later in the automatic // type detection code. - fieldList.emplace_back(fieldname.toStdString(), ""); + fieldList.emplace_back(fieldname, ""); } // Try to find out a data type for each column. Skip the header row if there is one. @@ -440,9 +438,9 @@ sqlb::FieldVector ImportCsvDialog::generateFieldList(const QString& filename) std::string new_type = "TEXT"; if(old_type == "INTEGER" && !convert_to_int && convert_to_float) // So far it's integer, but now it's only convertible to float new_type = "REAL"; - else if(old_type == "" && convert_to_int) // No type yet, but this bit is convertible to integer + else if(old_type.empty() && convert_to_int) // No type yet, but this bit is convertible to integer new_type = "INTEGER"; - else if(old_type == "" && convert_to_float) // No type yet and only convertible to float (less 'difficult' than integer) + else if(old_type.empty() && convert_to_float) // No type yet and only convertible to float (less 'difficult' than integer) new_type = "REAL"; else if(old_type == "REAL" && convert_to_float) // It was float so far and still is new_type = "INTEGER"; @@ -534,7 +532,7 @@ bool ImportCsvDialog::importCsv(const QString& fileName, const QString& name) // Create a savepoint, so we can rollback in case of any errors during importing // db needs to be saved or an error will occur - QString restorepointName = pdb->generateSavepointName("csvimport"); + std::string restorepointName = pdb->generateSavepointName("csvimport"); if(!pdb->setSavepoint(restorepointName)) { rollback(this, pdb, nullptr, restorepointName, 0, tr("Creating restore point failed: %1").arg(pdb->lastError())); @@ -605,14 +603,14 @@ bool ImportCsvDialog::importCsv(const QString& fileName, const QString& name) } // Prepare the INSERT statement. The prepared statement can then be reused for each row to insert - QString sQuery = QString("INSERT %1 INTO %2 VALUES(").arg(currentOnConflictStrategy()).arg(sqlb::escapeIdentifier(tableName)); + std::string sQuery = "INSERT " + currentOnConflictStrategy() + " INTO " + sqlb::escapeIdentifier(tableName.toStdString()) + " VALUES("; for(size_t i=1;i<=fieldList.size();i++) - sQuery.append(QString("?%1,").arg(i)); - sQuery.chop(1); // Remove last comma + sQuery += "?" + std::to_string(i) + ","; + sQuery.pop_back(); // Remove last comma sQuery.append(")"); sqlite3_stmt* stmt; auto pDb = pdb->get(tr("importing CSV")); - sqlite3_prepare_v2(pDb.get(), sQuery.toUtf8(), sQuery.toUtf8().length(), &stmt, nullptr); + sqlite3_prepare_v2(pDb.get(), sQuery.c_str(), static_cast(sQuery.size()), &stmt, nullptr); // Parse entire file size_t lastRowNum = 0; @@ -707,10 +705,18 @@ void ImportCsvDialog::setQuoteChar(QChar c) { QComboBox* combo = ui->comboQuote; int index = combo->findText(QString(c)); + ui->spinBoxQuote->setValue(c.unicode()); if(index == -1) { - combo->setCurrentIndex(combo->count() - 1); - ui->editCustomQuote->setText(QString(c)); + if(c.isPrint()) + { + combo->setCurrentIndex(combo->count() - OtherPrintable); + ui->editCustomQuote->setText(QString(c)); + } + else + { + combo->setCurrentIndex(combo->count() - OtherCode); + } } else { @@ -723,8 +729,10 @@ QChar ImportCsvDialog::currentQuoteChar() const QString value; // The last item in the combobox is the 'Other' item; if it is selected return the text of the line edit field instead - if(ui->comboQuote->currentIndex() == ui->comboQuote->count()-1) + if(ui->comboQuote->currentIndex() == ui->comboQuote->count() - OtherPrintable) value = ui->editCustomQuote->text().length() ? ui->editCustomQuote->text() : ""; + else if(ui->comboQuote->currentIndex() == ui->comboQuote->count() - OtherCode) + value = QString(QChar(ui->spinBoxQuote->value())); else if(ui->comboQuote->currentText().length()) value = ui->comboQuote->currentText(); @@ -736,10 +744,18 @@ void ImportCsvDialog::setSeparatorChar(QChar c) QComboBox* combo = ui->comboSeparator; QString sText = c == '\t' ? QString("Tab") : QString(c); int index = combo->findText(sText); + ui->spinBoxSeparator->setValue(c.unicode()); if(index == -1) { - combo->setCurrentIndex(combo->count() - 1); - ui->editCustomSeparator->setText(QString(c)); + if(c.isPrint()) + { + combo->setCurrentIndex(combo->count() - OtherPrintable); + ui->editCustomSeparator->setText(QString(c)); + } + else + { + combo->setCurrentIndex(combo->count() - OtherCode); + } } else { @@ -751,9 +767,12 @@ QChar ImportCsvDialog::currentSeparatorChar() const { QString value; - // The last item in the combobox is the 'Other' item; if it is selected return the text of the line edit field instead - if(ui->comboSeparator->currentIndex() == ui->comboSeparator->count()-1 || ui->comboSeparator->currentText().isEmpty()) + // The last options in the combobox are the 'Other (*)' items; + // if one of them is selected return the text or code of the corresponding field instead + if(ui->comboSeparator->currentIndex() == ui->comboSeparator->count() - OtherPrintable) value = ui->editCustomSeparator->text().length() ? ui->editCustomSeparator->text() : ""; + else if(ui->comboSeparator->currentIndex() == ui->comboSeparator->count() - OtherCode) + value = QString(QChar(ui->spinBoxSeparator->value())); else value = ui->comboSeparator->currentText() == tr("Tab") ? "\t" : ui->comboSeparator->currentText(); @@ -784,7 +803,7 @@ QString ImportCsvDialog::currentEncoding() const return ui->comboEncoding->currentText(); } -QString ImportCsvDialog::currentOnConflictStrategy() const +std::string ImportCsvDialog::currentOnConflictStrategy() const { switch(ui->comboOnConflictStrategy->currentIndex()) { @@ -793,7 +812,7 @@ QString ImportCsvDialog::currentOnConflictStrategy() const case 2: return "OR REPLACE"; default: - return QString(); + return {}; } } diff --git a/src/ImportCsvDialog.h b/src/ImportCsvDialog.h index 6fe68f9a..6e7f92ee 100644 --- a/src/ImportCsvDialog.h +++ b/src/ImportCsvDialog.h @@ -19,7 +19,7 @@ class ImportCsvDialog : public QDialog Q_OBJECT public: - explicit ImportCsvDialog(const QStringList& filenames, DBBrowserDB* db, QWidget* parent = nullptr); + explicit ImportCsvDialog(const std::vector& filenames, DBBrowserDB* db, QWidget* parent = nullptr); ~ImportCsvDialog() override; private slots: @@ -33,15 +33,20 @@ private slots: void toggleAdvancedSection(bool show); private: + + // Positions for combos starting at the bottom + enum {OtherCode = 1, + OtherPrintable = 2}; + Ui::ImportCsvDialog* ui; - QStringList csvFilenames; + std::vector csvFilenames; QString selectedFile; DBBrowserDB* pdb; QCompleter* encodingCompleter; QStringList dontAskForExistingTableAgain; - CSVParser::ParserResult parseCSV(const QString& fileName, std::function rowFunction, size_t count = 0); - sqlb::FieldVector generateFieldList(const QString& filename); + CSVParser::ParserResult parseCSV(const QString& fileName, std::function rowFunction, size_t count = 0) const; + sqlb::FieldVector generateFieldList(const QString& filename) const; bool importCsv(const QString& f, const QString& n = QString()); @@ -54,7 +59,7 @@ private: void setEncoding(const QString& sEnc); QString currentEncoding() const; - QString currentOnConflictStrategy() const; + std::string currentOnConflictStrategy() const; char32_t toUtf8(const QString& s) const; }; diff --git a/src/ImportCsvDialog.ui b/src/ImportCsvDialog.ui index 9947d3bb..c470c8db 100644 --- a/src/ImportCsvDialog.ui +++ b/src/ImportCsvDialog.ui @@ -85,7 +85,12 @@ - Other + Other (printable) + + + + + Other (code) @@ -97,6 +102,13 @@ + + + + 1114112 + + + @@ -143,7 +155,12 @@ - Other + Other (printable) + + + + + Other (code) @@ -155,6 +172,13 @@ + + + + 1114112 + + + @@ -719,6 +743,38 @@ + + spinBoxQuote + valueChanged(int) + ImportCsvDialog + updatePreview() + + + 529 + 111 + + + 393 + 358 + + + + + spinBoxSeparator + valueChanged(int) + ImportCsvDialog + updatePreview() + + + 529 + 77 + + + 393 + 358 + + + updatePreview() diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index d6571939..8db2ddd9 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -5,7 +5,6 @@ #include "EditIndexDialog.h" #include "AboutDialog.h" #include "EditTableDialog.h" -#include "AddRecordDialog.h" #include "ImportCsvDialog.h" #include "ExportDataDialog.h" #include "Settings.h" @@ -21,29 +20,22 @@ #include "ExportSqlDialog.h" #include "SqlUiLexer.h" #include "FileDialog.h" -#include "ColumnDisplayFormatDialog.h" #include "FilterTableHeader.h" #include "RemoteDock.h" #include "RemoteDatabase.h" #include "FindReplaceDialog.h" -#include "Data.h" -#include "CondFormat.h" -#include "CondFormatManager.h" #include "RunSql.h" +#include "ExtendedTableWidget.h" #include #include -#include #include #include #include -#include #include #include #include -#include #include -#include #include #include #include @@ -52,11 +44,11 @@ #include #include #include -#include #include #include // This include seems to only be necessary for the Windows build #include #include +#include #ifdef Q_OS_MACX //Needed only on macOS #include @@ -100,14 +92,11 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow), db(), - m_browseTableModel(new SqliteTableModel(db, this, static_cast(Settings::getValue("db", "prefetchsize").toUInt()))), - m_currentTabTableModel(m_browseTableModel), m_remoteDb(new RemoteDatabase), editDock(new EditDialog(this)), plotDock(new PlotDock(this)), remoteDock(new RemoteDock(this)), findReplaceDialog(new FindReplaceDialog(this)), - gotoValidator(new QIntValidator(0, 0, this)), execute_sql_worker(nullptr), isProjectModified(false) { @@ -121,33 +110,9 @@ MainWindow::MainWindow(QWidget* parent) MainWindow::~MainWindow() { delete m_remoteDb; - delete gotoValidator; delete ui; } -// Functions for documenting the shortcuts in the user interface using native names -static QString shortcutsTip(const QList& keys) -{ - QString tip(""); - - if (!keys.isEmpty()) { - tip = " ["; - - for (auto shortcut : keys) - tip.append(shortcut.toString(QKeySequence::NativeText) + ", "); - tip.chop(2); - - tip.append("]"); - } - return tip; -} - -static void addShortcutsTooltip(QAction* action, const QList& extraKeys = QList()) -{ - if (!action->shortcuts().isEmpty() || !extraKeys.isEmpty()) - action->setToolTip(action->toolTip() + shortcutsTip(action->shortcuts() + extraKeys)); -} - void MainWindow::init() { // Load window settings @@ -158,7 +123,7 @@ void MainWindow::init() #ifdef Q_OS_MACX // Add OpenGL Context for macOS QOpenGLWidget *ogl = new QOpenGLWidget(this); - ui->horizontalLayout->addWidget(ogl); + ui->verticalLayout->addWidget(ogl); ogl->setHidden(true); #endif @@ -176,31 +141,35 @@ void MainWindow::init() connect(&db, &DBBrowserDB::sqlExecuted, this, &MainWindow::logSql, Qt::QueuedConnection); connect(&db, &DBBrowserDB::requestCollation, this, &MainWindow::requestCollation); - // Set the validator for the goto line edit - ui->editGoto->setValidator(gotoValidator); + // Initialise table browser first + ui->tableBrowser->init(&db); - // Set up filters - connect(ui->dataTable->filterHeader(), SIGNAL(filterChanged(int,QString)), this, SLOT(updateFilter(int,QString))); - connect(ui->dataTable->filterHeader(), SIGNAL(addCondFormat(int,QString)), this, SLOT(addCondFormat(int,QString))); - connect(ui->dataTable->filterHeader(), SIGNAL(clearAllCondFormats(int)), this, SLOT(clearAllCondFormats(int))); - connect(ui->dataTable->filterHeader(), SIGNAL(editCondFormats(int)), this, SLOT(editCondFormats(int))); - connect(ui->dataTable, SIGNAL(editCondFormats(int)), this, SLOT(editCondFormats(int))); - connect(m_browseTableModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataTableSelectionChanged(QModelIndex))); + // Set project modified flag when the settings in the table browser were changed + connect(ui->tableBrowser, &TableBrowser::projectModified, this, [this]() { + isProjectModified = true; + }); - // Select in table the rows correspoding to the selected points in plot - connect(plotDock, SIGNAL(pointsSelected(int,int)), ui->dataTable, SLOT(selectTableLines(int,int))); + connect(ui->tableBrowser->model(), &SqliteTableModel::dataChanged, this, &MainWindow::dataTableSelectionChanged); + connect(ui->tableBrowser, &TableBrowser::selectionChanged, this, &MainWindow::dataTableSelectionChanged); + connect(ui->tableBrowser, &TableBrowser::selectionChangedByDoubleClick, this, &MainWindow::doubleClickTable); + connect(ui->tableBrowser, &TableBrowser::updatePlot, this, &MainWindow::attachPlot); + connect(ui->tableBrowser, &TableBrowser::createView, this, &MainWindow::saveAsView); + connect(ui->tableBrowser, &TableBrowser::requestFileOpen, this, [this](const QString& file) { + fileOpen(file); + }); + connect(ui->tableBrowser, &TableBrowser::statusMessageRequested, ui->statusbar, [this](const QString& message) { + ui->statusbar->showMessage(message); + }); + + m_currentTabTableModel = ui->tableBrowser->model(); // Set up DB structure tab dbStructureModel = new DbStructureModel(db, this); connect(&db, &DBBrowserDB::structureUpdated, this, [this]() { - // TODO This needs to be a queued connection because the schema can be updated from different threads than the main thread. - // However, this makes calling this lambda asynchronous which can lead to unexpected results. One example is that opening a database, - // changing to the Browse Data tab, and then opening another database makes the table browser try to load the old table because the table - // list wasn't updated yet. - QString old_table = ui->comboBrowseTable->currentText(); + QString old_table = QString::fromStdString(ui->tableBrowser->currentlyBrowsedTableName().name()); dbStructureModel->reloadData(); populateStructure(old_table); - }, Qt::QueuedConnection); + }); ui->dbTreeWidget->setModel(dbStructureModel); ui->dbTreeWidget->setColumnWidth(DbStructureModel::ColumnName, 300); ui->dbTreeWidget->setColumnHidden(DbStructureModel::ColumnObjectType, true); @@ -212,7 +181,7 @@ void MainWindow::init() ui->treeSchemaDock->setColumnHidden(DbStructureModel::ColumnSchema, true); // Set up the table combo box in the Browse Data tab - ui->comboBrowseTable->setModel(dbStructureModel); + ui->tableBrowser->setStructure(dbStructureModel); // Create docks ui->dockEdit->setWidget(editDock); @@ -237,16 +206,21 @@ void MainWindow::init() ui->comboLogSubmittedBy->setCurrentIndex(ui->comboLogSubmittedBy->findText(Settings::getValue("SQLLogDock", "Log").toString())); // Add keyboard shortcuts - QShortcut* shortcutBrowseRefreshF5 = new QShortcut(QKeySequence("F5"), this); - connect(shortcutBrowseRefreshF5, SIGNAL(activated()), this, SLOT(refresh())); + connect(shortcutBrowseRefreshF5, &QShortcut::activated, this, &MainWindow::refresh); QShortcut* shortcutBrowseRefreshCtrlR = new QShortcut(QKeySequence("Ctrl+R"), this); - connect(shortcutBrowseRefreshCtrlR, SIGNAL(activated()), this, SLOT(refresh())); + connect(shortcutBrowseRefreshCtrlR, &QShortcut::activated, this, &MainWindow::refresh); // Add print shortcut for the DB Structure tab (dbTreeWidget) with context to the widget, so other print shortcuts aren't eclipsed. QShortcut* shortcutPrint = new QShortcut(QKeySequence(QKeySequence::Print), ui->dbTreeWidget, nullptr, nullptr, Qt::WidgetShortcut); connect(shortcutPrint, &QShortcut::activated, this, &MainWindow::printDbStructure); + QShortcut* closeTabShortcut = new QShortcut(tr("Ctrl+W"), ui->tabSqlAreas, nullptr, nullptr, Qt::WidgetWithChildrenShortcut); + connect(closeTabShortcut, &QShortcut::activated, this, [this]() { + if(ui->tabSqlAreas->currentIndex() >= 0) + closeSqlTab(ui->tabSqlAreas->currentIndex()); + }); + // Create the actions for the recently opened dbs list for(int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); @@ -267,6 +241,8 @@ void MainWindow::init() popupTableMenu->addAction(ui->actionExportCsvPopup); popupSchemaDockMenu = new QMenu(this); + popupSchemaDockMenu->addAction(ui->actionPopupSchemaDockBrowseTable); + popupSchemaDockMenu->addSeparator(); popupSchemaDockMenu->addAction(ui->actionDropQualifiedCheck); popupSchemaDockMenu->addAction(ui->actionEnquoteNamesCheck); @@ -275,11 +251,6 @@ void MainWindow::init() popupOpenDbMenu->addAction(ui->fileOpenReadOnlyAction); ui->fileOpenActionPopup->setMenu(popupOpenDbMenu); - popupNewRecordMenu = new QMenu(this); - popupNewRecordMenu->addAction(ui->newRecordAction); - popupNewRecordMenu->addAction(ui->insertValuesAction); - ui->actionNewRecord->setMenu(popupNewRecordMenu); - popupSaveSqlFileMenu = new QMenu(this); popupSaveSqlFileMenu->addAction(ui->actionSqlSaveFile); popupSaveSqlFileMenu->addAction(ui->actionSqlSaveFileAs); @@ -291,29 +262,6 @@ void MainWindow::init() ui->actionSqlResultsSave->setMenu(popupSaveSqlResultsMenu); qobject_cast(ui->toolbarSql->widgetForAction(ui->actionSqlResultsSave))->setPopupMode(QToolButton::InstantPopup); - popupSaveFilterAsMenu = new QMenu(this); - popupSaveFilterAsMenu->addAction(ui->actionFilteredTableExportCsv); - popupSaveFilterAsMenu->addAction(ui->actionFilterSaveAsView); - ui->actionSaveFilterAsPopup->setMenu(popupSaveFilterAsMenu); - qobject_cast(ui->browseToolbar->widgetForAction(ui->actionSaveFilterAsPopup))->setPopupMode(QToolButton::InstantPopup); - - popupBrowseDataHeaderMenu = new QMenu(this); - popupBrowseDataHeaderMenu->addAction(ui->actionShowRowidColumn); - popupBrowseDataHeaderMenu->addAction(ui->actionHideColumns); - popupBrowseDataHeaderMenu->addAction(ui->actionShowAllColumns); - popupBrowseDataHeaderMenu->addSeparator(); - popupBrowseDataHeaderMenu->addAction(ui->actionUnlockViewEditing); - popupBrowseDataHeaderMenu->addAction(ui->actionBrowseTableEditDisplayFormat); - popupBrowseDataHeaderMenu->addSeparator(); - popupBrowseDataHeaderMenu->addAction(ui->actionSetTableEncoding); - popupBrowseDataHeaderMenu->addAction(ui->actionSetAllTablesEncoding); - - QShortcut* dittoRecordShortcut = new QShortcut(QKeySequence("Ctrl+\""), this); - connect(dittoRecordShortcut, &QShortcut::activated, [this]() { - int currentRow = ui->dataTable->currentIndex().row(); - duplicateRecord(currentRow); - }); - // Add menu item for log dock ui->viewMenu->insertAction(ui->viewDBToolbarAction, ui->dockLog->toggleViewAction()); ui->viewMenu->actions().at(0)->setShortcut(QKeySequence(tr("Ctrl+L"))); @@ -385,6 +333,16 @@ void MainWindow::init() QShortcut* setTab4Shortcut = new QShortcut(QKeySequence("Alt+4"), this); connect(setTab4Shortcut, &QShortcut::activated, [this]() { ui->mainTab->setCurrentIndex(3); }); + // Add button to close Execute SQL tabs + QToolButton* buttonCloseSqlTab = new QToolButton(ui->tabSqlAreas); + buttonCloseSqlTab->setIcon(QIcon(":icons/close")); + buttonCloseSqlTab->setToolTip(tr("Close current SQL tab")); + buttonCloseSqlTab->setAutoRaise(true); + connect(buttonCloseSqlTab, &QToolButton::clicked, [this]() { + closeSqlTab(ui->tabSqlAreas->currentIndex()); + }); + ui->tabSqlAreas->setCornerWidget(buttonCloseSqlTab); + // If we're not compiling in SQLCipher, hide its FAQ link in the help menu #ifndef ENABLE_SQLCIPHER ui->actionSqlCipherFaq->setVisible(false); @@ -441,20 +399,12 @@ void MainWindow::init() }); // Connect some more signals and slots - connect(ui->dataTable->filterHeader(), SIGNAL(sectionClicked(int)), this, SLOT(browseTableHeaderClicked(int))); - connect(ui->dataTable->filterHeader(), &QHeaderView::sectionDoubleClicked, ui->dataTable, &QTableView::selectColumn); - connect(ui->dataTable->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setRecordsetLabel())); - connect(ui->dataTable->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(updateBrowseDataColumnWidth(int,int,int))); - connect(editDock, SIGNAL(recordTextUpdated(QPersistentModelIndex, QByteArray, bool)), this, SLOT(updateRecordText(QPersistentModelIndex, QByteArray, bool))); - connect(ui->dbTreeWidget->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(changeTreeSelection())); - connect(ui->dataTable->horizontalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showDataColumnPopupMenu(QPoint))); - connect(ui->dataTable->verticalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showRecordPopupMenu(QPoint))); - connect(ui->dataTable, SIGNAL(openFileFromDropEvent(QString)), this, SLOT(fileOpen(QString))); - connect(ui->dockEdit, SIGNAL(visibilityChanged(bool)), this, SLOT(toggleEditDock(bool))); + connect(editDock, &EditDialog::recordTextUpdated, this, &MainWindow::updateRecordText); + connect(editDock, &EditDialog::requestUrlOrFileOpen, this, &MainWindow::openUrlOrFile); + connect(ui->dbTreeWidget->selectionModel(), &QItemSelectionModel::currentChanged, this, &MainWindow::changeTreeSelection); + connect(ui->dockEdit, &QDockWidget::visibilityChanged, this, &MainWindow::toggleEditDock); connect(m_remoteDb, SIGNAL(openFile(QString)), this, SLOT(fileOpen(QString))); connect(m_remoteDb, &RemoteDatabase::gotCurrentVersion, this, &MainWindow::checkNewVersion); - connect(m_browseTableModel, &SqliteTableModel::finishedFetch, this, &MainWindow::setRecordsetLabel); - connect(ui->dataTable, &ExtendedTableWidget::selectedRowsToBeDeleted, this, &MainWindow::deleteRecord); connect(ui->actionDropQualifiedCheck, &QAction::toggled, dbStructureModel, &DbStructureModel::setDropQualifiedNames); connect(ui->actionEnquoteNamesCheck, &QAction::toggled, dbStructureModel, &DbStructureModel::setDropEnquotedNames); connect(&db, &DBBrowserDB::databaseInUseChanged, this, &MainWindow::updateDatabaseBusyStatus); @@ -462,9 +412,9 @@ void MainWindow::init() ui->actionDropQualifiedCheck->setChecked(Settings::getValue("SchemaDock", "dropQualifiedNames").toBool()); ui->actionEnquoteNamesCheck->setChecked(Settings::getValue("SchemaDock", "dropEnquotedNames").toBool()); - connect(m_browseTableModel, &SqliteTableModel::finishedFetch, [this](){ - auto & settings = browseTableSettings[currentlyBrowsedTableName()]; - plotDock->updatePlot(m_browseTableModel, &settings, true, false); + connect(ui->tableBrowser->model(), &SqliteTableModel::finishedFetch, [this](){ + auto& settings = ui->tableBrowser->settings(ui->tableBrowser->currentlyBrowsedTableName()); + plotDock->updatePlot(ui->tableBrowser->model(), &settings, true, false); }); connect(ui->actionSqlStop, &QAction::triggered, [this]() { @@ -472,22 +422,6 @@ void MainWindow::init() execute_sql_worker->stop(); }); - // Lambda function for keyboard shortcuts for selecting next/previous table in Browse Data tab - connect(ui->dataTable, &ExtendedTableWidget::switchTable, [this](bool next) { - int index = ui->comboBrowseTable->currentIndex(); - int num_items = ui->comboBrowseTable->count(); - if(next) - { - if(++index >= num_items) - index = 0; - } else { - if(--index < 0) - index = num_items - 1; - } - ui->comboBrowseTable->setCurrentIndex(index); - populateTable(); - }); - // Connect tool pragmas connect(ui->actionIntegrityCheck, &QAction::triggered, [this]() { runSqlNewTab("PRAGMA integrity_check;", ui->actionIntegrityCheck->text()); @@ -502,17 +436,20 @@ void MainWindow::init() runSqlNewTab("PRAGMA optimize;", ui->actionOptimize->text()); }); + // Action for switching the table via the Database Structure tab + connect(ui->actionPopupSchemaDockBrowseTable, &QAction::triggered, [this]() { + sqlb::ObjectIdentifier obj(ui->treeSchemaDock->model()->data(ui->treeSchemaDock->currentIndex().sibling(ui->treeSchemaDock->currentIndex().row(), DbStructureModel::ColumnSchema), Qt::EditRole).toString().toStdString(), + ui->treeSchemaDock->model()->data(ui->treeSchemaDock->currentIndex().sibling(ui->treeSchemaDock->currentIndex().row(), DbStructureModel::ColumnName), Qt::EditRole).toString().toStdString()); + switchToBrowseDataTab(obj); + refresh(); // Required in case the Browse Data tab already was the active main tab + }); + // Set other window settings setAcceptDrops(true); setWindowTitle(QApplication::applicationName()); // Add the documentation of shortcuts, which aren't otherwise visible in the user interface, to some buttons. - addShortcutsTooltip(ui->actionDbPrint); - - addShortcutsTooltip(ui->actionRefresh, {shortcutBrowseRefreshCtrlR->key()}); - addShortcutsTooltip(ui->actionPrintTable); - addShortcutsTooltip(ui->actionSqlOpenTab); addShortcutsTooltip(ui->actionSqlPrint); addShortcutsTooltip(ui->actionExecuteSql, {shortcutBrowseRefreshF5->key(), shortcutBrowseRefreshCtrlR->key()}); @@ -586,10 +523,13 @@ bool MainWindow::fileOpen(const QString& fileName, bool openFromProject, bool re statusReadOnlyLabel->setVisible(db.readOnly()); setCurrentFile(wFile); if(!openFromProject) { - currentProjectFilename.clear(); - addToRecentFilesMenu(wFile); + addToRecentFilesMenu(wFile, readOnly); + // When a new DB file has been open while a project is open, set the project modified. + if(!currentProjectFilename.isEmpty()) + isProjectModified = true; } - openSqlTab(true); + if(ui->tabSqlAreas->count() == 0) + openSqlTab(true); if(ui->mainTab->currentWidget() == ui->browser) populateTable(); else if(ui->mainTab->currentWidget() == ui->pragmas) @@ -623,7 +563,8 @@ void MainWindow::fileNew() statusEncryptionLabel->setVisible(false); statusReadOnlyLabel->setVisible(false); populateTable(); - openSqlTab(true); + if(ui->tabSqlAreas->count() == 0) + openSqlTab(true); createTable(); } } @@ -636,7 +577,8 @@ void MainWindow::fileNewInMemoryDatabase() statusEncryptionLabel->setVisible(false); statusReadOnlyLabel->setVisible(false); populateTable(); - openSqlTab(true); + if(ui->tabSqlAreas->count() == 0) + openSqlTab(true); createTable(); } @@ -649,14 +591,7 @@ void MainWindow::populateStructure(const QString& old_table) ui->treeSchemaDock->expandToDepth(0); // Refresh the browse data tab - ui->comboBrowseTable->setRootModelIndex(dbStructureModel->index(0, 0)); // Show the 'browsable' section of the db structure tree - int old_table_index = ui->comboBrowseTable->findText(old_table); - if(old_table_index == -1 && ui->comboBrowseTable->count()) // If the old table couldn't be found anymore but there is another table, select that - ui->comboBrowseTable->setCurrentIndex(0); - else if(old_table_index == -1) // If there aren't any tables to be selected anymore, clear the table view - clearTableBrowser(); - else // Under normal circumstances just select the old table again - ui->comboBrowseTable->setCurrentIndex(old_table_index); + ui->tableBrowser->setStructure(dbStructureModel, old_table); // Cancel here if no database is opened if(!db.isOpen()) @@ -667,15 +602,19 @@ void MainWindow::populateStructure(const QString& old_table) for(const auto& it : db.schemata) { SqlUiLexer::TablesAndColumnsMap tablesToColumnsMap; - objectMap tab = db.getBrowsableObjects(it.first); - for(const auto& jt : tab) - { - QString objectname = QString::fromStdString(jt.second->name()); - sqlb::FieldInfoList fi = jt.second->fieldInformation(); - for(const sqlb::FieldInfo& f : fi) - tablesToColumnsMap[objectname].push_back(QString::fromStdString(f.name)); + for(const auto& jt : it.second) + { + if(jt.second->type() == sqlb::Object::Types::Table || jt.second->type() == sqlb::Object::Types::View) + { + QString objectname = QString::fromStdString(jt.second->name()); + + sqlb::FieldInfoList fi = jt.second->fieldInformation(); + for(const sqlb::FieldInfo& f : fi) + tablesToColumnsMap[objectname].push_back(QString::fromStdString(f.name)); + } } + qualifiedTablesMap[QString::fromStdString(it.first)] = tablesToColumnsMap; } SqlTextEdit::sqlLexer->setTableNames(qualifiedTablesMap); @@ -694,212 +633,17 @@ void MainWindow::populateStructure(const QString& old_table) } -void MainWindow::clearTableBrowser() -{ - if (!ui->dataTable->model()) - return; - - ui->dataTable->setModel(nullptr); - if(qobject_cast(ui->dataTable->horizontalHeader())) - qobject_cast(ui->dataTable->horizontalHeader())->generateFilters(0); -} - void MainWindow::populateTable() { // Early exit if the Browse Data tab isn't visible as there is no need to update it in this case if(ui->mainTab->currentWidget() != ui->browser) return; - // Remove the model-view link if the table name is empty in order to remove any data from the view - if(ui->comboBrowseTable->model()->rowCount(ui->comboBrowseTable->rootModelIndex()) == 0) - { - clearTableBrowser(); - return; - } - QApplication::setOverrideCursor(Qt::WaitCursor); - - // Get current table name - sqlb::ObjectIdentifier tablename = currentlyBrowsedTableName(); - - // Set model - bool reconnectSelectionSignals = false; - if(ui->dataTable->model() == nullptr) - reconnectSelectionSignals = true; - ui->dataTable->setModel(m_browseTableModel); - if(reconnectSelectionSignals) - { - connect(ui->dataTable->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(dataTableSelectionChanged(QModelIndex))); - connect(ui->dataTable->selectionModel(), &QItemSelectionModel::selectionChanged, [this](const QItemSelection&, const QItemSelection&) { - updateInsertDeleteRecordButton(); - - const QModelIndexList& sel = ui->dataTable->selectionModel()->selectedIndexes(); - QString statusMessage; - if (sel.count() > 1) { - int rows = sel.last().row() - sel.first().row() + 1; - statusMessage = tr("%n row(s)", "", rows); - int columns = sel.last().column() - sel.first().column() + 1; - statusMessage += tr(", %n column(s)", "", columns); - - if (sel.count() < Settings::getValue("databrowser", "complete_threshold").toInt()) { - double sum = 0; - double first = m_browseTableModel->data(sel.first(), Qt::EditRole).toDouble(); - double min = first; - double max = first; - for (const QModelIndex& index : sel) { - double dblData = m_browseTableModel->data(index, Qt::EditRole).toDouble(); - sum += dblData; - min = std::min(min, dblData); - max = std::max(max, dblData); - } - statusMessage += tr(". Sum: %1; Average: %2; Min: %3; Max: %4").arg(sum).arg(sum/sel.count()).arg(min).arg(max); - } - }; - ui->statusbar->showMessage(statusMessage); - }); - } - // Search stored table settings for this table - bool storedDataFound = browseTableSettings.contains(tablename); - - // Set new table - if(!storedDataFound) - { - // No stored settings found. - - // Set table name and apply default display format settings - m_browseTableModel->setQuery(sqlb::Query(tablename)); - - // There aren't any information stored for this table yet, so use some default values - - // Hide rowid column. Needs to be done before the column widths setting because of the workaround in there - showRowidColumn(false); - - // Unhide all columns by default - on_actionShowAllColumns_triggered(); - - // Enable editing in general, but lock view editing - unlockViewEditing(false); - - // Column widths - for(int i=1;icolumnCount();i++) - ui->dataTable->setColumnWidth(i, ui->dataTable->horizontalHeader()->defaultSectionSize()); - - // Encoding - m_browseTableModel->setEncoding(defaultBrowseTableEncoding); - - setRecordsetLabel(); - - // Plot - attachPlot(ui->dataTable, m_browseTableModel, &browseTableSettings[tablename]); - - // The filters can be left empty as they are - } else { - // Stored settings found. Retrieve them and assemble a query from them. - BrowseDataTableSettings storedData = browseTableSettings[tablename]; - sqlb::Query query(tablename); - - // Sorting - query.setOrderBy(storedData.query.orderBy()); - - // Filters - for(auto it=storedData.filterValues.constBegin();it!=storedData.filterValues.constEnd();++it) - query.where().insert({it.key(), CondFormat::filterToSqlCondition(it.value(), m_browseTableModel->encoding()).toStdString()}); - - // Display formats - bool only_defaults = true; - if(db.getObjectByName(tablename)) - { - const sqlb::FieldInfoList& tablefields = db.getObjectByName(tablename)->fieldInformation(); - for(size_t i=0; i(i)+1]; - if(format.size()) - { - query.selectedColumns().emplace_back(tablefields.at(i).name, format.toStdString()); - only_defaults = false; - } else { - query.selectedColumns().emplace_back(tablefields.at(i).name, tablefields.at(i).name); - } - } - } - if(only_defaults) - query.selectedColumns().clear(); - - // Unlock view editing - query.setRowIdColumn(storedData.unlockViewPk.toStdString()); - - // Apply query - m_browseTableModel->setQuery(query); - - // There is information stored for this table, so extract it and apply it - applyBrowseTableSettings(storedData); - - setRecordsetLabel(); - - // Plot - attachPlot(ui->dataTable, m_browseTableModel, &browseTableSettings[tablename], false); - } - - // Show/hide menu options depending on whether this is a table or a view - if(db.getObjectByName(currentlyBrowsedTableName()) && db.getObjectByName(currentlyBrowsedTableName())->type() == sqlb::Object::Table) - { - // Table - sqlb::TablePtr table = db.getObjectByName(currentlyBrowsedTableName()); - ui->actionUnlockViewEditing->setVisible(false); - ui->actionShowRowidColumn->setVisible(!table->withoutRowidTable()); - } else { - // View - ui->actionUnlockViewEditing->setVisible(true); - ui->actionShowRowidColumn->setVisible(false); - } - - updateInsertDeleteRecordButton(); - + ui->tableBrowser->updateTable(); QApplication::restoreOverrideCursor(); } -void MainWindow::applyBrowseTableSettings(BrowseDataTableSettings storedData, bool skipFilters) -{ - // We don't want to pass storedData by reference because the functions below would change the referenced data in their original - // place, thus modifiying the data this function can use. To have a static description of what the view should look like we want - // a copy here. - - // Show rowid column. Needs to be done before the column widths setting because of the workaround in there and before the filter setting - // because of the filter row generation. - showRowidColumn(storedData.showRowid, skipFilters); - - // Enable editing in general and (un)lock view editing depending on the settings - unlockViewEditing(!storedData.unlockViewPk.isEmpty(), storedData.unlockViewPk); - - // Column hidden status - on_actionShowAllColumns_triggered(); - for(auto hiddenIt=storedData.hiddenColumns.constBegin();hiddenIt!=storedData.hiddenColumns.constEnd();++hiddenIt) - hideColumns(hiddenIt.key(), hiddenIt.value()); - - // Column widths - for(auto widthIt=storedData.columnWidths.constBegin();widthIt!=storedData.columnWidths.constEnd();++widthIt) - ui->dataTable->setColumnWidth(widthIt.key(), widthIt.value()); - - // Filters - if(!skipFilters) - { - // Set filters blocking signals, since the filter is already applied to the browse table model - FilterTableHeader* filterHeader = qobject_cast(ui->dataTable->horizontalHeader()); - bool oldState = filterHeader->blockSignals(true); - for(auto filterIt=storedData.filterValues.constBegin();filterIt!=storedData.filterValues.constEnd();++filterIt) - filterHeader->setFilter(static_cast(filterIt.key()), filterIt.value()); - - // Conditional formats - for(auto formatIt=storedData.condFormats.constBegin(); formatIt!=storedData.condFormats.constEnd(); ++formatIt) - m_browseTableModel->setCondFormats(formatIt.key(), formatIt.value()); - - filterHeader->blockSignals(oldState); - } - - // Encoding - m_browseTableModel->setEncoding(storedData.encoding); -} - bool MainWindow::fileClose() { // Stop any running SQL statements before closing the database @@ -916,32 +660,20 @@ bool MainWindow::fileClose() } // Close the database but stop the closing process here if the user pressed the cancel button in there - if(!closeProject()) + if(!db.close()) return false; - setWindowTitle(QApplication::applicationName()); + setCurrentFile(QString()); loadPragmas(); statusEncryptionLabel->setVisible(false); statusReadOnlyLabel->setVisible(false); - // Reset the model for the Browse tab - m_browseTableModel->reset(); - - // Remove all stored table information browse data tab - browseTableSettings.clear(); - defaultBrowseTableEncoding = QString(); + // Reset the table browser of the Browse Data tab + ui->tableBrowser->reset(); // Clear edit dock editDock->setCurrentIndex(QModelIndex()); - // Reset the recordset label inside the Browse tab now - setRecordsetLabel(); - - // Reset the plot dock model and connection - attachPlot(nullptr, nullptr); - - activateFields(false); - // Clear the SQL Log ui->editLogApplication->clear(); ui->editLogUser->clear(); @@ -992,9 +724,9 @@ bool MainWindow::closeProject() QMessageBox::StandardButton reply = QMessageBox::question (nullptr, QApplication::applicationName(), - tr("Do you want to save the changes made to the project file %1?"). + tr("Do you want to save the changes made to the project file '%1'?"). arg(QFileInfo(currentProjectFilename).fileName()), - QMessageBox::Save | QMessageBox::No | QMessageBox::Cancel); + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); switch(reply) { case QMessageBox::Save: saveProject(); @@ -1005,61 +737,10 @@ bool MainWindow::closeProject() break; } } + currentProjectFilename.clear(); return db.close(); } -void MainWindow::addRecord() -{ - int row = m_browseTableModel->rowCount(); - - // If table has pseudo_pk, then it must be an editable view. Jump straight to inserting by pop-up dialog. - if(!m_browseTableModel->hasPseudoPk() && m_browseTableModel->insertRow(row)) - { - selectTableLine(row); - } else { - // Error inserting empty row. - // User has to provide values acomplishing the constraints. Open Add Record Dialog. - insertValues(); - } -} - -void MainWindow::insertValues() -{ - std::vector pseudo_pk = m_browseTableModel->hasPseudoPk() ? m_browseTableModel->pseudoPk() : std::vector(); - AddRecordDialog dialog(db, currentlyBrowsedTableName(), this, pseudo_pk); - if (dialog.exec()) - populateTable(); -} - -void MainWindow::deleteRecord() -{ - if(ui->dataTable->selectionModel()->hasSelection()) - { - // If only filter header is selected - if(ui->dataTable->selectionModel()->selectedIndexes().isEmpty()) - return; - - int old_row = ui->dataTable->currentIndex().row(); - while(ui->dataTable->selectionModel()->hasSelection()) - { - int first_selected_row = ui->dataTable->selectionModel()->selectedIndexes().first().row(); - int last_selected_row = ui->dataTable->selectionModel()->selectedIndexes().last().row(); - int selected_rows_count = last_selected_row - first_selected_row + 1; - if(!m_browseTableModel->removeRows(first_selected_row, selected_rows_count)) - { - QMessageBox::warning(this, QApplication::applicationName(), tr("Error deleting record:\n%1").arg(db.lastError())); - break; - } - } - - if(old_row > m_browseTableModel->rowCount()) - old_row = m_browseTableModel->rowCount(); - selectTableLine(old_row); - } else { - QMessageBox::information( this, QApplication::applicationName(), tr("Please select a record first")); - } -} - void MainWindow::attachPlot(ExtendedTableWidget* tableWidget, SqliteTableModel* model, BrowseDataTableSettings* settings, bool keepOrResetSelection) { plotDock->updatePlot(model, settings, true, keepOrResetSelection); @@ -1067,98 +748,14 @@ void MainWindow::attachPlot(ExtendedTableWidget* tableWidget, SqliteTableModel* disconnect(plotDock, SIGNAL(pointsSelected(int,int)), nullptr, nullptr); if(tableWidget) { // Connect plot selection to the current table results widget. - connect(plotDock, SIGNAL(pointsSelected(int,int)), tableWidget, SLOT(selectTableLines(int,int))); - connect(tableWidget, SIGNAL(destroyed()), plotDock, SLOT(resetPlot())); - + connect(plotDock, SIGNAL(pointsSelected(int,int)), tableWidget, SLOT(selectTableLines(int, int))); + connect(tableWidget, &ExtendedTableWidget::destroyed, plotDock, &PlotDock::resetPlot); + // Disconnect requestUrlOrFileOpen in order to make sure that there is only one connection. Otherwise we can open it several times. + disconnect(tableWidget, &ExtendedTableWidget::requestUrlOrFileOpen, this, &MainWindow::openUrlOrFile); + connect(tableWidget, &ExtendedTableWidget::requestUrlOrFileOpen, this, &MainWindow::openUrlOrFile); } } -void MainWindow::selectTableLine(int lineToSelect) -{ - ui->dataTable->selectTableLine(lineToSelect); -} - -void MainWindow::navigatePrevious() -{ - int curRow = ui->dataTable->currentIndex().row(); - curRow -= ui->dataTable->numVisibleRows() - 1; - if(curRow < 0) - curRow = 0; - selectTableLine(curRow); -} - - -void MainWindow::navigateNext() -{ - int curRow = ui->dataTable->currentIndex().row(); - curRow += ui->dataTable->numVisibleRows() - 1; - if(curRow >= m_browseTableModel->rowCount()) - curRow = m_browseTableModel->rowCount() - 1; - selectTableLine(curRow); -} - -void MainWindow::navigateBegin() -{ - selectTableLine(0); -} - -void MainWindow::navigateEnd() -{ - selectTableLine(m_browseTableModel->rowCount()-1); -} - - -void MainWindow::navigateGoto() -{ - int row = ui->editGoto->text().toInt(); - if(row <= 0) - row = 1; - if(row > m_browseTableModel->rowCount()) - row = m_browseTableModel->rowCount(); - - selectTableLine(row - 1); - ui->editGoto->setText(QString::number(row)); -} - -void MainWindow::setRecordsetLabel() -{ - // Get all the numbers, i.e. the number of the first row and the last row as well as the total number of rows - int from = ui->dataTable->verticalHeader()->visualIndexAt(0) + 1; - int total = m_browseTableModel->rowCount(); - int to = ui->dataTable->verticalHeader()->visualIndexAt(ui->dataTable->height()) - 1; - if (to == -2) - to = total; - - // Update the validator of the goto row field - gotoValidator->setRange(0, total); - - // When there is no query for this table (i.e. no table is selected), there is no row count query either which in turn means - // that the row count query will never finish. And because of this the row count will be forever unknown. To avoid always showing - // a misleading "determining row count" text in the UI we set the row count status to complete here for empty queries. - auto row_count_available = m_browseTableModel->rowCountAvailable(); - if(m_browseTableModel->query().isEmpty()) - row_count_available = SqliteTableModel::RowCount::Complete; - - // Update the label showing the current position - QString txt; - switch(row_count_available) - { - case SqliteTableModel::RowCount::Unknown: - txt = tr("determining row count..."); - break; - case SqliteTableModel::RowCount::Partial: - txt = tr("%1 - %2 of >= %3").arg(from).arg(to).arg(total); - break; - case SqliteTableModel::RowCount::Complete: - default: - txt = tr("%1 - %2 of %3").arg(from).arg(to).arg(total); - break; - } - ui->labelRecordset->setText(txt); - - enableEditing(m_browseTableModel->rowCountAvailable() != SqliteTableModel::RowCount::Unknown); -} - void MainWindow::refresh() { // What the Refresh function does depends on the currently active tab. This way the keyboard shortcuts (F5 and Ctrl+R) @@ -1182,11 +779,6 @@ void MainWindow::refresh() void MainWindow::createTable() { - if (!db.isOpen()){ - QMessageBox::information( this, QApplication::applicationName(), tr("There is no database opened. Please open or create a new database file.")); - return; - } - EditTableDialog dialog(db, sqlb::ObjectIdentifier(), true, this); if(dialog.exec()) { @@ -1196,11 +788,6 @@ void MainWindow::createTable() void MainWindow::createIndex() { - if (!db.isOpen()){ - QMessageBox::information( this, QApplication::applicationName(), tr("There is no database opened. Please open or create a new database file.")); - return; - } - EditIndexDialog dialog(db, sqlb::ObjectIdentifier(), true, this); if(dialog.exec()) populateTable(); @@ -1235,8 +822,8 @@ void MainWindow::deleteObject() QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) { // Delete the table - QString statement = QString("DROP %1 %2;").arg(type.toUpper()).arg(QString::fromStdString(name.toString())); - if(!db.executeSQL(statement)) + QString statement = QString("DROP %1 %2;").arg(type.toUpper(), QString::fromStdString(name.toString())); + if(!db.executeSQL(statement.toStdString())) { if (type == "table") message = tr("Error: could not delete the table."); @@ -1290,7 +877,7 @@ void MainWindow::editObject() // If foreign_keys were enabled, we must commit or rollback the transaction so the foreign_keys pragma can be restored. if (foreign_keys == "1") { - if (!db.querySingleValueFromDb(QString("PRAGMA %1.foreign_key_check").arg(QString::fromStdString(sqlb::escapeIdentifier(name.schema())))).isNull()) { + if (!db.querySingleValueFromDb("PRAGMA " + sqlb::escapeIdentifier(name.schema()) + ".foreign_key_check").isNull()) { // Raise warning for accepted modification. When rejected, warn user also since we know now that the table has problems, // but it wasn't our fault. if (ok) @@ -1308,7 +895,7 @@ void MainWindow::editObject() db.setPragma("foreign_keys", foreign_keys); } if(ok) { - ui->dataTable->filterHeader()->clearFilters(); + ui->tableBrowser->clearFilters(); populateTable(); } } else if(type == "index") { @@ -1338,10 +925,13 @@ void MainWindow::toggleEditDock(bool visible) { if (!visible) { // Update main window - ui->dataTable->setFocus(); + ui->tableBrowser->setFocus(); } else { - // fill edit dock with actual data - editDock->setCurrentIndex(ui->dataTable->currentIndex()); + // fill edit dock with actual data, when the current index has changed while the dock was invisible. + // (note that this signal is also emitted when the widget is docked or undocked, so we have to avoid + // reloading data when the user is editing and (un)docks the editor). + if (editDock->currentIndex() != ui->tableBrowser->currentIndex()) + editDock->setCurrentIndex(ui->tableBrowser->currentIndex()); } } @@ -1353,8 +943,8 @@ void MainWindow::doubleClickTable(const QModelIndex& index) } // * Don't allow editing of other objects than tables and editable views - bool isEditingAllowed = !db.readOnly() && m_currentTabTableModel == m_browseTableModel && - m_browseTableModel->isEditable(); + bool isEditingAllowed = !db.readOnly() && m_currentTabTableModel == ui->tableBrowser->model() && + ui->tableBrowser->model()->isEditable(); // Enable or disable the Apply, Null, & Import buttons in the Edit Cell // dock depending on the value of the "isEditingAllowed" bool above @@ -1377,8 +967,8 @@ void MainWindow::dataTableSelectionChanged(const QModelIndex& index) return; } - bool editingAllowed = !db.readOnly() && (m_currentTabTableModel == m_browseTableModel) && - m_browseTableModel->isEditable(); + bool editingAllowed = !db.readOnly() && (m_currentTabTableModel == ui->tableBrowser->model()) && + ui->tableBrowser->model()->isEditable(); // Don't allow editing of other objects than tables and editable views editDock->setReadOnly(!editingAllowed); @@ -1468,7 +1058,7 @@ void MainWindow::executeQuery() // Need to set the end position here before adjusting the start line int execute_to_line = execute_from_line; - int execute_to_index = editor->text(execute_to_line).length() - 1; // The -1 compensates for the line break at the end of the line + int execute_to_index = editor->text(execute_to_line).remove('\n').remove('\r').length(); // This chops the line break at the end of the line execute_to_position = editor->positionFromLineIndex(execute_to_line, execute_to_index); QByteArray firstPartEntireSQL = sqlWidget->getSql().toUtf8().left(execute_from_position); @@ -1494,9 +1084,13 @@ void MainWindow::executeQuery() // Special case: if the start position is at the end of a line, then move to the beggining of next line. // Otherwise for the typical case, the line reference is one less than expected. - // Note that execute_from_index uses character positions and not byte positions, so text().length() must be used. - if (editor->text(execute_from_line).length() == execute_from_index+1) { + // Note that execute_from_index uses character positions and not byte positions, so at() can be used. + QChar char_at_index = editor->text(execute_from_line).at(execute_from_index); + if (char_at_index == '\r' || char_at_index == '\n') { execute_from_line++; + // The next lines could be empty, so skip all of them too. + while(editor->text(execute_from_line).trimmed().isEmpty()) + execute_from_line++; execute_from_index = 0; } @@ -1532,6 +1126,9 @@ void MainWindow::executeQuery() // existing execution area. execute_sql_worker.reset(new RunSql(db, sql, execute_from_position, execute_to_position, true)); + connect(execute_sql_worker.get(), &RunSql::structureUpdated, sqlWidget, [this]() { + db.updateSchema(); + }, Qt::QueuedConnection); connect(execute_sql_worker.get(), &RunSql::statementErrored, sqlWidget, [query_logger, this, sqlWidget](const QString& status_message, int from_position, int to_position) { sqlWidget->getModel()->reset(); ui->actionSqlResultsSave->setEnabled(false); @@ -1565,7 +1162,7 @@ void MainWindow::executeQuery() disconnect(*conn); attachPlot(sqlWidget->getTableResult(), sqlWidget->getModel()); - connect(sqlWidget->getTableResult()->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(dataTableSelectionChanged(QModelIndex))); + connect(sqlWidget->getTableResult()->selectionModel(), &QItemSelectionModel::currentChanged, this, &MainWindow::dataTableSelectionChanged); connect(sqlWidget->getTableResult(), &QTableView::doubleClicked, this, &MainWindow::doubleClickTable); auto time_end = std::chrono::high_resolution_clock::now(); @@ -1622,7 +1219,7 @@ void MainWindow::mainTabSelected(int /*tabindex*/) if(ui->mainTab->currentWidget() == ui->browser) { - m_currentTabTableModel = m_browseTableModel; + m_currentTabTableModel = ui->tableBrowser->model(); populateTable(); } else if(ui->mainTab->currentWidget() == ui->pragmas) { loadPragmas(); @@ -1644,6 +1241,7 @@ void MainWindow::importTableFromCSV() << FILE_FILTER_TSV << FILE_FILTER_DSV << FILE_FILTER_TXT + << FILE_FILTER_DAT << FILE_FILTER_ALL; QStringList wFiles = FileDialog::getOpenFileNames( @@ -1652,13 +1250,13 @@ void MainWindow::importTableFromCSV() tr("Choose text files"), file_filter.join(";;")); - QStringList validFiles; + std::vector validFiles; for(const auto& file : wFiles) { if (QFile::exists(file)) - validFiles.append(file); + validFiles.push_back(file); } - if (!validFiles.isEmpty()) + if (!validFiles.empty()) { ImportCsvDialog dialog(validFiles, &db, this); if (dialog.exec()) @@ -1680,7 +1278,7 @@ void MainWindow::exportTableToCSV() current_table = sqlb::ObjectIdentifier(schema.toStdString(), name.toStdString()); } } else if(ui->mainTab->currentWidget() == ui->browser) { - current_table = currentlyBrowsedTableName(); + current_table = ui->tableBrowser->currentlyBrowsedTableName(); } // Open dialog @@ -1702,7 +1300,7 @@ void MainWindow::exportTableToJson() current_table = sqlb::ObjectIdentifier(schema.toStdString(), name.toStdString()); } } else if(ui->mainTab->currentWidget() == ui->browser) { - current_table = currentlyBrowsedTableName(); + current_table = ui->tableBrowser->currentlyBrowsedTableName(); } // Open dialog @@ -1710,12 +1308,11 @@ void MainWindow::exportTableToJson() dialog.exec(); } -void MainWindow::dbState( bool dirty ) +void MainWindow::dbState(bool dirty) { ui->fileSaveAction->setEnabled(dirty); ui->fileRevertAction->setEnabled(dirty); - ui->fileAttachAction->setEnabled(!dirty); - //ui->actionEncryption->setEnabled(!dirty); + ui->fileAttachAction->setEnabled(db.isOpen() && !dirty); } void MainWindow::fileSave() @@ -1746,7 +1343,7 @@ void MainWindow::exportDatabaseToSQL() { QString current_table; if(ui->mainTab->currentWidget() == ui->browser) - current_table = ui->comboBrowseTable->currentText(); + current_table = QString::fromStdString(ui->tableBrowser->currentlyBrowsedTableName().name()); ExportSqlDialog dialog(&db, this, current_table); dialog.exec(); @@ -1794,7 +1391,7 @@ void MainWindow::importDatabaseFromSQL() // Create the new file and open it in the browser db.create(newDbFile); - closeProject(); + db.close(); fileOpen(newDbFile); } @@ -1812,7 +1409,7 @@ void MainWindow::importDatabaseFromSQL() QApplication::restoreOverrideCursor(); if(!ok) QMessageBox::warning(this, QApplication::applicationName(), tr("Error importing data: %1").arg(db.lastError())); - else if(db.getPragma("foreign_keys") == "1" && !db.querySingleValueFromDb(QString("PRAGMA foreign_key_check")).isNull()) + else if(db.getPragma("foreign_keys") == "1" && !db.querySingleValueFromDb("PRAGMA foreign_key_check").isNull()) QMessageBox::warning(this, QApplication::applicationName(), tr("Import completed. Some foreign key constraints are violated. Please fix them before saving.")); else QMessageBox::information(this, QApplication::applicationName(), tr("Import completed.")); @@ -1848,6 +1445,15 @@ void MainWindow::createTreeContextMenu(const QPoint &qPoint) //** DB Schema Dock Context Menu void MainWindow::createSchemaDockContextMenu(const QPoint &qPoint) { + bool enable_browse_table = false; + if(ui->treeSchemaDock->selectionModel()->hasSelection()) + { + QString type = ui->treeSchemaDock->model()->data(ui->treeSchemaDock->currentIndex().sibling(ui->treeSchemaDock->currentIndex().row(), DbStructureModel::ColumnObjectType), Qt::EditRole).toString(); + if(type == "table" || type == "view") + enable_browse_table = true; + } + ui->actionPopupSchemaDockBrowseTable->setEnabled(enable_browse_table); + popupSchemaDockMenu->exec(ui->treeSchemaDock->mapToGlobal(qPoint)); } @@ -1914,7 +1520,17 @@ void MainWindow::openRecentFile() { QAction *action = qobject_cast(sender()); if (action) - fileOpen(action->data().toString()); + { + QString file = action->data().toString(); + bool read_only = false; + if(file.startsWith("[ro]")) // Check if file is in read-only + { + file = file.mid(4); + read_only = true; + } + + fileOpen(file, false, read_only); + } } void MainWindow::updateRecentFileActions() @@ -1925,7 +1541,12 @@ void MainWindow::updateRecentFileActions() // Check if files still exist and remove any non-existent file for(int i=0;isetText(text); recentFileActs[i]->setData(files[i]); recentFileActs[i]->setVisible(true); @@ -1946,7 +1575,7 @@ void MainWindow::updateRecentFileActions() // Add shortcut for opening the file using the keyboard. However, if the application is configured to store // more than nine recently opened files don't set shortcuts for the later ones which wouldn't be single digit anymore. if(i < 9) - recentFileActs[i]->setShortcut(QKeySequence(Qt::CTRL + (Qt::Key_1+i))); + recentFileActs[i]->setShortcut(QKeySequence(static_cast(Qt::CTRL + (Qt::Key_1+static_cast(i))))); } for (int j = numRecentFiles; j < MaxRecentFiles; ++j) recentFileActs[j]->setVisible(false); @@ -1957,18 +1586,36 @@ void MainWindow::updateRecentFileActions() void MainWindow::setCurrentFile(const QString &fileName) { setWindowFilePath(fileName); - setWindowTitle(QApplication::applicationName() + " - " + QDir::toNativeSeparators(fileName)); - activateFields(true); - dbState(db.getDirty()); + if(currentProjectFilename.isEmpty() && fileName.isEmpty()) + setWindowTitle(QApplication::applicationName()); + else if(currentProjectFilename.isEmpty()) + setWindowTitle(QApplication::applicationName() + " - " + QDir::toNativeSeparators(fileName)); + else { + QFileInfo projectFileInfo(currentProjectFilename); + QFileInfo dbFileInfo(fileName); + QString dbFileName; + if(dbFileInfo.path() == projectFileInfo.path()) + dbFileName = dbFileInfo.fileName(); + else + dbFileName = QDir::toNativeSeparators(fileName); + setWindowTitle(QApplication::applicationName() + " - " + QDir::toNativeSeparators(currentProjectFilename) + " [" + dbFileName + "]"); + } + activateFields(!fileName.isEmpty()); + if(!fileName.isEmpty()) + dbState(db.getDirty()); } -void MainWindow::addToRecentFilesMenu(const QString& filename) +void MainWindow::addToRecentFilesMenu(const QString& filename, bool read_only) { - QStringList files = Settings::getValue("General", "recentFileList").toStringList(); QFileInfo info(filename); + QString path = info.absoluteFilePath(); + if(read_only) + path = "[ro]" + path; - files.removeAll(info.absoluteFilePath()); - files.prepend(info.absoluteFilePath()); + QStringList files = Settings::getValue("General", "recentFileList").toStringList(); + + files.removeAll(path); + files.prepend(path); while (files.size() > MaxRecentFiles) files.removeLast(); @@ -1996,8 +1643,43 @@ void MainWindow::dropEvent(QDropEvent *event) QString fileName = urls.first().toLocalFile(); - if(!fileName.isEmpty()) + if(!fileName.isEmpty()) { + + // If there is no open database, the only possible option is to open the file. + if (!db.isOpen()) { fileOpen(fileName); + return; + } + bool ok; + const QString open = tr("Open Database or Project"); + const QString attach = tr("Attach Database..."); + const QString import = tr("Import CSV file(s)..."); + QString action = QInputDialog::getItem(this, + qApp->applicationName(), + tr("Select the action to apply to the dropped file(s).
" + "Note: only 'Import' will process more than one file.", "", urls.count()), + {open, attach, import}, + 0, + false, + &ok); + if(ok) { + if (action == open) { + fileOpen(fileName); + } else if (action == attach) { + fileAttach(fileName); + } else if (action == import) { + + std::vector validFiles; + for(const auto& url : urls) { + if (QFile::exists(url.toLocalFile())) + validFiles.push_back(url.toLocalFile()); + } + ImportCsvDialog dialog(validFiles, &db, this); + if (dialog.exec()) + populateTable(); + } + } + } } void MainWindow::activateFields(bool enable) @@ -2005,6 +1687,7 @@ void MainWindow::activateFields(bool enable) bool write = !db.readOnly(); bool tempDb = db.currentFile() == ":memory:"; + ui->tableBrowser->setEnabled(enable); ui->fileCloseAction->setEnabled(enable); ui->fileAttachAction->setEnabled(enable); ui->fileCompactAction->setEnabled(enable && write); @@ -2015,16 +1698,8 @@ void MainWindow::activateFields(bool enable) ui->editCreateTableAction->setEnabled(enable && write); ui->editCreateIndexAction->setEnabled(enable && write); ui->actionDbPrint->setEnabled(enable); - ui->buttonNext->setEnabled(enable); - ui->buttonPrevious->setEnabled(enable); - ui->buttonBegin->setEnabled(enable); - ui->buttonEnd->setEnabled(enable); ui->scrollAreaWidgetContents->setEnabled(enable); ui->buttonBoxPragmas->setEnabled(enable && write); - ui->buttonGoto->setEnabled(enable); - ui->editGoto->setEnabled(enable); - ui->actionRefresh->setEnabled(enable); - ui->actionPrintTable->setEnabled(enable); ui->actionExecuteSql->setEnabled(enable); ui->actionLoadExtension->setEnabled(enable); ui->actionSqlExecuteLine->setEnabled(enable); @@ -2036,96 +1711,18 @@ void MainWindow::activateFields(bool enable) ui->actionQuickCheck->setEnabled(enable); ui->actionForeignKeyCheck->setEnabled(enable); ui->actionOptimize->setEnabled(enable); - ui->actionClearFilters->setEnabled(enable); - ui->actionSaveFilterAsPopup->setEnabled(enable); ui->dockEdit->setEnabled(enable); ui->dockPlot->setEnabled(enable); if(!enable) ui->actionSqlResultsSave->setEnabled(false); - updateInsertDeleteRecordButton(); remoteDock->enableButtons(); } -void MainWindow::enableEditing(bool enable_edit) -{ - // Don't enable anything if this is a read only database - bool edit = enable_edit && !db.readOnly(); - - // Apply settings - ui->dataTable->setEditTriggers(edit ? QAbstractItemView::SelectedClicked | QAbstractItemView::AnyKeyPressed | QAbstractItemView::EditKeyPressed : QAbstractItemView::NoEditTriggers); - updateInsertDeleteRecordButton(); -} - -void MainWindow::browseTableHeaderClicked(int logicalindex) -{ - BrowseDataTableSettings& settings = browseTableSettings[currentlyBrowsedTableName()]; - - // Abort if there is more than one column selected because this tells us that the user pretty sure wants to do a range selection - // instead of sorting data. But restore before the sort indicator automatically changed by Qt so it still indicates the last - // use sort action. - // This check is disabled when the Control key is pressed. This is done because we use the Control key for sorting by multiple columns and - // Qt seems to pretty much always select multiple columns when the Control key is pressed. - if(!QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) && ui->dataTable->selectionModel()->selectedColumns().count() > 1) { - applyBrowseTableSettings(settings); - return; - } - - // Get the current list of sort columns - auto& columns = settings.query.orderBy(); - - // Before sorting, first check if the Control key is pressed. If it is, we want to append this column to the list of sort columns. If it is not, - // we want to sort only by the new column. - if(QApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) - { - // Multi column sorting - - // If the column was control+clicked again, change its sort order. - // If not already in the sort order, add the column as a new sort column to the list. - bool present = false; - for(sqlb::SortedColumn& sortedCol : columns) { - - if(sortedCol.column == static_cast(logicalindex)) { - sortedCol.direction = (sortedCol.direction == sqlb::Ascending ? sqlb::Descending : sqlb::Ascending); - present = true; - break; - } - } - if(!present) - columns.emplace_back(logicalindex, sqlb::Ascending); - } else { - // Single column sorting - - // If we have exactly one sort column and it is the column which was just clicked, change its sort order. - // If not, clear the list of sorting columns and replace it by a single new sort column. - if(columns.size() == 1 && columns.front().column == static_cast(logicalindex)) - { - columns.front().direction = (columns.front().direction == sqlb::Ascending ? sqlb::Descending : sqlb::Ascending); - } else { - columns.clear(); - columns.emplace_back(logicalindex, sqlb::Ascending); - } - } - - // Do the actual sorting - ui->dataTable->sortByColumns(columns); - - // select the first item in the column so the header is bold - // we might try to select the last selected item - ui->dataTable->setCurrentIndex(ui->dataTable->currentIndex().sibling(0, logicalindex)); - - attachPlot(ui->dataTable, m_browseTableModel, &browseTableSettings[currentlyBrowsedTableName()]); - - // Reapply the view settings. This seems to be necessary as a workaround for newer Qt versions. - applyBrowseTableSettings(settings); - - isProjectModified = true; -} - void MainWindow::resizeEvent(QResizeEvent*) { - setRecordsetLabel(); + ui->tableBrowser->updateRecordsetLabel(); } void MainWindow::loadPragmas() @@ -2234,12 +1831,12 @@ bool MainWindow::askSaveSqlTab(int index, bool& ignoreUnattachedBuffers) // Once the project is saved, remaining SQL tabs will not be modified, so this is only expected to be asked once. QString message = currentProjectFilename.isEmpty() ? tr("Do you want to save the changes made to SQL tabs in a new project file?") : - tr("Do you want to save the changes made to SQL tabs in the project file %1?"). + tr("Do you want to save the changes made to SQL tabs in the project file '%1'?"). arg(QFileInfo(currentProjectFilename).fileName()); QMessageBox::StandardButton reply = QMessageBox::question(nullptr, QApplication::applicationName(), message, - QMessageBox::Save | QMessageBox::No | QMessageBox::Cancel); + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); switch(reply) { case QMessageBox::Save: saveProject(); @@ -2256,7 +1853,7 @@ bool MainWindow::askSaveSqlTab(int index, bool& ignoreUnattachedBuffers) QApplication::applicationName(), tr("Do you want to save the changes made to the SQL file %1?"). arg(QFileInfo(sqlExecArea->fileName()).fileName()), - QMessageBox::Save | QMessageBox::No | QMessageBox::Cancel); + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); switch(reply) { case QMessageBox::Save: saveSqlFile(index); @@ -2273,10 +1870,6 @@ bool MainWindow::askSaveSqlTab(int index, bool& ignoreUnattachedBuffers) void MainWindow::closeSqlTab(int index, bool force) { - // Don't close last tab - if(ui->tabSqlAreas->count() == 1 && !force) - return; - // Check if we're still executing statements from this tab and stop them before proceeding if(!ui->tabSqlAreas->tabIcon(index).isNull()) { @@ -2298,6 +1891,15 @@ void MainWindow::closeSqlTab(int index, bool force) QWidget* w = ui->tabSqlAreas->widget(index); ui->tabSqlAreas->removeTab(index); delete w; + + // Don't let an empty tab widget + if(ui->tabSqlAreas->count() == 0 && !force) + openSqlTab(true); + + // Set focus to the currently selected editor tab. + SqlExecutionArea* sqlarea = qobject_cast(ui->tabSqlAreas->currentWidget()); + if(sqlarea) + sqlarea->getEditor()->setFocus(); } int MainWindow::openSqlTab(bool resetCounter) @@ -2316,11 +1918,11 @@ int MainWindow::openSqlTab(bool resetCounter) // would interfere with the search bar and it'd be anyway redundant. w->getEditor()->setEnabledFindDialog(false); w->getEditor()->setFocus(); - connect(w, SIGNAL(findFrameVisibilityChanged(bool)), ui->actionSqlFind, SLOT(setChecked(bool))); + connect(w, &SqlExecutionArea::findFrameVisibilityChanged, ui->actionSqlFind, &QAction::setChecked); // Connect now the find shortcut to the editor with widget context, so it isn't ambiguous with other Scintilla Widgets. QShortcut* shortcutFind = new QShortcut(ui->actionSqlFind->shortcut(), w->getEditor(), nullptr, nullptr, Qt::WidgetShortcut); - connect(shortcutFind, SIGNAL(activated()), ui->actionSqlFind, SLOT(toggle())); + connect(shortcutFind, &QShortcut::activated, ui->actionSqlFind, &QAction::toggle); return index; } @@ -2453,7 +2055,7 @@ void MainWindow::loadExtension() void MainWindow::reloadSettings() { // Set data browser font - ui->dataTable->reloadSettings(); + ui->tableBrowser->reloadSettings(); switch (static_cast(Settings::getValue("General", "appStyle").toInt())) { case Settings::FollowDesktopStyle : @@ -2475,11 +2077,9 @@ void MainWindow::reloadSettings() setToolButtonStyle(static_cast(Settings::getValue("General", "toolbarStyle").toInt())); ui->dbToolbar->setToolButtonStyle(static_cast(Settings::getValue("General", "toolbarStyleStructure").toInt())); - ui->browseToolbar->setToolButtonStyle(static_cast(Settings::getValue("General", "toolbarStyleBrowse").toInt())); ui->toolbarSql->setToolButtonStyle(static_cast(Settings::getValue("General", "toolbarStyleSql").toInt())); // Set prefetch sizes for lazy population of table models - m_browseTableModel->setChunkSize(static_cast(Settings::getValue("db", "prefetchsize").toUInt())); for(int i=0;itabSqlAreas->count();++i) qobject_cast(ui->tabSqlAreas->widget(i))->reloadSettings(); @@ -2575,13 +2175,13 @@ void MainWindow::checkNewVersion(const QString& versionstring, const QString& ur } } -void MainWindow::on_actionWiki_triggered() +void MainWindow::on_actionWiki_triggered() const { QDesktopServices::openUrl(QUrl("https://github.com/sqlitebrowser/sqlitebrowser/wiki")); } // 'Help | Bug Report...' link will set an appropiate body, add the system information and set the label 'bug' automatically to the issue -void MainWindow::on_actionBug_report_triggered() +void MainWindow::on_actionBug_report_triggered() const { const QString version = Application::versionString(); const QString os = QSysInfo::prettyProductName(); @@ -2620,7 +2220,7 @@ void MainWindow::on_actionBug_report_triggered() } // 'Help | Feature Request...' link will set an appropiate body and add the label 'enhancement' automatically to the issue -void MainWindow::on_actionFeature_Request_triggered() +void MainWindow::on_actionFeature_Request_triggered() const { QUrlQuery query; @@ -2634,45 +2234,50 @@ void MainWindow::on_actionFeature_Request_triggered() QDesktopServices::openUrl(url); } -void MainWindow::on_actionSqlCipherFaq_triggered() +void MainWindow::on_actionSqlCipherFaq_triggered() const { QDesktopServices::openUrl(QUrl("https://discuss.zetetic.net/c/sqlcipher/sqlcipher-faq")); } -void MainWindow::on_actionWebsite_triggered() +void MainWindow::on_actionWebsite_triggered() const { QDesktopServices::openUrl(QUrl("https://sqlitebrowser.org")); } -void MainWindow::on_actionDonatePatreon_triggered() +void MainWindow::on_actionDonatePatreon_triggered() const { QDesktopServices::openUrl(QUrl("https://www.patreon.com/bePatron?u=11578749")); } -void MainWindow::updateBrowseDataColumnWidth(int section, int /*old_size*/, int new_size) +static void loadCondFormatMap(BrowseDataTableSettings::CondFormatMap& condFormats, QXmlStreamReader& xml, const QString& encoding) { - std::unordered_set selectedCols = ui->dataTable->selectedCols(); - sqlb::ObjectIdentifier tableName = currentlyBrowsedTableName(); + const QStringRef name = xml.name(); - if (selectedCols.find(section) == selectedCols.end()) - { - if (browseTableSettings[tableName].columnWidths[section] != new_size) { - isProjectModified = true; - browseTableSettings[tableName].columnWidths[section] = new_size; - } - } - else - { - ui->dataTable->blockSignals(true); - for(int col : selectedCols) - { - ui->dataTable->setColumnWidth(col, new_size); - if (browseTableSettings[tableName].columnWidths[col] != new_size) { - isProjectModified = true; - browseTableSettings[tableName].columnWidths[col] = new_size; + while(xml.readNext() != QXmlStreamReader::EndElement && xml.name() != name) { + if (xml.name() == "column") { + size_t index = xml.attributes().value("index").toUInt(); + while(xml.readNext() != QXmlStreamReader::EndElement && xml.name() != "column") { + if(xml.name() == "format") { + QFont font; + if (xml.attributes().hasAttribute("font")) + font.fromString(xml.attributes().value("font").toString()); + else + Settings::getValue("databrowser", "font").toString(); + + CondFormat::Alignment align; + if (xml.attributes().hasAttribute("align")) + align = static_cast(xml.attributes().value("align").toInt()); + else + align = CondFormat::AlignLeft; + + condFormats[index].emplace_back(xml.attributes().value("condition").toString(), + QColor(xml.attributes().value("foreground").toString()), + QColor(xml.attributes().value("background").toString()), + font, align, encoding); + xml.skipCurrentElement(); + } } } - ui->dataTable->blockSignals(false); } } @@ -2721,20 +2326,9 @@ static void loadBrowseDataTableSettings(BrowseDataTableSettings& settings, QXmlS } } } else if(xml.name() == "conditional_formats") { - while(xml.readNext() != QXmlStreamReader::EndElement && xml.name() != "conditional_formats") { - if (xml.name() == "column") { - int index = xml.attributes().value("index").toInt(); - while(xml.readNext() != QXmlStreamReader::EndElement && xml.name() != "column") { - if(xml.name() == "format") { - settings.condFormats[index].emplace_back(xml.attributes().value("condition").toString(), - QColor(xml.attributes().value("foreground").toString()), - QColor(xml.attributes().value("background").toString()), - settings.encoding); - xml.skipCurrentElement(); - } - } - } - } + loadCondFormatMap(settings.condFormats, xml, settings.encoding); + } else if(xml.name() == "row_id_formats") { + loadCondFormatMap(settings.rowIdFormats, xml, settings.encoding); } else if(xml.name() == "display_formats") { while(xml.readNext() != QXmlStreamReader::EndElement && xml.name() != "display_formats") { if (xml.name() == "column") { @@ -2765,6 +2359,16 @@ static void loadBrowseDataTableSettings(BrowseDataTableSettings& settings, QXmlS } settings.plotYAxes[yAxisName] = yAxisSettings; } + } else if(xml.name() == "global_filter") { + while(xml.readNext() != QXmlStreamReader::EndElement && xml.name() != "global_filter") + { + if(xml.name() == "filter") + { + QString value = xml.attributes().value("value").toString(); + settings.globalFilters.push_back(value); + xml.skipCurrentElement(); + } + } } } } @@ -2791,9 +2395,15 @@ bool MainWindow::loadProject(QString filename, bool readOnly) if(xml.name() != "sqlb_project") return false; - isProjectModified = false; - addToRecentFilesMenu(filename); + // We are going to open a new project, so close the possible current one before opening another. + // Stop the opening process here if the user pressed the cancel button in there. + if(!closeProject()) + return false; + addToRecentFilesMenu(filename, readOnly); + currentProjectFilename = filename; + + QString currentTable; while(!xml.atEnd() && !xml.hasError()) { // Read next token @@ -2885,11 +2495,11 @@ bool MainWindow::loadProject(QString filename, bool readOnly) if(xml.name() == "current_table") { // Currently selected table - ui->comboBrowseTable->setCurrentIndex(ui->comboBrowseTable->findText(xml.attributes().value("name").toString())); + currentTable = xml.attributes().value("name").toString(); xml.skipCurrentElement(); } else if(xml.name() == "default_encoding") { // Default text encoding - defaultBrowseTableEncoding = xml.attributes().value("codec").toString(); + ui->tableBrowser->setDefaultEncoding(xml.attributes().value("codec").toString()); xml.skipCurrentElement(); } else if(xml.name() == "browsetable_info") { // This tag is only found in old project files. In newer versions (>= 3.11) it is replaced by a new implementation. @@ -2914,7 +2524,11 @@ bool MainWindow::loadProject(QString filename, bool readOnly) QString attrData = xml.attributes().value("data").toString(); QByteArray temp = QByteArray::fromBase64(attrData.toUtf8()); QDataStream stream(temp); - stream >> browseTableSettings; + QMap settings; + stream >> settings; + for(auto it=settings.begin();it!=settings.end();++it) + ui->tableBrowser->setSettings(it.key(), it.value()); + xml.skipCurrentElement(); } else if(xml.name() == "browse_table_settings") { @@ -2926,21 +2540,11 @@ bool MainWindow::loadProject(QString filename, bool readOnly) xml.attributes().value("name").toString().toStdString()); BrowseDataTableSettings settings; loadBrowseDataTableSettings(settings, xml); - browseTableSettings[tableIdentifier] = settings; + ui->tableBrowser->setSettings(tableIdentifier, settings); } } } - if(ui->mainTab->currentWidget() == ui->browser) - { - populateTable(); // Refresh view - sqlb::ObjectIdentifier current_table = currentlyBrowsedTableName(); - - ui->dataTable->sortByColumns(browseTableSettings[current_table].query.orderBy()); - showRowidColumn(browseTableSettings[current_table].showRowid); - unlockViewEditing(!browseTableSettings[current_table].unlockViewPk.isEmpty(), browseTableSettings[current_table].unlockViewPk); - } - } } else if(xml.name() == "tab_sql") { // Close all open tabs first @@ -2969,7 +2573,34 @@ bool MainWindow::loadProject(QString filename, bool readOnly) } file.close(); - currentProjectFilename = filename; + + if(ui->mainTab->currentWidget() == ui->browser) { + if (!currentTable.isEmpty()) + { + sqlb::ObjectIdentifier obj; + if(!obj.fromSerialised(currentTable.toStdString())) + { + // This is an old project file format which doesn't yet contain serialised table identifiers. This means + // we have to try our best to unserialise this one manually. The only problem is when the name of an + // attached database or of a table contains a dot character. In that case the name becomes ambigious and + // we just try to split it at the first dot. I don't think it affects many (if any) project files. But if + // it turn out to be wrong, we can always add a loop here which checks for any possible combination of schema + // and table name whether an object with that combination exists. + // TODO: Delete this code in the future when we don't expect there to be any project files in the old format anymore. + if(currentTable.contains('.')) + { + obj.setSchema(currentTable.left(currentTable.indexOf('.')).toStdString()); + obj.setName(currentTable.mid(currentTable.indexOf('.')+1).toStdString()); + } else { + obj.setName(currentTable.toStdString()); + } + } + switchToBrowseDataTab(obj); + } + populateTable(); // Refresh view + } + + isProjectModified = false; return !xml.hasError(); } else { @@ -2994,6 +2625,26 @@ static void saveDbTreeState(const QTreeView* tree, QXmlStreamWriter& xml, QModel } } +static void saveCondFormatMap(const QString& elementName, const BrowseDataTableSettings::CondFormatMap& condFormats, QXmlStreamWriter& xml) +{ + xml.writeStartElement(elementName); + for(auto iter=condFormats.constBegin(); iter!=condFormats.constEnd(); ++iter) { + xml.writeStartElement("column"); + xml.writeAttribute("index", QString::number(iter.key())); + for(auto format : iter.value()) { + xml.writeStartElement("format"); + xml.writeAttribute("condition", format.filter()); + xml.writeAttribute("background", format.backgroundColor().name()); + xml.writeAttribute("foreground", format.foregroundColor().name()); + xml.writeAttribute("font", format.font().toString()); + xml.writeAttribute("align", QString().setNum(format.alignment())); + xml.writeEndElement(); + } + xml.writeEndElement(); + } + xml.writeEndElement(); +} + static void saveBrowseDataTableSettings(const BrowseDataTableSettings& object, QXmlStreamWriter& xml) { xml.writeAttribute("show_row_id", QString::number(object.showRowid)); @@ -3027,20 +2678,8 @@ static void saveBrowseDataTableSettings(const BrowseDataTableSettings& object, Q xml.writeEndElement(); } xml.writeEndElement(); - xml.writeStartElement("conditional_formats"); - for(auto iter=object.condFormats.constBegin(); iter!=object.condFormats.constEnd(); ++iter) { - xml.writeStartElement("column"); - xml.writeAttribute("index", QString::number(iter.key())); - for(auto format : iter.value()) { - xml.writeStartElement("format"); - xml.writeAttribute("condition", format.filter()); - xml.writeAttribute("background", format.backgroundColor().name()); - xml.writeAttribute("foreground", format.foregroundColor().name()); - xml.writeEndElement(); - } - xml.writeEndElement(); - } - xml.writeEndElement(); + saveCondFormatMap("conditional_formats", object.condFormats, xml); + saveCondFormatMap("row_id_formats", object.rowIdFormats, xml); xml.writeStartElement("display_formats"); for(auto iter=object.displayFormats.constBegin(); iter!=object.displayFormats.constEnd(); ++iter) { xml.writeStartElement("column"); @@ -3069,9 +2708,17 @@ static void saveBrowseDataTableSettings(const BrowseDataTableSettings& object, Q xml.writeEndElement(); } xml.writeEndElement(); + xml.writeStartElement("global_filter"); + for(const auto& v : object.globalFilters) + { + xml.writeStartElement("filter"); + xml.writeAttribute("value", v); + xml.writeEndElement(); + } + xml.writeEndElement(); } -QString MainWindow::saveProject(const QString& currentFilename) +void MainWindow::saveProject(const QString& currentFilename) { QString filename; if(currentFilename.isEmpty()) { @@ -3098,8 +2745,10 @@ QString MainWindow::saveProject(const QString& currentFilename) if(!opened) { QMessageBox::warning(this, qApp->applicationName(), tr("Could not open project file for writing.\nReason: %1").arg(file.errorString())); - return QString(); + currentProjectFilename.clear(); + return; } + currentProjectFilename = filename; QApplication::setOverrideCursor(Qt::WaitCursor); QXmlStreamWriter xml(&file); @@ -3119,25 +2768,18 @@ QString MainWindow::saveProject(const QString& currentFilename) // Attached databases xml.writeStartElement("attached"); - QString sql("PRAGMA database_list;"); - db.logSQL(sql, kLogMsg_App); - sqlite3_stmt* db_vm; - if(sqlite3_prepare_v2(db.get("project").get(), sql.toUtf8(), sql.toUtf8().length(), &db_vm, nullptr) == SQLITE_OK) - { - while(sqlite3_step(db_vm) == SQLITE_ROW) + db.executeSQL("PRAGMA database_list;", false, true, [&xml](int, std::vector values, std::vector) -> bool { + auto schema = values.at(1); + if(schema != "main" && schema != "temp") { - QString schema(QString::fromUtf8(reinterpret_cast(sqlite3_column_text(db_vm, 1)))); - if(schema != "main" && schema != "temp") - { - QString path(QString::fromUtf8(reinterpret_cast(sqlite3_column_text(db_vm, 2)))); - xml.writeStartElement("db"); - xml.writeAttribute("schema", schema); - xml.writeAttribute("path", path); - xml.writeEndElement(); - } + auto path = values.at(2); + xml.writeStartElement("db"); + xml.writeAttribute("schema", schema); + xml.writeAttribute("path", path); + xml.writeEndElement(); } - sqlite3_finalize(db_vm); - } + return false; + }); xml.writeEndElement(); // Window settings @@ -3163,14 +2805,15 @@ QString MainWindow::saveProject(const QString& currentFilename) // Browse Data tab settings xml.writeStartElement("tab_browse"); xml.writeStartElement("current_table"); // Currently selected table - xml.writeAttribute("name", ui->comboBrowseTable->currentText()); + xml.writeAttribute("name", QString::fromStdString(ui->tableBrowser->currentlyBrowsedTableName().toSerialised())); xml.writeEndElement(); xml.writeStartElement("default_encoding"); // Default encoding for text stored in tables - xml.writeAttribute("codec", defaultBrowseTableEncoding); + xml.writeAttribute("codec", ui->tableBrowser->defaultEncoding()); xml.writeEndElement(); xml.writeStartElement("browse_table_settings"); - for(auto tableIt=browseTableSettings.constBegin(); tableIt!=browseTableSettings.constEnd(); ++tableIt) { + const auto settings = ui->tableBrowser->allSettings(); + for(auto tableIt=settings.constBegin(); tableIt!=settings.constEnd(); ++tableIt) { xml.writeStartElement("table"); xml.writeAttribute("schema", QString::fromStdString(tableIt.key().schema())); @@ -3204,30 +2847,37 @@ QString MainWindow::saveProject(const QString& currentFilename) file.close(); addToRecentFilesMenu(filename); + setCurrentFile(db.currentFile()); isProjectModified = false; + showStatusMessage5s(tr("Project saved to file '%1'").arg(currentProjectFilename)); QApplication::restoreOverrideCursor(); } - return filename; } void MainWindow::saveProject() { - currentProjectFilename = saveProject(currentProjectFilename); + saveProject(currentProjectFilename); } void MainWindow::saveProjectAs() { - currentProjectFilename = saveProject(QString()); + saveProject(QString()); } -void MainWindow::fileAttach() +void MainWindow::fileAttach(const QString& fileName) { - // Get file name of database to attach - QString file = FileDialog::getOpenFileName( - OpenDatabaseFile, - this, - tr("Choose a database file"), - FileDialog::getSqlDatabaseFileFilter()); + QString file; + if (fileName.isEmpty()) { + + // Get file name of database to attach + file = FileDialog::getOpenFileName( + OpenDatabaseFile, + this, + tr("Choose a database file"), + FileDialog::getSqlDatabaseFileFilter()); + } else + file = fileName; + if(!QFile::exists(file)) return; @@ -3236,54 +2886,6 @@ void MainWindow::fileAttach() isProjectModified = true; } -void MainWindow::updateFilter(int column, const QString& value) -{ - m_browseTableModel->updateFilter(column, value); - BrowseDataTableSettings& settings = browseTableSettings[currentlyBrowsedTableName()]; - if(value.isEmpty()) - isProjectModified = settings.filterValues.remove(column) > 0; - else - if (settings.filterValues[column] != value) { - isProjectModified = true; - settings.filterValues[column] = value; - } - setRecordsetLabel(); - - // Reapply the view settings. This seems to be necessary as a workaround for newer Qt versions. - applyBrowseTableSettings(settings, true); -} - -void MainWindow::addCondFormat(int column, const QString& value) -{ - // Create automatically a new conditional format with the next serial background color according to the theme and the regular foreground - // color in the settings. - CondFormat newCondFormat(value, QColor(Settings::getValue("databrowser", "reg_fg_colour").toString()), - m_condFormatPalette.nextSerialColor(Palette::appHasDarkTheme()), - m_browseTableModel->encoding()); - m_browseTableModel->addCondFormat(column, newCondFormat); - browseTableSettings[currentlyBrowsedTableName()].condFormats[column].push_back(newCondFormat); -} - -void MainWindow::clearAllCondFormats(int column) -{ - std::vector emptyCondFormatVector = std::vector(); - m_browseTableModel->setCondFormats(column, emptyCondFormatVector); - browseTableSettings[currentlyBrowsedTableName()].condFormats[column].clear(); - isProjectModified = true; -} - -void MainWindow::editCondFormats(int column) -{ - CondFormatManager condFormatDialog(browseTableSettings[currentlyBrowsedTableName()].condFormats[column], - m_browseTableModel->encoding(), this); - if (condFormatDialog.exec()) { - std::vector condFormatVector = condFormatDialog.getCondFormats(); - m_browseTableModel->setCondFormats(column, condFormatVector); - browseTableSettings[currentlyBrowsedTableName()].condFormats[column] = condFormatVector; - isProjectModified = true; - } -} - void MainWindow::editEncryption() { #ifdef ENABLE_SQLCIPHER @@ -3315,17 +2917,19 @@ void MainWindow::editEncryption() // Attach a new database using the new settings qApp->processEvents(); if(ok) - ok = db.executeSQL(QString("ATTACH DATABASE '%1' AS sqlitebrowser_edit_encryption KEY %2;").arg(db.currentFile() + ".enctemp").arg(cipherSettings.getPassword()), + ok = db.executeSQL("ATTACH DATABASE '" + db.currentFile().toStdString() + ".enctemp' AS sqlitebrowser_edit_encryption KEY " + cipherSettings.getPassword() + ";", false, false); qApp->processEvents(); if(ok) - ok = db.executeSQL(QString("PRAGMA sqlitebrowser_edit_encryption.cipher_page_size = %1").arg(cipherSettings.getPageSize()), false, false); + ok = db.executeSQL("PRAGMA sqlitebrowser_edit_encryption.cipher_page_size = " + std::to_string(cipherSettings.getPageSize()), false, false); if(ok) - ok = db.executeSQL(QString("PRAGMA sqlitebrowser_edit_encryption.cipher_hmac_algorithm = %1").arg(cipherSettings.getHmacAlgorithm()), false, false); + ok = db.executeSQL("PRAGMA sqlitebrowser_edit_encryption.cipher_hmac_algorithm = " + cipherSettings.getHmacAlgorithm(), false, false); if(ok) - ok = db.executeSQL(QString("PRAGMA sqlitebrowser_edit_encryption.cipher_kdf_algorithm = %1").arg(cipherSettings.getKdfAlgorithm()), false, false); + ok = db.executeSQL("PRAGMA sqlitebrowser_edit_encryption.cipher_kdf_algorithm = " + cipherSettings.getKdfAlgorithm(), false, false); if(ok) - ok = db.executeSQL(QString("PRAGMA sqlitebrowser_edit_encryption.kdf_iter = %1").arg(cipherSettings.getKdfIterations()), false, false); + ok = db.executeSQL("PRAGMA sqlitebrowser_edit_encryption.kdf_iter = " + std::to_string(cipherSettings.getKdfIterations()), false, false); + if (ok) + ok = db.executeSQL("PRAGMA sqlitebrowser_edit_encryption.cipher_plaintext_header_size = " + std::to_string(cipherSettings.getPlaintextHeaderSize()), false, false); // Export the current database to the new one qApp->processEvents(); @@ -3335,7 +2939,7 @@ void MainWindow::editEncryption() // Set user version of the new database qApp->processEvents(); if (ok) - ok = db.executeSQL(QString("PRAGMA sqlitebrowser_edit_encryption.user_version = %1;").arg(db.getPragma("user_version").toInt()), false, false); + ok = db.executeSQL("PRAGMA sqlitebrowser_edit_encryption.user_version = " + std::to_string(db.getPragma("user_version").toInt()) + ";", false, false); // We need to detach the database before proceeding qApp->processEvents(); @@ -3360,7 +2964,7 @@ void MainWindow::editEncryption() #endif } -void MainWindow::switchToBrowseDataTab(QString tableToBrowse) +void MainWindow::switchToBrowseDataTab(sqlb::ObjectIdentifier tableToBrowse) { // If no table name was provided get the currently selected table fromt he structure tab if(tableToBrowse.isEmpty()) @@ -3369,22 +2973,16 @@ void MainWindow::switchToBrowseDataTab(QString tableToBrowse) if(!ui->dbTreeWidget->selectionModel()->hasSelection()) return; - sqlb::ObjectIdentifier obj(ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), DbStructureModel::ColumnSchema)).toString().toStdString(), - ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), DbStructureModel::ColumnName)).toString().toStdString()); - tableToBrowse = QString::fromStdString(obj.toDisplayString()); + tableToBrowse.setSchema(ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), DbStructureModel::ColumnSchema), Qt::EditRole).toString().toStdString()); + tableToBrowse.setName(ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), DbStructureModel::ColumnName), Qt::EditRole).toString().toStdString()); } - ui->comboBrowseTable->setCurrentIndex(ui->comboBrowseTable->findText(tableToBrowse)); + ui->tableBrowser->setCurrentTable(tableToBrowse); if (ui->mainTab->indexOf(ui->browser) == -1) ui->mainTab->addTab(ui->browser, ui->browser->accessibleName()); ui->mainTab->setCurrentWidget(ui->browser); } -void MainWindow::on_actionClearFilters_triggered() -{ - ui->dataTable->filterHeader()->clearFilters(); -} - void MainWindow::copyCurrentCreateStatement() { // Cancel if no field is currently selected @@ -3398,358 +2996,12 @@ void MainWindow::copyCurrentCreateStatement() QApplication::clipboard()->setText(stmt); } -void MainWindow::jumpToRow(const sqlb::ObjectIdentifier& table, QString column, const QByteArray& value) -{ - // First check if table exists - sqlb::TablePtr obj = db.getObjectByName(table); - if(!obj) - return; - - // If no column name is set, assume the primary key is meant - if(!column.size()) - column = QString::fromStdString(obj->primaryKey().front()); - - // If column doesn't exist don't do anything - auto column_index = sqlb::findField(obj, column.toStdString()); - if(column_index == obj->fields.end()) - return; - - // Jump to table - ui->comboBrowseTable->setCurrentIndex(ui->comboBrowseTable->findText(QString::fromStdString(table.toDisplayString()))); - populateTable(); - - // Set filter - ui->dataTable->filterHeader()->setFilter(static_cast(column_index-obj->fields.begin()+1), QString("=") + value); -} - -void MainWindow::showDataColumnPopupMenu(const QPoint& pos) -{ - // Get the index of the column which the user has clicked on and store it in the action. This is sort of hack-ish and it might be the heat in my room - // but I haven't come up with a better solution so far - int logical_index = ui->dataTable->horizontalHeader()->logicalIndexAt(pos); - if(logical_index == -1) // Don't open the popup menu if the user hasn't clicked on a column header - return; - ui->actionBrowseTableEditDisplayFormat->setProperty("clicked_column", logical_index); - - // Calculate the proper position for the context menu and display it - popupBrowseDataHeaderMenu->exec(ui->dataTable->horizontalHeader()->mapToGlobal(pos)); -} - -void MainWindow::showRecordPopupMenu(const QPoint& pos) -{ - if(!(db.getObjectByName(currentlyBrowsedTableName())->type() == sqlb::Object::Types::Table && !db.readOnly())) - return; - - int row = ui->dataTable->verticalHeader()->logicalIndexAt(pos); - if (row == -1) - return; - - // Select the row if it is not already in the selection. - QModelIndexList rowList = ui->dataTable->selectionModel()->selectedRows(); - bool found = false; - for (QModelIndex index : rowList) { - if (row == index.row()) { - found = true; - break; - } - } - if (!found) - ui->dataTable->selectRow(row); - - rowList = ui->dataTable->selectionModel()->selectedRows(); - - QString duplicateText = rowList.count() > 1 ? tr("Duplicate records") : tr("Duplicate record"); - - QMenu popupRecordMenu(this); - QAction* action = new QAction(duplicateText, &popupRecordMenu); - // Set shortcut for documentation purposes (the actual functional shortcut is not set here) - action->setShortcut(QKeySequence(tr("Ctrl+\""))); - popupRecordMenu.addAction(action); - - connect(action, &QAction::triggered, [&]() { - for (QModelIndex index : rowList) { - duplicateRecord(index.row()); - } - }); - - QAction* deleteRecordAction = new QAction(QIcon(":icons/delete_record"), ui->actionDeleteRecord->text(), &popupRecordMenu); - popupRecordMenu.addAction(deleteRecordAction); - - connect(deleteRecordAction, &QAction::triggered, [&]() { - deleteRecord(); - }); - - popupRecordMenu.exec(ui->dataTable->verticalHeader()->mapToGlobal(pos)); -} - -void MainWindow::editDataColumnDisplayFormat() -{ - // Get the current table name and fetch its table object, then retrieve the fields of that table and look up the index of the clicked table header - // section using it as the table field array index. Subtract one from the header index to get the column index because in the the first (though hidden) - // column is always the rowid column. Ultimately, get the column name from the column object - sqlb::ObjectIdentifier current_table = currentlyBrowsedTableName(); - int field_number = sender()->property("clicked_column").toInt(); - QString field_name; - if (db.getObjectByName(current_table)->type() == sqlb::Object::Table) - field_name = QString::fromStdString(db.getObjectByName(current_table)->fields.at(static_cast(field_number)-1).name()); - else - field_name = QString::fromStdString(db.getObjectByName(current_table)->fieldNames().at(static_cast(field_number)-1)); - // Get the current display format of the field - QString current_displayformat = browseTableSettings[current_table].displayFormats[field_number]; - - // Open the dialog - ColumnDisplayFormatDialog dialog(db, current_table, field_name, current_displayformat, this); - if(dialog.exec()) - { - // Set the newly selected display format - QString new_format = dialog.selectedDisplayFormat(); - if(new_format.size()) - browseTableSettings[current_table].displayFormats[field_number] = new_format; - else - browseTableSettings[current_table].displayFormats.remove(field_number); - isProjectModified = true; - - // Refresh view - populateTable(); - } -} - -void MainWindow::showRowidColumn(bool show, bool skipFilters) -{ - // Block all signals from the horizontal header. Otherwise the QHeaderView::sectionResized signal causes us trouble - ui->dataTable->horizontalHeader()->blockSignals(true); - - // WORKAROUND - // Set the opposite hidden/visible status of what we actually want for the rowid column. This is to work around a Qt bug which - // is present in at least version 5.7.1. The problem is this: when you browse a table/view with n colums, then switch to a table/view - // with less than n columns, you'll be able to resize the first (hidden!) column by resizing the section to the left of the first visible - // column. By doing so the table view gets messed up. But even when not resizing the first hidden column, tab-ing through the fields - // will stop at the not-so-much-hidden rowid column, too. All this can be fixed by this line. I haven't managed to find another workaround - // or way to fix this yet. - ui->dataTable->setColumnHidden(0, show); - - // Show/hide rowid column - ui->dataTable->setColumnHidden(0, !show); - - // Update checked status of the popup menu action - ui->actionShowRowidColumn->setChecked(show); - - // Save settings for this table - sqlb::ObjectIdentifier current_table = currentlyBrowsedTableName(); - if (browseTableSettings[current_table].showRowid != show) { - isProjectModified = true; - browseTableSettings[current_table].showRowid = show; - } - - // Update the filter row - if(!skipFilters) - qobject_cast(ui->dataTable->horizontalHeader())->generateFilters(static_cast(m_browseTableModel->columnCount()), show); - - // Re-enable signals - ui->dataTable->horizontalHeader()->blockSignals(false); - - ui->dataTable->update(); -} - -void MainWindow::browseDataSetTableEncoding(bool forAllTables) -{ - // Get the old encoding - QString encoding = m_browseTableModel->encoding(); - - // Ask the user for a new encoding - bool ok; - QString question; - QStringList availableCodecs = toStringList(QTextCodec::availableCodecs()); - availableCodecs.removeDuplicates(); - int currentItem = availableCodecs.indexOf(encoding); - - if(forAllTables) - question = tr("Please choose a new encoding for all tables."); - else - question = tr("Please choose a new encoding for this table."); - encoding = QInputDialog::getItem(this, - tr("Set encoding"), - tr("%1\nLeave the field empty for using the database encoding.").arg(question), - availableCodecs, - currentItem, - true, // editable - &ok); - - // Only set the new encoding if the user clicked the OK button - if(ok) - { - // Check if encoding is valid - if(!encoding.isEmpty() && !QTextCodec::codecForName(encoding.toUtf8())) - { - QMessageBox::warning(this, qApp->applicationName(), tr("This encoding is either not valid or not supported.")); - return; - } - - // Set encoding for current table - m_browseTableModel->setEncoding(encoding); - - // Save encoding for this table - browseTableSettings[currentlyBrowsedTableName()].encoding = encoding; - - // Set default encoding if requested to and change all stored table encodings - if(forAllTables) - { - defaultBrowseTableEncoding = encoding; - - for(auto it=browseTableSettings.begin();it!=browseTableSettings.end();++it) - it.value().encoding = encoding; - } - isProjectModified = true; - } -} - -void MainWindow::browseDataSetDefaultTableEncoding() -{ - browseDataSetTableEncoding(true); -} - void MainWindow::fileOpenReadOnly() { // Redirect to 'standard' fileOpen(), with the read only flag set fileOpen(QString(), false, true); } -void MainWindow::unlockViewEditing(bool unlock, QString pk) -{ - sqlb::ObjectIdentifier currentTable = currentlyBrowsedTableName(); - - if(currentTable.isEmpty()) - return; - - // If this isn't a view just unlock editing and return - if(db.getObjectByName(currentTable) && db.getObjectByName(currentTable)->type() != sqlb::Object::View) - { - m_browseTableModel->setPseudoPk(m_browseTableModel->pseudoPk()); - enableEditing(true); - return; - } - - sqlb::ViewPtr obj = db.getObjectByName(currentTable); - - // If the view gets unlocked for editing and we don't have a 'primary key' for this view yet, then ask for one - if(unlock && pk.isEmpty()) - { - while(true) - { - bool ok; - - QStringList options; - for(const auto& n : obj->fieldNames()) - options.push_back(QString::fromStdString(n)); - - // Ask for a PK - pk = QInputDialog::getItem(this, - qApp->applicationName(), - tr("Please enter a pseudo-primary key in order to enable editing on this view. " - "This should be the name of a unique column in the view."), - options, - 0, - false, - &ok); - - // Cancelled? - if(!ok || pk.isEmpty()) { - ui->actionUnlockViewEditing->setChecked(false); - return; - } - - // Do some basic testing of the input and if the input appears to be good, go on - if(db.executeSQL(QString("SELECT %1 FROM %2 LIMIT 1;").arg(sqlb::escapeIdentifier(pk)).arg(QString::fromStdString(currentTable.toString())), false, true)) - break; - } - } else if(!unlock) { - // Locking the view is done by unsetting the pseudo-primary key - pk.clear(); - } - - // (De)activate editing - enableEditing(unlock); - m_browseTableModel->setPseudoPk({pk.toStdString()}); - - // Update checked status of the popup menu action - ui->actionUnlockViewEditing->blockSignals(true); - ui->actionUnlockViewEditing->setChecked(unlock); - ui->actionUnlockViewEditing->blockSignals(false); - - // If the settings didn't change, do not try to reapply them. - // This avoids an infinite mutual recursion. - BrowseDataTableSettings& settings = browseTableSettings[currentTable]; - - if(settings.unlockViewPk != pk) { - // Save settings for this table - settings.unlockViewPk = pk; - // Reapply the view settings. This seems to be necessary as a workaround for newer Qt versions. - applyBrowseTableSettings(settings); - isProjectModified = true; - } -} - -sqlb::ObjectIdentifier MainWindow::currentlyBrowsedTableName() const -{ - return sqlb::ObjectIdentifier(ui->comboBrowseTable->model()->data(dbStructureModel->index(ui->comboBrowseTable->currentIndex(), - DbStructureModel::ColumnSchema, - ui->comboBrowseTable->rootModelIndex())).toString().toStdString(), - ui->comboBrowseTable->currentData(Qt::EditRole).toString().toStdString()); // Use the edit role here to make sure we actually get the - // table name without the schema bit in front of it. -} - -void MainWindow::hideColumns(int column, bool hide) -{ - sqlb::ObjectIdentifier tableName = currentlyBrowsedTableName(); - - // Select columns to (un)hide - std::unordered_set columns; - if(column == -1) - { - if(ui->dataTable->selectedCols().size() == 0) - columns.insert(ui->actionBrowseTableEditDisplayFormat->property("clicked_column").toInt()); - else { - auto cols = ui->dataTable->selectedCols(); - columns.insert(cols.begin(), cols.end()); - } - } else { - columns.insert(column); - } - - // (Un)hide requested column(s) - for(int col : columns) - { - ui->dataTable->setColumnHidden(col, hide); - if(!hide) - ui->dataTable->setColumnWidth(col, ui->dataTable->horizontalHeader()->defaultSectionSize()); - browseTableSettings[tableName].hiddenColumns[col] = hide; - } - - // check to see if all the columns are hidden - bool allHidden = true; - for(int col = 1; col < ui->dataTable->model()->columnCount(); col++) - { - if(!ui->dataTable->isColumnHidden(col)) - { - allHidden = false; - break; - } - } - - if(allHidden && ui->dataTable->model()->columnCount() > 1) - hideColumns(1, false); - isProjectModified = true; -} - -void MainWindow::on_actionShowAllColumns_triggered() -{ - for(int col = 1; col < ui->dataTable->model()->columnCount(); col++) - { - if(ui->dataTable->isColumnHidden(col)) - hideColumns(col, false); - } -} - void MainWindow::requestCollation(const QString& name, int eTextRep) { QMessageBox::StandardButton reply = QMessageBox::question( @@ -3815,7 +3067,7 @@ void MainWindow::openSqlPrintDialog() sqlWidget->getEditor()->openPrintDialog(); } -void MainWindow::saveAsView(QString query) +void MainWindow::saveAsView(const std::string& query) { // Let the user select a name for the new view and make sure it doesn't already exist QString name; @@ -3831,67 +3083,12 @@ void MainWindow::saveAsView(QString query) } // Create the view - if(db.executeSQL(QString("CREATE VIEW %1 AS %2;").arg(sqlb::escapeIdentifier(name)).arg(query))) + if(db.executeSQL("CREATE VIEW " + sqlb::escapeIdentifier(name.toStdString()) + " AS " + query + ";")) QMessageBox::information(this, qApp->applicationName(), tr("View successfully created.")); else QMessageBox::warning(this, qApp->applicationName(), tr("Error creating view: %1").arg(db.lastError())); } -void MainWindow::exportFilteredTable() -{ - ExportDataDialog dialog(db, ExportDataDialog::ExportFormatCsv, this, m_browseTableModel->customQuery(false)); - dialog.exec(); -} - -void MainWindow::saveFilterAsView() -{ - if (m_browseTableModel->filterCount() > 0) - // Save as view a custom query without rowid - saveAsView(m_browseTableModel->customQuery(false)); - else - QMessageBox::information(this, qApp->applicationName(), tr("There is no filter set for this table. View will not be created.")); -} - -void MainWindow::duplicateRecord(int currentRow) -{ - auto row = m_browseTableModel->dittoRecord(currentRow); - if (row.isValid()) - ui->dataTable->setCurrentIndex(row); - else - QMessageBox::warning(this, qApp->applicationName(), db.lastError()); -} - -void MainWindow::updateInsertDeleteRecordButton() -{ - // Update the delete record button to reflect number of selected records - - // NOTE: We're assuming here that the selection is always contiguous, i.e. that there are never two selected - // rows with a non-selected row in between. - int rows = 0; - - // If there is no model yet (because e.g. no database file is opened) there is no selection model either. So we need to check for that here - // in order to avoid null pointer dereferences. If no selection model exists we will just continue as if no row is selected because without a - // model you could argue there actually is no row to be selected. - if(ui->dataTable->selectionModel()) - { - const auto & sel = ui->dataTable->selectionModel()->selectedIndexes(); - if(sel.count()) - rows = sel.last().row() - sel.first().row() + 1; - } - - // Enable the insert and delete buttons only if the currently browsed table or view is editable. For the delete button we additionally require - // at least one row to be selected. For the insert button there is an extra rule to disable it when we are browsing a view because inserting - // into a view isn't supported yet. - bool isEditable = m_browseTableModel->isEditable() && !db.readOnly(); - ui->actionNewRecord->setEnabled(isEditable); - ui->actionDeleteRecord->setEnabled(isEditable && rows != 0); - - if(rows > 1) - ui->actionDeleteRecord->setText(tr("Delete Records")); - else - ui->actionDeleteRecord->setText(tr("Delete Record")); -} - void MainWindow::runSqlNewTab(const QString& query, const QString& title) { QString message = tr("This action will open a new SQL tab for running:") + @@ -3991,21 +3188,19 @@ void MainWindow::printDbStructure () } out << ""; - QTextDocument *document = new QTextDocument(); - document->setHtml(strStream); - QPrinter printer; printer.setDocName(treeView->windowTitle()); QPrintPreviewDialog *dialog = new QPrintPreviewDialog(&printer); - connect(dialog, &QPrintPreviewDialog::paintRequested, [&](QPrinter *previewPrinter) { - document->print(previewPrinter); + connect(dialog, &QPrintPreviewDialog::paintRequested, [strStream](QPrinter *previewPrinter) { + QTextDocument document; + document.setHtml(strStream); + document.print(previewPrinter); }); dialog->exec(); - delete dialog; - delete document; + } void MainWindow::updateDatabaseBusyStatus(bool busy, const QString& user) @@ -4041,7 +3236,7 @@ void MainWindow::restoreOpenTabs(QString tabs) // Avoid flickering while clearing and adding tabs. ui->mainTab->setUpdatesEnabled(false); ui->mainTab->clear(); - for (QString objectName : tabList) { + for (const auto& objectName : tabList) { for (QWidget* widget : {ui->structure, ui->browser, ui->pragmas, ui->query}) if (widget->objectName() == objectName) { ui->mainTab->addTab(widget, widget->accessibleName()); @@ -4051,7 +3246,7 @@ void MainWindow::restoreOpenTabs(QString tabs) ui->mainTab->setUpdatesEnabled(true); // Force the update of the View menu toggable entries // (it doesn't seem to be a better way) - ui->mainTab->tabCloseRequested(-1); + emit ui->mainTab->tabCloseRequested(-1); } } @@ -4081,3 +3276,75 @@ void MainWindow::saveAll() fileSave(); } + +void MainWindow::showContextMenuSqlTabBar(const QPoint& pos) +{ + // Don't show context menu if the mouse click was outside of all the tabs + int tab = ui->tabSqlAreas->tabBar()->tabAt(pos); + if(tab == -1) + return; + + // Prepare all menu actions + QAction* actionRename = new QAction(this); + actionRename->setText(tr("Rename Tab")); + connect(actionRename, &QAction::triggered, [this, tab]() { + renameSqlTab(tab); + }); + + QAction* actionDuplicate = new QAction(this); + actionDuplicate->setText(tr("Duplicate Tab")); + connect(actionDuplicate, &QAction::triggered, [this, tab]() { + QString tab_name = ui->tabSqlAreas->tabText(tab).remove("&").remove(QRegExp(" \\(\\d+\\)$")); + QString new_tab_name; + for(int i=1;;i++) + { + new_tab_name = tab_name + QString(" (%1)").arg(i); + bool name_already_exists = false; + for(int j=0;jtabSqlAreas->count();j++) + { + if(ui->tabSqlAreas->tabText(j).remove("&") == new_tab_name) + { + name_already_exists = true; + break; + } + } + + if(!name_already_exists) + break; + } + + int new_tab = openSqlTab(); + ui->tabSqlAreas->setTabText(new_tab, new_tab_name); + + SqlExecutionArea* old_area = qobject_cast(ui->tabSqlAreas->widget(tab)); + SqlExecutionArea* new_area = qobject_cast(ui->tabSqlAreas->widget(new_tab)); + new_area->setSql(old_area->getSql()); + }); + + QAction* actionClose = new QAction(this); + actionClose->setText(tr("Close Tab")); + actionClose->setShortcut(tr("Ctrl+W")); + connect(actionClose, &QAction::triggered, [this, tab]() { + closeSqlTab(tab); + }); + + // Show menu + QMenu* menuTabs = new QMenu(this); + menuTabs->addAction(actionRename); + menuTabs->addAction(actionDuplicate); + menuTabs->addAction(actionClose); + menuTabs->exec(ui->tabSqlAreas->mapToGlobal(pos)); +} + +void MainWindow::openUrlOrFile(const QString& urlString) +{ + QUrl url = QUrl::fromUserInput(urlString, QFileInfo(db.currentFile()).path(), QUrl::AssumeLocalFile); + if(url.isValid()) { + if(QDesktopServices::openUrl(url)) + showStatusMessage5s(tr("Opening '%1'...").arg(url.toDisplayString())); + else + showStatusMessage5s(tr("There was an error opening '%1'...").arg(url.toDisplayString())); + + } else + showStatusMessage5s(tr("Value is not a valid URL or filename: %1").arg(url.errorString())); +} diff --git a/src/MainWindow.h b/src/MainWindow.h index d4a0bbc8..f288d3ef 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -2,26 +2,22 @@ #define MAINWINDOW_H #include "sqlitedb.h" -#include "PlotDock.h" -#include "Palette.h" -#include "CondFormat.h" -#include "sql/Query.h" #include #include -#include -class EditDialog; -class SqliteTableModel; +struct BrowseDataTableSettings; class DbStructureModel; -class RemoteDock; -class RemoteDatabase; -class FindReplaceDialog; +class EditDialog; class ExtendedTableWidget; +class FindReplaceDialog; +class PlotDock; +class RemoteDatabase; +class RemoteDock; class RunSql; +class SqliteTableModel; class QDragEnterEvent; -class QIntValidator; class QModelIndex; class QLabel; class QPersistentModelIndex; @@ -31,55 +27,6 @@ namespace Ui { class MainWindow; } -struct BrowseDataTableSettings -{ - sqlb::Query query; // NOTE: We only store the sort order in here (for now) - QMap columnWidths; - QMap filterValues; - QMap> condFormats; - QMap displayFormats; - bool showRowid; - QString encoding; - QString plotXAxis; - QMap plotYAxes; - QString unlockViewPk; - QMap hiddenColumns; - - BrowseDataTableSettings() : - showRowid(false) - { - } - - friend QDataStream& operator>>(QDataStream& stream, BrowseDataTableSettings& object) - { - int sortOrderIndex, sortOrderMode; - stream >> sortOrderIndex; - stream >> sortOrderMode; - object.query.orderBy().emplace_back(sortOrderIndex, sortOrderMode == Qt::AscendingOrder ? sqlb::Ascending : sqlb::Descending); - stream >> object.columnWidths; - stream >> object.filterValues; - stream >> object.displayFormats; - stream >> object.showRowid; - stream >> object.encoding; - - // Versions pre 3.10.0 didn't store the following information in their project files. - // To be absolutely sure that nothing strange happens when we read past the stream for - // those cases, check for the end of the stream here. - if(stream.atEnd()) - return stream; - stream >> object.plotXAxis; - stream >> object.plotYAxes; - stream >> object.unlockViewPk; - - // Project files from versions before 3.11.0 didn't have these fields - if(stream.atEnd()) - return stream; - stream >> object.hiddenColumns; - - return stream; - } -}; - class MainWindow : public QMainWindow { Q_OBJECT @@ -118,21 +65,14 @@ private: DBBrowserDB db; - /// the table model used in the "Browse Data" page (re-used and - /// re-initialized when switching to another table) - SqliteTableModel* m_browseTableModel; - SqliteTableModel* m_currentTabTableModel; QMenu* popupTableMenu; QMenu* popupSchemaDockMenu; QMenu* recentFilesMenu; QMenu* popupOpenDbMenu; - QMenu* popupNewRecordMenu; QMenu* popupSaveSqlFileMenu; QMenu* popupSaveSqlResultsMenu; - QMenu* popupSaveFilterAsMenu; - QMenu* popupBrowseDataHeaderMenu; QLabel* statusEncodingLabel; QLabel* statusEncryptionLabel; @@ -146,8 +86,6 @@ private: QAction *recentFileActs[MaxRecentFiles]; QAction *recentSeparatorAct; - QMap browseTableSettings; - RemoteDatabase* m_remoteDb; EditDialog* editDock; @@ -155,12 +93,6 @@ private: RemoteDock* remoteDock; FindReplaceDialog* findReplaceDialog; - QIntValidator* gotoValidator; - - QString defaultBrowseTableEncoding; - - Palette m_condFormatPalette; - std::unique_ptr execute_sql_worker; QString defaultOpenTabs; @@ -174,21 +106,15 @@ private: void updateRecentFileActions(); void setCurrentFile(const QString& fileName); - void addToRecentFilesMenu(const QString& filename); + void addToRecentFilesMenu(const QString& filename, bool read_only = false); void activateFields(bool enable = true); - void enableEditing(bool enable_edit); - void saveAsView(QString query); - void duplicateRecord(int currentRow); - void selectTableLine(int lineToSelect); + void saveAsView(const std::string& query); void attachPlot(ExtendedTableWidget* tableWidget, SqliteTableModel* model, BrowseDataTableSettings* settings = nullptr, bool keepOrResetSelection = true); - sqlb::ObjectIdentifier currentlyBrowsedTableName() const; - - void applyBrowseTableSettings(BrowseDataTableSettings storedData, bool skipFilters = false); void toggleTabVisible(QWidget* tabWidget, bool show); void restoreOpenTabs(QString tabs); QString saveOpenTabs(); - QString saveProject(const QString& currentFilename); + void saveProject(const QString& currentFilename); bool closeFiles(); bool closeProject(); bool askSaveSqlTab(int index, bool& ignoreUnattachedBuffers); @@ -204,12 +130,10 @@ public slots: void logSql(const QString &sql, int msgtype); void dbState(bool dirty); void refresh(); - void jumpToRow(const sqlb::ObjectIdentifier& table, QString column, const QByteArray& value); - void switchToBrowseDataTab(QString tableToBrowse = QString()); + void switchToBrowseDataTab(sqlb::ObjectIdentifier tableToBrowse = sqlb::ObjectIdentifier()); void populateStructure(const QString& old_table = QString()); void reloadSettings(); - private slots: void createTreeContextMenu(const QPoint & qPoint); void createSchemaDockContextMenu(const QPoint & qPoint); @@ -217,17 +141,7 @@ private slots: void fileNew(); void fileNewInMemoryDatabase(); void populateTable(); - void clearTableBrowser(); bool fileClose(); - void addRecord(); - void insertValues(); - void deleteRecord(); - void navigatePrevious(); - void navigateNext(); - void navigateBegin(); - void navigateEnd(); - void navigateGoto(); - void setRecordsetLabel(); void createTable(); void createIndex(); void compact(); @@ -252,7 +166,6 @@ private slots: void updatePragmaUi(); void savePragmas(); void mainTabSelected( int tabindex ); - void browseTableHeaderClicked(int logicalindex); int openSqlTab(bool resetCounter = false); void closeSqlTab(int index, bool force = false); void changeSqlTab(int index); @@ -263,43 +176,25 @@ private slots: void saveSqlResultsAsView(); void loadExtension(); void checkNewVersion(const QString& versionstring, const QString& url); - void on_actionWiki_triggered(); - void on_actionBug_report_triggered(); - void on_actionFeature_Request_triggered(); - void on_actionSqlCipherFaq_triggered(); - void on_actionWebsite_triggered(); - void on_actionDonatePatreon_triggered(); - void updateBrowseDataColumnWidth(int section, int /*old_size*/, int new_size); + void on_actionWiki_triggered() const; + void on_actionBug_report_triggered() const; + void on_actionFeature_Request_triggered() const; + void on_actionSqlCipherFaq_triggered() const; + void on_actionWebsite_triggered() const; + void on_actionDonatePatreon_triggered() const; bool loadProject(QString filename = QString(), bool readOnly = false); void saveProject(); void saveProjectAs(); - void fileAttach(); - void updateFilter(int column, const QString& value); - void addCondFormat(int column, const QString& value); - void clearAllCondFormats(int column); - void editCondFormats(int column); + void fileAttach(const QString& fileName = QString()); void editEncryption(); - void on_actionClearFilters_triggered(); void copyCurrentCreateStatement(); - void showDataColumnPopupMenu(const QPoint& pos); - void showRecordPopupMenu(const QPoint& pos); - void editDataColumnDisplayFormat(); - void showRowidColumn(bool show, bool skipFilters = false); - void browseDataSetTableEncoding(bool forAllTables = false); - void browseDataSetDefaultTableEncoding(); void fileOpenReadOnly(); - void unlockViewEditing(bool unlock, QString pk = QString()); - void hideColumns(int column = -1, bool hide = true); - void on_actionShowAllColumns_triggered(); void requestCollation(const QString& name, int eTextRep); void renameSqlTab(int index); void setFindFrameVisibility(bool show); void openFindReplaceDialog(); void toggleSqlBlockComment(); void openSqlPrintDialog(); - void saveFilterAsView(); - void exportFilteredTable(); - void updateInsertDeleteRecordButton(); void runSqlNewTab(const QString& query, const QString& title); void printDbStructure(); void updateDatabaseBusyStatus(bool busy, const QString& user); @@ -308,6 +203,8 @@ private slots: void showStatusMessage5s(QString message); void saveSqlFile(int tabIndex); void saveAll(); + void showContextMenuSqlTabBar(const QPoint& pos); + void openUrlOrFile(const QString& urlString); }; #endif diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 7d969440..03b31430 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -39,9 +39,6 @@ 0 - - true - true @@ -124,6 +121,9 @@ You can drag SQL statements from an object row and drop them into other applicat Browse Data + + 3 + 3 @@ -137,222 +137,7 @@ You can drag SQL statements from an object row and drop them into other applicat 3 - - - - - &Table: - - - comboBrowseTable - - - - - - - Select a table to browse data - - - Use this list to select a table to be displayed in the database view - - - 30 - - - QComboBox::AdjustToContents - - - - - - - Qt::ToolButtonIconOnly - - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 0 - 20 - - - - - - - - - - true - - - This is the database table view. You can do the following actions: - - Start writing for editing inline the value. - - Double-click any record to edit its contents in the cell editor window. - - Alt+Del for deleting the cell content to NULL. - - Ctrl+" for duplicating the current record. - - Ctrl+' for copying the value from the cell above. - - Standard selection and copy/paste operations. - - - QAbstractItemView::NoEditTriggers - - - QAbstractItemView::DragDrop - - - Qt::CopyAction - - - QAbstractItemView::ContiguousSelection - - - - - - - - - false - - - <html><head/><body><p>Scroll to the beginning</p></body></html> - - - <html><head/><body><p>Clicking this button navigates to the beginning in the table view above.</p></body></html> - - - |< - - - - :/icons/resultset_first.png:/icons/resultset_first.png - - - - - - - false - - - Scroll one page upwards - - - <html><head/><body><p>Clicking this button navigates one page of records upwards in the table view above.</p></body></html> - - - < - - - - :/icons/resultset_previous.png:/icons/resultset_previous.png - - - - - - - 0 - 0 of 0 - - - - - - - false - - - Scroll one page downwards - - - <html><head/><body><p>Clicking this button navigates one page of records downwards in the table view above.</p></body></html> - - - > - - - - :/icons/run:/icons/run - - - - - - - false - - - Scroll to the end - - - <html><head/><body><p>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Clicking this button navigates up to the end in the table view above.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</p></body></html> - - - >| - - - - :/icons/run_line:/icons/run_line - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Click here to jump to the specified record</p></body></html> - - - <html><head/><body><p>This button is used to navigate to the record number specified in the Go to area.</p></body></html> - - - Go to: - - - - - - - Enter record number to browse - - - Type a record number in this area and click the Go to: button to display the record in the database view - - - 1 - - - - + @@ -939,12 +724,12 @@ You can drag SQL statements from an object row and drop them into other applicat -1 - - true - true + + Qt::CustomContextMenu + @@ -1396,7 +1181,7 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed This button closes the connection to the currently open database file - Ctrl+W + Ctrl+F4 QAction::NoRole @@ -1788,6 +1573,9 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed &Wiki + + F1 + QAction::NoRole @@ -1966,41 +1754,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Copy the CREATE statement of the item to the clipboard - - - Edit display format - - - Edit the display format of the data in this column - - - - - true - - - Show rowid column - - - Toggle the visibility of the rowid column - - - - - Set encoding - - - Change the encoding of the text in the table cells - - - - - Set encoding for all tables - - - Change the default encoding assumed for all tables in the database - - @@ -2024,27 +1777,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed QAction::NoRole - - - - :/icons/refresh:/icons/refresh - - - Refresh - - - Refresh the data in the selected table - - - This button refreshes the data in the currently selected table. - - - F5 - - - Qt::WidgetShortcut - - @@ -2062,21 +1794,13 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed This option is used to open an existing database file. + + Ctrl+Shift+O + QAction::NoRole - - - true - - - Unlock view editing - - - This unlocks the current view for editing. However, you will need appropriate triggers for editing. - - @@ -2159,22 +1883,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Save as view - - - Hide column(s) - - - Hide selected column(s) - - - - - Show all columns - - - Show all columns that were hidden - - true @@ -2208,34 +1916,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Extra DB Toolbar - - - Export to &CSV - - - Export the filtered data to CSV - - - Export the filtered data to CSV - - - This button exports the data of the browsed table as currently displayed (after filters, display formats and order column) as a CSV file. - - - - - Save as &view - - - Save the current filter, sort column and display formats as a view - - - Save the current filter, sort column and display formats as a view - - - This button saves the current setting of the browsed table (filters, display formats and order column) as an SQL view that you can later browse or use in SQL statements. - - @@ -2257,32 +1937,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed QAction::TextHeuristicRole - - - Insert Values... - - - Open a dialog for inserting values in a new record - - - Open a dialog for inserting values in a new record - - - - - - :/icons/add_record:/icons/add_record - - - New Record - - - Insert new record using default values in browsed table - - - Insert new record using default values in browsed table - - New In-&Memory Database @@ -2444,102 +2098,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Stop the currently running SQL script - - - - :/icons/print:/icons/print - - - Print - - - Print currently browsed table data - - - - - - Print currently browsed table data. Print selection if more than one cell is selected. - - - Ctrl+P - - - Qt::WidgetShortcut - - - - - - :/icons/clear_filters:/icons/clear_filters - - - Clear Filters - - - Clear all filters - - - This button clears all the filters set in the header input fields for the currently browsed table. - - - This button clears all the filters set in the header input fields for the currently browsed table. - - - - - - :/icons/save_table:/icons/save_table - - - Save Table As... - - - Save the table as currently displayed - - - Save the table as currently displayed - - - <html><head/><body><p>This popup menu provides the following options applying to the currently browsed and filtered table:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Export to CSV: this option exports the data of the browsed table as currently displayed (after filters, display formats and order column) to a CSV file.</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Save as view: this option saves the current setting of the browsed table (filters, display formats and order column) as an SQL view that you can later browse or use in SQL statements.</li></ul></body></html> - - - - - - :/icons/add_record:/icons/add_record - - - New Record - - - Insert a new record in the current table - - - Insert a new record in the current table - - - <html><head/><body><p>This button creates a new record in the database. Hold the mouse button to open a pop-up menu of different options:</p><ul><li><span style=" font-weight:600;">New Record</span>: insert a new record with default values in the database.</li><li><span style=" font-weight:600;">Insert Values...</span>: open a dialog for entering values before they are inserted in the database. This allows to enter values acomplishing the different constraints. This dialog is also open if the <span style=" font-weight:600;">New Record</span> option fails due to these constraints.</li></ul></body></html> - - - - - - :/icons/delete_record:/icons/delete_record - - - Delete Record - - - Delete the current record - - - This button deletes the record or records currently selected in the table - - - This button deletes the record or records currently selected in the table - - @@ -2579,6 +2137,15 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Ctrl+Shift+S + + + + :/icons/table:/icons/table + + + Browse Table + + @@ -2587,21 +2154,18 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed

sqltextedit.h
1 - - ExtendedTableWidget - QTableWidget -
ExtendedTableWidget.h
- - foreignKeyClicked(QString,QString,QByteArray) - foreignKeyClicked(sqlb::ObjectIdentifier,QString,QByteArray) - -
ExtendedScintilla QTextEdit
ExtendedScintilla.h
1
+ + TableBrowser + QWidget +
TableBrowser.h
+ 1 +
mainTab @@ -2609,14 +2173,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed comboLogSubmittedBy buttonLogClear treeSchemaDock - comboBrowseTable - dataTable - buttonBegin - buttonPrevious - buttonNext - buttonEnd - buttonGoto - editGoto scrollareaPragmas comboboxPragmaAutoVacuum checkboxPragmaAutomaticIndex @@ -2706,102 +2262,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - comboBrowseTable - activated(QString) - MainWindow - populateTable() - - - 118 - 141 - - - 399 - 299 - - - - - actionDeleteRecord - triggered() - MainWindow - deleteRecord() - - - -1 - -1 - - - 399 - 299 - - - - - buttonPrevious - clicked() - MainWindow - navigatePrevious() - - - 86 - 539 - - - 399 - 299 - - - - - buttonNext - clicked() - MainWindow - navigateNext() - - - 183 - 539 - - - 399 - 299 - - - - - buttonGoto - clicked() - MainWindow - navigateGoto() - - - 365 - 539 - - - 399 - 299 - - - - - editGoto - returnPressed() - MainWindow - navigateGoto() - - - 506 - 538 - - - 399 - 299 - - - fileCompactAction triggered() @@ -3218,22 +2678,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - dataTable - doubleClicked(QModelIndex) - MainWindow - doubleClickTable(QModelIndex) - - - 399 - 211 - - - 399 - 299 - - - tabSqlAreas tabCloseRequested(int) @@ -3474,38 +2918,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - buttonEnd - clicked() - MainWindow - navigateEnd() - - - 223 - 539 - - - 499 - 314 - - - - - buttonBegin - clicked() - MainWindow - navigateBegin() - - - 50 - 539 - - - 499 - 314 - - - actionEditBrowseTable triggered() @@ -3538,86 +2950,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - dataTable - foreignKeyClicked(sqlb::ObjectIdentifier,QString,QByteArray) - MainWindow - jumpToRow(sqlb::ObjectIdentifier,QString,QByteArray) - - - 70 - 242 - - - 518 - 314 - - - - - actionBrowseTableEditDisplayFormat - triggered() - MainWindow - editDataColumnDisplayFormat() - - - -1 - -1 - - - 518 - 314 - - - - - actionShowRowidColumn - triggered(bool) - MainWindow - showRowidColumn(bool) - - - -1 - -1 - - - 518 - 314 - - - - - actionSetTableEncoding - triggered() - MainWindow - browseDataSetTableEncoding() - - - -1 - -1 - - - 518 - 314 - - - - - actionSetAllTablesEncoding - triggered() - MainWindow - browseDataSetDefaultTableEncoding() - - - -1 - -1 - - - 518 - 314 - - - fileExportJsonAction triggered() @@ -3634,22 +2966,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - actionRefresh - triggered() - MainWindow - refresh() - - - -1 - -1 - - - 518 - 314 - - - fileOpenReadOnlyAction triggered() @@ -3666,22 +2982,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - actionUnlockViewEditing - toggled(bool) - MainWindow - unlockViewEditing(bool) - - - -1 - -1 - - - 518 - 314 - - - actionSqlResultsExportCsv triggered() @@ -3714,22 +3014,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - actionHideColumns - triggered() - MainWindow - hideColumns() - - - -1 - -1 - - - 518 - 314 - - - tabSqlAreas tabBarDoubleClicked(int) @@ -3826,38 +3110,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - actionFilteredTableExportCsv - triggered() - MainWindow - exportFilteredTable() - - - -1 - -1 - - - 518 - 314 - - - - - actionFilterSaveAsView - triggered() - MainWindow - saveFilterAsView() - - - -1 - -1 - - - 518 - 314 - - - fileOpenActionPopup triggered() @@ -3874,38 +3126,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - newRecordAction - triggered() - MainWindow - addRecord() - - - -1 - -1 - - - 518 - 314 - - - - - insertValuesAction - triggered() - MainWindow - insertValues() - - - -1 - -1 - - - 20 - 20 - - - fileNewInMemoryDatabaseAction triggered() @@ -3954,22 +3174,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - - actionPrintTable - triggered() - dataTable - openPrintDialog() - - - -1 - -1 - - - 326 - 347 - - - actionSqlToggleComment triggered() @@ -4323,18 +3527,18 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed - actionNewRecord - triggered() + tabSqlAreas + customContextMenuRequested(QPoint) MainWindow - addRecord() + showContextMenuSqlTabBar(QPoint) -1 -1 - 518 - 314 + 20 + 20 @@ -4342,20 +3546,10 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed fileOpen() fileClose() - populateTable() - addRecord() - deleteRecord() - navigatePrevious() - navigateNext() - navigateBegin() - navigateEnd() - navigateGoto() browseFind(bool) refresh() compact() helpWhatsThis() - doubleClickTable(QModelIndex) - browseTableHeaderClicked(int) mainTabSelected(int) executeQuery() importTableFromCSV() @@ -4393,20 +3587,14 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed saveSqlFileAs() switchToBrowseDataTab() copyCurrentCreateStatement() - jumpToRow(sqlb::ObjectIdentifier,QString,QByteArray) - editDataColumnDisplayFormat() - showRowidColumn(bool) - browseDataSetTableEncoding() - browseDataSetDefaultTableEncoding() browseDataFetchAllData() exportTableToJson() fileOpenReadOnly() - unlockViewEditing(bool) saveSqlResultsAsCsv() saveSqlResultsAsView() changeSqlTab(int) - hideColumns() renameSqlTab(int) fileNewInMemoryDatabase() + showContextMenuSqlTabBar(QPoint) diff --git a/src/PlotDock.cpp b/src/PlotDock.cpp index edb36f1b..ef92c957 100644 --- a/src/PlotDock.cpp +++ b/src/PlotDock.cpp @@ -3,7 +3,7 @@ #include "Settings.h" #include "sqlitetablemodel.h" #include "FileDialog.h" -#include "MainWindow.h" // Just for BrowseDataTableSettings, not for the actual main window class +#include "TableBrowser.h" // Just for BrowseDataTableSettings, not for the actual table browser class #include #include @@ -48,11 +48,11 @@ PlotDock::PlotDock(QWidget* parent) // Connect signals connect(ui->treePlotColumns, &QTreeWidget::itemChanged, this, &PlotDock::on_treePlotColumns_itemChanged); - connect(ui->plotWidget, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged())); + connect(ui->plotWidget, &QCustomPlot::selectionChangedByUser, this, &PlotDock::selectionChanged); // connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed: - connect(ui->plotWidget, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress())); - connect(ui->plotWidget, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel())); + connect(ui->plotWidget, &QCustomPlot::mousePress, this, &PlotDock::mousePress); + connect(ui->plotWidget, &QCustomPlot::mouseWheel, this, &PlotDock::mouseWheel); // Enable: click on items to select them, Ctrl+Click for multi-selection, mouse-wheel for zooming and mouse drag for // changing the visible range. @@ -61,7 +61,7 @@ PlotDock::PlotDock(QWidget* parent) ui->plotWidget->setSelectionRectMode(QCP::srmNone); QShortcut* shortcutCopy = new QShortcut(QKeySequence::Copy, ui->plotWidget, nullptr, nullptr, Qt::WidgetShortcut); - connect(shortcutCopy, SIGNAL(activated()), this, SLOT(copy())); + connect(shortcutCopy, &QShortcut::activated, this, &PlotDock::copy); QShortcut* shortcutPrint = new QShortcut(QKeySequence::Print, ui->plotWidget, nullptr, nullptr, Qt::WidgetShortcut); connect(shortcutPrint, &QShortcut::activated, this, &PlotDock::openPrintDialog); @@ -89,13 +89,13 @@ PlotDock::PlotDock(QWidget* parent) showLegendAction->setCheckable(true); m_contextMenu->addAction(showLegendAction); - connect(showLegendAction, SIGNAL(toggled(bool)), this, SLOT(toggleLegendVisible(bool))); + connect(showLegendAction, &QAction::toggled, this, &PlotDock::toggleLegendVisible); QAction* stackedBarsAction = new QAction(tr("Stacked bars"), m_contextMenu); stackedBarsAction->setCheckable(true); m_contextMenu->addAction(stackedBarsAction); - connect(stackedBarsAction, SIGNAL(toggled(bool)), this, SLOT(toggleStackedBars(bool))); + connect(stackedBarsAction, &QAction::toggled, this, &PlotDock::toggleStackedBars); connect(ui->plotWidget, &QTableView::customContextMenuRequested, [=](const QPoint& pos) { @@ -193,7 +193,7 @@ void PlotDock::updatePlot(SqliteTableModel* model, BrowseDataTableSettings* sett // in the PlotColumnType, both using the User Role. columnitem->setData(PlotColumnField, Qt::UserRole, i); columnitem->setData(PlotColumnType, Qt::UserRole, static_cast(columntype)); - columnitem->setText(PlotColumnField, model->headerData(i, Qt::Horizontal).toString()); + columnitem->setText(PlotColumnField, model->headerData(i, Qt::Horizontal, Qt::EditRole).toString()); // restore previous check state if(mapItemsY.contains(columnitem->text(PlotColumnField))) @@ -331,36 +331,43 @@ void PlotDock::updatePlot(SqliteTableModel* model, BrowseDataTableSettings* sett for(int j = 0; j < nrows; ++j) { tdata[j] = j; - // convert x type axis if it's datetime - switch (xtype) { - case QVariant::DateTime: - case QVariant::Date: { - QString s = model->data(model->index(j, x)).toString(); - QDateTime d = QDateTime::fromString(s, Qt::ISODate); - xdata[j] = static_cast(d.toMSecsSinceEpoch()) / 1000.0; - break; - } - case QVariant::Time: { - QString s = model->data(model->index(j, x)).toString(); - QTime t = QTime::fromString(s); - xdata[j] = t.msecsSinceStartOfDay() / 1000.0; - break; - } - case QVariant::String: { - xdata[j] = j+1; - labels << model->data(model->index(j, x)).toString(); - break; - } - default: { - // Get the x value for this point. If the selected column is -1, i.e. the row number, just use the current row number from the loop - // instead of retrieving some value from the model. - if(x == RowNumId) - xdata[j] = j+1; - else - xdata[j] = model->data(model->index(j, x)).toDouble(); - } - } + // NULL values produce gaps in the graph. We use NaN values in + // that case as required by QCustomPlot. + if(x != RowNumId && model->data(model->index(j, x), Qt::EditRole).isNull()) + xdata[j] = qQNaN(); + else { + + // convert x type axis if it's datetime + switch (xtype) { + case QVariant::DateTime: + case QVariant::Date: { + QString s = model->data(model->index(j, x)).toString(); + QDateTime d = QDateTime::fromString(s, Qt::ISODate); + xdata[j] = static_cast(d.toMSecsSinceEpoch()) / 1000.0; + break; + } + case QVariant::Time: { + QString s = model->data(model->index(j, x)).toString(); + QTime t = QTime::fromString(s); + xdata[j] = t.msecsSinceStartOfDay() / 1000.0; + break; + } + case QVariant::String: { + xdata[j] = j+1; + labels << model->data(model->index(j, x)).toString(); + break; + } + default: { + // Get the x value for this point. If the selected column is -1, i.e. the row number, just use the current row number from the loop + // instead of retrieving some value from the model. + if(x == RowNumId) + xdata[j] = j+1; + else + xdata[j] = model->data(model->index(j, x)).toDouble(); + } + } + } if (j != 0) isSorted &= (xdata[j-1] <= xdata[j]); @@ -435,7 +442,7 @@ void PlotDock::updatePlot(SqliteTableModel* model, BrowseDataTableSettings* sett if(column == RowNumId) yAxisLabels << tr("Row #"); else - yAxisLabels << model->headerData(column, Qt::Horizontal).toString(); + yAxisLabels << model->headerData(column, Qt::Horizontal, Qt::EditRole).toString(); } } @@ -448,7 +455,7 @@ void PlotDock::updatePlot(SqliteTableModel* model, BrowseDataTableSettings* sett if(x == RowNumId) ui->plotWidget->xAxis->setLabel(tr("Row #")); else - ui->plotWidget->xAxis->setLabel(model->headerData(x, Qt::Horizontal).toString()); + ui->plotWidget->xAxis->setLabel(model->headerData(x, Qt::Horizontal, Qt::EditRole).toString()); ui->plotWidget->yAxis->setLabel(yAxisLabels.join("|")); } @@ -682,7 +689,7 @@ void PlotDock::on_comboPointShape_currentIndexChanged(int index) } } -QVariant::Type PlotDock::guessDataType(SqliteTableModel* model, int column) +QVariant::Type PlotDock::guessDataType(SqliteTableModel* model, int column) const { QVariant::Type type = QVariant::Invalid; for(int i = 0; i < std::min(10, model->rowCount()) && type != QVariant::String; ++i) @@ -740,9 +747,9 @@ void PlotDock::fetchAllData() void PlotDock::selectionChanged() { - for (QCPAbstractPlottable* plottable : ui->plotWidget->selectedPlottables()) { + for (const QCPAbstractPlottable* plottable : ui->plotWidget->selectedPlottables()) { - for (QCPDataRange dataRange : plottable->selection().dataRanges()) { + for (const QCPDataRange& dataRange : plottable->selection().dataRanges()) { int index = dataRange.begin(); if (dataRange.length() != 0) { diff --git a/src/PlotDock.h b/src/PlotDock.h index 5a3195a4..f797e6b9 100644 --- a/src/PlotDock.h +++ b/src/PlotDock.h @@ -100,7 +100,7 @@ private: * \param column index of the column to check * \return the guessed datatype */ - QVariant::Type guessDataType(SqliteTableModel* model, int column); + QVariant::Type guessDataType(SqliteTableModel* model, int column) const; void adjustBars(); private slots: diff --git a/src/PreferencesDialog.cpp b/src/PreferencesDialog.cpp index 1ce272d0..4b97f46c 100644 --- a/src/PreferencesDialog.cpp +++ b/src/PreferencesDialog.cpp @@ -33,8 +33,8 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Tabs tab) ui->fr_null_bg->installEventFilter(this); ui->fr_null_fg->installEventFilter(this); - connect(ui->comboDataBrowserFont, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreviewFont())); - connect(ui->spinDataBrowserFontSize, SIGNAL(valueChanged(int)), this, SLOT(updatePreviewFont())); + connect(ui->comboDataBrowserFont, static_cast(&QFontComboBox::currentIndexChanged), this, &PreferencesDialog::updatePreviewFont); + connect(ui->spinDataBrowserFontSize, static_cast(&QSpinBox::valueChanged), this, &PreferencesDialog::updatePreviewFont); #ifndef CHECKNEWVERSION ui->labelUpdates->setVisible(false); @@ -109,6 +109,7 @@ void PreferencesDialog::loadSettings() ui->spinSymbolLimit->setValue(Settings::getValue("databrowser", "symbol_limit").toInt()); ui->spinCompleteThreshold->setValue(Settings::getValue("databrowser", "complete_threshold").toInt()); + ui->checkShowImagesInline->setChecked(Settings::getValue("databrowser", "image_preview").toBool()); ui->txtNull->setText(Settings::getValue("databrowser", "null_text").toString()); ui->txtBlob->setText(Settings::getValue("databrowser", "blob_text").toString()); ui->editFilterEscape->setText(Settings::getValue("databrowser", "filter_escape").toString()); @@ -217,6 +218,7 @@ void PreferencesDialog::saveSettings() Settings::setValue("databrowser", "font", ui->comboDataBrowserFont->currentText()); Settings::setValue("databrowser", "fontsize", ui->spinDataBrowserFontSize->value()); + Settings::setValue("databrowser", "image_preview", ui->checkShowImagesInline->isChecked()); saveColorSetting(ui->fr_null_fg, "null_fg"); saveColorSetting(ui->fr_null_bg, "null_bg"); saveColorSetting(ui->fr_reg_fg, "reg_fg"); @@ -479,33 +481,26 @@ void PreferencesDialog::loadColorSetting(QFrame *frame, const std::string& setti void PreferencesDialog::setColorSetting(QFrame *frame, const QColor &color) { QPalette::ColorRole role; - QString style; QLineEdit *line; if (frame == ui->fr_bin_bg) { line = ui->txtBlob; role = line->backgroundRole(); - style = QString("background-color"); } else if (frame == ui->fr_bin_fg) { line = ui->txtBlob; role = line->foregroundRole(); - style = QString("color"); } else if (frame == ui->fr_reg_bg) { line = ui->txtRegular; role = line->backgroundRole(); - style = QString("background-color"); } else if (frame == ui->fr_reg_fg) { line = ui->txtRegular; role = line->foregroundRole(); - style = QString("color"); } else if (frame == ui->fr_null_bg) { line = ui->txtNull; role = line->backgroundRole(); - style = QString("background-color"); } else if (frame == ui->fr_null_fg) { line = ui->txtNull; role = line->foregroundRole(); - style = QString("color"); } else return; diff --git a/src/PreferencesDialog.ui b/src/PreferencesDialog.ui index 089c639c..443929fc 100644 --- a/src/PreferencesDialog.ui +++ b/src/PreferencesDialog.ui @@ -821,6 +821,23 @@ Can be set to 0 for disabling completion.
+ + + + Show images in cell + + + checkShowImagesInline + + + + + + + Enable this option to show a preview of BLOBs containing image data in the cells. This can affect the performance of the data browser, however. + + + @@ -1866,10 +1883,12 @@ Can be set to 0 for disabling completion.
+ tabWidget comboDefaultLocation locationEdit setLocationButton languageComboBox + appStyleCombo toolbarStyleComboMain toolbarStyleComboStructure toolbarStyleComboBrowse @@ -1877,6 +1896,7 @@ Can be set to 0 for disabling completion.
toolbarStyleComboEditCell checkUseRemotes checkUpdates + buttonManageFileExtension encodingComboBox foreignKeysCheckBox checkHideSchemaLinebreaks @@ -1886,6 +1906,9 @@ Can be set to 0 for disabling completion.
editDatabaseDefaultSqlText comboDataBrowserFont spinDataBrowserFontSize + spinSymbolLimit + spinCompleteThreshold + checkShowImagesInline fr_null_fg fr_null_bg txtNull @@ -1902,20 +1925,25 @@ Can be set to 0 for disabling completion.
spinEditorFontSize spinLogFontSize spinTabSize + wrapComboBox + quoteComboBox checkAutoCompletion + checkCompleteUpper checkErrorIndicators checkHorizontalTiling listExtensions buttonAddExtension buttonRemoveExtension checkRegexDisabled - editRemoteCloneDirectory - buttonRemoteBrowseCloneDirectory - tableCaCerts + checkAllowLoadExtension + tabCertificates tableClientCerts buttonClientCertAdd buttonClientCertRemove - tabWidget + buttonProxy + editRemoteCloneDirectory + buttonRemoteBrowseCloneDirectory + tableCaCerts @@ -1992,12 +2020,12 @@ Can be set to 0 for disabling completion. setVisible(bool) - 365 - 207 + 344 + 230 - 108 - 280 + 119 + 273 @@ -2008,8 +2036,8 @@ Can be set to 0 for disabling completion. setVisible(bool) - 365 - 207 + 344 + 230 365 @@ -2024,8 +2052,8 @@ Can be set to 0 for disabling completion. activateRemoteTab(bool) - 161 - 172 + 231 + 393 382 @@ -2040,8 +2068,8 @@ Can be set to 0 for disabling completion. addClientCertificate() - 578 - 315 + 722 + 110 596 @@ -2056,8 +2084,8 @@ Can be set to 0 for disabling completion. removeClientCertificate() - 578 - 353 + 722 + 139 597 @@ -2072,8 +2100,8 @@ Can be set to 0 for disabling completion. chooseRemoteCloneDirectory() - 567 - 54 + 732 + 538 595 @@ -2088,12 +2116,12 @@ Can be set to 0 for disabling completion. setEnabled(bool) - 474 - 464 + 642 + 450 - 474 - 492 + 642 + 480 @@ -2104,8 +2132,8 @@ Can be set to 0 for disabling completion. on_buttonBox_clicked(QAbstractButton*) - 385 - 591 + 394 + 584 385 @@ -2120,8 +2148,8 @@ Can be set to 0 for disabling completion. configureProxy() - 385 - 591 + 225 + 506 385 diff --git a/src/RemoteDatabase.cpp b/src/RemoteDatabase.cpp index a57854b1..408b8d44 100644 --- a/src/RemoteDatabase.cpp +++ b/src/RemoteDatabase.cpp @@ -170,7 +170,7 @@ void RemoteDatabase::gotReply(QNetworkReply* reply) if(reply->error() != QNetworkReply::NoError) { QMessageBox::warning(nullptr, qApp->applicationName(), - tr("Error when connecting to %1.\n%2").arg(reply->url().toString()).arg(reply->errorString())); + tr("Error when connecting to %1.\n%2").arg(reply->url().toString(), reply->errorString())); reply->deleteLater(); return; } @@ -321,7 +321,7 @@ void RemoteDatabase::gotError(QNetworkReply* reply, const QList& erro } // Build an error message and short it to the user - QString message = tr("Error opening remote file at %1.\n%2").arg(reply->url().toString()).arg(errors.at(0).errorString()); + QString message = tr("Error opening remote file at %1.\n%2").arg(reply->url().toString(), errors.at(0).errorString()); QMessageBox::warning(nullptr, qApp->applicationName(), message); // Delete reply later, i.e. after returning from this slot function @@ -473,7 +473,7 @@ void RemoteDatabase::fetch(const QString& url, RequestType type, const QString& // Build network request QNetworkRequest request; request.setUrl(url); - request.setRawHeader("User-Agent", QString("%1 %2").arg(qApp->organizationName()).arg(APP_VERSION).toUtf8()); + request.setRawHeader("User-Agent", QString("%1 %2").arg(qApp->organizationName(), APP_VERSION).toUtf8()); // Set SSL configuration when trying to access a file via the HTTPS protocol. // Skip this step when no client certificate was specified. In this case the default HTTPS configuration is used. @@ -522,7 +522,7 @@ void RemoteDatabase::push(const QString& filename, const QString& url, const QSt // Build network request QNetworkRequest request; request.setUrl(url); - request.setRawHeader("User-Agent", QString("%1 %2").arg(qApp->organizationName()).arg(APP_VERSION).toUtf8()); + request.setRawHeader("User-Agent", QString("%1 %2").arg(qApp->organizationName(), APP_VERSION).toUtf8()); // Get the last modified date of the file and prepare it for conversion into the ISO date format QDateTime last_modified = QFileInfo(filename).lastModified(); @@ -565,7 +565,7 @@ void RemoteDatabase::push(const QString& filename, const QString& url, const QSt prepareProgressDialog(reply, true, url); } -void RemoteDatabase::addPart(QHttpMultiPart* multipart, const QString& name, const QString& value) +void RemoteDatabase::addPart(QHttpMultiPart* multipart, const QString& name, const QString& value) const { QHttpPart part; part.setHeader(QNetworkRequest::ContentDispositionHeader, QString("form-data; name=\"%1\"").arg(name)); @@ -574,10 +574,10 @@ void RemoteDatabase::addPart(QHttpMultiPart* multipart, const QString& name, con multipart->append(part); } -void RemoteDatabase::addPart(QHttpMultiPart* multipart, const QString& name, QFile* file, const QString& filename) +void RemoteDatabase::addPart(QHttpMultiPart* multipart, const QString& name, QFile* file, const QString& filename) const { QHttpPart part; - part.setHeader(QNetworkRequest::ContentDispositionHeader, QString("form-data; name=\"%1\"; filename=\"%2\"").arg(name).arg(filename)); + part.setHeader(QNetworkRequest::ContentDispositionHeader, QString("form-data; name=\"%1\"; filename=\"%2\"").arg(name, filename)); part.setBodyDevice(file); file->setParent(multipart); // Close the file and delete the file object as soon as the multi-part object is destroyed diff --git a/src/RemoteDatabase.h b/src/RemoteDatabase.h index f013a7d7..42d7eea3 100644 --- a/src/RemoteDatabase.h +++ b/src/RemoteDatabase.h @@ -85,8 +85,8 @@ private: std::string localLastCommitId(QString clientCert, const QUrl& url); // Helper functions for building multi-part HTTP requests - void addPart(QHttpMultiPart* multipart, const QString& name, const QString& value); - void addPart(QHttpMultiPart* multipart, const QString& name, QFile* file, const QString& filename); + void addPart(QHttpMultiPart* multipart, const QString& name, const QString& value) const; + void addPart(QHttpMultiPart* multipart, const QString& name, QFile* file, const QString& filename) const; // Before using a new client certificate we need to clear the access and authentication cache of the network manager // object. Otherwise Qt might reuse the old certificate if the requested URL has been used before. diff --git a/src/RemoteModel.cpp b/src/RemoteModel.cpp index c7c77e72..a8f5b62a 100644 --- a/src/RemoteModel.cpp +++ b/src/RemoteModel.cpp @@ -1,10 +1,14 @@ #include +#include "Data.h" #include "RemoteModel.h" #include "RemoteDatabase.h" using json = nlohmann::json; +// The header list is a list of column titles +const static std::vector headerList = {QObject::tr("Name"), QObject::tr("Commit"), QObject::tr("Last modified"), QObject::tr("Size")}; + RemoteModelItem::RemoteModelItem(RemoteModelItem* parent) : m_parent(parent), m_fetchedDirectoryList(false) @@ -89,7 +93,7 @@ std::vector RemoteModelItem::loadArray(const json& array, Remo if(elem.contains("commit_id")) item->setValue(RemoteModelColumnCommitId, QString::fromStdString(elem["commit_id"])); if(elem.contains("size")) - item->setValue(RemoteModelColumnSize, QString::number(static_cast(elem["size"]))); + item->setValue(RemoteModelColumnSize, QString::number(static_cast(elem["size"]))); items.push_back(item); } @@ -102,9 +106,6 @@ RemoteModel::RemoteModel(QObject* parent, RemoteDatabase& remote) : rootItem(new RemoteModelItem()), remoteDatabase(remote) { - // Initialise list of column names - headerList << tr("Name") << tr("Commit") << tr("Last modified") << tr("Size"); - // Set up signals connect(&remoteDatabase, &RemoteDatabase::gotDirList, this, &RemoteModel::parseDirectoryListing); } @@ -238,17 +239,8 @@ QVariant RemoteModel::data(const QModelIndex& index, int role) const return QVariant(); // Convert size to human readable format - float size = item->value(RemoteModelColumnSize).toFloat(); - QStringList list; - list << "KiB" << "MiB" << "GiB" << "TiB"; - QStringListIterator it(list); - QString unit(tr("bytes")); - while(size >= 1024.0f && it.hasNext()) - { - unit = it.next(); - size /= 1024.0f; - } - return QString().setNum(size, 'f', 2).remove(".00") + QString(" ") + unit; + unsigned int size = item->value(RemoteModelColumnSize).toUInt(); + return humanReadableSize(size); } } } @@ -263,7 +255,7 @@ QVariant RemoteModel::headerData(int section, Qt::Orientation orientation, int r return QAbstractItemModel::headerData(section, orientation, role); // Return header string depending on column - return headerList.at(section); + return headerList.at(static_cast(section)); } int RemoteModel::rowCount(const QModelIndex& parent) const @@ -277,7 +269,7 @@ int RemoteModel::rowCount(const QModelIndex& parent) const int RemoteModel::columnCount(const QModelIndex& /*parent*/) const { - return headerList.size(); + return static_cast(headerList.size()); } bool RemoteModel::hasChildren(const QModelIndex& parent) const diff --git a/src/RemoteModel.h b/src/RemoteModel.h index 26d2149e..e49bf57e 100644 --- a/src/RemoteModel.h +++ b/src/RemoteModel.h @@ -2,7 +2,6 @@ #define REMOTEMODEL_H #include -#include #include @@ -101,9 +100,6 @@ private: // Pointer to the root item. This contains all the actual item data. RemoteModelItem* rootItem; - // The header list is a list of column titles. It's a static list that's getting filled in the constructor. - QStringList headerList; - // Reference to the remote database object which is stored somewhere in the main window. RemoteDatabase& remoteDatabase; diff --git a/src/RowLoader.cpp b/src/RowLoader.cpp index c8438037..7b1b904f 100644 --- a/src/RowLoader.cpp +++ b/src/RowLoader.cpp @@ -20,7 +20,7 @@ RowLoader::RowLoader ( std::function(void)> db_getter_, std::function statement_logger_, std::vector & headers_, - QMutex & cache_mutex_, + std::mutex & cache_mutex_, Cache & cache_data_ ) : db_getter(db_getter_), statement_logger(statement_logger_), headers(headers_) @@ -76,7 +76,7 @@ std::shared_ptr RowLoader::getDb () const return pDb; } -int RowLoader::countRows() +int RowLoader::countRows() const { int retval = -1; @@ -99,15 +99,10 @@ int RowLoader::countRows() QByteArray utf8Query = countQuery.toUtf8(); sqlite3_stmt* stmt; - int status = sqlite3_prepare_v2(pDb.get(), utf8Query, utf8Query.size(), &stmt, nullptr); - if(status == SQLITE_OK) + if(sqlite3_prepare_v2(pDb.get(), utf8Query, utf8Query.size(), &stmt, nullptr) == SQLITE_OK) { - status = sqlite3_step(stmt); - if(status == SQLITE_ROW) - { - QString sCount = QString::fromUtf8(reinterpret_cast(sqlite3_column_text(stmt, 0))); - retval = sCount.toInt(); - } + if(sqlite3_step(stmt) == SQLITE_ROW) + retval = sqlite3_column_int(stmt, 0); sqlite3_finalize(stmt); } else { qWarning() << "Count query failed: " << countQuery; @@ -223,32 +218,28 @@ void RowLoader::process (Task & t) QByteArray utf8Query = sLimitQuery.toUtf8(); sqlite3_stmt *stmt; - - int status = sqlite3_prepare_v2(pDb.get(), utf8Query, utf8Query.size(), &stmt, nullptr); - auto row = t.row_begin; - - if(SQLITE_OK == status) + if(sqlite3_prepare_v2(pDb.get(), utf8Query, utf8Query.size(), &stmt, nullptr) == SQLITE_OK) { - const int num_columns = static_cast(headers.size()); + const size_t num_columns = headers.size(); while(!t.cancel && sqlite3_step(stmt) == SQLITE_ROW) { // Construct a new row object with the right number of columns - Cache::value_type rowdata(static_cast(num_columns)); - for(int i=0;i(i)) != SQLITE_NULL) { - int bytes = sqlite3_column_bytes(stmt, i); + int bytes = sqlite3_column_bytes(stmt, static_cast(i)); if(bytes) - rowdata[static_cast(i)] = QByteArray(static_cast(sqlite3_column_blob(stmt, i)), bytes); + rowdata[i] = QByteArray(static_cast(sqlite3_column_blob(stmt, static_cast(i))), bytes); else - rowdata[static_cast(i)] = ""; + rowdata[i] = ""; } } - QMutexLocker lk(&cache_mutex); + std::lock_guard lk(cache_mutex); cache_data.set(row++, std::move(rowdata)); } diff --git a/src/RowLoader.h b/src/RowLoader.h index 9e4feca7..772834e6 100644 --- a/src/RowLoader.h +++ b/src/RowLoader.h @@ -11,7 +11,6 @@ #include #include -#include #include "RowCache.h" @@ -31,7 +30,7 @@ public: std::function(void)> db_getter, std::function statement_logger, std::vector & headers, - QMutex & cache_mutex, + std::mutex & cache_mutex, Cache & cache_data ); @@ -71,7 +70,7 @@ private: const std::function()> db_getter; const std::function statement_logger; std::vector & headers; - QMutex & cache_mutex; + std::mutex & cache_mutex; Cache & cache_data; mutable std::mutex m; @@ -111,7 +110,7 @@ private: std::unique_ptr current_task; std::unique_ptr next_task; - int countRows (); + int countRows () const; void process (Task &); diff --git a/src/RunSql.cpp b/src/RunSql.cpp index a5a91210..62f22adb 100644 --- a/src/RunSql.cpp +++ b/src/RunSql.cpp @@ -50,9 +50,9 @@ void RunSql::run() // Execution finished - // If the DB structure was changed by some command in this SQL script, update our schema representations + // If the DB structure was changed by some command in this SQL script, send a signal if(structure_updated) - db.updateSchema(); + emit structureUpdated(); } void RunSql::startNextStatement() @@ -157,6 +157,7 @@ bool RunSql::executeNextStatement() queries_left_to_execute = QByteArray(tail); lk.unlock(); + QString error; if (sql3status == SQLITE_OK) { sql3status = sqlite3_step(vm); @@ -227,18 +228,10 @@ bool RunSql::executeNextStatement() case SQLITE_MISUSE: break; default: - QString error = QString::fromUtf8(sqlite3_errmsg(pDb.get())); - releaseDbAccess(); - emit statementErrored(error, execute_current_position, end_of_current_statement_position); - stopExecution(); - return false; + error = QString::fromUtf8(sqlite3_errmsg(pDb.get())); } } else { - QString error = QString::fromUtf8(sqlite3_errmsg(pDb.get())); - releaseDbAccess(); - emit statementErrored(error, execute_current_position, end_of_current_statement_position); - stopExecution(); - return false; + error = QString::fromUtf8(sqlite3_errmsg(pDb.get())); } // Release the database @@ -256,6 +249,12 @@ bool RunSql::executeNextStatement() savepoint_created = false; } + if(!error.isEmpty()) + { + emit statementErrored(error, execute_current_position, end_of_current_statement_position); + stopExecution(); + return false; + } // Update the start position for the next statement and check if we are at // the end of the part we want to execute. If so, stop the execution now. execute_current_position = end_of_current_statement_position; diff --git a/src/RunSql.h b/src/RunSql.h index 2a790a27..15eb615e 100644 --- a/src/RunSql.h +++ b/src/RunSql.h @@ -54,6 +54,7 @@ signals: void statementErrored(QString message, int from_position, int to_position); void statementExecuted(QString message, int from_position, int to_position); void statementReturnsRows(QString query, int from_position, int to_position, qint64 time_in_ms); + void structureUpdated(); /** * This signal must be connected with a Qt::BlockingQueuedConnection in order to work as expected! diff --git a/src/SelectItemsPopup.cpp b/src/SelectItemsPopup.cpp new file mode 100644 index 00000000..6d054f11 --- /dev/null +++ b/src/SelectItemsPopup.cpp @@ -0,0 +1,136 @@ +#include "SelectItemsPopup.h" +#include "ui_SelectItemsPopup.h" + +#include + +SelectItemsPopup::SelectItemsPopup(const std::vector& available, const std::vector& selected, QWidget* parent) : + QDialog(parent), + ui(new Ui::SelectItemsPopup) +{ + ui->setupUi(this); + setWindowFlags(Qt::Popup); + + // Load initial items + for(const auto& s : available) + { + if(std::find(selected.begin(), selected.end(), s) == selected.end()) + new QListWidgetItem(QString::fromStdString(s), ui->listAvailable); + } + for(const auto& s : selected) + new QListWidgetItem(QString::fromStdString(s), ui->listSelected); +} + +SelectItemsPopup::~SelectItemsPopup() +{ + delete ui; +} + +std::vector SelectItemsPopup::selectedItems() const +{ + std::vector result; + for(int i=0;ilistSelected->count();i++) + result.push_back(ui->listSelected->item(i)->text().toStdString()); + return result; +} + +void SelectItemsPopup::selectItem(const QModelIndex& idx) +{ + // Get currently selected iitem if none was provided + QListWidgetItem* item; + if(idx.isValid()) + item = ui->listAvailable->item(idx.row()); + else + item = ui->listAvailable->currentItem(); + + if(!item) + return; + + // Add it to the selected items list + new QListWidgetItem(item->text(), ui->listSelected); + + // Remove it from available items list + delete item; +} + +void SelectItemsPopup::unselectItem(const QModelIndex& idx) +{ + // Get currently selected iitem if none was provided + QListWidgetItem* item; + if(idx.isValid()) + item = ui->listSelected->item(idx.row()); + else + item = ui->listSelected->currentItem(); + + if(!item) + return; + + // Add it to the available items list + new QListWidgetItem(item->text(), ui->listAvailable); + + // Remove it from selected items list + delete item; +} + +void SelectItemsPopup::resizeEvent(QResizeEvent*) +{ + // We modify the shape of the dialog to add an arrow shaped edge. See the ascii art image below for details. The edges + // are numbered, their order is the same as in the polygon definition. + + /* + /3\ + / \ + 1---2 4--------5 + | | + | | + 7------------------6 + */ + + const int arrow_height = ui->spacer->geometry().height(); + const int arrow_width = arrow_height * 3; + const int arrow_position_div = 5; + + QPolygon poly; + poly << QPoint(rect().x(), rect().y() + arrow_height) + << QPoint(rect().x() + rect().width() / arrow_position_div - arrow_width / 2, rect().y() + arrow_height) + << QPoint(rect().x() + rect().width() / arrow_position_div, rect().y()) + << QPoint(rect().x() + rect().width() / arrow_position_div + arrow_width / 2, rect().y() + arrow_height) + << QPoint(rect().x() + rect().width(), rect().y() + arrow_height) + << QPoint(rect().x() + rect().width(), rect().y() + rect().height()) + << QPoint(rect().x(), rect().y() + rect().height()); + setMask(QRegion(poly)); +} + +void SelectItemsPopup::buttonBoxClicked(QAbstractButton* button) +{ + if(button == ui->buttonBox->button(QDialogButtonBox::Apply)) + accept(); +} + +void SelectItemsPopup::moveItemUp() +{ + moveCurrentItem(false); +} + +void SelectItemsPopup::moveItemDown() +{ + moveCurrentItem(true); +} + +void SelectItemsPopup::moveCurrentItem(bool down) +{ + // Get current row number and calculate row number after the movement. Check the values + int currentRow = ui->listSelected->currentRow(); + if(currentRow == -1) + return; + int newRow = currentRow + (down ? 1 : -1); + if(newRow < 0) + return; + if(newRow >= ui->listSelected->count()) + return; + + // Swap items + ui->listSelected->insertItem(newRow, ui->listSelected->takeItem(currentRow)); + + // Select old item at new position + ui->listSelected->setCurrentRow(newRow); +} diff --git a/src/SelectItemsPopup.h b/src/SelectItemsPopup.h new file mode 100644 index 00000000..e7fb9e9d --- /dev/null +++ b/src/SelectItemsPopup.h @@ -0,0 +1,44 @@ +#ifndef SELECTITEMS_H +#define SELECTITEMS_H + +#include +#include + +#include +#include + +class QAbstractButton; + +namespace Ui { +class SelectItemsPopup; +} + +class SelectItemsPopup : public QDialog +{ + Q_OBJECT + +public: + explicit SelectItemsPopup(const std::vector& available, const std::vector& selected = {}, QWidget* parent = nullptr); + ~SelectItemsPopup(); + + std::vector selectedItems() const; + +private slots: + void buttonBoxClicked(QAbstractButton* button); + + void selectItem(const QModelIndex& idx = QModelIndex()); + void unselectItem(const QModelIndex& idx = QModelIndex()); + + void moveItemUp(); + void moveItemDown(); + +protected: + void resizeEvent(QResizeEvent* ev); + +private: + Ui::SelectItemsPopup* ui; + + void moveCurrentItem(bool down); +}; + +#endif diff --git a/src/SelectItemsPopup.ui b/src/SelectItemsPopup.ui new file mode 100644 index 00000000..89b0d4ef --- /dev/null +++ b/src/SelectItemsPopup.ui @@ -0,0 +1,331 @@ + + + SelectItemsPopup + + + + 0 + 0 + 537 + 290 + + + + + + + Qt::Vertical + + + + 0 + 15 + + + + + + + + + + + + A&vailable + + + listAvailable + + + + + + + QAbstractItemView::NoEditTriggers + + + false + + + true + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::RightArrow + + + + + + + Qt::LeftArrow + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Sele&cted + + + listSelected + + + + + + + QAbstractItemView::NoEditTriggers + + + false + + + QAbstractItemView::InternalMove + + + true + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::UpArrow + + + + + + + Qt::DownArrow + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel + + + + + + + listAvailable + listSelected + buttonSelect + buttonUnselect + + + + + buttonSelect + clicked() + SelectItemsPopup + selectItem() + + + 263 + 115 + + + 2 + 203 + + + + + buttonUnselect + clicked() + SelectItemsPopup + unselectItem() + + + 257 + 159 + + + 515 + 186 + + + + + listAvailable + doubleClicked(QModelIndex) + SelectItemsPopup + selectItem(QModelIndex) + + + 124 + 45 + + + 115 + 0 + + + + + listSelected + doubleClicked(QModelIndex) + SelectItemsPopup + unselectItem(QModelIndex) + + + 377 + 96 + + + 383 + 4 + + + + + buttonBox + rejected() + SelectItemsPopup + reject() + + + 262 + 258 + + + 262 + 140 + + + + + buttonBox + clicked(QAbstractButton*) + SelectItemsPopup + buttonBoxClicked(QAbstractButton*) + + + 262 + 258 + + + 262 + 140 + + + + + buttonDown + clicked() + SelectItemsPopup + moveItemDown() + + + 513 + 153 + + + 268 + 144 + + + + + buttonUp + clicked() + SelectItemsPopup + moveItemUp() + + + 513 + 124 + + + 268 + 144 + + + + + + selectItem(QModelIndex) + unselectItem(QModelIndex) + selectItem() + unselectItem() + buttonBoxClicked(QAbstractButton*) + moveItemUp() + moveItemDown() + + diff --git a/src/Settings.cpp b/src/Settings.cpp index 8c262c95..4524f0ac 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -83,7 +83,7 @@ QVariant Settings::getDefaultValue(const std::string& group, const std::string& // db/defaultsqltext? if(group == "db" && name == "defaultsqltext") - return ""; + return QString(); // exportcsv/firstrowheader? if(group == "exportcsv" && name == "firstrowheader") @@ -137,15 +137,15 @@ QVariant Settings::getDefaultValue(const std::string& group, const std::string& // MainWindow/geometry? if(group == "MainWindow" && name == "geometry") - return ""; + return QString(); // MainWindow/windowState? if(group == "MainWindow" && name == "windowState") - return ""; + return QString(); // MainWindow/openTabs? if(group == "MainWindow" && name == "openTabs") - return ""; + return QString(); // SQLLogDock/Log? if(group == "SQLLogDock" && name == "Log") @@ -208,6 +208,8 @@ QVariant Settings::getDefaultValue(const std::string& group, const std::string& return 5000; if(name == "complete_threshold") return 1000; + if(name == "image_preview") + return false; if(name == "indent_compact") return false; if(name == "auto_switch_mode") diff --git a/src/Settings.h b/src/Settings.h index 08f6de2f..c5aae15a 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -19,7 +19,7 @@ public: static void restoreDefaults(); private: - Settings() { } // class is fully static + Settings() = delete; // class is fully static // This works similar to getValue but returns the default value instead of the value set by the user static QVariant getDefaultValue(const std::string& group, const std::string& name); diff --git a/src/SqlExecutionArea.cpp b/src/SqlExecutionArea.cpp index 5b8a3877..0e2f30c3 100644 --- a/src/SqlExecutionArea.cpp +++ b/src/SqlExecutionArea.cpp @@ -22,21 +22,20 @@ SqlExecutionArea::SqlExecutionArea(DBBrowserDB& _db, QWidget* parent) : ui->setupUi(this); // Create model - model = new SqliteTableModel(db, this, static_cast(Settings::getValue("db", "prefetchsize").toUInt())); + model = new SqliteTableModel(db, this); ui->tableResult->setModel(model); connect(model, &SqliteTableModel::finishedFetch, this, &SqlExecutionArea::fetchedData); ui->findFrame->hide(); QShortcut* shortcutHideFind = new QShortcut(QKeySequence("ESC"), ui->findLineEdit); - connect(shortcutHideFind, SIGNAL(activated()), this, SLOT(hideFindFrame())); + connect(shortcutHideFind, &QShortcut::activated, this, &SqlExecutionArea::hideFindFrame); - connect(ui->findLineEdit, SIGNAL(textChanged(const QString &)), - this, SLOT(findLineEdit_textChanged(const QString &))); - connect(ui->previousToolButton, SIGNAL(clicked()), this, SLOT(findPrevious())); - connect(ui->nextToolButton, SIGNAL(clicked()), this, SLOT(findNext())); - connect(ui->findLineEdit, SIGNAL(returnPressed()), this, SLOT(findNext())); - connect(ui->hideFindButton, SIGNAL(clicked()), this, SLOT(hideFindFrame())); + connect(ui->findLineEdit, &QLineEdit::textChanged, this, &SqlExecutionArea::findLineEdit_textChanged); + connect(ui->previousToolButton, &QToolButton::clicked, this, &SqlExecutionArea::findPrevious); + connect(ui->nextToolButton, &QToolButton::clicked, this, &SqlExecutionArea::findNext); + connect(ui->findLineEdit, &QLineEdit::returnPressed, this, &SqlExecutionArea::findNext); + connect(ui->hideFindButton, &QToolButton::clicked, this, &SqlExecutionArea::hideFindFrame); connect(&fileSystemWatch, &QFileSystemWatcher::fileChanged, this, &SqlExecutionArea::fileChanged); @@ -70,6 +69,11 @@ QString SqlExecutionArea::getSelectedSql() const return ui->editEditor->selectedText().trimmed().replace(QChar(0x2029), '\n'); } +void SqlExecutionArea::setSql(const QString& sql) +{ + ui->editEditor->setText(sql); +} + void SqlExecutionArea::finishExecution(const QString& result, const bool ok) { error_state = !ok; @@ -145,8 +149,8 @@ void SqlExecutionArea::reloadSettings() ui->splitter->restoreState(Settings::getValue("editor", "splitter1_sizes").toByteArray()); ui->splitter_2->restoreState(Settings::getValue("editor", "splitter2_sizes").toByteArray()); - // Set prefetch settings - model->setChunkSize(static_cast(Settings::getValue("db", "prefetchsize").toUInt())); + // Reload model settings + model->reloadSettings(); // Check if error indicators are enabled for the not-ok background clue showErrorIndicators = Settings::getValue("editor", "error_indicators").toBool(); @@ -167,7 +171,7 @@ void SqlExecutionArea::find(QString expr, bool forward) forward); // Set reddish background when not found - if (found || expr == "") + if (found || expr.isEmpty()) ui->findLineEdit->setStyleSheet(""); else ui->findLineEdit->setStyleSheet("QLineEdit {color: white; background-color: rgb(255, 102, 102)}"); @@ -267,6 +271,8 @@ void SqlExecutionArea::saveFile(const QString& filename) // Write to the file if(f.write(getSql().toUtf8()) != -1) { + // Close file now. If we let the destructor close it, we can get change notifications. + f.close(); // Set modified to false so we can get control of unsaved changes when closing. ui->editEditor->setModified(false); @@ -292,7 +298,7 @@ void SqlExecutionArea::fileChanged(const QString& filename) if(QMessageBox::question( this, qApp->applicationName(), - tr("The file \"%1\" was modified by another program. Do you want to reload it?%2").arg(filename).arg(changes), + tr("The file \"%1\" was modified by another program. Do you want to reload it?%2").arg(filename, changes), QMessageBox::Yes | QMessageBox::Ignore) == QMessageBox::Yes) { // Read in the file diff --git a/src/SqlExecutionArea.h b/src/SqlExecutionArea.h index 142cecc3..fa67cf95 100644 --- a/src/SqlExecutionArea.h +++ b/src/SqlExecutionArea.h @@ -25,6 +25,7 @@ public: QString getSql() const; QString getSelectedSql() const; + void setSql(const QString& sql); void openFile(const QString& filename); void saveFile(const QString& filename); diff --git a/src/TableBrowser.cpp b/src/TableBrowser.cpp new file mode 100644 index 00000000..d6e2bcef --- /dev/null +++ b/src/TableBrowser.cpp @@ -0,0 +1,1583 @@ +#include "AddRecordDialog.h" +#include "Application.h" +#include "ColumnDisplayFormatDialog.h" +#include "CondFormatManager.h" +#include "Data.h" +#include "DbStructureModel.h" +#include "ExportDataDialog.h" +#include "FilterTableHeader.h" +#include "TableBrowser.h" +#include "Settings.h" +#include "sqlitedb.h" +#include "sqlitetablemodel.h" +#include "ui_TableBrowser.h" + +#include +#include +#include +#include +#include +#include +#include + +QMap TableBrowser::m_settings; +QString TableBrowser::m_defaultEncoding; + +TableBrowser::TableBrowser(QWidget* parent) : + QWidget(parent), + ui(new Ui::TableBrowser), + gotoValidator(new QIntValidator(0, 0, this)), + db(nullptr), + dbStructureModel(nullptr), + m_model(nullptr), + m_adjustRows(false), + m_columnsResized(false) +{ + ui->setupUi(this); + + // Set the validator for the goto line edit + ui->editGoto->setValidator(gotoValidator); + + // Set custom placeholder text for global filter field and disable conditional formats + ui->editGlobalFilter->setPlaceholderText(tr("Filter in all columns")); + ui->editGlobalFilter->setConditionFormatContextMenuEnabled(false); + + // Set up popup menus + popupNewRecordMenu = new QMenu(this); + popupNewRecordMenu->addAction(ui->newRecordAction); + popupNewRecordMenu->addAction(ui->insertValuesAction); + ui->actionNewRecord->setMenu(popupNewRecordMenu); + + popupSaveFilterAsMenu = new QMenu(this); + popupSaveFilterAsMenu->addAction(ui->actionFilteredTableExportCsv); + popupSaveFilterAsMenu->addAction(ui->actionFilterSaveAsView); + ui->actionSaveFilterAsPopup->setMenu(popupSaveFilterAsMenu); + qobject_cast(ui->browseToolbar->widgetForAction(ui->actionSaveFilterAsPopup))->setPopupMode(QToolButton::InstantPopup); + + popupHeaderMenu = new QMenu(this); + popupHeaderMenu->addAction(ui->actionShowRowidColumn); + popupHeaderMenu->addAction(ui->actionHideColumns); + popupHeaderMenu->addAction(ui->actionShowAllColumns); + popupHeaderMenu->addAction(ui->actionSelectColumn); + popupHeaderMenu->addSeparator(); + popupHeaderMenu->addAction(ui->actionUnlockViewEditing); + popupHeaderMenu->addAction(ui->actionBrowseTableEditDisplayFormat); + popupHeaderMenu->addSeparator(); + popupHeaderMenu->addAction(ui->actionSetTableEncoding); + popupHeaderMenu->addAction(ui->actionSetAllTablesEncoding); + + connect(ui->actionSelectColumn, &QAction::triggered, [this]() { + ui->dataTable->selectColumn(ui->actionBrowseTableEditDisplayFormat->property("clicked_column").toInt()); + }); + + // Set up shortcuts + QShortcut* dittoRecordShortcut = new QShortcut(QKeySequence("Ctrl+\""), this); + connect(dittoRecordShortcut, &QShortcut::activated, [this]() { + int currentRow = ui->dataTable->currentIndex().row(); + duplicateRecord(currentRow); + }); + + // Lambda function for keyboard shortcuts for selecting next/previous table in Browse Data tab + connect(ui->dataTable, &ExtendedTableWidget::switchTable, [this](bool next) { + int index = ui->comboBrowseTable->currentIndex(); + int num_items = ui->comboBrowseTable->count(); + if(next) + { + if(++index >= num_items) + index = 0; + } else { + if(--index < 0) + index = num_items - 1; + } + ui->comboBrowseTable->setCurrentIndex(index); + updateTable(); + }); + + // Add the documentation of shortcuts, which aren't otherwise visible in the user interface, to some buttons. + addShortcutsTooltip(ui->actionRefresh, {QKeySequence(tr("Ctrl+R"))}); + addShortcutsTooltip(ui->actionPrintTable); + + // Set up filters + connect(ui->dataTable->filterHeader(), &FilterTableHeader::filterChanged, this, &TableBrowser::updateFilter); + connect(ui->dataTable->filterHeader(), &FilterTableHeader::addCondFormat, this, &TableBrowser::addCondFormatFromFilter); + connect(ui->dataTable->filterHeader(), &FilterTableHeader::allCondFormatsCleared, this, &TableBrowser::clearAllCondFormats); + connect(ui->dataTable->filterHeader(), &FilterTableHeader::condFormatsEdited, this, &TableBrowser::editCondFormats); + connect(ui->dataTable, &ExtendedTableWidget::editCondFormats, this, &TableBrowser::editCondFormats); + + // Set up global filter + connect(ui->editGlobalFilter, &FilterLineEdit::delayedTextChanged, this, [this](const QString& value) { + // Split up filter values + QStringList values = value.trimmed().split(" ", QString::SkipEmptyParts); + std::vector filters; + for(const auto& s : values) + filters.push_back(s); + + // Have they changed? + BrowseDataTableSettings& settings = m_settings[currentlyBrowsedTableName()]; + if(filters != settings.globalFilters) + { + // Set global filters + m_model->updateGlobalFilter(filters); + updateRecordsetLabel(); + + // Save them + settings.globalFilters = filters; + emit projectModified(); + } + }); + + connect(ui->dataTable, &ExtendedTableWidget::doubleClicked, this, &TableBrowser::selectionChangedByDoubleClick); + connect(ui->dataTable->filterHeader(), &FilterTableHeader::sectionClicked, this, &TableBrowser::headerClicked); + connect(ui->dataTable->filterHeader(), &QHeaderView::sectionDoubleClicked, ui->dataTable, &QTableView::selectColumn); + connect(ui->dataTable->verticalScrollBar(), &QScrollBar::valueChanged, this, &TableBrowser::updateRecordsetLabel); + connect(ui->dataTable->horizontalHeader(), &QHeaderView::sectionResized, this, &TableBrowser::updateColumnWidth); + connect(ui->dataTable->horizontalHeader(), &QHeaderView::customContextMenuRequested, this, &TableBrowser::showDataColumnPopupMenu); + connect(ui->dataTable->verticalHeader(), &QHeaderView::customContextMenuRequested, this, &TableBrowser::showRecordPopupMenu); + connect(ui->dataTable, &ExtendedTableWidget::openFileFromDropEvent, this, &TableBrowser::requestFileOpen); + connect(ui->dataTable, &ExtendedTableWidget::selectedRowsToBeDeleted, this, &TableBrowser::deleteRecord); + + connect(ui->fontComboBox, &QFontComboBox::currentFontChanged, this, [this](const QFont &font) { + modifyFormat([font](CondFormat& format) { format.setFontFamily(font.family()); }); + }); + connect(ui->fontSizeBox, static_cast(&QSpinBox::valueChanged), this, + [this](int pointSize) { + modifyFormat([pointSize](CondFormat& format) { format.setFontPointSize(pointSize); }); + }); + + connect(ui->actionFontColor, &QAction::triggered, this, [this]() { + QColor color = QColorDialog::getColor(QColor(m_model->data(currentIndex(), Qt::ForegroundRole).toString())); + if(color.isValid()) + modifyFormat([color](CondFormat& format) { format.setForegroundColor(color); }); + }); + connect(ui->actionBackgroundColor, &QAction::triggered, this, [this]() { + QColor color = QColorDialog::getColor(QColor(m_model->data(currentIndex(), Qt::BackgroundRole).toString())); + if(color.isValid()) + modifyFormat([color](CondFormat& format) { format.setBackgroundColor(color); }); + }); + + connect(ui->actionBold, &QAction::toggled, this, [this](bool checked) { + modifyFormat([checked](CondFormat& format) { format.setBold(checked); }); + }); + connect(ui->actionItalic, &QAction::toggled, this, [this](bool checked) { + modifyFormat([checked](CondFormat& format) { format.setItalic(checked); }); + }); + connect(ui->actionUnderline, &QAction::toggled, this, [this](bool checked) { + modifyFormat([checked](CondFormat& format) { format.setUnderline(checked); }); + }); + + connect(ui->actionLeftAlign, &QAction::triggered, this, [this]() { + ui->actionLeftAlign->setChecked(true); + ui->actionRightAlign->setChecked(false); + ui->actionCenter->setChecked(false); + ui->actionJustify->setChecked(false); + modifyFormat([](CondFormat& format) { format.setAlignment(CondFormat::AlignLeft); }); + }); + connect(ui->actionRightAlign, &QAction::triggered, this, [this]() { + ui->actionLeftAlign->setChecked(false); + ui->actionRightAlign->setChecked(true); + ui->actionCenter->setChecked(false); + ui->actionJustify->setChecked(false); + modifyFormat([](CondFormat& format) { format.setAlignment(CondFormat::AlignRight); }); + }); + connect(ui->actionCenter, &QAction::triggered, this, [this]() { + ui->actionLeftAlign->setChecked(false); + ui->actionRightAlign->setChecked(false); + ui->actionCenter->setChecked(true); + ui->actionJustify->setChecked(false); + modifyFormat([](CondFormat& format) { format.setAlignment(CondFormat::AlignCenter); }); + }); + connect(ui->actionJustify, &QAction::triggered, this, [this]() { + ui->actionLeftAlign->setChecked(false); + ui->actionRightAlign->setChecked(false); + ui->actionCenter->setChecked(false); + ui->actionJustify->setChecked(true); + modifyFormat([](CondFormat& format) { format.setAlignment(CondFormat::AlignJustify); }); + }); + + connect(ui->actionEditCondFormats, &QAction::triggered, this, [this]() { editCondFormats(static_cast(currentIndex().column())); }); + connect(ui->actionClearFormat, &QAction::triggered, this, [this]() { + for (const size_t column : ui->dataTable->selectedCols()) + clearAllCondFormats(column); + for (const QModelIndex& index : ui->dataTable->selectionModel()->selectedIndexes()) + clearRowIdFormats(index); + + }); + + connect(ui->dataTable, &ExtendedTableWidget::currentIndexChanged, this, [this](const QModelIndex ¤t, const QModelIndex &) { + // Get cell current format for updating the format toolbar values. Block signals, so the format change is not reapplied. + QFont font; + font.fromString(m_model->data(current, Qt::FontRole).toString()); + ui->fontComboBox->blockSignals(true); + ui->fontComboBox->setCurrentFont(font); + ui->fontComboBox->blockSignals(false); + + ui->fontSizeBox->blockSignals(true); + ui->fontSizeBox->setValue(font.pointSize()); + ui->fontSizeBox->blockSignals(false); + + ui->actionBold->blockSignals(true); + ui->actionBold->setChecked(font.bold()); + ui->actionBold->blockSignals(false); + + ui->actionItalic->blockSignals(true); + ui->actionItalic->setChecked(font.italic()); + ui->actionItalic->blockSignals(false); + + ui->actionUnderline->blockSignals(true); + ui->actionUnderline->setChecked(font.underline()); + ui->actionUnderline->blockSignals(false); + + Qt::Alignment align = Qt::Alignment(m_model->data(current, Qt::TextAlignmentRole).toInt()); + ui->actionLeftAlign->blockSignals(true); + ui->actionLeftAlign->setChecked(align.testFlag(Qt::AlignLeft)); + ui->actionLeftAlign->blockSignals(false); + + ui->actionRightAlign->blockSignals(true); + ui->actionRightAlign->setChecked(align.testFlag(Qt::AlignRight)); + ui->actionRightAlign->blockSignals(false); + + ui->actionCenter->blockSignals(true); + ui->actionCenter->setChecked(align.testFlag(Qt::AlignCenter)); + ui->actionCenter->blockSignals(false); + + ui->actionJustify->blockSignals(true); + ui->actionJustify->setChecked(align.testFlag(Qt::AlignJustify)); + ui->actionJustify->blockSignals(false); + }); + + connect(ui->actionToggleFormatToolbar, &QAction::toggled, ui->formatFrame, &QFrame::setVisible); + ui->actionToggleFormatToolbar->setChecked(false); + ui->formatFrame->setVisible(false); + + // Set up find frame + ui->frameFind->hide(); + + QShortcut* shortcutHideFindFrame = new QShortcut(QKeySequence("ESC"), ui->editFindExpression); + connect(shortcutHideFindFrame, &QShortcut::activated, ui->buttonFindClose, &QToolButton::click); + + connect(ui->actionFind, &QAction::triggered, [this](bool checked) { + if(checked) + { + ui->widgetReplace->hide(); + ui->frameFind->show(); + ui->editFindExpression->setFocus(); + ui->actionReplace->setChecked(false); + } else { + ui->buttonFindClose->click(); + } + }); + connect(ui->actionReplace, &QAction::triggered, [this](bool checked) { + if(checked) + { + ui->widgetReplace->show(); + ui->frameFind->show(); + ui->editFindExpression->setFocus(); + ui->actionFind->setChecked(false); + } else { + ui->buttonFindClose->click(); + } + }); + + connect(ui->editFindExpression, &QLineEdit::returnPressed, ui->buttonFindNext, &QToolButton::click); + connect(ui->editFindExpression, &QLineEdit::textChanged, this, [this]() { + // When the text has changed but neither Return nor F3 or similar nor any buttons were pressed, we want to include the current + // cell in the search as well. This makes sure the selected cell does not jump around every time the text is changed but only + // when the current cell does not match the search expression anymore. + find(ui->editFindExpression->text(), true, true); + }); + connect(ui->buttonFindClose, &QToolButton::clicked, this, [this](){ + ui->dataTable->setFocus(); + ui->frameFind->hide(); + ui->actionFind->setChecked(false); + ui->actionReplace->setChecked(false); + }); + connect(ui->buttonFindPrevious, &QToolButton::clicked, this, [this](){ + find(ui->editFindExpression->text(), false); + }); + connect(ui->buttonFindNext, &QToolButton::clicked, this, [this](){ + find(ui->editFindExpression->text(), true); + }); + connect(ui->buttonReplaceNext, &QToolButton::clicked, this, [this](){ + find(ui->editFindExpression->text(), true, true, ReplaceMode::ReplaceNext); + }); + connect(ui->buttonReplaceAll, &QToolButton::clicked, this, [this](){ + find(ui->editFindExpression->text(), true, true, ReplaceMode::ReplaceAll); + }); +} + +TableBrowser::~TableBrowser() +{ + delete gotoValidator; + delete ui; +} + +void TableBrowser::init(DBBrowserDB* _db) +{ + db = _db; + + if(m_model) + delete m_model; + m_model = new SqliteTableModel(*db, this); + + connect(m_model, &SqliteTableModel::finishedFetch, this, &TableBrowser::fetchedData); + +} + +void TableBrowser::reset() +{ + // Reset the model + if(m_model) + m_model->reset(); + + // Remove all stored table information browse data tab + m_settings.clear(); + m_defaultEncoding = QString(); + + // Reset the recordset label inside the Browse tab now + updateRecordsetLabel(); + + // Clear filters + clearFilters(); + + // Reset the plot dock model and connection + emit updatePlot(nullptr, nullptr, nullptr, true); +} + +sqlb::ObjectIdentifier TableBrowser::currentlyBrowsedTableName() const +{ + return sqlb::ObjectIdentifier(ui->comboBrowseTable->model()->data(dbStructureModel->index(ui->comboBrowseTable->currentIndex(), + DbStructureModel::ColumnSchema, + ui->comboBrowseTable->rootModelIndex())).toString().toStdString(), + ui->comboBrowseTable->currentData(Qt::EditRole).toString().toStdString()); // Use the edit role here to make sure we actually get the + // table name without the schema bit in front of it. +} + +BrowseDataTableSettings& TableBrowser::settings(const sqlb::ObjectIdentifier& object) +{ + return m_settings[object]; +} + +void TableBrowser::setSettings(const sqlb::ObjectIdentifier& table, const BrowseDataTableSettings& table_settings) +{ + m_settings[table] = table_settings; +} + +void TableBrowser::setStructure(QAbstractItemModel* model, const QString& old_table) +{ + dbStructureModel = model; + ui->comboBrowseTable->setModel(model); + + ui->comboBrowseTable->setRootModelIndex(dbStructureModel->index(0, 0)); // Show the 'browsable' section of the db structure tree + int old_table_index = ui->comboBrowseTable->findText(old_table); + if(old_table_index == -1 && ui->comboBrowseTable->count()) // If the old table couldn't be found anymore but there is another table, select that + ui->comboBrowseTable->setCurrentIndex(0); + else if(old_table_index == -1) // If there aren't any tables to be selected anymore, clear the table view + clear(); + else // Under normal circumstances just select the old table again + ui->comboBrowseTable->setCurrentIndex(old_table_index); +} + +QModelIndex TableBrowser::currentIndex() const +{ + return ui->dataTable->currentIndex(); +} + +void TableBrowser::setEnabled(bool enable) +{ + ui->browseToolbar->setEnabled(enable); + ui->editGlobalFilter->setEnabled(enable); + ui->formatFrame->setEnabled(enable); + ui->frameFind->setEnabled(enable); + + ui->buttonNext->setEnabled(enable); + ui->buttonPrevious->setEnabled(enable); + ui->buttonBegin->setEnabled(enable); + ui->buttonEnd->setEnabled(enable); + ui->buttonGoto->setEnabled(enable); + ui->editGoto->setEnabled(enable); + + updateInsertDeleteRecordButton(); +} + +void TableBrowser::updateTable() +{ + // Remove the model-view link if the table name is empty in order to remove any data from the view + if(ui->comboBrowseTable->model()->rowCount(ui->comboBrowseTable->rootModelIndex()) == 0) + { + clear(); + return; + } + + // Restore default value that could have been modified in updateFilter or browseTableHeaderClicked + ui->dataTable->verticalHeader()->setMinimumWidth(0); + + // Get current table name + sqlb::ObjectIdentifier tablename = currentlyBrowsedTableName(); + + // Set model + bool reconnectSelectionSignals = false; + if(ui->dataTable->model() == nullptr) + reconnectSelectionSignals = true; + ui->dataTable->setModel(m_model); + if(reconnectSelectionSignals) + { + connect(ui->dataTable->selectionModel(), &QItemSelectionModel::currentChanged, this, &TableBrowser::selectionChanged); + connect(ui->dataTable->selectionModel(), &QItemSelectionModel::selectionChanged, [this](const QItemSelection&, const QItemSelection&) { + updateInsertDeleteRecordButton(); + + const QModelIndexList& sel = ui->dataTable->selectionModel()->selectedIndexes(); + QString statusMessage; + if (sel.count() > 1) { + int rows = sel.last().row() - sel.first().row() + 1; + statusMessage = tr("%n row(s)", "", rows); + int columns = sel.last().column() - sel.first().column() + 1; + statusMessage += tr(", %n column(s)", "", columns); + + if (sel.count() < Settings::getValue("databrowser", "complete_threshold").toInt()) { + double sum = 0; + double first = m_model->data(sel.first(), Qt::EditRole).toDouble(); + double min = first; + double max = first; + for (const QModelIndex& index : sel) { + double dblData = m_model->data(index, Qt::EditRole).toDouble(); + sum += dblData; + min = std::min(min, dblData); + max = std::max(max, dblData); + } + statusMessage += tr(". Sum: %1; Average: %2; Min: %3; Max: %4").arg(sum).arg(sum/sel.count()).arg(min).arg(max); + } + } + emit statusMessageRequested(statusMessage); + }); + } + // Search stored table settings for this table + bool storedDataFound = m_settings.contains(tablename); + + // Set new table + if(!storedDataFound) + { + // No stored settings found. + + // Set table name and apply default display format settings + m_model->setQuery(sqlb::Query(tablename)); + + // There aren't any information stored for this table yet, so use some default values + + // Hide rowid column. Needs to be done before the column widths setting because of the workaround in there + showRowidColumn(false); + + // Unhide all columns by default + on_actionShowAllColumns_triggered(); + + // Enable editing in general, but lock view editing + unlockViewEditing(false); + + // Prepare for setting an initial column width based on the content. + m_columnsResized = false; + + // Encoding + m_model->setEncoding(m_defaultEncoding); + + // Global filter + ui->editGlobalFilter->clear(); + + updateRecordsetLabel(); + + // Plot + emit updatePlot(ui->dataTable, m_model, &m_settings[tablename], true); + + // The filters can be left empty as they are + } else { + // Stored settings found. Retrieve them and assemble a query from them. + BrowseDataTableSettings storedData = m_settings[tablename]; + sqlb::Query query(tablename); + + // Sorting + query.setOrderBy(storedData.query.orderBy()); + + // Filters + for(auto it=storedData.filterValues.constBegin();it!=storedData.filterValues.constEnd();++it) + query.where().insert({it.key(), CondFormat::filterToSqlCondition(it.value(), m_model->encoding())}); + + // Global filter + for(const auto& f : storedData.globalFilters) + query.globalWhere().push_back(CondFormat::filterToSqlCondition(f, m_model->encoding())); + + // Display formats + bool only_defaults = true; + if(db->getObjectByName(tablename)) + { + const sqlb::FieldInfoList& tablefields = db->getObjectByName(tablename)->fieldInformation(); + for(size_t i=0; i(i)+1]; + if(format.size()) + { + query.selectedColumns().emplace_back(tablefields.at(i).name, format.toStdString()); + only_defaults = false; + } else { + query.selectedColumns().emplace_back(tablefields.at(i).name, tablefields.at(i).name); + } + } + } + if(only_defaults) + query.selectedColumns().clear(); + + // Unlock view editing + query.setRowIdColumn(storedData.unlockViewPk.toStdString()); + + // Apply query + m_model->setQuery(query); + + // There is information stored for this table, so extract it and apply it + applySettings(storedData); + + updateRecordsetLabel(); + + // Plot + emit updatePlot(ui->dataTable, m_model, &m_settings[tablename], false); + } + + + // Show/hide menu options depending on whether this is a table or a view + if(db->getObjectByName(currentlyBrowsedTableName()) && db->getObjectByName(currentlyBrowsedTableName())->type() == sqlb::Object::Table) + { + // Table + sqlb::TablePtr table = db->getObjectByName(currentlyBrowsedTableName()); + ui->actionUnlockViewEditing->setVisible(false); + ui->actionShowRowidColumn->setVisible(!table->withoutRowidTable()); + } else { + // View + ui->actionUnlockViewEditing->setVisible(true); + ui->actionShowRowidColumn->setVisible(false); + } + + updateInsertDeleteRecordButton(); +} + +void TableBrowser::clearFilters() +{ + ui->dataTable->filterHeader()->clearFilters(); + ui->editGlobalFilter->clear(); +} + +void TableBrowser::reloadSettings() +{ + ui->dataTable->reloadSettings(); + + ui->browseToolbar->setToolButtonStyle(static_cast(Settings::getValue("General", "toolbarStyleBrowse").toInt())); + m_model->reloadSettings(); +} + +void TableBrowser::setCurrentTable(const sqlb::ObjectIdentifier& name) +{ + ui->comboBrowseTable->setCurrentIndex(ui->comboBrowseTable->findText(QString::fromStdString(name.toDisplayString()))); +} + +void TableBrowser::clear() +{ + if (!ui->dataTable->model()) + return; + + ui->dataTable->setModel(nullptr); + if(qobject_cast(ui->dataTable->horizontalHeader())) + qobject_cast(ui->dataTable->horizontalHeader())->generateFilters(0); + + ui->editGlobalFilter->blockSignals(true); + ui->editGlobalFilter->clear(); + ui->editGlobalFilter->blockSignals(false); +} + +void TableBrowser::updateFilter(size_t column, const QString& value) +{ + // Set minimum width to the vertical header in order to avoid flickering while a filter is being updated. + ui->dataTable->verticalHeader()->setMinimumWidth(ui->dataTable->verticalHeader()->width()); + + m_model->updateFilter(column, value); + BrowseDataTableSettings& settings = m_settings[currentlyBrowsedTableName()]; + if(value.isEmpty() && settings.filterValues.remove(static_cast(column)) > 0) + { + emit projectModified(); + } else { + if (settings.filterValues[static_cast(column)] != value) { + settings.filterValues[static_cast(column)] = value; + emit projectModified(); + } + } + + updateRecordsetLabel(); + + // Reapply the view settings. This seems to be necessary as a workaround for newer Qt versions. + applySettings(settings, true); +} + +void TableBrowser::addCondFormatFromFilter(size_t column, const QString& value) +{ + QFont font = QFont(Settings::getValue("databrowser", "font").toString()); + font.setPointSize(Settings::getValue("databrowser", "fontsize").toInt()); + + // Create automatically a new conditional format with the next serial background color according to the theme and the regular foreground + // color and font in the settings. + CondFormat newCondFormat(value, QColor(Settings::getValue("databrowser", "reg_fg_colour").toString()), + m_condFormatPalette.nextSerialColor(Palette::appHasDarkTheme()), + font, + CondFormat::AlignLeft, + m_model->encoding()); + addCondFormat(false, column, newCondFormat); +} + +void TableBrowser::addCondFormat(bool isRowIdFormat, size_t column, const CondFormat& newCondFormat) +{ + BrowseDataTableSettings& settings = m_settings[currentlyBrowsedTableName()]; + std::vector& formats = isRowIdFormat ? settings.rowIdFormats[column] : settings.condFormats[column]; + m_model->addCondFormat(isRowIdFormat, column, newCondFormat); + // Conditionless formats are pushed back and others inserted at the begining, so they aren't eclipsed. + if (newCondFormat.filter().isEmpty()) + formats.push_back(newCondFormat); + else + formats.insert(formats.begin(), newCondFormat); +} + +void TableBrowser::clearAllCondFormats(size_t column) +{ + std::vector emptyCondFormatVector = std::vector(); + m_model->setCondFormats(false, column, emptyCondFormatVector); + m_settings[currentlyBrowsedTableName()].condFormats[column].clear(); + emit projectModified(); +} + +void TableBrowser::clearRowIdFormats(const QModelIndex index) +{ + + std::vector& rowIdFormats = m_settings[currentlyBrowsedTableName()].rowIdFormats[static_cast(index.column())]; + rowIdFormats.erase(std::remove_if(rowIdFormats.begin(), rowIdFormats.end(), [&](const CondFormat& format) { + return format.filter() == QString("=%1").arg(m_model->data(index.sibling(index.row(), 0)).toString()); + }), rowIdFormats.end()); + m_model->setCondFormats(true, static_cast(index.column()), rowIdFormats); + emit projectModified(); + +} + +void TableBrowser::editCondFormats(size_t column) +{ + CondFormatManager condFormatDialog(m_settings[currentlyBrowsedTableName()].condFormats[column], + m_model->encoding(), this); + condFormatDialog.setWindowTitle(tr("Conditional formats for \"%1\""). + arg(m_model->headerData(static_cast(column), Qt::Horizontal, Qt::EditRole).toString())); + if (condFormatDialog.exec()) { + std::vector condFormatVector = condFormatDialog.getCondFormats(); + m_model->setCondFormats(false, column, condFormatVector); + m_settings[currentlyBrowsedTableName()].condFormats[column] = condFormatVector; + emit projectModified(); + } +} +void TableBrowser::modifySingleFormat(const bool isRowIdFormat, const QString& filter, const QModelIndex refIndex, std::function changeFunction) +{ + const size_t column = static_cast(refIndex.column()); + BrowseDataTableSettings& settings = m_settings[currentlyBrowsedTableName()]; + std::vector& formats = isRowIdFormat ? settings.rowIdFormats[column] : settings.condFormats[column]; + auto it = std::find_if(formats.begin(), formats.end(), [&filter](const CondFormat& format) { + return format.filter() == filter; + }); + if(it != formats.end()) { + changeFunction(*it); + m_model->addCondFormat(isRowIdFormat, column, *it); + } else { + // Create a new conditional format based on the current reference index and then modify it as requested using the passed function. + CondFormat newCondFormat(filter, m_model, refIndex, m_model->encoding()); + changeFunction(newCondFormat); + addCondFormat(isRowIdFormat, column, newCondFormat); + } +} + +void TableBrowser::modifyFormat(std::function changeFunction) +{ + // Modify the conditional formats from entirely selected columns having the current filter value, + // or modify the row-id formats of selected cells, when the selection does not cover entire columns. + const std::unordered_set& columns = ui->dataTable->selectedCols(); + if (columns.size() > 0) { + for (size_t column : columns) { + const QString& filter = m_settings[currentlyBrowsedTableName()].filterValues.value(static_cast(column)); + modifySingleFormat(false, filter, currentIndex().sibling(currentIndex().row(), static_cast(column)), changeFunction); + } + } else { + for(const QModelIndex& index : ui->dataTable->selectionModel()->selectedIndexes()) { + const QString filter = QString("=%1").arg(m_model->data(index.sibling(index.row(), 0)).toString()); + modifySingleFormat(true, filter, index, changeFunction); + } + } + emit projectModified(); +} + +void TableBrowser::updateRecordsetLabel() +{ + // Get all the numbers, i.e. the number of the first row and the last row as well as the total number of rows + int from = ui->dataTable->verticalHeader()->visualIndexAt(0) + 1; + int total = m_model->rowCount(); + int to = ui->dataTable->verticalHeader()->visualIndexAt(ui->dataTable->height()) - 1; + if (to == -2) + to = total; + + // Update the validator of the goto row field + gotoValidator->setRange(0, total); + + // When there is no query for this table (i.e. no table is selected), there is no row count query either which in turn means + // that the row count query will never finish. And because of this the row count will be forever unknown. To avoid always showing + // a misleading "determining row count" text in the UI we set the row count status to complete here for empty queries. + auto row_count_available = m_model->rowCountAvailable(); + if(m_model->query().empty()) + row_count_available = SqliteTableModel::RowCount::Complete; + + // Update the label showing the current position + QString txt; + switch(row_count_available) + { + case SqliteTableModel::RowCount::Unknown: + txt = tr("determining row count..."); + break; + case SqliteTableModel::RowCount::Partial: + txt = tr("%1 - %2 of >= %3").arg(from).arg(to).arg(total); + break; + case SqliteTableModel::RowCount::Complete: + txt = tr("%1 - %2 of %3").arg(from).arg(to).arg(total); + break; + } + ui->labelRecordset->setText(txt); + + // Enable editing only for tables or views with editing unlocked for which the row count is already available + sqlb::ObjectIdentifier current_table = currentlyBrowsedTableName(); + bool is_table_or_unlocked_view = !m_model->query().empty() && db->getObjectByName(current_table) && ( + (db->getObjectByName(current_table)->type() == sqlb::Object::View && m_model->hasPseudoPk()) || + (db->getObjectByName(current_table)->type() == sqlb::Object::Table)); + enableEditing(m_model->rowCountAvailable() != SqliteTableModel::RowCount::Unknown && is_table_or_unlocked_view); +} + +void TableBrowser::applySettings(const BrowseDataTableSettings& storedData, bool skipFilters) +{ + // We don't want to pass storedData by reference because the functions below would change the referenced data in their original + // place, thus modifiying the data this function can use. To have a static description of what the view should look like we want + // a copy here. + + // Show rowid column. Needs to be done before the column widths setting because of the workaround in there and before the filter setting + // because of the filter row generation. + showRowidColumn(storedData.showRowid, skipFilters); + + // Enable editing in general and (un)lock view editing depending on the settings + unlockViewEditing(!storedData.unlockViewPk.isEmpty() && storedData.unlockViewPk != "_rowid_", storedData.unlockViewPk); + + // Column hidden status + on_actionShowAllColumns_triggered(); + for(auto hiddenIt=storedData.hiddenColumns.constBegin();hiddenIt!=storedData.hiddenColumns.constEnd();++hiddenIt) + hideColumns(hiddenIt.key(), hiddenIt.value()); + + // Column widths + for(auto widthIt=storedData.columnWidths.constBegin();widthIt!=storedData.columnWidths.constEnd();++widthIt) + ui->dataTable->setColumnWidth(widthIt.key(), widthIt.value()); + m_columnsResized = true; + + // Filters + if(!skipFilters) + { + // Set filters blocking signals, since the filter is already applied to the browse table model + FilterTableHeader* filterHeader = qobject_cast(ui->dataTable->horizontalHeader()); + bool oldState = filterHeader->blockSignals(true); + for(auto filterIt=storedData.filterValues.constBegin();filterIt!=storedData.filterValues.constEnd();++filterIt) + filterHeader->setFilter(static_cast(filterIt.key()), filterIt.value()); + + // Regular conditional formats + for(auto formatIt=storedData.condFormats.constBegin(); formatIt!=storedData.condFormats.constEnd(); ++formatIt) + m_model->setCondFormats(false, formatIt.key(), formatIt.value()); + + // Row Id formats + for(auto formatIt=storedData.rowIdFormats.constBegin(); formatIt!=storedData.rowIdFormats.constEnd(); ++formatIt) + m_model->setCondFormats(true, formatIt.key(), formatIt.value()); + + filterHeader->blockSignals(oldState); + + ui->editGlobalFilter->blockSignals(true); + QString text; + for(const auto& f : storedData.globalFilters) + text += f + " "; + text.chop(1); + ui->editGlobalFilter->setText(text); + ui->editGlobalFilter->blockSignals(false); + } + + // Encoding + m_model->setEncoding(storedData.encoding); +} + +void TableBrowser::enableEditing(bool enable_edit) +{ + // Don't enable anything if this is a read only database + bool edit = enable_edit && !db->readOnly(); + + // Apply settings + ui->dataTable->setEditTriggers(edit ? QAbstractItemView::SelectedClicked | QAbstractItemView::AnyKeyPressed | QAbstractItemView::EditKeyPressed : QAbstractItemView::NoEditTriggers); + updateInsertDeleteRecordButton(); +} + +void TableBrowser::showRowidColumn(bool show, bool skipFilters) +{ + // Block all signals from the horizontal header. Otherwise the QHeaderView::sectionResized signal causes us trouble + ui->dataTable->horizontalHeader()->blockSignals(true); + + // WORKAROUND + // Set the opposite hidden/visible status of what we actually want for the rowid column. This is to work around a Qt bug which + // is present in at least version 5.7.1. The problem is this: when you browse a table/view with n colums, then switch to a table/view + // with less than n columns, you'll be able to resize the first (hidden!) column by resizing the section to the left of the first visible + // column. By doing so the table view gets messed up. But even when not resizing the first hidden column, tab-ing through the fields + // will stop at the not-so-much-hidden rowid column, too. All this can be fixed by this line. I haven't managed to find another workaround + // or way to fix this yet. + ui->dataTable->setColumnHidden(0, show); + + // Show/hide rowid column + ui->dataTable->setColumnHidden(0, !show); + + // Update checked status of the popup menu action + ui->actionShowRowidColumn->setChecked(show); + + // Save settings for this table + sqlb::ObjectIdentifier current_table = currentlyBrowsedTableName(); + if (m_settings[current_table].showRowid != show) { + emit projectModified(); + m_settings[current_table].showRowid = show; + } + + // Update the filter row + if(!skipFilters) + qobject_cast(ui->dataTable->horizontalHeader())->generateFilters(static_cast(m_model->columnCount()), show); + + // Re-enable signals + ui->dataTable->horizontalHeader()->blockSignals(false); + + ui->dataTable->update(); +} + +void TableBrowser::unlockViewEditing(bool unlock, QString pk) +{ + sqlb::ObjectIdentifier currentTable = currentlyBrowsedTableName(); + + if(currentTable.isEmpty()) + return; + + // If this isn't a view just unlock editing and return + if(db->getObjectByName(currentTable) && db->getObjectByName(currentTable)->type() != sqlb::Object::View) + { + m_model->setPseudoPk(m_model->pseudoPk()); + enableEditing(true); + return; + } + + sqlb::ViewPtr obj = db->getObjectByName(currentTable); + + // If the view gets unlocked for editing and we don't have a 'primary key' for this view yet, then ask for one + if(unlock && pk.isEmpty()) + { + while(true) + { + bool ok; + + QStringList options; + for(const auto& n : obj->fieldNames()) + options.push_back(QString::fromStdString(n)); + + // Ask for a PK + pk = QInputDialog::getItem(this, + qApp->applicationName(), + tr("Please enter a pseudo-primary key in order to enable editing on this view. " + "This should be the name of a unique column in the view."), + options, + 0, + false, + &ok); + + // Cancelled? + if(!ok || pk.isEmpty()) { + ui->actionUnlockViewEditing->setChecked(false); + return; + } + + // Do some basic testing of the input and if the input appears to be good, go on + if(db->executeSQL("SELECT " + sqlb::escapeIdentifier(pk.toStdString()) + " FROM " + currentTable.toString() + " LIMIT 1;", false, true)) + break; + } + } else if(!unlock) { + // Locking the view is done by unsetting the pseudo-primary key + pk = "_rowid_"; + } + + // (De)activate editing + enableEditing(unlock); + m_model->setPseudoPk({pk.toStdString()}); + + // Update checked status of the popup menu action + ui->actionUnlockViewEditing->blockSignals(true); + ui->actionUnlockViewEditing->setChecked(unlock); + ui->actionUnlockViewEditing->blockSignals(false); + + // If the settings didn't change, do not try to reapply them. + // This avoids an infinite mutual recursion. + BrowseDataTableSettings& settings = m_settings[currentTable]; + + if(settings.unlockViewPk != pk) { + // Save settings for this table + settings.unlockViewPk = pk; + // Reapply the view settings. This seems to be necessary as a workaround for newer Qt versions. + applySettings(settings); + emit projectModified(); + } +} + +void TableBrowser::hideColumns(int column, bool hide) +{ + sqlb::ObjectIdentifier tableName = currentlyBrowsedTableName(); + + // Select columns to (un)hide + std::unordered_set columns; + if(column == -1) + { + if(ui->dataTable->selectedCols().size() == 0) + columns.insert(ui->actionBrowseTableEditDisplayFormat->property("clicked_column").toInt()); + else { + auto cols = ui->dataTable->selectedCols(); + columns.insert(cols.begin(), cols.end()); + } + } else { + columns.insert(column); + } + + // (Un)hide requested column(s) + for(int col : columns) + { + ui->dataTable->setColumnHidden(col, hide); + if(!hide) + ui->dataTable->setColumnWidth(col, ui->dataTable->horizontalHeader()->defaultSectionSize()); + m_settings[tableName].hiddenColumns[col] = hide; + } + + // check to see if all the columns are hidden + bool allHidden = true; + for(int col = 1; col < ui->dataTable->model()->columnCount(); col++) + { + if(!ui->dataTable->isColumnHidden(col)) + { + allHidden = false; + break; + } + } + + if(allHidden && ui->dataTable->model()->columnCount() > 1) + hideColumns(1, false); + emit projectModified(); +} + +void TableBrowser::on_actionShowAllColumns_triggered() +{ + for(int col = 1; col < ui->dataTable->model()->columnCount(); col++) + { + if(ui->dataTable->isColumnHidden(col)) + hideColumns(col, false); + } +} + +void TableBrowser::updateInsertDeleteRecordButton() +{ + // Update the delete record button to reflect number of selected records + + // NOTE: We're assuming here that the selection is always contiguous, i.e. that there are never two selected + // rows with a non-selected row in between. + int rows = 0; + + // If there is no model yet (because e.g. no database file is opened) there is no selection model either. So we need to check for that here + // in order to avoid null pointer dereferences. If no selection model exists we will just continue as if no row is selected because without a + // model you could argue there actually is no row to be selected. + if(ui->dataTable->selectionModel()) + { + const auto & sel = ui->dataTable->selectionModel()->selectedIndexes(); + if(sel.count()) + rows = sel.last().row() - sel.first().row() + 1; + } + + // Enable the insert and delete buttons only if the currently browsed table or view is editable. For the delete button we additionally require + // at least one row to be selected. For the insert button there is an extra rule to disable it when we are browsing a view because inserting + // into a view isn't supported yet. + bool isEditable = m_model->isEditable() && !db->readOnly(); + ui->actionNewRecord->setEnabled(isEditable); + ui->actionDeleteRecord->setEnabled(isEditable && rows != 0); + + if(rows > 1) + ui->actionDeleteRecord->setText(tr("Delete Records")); + else + ui->actionDeleteRecord->setText(tr("Delete Record")); +} + +void TableBrowser::duplicateRecord(int currentRow) +{ + auto row = m_model->dittoRecord(currentRow); + if (row.isValid()) + ui->dataTable->setCurrentIndex(row); + else + QMessageBox::warning(this, qApp->applicationName(), db->lastError()); +} + +void TableBrowser::headerClicked(int logicalindex) +{ + BrowseDataTableSettings& settings = m_settings[currentlyBrowsedTableName()]; + + // Abort if there is more than one column selected because this tells us that the user pretty sure wants to do a range selection + // instead of sorting data. But restore before the sort indicator automatically changed by Qt so it still indicates the last + // use sort action. + // This check is disabled when the Control key is pressed. This is done because we use the Control key for sorting by multiple columns and + // Qt seems to pretty much always select multiple columns when the Control key is pressed. + if(!QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) && ui->dataTable->selectionModel()->selectedColumns().count() > 1) { + applySettings(settings); + return; + } + + // Set minimum width to the vertical header in order to avoid flickering when sorting. + ui->dataTable->verticalHeader()->setMinimumWidth(ui->dataTable->verticalHeader()->width()); + + // Get the current list of sort columns + auto& columns = settings.query.orderBy(); + + // Before sorting, first check if the Control key is pressed. If it is, we want to append this column to the list of sort columns. If it is not, + // we want to sort only by the new column. + if(QApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) + { + // Multi column sorting + + // If the column was control+clicked again, change its sort order. + // If not already in the sort order, add the column as a new sort column to the list. + bool present = false; + for(sqlb::SortedColumn& sortedCol : columns) { + + if(sortedCol.column == static_cast(logicalindex)) { + sortedCol.direction = (sortedCol.direction == sqlb::Ascending ? sqlb::Descending : sqlb::Ascending); + present = true; + break; + } + } + if(!present) + columns.emplace_back(logicalindex, sqlb::Ascending); + } else { + // Single column sorting + + // If we have exactly one sort column and it is the column which was just clicked, change its sort order. + // If not, clear the list of sorting columns and replace it by a single new sort column. + if(columns.size() == 1 && columns.front().column == static_cast(logicalindex)) + { + columns.front().direction = (columns.front().direction == sqlb::Ascending ? sqlb::Descending : sqlb::Ascending); + } else { + columns.clear(); + columns.emplace_back(logicalindex, sqlb::Ascending); + } + } + + // Do the actual sorting + ui->dataTable->sortByColumns(columns); + + // select the first item in the column so the header is bold + // we might try to select the last selected item + ui->dataTable->setCurrentIndex(ui->dataTable->currentIndex().sibling(0, logicalindex)); + + emit updatePlot(ui->dataTable, m_model, &m_settings[currentlyBrowsedTableName()], true); + + // Reapply the view settings. This seems to be necessary as a workaround for newer Qt versions. + applySettings(settings); + + emit projectModified(); +} + +void TableBrowser::updateColumnWidth(int section, int /*old_size*/, int new_size) +{ + std::unordered_set selectedCols = ui->dataTable->selectedCols(); + sqlb::ObjectIdentifier tableName = currentlyBrowsedTableName(); + + if (selectedCols.find(static_cast(section)) == selectedCols.end()) + { + if (m_settings[tableName].columnWidths[section] != new_size) { + emit projectModified(); + m_settings[tableName].columnWidths[section] = new_size; + } + } + else + { + ui->dataTable->blockSignals(true); + for(size_t col : selectedCols) + { + ui->dataTable->setColumnWidth(static_cast(col), new_size); + if (m_settings[tableName].columnWidths[static_cast(col)] != new_size) { + emit projectModified(); + m_settings[tableName].columnWidths[static_cast(col)] = new_size; + } + } + ui->dataTable->blockSignals(false); + } +} + +void TableBrowser::showDataColumnPopupMenu(const QPoint& pos) +{ + // Get the index of the column which the user has clicked on and store it in the action. This is sort of hack-ish and it might be the heat in my room + // but I haven't come up with a better solution so far + int logical_index = ui->dataTable->horizontalHeader()->logicalIndexAt(pos); + if(logical_index == -1) // Don't open the popup menu if the user hasn't clicked on a column header + return; + ui->actionBrowseTableEditDisplayFormat->setProperty("clicked_column", logical_index); + + // Calculate the proper position for the context menu and display it + popupHeaderMenu->exec(ui->dataTable->horizontalHeader()->mapToGlobal(pos)); +} + +void TableBrowser::showRecordPopupMenu(const QPoint& pos) +{ + int row = ui->dataTable->verticalHeader()->logicalIndexAt(pos); + if (row == -1) + return; + + QMenu popupRecordMenu(this); + + // "Delete and duplicate records" can only be done on writable objects + if(db->getObjectByName(currentlyBrowsedTableName())->type() == sqlb::Object::Types::Table && !db->readOnly()) { + + // Select the row if it is not already in the selection. + QModelIndexList rowList = ui->dataTable->selectionModel()->selectedRows(); + bool found = false; + for (QModelIndex index : rowList) { + if (row == index.row()) { + found = true; + break; + } + } + if (!found) + ui->dataTable->selectRow(row); + + rowList = ui->dataTable->selectionModel()->selectedRows(); + + QString duplicateText = rowList.count() > 1 ? tr("Duplicate records") : tr("Duplicate record"); + + QAction* action = new QAction(duplicateText, &popupRecordMenu); + // Set shortcut for documentation purposes (the actual functional shortcut is not set here) + action->setShortcut(QKeySequence(tr("Ctrl+\""))); + popupRecordMenu.addAction(action); + + connect(action, &QAction::triggered, [rowList, this]() { + for (const QModelIndex& index : rowList) + duplicateRecord(index.row()); + }); + + QAction* deleteRecordAction = new QAction(QIcon(":icons/delete_record"), ui->actionDeleteRecord->text(), &popupRecordMenu); + popupRecordMenu.addAction(deleteRecordAction); + + connect(deleteRecordAction, &QAction::triggered, [&]() { + deleteRecord(); + }); + + popupRecordMenu.addSeparator(); + } + + // "Adjust rows" can be done on any object + QAction* adjustRowHeightAction = new QAction(tr("Adjust rows to contents"), &popupRecordMenu); + adjustRowHeightAction->setCheckable(true); + adjustRowHeightAction->setChecked(m_adjustRows); + popupRecordMenu.addAction(adjustRowHeightAction); + + connect(adjustRowHeightAction, &QAction::toggled, [&](bool checked) { + m_adjustRows = checked; + if(m_adjustRows) + ui->dataTable->resizeRowsToContents(); + else + updateTable(); + }); + + popupRecordMenu.exec(ui->dataTable->verticalHeader()->mapToGlobal(pos)); +} + +void TableBrowser::addRecord() +{ + int row = m_model->rowCount(); + + // If table has pseudo_pk, then it must be an editable view. Jump straight to inserting by pop-up dialog. + if(!m_model->hasPseudoPk() && m_model->insertRow(row)) + { + selectTableLine(row); + } else { + // Error inserting empty row. + // User has to provide values acomplishing the constraints. Open Add Record Dialog. + insertValues(); + } +} + +void TableBrowser::insertValues() +{ + std::vector pseudo_pk = m_model->hasPseudoPk() ? m_model->pseudoPk() : std::vector(); + AddRecordDialog dialog(*db, currentlyBrowsedTableName(), this, pseudo_pk); + if (dialog.exec()) + updateTable(); +} + +void TableBrowser::deleteRecord() +{ + if(ui->dataTable->selectionModel()->hasSelection()) + { + // If only filter header is selected + if(ui->dataTable->selectionModel()->selectedIndexes().isEmpty()) + return; + + int old_row = ui->dataTable->currentIndex().row(); + while(ui->dataTable->selectionModel()->hasSelection()) + { + int first_selected_row = ui->dataTable->selectionModel()->selectedIndexes().first().row(); + int last_selected_row = ui->dataTable->selectionModel()->selectedIndexes().last().row(); + int selected_rows_count = last_selected_row - first_selected_row + 1; + if(!m_model->removeRows(first_selected_row, selected_rows_count)) + { + QMessageBox::warning(this, QApplication::applicationName(), tr("Error deleting record:\n%1").arg(db->lastError())); + break; + } + } + + if(old_row > m_model->rowCount()) + old_row = m_model->rowCount(); + selectTableLine(old_row); + } else { + QMessageBox::information( this, QApplication::applicationName(), tr("Please select a record first")); + } +} + +void TableBrowser::navigatePrevious() +{ + int curRow = ui->dataTable->currentIndex().row(); + curRow -= ui->dataTable->numVisibleRows() - 1; + if(curRow < 0) + curRow = 0; + selectTableLine(curRow); +} + +void TableBrowser::navigateNext() +{ + int curRow = ui->dataTable->currentIndex().row(); + curRow += ui->dataTable->numVisibleRows() - 1; + if(curRow >= m_model->rowCount()) + curRow = m_model->rowCount() - 1; + selectTableLine(curRow); +} + +void TableBrowser::navigateBegin() +{ + selectTableLine(0); +} + +void TableBrowser::navigateEnd() +{ + selectTableLine(m_model->rowCount()-1); +} + +void TableBrowser::navigateGoto() +{ + int row = ui->editGoto->text().toInt(); + if(row <= 0) + row = 1; + if(row > m_model->rowCount()) + row = m_model->rowCount(); + + selectTableLine(row - 1); + ui->editGoto->setText(QString::number(row)); +} + +void TableBrowser::selectTableLine(int lineToSelect) +{ + ui->dataTable->selectTableLine(lineToSelect); +} + +void TableBrowser::on_actionClearFilters_triggered() +{ + ui->dataTable->filterHeader()->clearFilters(); +} + +void TableBrowser::on_actionClearSorting_triggered() +{ + // Get the current list of sort columns + auto& columns = m_settings[currentlyBrowsedTableName()].query.orderBy(); + columns.clear(); + // Set cleared vector of sort-by columns + m_model->sort(columns); +} + +void TableBrowser::editDisplayFormat() +{ + // Get the current table name and fetch its table object, then retrieve the fields of that table and look up the index of the clicked table header + // section using it as the table field array index. Subtract one from the header index to get the column index because in the the first (though hidden) + // column is always the rowid column. Ultimately, get the column name from the column object + sqlb::ObjectIdentifier current_table = currentlyBrowsedTableName(); + int field_number = sender()->property("clicked_column").toInt(); + QString field_name; + if (db->getObjectByName(current_table)->type() == sqlb::Object::Table) + field_name = QString::fromStdString(db->getObjectByName(current_table)->fields.at(static_cast(field_number)-1).name()); + else + field_name = QString::fromStdString(db->getObjectByName(current_table)->fieldNames().at(static_cast(field_number)-1)); + // Get the current display format of the field + QString current_displayformat = m_settings[current_table].displayFormats[field_number]; + + // Open the dialog + ColumnDisplayFormatDialog dialog(*db, current_table, field_name, current_displayformat, this); + if(dialog.exec()) + { + // Set the newly selected display format + QString new_format = dialog.selectedDisplayFormat(); + if(new_format.size()) + m_settings[current_table].displayFormats[field_number] = new_format; + else + m_settings[current_table].displayFormats.remove(field_number); + emit projectModified(); + + // Refresh view + updateTable(); + } +} + +void TableBrowser::exportFilteredTable() +{ + ExportDataDialog dialog(*db, ExportDataDialog::ExportFormatCsv, this, m_model->customQuery(false)); + dialog.exec(); +} + +void TableBrowser::saveFilterAsView() +{ + if (m_model->filterCount() > 0) + // Save as view a custom query without rowid + emit createView(m_model->customQuery(false)); + else + QMessageBox::information(this, qApp->applicationName(), tr("There is no filter set for this table. View will not be created.")); +} + +void TableBrowser::setTableEncoding(bool forAllTables) +{ + // Get the old encoding + QString encoding = m_model->encoding(); + + // Ask the user for a new encoding + bool ok; + QString question; + QStringList availableCodecs = toStringList(QTextCodec::availableCodecs()); + availableCodecs.removeDuplicates(); + int currentItem = availableCodecs.indexOf(encoding); + + if(forAllTables) + question = tr("Please choose a new encoding for all tables."); + else + question = tr("Please choose a new encoding for this table."); + encoding = QInputDialog::getItem(this, + tr("Set encoding"), + tr("%1\nLeave the field empty for using the database encoding.").arg(question), + availableCodecs, + currentItem, + true, // editable + &ok); + + // Only set the new encoding if the user clicked the OK button + if(ok) + { + // Check if encoding is valid + if(!encoding.isEmpty() && !QTextCodec::codecForName(encoding.toUtf8())) + { + QMessageBox::warning(this, qApp->applicationName(), tr("This encoding is either not valid or not supported.")); + return; + } + + // Set encoding for current table + m_model->setEncoding(encoding); + + // Save encoding for this table + m_settings[currentlyBrowsedTableName()].encoding = encoding; + + // Set default encoding if requested to and change all stored table encodings + if(forAllTables) + { + m_defaultEncoding = encoding; + + for(auto it=m_settings.begin();it!=m_settings.end();++it) + it.value().encoding = encoding; + } + + emit projectModified(); + } +} + +void TableBrowser::setDefaultTableEncoding() +{ + setTableEncoding(true); +} + +void TableBrowser::jumpToRow(const sqlb::ObjectIdentifier& table, std::string column, const QByteArray& value) +{ + // First check if table exists + sqlb::TablePtr obj = db->getObjectByName(table); + if(!obj) + return; + + // If no column name is set, assume the primary key is meant + if(!column.size()) + column = obj->primaryKey()->columnList().front(); + + // If column doesn't exist don't do anything + auto column_index = sqlb::findField(obj, column); + if(column_index == obj->fields.end()) + return; + + // Jump to table + setCurrentTable(table); + + // Set filter + ui->dataTable->filterHeader()->setFilter(static_cast(column_index-obj->fields.begin()+1), QString("=") + value); + updateTable(); +} + +static QString replaceInValue(QString value, const QString& find, const QString& replace, Qt::MatchFlags flags) +{ + // Helper function which replaces a string in another string by a third string. It uses regular expressions if told so. + if(flags.testFlag(Qt::MatchRegExp)) + { + QRegularExpression reg_exp(find, (flags.testFlag(Qt::MatchCaseSensitive) ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption)); + if(!flags.testFlag(Qt::MatchContains)) + { +#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) + reg_exp.setPattern("\\A(" + reg_exp.pattern() + ")\\Z"); +#else + reg_exp.setPattern(QRegularExpression::anchoredPattern(reg_exp.pattern())); +#endif + } + + return value.replace(reg_exp, replace); + } else { + return value.replace(find, replace, flags.testFlag(Qt::MatchCaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive); + } +} + +void TableBrowser::find(const QString& expr, bool forward, bool include_first, ReplaceMode replace) +{ + // Reset the colour of the line edit, assuming there is no error. + ui->editFindExpression->setStyleSheet(""); + + // You are not allowed to search for an ampty string + if(expr.isEmpty()) + return; + + // Get the cell from which the search should be started. If there is a selected cell, use that. If there is no selected cell, start at the first cell. + QModelIndex start; + if(ui->dataTable->selectionModel()->hasSelection()) + start = ui->dataTable->selectionModel()->selectedIndexes().front(); + else + start = m_model->index(0, 0); + + // Prepare the match flags with all the search settings + Qt::MatchFlags flags = Qt::MatchWrap; + + if(ui->checkFindCaseSensitive->isChecked()) + flags |= Qt::MatchCaseSensitive; + + if(ui->checkFindWholeCell->isChecked()) + flags |= Qt::MatchFixedString; + else + flags |= Qt::MatchContains; + + if(ui->checkFindRegEx->isChecked()) + flags |= Qt::MatchRegExp; + + // Prepare list of columns to search in. We only search in non-hidden rows + std::vector column_list; + sqlb::ObjectIdentifier tableName = currentlyBrowsedTableName(); + if(m_settings[tableName].showRowid) + column_list.push_back(0); + for(int i=1;icolumnCount();i++) + { + if(m_settings[tableName].hiddenColumns.contains(i) == false) + column_list.push_back(i); + else if(m_settings[tableName].hiddenColumns[i] == false) + column_list.push_back(i); + } + + // Are we only searching for text or are we supposed to replace text? + switch(replace) + { + case ReplaceMode::NoReplace: { + // Perform the actual search using the model class + const auto match = m_model->nextMatch(start, column_list, expr, flags, !forward, include_first); + + // Select the next match if we found one + if(match.isValid()) + ui->dataTable->setCurrentIndex(match); + + // Make the expression control red if no results were found + if(!match.isValid()) + ui->editFindExpression->setStyleSheet("QLineEdit {color: white; background-color: rgb(255, 102, 102)}"); + } break; + case ReplaceMode::ReplaceNext: { + // Find the next match + const auto match = m_model->nextMatch(start, column_list, expr, flags, !forward, include_first); + + // If there was a match, perform the replacement on the cell and select it + if(match.isValid()) + { + m_model->setData(match, replaceInValue(match.data(Qt::EditRole).toString(), expr, ui->editReplaceExpression->text(), flags)); + ui->dataTable->setCurrentIndex(match); + } + + // Make the expression control red if no results were found + if(!match.isValid()) + ui->editFindExpression->setStyleSheet("QLineEdit {color: white; background-color: rgb(255, 102, 102)}"); + } break; + case ReplaceMode::ReplaceAll: { + // Find all matches + std::set all_matches; + while(true) + { + // Find the next match + const auto match = m_model->nextMatch(start, column_list, expr, flags, !forward, include_first); + + // If there was a match, perform the replacement and continue from that position. If there was no match, stop looking for other matches. + // Additionally, keep track of all the matches so far in order to avoid running over them again indefinitely, e.g. when replacing "1" by "10". + if(match.isValid() && all_matches.find(match) == all_matches.end()) + { + all_matches.insert(match); + m_model->setData(match, replaceInValue(match.data(Qt::EditRole).toString(), expr, ui->editReplaceExpression->text(), flags)); + + // Start searching from the last match onwards in order to not search through the same cells over and over again. + start = match; + include_first = false; + } else { + break; + } + } + + // Make the expression control red if no results were found + if(!all_matches.empty()) + QMessageBox::information(this, qApp->applicationName(), tr("%1 replacement(s) made.").arg(all_matches.size())); + else + ui->editFindExpression->setStyleSheet("QLineEdit {color: white; background-color: rgb(255, 102, 102)}"); + } break; + } +} + +void TableBrowser::fetchedData() +{ + updateRecordsetLabel(); + + // Adjust row height to contents. This has to be done each time new data is fetched. + if(m_adjustRows) + ui->dataTable->resizeRowsToContents(); + + // Don't resize the columns more than once to fit their contents. This is necessary because the finishedFetch signal of the model + // is emitted for each loaded prefetch block and we want to avoid column resizes while scrolling down. + if(m_columnsResized) + return; + m_columnsResized = true; + + // Set column widths according to their contents but make sure they don't exceed a certain size + ui->dataTable->resizeColumnsToContents(); + for(int i = 0; i < m_model->columnCount(); i++) + { + if(ui->dataTable->columnWidth(i) > 300) + ui->dataTable->setColumnWidth(i, 300); + } +} diff --git a/src/TableBrowser.h b/src/TableBrowser.h new file mode 100644 index 00000000..57835fbd --- /dev/null +++ b/src/TableBrowser.h @@ -0,0 +1,197 @@ +#ifndef TABLEBROWSER_H +#define TABLEBROWSER_H + +#include "CondFormat.h" +#include "PlotDock.h" +#include "sql/Query.h" + +#include +#include +#include + +#include +#include + +class DBBrowserDB; +class ExtendedTableWidget; +class SqliteTableModel; + +class QAbstractItemModel; +class QIntValidator; + +namespace Ui { +class TableBrowser; +} + +struct BrowseDataTableSettings +{ + using CondFormatMap = QMap>; + sqlb::Query query; // NOTE: We only store the sort order in here (for now) + QMap columnWidths; + QMap filterValues; + CondFormatMap condFormats; + CondFormatMap rowIdFormats; + QMap displayFormats; + bool showRowid; + QString encoding; + QString plotXAxis; + QMap plotYAxes; + QString unlockViewPk; + QMap hiddenColumns; + std::vector globalFilters; + + BrowseDataTableSettings() : + showRowid(false), + unlockViewPk("_rowid_") + { + } + + friend QDataStream& operator>>(QDataStream& stream, BrowseDataTableSettings& object) + { + int sortOrderIndex, sortOrderMode; + stream >> sortOrderIndex; + stream >> sortOrderMode; + object.query.orderBy().emplace_back(sortOrderIndex, sortOrderMode == Qt::AscendingOrder ? sqlb::Ascending : sqlb::Descending); + stream >> object.columnWidths; + stream >> object.filterValues; + stream >> object.displayFormats; + stream >> object.showRowid; + stream >> object.encoding; + + // Versions pre 3.10.0 didn't store the following information in their project files. + // To be absolutely sure that nothing strange happens when we read past the stream for + // those cases, check for the end of the stream here. + if(stream.atEnd()) + return stream; + stream >> object.plotXAxis; + stream >> object.plotYAxes; + stream >> object.unlockViewPk; + + // Project files from versions before 3.11.0 didn't have these fields + if(stream.atEnd()) + return stream; + stream >> object.hiddenColumns; + + return stream; + } +}; + +class TableBrowser : public QWidget +{ + Q_OBJECT + +public: + explicit TableBrowser(QWidget* parent = nullptr); + ~TableBrowser(); + void init(DBBrowserDB* _db); + void reset(); + + sqlb::ObjectIdentifier currentlyBrowsedTableName() const; + + QMap allSettings() const { return m_settings; } + BrowseDataTableSettings& settings(const sqlb::ObjectIdentifier& object); + void setSettings(const sqlb::ObjectIdentifier& table, const BrowseDataTableSettings& table_settings); + + void setStructure(QAbstractItemModel* model, const QString& old_table = QString()); + void updateStructure(); + + SqliteTableModel* model() { return m_model; } + + QModelIndex currentIndex() const; + + void setDefaultEncoding(const QString& encoding) { m_defaultEncoding = encoding; } + QString defaultEncoding() const { return m_defaultEncoding; } + +public slots: + void setEnabled(bool enable); + void updateTable(); + void clearFilters(); + void reloadSettings(); + void setCurrentTable(const sqlb::ObjectIdentifier& name); + void updateRecordsetLabel(); + void jumpToRow(const sqlb::ObjectIdentifier& table, std::string column, const QByteArray& value); + +signals: + void projectModified(); + void selectionChanged(QModelIndex index); + void selectionChangedByDoubleClick(QModelIndex index); + void statusMessageRequested(QString message); + void updatePlot(ExtendedTableWidget* tableWidget, SqliteTableModel* model, BrowseDataTableSettings* settings, bool keepOrResetSelection); + void createView(std::string sql); + void requestFileOpen(QString file); + +private slots: + void clear(); + void updateFilter(size_t column, const QString& value); + void addCondFormatFromFilter(size_t column, const QString& value); + void addCondFormat(bool isRowIdFormat, size_t column, const CondFormat& newCondFormat); + void clearAllCondFormats(size_t column); + void clearRowIdFormats(const QModelIndex index); + void editCondFormats(size_t column); + void applySettings(const BrowseDataTableSettings& storedData, bool skipFilters = false); + void enableEditing(bool enable_edit); + void showRowidColumn(bool show, bool skipFilters = false); + void unlockViewEditing(bool unlock, QString pk = QString()); + void hideColumns(int column = -1, bool hide = true); + void on_actionShowAllColumns_triggered(); + void updateInsertDeleteRecordButton(); + void duplicateRecord(int currentRow); + void headerClicked(int logicalindex); + void updateColumnWidth(int section, int /*old_size*/, int new_size); + void showDataColumnPopupMenu(const QPoint& pos); + void showRecordPopupMenu(const QPoint& pos); + void addRecord(); + void insertValues(); + void deleteRecord(); + void navigatePrevious(); + void navigateNext(); + void navigateBegin(); + void navigateEnd(); + void navigateGoto(); + void selectTableLine(int lineToSelect); + void on_actionClearFilters_triggered(); + void on_actionClearSorting_triggered(); + void editDisplayFormat(); + void exportFilteredTable(); + void saveFilterAsView(); + void setTableEncoding(bool forAllTables = false); + void setDefaultTableEncoding(); + void fetchedData(); + +private: + enum class ReplaceMode + { + NoReplace, + ReplaceNext, + ReplaceAll, + }; + void find(const QString& expr, bool forward, bool include_first = false, ReplaceMode replace = ReplaceMode::NoReplace); + +private: + Ui::TableBrowser* ui; + QIntValidator* gotoValidator; + QMenu* popupNewRecordMenu; + QMenu* popupSaveFilterAsMenu; + QMenu* popupHeaderMenu; + + DBBrowserDB* db; + + QAbstractItemModel* dbStructureModel; + + /// the table model used in the "Browse Data" page (re-used and + /// re-initialized when switching to another table) + SqliteTableModel* m_model; + + static QMap m_settings; // This is static, so settings are shared between instances + static QString m_defaultEncoding; + + Palette m_condFormatPalette; + bool m_adjustRows; + bool m_columnsResized; + + void modifySingleFormat(const bool isRowIdFormat, const QString& filter, const QModelIndex refIndex, + std::function changeFunction); + void modifyFormat(std::function changeFunction); +}; + +#endif diff --git a/src/TableBrowser.ui b/src/TableBrowser.ui new file mode 100644 index 00000000..2a3ea3b4 --- /dev/null +++ b/src/TableBrowser.ui @@ -0,0 +1,1481 @@ + + + TableBrowser + + + + 0 + 0 + 695 + 400 + + + + Browse Data + + + + 1 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 2 + + + 2 + + + + + &Table: + + + comboBrowseTable + + + + + + + + 150 + 0 + + + + Select a table to browse data + + + Use this list to select a table to be displayed in the database view + + + 30 + + + QComboBox::AdjustToContents + + + + + + + Qt::ToolButtonIconOnly + + + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 0 + 20 + + + + + + + + + + + 5 + + + 2 + + + 0 + + + 2 + + + 0 + + + + + + + + + 50 + 16777215 + + + + 1 + + + + + + + Qt::ToolButtonIconOnly + + + + + + + + + + + + + + + + + + + + + + + + true + + + This is the database table view. You can do the following actions: + - Start writing for editing inline the value. + - Double-click any record to edit its contents in the cell editor window. + - Alt+Del for deleting the cell content to NULL. + - Ctrl+" for duplicating the current record. + - Ctrl+' for copying the value from the cell above. + - Standard selection and copy/paste operations. + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::DragDrop + + + Qt::CopyAction + + + QAbstractItemView::ContiguousSelection + + + + + + + + 16777215 + 62 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 3 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::DefaultContextMenu + + + Text pattern to find considering the checks in this frame + + + Find in table + + + true + + + + + + + Find previous match [Shift+F3] + + + Find previous match with mapping + + + + :/icons/up:/icons/up + + + Shift+F3 + + + + + + + Find next match [Enter, F3] + + + Find next match with wrapping + + + + :/icons/down:/icons/down + + + F3 + + + + + + + The found pattern must match in letter case + + + Case Sensitive + + + + + + + The found pattern must be a whole word + + + Whole Cell + + + + + + + Interpret search pattern as a regular expression + + + <html><head/><body><p>When checked, the pattern to find is interpreted as a UNIX regular expression. See <a href="https://en.wikibooks.org/wiki/Regular_Expressions">Regular Expression in Wikibooks</a>.</p></body></html> + + + Regular Expression + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close Find Bar + + + Close Find Bar + + + + :/icons/close:/icons/close + + + true + + + + + + + + + + + 3 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::DefaultContextMenu + + + Text to replace with + + + Replace with + + + true + + + + + + + Replace next match + + + Replace + + + + + + + Replace all matches + + + Replace all + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + 2 + + + 2 + + + 2 + + + 2 + + + + + false + + + <html><head/><body><p>Scroll to the beginning</p></body></html> + + + <html><head/><body><p>Clicking this button navigates to the beginning in the table view above.</p></body></html> + + + |< + + + + :/icons/resultset_first.png:/icons/resultset_first.png + + + + + + + false + + + Scroll one page upwards + + + <html><head/><body><p>Clicking this button navigates one page of records upwards in the table view above.</p></body></html> + + + < + + + + :/icons/resultset_previous.png:/icons/resultset_previous.png + + + + + + + 0 - 0 of 0 + + + + + + + false + + + Scroll one page downwards + + + <html><head/><body><p>Clicking this button navigates one page of records downwards in the table view above.</p></body></html> + + + > + + + + :/icons/run:/icons/run + + + + + + + false + + + Scroll to the end + + + <html><head/><body><p>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Clicking this button navigates up to the end in the table view above.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</p></body></html> + + + >| + + + + :/icons/run_line:/icons/run_line + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Click here to jump to the specified record</p></body></html> + + + <html><head/><body><p>This button is used to navigate to the record number specified in the Go to area.</p></body></html> + + + Go to: + + + + + + + Enter record number to browse + + + Type a record number in this area and click the Go to: button to display the record in the database view + + + 1 + + + + + + + + + true + + + Show rowid column + + + Toggle the visibility of the rowid column + + + + + true + + + Unlock view editing + + + This unlocks the current view for editing. However, you will need appropriate triggers for editing. + + + + + Edit display format + + + Edit the display format of the data in this column + + + + + + :/icons/add_record:/icons/add_record + + + New Record + + + Insert a new record in the current table + + + Insert a new record in the current table + + + <html><head/><body><p>This button creates a new record in the database. Hold the mouse button to open a pop-up menu of different options:</p><ul><li><span style=" font-weight:600;">New Record</span>: insert a new record with default values in the database.</li><li><span style=" font-weight:600;">Insert Values...</span>: open a dialog for entering values before they are inserted in the database. This allows to enter values acomplishing the different constraints. This dialog is also open if the <span style=" font-weight:600;">New Record</span> option fails due to these constraints.</li></ul></body></html> + + + + + + :/icons/delete_record:/icons/delete_record + + + Delete Record + + + Delete the current record + + + This button deletes the record or records currently selected in the table + + + This button deletes the record or records currently selected in the table + + + + + + :/icons/add_record:/icons/add_record + + + New Record + + + Insert new record using default values in browsed table + + + Insert new record using default values in browsed table + + + + + Insert Values... + + + Open a dialog for inserting values in a new record + + + Open a dialog for inserting values in a new record + + + + + Export to &CSV + + + Export the filtered data to CSV + + + Export the filtered data to CSV + + + This button exports the data of the browsed table as currently displayed (after filters, display formats and order column) as a CSV file. + + + + + Save as &view + + + Save the current filter, sort column and display formats as a view + + + Save the current filter, sort column and display formats as a view + + + This button saves the current setting of the browsed table (filters, display formats and order column) as an SQL view that you can later browse or use in SQL statements. + + + + + + :/icons/save_table:/icons/save_table + + + Save Table As... + + + Save the table as currently displayed + + + Save the table as currently displayed + + + <html><head/><body><p>This popup menu provides the following options applying to the currently browsed and filtered table:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Export to CSV: this option exports the data of the browsed table as currently displayed (after filters, display formats and order column) to a CSV file.</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Save as view: this option saves the current setting of the browsed table (filters, display formats and order column) as an SQL view that you can later browse or use in SQL statements.</li></ul></body></html> + + + + + Hide column(s) + + + Hide selected column(s) + + + + + Show all columns + + + Show all columns that were hidden + + + + + Set encoding + + + Change the encoding of the text in the table cells + + + + + Set encoding for all tables + + + Change the default encoding assumed for all tables in the database + + + + + + :/icons/clear_filters:/icons/clear_filters + + + Clear Filters + + + Clear all filters + + + This button clears all the filters set in the header input fields for the currently browsed table. + + + This button clears all the filters set in the header input fields for the currently browsed table. + + + + + + :/icons/clear_sorting:/icons/clear_sorting + + + Clear Sorting + + + Reset the order of rows to the default + + + This button clears the sorting columns specified for the currently browsed table and returns to the default order. + + + This button clears the sorting columns specified for the currently browsed table and returns to the default order. + + + + + + :/icons/print:/icons/print + + + Print + + + Print currently browsed table data + + + + + + Print currently browsed table data. Print selection if more than one cell is selected. + + + Ctrl+P + + + Qt::WidgetShortcut + + + + + + :/icons/refresh:/icons/refresh + + + Refresh + + + Refresh the data in the selected table + + + This button refreshes the data in the currently selected table. + + + F5 + + + Qt::WidgetShortcut + + + + + true + + + + :/icons/find:/icons/find + + + Find in cells + + + Open the find tool bar which allows you to search for values in the table view below. + + + Ctrl+F + + + + + true + + + + :/icons/text_bold.png:/icons/text_bold.png + + + Bold + + + Bold + + + Ctrl+B + + + + + true + + + + :/icons/text_italic.png:/icons/text_italic.png + + + Italic + + + Italic + + + + + true + + + + :/icons/text_underline.png:/icons/text_underline.png + + + Underline + + + Underline + + + Ctrl+U + + + + + true + + + + :/icons/text_align_right.png:/icons/text_align_right.png + + + Align Right + + + Align Right + + + + + true + + + + :/icons/text_align_left.png:/icons/text_align_left.png + + + Align Left + + + Align Left + + + + + true + + + + :/icons/text_align_center.png:/icons/text_align_center.png + + + Center Horizontally + + + Center Horizontally + + + + + true + + + + :/icons/text_align_justify.png:/icons/text_align_justify.png + + + Justify + + + Justify + + + + + + :/icons/edit_cond_formats:/icons/edit_cond_formats + + + Edit Conditional Formats... + + + Edit Conditional Formats... + + + Edit conditional formats for the current column + + + + + + :/icons/clear_cond_formats:/icons/clear_cond_formats + + + Clear Format + + + Clear All Formats + + + Clear all cell formatting from selected cells and all conditional formats from selected columns + + + Clear all cell formatting from selected cells and all conditional formats from selected columns + + + + + + :/icons/foreground_color:/icons/foreground_color + + + Font Color + + + Font Color + + + + + + :/icons/background_color:/icons/background_color + + + Background Color + + + Background Color + + + + + true + + + + :/icons/cond_formats:/icons/cond_formats + + + Toggle Format Toolbar + + + Show/hide format toolbar + + + This button shows or hides the formatting toolbar of the Data Browser + + + This button shows or hides the formatting toolbar of the Data Browser + + + + + Select column + + + Ctrl+Space + + + + + true + + + + :/icons/text_replace:/icons/text_replace + + + Replace + + + Replace text in cells + + + Ctrl+H + + + + + + ExtendedTableWidget + QTableWidget +
ExtendedTableWidget.h
+ + foreignKeyClicked(QString,QString,QByteArray) + foreignKeyClicked(sqlb::ObjectIdentifier,QString,QByteArray) + +
+ + FilterLineEdit + QLineEdit +
FilterLineEdit.h
+
+
+ + comboBrowseTable + editGlobalFilter + fontComboBox + fontSizeBox + dataTable + editFindExpression + editReplaceExpression + buttonFindPrevious + buttonFindNext + checkFindCaseSensitive + checkFindWholeCell + checkFindRegEx + buttonFindClose + buttonReplaceNext + buttonReplaceAll + buttonBegin + buttonPrevious + buttonNext + buttonEnd + buttonGoto + editGoto + + + + + + + comboBrowseTable + activated(QString) + TableBrowser + updateTable() + + + 159 + 31 + + + 399 + 299 + + + + + buttonPrevious + clicked() + TableBrowser + navigatePrevious() + + + 55 + 395 + + + 399 + 299 + + + + + buttonNext + clicked() + TableBrowser + navigateNext() + + + 140 + 395 + + + 399 + 299 + + + + + buttonGoto + clicked() + TableBrowser + navigateGoto() + + + 452 + 397 + + + 399 + 299 + + + + + editGoto + returnPressed() + TableBrowser + navigateGoto() + + + 648 + 397 + + + 399 + 299 + + + + + buttonEnd + clicked() + TableBrowser + navigateEnd() + + + 170 + 395 + + + 499 + 314 + + + + + buttonBegin + clicked() + TableBrowser + navigateBegin() + + + 25 + 395 + + + 499 + 314 + + + + + dataTable + foreignKeyClicked(sqlb::ObjectIdentifier,std::string,QByteArray) + TableBrowser + jumpToRow(sqlb::ObjectIdentifier,std::string,QByteArray) + + + 70 + 242 + + + 518 + 314 + + + + + actionShowRowidColumn + triggered(bool) + TableBrowser + showRowidColumn(bool) + + + -1 + -1 + + + 518 + 314 + + + + + actionUnlockViewEditing + toggled(bool) + TableBrowser + unlockViewEditing(bool) + + + -1 + -1 + + + 518 + 314 + + + + + actionBrowseTableEditDisplayFormat + triggered() + TableBrowser + editDisplayFormat() + + + -1 + -1 + + + 518 + 314 + + + + + actionNewRecord + triggered() + TableBrowser + addRecord() + + + -1 + -1 + + + 518 + 314 + + + + + actionDeleteRecord + triggered() + TableBrowser + deleteRecord() + + + -1 + -1 + + + 399 + 299 + + + + + newRecordAction + triggered() + TableBrowser + addRecord() + + + -1 + -1 + + + 518 + 314 + + + + + insertValuesAction + triggered() + TableBrowser + insertValues() + + + -1 + -1 + + + 20 + 20 + + + + + actionFilteredTableExportCsv + triggered() + TableBrowser + exportFilteredTable() + + + -1 + -1 + + + 518 + 314 + + + + + actionFilterSaveAsView + triggered() + TableBrowser + saveFilterAsView() + + + -1 + -1 + + + 518 + 314 + + + + + actionSetTableEncoding + triggered() + TableBrowser + setTableEncoding() + + + -1 + -1 + + + 518 + 314 + + + + + actionSetAllTablesEncoding + triggered() + TableBrowser + setDefaultTableEncoding() + + + -1 + -1 + + + 518 + 314 + + + + + actionHideColumns + triggered() + TableBrowser + hideColumns() + + + -1 + -1 + + + 518 + 314 + + + + + actionRefresh + triggered() + TableBrowser + updateTable() + + + -1 + -1 + + + 518 + 314 + + + + + actionPrintTable + triggered() + dataTable + openPrintDialog() + + + -1 + -1 + + + 326 + 291 + + + + + + updateTable() + selectionChanged(QModelIndex) + navigatePrevious() + navigateNext() + navigateBegin() + navigateEnd() + navigateGoto() + jumpToRow(sqlb::ObjectIdentifier,std::string,QByteArray) + showRowidColumn(bool) + unlockViewEditing(bool) + editDisplayFormat() + addRecord() + deleteRecord() + insertValues() + exportFilteredTable + saveFilterAsView + setDefaultTableEncoding() + hideColumns() + setTableEncoding() + +
diff --git a/src/VacuumDialog.cpp b/src/VacuumDialog.cpp index 404dc46a..c2a622a4 100644 --- a/src/VacuumDialog.cpp +++ b/src/VacuumDialog.cpp @@ -46,7 +46,7 @@ void VacuumDialog::accept() // Loop through all selected databases and vacuum them individually QList selection = ui->treeDatabases->selectedItems(); for(const QTreeWidgetItem* item : selection) - db->executeSQL(QString("VACUUM %1;").arg(sqlb::escapeIdentifier(item->text(0))), false); + db->executeSQL("VACUUM " + sqlb::escapeIdentifier(item->text(0).toStdString()), false); QApplication::restoreOverrideCursor(); QDialog::accept(); diff --git a/src/csvparser.cpp b/src/csvparser.cpp index ca0621f0..212a0537 100644 --- a/src/csvparser.cpp +++ b/src/csvparser.cpp @@ -281,7 +281,7 @@ CSVParser::ParserResult CSVParser::parse(csvRowFunction insertFunction, QTextStr } } - if(record.num_fields) + if(record.num_fields || record.fields->buffer_length) { addColumn(record, field, m_bTrimFields); @@ -292,7 +292,9 @@ CSVParser::ParserResult CSVParser::parse(csvRowFunction insertFunction, QTextStr if(m_pCSVProgress) m_pCSVProgress->end(); - return (state == StateNormal) ? ParserResult::ParserResultSuccess : ParserResult::ParserResultError; + // Check if we are in StateNormal or StateEndQuote state. The first is what we should be in for unquoted data and all files which + // end with a line break. The latter is what we are in for quoted data with no final line break. + return (state == StateNormal || state == StateEndQuote) ? ParserResult::ParserResultSuccess : ParserResult::ParserResultError; } bool CSVParser::look_ahead(QTextStream& stream, QByteArray& sBuffer, const char** it, const char** sBufferEnd, char expected) diff --git a/src/csvparser.h b/src/csvparser.h index 0c74330c..8687ff9b 100644 --- a/src/csvparser.h +++ b/src/csvparser.h @@ -16,7 +16,7 @@ class QTextStream; class CSVProgress { public: - virtual ~CSVProgress() { } + virtual ~CSVProgress() = default; virtual void start() = 0; virtual bool update(int64_t pos) = 0; diff --git a/src/docktextedit.cpp b/src/docktextedit.cpp index b0e7ddc9..39c40f9b 100644 --- a/src/docktextedit.cpp +++ b/src/docktextedit.cpp @@ -27,10 +27,6 @@ DockTextEdit::DockTextEdit(QWidget* parent) : reloadSettings(); } -DockTextEdit::~DockTextEdit() -{ -} - void DockTextEdit::reloadSettings() { // Set the parent settings for both lexers @@ -115,5 +111,5 @@ void DockTextEdit::clearTextInMargin() clearMarginText(); setMarginLineNumbers(0, true); reloadCommonSettings(); - linesChanged(); + emit linesChanged(); } diff --git a/src/docktextedit.h b/src/docktextedit.h index 680eb8d1..c5d32369 100644 --- a/src/docktextedit.h +++ b/src/docktextedit.h @@ -16,7 +16,6 @@ class DockTextEdit : public ExtendedScintilla public: explicit DockTextEdit(QWidget *parent = nullptr); - ~DockTextEdit() override; // Enumeration of supported languages enum Language @@ -27,7 +26,7 @@ public: }; void setLanguage(Language lang); - Language language() { return m_language; } + Language language() const { return m_language; } // Disables the line-number margin and sets this text in the first line. void setTextInMargin(const QString& text); diff --git a/src/grammar/README b/src/grammar/README deleted file mode 100644 index 42fec62b..00000000 --- a/src/grammar/README +++ /dev/null @@ -1,6 +0,0 @@ -To generate c++ code from the grammar(sqlit3.g) you need -antlr 2.7.7. Download it from www.antlr2.org. - -Either put the antlr.jar into your system classpath or -start it like this: -java -cp .:/pathto/antlr.jar antlr.Tool sqlite3.g diff --git a/src/grammar/Sqlite3Lexer.cpp b/src/grammar/Sqlite3Lexer.cpp deleted file mode 100644 index 8a7094e4..00000000 --- a/src/grammar/Sqlite3Lexer.cpp +++ /dev/null @@ -1,1232 +0,0 @@ -/* $ANTLR 2.7.7 (20171109): "sqlite3.g" -> "Sqlite3Lexer.cpp"$ */ -#include "Sqlite3Lexer.hpp" -#include -#include -#include -#include -#include -#include -#include - -Sqlite3Lexer::Sqlite3Lexer(ANTLR_USE_NAMESPACE(std)istream& in) - : ANTLR_USE_NAMESPACE(antlr)CharScanner(new ANTLR_USE_NAMESPACE(antlr)CharBuffer(in),false) -{ - initLiterals(); -} - -Sqlite3Lexer::Sqlite3Lexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib) - : ANTLR_USE_NAMESPACE(antlr)CharScanner(ib,false) -{ - initLiterals(); -} - -Sqlite3Lexer::Sqlite3Lexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state) - : ANTLR_USE_NAMESPACE(antlr)CharScanner(state,false) -{ - initLiterals(); -} - -void Sqlite3Lexer::initLiterals() -{ - literals["CONSTRAINT"] = 19; - literals["CREATE"] = 16; - literals["CASE"] = 13; - literals["END"] = 29; - literals["CASCADE"] = 12; - literals["TEMPORARY"] = 67; - literals["RANGE"] = 58; - literals["DEFERRABLE"] = 24; - literals["IMMEDIATE"] = 45; - literals["AUTOINCREMENT"] = 6; - literals["ROWID"] = 64; - literals["EXISTS"] = 51; - literals["NO"] = 47; - literals["THEN"] = 69; - literals["AND"] = 9; - literals["CURRENT_DATE"] = 21; - literals["NOT"] = 48; - literals["KEY"] = 36; - literals["COLLATE"] = 17; - literals["NULL"] = 49; - literals["TEMP"] = 68; - literals["OVER"] = 53; - literals["INITIALLY"] = 43; - literals["RESTRICT"] = 62; - literals["LIKE"] = 37; - literals["WHEN"] = 75; - literals["FOREIGN"] = 34; - literals["SET"] = 66; - literals["IS"] = 46; - literals["FILTER"] = 32; - literals["OR"] = 10; - literals["INDEX"] = 42; - literals["PRIMARY"] = 56; - literals["DEFERRED"] = 25; - literals["UPDATE"] = 72; - literals["IF"] = 39; - literals["PRECEDING"] = 55; - literals["UNIQUE"] = 71; - literals["AS"] = 7; - literals["TABLE"] = 38; - literals["UNBOUNDED"] = 70; - literals["DEFAULT"] = 23; - literals["ACTION"] = 5; - literals["DELETE"] = 26; - literals["GLOB"] = 35; - literals["FOLLOWING"] = 33; - literals["IGNORE"] = 40; - literals["INSERT"] = 44; - literals["CURRENT_TIMESTAMP"] = 22; - literals["CONFLICT"] = 18; - literals["ROWS"] = 65; - literals["REPLACE"] = 61; - literals["ASC"] = 8; - literals["FAIL"] = 31; - literals["REGEXP"] = 60; - literals["REFERENCES"] = 59; - literals["ON"] = 52; - literals["DESC"] = 27; - literals["IN"] = 41; - literals["CAST"] = 14; - literals["ESCAPE"] = 30; - literals["VIRTUAL"] = 74; - literals["WHERE"] = 76; - literals["ELSE"] = 28; - literals["PARTITION"] = 54; - literals["WITHOUT"] = 77; - literals["MATCH"] = 50; - literals["RAISE"] = 57; - literals["ABORT"] = 4; - literals["BETWEEN"] = 11; - literals["CHECK"] = 15; - literals["ROLLBACK"] = 63; - literals["CURRENT_TIME"] = 20; - literals["USING"] = 73; -} - -ANTLR_USE_NAMESPACE(antlr)RefToken Sqlite3Lexer::nextToken() -{ - ANTLR_USE_NAMESPACE(antlr)RefToken theRetToken; - for (;;) { - ANTLR_USE_NAMESPACE(antlr)RefToken theRetToken; - int _ttype = ANTLR_USE_NAMESPACE(antlr)Token::INVALID_TYPE; - resetText(); - try { // for lexical and char stream error handling - switch ( LA(1)) { - case 0x5f /* '_' */ : - case 0x61 /* 'a' */ : - case 0x62 /* 'b' */ : - case 0x63 /* 'c' */ : - case 0x64 /* 'd' */ : - case 0x65 /* 'e' */ : - case 0x66 /* 'f' */ : - case 0x67 /* 'g' */ : - case 0x68 /* 'h' */ : - case 0x69 /* 'i' */ : - case 0x6a /* 'j' */ : - case 0x6b /* 'k' */ : - case 0x6c /* 'l' */ : - case 0x6d /* 'm' */ : - case 0x6e /* 'n' */ : - case 0x6f /* 'o' */ : - case 0x70 /* 'p' */ : - case 0x71 /* 'q' */ : - case 0x72 /* 'r' */ : - case 0x73 /* 's' */ : - case 0x74 /* 't' */ : - case 0x75 /* 'u' */ : - case 0x76 /* 'v' */ : - case 0x77 /* 'w' */ : - case 0x78 /* 'x' */ : - case 0x79 /* 'y' */ : - case 0x7a /* 'z' */ : - { - mID(true); - theRetToken=_returnToken; - break; - } - case 0x5b /* '[' */ : - case 0x60 /* '`' */ : - { - mQUOTEDID(true); - theRetToken=_returnToken; - break; - } - case 0x22 /* '\"' */ : - { - mQUOTEDLITERAL(true); - theRetToken=_returnToken; - break; - } - case 0x2e /* '.' */ : - case 0x30 /* '0' */ : - case 0x31 /* '1' */ : - case 0x32 /* '2' */ : - case 0x33 /* '3' */ : - case 0x34 /* '4' */ : - case 0x35 /* '5' */ : - case 0x36 /* '6' */ : - case 0x37 /* '7' */ : - case 0x38 /* '8' */ : - case 0x39 /* '9' */ : - { - mNUMERIC(true); - theRetToken=_returnToken; - break; - } - case 0x2b /* '+' */ : - { - mPLUS(true); - theRetToken=_returnToken; - break; - } - case 0x9 /* '\t' */ : - case 0xa /* '\n' */ : - case 0xc /* '\14' */ : - case 0xd /* '\r' */ : - case 0x20 /* ' ' */ : - { - mWS(true); - theRetToken=_returnToken; - break; - } - case 0x27 /* '\'' */ : - { - mSTRINGLITERAL(true); - theRetToken=_returnToken; - break; - } - case 0x28 /* '(' */ : - { - mLPAREN(true); - theRetToken=_returnToken; - break; - } - case 0x29 /* ')' */ : - { - mRPAREN(true); - theRetToken=_returnToken; - break; - } - case 0x2c /* ',' */ : - { - mCOMMA(true); - theRetToken=_returnToken; - break; - } - case 0x3b /* ';' */ : - { - mSEMI(true); - theRetToken=_returnToken; - break; - } - case 0x2a /* '*' */ : - { - mSTAR(true); - theRetToken=_returnToken; - break; - } - case 0x7e /* '~' */ : - { - mTILDE(true); - theRetToken=_returnToken; - break; - } - case 0x26 /* '&' */ : - { - mAMPERSAND(true); - theRetToken=_returnToken; - break; - } - case 0x21 /* '!' */ : - { - mUNEQUAL(true); - theRetToken=_returnToken; - break; - } - default: - if ((LA(1) == 0x2d /* '-' */ || LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x2a /* '*' */ || LA(2) == 0x2d /* '-' */ )) { - mCOMMENT(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x7c /* '|' */ ) && (LA(2) == 0x7c /* '|' */ )) { - mOROP(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3d /* '=' */ ) && (LA(2) == 0x3d /* '=' */ )) { - mEQUAL2(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3d /* '=' */ )) { - mGREATEREQUAL(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3d /* '=' */ )) { - mLOWEREQUAL(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3e /* '>' */ )) { - mUNEQUAL2(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3c /* '<' */ )) { - mBITWISELEFT(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3e /* '>' */ )) { - mBITWISERIGHT(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x2d /* '-' */ ) && (true)) { - mMINUS(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x7c /* '|' */ ) && (true)) { - mBITOR(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3d /* '=' */ ) && (true)) { - mEQUAL(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3e /* '>' */ ) && (true)) { - mGREATER(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x3c /* '<' */ ) && (true)) { - mLOWER(true); - theRetToken=_returnToken; - } - else { - if (LA(1)==EOF_CHAR) - { - uponEOF(); - _returnToken = makeToken(ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE); - } - else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - } - if ( !_returnToken ) - goto tryAgain; // found SKIP token - - _ttype = _returnToken->getType(); - _ttype = testLiteralsTable(_ttype); - _returnToken->setType(_ttype); - return _returnToken; - } - catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& e) { - throw ANTLR_USE_NAMESPACE(antlr)TokenStreamRecognitionException(e); - } - catch (ANTLR_USE_NAMESPACE(antlr)CharStreamIOException& csie) { - throw ANTLR_USE_NAMESPACE(antlr)TokenStreamIOException(csie.io); - } - catch (ANTLR_USE_NAMESPACE(antlr)CharStreamException& cse) { - throw ANTLR_USE_NAMESPACE(antlr)TokenStreamException(cse.getMessage()); - } -tryAgain:; - } -} - -void Sqlite3Lexer::mDIGIT(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = DIGIT; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - matchRange(L'0',L'9'); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mDOT(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = DOT; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mID(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = ID; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - { - switch ( LA(1)) { - case 0x61 /* 'a' */ : - case 0x62 /* 'b' */ : - case 0x63 /* 'c' */ : - case 0x64 /* 'd' */ : - case 0x65 /* 'e' */ : - case 0x66 /* 'f' */ : - case 0x67 /* 'g' */ : - case 0x68 /* 'h' */ : - case 0x69 /* 'i' */ : - case 0x6a /* 'j' */ : - case 0x6b /* 'k' */ : - case 0x6c /* 'l' */ : - case 0x6d /* 'm' */ : - case 0x6e /* 'n' */ : - case 0x6f /* 'o' */ : - case 0x70 /* 'p' */ : - case 0x71 /* 'q' */ : - case 0x72 /* 'r' */ : - case 0x73 /* 's' */ : - case 0x74 /* 't' */ : - case 0x75 /* 'u' */ : - case 0x76 /* 'v' */ : - case 0x77 /* 'w' */ : - case 0x78 /* 'x' */ : - case 0x79 /* 'y' */ : - case 0x7a /* 'z' */ : - { - matchRange(L'a',L'z'); - break; - } - case 0x5f /* '_' */ : - { - match(L'_' /* charlit */ ); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { // ( ... )* - for (;;) { - switch ( LA(1)) { - case 0x61 /* 'a' */ : - case 0x62 /* 'b' */ : - case 0x63 /* 'c' */ : - case 0x64 /* 'd' */ : - case 0x65 /* 'e' */ : - case 0x66 /* 'f' */ : - case 0x67 /* 'g' */ : - case 0x68 /* 'h' */ : - case 0x69 /* 'i' */ : - case 0x6a /* 'j' */ : - case 0x6b /* 'k' */ : - case 0x6c /* 'l' */ : - case 0x6d /* 'm' */ : - case 0x6e /* 'n' */ : - case 0x6f /* 'o' */ : - case 0x70 /* 'p' */ : - case 0x71 /* 'q' */ : - case 0x72 /* 'r' */ : - case 0x73 /* 's' */ : - case 0x74 /* 't' */ : - case 0x75 /* 'u' */ : - case 0x76 /* 'v' */ : - case 0x77 /* 'w' */ : - case 0x78 /* 'x' */ : - case 0x79 /* 'y' */ : - case 0x7a /* 'z' */ : - { - matchRange(L'a',L'z'); - break; - } - case 0x30 /* '0' */ : - case 0x31 /* '1' */ : - case 0x32 /* '2' */ : - case 0x33 /* '3' */ : - case 0x34 /* '4' */ : - case 0x35 /* '5' */ : - case 0x36 /* '6' */ : - case 0x37 /* '7' */ : - case 0x38 /* '8' */ : - case 0x39 /* '9' */ : - { - matchRange(L'0',L'9'); - break; - } - case 0x5f /* '_' */ : - { - match(L'_' /* charlit */ ); - break; - } - default: - if (((LA(1) >= 0x80 && LA(1) <= 0x2b8))) { - matchRange(L'\200',L'\u02b8'); - } - else { - goto _loop6; - } - } - } - _loop6:; - } // ( ... )* - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mQUOTEDID(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = QUOTEDID; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - switch ( LA(1)) { - case 0x60 /* '`' */ : - { - match(L'`' /* charlit */ ); - { // ( ... )* - for (;;) { - if ((LA(1) == 0x60 /* '`' */ ) && (LA(2) == 0x60 /* '`' */ )) { - { - match(L'`' /* charlit */ ); - match(L'`' /* charlit */ ); - } - } - else if ((_tokenSet_0.member(LA(1)))) { - { - match(_tokenSet_0); - } - } - else { - goto _loop11; - } - - } - _loop11:; - } // ( ... )* - match(L'`' /* charlit */ ); - break; - } - case 0x5b /* '[' */ : - { - match(L'[' /* charlit */ ); - { // ( ... )* - for (;;) { - if ((_tokenSet_1.member(LA(1)))) { - { - match(_tokenSet_1); - } - } - else { - goto _loop14; - } - - } - _loop14:; - } // ( ... )* - match(L']' /* charlit */ ); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mQUOTEDLITERAL(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = QUOTEDLITERAL; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'\"' /* charlit */ ); - { // ( ... )* - for (;;) { - if ((LA(1) == 0x22 /* '\"' */ ) && (LA(2) == 0x22 /* '\"' */ )) { - { - match(L'\"' /* charlit */ ); - match(L'\"' /* charlit */ ); - } - } - else if ((_tokenSet_2.member(LA(1)))) { - matchNot(L'\"' /* charlit */ ); - } - else { - goto _loop18; - } - - } - _loop18:; - } // ( ... )* - match(L'\"' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mNUMERIC(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = NUMERIC; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - { - switch ( LA(1)) { - case 0x30 /* '0' */ : - case 0x31 /* '1' */ : - case 0x32 /* '2' */ : - case 0x33 /* '3' */ : - case 0x34 /* '4' */ : - case 0x35 /* '5' */ : - case 0x36 /* '6' */ : - case 0x37 /* '7' */ : - case 0x38 /* '8' */ : - case 0x39 /* '9' */ : - { - { // ( ... )+ - int _cnt22=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt22>=1 ) { goto _loop22; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt22++; - } - _loop22:; - } // ( ... )+ - { - if ((LA(1) == 0x2e /* '.' */ )) { - match(L'.' /* charlit */ ); - { // ( ... )* - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - goto _loop25; - } - - } - _loop25:; - } // ( ... )* - } - else { - } - - } - break; - } - case 0x2e /* '.' */ : - { - match(L'.' /* charlit */ ); - { // ( ... )+ - int _cnt27=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt27>=1 ) { goto _loop27; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt27++; - } - _loop27:; - } // ( ... )+ - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - if ((LA(1) == 0x65 /* 'e' */ )) { - match(L'e' /* charlit */ ); - { - switch ( LA(1)) { - case 0x2b /* '+' */ : - { - mPLUS(false); - break; - } - case 0x2d /* '-' */ : - { - mMINUS(false); - break; - } - case 0x30 /* '0' */ : - case 0x31 /* '1' */ : - case 0x32 /* '2' */ : - case 0x33 /* '3' */ : - case 0x34 /* '4' */ : - case 0x35 /* '5' */ : - case 0x36 /* '6' */ : - case 0x37 /* '7' */ : - case 0x38 /* '8' */ : - case 0x39 /* '9' */ : - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { // ( ... )+ - int _cnt31=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt31>=1 ) { goto _loop31; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt31++; - } - _loop31:; - } // ( ... )+ - } - else { - } - - } - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mPLUS(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = PLUS; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'+' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mMINUS(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = MINUS; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'-' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mNL(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = NL; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - { - switch ( LA(1)) { - case 0xd /* '\r' */ : - { - match(L'\r' /* charlit */ ); - break; - } - case 0xa /* '\n' */ : - { - match(L'\n' /* charlit */ ); - newline(); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mCOMMENT(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = COMMENT; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - { - switch ( LA(1)) { - case 0x2d /* '-' */ : - { - match(L'-' /* charlit */ ); - match(L'-' /* charlit */ ); - { // ( ... )* - for (;;) { - if ((_tokenSet_3.member(LA(1)))) { - { - match(_tokenSet_3); - } - } - else { - goto _loop38; - } - - } - _loop38:; - } // ( ... )* - mNL(false); - newline(); - break; - } - case 0x2f /* '/' */ : - { - match(L'/' /* charlit */ ); - match(L'*' /* charlit */ ); - { // ( ... )* - for (;;) { - // nongreedy exit test - if ((LA(1) == 0x2a /* '*' */ ) && (LA(2) == 0x2f /* '/' */ )) goto _loop41; - if ((_tokenSet_3.member(LA(1))) && ((LA(2) >= 0x0 /* '\0' */ && LA(2) <= 0xfffe))) { - { - match(_tokenSet_3); - } - } - else if ((LA(1) == 0xa /* '\n' */ || LA(1) == 0xd /* '\r' */ )) { - mNL(false); - newline(); - } - else { - goto _loop41; - } - - } - _loop41:; - } // ( ... )* - match(L'*' /* charlit */ ); - match(L'/' /* charlit */ ); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } - } - _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mWS(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = WS; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - { - switch ( LA(1)) { - case 0x20 /* ' ' */ : - { - match(L' ' /* charlit */ ); - break; - } - case 0x9 /* '\t' */ : - { - match(L'\t' /* charlit */ ); - break; - } - case 0xc /* '\14' */ : - { - match(L'\14' /* charlit */ ); - break; - } - case 0xa /* '\n' */ : - case 0xd /* '\r' */ : - { - mNL(false); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } - } - _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mSTRINGLITERAL(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = STRINGLITERAL; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'\'' /* charlit */ ); - { // ( ... )* - for (;;) { - if ((LA(1) == 0x27 /* '\'' */ ) && (LA(2) == 0x27 /* '\'' */ )) { - { - match(L'\'' /* charlit */ ); - match(L'\'' /* charlit */ ); - } - } - else if ((_tokenSet_4.member(LA(1)))) { - matchNot(L'\'' /* charlit */ ); - } - else { - goto _loop47; - } - - } - _loop47:; - } // ( ... )* - match(L'\'' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mLPAREN(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = LPAREN; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'(' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mRPAREN(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = RPAREN; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L')' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mCOMMA(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = COMMA; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L',' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mSEMI(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = SEMI; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L';' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mSTAR(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = STAR; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'*' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mTILDE(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = TILDE; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'~' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mAMPERSAND(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = AMPERSAND; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'&' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mBITOR(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = BITOR; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'|' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mOROP(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = OROP; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - mBITOR(false); - mBITOR(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mEQUAL(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = EQUAL; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'=' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mEQUAL2(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = EQUAL2; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - mEQUAL(false); - mEQUAL(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mGREATER(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = GREATER; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'>' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mGREATEREQUAL(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = GREATEREQUAL; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - mGREATER(false); - mEQUAL(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mLOWER(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = LOWER; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'<' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mLOWEREQUAL(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = LOWEREQUAL; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - mLOWER(false); - mEQUAL(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mUNEQUAL(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = UNEQUAL; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match(L'!' /* charlit */ ); - mEQUAL(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mUNEQUAL2(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = UNEQUAL2; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - mLOWER(false); - mGREATER(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mBITWISELEFT(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = BITWISELEFT; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - mLOWER(false); - mLOWER(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void Sqlite3Lexer::mBITWISERIGHT(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = BITWISERIGHT; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - mGREATER(false); - mGREATER(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - - -const unsigned long Sqlite3Lexer::_tokenSet_0_data_[] = { 4294967295UL, 4294967295UL, 4294967295UL, 4294967294UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 2147483647UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 -// 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e -// 0x1f ! \" # $ % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > -// ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ -// a b c d e f g h i j k l m n o p q r s t u v w x -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Lexer::_tokenSet_0(_tokenSet_0_data_,4096); -const unsigned long Sqlite3Lexer::_tokenSet_1_data_[] = { 4294967295UL, 4294967295UL, 3758096383UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 2147483647UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 -// 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e -// 0x1f ! \" # $ % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > -// ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ^ _ ` -// a b c d e f g h i j k l m n o p q r s t u v w x -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Lexer::_tokenSet_1(_tokenSet_1_data_,4096); -const unsigned long Sqlite3Lexer::_tokenSet_2_data_[] = { 4294967295UL, 4294967291UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 2147483647UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 -// 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e -// 0x1f ! # $ % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? -// @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` -// a b c d e f g h i j k l m n o p q r s t u v w x -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Lexer::_tokenSet_2(_tokenSet_2_data_,4096); -const unsigned long Sqlite3Lexer::_tokenSet_3_data_[] = { 4294958079UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 2147483647UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 -// 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! -// \" # $ % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B -// C D E F G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c -// d e f g h i j k l m n o p q r s t u v w x -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Lexer::_tokenSet_3(_tokenSet_3_data_,4096); -const unsigned long Sqlite3Lexer::_tokenSet_4_data_[] = { 4294967295UL, 4294967167UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 2147483647UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 -// 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e -// 0x1f ! \" # $ % & ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? -// @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` -// a b c d e f g h i j k l m n o p q r s t u v w x -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Lexer::_tokenSet_4(_tokenSet_4_data_,4096); - diff --git a/src/grammar/Sqlite3Lexer.hpp b/src/grammar/Sqlite3Lexer.hpp deleted file mode 100644 index ce259078..00000000 --- a/src/grammar/Sqlite3Lexer.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef INC_Sqlite3Lexer_hpp_ -#define INC_Sqlite3Lexer_hpp_ - -#include -/* $ANTLR 2.7.7 (20171109): "sqlite3.g" -> "Sqlite3Lexer.hpp"$ */ -#include -#include -#include -#include "sqlite3TokenTypes.hpp" -#include -class CUSTOM_API Sqlite3Lexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public sqlite3TokenTypes -{ -private: - void initLiterals(); -public: - bool getCaseSensitiveLiterals() const - { - return false; - } -public: - Sqlite3Lexer(ANTLR_USE_NAMESPACE(std)istream& in); - Sqlite3Lexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); - Sqlite3Lexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); - ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); - protected: void mDIGIT(bool _createToken); - protected: void mDOT(bool _createToken); - public: void mID(bool _createToken); - public: void mQUOTEDID(bool _createToken); - public: void mQUOTEDLITERAL(bool _createToken); - public: void mNUMERIC(bool _createToken); - public: void mPLUS(bool _createToken); - public: void mMINUS(bool _createToken); - protected: void mNL(bool _createToken); - public: void mCOMMENT(bool _createToken); - public: void mWS(bool _createToken); - public: void mSTRINGLITERAL(bool _createToken); - public: void mLPAREN(bool _createToken); - public: void mRPAREN(bool _createToken); - public: void mCOMMA(bool _createToken); - public: void mSEMI(bool _createToken); - public: void mSTAR(bool _createToken); - public: void mTILDE(bool _createToken); - public: void mAMPERSAND(bool _createToken); - public: void mBITOR(bool _createToken); - public: void mOROP(bool _createToken); - public: void mEQUAL(bool _createToken); - public: void mEQUAL2(bool _createToken); - public: void mGREATER(bool _createToken); - public: void mGREATEREQUAL(bool _createToken); - public: void mLOWER(bool _createToken); - public: void mLOWEREQUAL(bool _createToken); - public: void mUNEQUAL(bool _createToken); - public: void mUNEQUAL2(bool _createToken); - public: void mBITWISELEFT(bool _createToken); - public: void mBITWISERIGHT(bool _createToken); -private: - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; -}; - -#endif /*INC_Sqlite3Lexer_hpp_*/ diff --git a/src/grammar/Sqlite3Parser.cpp b/src/grammar/Sqlite3Parser.cpp deleted file mode 100644 index 9d818ba2..00000000 --- a/src/grammar/Sqlite3Parser.cpp +++ /dev/null @@ -1,5948 +0,0 @@ -/* $ANTLR 2.7.7 (20171109): "sqlite3.g" -> "Sqlite3Parser.cpp"$ */ -#include "Sqlite3Parser.hpp" -#include -#include -#include -Sqlite3Parser::Sqlite3Parser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k) -: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,k) -{ -} - -Sqlite3Parser::Sqlite3Parser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf) -: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,2) -{ -} - -Sqlite3Parser::Sqlite3Parser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k) -: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,k) -{ -} - -Sqlite3Parser::Sqlite3Parser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer) -: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,2) -{ -} - -Sqlite3Parser::Sqlite3Parser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state) -: ANTLR_USE_NAMESPACE(antlr)LLkParser(state,2) -{ -} - -void Sqlite3Parser::id() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST id_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - switch ( LA(1)) { - case ID: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp1_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp1_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp1_AST); - } - match(ID); - id_AST = currentAST.root; - break; - } - case QUOTEDID: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp2_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp2_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp2_AST); - } - match(QUOTEDID); - id_AST = currentAST.root; - break; - } - case QUOTEDLITERAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp3_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp3_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp3_AST); - } - match(QUOTEDLITERAL); - id_AST = currentAST.root; - break; - } - case STRINGLITERAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp4_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp4_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp4_AST); - } - match(STRINGLITERAL); - id_AST = currentAST.root; - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - returnAST = id_AST; -} - -void Sqlite3Parser::databasename() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST databasename_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - id(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - databasename_AST = currentAST.root; - returnAST = databasename_AST; -} - -void Sqlite3Parser::tablename() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST tablename_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - id(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - tablename_AST = currentAST.root; - returnAST = tablename_AST; -} - -void Sqlite3Parser::nonkeyword_columnname() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST nonkeyword_columnname_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - id(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - nonkeyword_columnname_AST = currentAST.root; - returnAST = nonkeyword_columnname_AST; -} - -void Sqlite3Parser::identifier() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST identifier_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - if ((_tokenSet_0.member(LA(1))) && (_tokenSet_0.member(LA(2)))) { - { - switch ( LA(1)) { - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - databasename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case DOT: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp5_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp5_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp5_AST); - } - match(DOT); - } - else if ((_tokenSet_1.member(LA(1))) && (LA(2) == ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE)) { - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - } - tablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - identifier_AST = currentAST.root; - returnAST = identifier_AST; -} - -void Sqlite3Parser::collationname() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST collationname_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - ANTLR_USE_NAMESPACE(antlr)RefAST tmp6_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp6_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp6_AST); - } - match(ID); - collationname_AST = currentAST.root; - returnAST = collationname_AST; -} - -void Sqlite3Parser::signednumber() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST signednumber_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - switch ( LA(1)) { - case PLUS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp7_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp7_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp7_AST); - } - match(PLUS); - break; - } - case MINUS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp8_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp8_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp8_AST); - } - match(MINUS); - break; - } - case NUMERIC: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp9_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp9_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp9_AST); - } - match(NUMERIC); - signednumber_AST = currentAST.root; - returnAST = signednumber_AST; -} - -void Sqlite3Parser::statementlist() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST statementlist_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - switch ( LA(1)) { - case CREATE: - { - statement(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE: - case SEMI: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { // ( ... )* - for (;;) { - if ((LA(1) == SEMI)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp10_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp10_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp10_AST); - } - match(SEMI); - statement(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop82; - } - - } - _loop82:; - } // ( ... )* - statementlist_AST = currentAST.root; - returnAST = statementlist_AST; -} - -void Sqlite3Parser::statement() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST statement_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - if ((LA(1) == CREATE) && (_tokenSet_2.member(LA(2)))) { - createtable(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - statement_AST = currentAST.root; - } - else if ((LA(1) == CREATE) && (LA(2) == INDEX || LA(2) == UNIQUE)) { - createindex(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - statement_AST = currentAST.root; - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - returnAST = statement_AST; -} - -void Sqlite3Parser::createtable() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST createtable_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - if ((LA(1) == CREATE) && (LA(2) == TABLE || LA(2) == TEMPORARY || LA(2) == TEMP)) { - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp11_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp11_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp11_AST); - } - match(CREATE); - { - switch ( LA(1)) { - case TEMP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp12_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp12_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp12_AST); - } - match(TEMP); - break; - } - case TEMPORARY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp13_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp13_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp13_AST); - } - match(TEMPORARY); - break; - } - case TABLE: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp14_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp14_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp14_AST); - } - match(TABLE); - { - switch ( LA(1)) { - case IF_T: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp15_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp15_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp15_AST); - } - match(IF_T); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp16_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp16_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp16_AST); - } - match(NOT); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp17_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp17_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp17_AST); - } - match(EXISTS); - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - tablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - { - keywordastablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case LPAREN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp18_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp18_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp18_AST); - } - match(LPAREN); - columndef(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA) && (_tokenSet_3.member(LA(2)))) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp19_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp19_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp19_AST); - } - match(COMMA); - columndef(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop94; - } - - } - _loop94:; - } // ( ... )* - { // ( ... )* - for (;;) { - if ((_tokenSet_4.member(LA(1)))) { - { - switch ( LA(1)) { - case COMMA: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp20_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp20_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp20_AST); - } - match(COMMA); - break; - } - case CHECK: - case CONSTRAINT: - case FOREIGN: - case PRIMARY: - case UNIQUE: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - tableconstraint(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop97; - } - - } - _loop97:; - } // ( ... )* - ANTLR_USE_NAMESPACE(antlr)RefAST tmp21_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp21_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp21_AST); - } - match(RPAREN); - { - switch ( LA(1)) { - case WITHOUT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp22_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp22_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp22_AST); - } - match(WITHOUT); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp23_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp23_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp23_AST); - } - match(ROWID); - break; - } - case ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE: - case SEMI: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case AS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp24_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp24_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp24_AST); - } - match(AS); - selectstmt(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState->guessing==0 ) { - createtable_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - createtable_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(CREATETABLE,"CREATETABLE"))->add(createtable_AST))); - currentAST.root = createtable_AST; - if ( createtable_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - createtable_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = createtable_AST->getFirstChild(); - else - currentAST.child = createtable_AST; - currentAST.advanceChildToEnd(); - } - } - createtable_AST = currentAST.root; - } - else if ((LA(1) == CREATE) && (LA(2) == VIRTUAL)) { - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp25_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp25_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp25_AST); - } - match(CREATE); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp26_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp26_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp26_AST); - } - match(VIRTUAL); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp27_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp27_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp27_AST); - } - match(TABLE); - { - switch ( LA(1)) { - case IF_T: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp28_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp28_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp28_AST); - } - match(IF_T); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp29_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp29_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp29_AST); - } - match(NOT); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp30_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp30_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp30_AST); - } - match(EXISTS); - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - tablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - { - keywordastablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp31_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp31_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp31_AST); - } - match(USING); - name(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { - switch ( LA(1)) { - case LPAREN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp32_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp32_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp32_AST); - } - match(LPAREN); - { - switch ( LA(1)) { - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CASE_T: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IF_T: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case NOT: - case NULL_T: - case MATCH: - case EXISTS: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case NUMERIC: - case STRINGLITERAL: - case LPAREN: - case PLUS: - case MINUS: - case TILDE: - { - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp33_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp33_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp33_AST); - } - match(COMMA); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop105; - } - - } - _loop105:; - } // ( ... )* - break; - } - case RPAREN: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp34_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp34_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp34_AST); - } - match(RPAREN); - break; - } - case ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE: - case SEMI: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - } - createtable_AST = currentAST.root; - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - returnAST = createtable_AST; -} - -void Sqlite3Parser::createindex() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST createindex_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - ANTLR_USE_NAMESPACE(antlr)RefAST tmp35_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp35_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp35_AST); - } - match(CREATE); - { - switch ( LA(1)) { - case UNIQUE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp36_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp36_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp36_AST); - } - match(UNIQUE); - break; - } - case INDEX: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp37_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp37_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp37_AST); - } - match(INDEX); - { - switch ( LA(1)) { - case IF_T: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp38_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp38_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp38_AST); - } - match(IF_T); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp39_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp39_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp39_AST); - } - match(NOT); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp40_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp40_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp40_AST); - } - match(EXISTS); - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - tablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - { - keywordastablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp41_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp41_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp41_AST); - } - match(ON); - { - switch ( LA(1)) { - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - tablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - { - keywordastablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp42_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp42_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp42_AST); - } - match(LPAREN); - indexedcolumn(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp43_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp43_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp43_AST); - } - match(COMMA); - indexedcolumn(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop113; - } - - } - _loop113:; - } // ( ... )* - ANTLR_USE_NAMESPACE(antlr)RefAST tmp44_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp44_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp44_AST); - } - match(RPAREN); - { - switch ( LA(1)) { - case WHERE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp45_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp45_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp45_AST); - } - match(WHERE); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE: - case SEMI: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - } - if ( inputState->guessing==0 ) { - createindex_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - createindex_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(CREATEINDEX,"CREATEINDEX"))->add(createindex_AST))); - currentAST.root = createindex_AST; - if ( createindex_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - createindex_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = createindex_AST->getFirstChild(); - else - currentAST.child = createindex_AST; - currentAST.advanceChildToEnd(); - } - createindex_AST = currentAST.root; - returnAST = createindex_AST; -} - -void Sqlite3Parser::create_statements() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST create_statements_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - if ((LA(1) == CREATE) && (_tokenSet_2.member(LA(2)))) { - createtable(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - create_statements_AST = currentAST.root; - } - else if ((LA(1) == CREATE) && (LA(2) == INDEX || LA(2) == UNIQUE)) { - createindex(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - create_statements_AST = currentAST.root; - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - returnAST = create_statements_AST; -} - -void Sqlite3Parser::keywordastablename() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST keywordastablename_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - switch ( LA(1)) { - case ABORT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp46_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp46_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp46_AST); - } - match(ABORT); - break; - } - case ACTION: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp47_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp47_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp47_AST); - } - match(ACTION); - break; - } - case ASC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp48_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp48_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp48_AST); - } - match(ASC); - break; - } - case CASCADE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp49_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp49_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp49_AST); - } - match(CASCADE); - break; - } - case CAST: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp50_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp50_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp50_AST); - } - match(CAST); - break; - } - case CONFLICT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp51_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp51_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp51_AST); - } - match(CONFLICT); - break; - } - case CURRENT_TIME: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp52_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp52_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp52_AST); - } - match(CURRENT_TIME); - break; - } - case CURRENT_DATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp53_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp53_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp53_AST); - } - match(CURRENT_DATE); - break; - } - case CURRENT_TIMESTAMP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp54_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp54_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp54_AST); - } - match(CURRENT_TIMESTAMP); - break; - } - case DEFERRED: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp55_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp55_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp55_AST); - } - match(DEFERRED); - break; - } - case DESC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp56_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp56_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp56_AST); - } - match(DESC); - break; - } - case ELSE_T: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp57_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp57_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp57_AST); - } - match(ELSE_T); - break; - } - case END: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp58_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp58_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp58_AST); - } - match(END); - break; - } - case FAIL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp59_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp59_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp59_AST); - } - match(FAIL); - break; - } - case FILTER: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp60_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp60_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp60_AST); - } - match(FILTER); - break; - } - case FOLLOWING: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp61_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp61_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp61_AST); - } - match(FOLLOWING); - break; - } - case GLOB: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp62_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp62_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp62_AST); - } - match(GLOB); - break; - } - case KEY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp63_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp63_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp63_AST); - } - match(KEY); - break; - } - case LIKE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp64_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp64_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp64_AST); - } - match(LIKE); - break; - } - case IGNORE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp65_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp65_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp65_AST); - } - match(IGNORE); - break; - } - case INITIALLY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp66_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp66_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp66_AST); - } - match(INITIALLY); - break; - } - case IMMEDIATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp67_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp67_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp67_AST); - } - match(IMMEDIATE); - break; - } - case MATCH: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp68_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp68_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp68_AST); - } - match(MATCH); - break; - } - case NO: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp69_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp69_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp69_AST); - } - match(NO); - break; - } - case OVER: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp70_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp70_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp70_AST); - } - match(OVER); - break; - } - case PARTITION: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp71_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp71_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp71_AST); - } - match(PARTITION); - break; - } - case PRECEDING: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp72_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp72_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp72_AST); - } - match(PRECEDING); - break; - } - case RAISE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp73_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp73_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp73_AST); - } - match(RAISE); - break; - } - case RANGE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp74_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp74_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp74_AST); - } - match(RANGE); - break; - } - case REGEXP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp75_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp75_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp75_AST); - } - match(REGEXP); - break; - } - case REPLACE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp76_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp76_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp76_AST); - } - match(REPLACE); - break; - } - case RESTRICT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp77_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp77_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp77_AST); - } - match(RESTRICT); - break; - } - case ROLLBACK: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp78_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp78_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp78_AST); - } - match(ROLLBACK); - break; - } - case ROWID: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp79_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp79_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp79_AST); - } - match(ROWID); - break; - } - case ROWS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp80_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp80_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp80_AST); - } - match(ROWS); - break; - } - case TEMPORARY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp81_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp81_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp81_AST); - } - match(TEMPORARY); - break; - } - case TEMP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp82_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp82_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp82_AST); - } - match(TEMP); - break; - } - case UNBOUNDED: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp83_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp83_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp83_AST); - } - match(UNBOUNDED); - break; - } - case VIRTUAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp84_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp84_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp84_AST); - } - match(VIRTUAL); - break; - } - case WITHOUT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp85_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp85_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp85_AST); - } - match(WITHOUT); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState->guessing==0 ) { - keywordastablename_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - keywordastablename_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(KEYWORDASTABLENAME,"KEYWORDASTABLENAME"))->add(keywordastablename_AST))); - currentAST.root = keywordastablename_AST; - if ( keywordastablename_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - keywordastablename_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = keywordastablename_AST->getFirstChild(); - else - currentAST.child = keywordastablename_AST; - currentAST.advanceChildToEnd(); - } - keywordastablename_AST = currentAST.root; - returnAST = keywordastablename_AST; -} - -void Sqlite3Parser::columndef() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST columndef_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - columnname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { - switch ( LA(1)) { - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - type_name(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case FOREIGN: - case NOT: - case NULL_T: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { // ( ... )* - for (;;) { - if ((_tokenSet_5.member(LA(1))) && (_tokenSet_6.member(LA(2)))) { - columnconstraint(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop122; - } - - } - _loop122:; - } // ( ... )* - if ( inputState->guessing==0 ) { - columndef_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - columndef_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(COLUMNDEF,"COLUMNDEF"))->add(columndef_AST))); - currentAST.root = columndef_AST; - if ( columndef_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - columndef_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = columndef_AST->getFirstChild(); - else - currentAST.child = columndef_AST; - currentAST.advanceChildToEnd(); - } - columndef_AST = currentAST.root; - returnAST = columndef_AST; -} - -void Sqlite3Parser::tableconstraint() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST tableconstraint_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - switch ( LA(1)) { - case CONSTRAINT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp86_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp86_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp86_AST); - } - match(CONSTRAINT); - name(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case CHECK: - case FOREIGN: - case PRIMARY: - case UNIQUE: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case PRIMARY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp87_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp87_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp87_AST); - } - match(PRIMARY); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp88_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp88_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp88_AST); - } - match(KEY); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp89_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp89_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp89_AST); - } - match(LPAREN); - indexedcolumn(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp90_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp90_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp90_AST); - } - match(COMMA); - indexedcolumn(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop143; - } - - } - _loop143:; - } // ( ... )* - ANTLR_USE_NAMESPACE(antlr)RefAST tmp91_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp91_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp91_AST); - } - match(RPAREN); - { - switch ( LA(1)) { - case ON: - { - conflictclause(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case CHECK: - case CONSTRAINT: - case FOREIGN: - case PRIMARY: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case UNIQUE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp92_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp92_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp92_AST); - } - match(UNIQUE); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp93_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp93_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp93_AST); - } - match(LPAREN); - indexedcolumn(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp94_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp94_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp94_AST); - } - match(COMMA); - indexedcolumn(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop146; - } - - } - _loop146:; - } // ( ... )* - ANTLR_USE_NAMESPACE(antlr)RefAST tmp95_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp95_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp95_AST); - } - match(RPAREN); - { - switch ( LA(1)) { - case ON: - { - conflictclause(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case CHECK: - case CONSTRAINT: - case FOREIGN: - case PRIMARY: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case CHECK: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp96_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp96_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp96_AST); - } - match(CHECK); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp97_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp97_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp97_AST); - } - match(LPAREN); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp98_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp98_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp98_AST); - } - match(RPAREN); - break; - } - case FOREIGN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp99_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp99_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp99_AST); - } - match(FOREIGN); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp100_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp100_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp100_AST); - } - match(KEY); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp101_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp101_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp101_AST); - } - match(LPAREN); - columnname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp102_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp102_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp102_AST); - } - match(COMMA); - columnname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop149; - } - - } - _loop149:; - } // ( ... )* - ANTLR_USE_NAMESPACE(antlr)RefAST tmp103_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp103_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp103_AST); - } - match(RPAREN); - foreignkeyclause(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState->guessing==0 ) { - tableconstraint_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - tableconstraint_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(TABLECONSTRAINT,"TABLECONSTRAINT"))->add(tableconstraint_AST))); - currentAST.root = tableconstraint_AST; - if ( tableconstraint_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - tableconstraint_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = tableconstraint_AST->getFirstChild(); - else - currentAST.child = tableconstraint_AST; - currentAST.advanceChildToEnd(); - } - tableconstraint_AST = currentAST.root; - returnAST = tableconstraint_AST; -} - -void Sqlite3Parser::selectstmt() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST selectstmt_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - ANTLR_USE_NAMESPACE(antlr)RefAST tmp104_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp104_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp104_AST); - } - match(SELECT); - selectstmt_AST = currentAST.root; - returnAST = selectstmt_AST; -} - -void Sqlite3Parser::name() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST name_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - switch ( LA(1)) { - case ID: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp105_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp105_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp105_AST); - } - match(ID); - name_AST = currentAST.root; - break; - } - case QUOTEDID: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp106_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp106_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp106_AST); - } - match(QUOTEDID); - name_AST = currentAST.root; - break; - } - case QUOTEDLITERAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp107_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp107_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp107_AST); - } - match(QUOTEDLITERAL); - name_AST = currentAST.root; - break; - } - case STRINGLITERAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp108_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp108_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp108_AST); - } - match(STRINGLITERAL); - name_AST = currentAST.root; - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - returnAST = name_AST; -} - -void Sqlite3Parser::expr() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST expr_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - switch ( LA(1)) { - case LPAREN: - { - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp109_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp109_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp109_AST); - } - match(LPAREN); - { - { - if ((_tokenSet_7.member(LA(1))) && (_tokenSet_8.member(LA(2)))) { - { - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )+ - int _cnt180=0; - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp110_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp110_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp110_AST); - } - match(COMMA); - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - if ( _cnt180>=1 ) { goto _loop180; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} - } - - _cnt180++; - } - _loop180:; - } // ( ... )+ - ANTLR_USE_NAMESPACE(antlr)RefAST tmp111_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp111_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp111_AST); - } - match(RPAREN); - binaryoperator(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp112_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp112_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp112_AST); - } - match(LPAREN); - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )+ - int _cnt182=0; - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp113_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp113_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp113_AST); - } - match(COMMA); - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - if ( _cnt182>=1 ) { goto _loop182; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} - } - - _cnt182++; - } - _loop182:; - } // ( ... )+ - } - } - else if ((_tokenSet_9.member(LA(1))) && (_tokenSet_10.member(LA(2)))) { - { - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp114_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp114_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp114_AST); - } - match(RPAREN); - } - { // ( ... )* - for (;;) { - if ((LA(1) == AND || LA(1) == OR) && (_tokenSet_9.member(LA(2)))) { - { - switch ( LA(1)) { - case AND: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp115_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp115_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp115_AST); - } - match(AND); - break; - } - case OR: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp116_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp116_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp116_AST); - } - match(OR); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop186; - } - - } - _loop186:; - } // ( ... )* - } - expr_AST = currentAST.root; - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CASE_T: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IF_T: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case NOT: - case NULL_T: - case MATCH: - case EXISTS: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case NUMERIC: - case STRINGLITERAL: - case PLUS: - case MINUS: - case TILDE: - { - { - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((_tokenSet_11.member(LA(1))) && (_tokenSet_7.member(LA(2)))) { - { - switch ( LA(1)) { - case GLOB: - case LIKE: - case IS: - case MATCH: - case REGEXP: - case PLUS: - case MINUS: - case STAR: - case AMPERSAND: - case BITOR: - case OROP: - case EQUAL: - case EQUAL2: - case GREATER: - case GREATEREQUAL: - case LOWER: - case LOWEREQUAL: - case UNEQUAL: - case UNEQUAL2: - case BITWISELEFT: - case BITWISERIGHT: - case SLASH: - case PERCENT: - { - binaryoperator(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case AND: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp117_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp117_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp117_AST); - } - match(AND); - break; - } - case OR: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp118_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp118_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp118_AST); - } - match(OR); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop190; - } - - } - _loop190:; - } // ( ... )* - } - expr_AST = currentAST.root; - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - returnAST = expr_AST; -} - -void Sqlite3Parser::indexedcolumn() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST indexedcolumn_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { - switch ( LA(1)) { - case COLLATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp119_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp119_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp119_AST); - } - match(COLLATE); - collationname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case AUTOINCREMENT: - case ASC: - case DESC: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case ASC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp120_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp120_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp120_AST); - } - match(ASC); - break; - } - case DESC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp121_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp121_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp121_AST); - } - match(DESC); - break; - } - case AUTOINCREMENT: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case AUTOINCREMENT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp122_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp122_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp122_AST); - } - match(AUTOINCREMENT); - break; - } - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState->guessing==0 ) { - indexedcolumn_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - indexedcolumn_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(INDEXEDCOLUMN,"INDEXEDCOLUMN"))->add(indexedcolumn_AST))); - currentAST.root = indexedcolumn_AST; - if ( indexedcolumn_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - indexedcolumn_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = indexedcolumn_AST->getFirstChild(); - else - currentAST.child = indexedcolumn_AST; - currentAST.advanceChildToEnd(); - } - indexedcolumn_AST = currentAST.root; - returnAST = indexedcolumn_AST; -} - -void Sqlite3Parser::keywordascolumnname() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST keywordascolumnname_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - switch ( LA(1)) { - case ABORT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp123_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp123_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp123_AST); - } - match(ABORT); - break; - } - case ACTION: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp124_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp124_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp124_AST); - } - match(ACTION); - break; - } - case ASC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp125_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp125_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp125_AST); - } - match(ASC); - break; - } - case CASCADE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp126_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp126_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp126_AST); - } - match(CASCADE); - break; - } - case CAST: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp127_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp127_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp127_AST); - } - match(CAST); - break; - } - case CONFLICT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp128_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp128_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp128_AST); - } - match(CONFLICT); - break; - } - case CURRENT_TIME: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp129_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp129_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp129_AST); - } - match(CURRENT_TIME); - break; - } - case CURRENT_DATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp130_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp130_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp130_AST); - } - match(CURRENT_DATE); - break; - } - case CURRENT_TIMESTAMP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp131_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp131_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp131_AST); - } - match(CURRENT_TIMESTAMP); - break; - } - case DEFERRED: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp132_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp132_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp132_AST); - } - match(DEFERRED); - break; - } - case DESC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp133_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp133_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp133_AST); - } - match(DESC); - break; - } - case END: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp134_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp134_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp134_AST); - } - match(END); - break; - } - case FAIL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp135_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp135_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp135_AST); - } - match(FAIL); - break; - } - case FILTER: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp136_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp136_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp136_AST); - } - match(FILTER); - break; - } - case FOLLOWING: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp137_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp137_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp137_AST); - } - match(FOLLOWING); - break; - } - case GLOB: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp138_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp138_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp138_AST); - } - match(GLOB); - break; - } - case KEY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp139_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp139_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp139_AST); - } - match(KEY); - break; - } - case LIKE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp140_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp140_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp140_AST); - } - match(LIKE); - break; - } - case IF_T: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp141_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp141_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp141_AST); - } - match(IF_T); - break; - } - case IGNORE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp142_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp142_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp142_AST); - } - match(IGNORE); - break; - } - case INITIALLY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp143_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp143_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp143_AST); - } - match(INITIALLY); - break; - } - case IMMEDIATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp144_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp144_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp144_AST); - } - match(IMMEDIATE); - break; - } - case MATCH: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp145_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp145_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp145_AST); - } - match(MATCH); - break; - } - case NO: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp146_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp146_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp146_AST); - } - match(NO); - break; - } - case OVER: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp147_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp147_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp147_AST); - } - match(OVER); - break; - } - case PARTITION: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp148_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp148_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp148_AST); - } - match(PARTITION); - break; - } - case PRECEDING: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp149_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp149_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp149_AST); - } - match(PRECEDING); - break; - } - case RAISE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp150_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp150_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp150_AST); - } - match(RAISE); - break; - } - case RANGE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp151_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp151_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp151_AST); - } - match(RANGE); - break; - } - case REGEXP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp152_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp152_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp152_AST); - } - match(REGEXP); - break; - } - case REPLACE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp153_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp153_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp153_AST); - } - match(REPLACE); - break; - } - case RESTRICT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp154_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp154_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp154_AST); - } - match(RESTRICT); - break; - } - case ROLLBACK: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp155_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp155_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp155_AST); - } - match(ROLLBACK); - break; - } - case ROWID: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp156_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp156_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp156_AST); - } - match(ROWID); - break; - } - case ROWS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp157_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp157_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp157_AST); - } - match(ROWS); - break; - } - case TEMPORARY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp158_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp158_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp158_AST); - } - match(TEMPORARY); - break; - } - case TEMP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp159_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp159_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp159_AST); - } - match(TEMP); - break; - } - case UNBOUNDED: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp160_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp160_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp160_AST); - } - match(UNBOUNDED); - break; - } - case VIRTUAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp161_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp161_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp161_AST); - } - match(VIRTUAL); - break; - } - case WITHOUT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp162_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp162_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp162_AST); - } - match(WITHOUT); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState->guessing==0 ) { - keywordascolumnname_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - keywordascolumnname_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(KEYWORDASCOLUMNNAME,"KEYWORDASCOLUMNNAME"))->add(keywordascolumnname_AST))); - currentAST.root = keywordascolumnname_AST; - if ( keywordascolumnname_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - keywordascolumnname_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = keywordascolumnname_AST->getFirstChild(); - else - currentAST.child = keywordascolumnname_AST; - currentAST.advanceChildToEnd(); - } - keywordascolumnname_AST = currentAST.root; - returnAST = keywordascolumnname_AST; -} - -void Sqlite3Parser::columnname() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST columnname_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - switch ( LA(1)) { - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - nonkeyword_columnname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IF_T: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - { - keywordascolumnname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState->guessing==0 ) { - } - columnname_AST = currentAST.root; - returnAST = columnname_AST; -} - -void Sqlite3Parser::type_name() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST type_name_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { // ( ... )+ - int _cnt126=0; - for (;;) { - switch ( LA(1)) { - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - name(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case ELSE_T: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case MATCH: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - { - keywordastablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - if ( _cnt126>=1 ) { goto _loop126; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} - } - } - _cnt126++; - } - _loop126:; - } // ( ... )+ - { - switch ( LA(1)) { - case LPAREN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp163_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp163_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp163_AST); - } - match(LPAREN); - signednumber(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { - switch ( LA(1)) { - case COMMA: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp164_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp164_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp164_AST); - } - match(COMMA); - signednumber(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case RPAREN: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp165_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp165_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp165_AST); - } - match(RPAREN); - break; - } - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case FOREIGN: - case NOT: - case NULL_T: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState->guessing==0 ) { - type_name_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - type_name_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(TYPE_NAME,"TYPE_NAME"))->add(type_name_AST))); - currentAST.root = type_name_AST; - if ( type_name_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - type_name_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = type_name_AST->getFirstChild(); - else - currentAST.child = type_name_AST; - currentAST.advanceChildToEnd(); - } - type_name_AST = currentAST.root; - returnAST = type_name_AST; -} - -void Sqlite3Parser::columnconstraint() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST columnconstraint_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - switch ( LA(1)) { - case CONSTRAINT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp166_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp166_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp166_AST); - } - match(CONSTRAINT); - name(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case CHECK: - case COLLATE: - case DEFAULT: - case NOT: - case NULL_T: - case PRIMARY: - case REFERENCES: - case UNIQUE: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case PRIMARY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp167_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp167_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp167_AST); - } - match(PRIMARY); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp168_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp168_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp168_AST); - } - match(KEY); - { - switch ( LA(1)) { - case ASC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp169_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp169_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp169_AST); - } - match(ASC); - break; - } - case DESC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp170_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp170_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp170_AST); - } - match(DESC); - break; - } - case AUTOINCREMENT: - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case FOREIGN: - case NOT: - case NULL_T: - case ON: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case ON: - { - conflictclause(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case AUTOINCREMENT: - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case FOREIGN: - case NOT: - case NULL_T: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case AUTOINCREMENT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp171_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp171_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp171_AST); - } - match(AUTOINCREMENT); - break; - } - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case FOREIGN: - case NOT: - case NULL_T: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case NOT: - case NULL_T: - { - { - switch ( LA(1)) { - case NOT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp172_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp172_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp172_AST); - } - match(NOT); - break; - } - case NULL_T: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp173_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp173_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp173_AST); - } - match(NULL_T); - { - switch ( LA(1)) { - case ON: - { - conflictclause(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case FOREIGN: - case NOT: - case NULL_T: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case UNIQUE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp174_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp174_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp174_AST); - } - match(UNIQUE); - { - switch ( LA(1)) { - case ON: - { - conflictclause(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case FOREIGN: - case NOT: - case NULL_T: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case CHECK: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp175_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp175_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp175_AST); - } - match(CHECK); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp176_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp176_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp176_AST); - } - match(LPAREN); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp177_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp177_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp177_AST); - } - match(RPAREN); - break; - } - case DEFAULT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp178_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp178_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp178_AST); - } - match(DEFAULT); - { - switch ( LA(1)) { - case QUOTEDLITERAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp179_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp179_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp179_AST); - } - match(QUOTEDLITERAL); - break; - } - case LPAREN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp180_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp180_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp180_AST); - } - match(LPAREN); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp181_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp181_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp181_AST); - } - match(RPAREN); - break; - } - case ID: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp182_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp182_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp182_AST); - } - match(ID); - break; - } - default: - if ((_tokenSet_12.member(LA(1))) && (_tokenSet_13.member(LA(2)))) { - literalvalue(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else if ((_tokenSet_14.member(LA(1))) && (_tokenSet_13.member(LA(2)))) { - keywordastablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else if ((LA(1) == NUMERIC || LA(1) == PLUS || LA(1) == MINUS) && (_tokenSet_15.member(LA(2)))) { - signednumber(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case COLLATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp183_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp183_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp183_AST); - } - match(COLLATE); - collationname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case REFERENCES: - { - foreignkeyclause(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState->guessing==0 ) { - columnconstraint_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(currentAST.root); - columnconstraint_AST = ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(astFactory->create(COLUMNCONSTRAINT,"COLUMNCONSTRAINT"))->add(columnconstraint_AST))); - currentAST.root = columnconstraint_AST; - if ( columnconstraint_AST!=ANTLR_USE_NAMESPACE(antlr)nullAST && - columnconstraint_AST->getFirstChild() != ANTLR_USE_NAMESPACE(antlr)nullAST ) - currentAST.child = columnconstraint_AST->getFirstChild(); - else - currentAST.child = columnconstraint_AST; - currentAST.advanceChildToEnd(); - } - columnconstraint_AST = currentAST.root; - returnAST = columnconstraint_AST; -} - -void Sqlite3Parser::conflictclause() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST conflictclause_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - ANTLR_USE_NAMESPACE(antlr)RefAST tmp184_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp184_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp184_AST); - } - match(ON); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp185_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp185_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp185_AST); - } - match(CONFLICT); - { - switch ( LA(1)) { - case ROLLBACK: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp186_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp186_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp186_AST); - } - match(ROLLBACK); - break; - } - case ABORT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp187_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp187_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp187_AST); - } - match(ABORT); - break; - } - case FAIL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp188_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp188_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp188_AST); - } - match(FAIL); - break; - } - case IGNORE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp189_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp189_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp189_AST); - } - match(IGNORE); - break; - } - case REPLACE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp190_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp190_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp190_AST); - } - match(REPLACE); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - conflictclause_AST = currentAST.root; - returnAST = conflictclause_AST; -} - -void Sqlite3Parser::literalvalue() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST literalvalue_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - switch ( LA(1)) { - case NUMERIC: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp191_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp191_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp191_AST); - } - match(NUMERIC); - literalvalue_AST = currentAST.root; - break; - } - case STRINGLITERAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp192_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp192_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp192_AST); - } - match(STRINGLITERAL); - literalvalue_AST = currentAST.root; - break; - } - case NULL_T: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp193_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp193_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp193_AST); - } - match(NULL_T); - literalvalue_AST = currentAST.root; - break; - } - case CURRENT_TIME: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp194_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp194_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp194_AST); - } - match(CURRENT_TIME); - literalvalue_AST = currentAST.root; - break; - } - case CURRENT_DATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp195_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp195_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp195_AST); - } - match(CURRENT_DATE); - literalvalue_AST = currentAST.root; - break; - } - case CURRENT_TIMESTAMP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp196_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp196_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp196_AST); - } - match(CURRENT_TIMESTAMP); - literalvalue_AST = currentAST.root; - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - returnAST = literalvalue_AST; -} - -void Sqlite3Parser::foreignkeyclause() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST foreignkeyclause_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - ANTLR_USE_NAMESPACE(antlr)RefAST tmp197_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp197_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp197_AST); - } - match(REFERENCES); - tablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { - switch ( LA(1)) { - case LPAREN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp198_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp198_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp198_AST); - } - match(LPAREN); - columnname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp199_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp199_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp199_AST); - } - match(COMMA); - columnname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop159; - } - - } - _loop159:; - } // ( ... )* - ANTLR_USE_NAMESPACE(antlr)RefAST tmp200_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp200_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp200_AST); - } - match(RPAREN); - break; - } - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case DEFERRABLE: - case FOREIGN: - case NOT: - case NULL_T: - case MATCH: - case ON: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { // ( ... )* - for (;;) { - switch ( LA(1)) { - case ON: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp201_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp201_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp201_AST); - } - match(ON); - { - switch ( LA(1)) { - case DELETE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp202_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp202_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp202_AST); - } - match(DELETE); - break; - } - case UPDATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp203_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp203_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp203_AST); - } - match(UPDATE); - break; - } - case INSERT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp204_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp204_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp204_AST); - } - match(INSERT); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case SET: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp205_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp205_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp205_AST); - } - match(SET); - { - switch ( LA(1)) { - case NULL_T: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp206_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp206_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp206_AST); - } - match(NULL_T); - break; - } - case DEFAULT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp207_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp207_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp207_AST); - } - match(DEFAULT); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case CASCADE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp208_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp208_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp208_AST); - } - match(CASCADE); - break; - } - case RESTRICT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp209_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp209_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp209_AST); - } - match(RESTRICT); - break; - } - case NO: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp210_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp210_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp210_AST); - } - match(NO); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp211_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp211_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp211_AST); - } - match(ACTION); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case MATCH: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp212_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp212_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp212_AST); - } - match(MATCH); - name(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - goto _loop164; - } - } - } - _loop164:; - } // ( ... )* - { - bool synPredMatched167 = false; - if (((LA(1) == NOT) && (LA(2) == DEFERRABLE))) { - int _m167 = mark(); - synPredMatched167 = true; - inputState->guessing++; - try { - { - match(NOT); - match(DEFERRABLE); - } - } - catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched167 = false; - } - rewind(_m167); - inputState->guessing--; - } - if ( synPredMatched167 ) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp213_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp213_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp213_AST); - } - match(NOT); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp214_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp214_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp214_AST); - } - match(DEFERRABLE); - { - switch ( LA(1)) { - case INITIALLY: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp215_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp215_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp215_AST); - } - match(INITIALLY); - { - switch ( LA(1)) { - case DEFERRED: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp216_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp216_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp216_AST); - } - match(DEFERRED); - break; - } - case IMMEDIATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp217_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp217_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp217_AST); - } - match(IMMEDIATE); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case CHECK: - case COLLATE: - case CONSTRAINT: - case DEFAULT: - case FOREIGN: - case NOT: - case NULL_T: - case PRIMARY: - case REFERENCES: - case UNIQUE: - case RPAREN: - case COMMA: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - } - else if ((LA(1) == DEFERRABLE)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp218_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp218_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp218_AST); - } - match(DEFERRABLE); - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp219_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp219_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp219_AST); - } - match(INITIALLY); - { - switch ( LA(1)) { - case DEFERRED: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp220_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp220_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp220_AST); - } - match(DEFERRED); - break; - } - case IMMEDIATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp221_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp221_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp221_AST); - } - match(IMMEDIATE); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - } - } - else if ((_tokenSet_13.member(LA(1))) && (_tokenSet_16.member(LA(2)))) { - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - } - foreignkeyclause_AST = currentAST.root; - returnAST = foreignkeyclause_AST; -} - -void Sqlite3Parser::functionname() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST functionname_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - id(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - functionname_AST = currentAST.root; - returnAST = functionname_AST; -} - -void Sqlite3Parser::subexpr() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST subexpr_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - { - switch ( LA(1)) { - case MINUS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp222_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp222_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp222_AST); - } - match(MINUS); - break; - } - case PLUS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp223_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp223_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp223_AST); - } - match(PLUS); - break; - } - case TILDE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp224_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp224_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp224_AST); - } - match(TILDE); - break; - } - case NOT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp225_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp225_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp225_AST); - } - match(NOT); - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CASE_T: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IF_T: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case NULL_T: - case MATCH: - case EXISTS: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case NUMERIC: - case STRINGLITERAL: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case EXISTS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp226_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp226_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp226_AST); - } - match(EXISTS); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp227_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp227_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp227_AST); - } - match(LPAREN); - { - switch ( LA(1)) { - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CASE_T: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IF_T: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case NOT: - case NULL_T: - case MATCH: - case EXISTS: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case NUMERIC: - case STRINGLITERAL: - case LPAREN: - case PLUS: - case MINUS: - case TILDE: - { - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case SELECT: - { - selectstmt(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp228_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp228_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp228_AST); - } - match(RPAREN); - break; - } - case CASE_T: - { - caseexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - if ((_tokenSet_12.member(LA(1))) && (_tokenSet_17.member(LA(2)))) { - literalvalue(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else if ((_tokenSet_3.member(LA(1))) && (_tokenSet_18.member(LA(2)))) { - { - if ((_tokenSet_1.member(LA(1))) && (LA(2) == DOT)) { - { - if ((_tokenSet_1.member(LA(1))) && (LA(2) == DOT)) { - databasename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp229_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp229_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp229_AST); - } - match(DOT); - } - else if ((_tokenSet_1.member(LA(1))) && (LA(2) == DOT)) { - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - } - tablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp230_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp230_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp230_AST); - } - match(DOT); - } - else if ((_tokenSet_3.member(LA(1))) && (_tokenSet_17.member(LA(2)))) { - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - } - columnname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else if ((_tokenSet_1.member(LA(1))) && (LA(2) == LPAREN)) { - functionname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp231_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp231_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp231_AST); - } - match(LPAREN); - { - switch ( LA(1)) { - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CASE_T: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IF_T: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case NOT: - case NULL_T: - case MATCH: - case EXISTS: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case NUMERIC: - case STRINGLITERAL: - case LPAREN: - case PLUS: - case MINUS: - case TILDE: - { - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp232_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp232_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp232_AST); - } - match(COMMA); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop198; - } - - } - _loop198:; - } // ( ... )* - break; - } - case RPAREN: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp233_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp233_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp233_AST); - } - match(RPAREN); - } - else if ((LA(1) == CAST) && (LA(2) == LPAREN)) { - castexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else if ((LA(1) == RAISE) && (LA(2) == LPAREN)) { - raisefunction(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - if ((_tokenSet_19.member(LA(1))) && (_tokenSet_20.member(LA(2)))) { - suffixexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else if ((_tokenSet_21.member(LA(1))) && (_tokenSet_22.member(LA(2)))) { - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - } - subexpr_AST = currentAST.root; - returnAST = subexpr_AST; -} - -void Sqlite3Parser::binaryoperator() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST binaryoperator_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - switch ( LA(1)) { - case OROP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp234_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp234_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp234_AST); - } - match(OROP); - binaryoperator_AST = currentAST.root; - break; - } - case STAR: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp235_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp235_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp235_AST); - } - match(STAR); - binaryoperator_AST = currentAST.root; - break; - } - case SLASH: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp236_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp236_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp236_AST); - } - match(SLASH); - binaryoperator_AST = currentAST.root; - break; - } - case PERCENT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp237_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp237_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp237_AST); - } - match(PERCENT); - binaryoperator_AST = currentAST.root; - break; - } - case PLUS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp238_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp238_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp238_AST); - } - match(PLUS); - binaryoperator_AST = currentAST.root; - break; - } - case MINUS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp239_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp239_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp239_AST); - } - match(MINUS); - binaryoperator_AST = currentAST.root; - break; - } - case BITWISELEFT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp240_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp240_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp240_AST); - } - match(BITWISELEFT); - binaryoperator_AST = currentAST.root; - break; - } - case BITWISERIGHT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp241_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp241_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp241_AST); - } - match(BITWISERIGHT); - binaryoperator_AST = currentAST.root; - break; - } - case AMPERSAND: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp242_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp242_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp242_AST); - } - match(AMPERSAND); - binaryoperator_AST = currentAST.root; - break; - } - case BITOR: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp243_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp243_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp243_AST); - } - match(BITOR); - binaryoperator_AST = currentAST.root; - break; - } - case LOWER: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp244_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp244_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp244_AST); - } - match(LOWER); - binaryoperator_AST = currentAST.root; - break; - } - case LOWEREQUAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp245_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp245_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp245_AST); - } - match(LOWEREQUAL); - binaryoperator_AST = currentAST.root; - break; - } - case GREATER: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp246_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp246_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp246_AST); - } - match(GREATER); - binaryoperator_AST = currentAST.root; - break; - } - case GREATEREQUAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp247_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp247_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp247_AST); - } - match(GREATEREQUAL); - binaryoperator_AST = currentAST.root; - break; - } - case EQUAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp248_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp248_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp248_AST); - } - match(EQUAL); - binaryoperator_AST = currentAST.root; - break; - } - case EQUAL2: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp249_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp249_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp249_AST); - } - match(EQUAL2); - binaryoperator_AST = currentAST.root; - break; - } - case UNEQUAL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp250_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp250_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp250_AST); - } - match(UNEQUAL); - binaryoperator_AST = currentAST.root; - break; - } - case UNEQUAL2: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp251_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp251_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp251_AST); - } - match(UNEQUAL2); - binaryoperator_AST = currentAST.root; - break; - } - case IS: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp252_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp252_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp252_AST); - } - match(IS); - binaryoperator_AST = currentAST.root; - break; - } - case GLOB: - case LIKE: - case MATCH: - case REGEXP: - { - like_operator(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - binaryoperator_AST = currentAST.root; - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - returnAST = binaryoperator_AST; -} - -void Sqlite3Parser::castexpr() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST castexpr_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - ANTLR_USE_NAMESPACE(antlr)RefAST tmp253_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp253_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp253_AST); - } - match(CAST); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp254_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp254_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp254_AST); - } - match(LPAREN); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp255_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp255_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp255_AST); - } - match(AS); - type_name(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp256_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp256_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp256_AST); - } - match(RPAREN); - castexpr_AST = currentAST.root; - returnAST = castexpr_AST; -} - -void Sqlite3Parser::caseexpr() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST caseexpr_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - ANTLR_USE_NAMESPACE(antlr)RefAST tmp257_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp257_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp257_AST); - } - match(CASE_T); - { - switch ( LA(1)) { - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CASE_T: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IF_T: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case NOT: - case NULL_T: - case MATCH: - case EXISTS: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case NUMERIC: - case STRINGLITERAL: - case LPAREN: - case PLUS: - case MINUS: - case TILDE: - { - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case WHEN: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { // ( ... )+ - int _cnt205=0; - for (;;) { - if ((LA(1) == WHEN)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp258_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp258_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp258_AST); - } - match(WHEN); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp259_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp259_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp259_AST); - } - match(THEN); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - if ( _cnt205>=1 ) { goto _loop205; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} - } - - _cnt205++; - } - _loop205:; - } // ( ... )+ - { - switch ( LA(1)) { - case ELSE_T: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp260_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp260_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp260_AST); - } - match(ELSE_T); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case END: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp261_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp261_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp261_AST); - } - match(END); - caseexpr_AST = currentAST.root; - returnAST = caseexpr_AST; -} - -void Sqlite3Parser::raisefunction() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST raisefunction_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - ANTLR_USE_NAMESPACE(antlr)RefAST tmp262_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp262_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp262_AST); - } - match(RAISE); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp263_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp263_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp263_AST); - } - match(LPAREN); - { - switch ( LA(1)) { - case IGNORE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp264_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp264_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp264_AST); - } - match(IGNORE); - break; - } - case ABORT: - case FAIL: - case ROLLBACK: - { - { - switch ( LA(1)) { - case ROLLBACK: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp265_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp265_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp265_AST); - } - match(ROLLBACK); - break; - } - case ABORT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp266_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp266_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp266_AST); - } - match(ABORT); - break; - } - case FAIL: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp267_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp267_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp267_AST); - } - match(FAIL); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp268_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp268_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp268_AST); - } - match(COMMA); - ANTLR_USE_NAMESPACE(antlr)RefAST tmp269_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp269_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp269_AST); - } - match(STRINGLITERAL); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp270_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp270_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp270_AST); - } - match(RPAREN); - raisefunction_AST = currentAST.root; - returnAST = raisefunction_AST; -} - -void Sqlite3Parser::suffixexpr() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST suffixexpr_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - switch ( LA(1)) { - case COLLATE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp271_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp271_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp271_AST); - } - match(COLLATE); - collationname(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - suffixexpr_AST = currentAST.root; - break; - } - case BETWEEN: - case GLOB: - case LIKE: - case IN: - case NOT: - case MATCH: - case REGEXP: - { - { - switch ( LA(1)) { - case NOT: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp272_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp272_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp272_AST); - } - match(NOT); - break; - } - case BETWEEN: - case GLOB: - case LIKE: - case IN: - case MATCH: - case REGEXP: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case BETWEEN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp273_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp273_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp273_AST); - } - match(BETWEEN); - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((_tokenSet_23.member(LA(1)))) { - { - switch ( LA(1)) { - case GLOB: - case LIKE: - case IS: - case MATCH: - case REGEXP: - case PLUS: - case MINUS: - case STAR: - case AMPERSAND: - case BITOR: - case OROP: - case EQUAL: - case EQUAL2: - case GREATER: - case GREATEREQUAL: - case LOWER: - case LOWEREQUAL: - case UNEQUAL: - case UNEQUAL2: - case BITWISELEFT: - case BITWISERIGHT: - case SLASH: - case PERCENT: - { - binaryoperator(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case OR: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp274_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp274_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp274_AST); - } - match(OR); - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop216; - } - - } - _loop216:; - } // ( ... )* - ANTLR_USE_NAMESPACE(antlr)RefAST tmp275_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp275_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp275_AST); - } - match(AND); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case IN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp276_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp276_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp276_AST); - } - match(IN); - { - switch ( LA(1)) { - case LPAREN: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp277_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp277_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp277_AST); - } - match(LPAREN); - { - switch ( LA(1)) { - case SELECT: - { - selectstmt(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - case ABORT: - case ACTION: - case ASC: - case CASCADE: - case CASE_T: - case CAST: - case CONFLICT: - case CURRENT_TIME: - case CURRENT_DATE: - case CURRENT_TIMESTAMP: - case DEFERRED: - case DESC: - case END: - case FAIL: - case FILTER: - case FOLLOWING: - case GLOB: - case KEY: - case LIKE: - case IF_T: - case IGNORE: - case INITIALLY: - case IMMEDIATE: - case NO: - case NOT: - case NULL_T: - case MATCH: - case EXISTS: - case OVER: - case PARTITION: - case PRECEDING: - case RAISE: - case RANGE: - case REGEXP: - case REPLACE: - case RESTRICT: - case ROLLBACK: - case ROWID: - case ROWS: - case TEMPORARY: - case TEMP: - case UNBOUNDED: - case VIRTUAL: - case WITHOUT: - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case NUMERIC: - case STRINGLITERAL: - case LPAREN: - case PLUS: - case MINUS: - case TILDE: - { - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )* - for (;;) { - if ((LA(1) == COMMA)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp278_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp278_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp278_AST); - } - match(COMMA); - expr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - goto _loop220; - } - - } - _loop220:; - } // ( ... )* - break; - } - case RPAREN: - { - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - ANTLR_USE_NAMESPACE(antlr)RefAST tmp279_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp279_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp279_AST); - } - match(RPAREN); - break; - } - case ID: - case QUOTEDID: - case QUOTEDLITERAL: - case STRINGLITERAL: - { - tablename(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case GLOB: - case LIKE: - case MATCH: - case REGEXP: - { - like_operator(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { - if ((LA(1) == ESCAPE) && (_tokenSet_7.member(LA(2)))) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp280_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp280_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp280_AST); - } - match(ESCAPE); - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else if ((_tokenSet_21.member(LA(1))) && (_tokenSet_22.member(LA(2)))) { - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - } - suffixexpr_AST = currentAST.root; - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - returnAST = suffixexpr_AST; -} - -void Sqlite3Parser::like_operator() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST like_operator_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - switch ( LA(1)) { - case LIKE: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp281_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp281_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp281_AST); - } - match(LIKE); - like_operator_AST = currentAST.root; - break; - } - case GLOB: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp282_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp282_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp282_AST); - } - match(GLOB); - like_operator_AST = currentAST.root; - break; - } - case REGEXP: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp283_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp283_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp283_AST); - } - match(REGEXP); - like_operator_AST = currentAST.root; - break; - } - case MATCH: - { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp284_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp284_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp284_AST); - } - match(MATCH); - like_operator_AST = currentAST.root; - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); - } - } - returnAST = like_operator_AST; -} - -void Sqlite3Parser::between_subexpr() { - returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; - ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; - ANTLR_USE_NAMESPACE(antlr)RefAST between_subexpr_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - { // ( ... )+ - int _cnt210=0; - for (;;) { - if ((LA(1) == AND)) { - ANTLR_USE_NAMESPACE(antlr)RefAST tmp285_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; - if ( inputState->guessing == 0 ) { - tmp285_AST = astFactory->create(LT(1)); - astFactory->addASTChild(currentAST, tmp285_AST); - } - match(AND); - subexpr(); - if (inputState->guessing==0) { - astFactory->addASTChild( currentAST, returnAST ); - } - } - else { - if ( _cnt210>=1 ) { goto _loop210; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} - } - - _cnt210++; - } - _loop210:; - } // ( ... )+ - between_subexpr_AST = currentAST.root; - returnAST = between_subexpr_AST; -} - -void Sqlite3Parser::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ) -{ - factory.setMaxNodeType(120); -} -const char* Sqlite3Parser::tokenNames[] = { - "<0>", - "EOF", - "<2>", - "NULL_TREE_LOOKAHEAD", - "\"ABORT\"", - "\"ACTION\"", - "\"AUTOINCREMENT\"", - "\"AS\"", - "\"ASC\"", - "\"AND\"", - "\"OR\"", - "\"BETWEEN\"", - "\"CASCADE\"", - "\"CASE\"", - "\"CAST\"", - "\"CHECK\"", - "\"CREATE\"", - "\"COLLATE\"", - "\"CONFLICT\"", - "\"CONSTRAINT\"", - "\"CURRENT_TIME\"", - "\"CURRENT_DATE\"", - "\"CURRENT_TIMESTAMP\"", - "\"DEFAULT\"", - "\"DEFERRABLE\"", - "\"DEFERRED\"", - "\"DELETE\"", - "\"DESC\"", - "\"ELSE\"", - "\"END\"", - "\"ESCAPE\"", - "\"FAIL\"", - "\"FILTER\"", - "\"FOLLOWING\"", - "\"FOREIGN\"", - "\"GLOB\"", - "\"KEY\"", - "\"LIKE\"", - "\"TABLE\"", - "\"IF\"", - "\"IGNORE\"", - "\"IN\"", - "\"INDEX\"", - "\"INITIALLY\"", - "\"INSERT\"", - "\"IMMEDIATE\"", - "\"IS\"", - "\"NO\"", - "\"NOT\"", - "\"NULL\"", - "\"MATCH\"", - "\"EXISTS\"", - "\"ON\"", - "\"OVER\"", - "\"PARTITION\"", - "\"PRECEDING\"", - "\"PRIMARY\"", - "\"RAISE\"", - "\"RANGE\"", - "\"REFERENCES\"", - "\"REGEXP\"", - "\"REPLACE\"", - "\"RESTRICT\"", - "\"ROLLBACK\"", - "\"ROWID\"", - "\"ROWS\"", - "\"SET\"", - "\"TEMPORARY\"", - "\"TEMP\"", - "\"THEN\"", - "\"UNBOUNDED\"", - "\"UNIQUE\"", - "\"UPDATE\"", - "\"USING\"", - "\"VIRTUAL\"", - "\"WHEN\"", - "\"WHERE\"", - "\"WITHOUT\"", - "TYPE_NAME", - "COLUMNDEF", - "COLUMNCONSTRAINT", - "TABLECONSTRAINT", - "CREATETABLE", - "CREATEINDEX", - "INDEXEDCOLUMN", - "KEYWORDASTABLENAME", - "KEYWORDASCOLUMNNAME", - "DIGIT", - "DOT", - "ID", - "QUOTEDID", - "QUOTEDLITERAL", - "NUMERIC", - "NL", - "COMMENT", - "WS", - "STRINGLITERAL", - "LPAREN", - "RPAREN", - "COMMA", - "SEMI", - "PLUS", - "MINUS", - "STAR", - "TILDE", - "AMPERSAND", - "BITOR", - "OROP", - "EQUAL", - "EQUAL2", - "GREATER", - "GREATEREQUAL", - "LOWER", - "LOWEREQUAL", - "UNEQUAL", - "UNEQUAL2", - "BITWISELEFT", - "BITWISERIGHT", - "SELECT", - "SLASH", - "PERCENT", - 0 -}; - -const unsigned long Sqlite3Parser::_tokenSet_0_data_[] = { 0UL, 0UL, 251658240UL, 1UL, 0UL, 0UL, 0UL, 0UL }; -// DOT ID QUOTEDID QUOTEDLITERAL STRINGLITERAL -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_0(_tokenSet_0_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_1_data_[] = { 0UL, 0UL, 234881024UL, 1UL, 0UL, 0UL, 0UL, 0UL }; -// ID QUOTEDID QUOTEDLITERAL STRINGLITERAL -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_1(_tokenSet_1_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_2_data_[] = { 0UL, 64UL, 1048UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// "TABLE" "TEMPORARY" "TEMP" "VIRTUAL" -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_2(_tokenSet_2_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_3_data_[] = { 2859749680UL, 4142180795UL, 234890331UL, 1UL, 0UL, 0UL, 0UL, 0UL }; -// "ABORT" "ACTION" "ASC" "CASCADE" "CAST" "CONFLICT" "CURRENT_TIME" "CURRENT_DATE" -// "CURRENT_TIMESTAMP" "DEFERRED" "DESC" "END" "FAIL" "FILTER" "FOLLOWING" -// "GLOB" "KEY" "LIKE" "IF" "IGNORE" "INITIALLY" "IMMEDIATE" "NO" "MATCH" -// "OVER" "PARTITION" "PRECEDING" "RAISE" "RANGE" "REGEXP" "REPLACE" "RESTRICT" -// "ROLLBACK" "ROWID" "ROWS" "TEMPORARY" "TEMP" "UNBOUNDED" "VIRTUAL" "WITHOUT" -// ID QUOTEDID QUOTEDLITERAL STRINGLITERAL -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_3(_tokenSet_3_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_4_data_[] = { 557056UL, 16777220UL, 128UL, 8UL, 0UL, 0UL, 0UL, 0UL }; -// "CHECK" "CONSTRAINT" "FOREIGN" "PRIMARY" "UNIQUE" COMMA -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_4(_tokenSet_4_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_5_data_[] = { 9076736UL, 151191552UL, 128UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// "CHECK" "COLLATE" "CONSTRAINT" "DEFAULT" "NOT" "NULL" "PRIMARY" "REFERENCES" -// "UNIQUE" -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_5(_tokenSet_5_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_6_data_[] = { 3137261872UL, 4294420799UL, 503325915UL, 111UL, 0UL, 0UL, 0UL, 0UL }; -// "ABORT" "ACTION" "ASC" "CASCADE" "CAST" "CHECK" "COLLATE" "CONFLICT" -// "CONSTRAINT" "CURRENT_TIME" "CURRENT_DATE" "CURRENT_TIMESTAMP" "DEFAULT" -// "DEFERRED" "DESC" "ELSE" "END" "FAIL" "FILTER" "FOLLOWING" "FOREIGN" -// "GLOB" "KEY" "LIKE" "IGNORE" "INITIALLY" "IMMEDIATE" "NO" "NOT" "NULL" -// "MATCH" "ON" "OVER" "PARTITION" "PRECEDING" "PRIMARY" "RAISE" "RANGE" -// "REFERENCES" "REGEXP" "REPLACE" "RESTRICT" "ROLLBACK" "ROWID" "ROWS" -// "TEMPORARY" "TEMP" "UNBOUNDED" "UNIQUE" "VIRTUAL" "WITHOUT" ID QUOTEDID -// QUOTEDLITERAL NUMERIC STRINGLITERAL LPAREN RPAREN COMMA PLUS MINUS -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_6(_tokenSet_6_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_7_data_[] = { 2859757872UL, 4142901691UL, 503325787UL, 353UL, 0UL, 0UL, 0UL, 0UL }; -// "ABORT" "ACTION" "ASC" "CASCADE" "CASE" "CAST" "CONFLICT" "CURRENT_TIME" -// "CURRENT_DATE" "CURRENT_TIMESTAMP" "DEFERRED" "DESC" "END" "FAIL" "FILTER" -// "FOLLOWING" "GLOB" "KEY" "LIKE" "IF" "IGNORE" "INITIALLY" "IMMEDIATE" -// "NO" "NOT" "NULL" "MATCH" "EXISTS" "OVER" "PARTITION" "PRECEDING" "RAISE" -// "RANGE" "REGEXP" "REPLACE" "RESTRICT" "ROLLBACK" "ROWID" "ROWS" "TEMPORARY" -// "TEMP" "UNBOUNDED" "VIRTUAL" "WITHOUT" ID QUOTEDID QUOTEDLITERAL NUMERIC -// STRINGLITERAL PLUS MINUS TILDE -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_7(_tokenSet_7_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_8_data_[] = { 2859890992UL, 4142902203UL, 520105051UL, 363UL, 0UL, 0UL, 0UL, 0UL }; -// "ABORT" "ACTION" "ASC" "BETWEEN" "CASCADE" "CASE" "CAST" "COLLATE" "CONFLICT" -// "CURRENT_TIME" "CURRENT_DATE" "CURRENT_TIMESTAMP" "DEFERRED" "DESC" -// "END" "FAIL" "FILTER" "FOLLOWING" "GLOB" "KEY" "LIKE" "IF" "IGNORE" -// "IN" "INITIALLY" "IMMEDIATE" "NO" "NOT" "NULL" "MATCH" "EXISTS" "OVER" -// "PARTITION" "PRECEDING" "RAISE" "RANGE" "REGEXP" "REPLACE" "RESTRICT" -// "ROLLBACK" "ROWID" "ROWS" "TEMPORARY" "TEMP" "UNBOUNDED" "VIRTUAL" "WHEN" -// "WITHOUT" DOT ID QUOTEDID QUOTEDLITERAL NUMERIC STRINGLITERAL LPAREN -// COMMA PLUS MINUS TILDE -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_8(_tokenSet_8_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_9_data_[] = { 2859757872UL, 4142901691UL, 503325787UL, 355UL, 0UL, 0UL, 0UL, 0UL }; -// "ABORT" "ACTION" "ASC" "CASCADE" "CASE" "CAST" "CONFLICT" "CURRENT_TIME" -// "CURRENT_DATE" "CURRENT_TIMESTAMP" "DEFERRED" "DESC" "END" "FAIL" "FILTER" -// "FOLLOWING" "GLOB" "KEY" "LIKE" "IF" "IGNORE" "INITIALLY" "IMMEDIATE" -// "NO" "NOT" "NULL" "MATCH" "EXISTS" "OVER" "PARTITION" "PRECEDING" "RAISE" -// "RANGE" "REGEXP" "REPLACE" "RESTRICT" "ROLLBACK" "ROWID" "ROWS" "TEMPORARY" -// "TEMP" "UNBOUNDED" "VIRTUAL" "WITHOUT" ID QUOTEDID QUOTEDLITERAL NUMERIC -// STRINGLITERAL LPAREN PLUS MINUS TILDE -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_9(_tokenSet_9_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_10_data_[] = { 2859892528UL, 4142918587UL, 520105051UL, 29360103UL, 0UL, 0UL, 0UL, 0UL }; -// "ABORT" "ACTION" "ASC" "AND" "OR" "BETWEEN" "CASCADE" "CASE" "CAST" -// "COLLATE" "CONFLICT" "CURRENT_TIME" "CURRENT_DATE" "CURRENT_TIMESTAMP" -// "DEFERRED" "DESC" "END" "FAIL" "FILTER" "FOLLOWING" "GLOB" "KEY" "LIKE" -// "IF" "IGNORE" "IN" "INITIALLY" "IMMEDIATE" "IS" "NO" "NOT" "NULL" "MATCH" -// "EXISTS" "OVER" "PARTITION" "PRECEDING" "RAISE" "RANGE" "REGEXP" "REPLACE" -// "RESTRICT" "ROLLBACK" "ROWID" "ROWS" "TEMPORARY" "TEMP" "UNBOUNDED" -// "VIRTUAL" "WHEN" "WITHOUT" DOT ID QUOTEDID QUOTEDLITERAL NUMERIC STRINGLITERAL -// LPAREN RPAREN PLUS MINUS STAR TILDE AMPERSAND BITOR OROP EQUAL EQUAL2 -// GREATER GREATEREQUAL LOWER LOWEREQUAL UNEQUAL UNEQUAL2 BITWISELEFT BITWISERIGHT -// SLASH PERCENT -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_10(_tokenSet_10_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_11_data_[] = { 1536UL, 268714024UL, 0UL, 29359840UL, 0UL, 0UL, 0UL, 0UL }; -// "AND" "OR" "GLOB" "LIKE" "IS" "MATCH" "REGEXP" PLUS MINUS STAR AMPERSAND -// BITOR OROP EQUAL EQUAL2 GREATER GREATEREQUAL LOWER LOWEREQUAL UNEQUAL -// UNEQUAL2 BITWISELEFT BITWISERIGHT SLASH PERCENT -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_11(_tokenSet_11_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_12_data_[] = { 7340032UL, 131072UL, 268435456UL, 1UL, 0UL, 0UL, 0UL, 0UL }; -// "CURRENT_TIME" "CURRENT_DATE" "CURRENT_TIMESTAMP" "NULL" NUMERIC STRINGLITERAL -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_12(_tokenSet_12_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_13_data_[] = { 9076736UL, 151191556UL, 128UL, 12UL, 0UL, 0UL, 0UL, 0UL }; -// "CHECK" "COLLATE" "CONSTRAINT" "DEFAULT" "FOREIGN" "NOT" "NULL" "PRIMARY" -// "REFERENCES" "UNIQUE" RPAREN COMMA -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_13(_tokenSet_13_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_14_data_[] = { 3128185136UL, 4142180667UL, 9307UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// "ABORT" "ACTION" "ASC" "CASCADE" "CAST" "CONFLICT" "CURRENT_TIME" "CURRENT_DATE" -// "CURRENT_TIMESTAMP" "DEFERRED" "DESC" "ELSE" "END" "FAIL" "FILTER" "FOLLOWING" -// "GLOB" "KEY" "LIKE" "IGNORE" "INITIALLY" "IMMEDIATE" "NO" "MATCH" "OVER" -// "PARTITION" "PRECEDING" "RAISE" "RANGE" "REGEXP" "REPLACE" "RESTRICT" -// "ROLLBACK" "ROWID" "ROWS" "TEMPORARY" "TEMP" "UNBOUNDED" "VIRTUAL" "WITHOUT" -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_14(_tokenSet_14_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_15_data_[] = { 9076736UL, 151191556UL, 268435584UL, 12UL, 0UL, 0UL, 0UL, 0UL }; -// "CHECK" "COLLATE" "CONSTRAINT" "DEFAULT" "FOREIGN" "NOT" "NULL" "PRIMARY" -// "REFERENCES" "UNIQUE" NUMERIC RPAREN COMMA -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_15(_tokenSet_15_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_16_data_[] = { 3137261874UL, 4294420927UL, 503325915UL, 127UL, 0UL, 0UL, 0UL, 0UL }; -// EOF "ABORT" "ACTION" "ASC" "CASCADE" "CAST" "CHECK" "COLLATE" "CONFLICT" -// "CONSTRAINT" "CURRENT_TIME" "CURRENT_DATE" "CURRENT_TIMESTAMP" "DEFAULT" -// "DEFERRED" "DESC" "ELSE" "END" "FAIL" "FILTER" "FOLLOWING" "FOREIGN" -// "GLOB" "KEY" "LIKE" "IF" "IGNORE" "INITIALLY" "IMMEDIATE" "NO" "NOT" -// "NULL" "MATCH" "ON" "OVER" "PARTITION" "PRECEDING" "PRIMARY" "RAISE" -// "RANGE" "REFERENCES" "REGEXP" "REPLACE" "RESTRICT" "ROLLBACK" "ROWID" -// "ROWS" "TEMPORARY" "TEMP" "UNBOUNDED" "UNIQUE" "VIRTUAL" "WITHOUT" ID -// QUOTEDID QUOTEDLITERAL NUMERIC STRINGLITERAL LPAREN RPAREN COMMA SEMI -// PLUS MINUS -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_16(_tokenSet_16_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_17_data_[] = { 2013401026UL, 268780072UL, 2080UL, 29359868UL, 0UL, 0UL, 0UL, 0UL }; -// EOF "AUTOINCREMENT" "AS" "ASC" "AND" "OR" "BETWEEN" "COLLATE" "DESC" -// "ELSE" "END" "ESCAPE" "GLOB" "LIKE" "IN" "IS" "NOT" "MATCH" "REGEXP" -// "THEN" "WHEN" RPAREN COMMA SEMI PLUS MINUS STAR AMPERSAND BITOR OROP -// EQUAL EQUAL2 GREATER GREATEREQUAL LOWER LOWEREQUAL UNEQUAL UNEQUAL2 -// BITWISELEFT BITWISERIGHT SLASH PERCENT -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_17(_tokenSet_17_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_18_data_[] = { 2013401026UL, 268780072UL, 16779296UL, 29359868UL, 0UL, 0UL, 0UL, 0UL }; -// EOF "AUTOINCREMENT" "AS" "ASC" "AND" "OR" "BETWEEN" "COLLATE" "DESC" -// "ELSE" "END" "ESCAPE" "GLOB" "LIKE" "IN" "IS" "NOT" "MATCH" "REGEXP" -// "THEN" "WHEN" DOT RPAREN COMMA SEMI PLUS MINUS STAR AMPERSAND BITOR -// OROP EQUAL EQUAL2 GREATER GREATEREQUAL LOWER LOWEREQUAL UNEQUAL UNEQUAL2 -// BITWISELEFT BITWISERIGHT SLASH PERCENT -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_18(_tokenSet_18_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_19_data_[] = { 133120UL, 268763688UL, 0UL, 0UL }; -// "BETWEEN" "COLLATE" "GLOB" "LIKE" "IN" "NOT" "MATCH" "REGEXP" -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_19(_tokenSet_19_data_,4); -const unsigned long Sqlite3Parser::_tokenSet_20_data_[] = { 2859759920UL, 4142902203UL, 503325787UL, 355UL, 0UL, 0UL, 0UL, 0UL }; -// "ABORT" "ACTION" "ASC" "BETWEEN" "CASCADE" "CASE" "CAST" "CONFLICT" -// "CURRENT_TIME" "CURRENT_DATE" "CURRENT_TIMESTAMP" "DEFERRED" "DESC" -// "END" "FAIL" "FILTER" "FOLLOWING" "GLOB" "KEY" "LIKE" "IF" "IGNORE" -// "IN" "INITIALLY" "IMMEDIATE" "NO" "NOT" "NULL" "MATCH" "EXISTS" "OVER" -// "PARTITION" "PRECEDING" "RAISE" "RANGE" "REGEXP" "REPLACE" "RESTRICT" -// "ROLLBACK" "ROWID" "ROWS" "TEMPORARY" "TEMP" "UNBOUNDED" "VIRTUAL" "WITHOUT" -// ID QUOTEDID QUOTEDLITERAL NUMERIC STRINGLITERAL LPAREN PLUS MINUS TILDE -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_20(_tokenSet_20_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_21_data_[] = { 2013398978UL, 268714024UL, 2080UL, 29359868UL, 0UL, 0UL, 0UL, 0UL }; -// EOF "AUTOINCREMENT" "AS" "ASC" "AND" "OR" "COLLATE" "DESC" "ELSE" "END" -// "ESCAPE" "GLOB" "LIKE" "IS" "MATCH" "REGEXP" "THEN" "WHEN" RPAREN COMMA -// SEMI PLUS MINUS STAR AMPERSAND BITOR OROP EQUAL EQUAL2 GREATER GREATEREQUAL -// LOWER LOWEREQUAL UNEQUAL UNEQUAL2 BITWISELEFT BITWISERIGHT SLASH PERCENT -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_21(_tokenSet_21_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_22_data_[] = { 4211081202UL, 4294962111UL, 503332091UL, 29360127UL, 0UL, 0UL, 0UL, 0UL }; -// EOF "ABORT" "ACTION" "AUTOINCREMENT" "AS" "ASC" "AND" "OR" "BETWEEN" -// "CASCADE" "CASE" "CAST" "CHECK" "CREATE" "COLLATE" "CONFLICT" "CONSTRAINT" -// "CURRENT_TIME" "CURRENT_DATE" "CURRENT_TIMESTAMP" "DEFAULT" "DEFERRED" -// "DESC" "ELSE" "END" "ESCAPE" "FAIL" "FILTER" "FOLLOWING" "FOREIGN" "GLOB" -// "KEY" "LIKE" "IF" "IGNORE" "IN" "INITIALLY" "IMMEDIATE" "IS" "NO" "NOT" -// "NULL" "MATCH" "EXISTS" "ON" "OVER" "PARTITION" "PRECEDING" "PRIMARY" -// "RAISE" "RANGE" "REFERENCES" "REGEXP" "REPLACE" "RESTRICT" "ROLLBACK" -// "ROWID" "ROWS" "TEMPORARY" "TEMP" "THEN" "UNBOUNDED" "UNIQUE" "VIRTUAL" -// "WHEN" "WHERE" "WITHOUT" ID QUOTEDID QUOTEDLITERAL NUMERIC STRINGLITERAL -// LPAREN RPAREN COMMA SEMI PLUS MINUS STAR TILDE AMPERSAND BITOR OROP -// EQUAL EQUAL2 GREATER GREATEREQUAL LOWER LOWEREQUAL UNEQUAL UNEQUAL2 -// BITWISELEFT BITWISERIGHT SLASH PERCENT -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_22(_tokenSet_22_data_,8); -const unsigned long Sqlite3Parser::_tokenSet_23_data_[] = { 1024UL, 268714024UL, 0UL, 29359840UL, 0UL, 0UL, 0UL, 0UL }; -// "OR" "GLOB" "LIKE" "IS" "MATCH" "REGEXP" PLUS MINUS STAR AMPERSAND BITOR -// OROP EQUAL EQUAL2 GREATER GREATEREQUAL LOWER LOWEREQUAL UNEQUAL UNEQUAL2 -// BITWISELEFT BITWISERIGHT SLASH PERCENT -const ANTLR_USE_NAMESPACE(antlr)BitSet Sqlite3Parser::_tokenSet_23(_tokenSet_23_data_,8); - - diff --git a/src/grammar/Sqlite3Parser.hpp b/src/grammar/Sqlite3Parser.hpp deleted file mode 100644 index d8f5ef54..00000000 --- a/src/grammar/Sqlite3Parser.hpp +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef INC_Sqlite3Parser_hpp_ -#define INC_Sqlite3Parser_hpp_ - -#include -/* $ANTLR 2.7.7 (20171109): "sqlite3.g" -> "Sqlite3Parser.hpp"$ */ -#include -#include -#include "sqlite3TokenTypes.hpp" -#include - -class CUSTOM_API Sqlite3Parser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public sqlite3TokenTypes -{ -public: - void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); -protected: - Sqlite3Parser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); -public: - Sqlite3Parser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); -protected: - Sqlite3Parser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); -public: - Sqlite3Parser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); - Sqlite3Parser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); - int getNumTokens() const - { - return Sqlite3Parser::NUM_TOKENS; - } - const char* getTokenName( int type ) const - { - if( type > getNumTokens() ) return 0; - return Sqlite3Parser::tokenNames[type]; - } - const char* const* getTokenNames() const - { - return Sqlite3Parser::tokenNames; - } - public: void id(); - public: void databasename(); - public: void tablename(); - public: void nonkeyword_columnname(); - public: void identifier(); - public: void collationname(); - public: void signednumber(); - public: void statementlist(); - public: void statement(); - public: void createtable(); - public: void createindex(); - public: void create_statements(); - public: void keywordastablename(); - public: void columndef(); - public: void tableconstraint(); - public: void selectstmt(); - public: void name(); - public: void expr(); - public: void indexedcolumn(); - public: void keywordascolumnname(); - public: void columnname(); - public: void type_name(); - public: void columnconstraint(); - public: void conflictclause(); - public: void literalvalue(); - public: void foreignkeyclause(); - public: void functionname(); - public: void subexpr(); - public: void binaryoperator(); - public: void castexpr(); - public: void caseexpr(); - public: void raisefunction(); - public: void suffixexpr(); - public: void like_operator(); - public: void between_subexpr(); -public: - ANTLR_USE_NAMESPACE(antlr)RefAST getAST() - { - return returnAST; - } - -protected: - ANTLR_USE_NAMESPACE(antlr)RefAST returnAST; -private: - static const char* tokenNames[]; -#ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 121; -#else - enum { - NUM_TOKENS = 121 - }; -#endif - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; - static const unsigned long _tokenSet_5_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; - static const unsigned long _tokenSet_6_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; - static const unsigned long _tokenSet_7_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; - static const unsigned long _tokenSet_8_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; - static const unsigned long _tokenSet_9_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; - static const unsigned long _tokenSet_10_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; - static const unsigned long _tokenSet_11_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; - static const unsigned long _tokenSet_12_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; - static const unsigned long _tokenSet_13_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; - static const unsigned long _tokenSet_14_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; - static const unsigned long _tokenSet_15_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; - static const unsigned long _tokenSet_16_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; - static const unsigned long _tokenSet_17_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; - static const unsigned long _tokenSet_18_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; - static const unsigned long _tokenSet_19_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; - static const unsigned long _tokenSet_20_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; - static const unsigned long _tokenSet_21_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; - static const unsigned long _tokenSet_22_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; - static const unsigned long _tokenSet_23_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; -}; - -#endif /*INC_Sqlite3Parser_hpp_*/ diff --git a/src/grammar/sqlite3.g b/src/grammar/sqlite3.g deleted file mode 100644 index 9f2d0871..00000000 --- a/src/grammar/sqlite3.g +++ /dev/null @@ -1,568 +0,0 @@ -options { - language="Cpp"; - genHashLines=false; -} - -class Sqlite3Lexer extends Lexer; -options { - k=2; - exportVocab=sqlite3; - caseSensitive=false; - caseSensitiveLiterals=false; - charVocabulary='\u0000'..'\uFFFE'; -} - -tokens { - ABORT="ABORT"; - ACTION="ACTION"; - AUTOINCREMENT="AUTOINCREMENT"; - AS="AS"; - ASC="ASC"; - AND="AND"; - OR="OR"; - BETWEEN="BETWEEN"; - CASCADE="CASCADE"; - CASE_T="CASE"; - CAST="CAST"; - CHECK="CHECK"; - CREATE="CREATE"; - COLLATE="COLLATE"; - CONFLICT="CONFLICT"; - CONSTRAINT="CONSTRAINT"; - CURRENT_TIME="CURRENT_TIME"; - CURRENT_DATE="CURRENT_DATE"; - CURRENT_TIMESTAMP="CURRENT_TIMESTAMP"; - DEFAULT="DEFAULT"; - DEFERRABLE="DEFERRABLE"; - DEFERRED="DEFERRED"; - DELETE="DELETE"; - DESC="DESC"; - ELSE_T="ELSE"; - END="END"; - ESCAPE="ESCAPE"; - FAIL="FAIL"; - FILTER="FILTER"; - FOLLOWING="FOLLOWING"; - FOREIGN="FOREIGN"; - GLOB="GLOB"; - KEY="KEY"; - LIKE="LIKE"; - TABLE="TABLE"; - IF_T="IF"; - IGNORE="IGNORE"; - IN="IN"; - INDEX="INDEX"; - INITIALLY="INITIALLY"; - INSERT="INSERT"; - IMMEDIATE="IMMEDIATE"; - IS="IS"; - NO="NO"; - NOT="NOT"; - NULL_T="NULL"; - MATCH="MATCH"; - EXISTS="EXISTS"; - ON="ON"; - OVER="OVER"; - PARTITION="PARTITION"; - PRECEDING="PRECEDING"; - PRIMARY="PRIMARY"; - RAISE="RAISE"; - RANGE="RANGE"; - REFERENCES="REFERENCES"; - REGEXP="REGEXP"; - REPLACE="REPLACE"; - RESTRICT="RESTRICT"; - ROLLBACK="ROLLBACK"; - ROWID="ROWID"; - ROWS="ROWS"; - SET="SET"; - TEMPORARY="TEMPORARY"; - TEMP="TEMP"; - THEN="THEN"; - UNBOUNDED="UNBOUNDED"; - UNIQUE="UNIQUE"; - UPDATE="UPDATE"; - USING="USING"; - VIRTUAL="VIRTUAL"; - WHEN="WHEN"; - WHERE="WHERE"; - WITHOUT="WITHOUT"; - -//ast - - TYPE_NAME; - COLUMNDEF; - COLUMNCONSTRAINT; - TABLECONSTRAINT; - CREATETABLE; - CREATEINDEX; - INDEXEDCOLUMN; - KEYWORDASTABLENAME; - KEYWORDASCOLUMNNAME; -} - -protected -DIGIT : '0'..'9' ; - -protected DOT:; - -ID - : - // 0080 - 02B8 load of good looking unicode chars - // there might be more allowed characters - ('a'..'z'|'_') ('a'..'z'|'0'..'9'|'_'|'\u0080'..'\u02B8')* - ; - -QUOTEDID - : '`' ( ~('`') | ('`' '`') )* '`' - | '[' ( ~(']') )* ']' - ; - -QUOTEDLITERAL - : '"' ( ~'"' | ('"' '"' ) )* '"' - ; - -NUMERIC - : ( (DIGIT)+ ( '.' (DIGIT)* )? - | '.' (DIGIT)+) - ( 'e' (PLUS|MINUS)? (DIGIT)+ )? - ; - -protected -NL : - ( '\r' - | '\n' {newline();} - ); - -COMMENT : - ( '-''-' (~('\n'|'\r'))* NL {newline();} // single line comment - | '/''*' ( options{greedy=false;} : NL {newline();} | ~('\n'|'\r') )* '*''/' // multi-line comment - ) { $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); }; - -WS : - ( ' ' - | '\t' - | '\f' - | NL - ) { $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); }; - -STRINGLITERAL - : -// '"' ( ESC_SEQ | ~('\\'|'"') )* '"' - '\'' ( ~'\'' | ('\'' '\'') )* '\'' - ; - -//protected -//ESC_SEQ -// : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') -// ; - -LPAREN : '('; -RPAREN : ')'; -COMMA : ','; -SEMI : ';'; -PLUS : '+'; -MINUS : '-'; -STAR : '*'; -TILDE : '~'; -AMPERSAND: '&'; -BITOR: '|'; -OROP: BITOR BITOR; -EQUAL: '='; -EQUAL2: EQUAL EQUAL; -GREATER: '>'; -GREATEREQUAL: GREATER EQUAL; -LOWER: '<'; -LOWEREQUAL: LOWER EQUAL; -UNEQUAL: '!' EQUAL; -UNEQUAL2: LOWER GREATER; -BITWISELEFT: LOWER LOWER; -BITWISERIGHT: GREATER GREATER; - -// parser - -class Sqlite3Parser extends Parser; -options { - k=2; - buildAST = true; - defaultErrorHandler=false; -} - -id : ID | QUOTEDID | QUOTEDLITERAL | STRINGLITERAL ; - -databasename - : - id - ; - -tablename - : - id - ; - -nonkeyword_columnname - : - id - ; - -identifier - : - ((databasename)? DOT)? tablename - ; - -collationname - : - ID - ; - -signednumber - : (PLUS | MINUS)? NUMERIC -// {#signednumber = #([SIGNEDNUMBER, "SIGNEDNUMBER"], #signednumber);} - ; - -// parser part -statementlist - : - (statement)? - (SEMI statement)* - ; - -statement - : - createtable - | createindex - ; - -create_statements - : - createtable - | createindex - ; - -keywordastablename - : - ( ABORT - | ACTION - | ASC - | CASCADE - | CAST - | CONFLICT - | CURRENT_TIME - | CURRENT_DATE - | CURRENT_TIMESTAMP - | DEFERRED - | DESC - | ELSE_T - | END - | FAIL - | FILTER - | FOLLOWING - | GLOB - | KEY - | LIKE - | IGNORE - | INITIALLY - | IMMEDIATE - | MATCH - | NO - | OVER - | PARTITION - | PRECEDING - | RAISE - | RANGE - | REGEXP - | REPLACE - | RESTRICT - | ROLLBACK - | ROWID - | ROWS - | TEMPORARY - | TEMP - | UNBOUNDED - | VIRTUAL - | WITHOUT - ) - {#keywordastablename = #([KEYWORDASTABLENAME, "KEYWORDASTABLENAME"], #keywordastablename);} - ; - -createtable - : - (CREATE (TEMP|TEMPORARY)? TABLE (IF_T NOT EXISTS)? (tablename | keywordastablename) - ( LPAREN columndef (COMMA columndef)* ((COMMA)? tableconstraint)* RPAREN (WITHOUT ROWID)? - | AS selectstmt - ) - {#createtable = #([CREATETABLE, "CREATETABLE"], #createtable);} - ) - |(CREATE VIRTUAL TABLE (IF_T NOT EXISTS)? (tablename | keywordastablename) - USING name (LPAREN (expr (COMMA expr)*)? RPAREN)? // TODO: Not sure about using "expr" here - ) - ; - -createindex - : - CREATE (UNIQUE)? INDEX (IF_T NOT EXISTS)? (tablename | keywordastablename) ON (tablename | keywordastablename) - ( LPAREN indexedcolumn (COMMA indexedcolumn)* RPAREN (WHERE expr)? ) - {#createindex = #([CREATEINDEX, "CREATEINDEX"], #createindex);} - ; - -keywordascolumnname - : - ( ABORT - | ACTION - | ASC - | CASCADE - | CAST - | CONFLICT - | CURRENT_TIME - | CURRENT_DATE - | CURRENT_TIMESTAMP - | DEFERRED - | DESC - | END - | FAIL - | FILTER - | FOLLOWING - | GLOB - | KEY - | LIKE - | IF_T - | IGNORE - | INITIALLY - | IMMEDIATE - | MATCH - | NO - | OVER - | PARTITION - | PRECEDING - | RAISE - | RANGE - | REGEXP - | REPLACE - | RESTRICT - | ROLLBACK - | ROWID - | ROWS - | TEMPORARY - | TEMP - | UNBOUNDED - | VIRTUAL - | WITHOUT - ) - {#keywordascolumnname = #([KEYWORDASCOLUMNNAME, "KEYWORDASCOLUMNNAME"], #keywordascolumnname);} - ; - -columnname - : - ( nonkeyword_columnname - | keywordascolumnname - ) - {} - ; - -columndef - : - columnname (type_name)? (columnconstraint)* - {#columndef = #([COLUMNDEF, "COLUMNDEF"], #columndef);} - ; - -name : ID | QUOTEDID | QUOTEDLITERAL | STRINGLITERAL; - -type_name - : - (name | keywordastablename)+ - (LPAREN signednumber (COMMA signednumber)? RPAREN)? - {#type_name = #([TYPE_NAME, "TYPE_NAME"], #type_name);} - ; - -columnconstraint - : - (CONSTRAINT name)? - ( PRIMARY KEY (ASC|DESC)? (conflictclause)? (AUTOINCREMENT)? - | (NOT)? NULL_T (conflictclause)? - | UNIQUE (conflictclause)? - | CHECK LPAREN expr RPAREN - | DEFAULT (QUOTEDLITERAL | LPAREN expr RPAREN | literalvalue | ID | keywordastablename | signednumber) - | COLLATE collationname - | foreignkeyclause) - {#columnconstraint = #([COLUMNCONSTRAINT, "COLUMNCONSTRAINT"], #columnconstraint);} - ; - -tableconstraint - : - (CONSTRAINT name)? - ( PRIMARY KEY LPAREN indexedcolumn (COMMA indexedcolumn)* RPAREN (conflictclause)? - | UNIQUE LPAREN indexedcolumn (COMMA indexedcolumn)* RPAREN (conflictclause)? - | CHECK LPAREN expr RPAREN - | FOREIGN KEY LPAREN columnname (COMMA columnname)* RPAREN foreignkeyclause - ) - {#tableconstraint = #([TABLECONSTRAINT, "TABLECONSTRAINT"], #tableconstraint);} - ; - -indexedcolumn - : - expr (COLLATE collationname)? (ASC|DESC)? (AUTOINCREMENT)? - {#indexedcolumn = #([INDEXEDCOLUMN, "INDEXEDCOLUMN"], #indexedcolumn);} - ; - -conflictclause - : - ON CONFLICT - ( ROLLBACK - | ABORT - | FAIL - | IGNORE - | REPLACE - ) - ; - -foreignkeyclause - : - REFERENCES tablename (LPAREN columnname (COMMA columnname)* RPAREN)? - ( ON (DELETE | UPDATE | INSERT) - ( SET (NULL_T | DEFAULT) - | CASCADE - | RESTRICT - | NO ACTION - ) - | MATCH name - )* - ( (NOT DEFERRABLE) => NOT DEFERRABLE (INITIALLY (DEFERRED | IMMEDIATE))? - | DEFERRABLE (INITIALLY (DEFERRED | IMMEDIATE) ) )? - ; - -selectstmt - : SELECT - ; - -functionname - : id ; - -expr - : - ( LPAREN (((subexpr (COMMA subexpr)+ RPAREN binaryoperator LPAREN subexpr (COMMA subexpr)+) | (expr)) RPAREN) ((AND | OR) expr)* ) - | ( subexpr ((binaryoperator | AND | OR) subexpr )* ) - ; - -subexpr - : - ( MINUS | PLUS | TILDE | NOT)? - ( literalvalue -// | bindparameter TODO - | ((databasename DOT)? tablename DOT)? columnname - | functionname LPAREN (expr (COMMA expr)* )? RPAREN //TODO - | castexpr - | EXISTS LPAREN (expr | selectstmt) RPAREN - | caseexpr - | raisefunction -// | windowfunc - ) - (suffixexpr)? - ; - -castexpr - : - CAST LPAREN expr AS type_name RPAREN - ; - -caseexpr - : - CASE_T (expr)? (WHEN expr THEN expr)+ (ELSE_T expr)? END - ; - -/* -windowfunc - : - functionname LPAREN (STAR | (expr (COMMA expr)*))? RPAREN (FILTER LPAREN WHERE expr RPAREN)? OVER - ( - (LPAREN windowdefn RPAREN) - | id - ) - ; - -windowdefn - : - (PARTITION BY expr (COMMA expr)*)? - (ORDER BY orderingterm (COMMA orderingterm)*)? - (framespec)? - ; - -orderingterm - : - expr (COLLATE collationname)? (ASC | DESC)? - ; - -framespec - : - (RANGE | ROWS) - (BETWEEN - ( - (UNBOUNDED PRECEDING) - | (expr PRECEDING) - | (CURRENT ROW) - | (expr FOLLOWING) - ) - AND - ( - (expr PRECEDING) - | (CURRENT ROW) - | (expr FOLLOWING) - | (UNBOUNDED FOLLOWING) - ) - ) - | - ( - (UNBOUNDED PRECEDING) - | (expr PRECEDING) - | (CURRENT ROW) - | (expr FOLLOWING) - ) - ; -*/ - -like_operator - : - LIKE - | GLOB - | REGEXP - | MATCH - ; - -between_subexpr - : - subexpr (AND subexpr)+ - ; - -suffixexpr - : - COLLATE collationname - | (NOT)? - ( BETWEEN subexpr ((binaryoperator | OR) subexpr )* AND expr - | IN ( LPAREN (selectstmt | expr (COMMA expr)* )? RPAREN | tablename) - | like_operator subexpr (ESCAPE subexpr)? - ) - ; - -literalvalue - : - NUMERIC - | STRINGLITERAL -// | blob-literal - | NULL_T - | CURRENT_TIME - | CURRENT_DATE - | CURRENT_TIMESTAMP - ; - -raisefunction - : RAISE LPAREN ( IGNORE | (ROLLBACK | ABORT | FAIL) COMMA STRINGLITERAL ) RPAREN ; - -binaryoperator - : - OROP - | STAR | SLASH | PERCENT - | PLUS | MINUS - | BITWISELEFT | BITWISERIGHT | AMPERSAND | BITOR - | LOWER | LOWEREQUAL | GREATER | GREATEREQUAL - | EQUAL | EQUAL2 | UNEQUAL | UNEQUAL2 - | IS | like_operator - ; diff --git a/src/grammar/sqlite3TokenTypes.hpp b/src/grammar/sqlite3TokenTypes.hpp deleted file mode 100644 index 38dc5c17..00000000 --- a/src/grammar/sqlite3TokenTypes.hpp +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef INC_sqlite3TokenTypes_hpp_ -#define INC_sqlite3TokenTypes_hpp_ - -/* $ANTLR 2.7.7 (20171109): "sqlite3.g" -> "sqlite3TokenTypes.hpp"$ */ - -#ifndef CUSTOM_API -# define CUSTOM_API -#endif - -#ifdef __cplusplus -struct CUSTOM_API sqlite3TokenTypes { -#endif - enum { - EOF_ = 1, - ABORT = 4, - ACTION = 5, - AUTOINCREMENT = 6, - AS = 7, - ASC = 8, - AND = 9, - OR = 10, - BETWEEN = 11, - CASCADE = 12, - CASE_T = 13, - CAST = 14, - CHECK = 15, - CREATE = 16, - COLLATE = 17, - CONFLICT = 18, - CONSTRAINT = 19, - CURRENT_TIME = 20, - CURRENT_DATE = 21, - CURRENT_TIMESTAMP = 22, - DEFAULT = 23, - DEFERRABLE = 24, - DEFERRED = 25, - DELETE = 26, - DESC = 27, - ELSE_T = 28, - END = 29, - ESCAPE = 30, - FAIL = 31, - FILTER = 32, - FOLLOWING = 33, - FOREIGN = 34, - GLOB = 35, - KEY = 36, - LIKE = 37, - TABLE = 38, - IF_T = 39, - IGNORE = 40, - IN = 41, - INDEX = 42, - INITIALLY = 43, - INSERT = 44, - IMMEDIATE = 45, - IS = 46, - NO = 47, - NOT = 48, - NULL_T = 49, - MATCH = 50, - EXISTS = 51, - ON = 52, - OVER = 53, - PARTITION = 54, - PRECEDING = 55, - PRIMARY = 56, - RAISE = 57, - RANGE = 58, - REFERENCES = 59, - REGEXP = 60, - REPLACE = 61, - RESTRICT = 62, - ROLLBACK = 63, - ROWID = 64, - ROWS = 65, - SET = 66, - TEMPORARY = 67, - TEMP = 68, - THEN = 69, - UNBOUNDED = 70, - UNIQUE = 71, - UPDATE = 72, - USING = 73, - VIRTUAL = 74, - WHEN = 75, - WHERE = 76, - WITHOUT = 77, - TYPE_NAME = 78, - COLUMNDEF = 79, - COLUMNCONSTRAINT = 80, - TABLECONSTRAINT = 81, - CREATETABLE = 82, - CREATEINDEX = 83, - INDEXEDCOLUMN = 84, - KEYWORDASTABLENAME = 85, - KEYWORDASCOLUMNNAME = 86, - DIGIT = 87, - DOT = 88, - ID = 89, - QUOTEDID = 90, - QUOTEDLITERAL = 91, - NUMERIC = 92, - NL = 93, - COMMENT = 94, - WS = 95, - STRINGLITERAL = 96, - LPAREN = 97, - RPAREN = 98, - COMMA = 99, - SEMI = 100, - PLUS = 101, - MINUS = 102, - STAR = 103, - TILDE = 104, - AMPERSAND = 105, - BITOR = 106, - OROP = 107, - EQUAL = 108, - EQUAL2 = 109, - GREATER = 110, - GREATEREQUAL = 111, - LOWER = 112, - LOWEREQUAL = 113, - UNEQUAL = 114, - UNEQUAL2 = 115, - BITWISELEFT = 116, - BITWISERIGHT = 117, - SELECT = 118, - SLASH = 119, - PERCENT = 120, - NULL_TREE_LOOKAHEAD = 3 - }; -#ifdef __cplusplus -}; -#endif -#endif /*INC_sqlite3TokenTypes_hpp_*/ diff --git a/src/icons/application_go.png b/src/icons/application_go.png new file mode 100644 index 00000000..5cc2b0dd Binary files /dev/null and b/src/icons/application_go.png differ diff --git a/src/icons/application_link.png b/src/icons/application_link.png new file mode 100644 index 00000000..f8fbb3ed Binary files /dev/null and b/src/icons/application_link.png differ diff --git a/src/icons/bullet_arrow_bottom.png b/src/icons/bullet_arrow_bottom.png new file mode 100644 index 00000000..1a28d825 Binary files /dev/null and b/src/icons/bullet_arrow_bottom.png differ diff --git a/src/icons/bullet_arrow_top.png b/src/icons/bullet_arrow_top.png new file mode 100644 index 00000000..0ce86d2b Binary files /dev/null and b/src/icons/bullet_arrow_top.png differ diff --git a/src/icons/clear_cond_formats.png b/src/icons/clear_cond_formats.png deleted file mode 100644 index 1646b12c..00000000 Binary files a/src/icons/clear_cond_formats.png and /dev/null differ diff --git a/src/icons/clear_sorting.png b/src/icons/clear_sorting.png new file mode 100644 index 00000000..be27fea4 Binary files /dev/null and b/src/icons/clear_sorting.png differ diff --git a/src/icons/document-link.png b/src/icons/document-link.png new file mode 100644 index 00000000..06df131a Binary files /dev/null and b/src/icons/document-link.png differ diff --git a/src/icons/icons.qrc b/src/icons/icons.qrc index 1cdd6343..b77a8b14 100644 --- a/src/icons/icons.qrc +++ b/src/icons/icons.qrc @@ -80,8 +80,26 @@ page_foreign_key.png save_all.png page_white_text.png - color_swatch.png - clear_cond_formats.png - edit_cond_formats.png + color_swatch.png + edit_cond_formats.png + clear_sorting.png + bullet_arrow_bottom.png + bullet_arrow_top.png + text_bold.png + text_italic.png + text_underline.png + text_align_center.png + text_align_justify.png + text_align_left.png + text_align_right.png + page_paintbrush.png + text_paintbrush.png + style.png + style_edit.png + style_delete.png + style_add.png + application_link.png + document-link.png + application_go.png diff --git a/src/icons/page_paintbrush.png b/src/icons/page_paintbrush.png new file mode 100644 index 00000000..246a2f0b Binary files /dev/null and b/src/icons/page_paintbrush.png differ diff --git a/src/icons/style.png b/src/icons/style.png new file mode 100644 index 00000000..81e41de7 Binary files /dev/null and b/src/icons/style.png differ diff --git a/src/icons/style_add.png b/src/icons/style_add.png new file mode 100644 index 00000000..e0369c6b Binary files /dev/null and b/src/icons/style_add.png differ diff --git a/src/icons/style_delete.png b/src/icons/style_delete.png new file mode 100644 index 00000000..640f187e Binary files /dev/null and b/src/icons/style_delete.png differ diff --git a/src/icons/style_edit.png b/src/icons/style_edit.png new file mode 100644 index 00000000..25bb5b67 Binary files /dev/null and b/src/icons/style_edit.png differ diff --git a/src/icons/table_row_delete.png b/src/icons/table_row_delete.png index 54c69691..d52c57e0 100644 Binary files a/src/icons/table_row_delete.png and b/src/icons/table_row_delete.png differ diff --git a/src/icons/table_row_insert.png b/src/icons/table_row_insert.png index ff5925ef..cfbfc753 100644 Binary files a/src/icons/table_row_insert.png and b/src/icons/table_row_insert.png differ diff --git a/src/icons/text_align_center.png b/src/icons/text_align_center.png new file mode 100644 index 00000000..57beb381 Binary files /dev/null and b/src/icons/text_align_center.png differ diff --git a/src/icons/text_align_justify.png b/src/icons/text_align_justify.png new file mode 100644 index 00000000..2fbdd692 Binary files /dev/null and b/src/icons/text_align_justify.png differ diff --git a/src/icons/text_align_left.png b/src/icons/text_align_left.png new file mode 100644 index 00000000..6c8fcc11 Binary files /dev/null and b/src/icons/text_align_left.png differ diff --git a/src/icons/text_align_right.png b/src/icons/text_align_right.png new file mode 100644 index 00000000..a1502571 Binary files /dev/null and b/src/icons/text_align_right.png differ diff --git a/src/icons/text_bold.png b/src/icons/text_bold.png new file mode 100644 index 00000000..889ae80e Binary files /dev/null and b/src/icons/text_bold.png differ diff --git a/src/icons/text_italic.png b/src/icons/text_italic.png new file mode 100644 index 00000000..8482ac8c Binary files /dev/null and b/src/icons/text_italic.png differ diff --git a/src/icons/text_paintbrush.png b/src/icons/text_paintbrush.png new file mode 100644 index 00000000..61876930 Binary files /dev/null and b/src/icons/text_paintbrush.png differ diff --git a/src/icons/text_underline.png b/src/icons/text_underline.png new file mode 100644 index 00000000..90d0df28 Binary files /dev/null and b/src/icons/text_underline.png differ diff --git a/src/sql/ObjectIdentifier.cpp b/src/sql/ObjectIdentifier.cpp index 4e8a56b3..d94aa1c7 100644 --- a/src/sql/ObjectIdentifier.cpp +++ b/src/sql/ObjectIdentifier.cpp @@ -20,6 +20,20 @@ void setIdentifierQuoting(escapeQuoting toQuoting) customQuoting = toQuoting; } +char getIdentifierQuoteChar() +{ + switch(customQuoting) { + case GraveAccents: + return '`'; + case SquareBrackets: + return '['; + case DoubleQuotes: + return '"'; + } + + return '"'; +} + std::string escapeIdentifier(const std::string& id) { switch(customQuoting) { @@ -39,6 +53,11 @@ std::string escapeIdentifier(const std::string& id) } } +std::string escapeString(const std::string& literal) +{ + return '\'' + duplicate_char(literal, '\'') + '\''; +} + bool ObjectIdentifier::fromSerialised(const std::string& serialised) { auto pos_comma = serialised.find(","); diff --git a/src/sql/ObjectIdentifier.h b/src/sql/ObjectIdentifier.h index 29742a7d..8d2f5282 100644 --- a/src/sql/ObjectIdentifier.h +++ b/src/sql/ObjectIdentifier.h @@ -14,9 +14,15 @@ enum escapeQuoting { // Set quoting style for escapeIdentifier void setIdentifierQuoting(escapeQuoting toQuoting); +// Get currently configured quote char +char getIdentifierQuoteChar(); + // Add quotes to an identifier std::string escapeIdentifier(const std::string& id); +// Add SQL quotes to a string literal and escape any single quote character +std::string escapeString(const std::string& literal); + // Object identifier consisting of schema name and object name class ObjectIdentifier { diff --git a/src/sql/Query.cpp b/src/sql/Query.cpp index 5645bb17..b35fb662 100644 --- a/src/sql/Query.cpp +++ b/src/sql/Query.cpp @@ -16,11 +16,13 @@ void Query::clear() std::string Query::buildWherePart() const { - std::string where; + if(m_where.empty() && m_global_where.empty()) + return std::string(); + + std::string where = "WHERE "; + if(m_where.size()) { - where = "WHERE "; - for(auto i=m_where.cbegin();i!=m_where.cend();++i) { const auto it = findSelectedColumnByName(m_column_names.at(i->first)); @@ -33,6 +35,39 @@ std::string Query::buildWherePart() const // Remove last ' AND ' where.erase(where.size() - 5); } + + if(m_global_where.size()) + { + // Connect to previous conditions if there are any + if(m_where.size()) + where += " AND "; + + // For each condition + for(const auto& w : m_global_where) + { + where += "("; + + // For each selected column + for(const auto& c : m_column_names) + { + const auto it = findSelectedColumnByName(c); + std::string column = sqlb::escapeIdentifier(c); + if(it != m_selected_columns.cend() && it->selector != column) + column = it->selector; + + where += column + " " + w + " OR "; + } + + // Remove last ' OR ' + where.erase(where.size() - 4); + + where += ") AND "; + } + + // Remove last ' AND ' + where.erase(where.size() - 5); + } + return where; } diff --git a/src/sql/Query.h b/src/sql/Query.h index cafb1770..112f6758 100644 --- a/src/sql/Query.h +++ b/src/sql/Query.h @@ -72,6 +72,10 @@ public: const std::unordered_map& where() const { return m_where; } std::unordered_map& where() { return m_where; } + const std::vector& globalWhere() const { return m_global_where; } + std::vector& globalWhere() { return m_global_where; } + void setGlobalWhere(const std::vector& w) { m_global_where = w; } + const std::vector& orderBy() const { return m_sort; } std::vector& orderBy() { return m_sort; } void setOrderBy(const std::vector& columns) { m_sort = columns; } @@ -81,7 +85,8 @@ private: sqlb::ObjectIdentifier m_table; std::vector m_rowid_columns; std::vector m_selected_columns; - std::unordered_map m_where; + std::unordered_map m_where; // TODO The two where variables should be merged into a single variable which ... + std::vector m_global_where; // ... holds some sort of general tree structure for all sorts of where conditions. std::vector m_sort; std::vector::iterator findSelectedColumnByName(const std::string& name); diff --git a/src/sql/parser/ParserDriver.cpp b/src/sql/parser/ParserDriver.cpp new file mode 100644 index 00000000..d2dae0f5 --- /dev/null +++ b/src/sql/parser/ParserDriver.cpp @@ -0,0 +1,31 @@ +#include "ParserDriver.h" + +namespace sqlb +{ +namespace parser +{ + +ParserDriver::ParserDriver() : + result(nullptr), + trace_scanner(false), + trace_parser(false), + scanner(nullptr), + buffer(nullptr) +{ +} + +int ParserDriver::parse(const std::string& s) +{ + source = s; + begin_scan(); + + sqlb::parser::parser parse(scanner, *this); + parse.set_debug_level(trace_parser); + int res = parse(); + + end_scan(); + return res; +} + +} +} diff --git a/src/sql/parser/ParserDriver.h b/src/sql/parser/ParserDriver.h new file mode 100644 index 00000000..66796da9 --- /dev/null +++ b/src/sql/parser/ParserDriver.h @@ -0,0 +1,59 @@ +#ifndef PARSER_DRIVER_H +#define PARSER_DRIVER_H + +#include +#include "sqlite3_parser.hpp" +#include "../sqlitetypes.h" + +// Give Flex the prototype of yylex we want and declare it for the parser +typedef void* yyscan_t; +namespace sqlb { namespace parser { class ParserDriver; } } +#define YY_DECL sqlb::parser::parser::symbol_type yylex(yyscan_t yyscanner, sqlb::parser::ParserDriver& drv) +YY_DECL; + +namespace sqlb +{ +namespace parser +{ + +class ParserDriver +{ +public: + ParserDriver(); + + void setScannerDebug(bool on) { trace_scanner = on; } + void setParserDebug(bool on) { trace_parser = on; } + + // Run the parser on string s. Returns 0 on success + int parse(const std::string& s); + + // Result returned by the parsing process + sqlb::ObjectPtr result; + + // The token's location used by the scanner + sqlb::parser::location location; + +private: + // The string to be parsed + std::string source; + + // Handling the scanner + void begin_scan(); + void end_scan(); + + // Debug flags for both scanner and parser + bool trace_scanner; + bool trace_parser; + + // Scanner state + yyscan_t scanner; + + // Scanner buffer + typedef struct yy_buffer_state* YY_BUFFER_STATE; + YY_BUFFER_STATE buffer; +}; + +} +} + +#endif diff --git a/src/sql/parser/README b/src/sql/parser/README new file mode 100644 index 00000000..71adf65b --- /dev/null +++ b/src/sql/parser/README @@ -0,0 +1,9 @@ +This directory contains the SQLite lexer and parser files. + +For convenience and to not have extra dependencies in the build process, +the generated C++ files are included here. Please don't edit them by hand. +To modify the lexer or parser, edit the sqlite3_lexer.ll or sqlite3_parser.yy +files and rerun flex or bison like this: + +flex sqlite3_lexer.ll +bison sqlite3_parser.yy diff --git a/src/sql/parser/sqlite3_lexer.cpp b/src/sql/parser/sqlite3_lexer.cpp new file mode 100644 index 00000000..009b49ff --- /dev/null +++ b/src/sql/parser/sqlite3_lexer.cpp @@ -0,0 +1,3565 @@ +#line 2 "sqlite3_lexer.cpp" + +#line 4 "sqlite3_lexer.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +/* %not-for-header */ +/* %if-c-only */ +/* %if-not-reentrant */ +/* %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 */ + +/* %endif */ + +/* %if-c-only */ + +/* %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 */ + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* %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 yyg->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 ((yyg->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 , yyscanner ) +#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 */ +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +/* %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 = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->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, yyg->yytext_ptr , yyscanner ) + +#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 */ +/* %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 ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->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 yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ +/* %ok-for-header */ + +/* %endif */ + +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); + +static void yyensure_buffer_stack ( yyscan_t yyscanner ); +static void yy_load_buffer_state ( yyscan_t yyscanner ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); + +/* %endif */ + +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ + } \ + 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 */ +/* Begin user sect3 */ + +#define yywrap(yyscanner) (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG +typedef flex_uint8_t YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +/* %% [1.5] DFA */ + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); +static int yy_get_next_buffer ( yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); + +/* %endif */ + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ +/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ + yyleng = (int) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ + yyg->yy_c_buf_p = yy_cp; +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ +#define YY_NUM_RULES 120 +#define YY_END_OF_BUFFER 121 +/* 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[449] = + { 0, + 0, 0, 0, 0, 121, 119, 1, 2, 2, 119, + 119, 106, 105, 119, 95, 96, 102, 100, 98, 101, + 97, 103, 91, 91, 119, 99, 113, 109, 111, 93, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 119, 119, 107, 104, 119, 119, 119, 86, + 1, 2, 115, 0, 89, 0, 90, 3, 91, 4, + 91, 91, 0, 0, 94, 117, 114, 116, 110, 112, + 118, 93, 86, 86, 86, 86, 10, 86, 0, 0, + 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, + + 86, 86, 86, 86, 86, 86, 86, 40, 86, 86, + 43, 47, 86, 86, 86, 52, 86, 56, 57, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 0, 0, 88, 0, + 87, 108, 86, 0, 0, 86, 91, 0, 91, 91, + 93, 86, 86, 6, 11, 86, 0, 0, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 31, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 49, 86, 86, 53, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + + 86, 86, 86, 72, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 92, 0, 0, 5, 86, + 86, 86, 0, 86, 86, 14, 15, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 28, 86, 30, 86, + 86, 34, 86, 86, 86, 86, 39, 86, 86, 86, + 86, 86, 86, 50, 86, 86, 55, 58, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 70, + 86, 86, 74, 76, 77, 86, 86, 86, 86, 86, + 83, 86, 86, 8, 86, 86, 86, 86, 16, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + + 35, 86, 86, 86, 86, 86, 44, 86, 86, 86, + 51, 86, 86, 86, 86, 62, 63, 86, 86, 86, + 86, 86, 69, 86, 73, 86, 86, 86, 86, 81, + 86, 84, 86, 9, 86, 86, 86, 86, 86, 86, + 20, 86, 86, 86, 27, 86, 32, 33, 36, 86, + 86, 41, 86, 86, 46, 48, 86, 86, 86, 86, + 86, 65, 86, 86, 86, 71, 86, 86, 79, 80, + 86, 86, 86, 7, 13, 17, 86, 86, 86, 24, + 86, 86, 86, 86, 38, 86, 86, 54, 86, 86, + 61, 86, 66, 86, 86, 86, 86, 82, 85, 86, + + 18, 86, 86, 86, 26, 29, 86, 86, 86, 86, + 86, 86, 67, 68, 86, 86, 86, 86, 86, 86, + 86, 37, 42, 45, 59, 60, 86, 75, 78, 86, + 19, 86, 86, 25, 64, 86, 86, 86, 86, 21, + 22, 12, 86, 86, 86, 86, 23, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 1, 1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 20, 21, 22, + 23, 24, 25, 20, 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, 35, + 51, 1, 52, 1, 53, 54, 55, 56, 57, 58, + + 59, 60, 61, 62, 63, 35, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 35, 1, 79, 1, 80, 1, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 1, 1, 82, 82, 82, 82, 82, 82, 82, + + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 84, + 84, 84, 84, 84, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[85] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, + 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, + 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 1, 1, 7, 1, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, + 1, 7, 7, 7 + } ; + +static const flex_int16_t yy_base[457] = + { 0, + 0, 0, 59, 60, 362, 2265, 343, 84, 86, 316, + 315, 2265, 2265, 311, 2265, 2265, 2265, 2265, 2265, 299, + 73, 300, 77, 81, 0, 2265, 79, 274, 81, 277, + 128, 64, 187, 76, 124, 82, 87, 35, 241, 98, + 115, 161, 182, 192, 234, 164, 227, 289, 259, 142, + 296, 170, 239, 236, 202, 2265, 197, 181, 170, 354, + 239, 109, 2265, 228, 223, 212, 209, 2265, 274, 2265, + 276, 331, 112, 0, 0, 2265, 2265, 2265, 2265, 2265, + 2265, 102, 50, 200, 254, 305, 312, 301, 128, 122, + 105, 319, 332, 340, 368, 347, 374, 381, 388, 395, + + 391, 412, 154, 425, 417, 446, 436, 59, 454, 449, + 505, 458, 472, 462, 478, 498, 510, 270, 273, 527, + 524, 539, 551, 584, 564, 554, 576, 588, 619, 605, + 628, 623, 631, 614, 634, 647, 174, 125, 2265, 121, + 108, 2265, 283, 72, 70, 651, 425, 174, 196, 0, + 269, 656, 641, 430, 482, 660, 63, 57, 671, 718, + 704, 559, 721, 696, 713, 759, 739, 742, 676, 752, + 684, 764, 748, 772, 768, 784, 779, 815, 822, 818, + 829, 834, 808, 849, 690, 724, 855, 837, 843, 858, + 864, 870, 894, 890, 885, 898, 904, 920, 924, 910, + + 933, 951, 954, 787, 959, 970, 962, 967, 979, 948, + 973, 1001, 1013, 1021, 938, 2265, 120, 28, 793, 1025, + 1031, 1038, 17, 1035, 1047, 882, 992, 1042, 1055, 1063, + 1067, 1071, 1052, 1086, 1090, 1098, 1007, 1093, 1075, 1121, + 1118, 1082, 1137, 1148, 1143, 1151, 1104, 1165, 1155, 1140, + 1178, 1172, 1181, 1110, 1195, 1198, 1115, 1168, 1206, 1212, + 1203, 1215, 1243, 1232, 1227, 1257, 1248, 1265, 1271, 1184, + 1277, 1254, 1282, 1224, 1260, 1289, 1300, 1306, 1320, 1311, + 1285, 1328, 1337, 1314, 1341, 1347, 1369, 1333, 1350, 1362, + 1375, 1379, 1383, 1387, 1390, 1393, 1409, 1417, 1430, 1434, + + 1365, 1437, 1446, 1449, 1452, 1461, 1403, 1470, 1464, 1486, + 1420, 1490, 1493, 1513, 1496, 1474, 1477, 1532, 1523, 1537, + 1547, 1556, 1501, 1544, 1504, 1561, 1551, 1578, 1582, 1516, + 1567, 1519, 1596, 1541, 1618, 1609, 1622, 1625, 1628, 1631, + 1585, 1614, 1643, 1664, 1589, 1646, 1638, 1649, 1652, 1655, + 1678, 1658, 1669, 1706, 1672, 1675, 1712, 1716, 1729, 1719, + 1726, 1684, 1745, 1748, 1757, 1690, 1752, 1762, 1698, 1733, + 1782, 1776, 1779, 1741, 1769, 1772, 1797, 1804, 1790, 1793, + 1841, 1849, 1812, 1832, 1800, 1844, 1853, 1809, 1861, 1867, + 1820, 1881, 1828, 1874, 1877, 1896, 1910, 1838, 1870, 1916, + + 1888, 1923, 1937, 1931, 1901, 1904, 1941, 1944, 1951, 1965, + 1957, 1978, 1960, 1968, 1981, 1987, 1992, 2008, 2012, 2020, + 2025, 1995, 2003, 2015, 2028, 2031, 2044, 2035, 2038, 2070, + 2041, 2060, 2092, 2052, 2055, 2101, 2111, 2118, 2105, 2063, + 2125, 2073, 2137, 2141, 2133, 2121, 2077, 2265, 2225, 2232, + 2235, 2238, 2245, 2252, 2256, 2259 + } ; + +static const flex_int16_t yy_def[457] = + { 0, + 448, 1, 1, 1, 448, 448, 448, 448, 448, 448, + 449, 448, 448, 450, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 451, 448, 448, 448, 448, 448, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 453, 454, 448, 448, 448, 448, 448, 452, + 448, 448, 448, 449, 448, 450, 448, 448, 448, 448, + 448, 448, 448, 455, 451, 448, 448, 448, 448, 448, + 448, 448, 452, 452, 452, 452, 452, 452, 448, 448, + 448, 452, 452, 452, 452, 452, 452, 452, 452, 452, + + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 456, 453, 448, 454, + 448, 448, 452, 448, 448, 452, 448, 448, 448, 455, + 448, 452, 452, 452, 452, 452, 448, 448, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 448, 456, 448, 452, 452, + 452, 452, 448, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 0, 448, 448, + 448, 448, 448, 448, 448, 448 + } ; + +static const flex_int16_t yy_nxt[2350] = + { 0, + 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, 38, 40, 41, 42, 43, 44, + 45, 38, 46, 47, 48, 49, 50, 51, 52, 38, + 53, 6, 38, 54, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 38, + 46, 47, 48, 49, 50, 51, 52, 38, 55, 56, + 6, 57, 58, 59, 60, 60, 62, 62, 62, 62, + 69, 69, 71, 92, 72, 72, 71, 83, 72, 72, + + 76, 77, 78, 80, 81, 98, 73, 104, 143, 99, + 73, 62, 62, 60, 60, 105, 89, 90, 91, 151, + 151, 106, 92, 107, 148, 74, 148, 113, 216, 149, + 149, 89, 90, 91, 98, 73, 104, 223, 99, 73, + 89, 90, 91, 83, 105, 89, 90, 91, 114, 106, + 218, 107, 143, 74, 84, 85, 113, 89, 90, 91, + 100, 140, 101, 89, 90, 91, 86, 102, 89, 90, + 91, 87, 103, 88, 141, 134, 139, 114, 137, 89, + 90, 91, 216, 84, 85, 158, 115, 173, 100, 123, + 101, 149, 149, 124, 86, 102, 89, 90, 91, 87, + + 103, 88, 157, 125, 134, 89, 90, 91, 83, 89, + 90, 91, 93, 149, 149, 115, 173, 66, 123, 94, + 67, 116, 124, 89, 90, 91, 95, 117, 64, 96, + 118, 125, 97, 65, 119, 89, 90, 91, 120, 152, + 61, 93, 89, 90, 91, 89, 90, 91, 94, 116, + 145, 89, 90, 91, 95, 117, 126, 96, 118, 121, + 97, 144, 119, 89, 90, 91, 120, 152, 89, 90, + 91, 108, 109, 89, 90, 91, 122, 143, 110, 111, + 142, 89, 90, 91, 112, 126, 151, 151, 121, 141, + 139, 69, 69, 147, 147, 82, 79, 131, 153, 132, + + 108, 109, 133, 73, 122, 73, 110, 111, 89, 90, + 91, 70, 112, 68, 127, 89, 90, 91, 128, 67, + 65, 129, 89, 90, 91, 131, 153, 132, 135, 136, + 133, 130, 73, 154, 73, 89, 90, 91, 63, 155, + 89, 90, 91, 127, 61, 156, 71, 128, 72, 72, + 129, 89, 90, 91, 89, 90, 91, 135, 136, 130, + 73, 448, 154, 159, 89, 90, 91, 448, 155, 161, + 89, 90, 91, 156, 448, 160, 164, 89, 90, 91, + 84, 85, 89, 90, 91, 448, 89, 90, 91, 73, + 448, 159, 146, 89, 90, 91, 448, 87, 161, 88, + + 89, 90, 91, 160, 162, 164, 163, 448, 448, 84, + 85, 166, 448, 89, 90, 91, 165, 167, 448, 171, + 146, 89, 90, 91, 168, 87, 448, 88, 89, 90, + 91, 169, 162, 448, 163, 89, 90, 91, 170, 172, + 166, 448, 147, 147, 165, 167, 448, 448, 171, 89, + 90, 91, 168, 176, 73, 89, 90, 91, 174, 169, + 448, 175, 89, 90, 91, 448, 170, 448, 172, 89, + 90, 91, 89, 90, 91, 179, 89, 90, 91, 448, + 448, 176, 177, 73, 448, 448, 181, 174, 178, 175, + 448, 448, 180, 89, 90, 91, 185, 187, 89, 90, + + 91, 448, 448, 179, 448, 448, 89, 90, 91, 448, + 177, 89, 90, 91, 181, 448, 178, 89, 90, 91, + 180, 186, 188, 448, 185, 187, 448, 89, 90, 91, + 89, 90, 91, 182, 448, 89, 90, 91, 183, 89, + 90, 91, 189, 89, 90, 91, 190, 448, 184, 186, + 188, 448, 448, 89, 90, 91, 191, 448, 448, 89, + 90, 91, 182, 89, 90, 91, 192, 183, 193, 448, + 189, 448, 194, 448, 190, 448, 184, 448, 448, 89, + 90, 91, 448, 448, 195, 191, 89, 90, 91, 196, + 203, 89, 90, 91, 192, 229, 448, 193, 204, 448, + + 201, 194, 205, 448, 448, 89, 90, 91, 89, 90, + 91, 202, 448, 195, 197, 198, 448, 196, 203, 448, + 89, 90, 91, 229, 199, 206, 204, 200, 201, 448, + 448, 205, 89, 90, 91, 89, 90, 91, 448, 202, + 89, 90, 91, 197, 198, 89, 90, 91, 207, 448, + 208, 211, 199, 206, 209, 200, 213, 89, 90, 91, + 448, 210, 448, 214, 212, 89, 90, 91, 448, 89, + 90, 91, 448, 448, 221, 448, 448, 207, 208, 219, + 211, 448, 448, 209, 213, 448, 89, 90, 91, 448, + 210, 215, 214, 212, 448, 89, 90, 91, 220, 222, + + 89, 90, 91, 221, 89, 90, 91, 448, 219, 89, + 90, 91, 89, 90, 91, 89, 90, 91, 224, 215, + 238, 232, 89, 90, 91, 448, 220, 222, 89, 90, + 91, 228, 89, 90, 91, 253, 448, 89, 90, 91, + 448, 89, 90, 91, 448, 225, 224, 226, 238, 448, + 232, 230, 89, 90, 91, 233, 448, 89, 90, 91, + 228, 448, 227, 253, 231, 89, 90, 91, 236, 237, + 448, 89, 90, 91, 225, 448, 226, 89, 90, 91, + 230, 239, 448, 233, 234, 89, 90, 91, 235, 240, + 227, 241, 231, 448, 89, 90, 91, 236, 237, 89, + + 90, 91, 89, 90, 91, 89, 90, 91, 242, 448, + 239, 243, 448, 234, 448, 245, 448, 235, 240, 241, + 89, 90, 91, 89, 90, 91, 448, 448, 244, 89, + 90, 91, 448, 89, 90, 91, 242, 448, 448, 243, + 89, 90, 91, 245, 246, 89, 90, 91, 247, 89, + 90, 91, 251, 89, 90, 91, 244, 248, 249, 448, + 89, 90, 91, 250, 255, 89, 90, 91, 89, 90, + 91, 448, 448, 246, 89, 90, 91, 247, 252, 448, + 251, 256, 448, 448, 254, 248, 448, 249, 448, 89, + 90, 91, 250, 255, 257, 448, 89, 90, 91, 89, + + 90, 91, 448, 89, 90, 91, 258, 252, 448, 256, + 89, 90, 91, 254, 259, 89, 90, 91, 89, 90, + 91, 260, 257, 448, 89, 90, 91, 261, 262, 263, + 89, 90, 91, 264, 258, 448, 89, 90, 91, 89, + 90, 91, 259, 448, 448, 89, 90, 91, 448, 265, + 260, 89, 90, 91, 267, 261, 262, 448, 263, 448, + 266, 448, 264, 89, 90, 91, 89, 90, 91, 268, + 283, 89, 90, 91, 448, 89, 90, 91, 265, 89, + 90, 91, 267, 271, 269, 89, 90, 91, 266, 277, + 448, 89, 90, 91, 270, 272, 275, 268, 278, 283, + + 274, 89, 90, 91, 448, 89, 90, 91, 448, 448, + 273, 448, 271, 269, 89, 90, 91, 277, 276, 89, + 90, 91, 270, 272, 448, 275, 448, 278, 274, 89, + 90, 91, 89, 90, 91, 89, 90, 91, 273, 279, + 89, 90, 91, 89, 90, 91, 276, 448, 89, 90, + 91, 89, 90, 91, 89, 90, 91, 280, 448, 281, + 89, 90, 91, 282, 287, 448, 448, 279, 448, 284, + 285, 286, 288, 89, 90, 91, 448, 289, 448, 448, + 290, 294, 89, 90, 91, 280, 448, 281, 89, 90, + 91, 282, 448, 287, 89, 90, 91, 284, 285, 291, + + 286, 288, 89, 90, 91, 289, 89, 90, 91, 290, + 294, 292, 89, 90, 91, 293, 89, 90, 91, 89, + 90, 91, 448, 89, 90, 91, 298, 291, 89, 90, + 91, 295, 296, 89, 90, 91, 89, 90, 91, 292, + 448, 448, 297, 293, 89, 90, 91, 448, 89, 90, + 91, 448, 89, 90, 91, 298, 89, 90, 91, 295, + 296, 299, 300, 89, 90, 91, 301, 89, 90, 91, + 297, 89, 90, 91, 89, 90, 91, 302, 448, 89, + 90, 91, 303, 306, 304, 89, 90, 91, 307, 299, + 300, 89, 90, 91, 448, 301, 89, 90, 91, 89, + + 90, 91, 89, 90, 91, 448, 302, 305, 448, 448, + 303, 308, 306, 304, 309, 448, 307, 310, 89, 90, + 91, 89, 90, 91, 89, 90, 91, 311, 315, 89, + 90, 91, 89, 90, 91, 305, 89, 90, 91, 313, + 308, 314, 309, 312, 316, 310, 89, 90, 91, 89, + 90, 91, 448, 89, 90, 91, 311, 315, 448, 89, + 90, 91, 89, 90, 91, 89, 90, 91, 313, 448, + 314, 312, 317, 316, 318, 319, 89, 90, 91, 89, + 90, 91, 320, 325, 89, 90, 91, 89, 90, 91, + 321, 322, 448, 89, 90, 91, 89, 90, 91, 323, + + 448, 317, 318, 319, 324, 89, 90, 91, 89, 90, + 91, 320, 325, 89, 90, 91, 448, 448, 321, 448, + 322, 326, 448, 448, 89, 90, 91, 448, 323, 89, + 90, 91, 448, 324, 327, 89, 90, 91, 89, 90, + 91, 89, 90, 91, 448, 328, 89, 90, 91, 326, + 329, 330, 89, 90, 91, 448, 331, 332, 89, 90, + 91, 337, 327, 89, 90, 91, 89, 90, 91, 448, + 89, 90, 91, 328, 448, 448, 333, 448, 329, 334, + 330, 89, 90, 91, 331, 335, 332, 89, 90, 91, + 337, 448, 89, 90, 91, 89, 90, 91, 336, 448, + + 448, 89, 90, 91, 333, 448, 338, 334, 339, 89, + 90, 91, 341, 335, 89, 90, 91, 448, 89, 90, + 91, 340, 89, 90, 91, 342, 343, 336, 89, 90, + 91, 89, 90, 91, 338, 344, 448, 339, 345, 448, + 448, 341, 448, 89, 90, 91, 89, 90, 91, 340, + 89, 90, 91, 342, 343, 346, 89, 90, 91, 347, + 89, 90, 91, 344, 89, 90, 91, 345, 89, 90, + 91, 89, 90, 91, 89, 90, 91, 348, 448, 349, + 351, 352, 448, 346, 89, 90, 91, 448, 347, 448, + 89, 90, 91, 350, 353, 354, 448, 448, 89, 90, + + 91, 89, 90, 91, 448, 348, 448, 349, 355, 351, + 352, 89, 90, 91, 448, 89, 90, 91, 89, 90, + 91, 350, 356, 353, 354, 448, 357, 89, 90, 91, + 89, 90, 91, 89, 90, 91, 355, 358, 360, 448, + 448, 359, 89, 90, 91, 89, 90, 91, 448, 448, + 356, 89, 90, 91, 357, 89, 90, 91, 89, 90, + 91, 361, 448, 362, 363, 358, 360, 89, 90, 91, + 359, 89, 90, 91, 89, 90, 91, 89, 90, 91, + 364, 365, 89, 90, 91, 89, 90, 91, 366, 368, + 361, 362, 371, 363, 89, 90, 91, 89, 90, 91, + + 89, 90, 91, 367, 89, 90, 91, 369, 448, 364, + 365, 370, 448, 89, 90, 91, 366, 368, 89, 90, + 91, 371, 89, 90, 91, 89, 90, 91, 89, 90, + 91, 367, 89, 90, 91, 448, 369, 89, 90, 91, + 370, 372, 89, 90, 91, 373, 448, 374, 89, 90, + 91, 375, 448, 448, 376, 377, 378, 448, 379, 89, + 90, 91, 448, 89, 90, 91, 89, 90, 91, 372, + 89, 90, 91, 383, 373, 374, 448, 89, 90, 91, + 375, 448, 448, 376, 377, 378, 379, 380, 384, 381, + 89, 90, 91, 382, 386, 89, 90, 91, 448, 89, + + 90, 91, 383, 89, 90, 91, 89, 90, 91, 89, + 90, 91, 89, 90, 91, 380, 385, 384, 381, 89, + 90, 91, 382, 386, 89, 90, 91, 89, 90, 91, + 89, 90, 91, 89, 90, 91, 89, 90, 91, 89, + 90, 91, 387, 448, 385, 89, 90, 91, 388, 389, + 89, 90, 91, 89, 90, 91, 89, 90, 91, 89, + 90, 91, 390, 448, 392, 89, 90, 91, 391, 448, + 387, 89, 90, 91, 393, 394, 388, 396, 389, 89, + 90, 91, 448, 448, 395, 448, 448, 89, 90, 91, + 397, 390, 392, 89, 90, 91, 391, 89, 90, 91, + + 89, 90, 91, 393, 394, 448, 396, 89, 90, 91, + 89, 90, 91, 395, 89, 90, 91, 448, 398, 397, + 399, 400, 89, 90, 91, 448, 89, 90, 91, 89, + 90, 91, 448, 89, 90, 91, 448, 402, 89, 90, + 91, 401, 403, 89, 90, 91, 398, 448, 399, 400, + 89, 90, 91, 89, 90, 91, 406, 89, 90, 91, + 89, 90, 91, 89, 90, 91, 402, 404, 448, 401, + 407, 89, 90, 91, 89, 90, 91, 405, 89, 90, + 91, 89, 90, 91, 406, 89, 90, 91, 408, 409, + 89, 90, 91, 89, 90, 91, 404, 448, 407, 448, + + 410, 89, 90, 91, 448, 411, 405, 448, 412, 89, + 90, 91, 414, 89, 90, 91, 408, 409, 413, 89, + 90, 91, 89, 90, 91, 89, 90, 91, 410, 448, + 89, 90, 91, 411, 89, 90, 91, 412, 415, 416, + 414, 448, 89, 90, 91, 417, 413, 448, 89, 90, + 91, 89, 90, 91, 448, 89, 90, 91, 89, 90, + 91, 418, 89, 90, 91, 419, 415, 421, 416, 89, + 90, 91, 422, 423, 417, 448, 448, 89, 90, 91, + 448, 420, 89, 90, 91, 89, 90, 91, 426, 418, + 448, 89, 90, 91, 419, 421, 448, 89, 90, 91, + + 424, 422, 423, 425, 89, 90, 91, 427, 448, 420, + 448, 448, 89, 90, 91, 429, 448, 426, 89, 90, + 91, 448, 89, 90, 91, 89, 90, 91, 424, 430, + 428, 425, 89, 90, 91, 448, 427, 432, 89, 90, + 91, 89, 90, 91, 429, 448, 89, 90, 91, 89, + 90, 91, 431, 433, 434, 448, 448, 430, 428, 89, + 90, 91, 89, 90, 91, 448, 432, 448, 89, 90, + 91, 448, 448, 89, 90, 91, 89, 90, 91, 448, + 431, 448, 433, 434, 89, 90, 91, 435, 448, 89, + 90, 91, 448, 89, 90, 91, 89, 90, 91, 436, + + 448, 89, 90, 91, 437, 448, 89, 90, 91, 89, + 90, 91, 89, 90, 91, 435, 89, 90, 91, 89, + 90, 91, 89, 90, 91, 89, 90, 91, 436, 438, + 448, 448, 437, 89, 90, 91, 89, 90, 91, 439, + 440, 89, 90, 91, 89, 90, 91, 441, 448, 442, + 448, 89, 90, 91, 89, 90, 91, 438, 89, 90, + 91, 447, 448, 448, 448, 448, 445, 439, 443, 440, + 446, 448, 448, 89, 90, 91, 441, 442, 448, 448, + 448, 444, 89, 90, 91, 448, 89, 90, 91, 447, + 448, 448, 89, 90, 91, 445, 443, 448, 446, 89, + + 90, 91, 89, 90, 91, 448, 89, 90, 91, 444, + 448, 448, 448, 448, 89, 90, 91, 448, 89, 90, + 91, 448, 89, 90, 91, 64, 448, 64, 64, 64, + 64, 64, 66, 448, 66, 66, 66, 66, 66, 75, + 75, 83, 83, 83, 83, 138, 448, 138, 138, 138, + 138, 138, 140, 448, 140, 140, 140, 140, 140, 150, + 150, 217, 217, 217, 5, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448 + } ; + +static const flex_int16_t yy_chk[2350] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 4, 8, 8, 9, 9, + 21, 21, 23, 32, 23, 23, 24, 223, 24, 24, + + 27, 27, 27, 29, 29, 34, 23, 36, 218, 34, + 24, 62, 62, 3, 4, 36, 38, 38, 38, 82, + 82, 36, 32, 37, 73, 23, 73, 40, 217, 73, + 73, 83, 83, 83, 34, 23, 36, 158, 34, 24, + 108, 108, 108, 157, 36, 32, 32, 32, 41, 36, + 145, 37, 144, 23, 31, 31, 40, 34, 34, 34, + 35, 141, 35, 36, 36, 36, 31, 35, 37, 37, + 37, 31, 35, 31, 140, 50, 138, 41, 52, 40, + 40, 40, 137, 31, 31, 91, 42, 103, 35, 46, + 35, 148, 148, 46, 31, 35, 41, 41, 41, 31, + + 35, 31, 90, 46, 50, 35, 35, 35, 89, 31, + 31, 31, 33, 149, 149, 42, 103, 67, 46, 33, + 66, 43, 46, 50, 50, 50, 33, 43, 65, 33, + 44, 46, 33, 64, 44, 103, 103, 103, 44, 84, + 61, 33, 42, 42, 42, 46, 46, 46, 33, 43, + 59, 52, 52, 52, 33, 43, 47, 33, 44, 45, + 33, 58, 44, 43, 43, 43, 44, 84, 33, 33, + 33, 39, 39, 44, 44, 44, 45, 57, 39, 39, + 55, 84, 84, 84, 39, 47, 151, 151, 45, 54, + 53, 69, 69, 71, 71, 30, 28, 49, 85, 49, + + 39, 39, 49, 69, 45, 71, 39, 39, 47, 47, + 47, 22, 39, 20, 48, 45, 45, 45, 48, 14, + 11, 48, 39, 39, 39, 49, 85, 49, 51, 51, + 49, 48, 69, 86, 71, 85, 85, 85, 10, 87, + 49, 49, 49, 48, 7, 88, 72, 48, 72, 72, + 48, 118, 118, 118, 119, 119, 119, 51, 51, 48, + 72, 5, 86, 92, 143, 143, 143, 0, 87, 94, + 48, 48, 48, 88, 0, 93, 96, 51, 51, 51, + 60, 60, 88, 88, 88, 0, 86, 86, 86, 72, + 0, 92, 60, 87, 87, 87, 0, 60, 94, 60, + + 92, 92, 92, 93, 95, 96, 95, 0, 0, 60, + 60, 98, 0, 93, 93, 93, 97, 98, 0, 101, + 60, 94, 94, 94, 98, 60, 0, 60, 96, 96, + 96, 99, 95, 0, 95, 60, 60, 60, 100, 102, + 98, 0, 147, 147, 97, 98, 0, 0, 101, 95, + 95, 95, 98, 105, 147, 97, 97, 97, 104, 99, + 0, 104, 98, 98, 98, 0, 100, 0, 102, 99, + 99, 99, 101, 101, 101, 107, 100, 100, 100, 0, + 0, 105, 106, 147, 0, 0, 110, 104, 106, 104, + 0, 0, 109, 102, 102, 102, 112, 114, 105, 105, + + 105, 0, 0, 107, 0, 0, 104, 104, 104, 0, + 106, 154, 154, 154, 110, 0, 106, 107, 107, 107, + 109, 113, 115, 0, 112, 114, 0, 106, 106, 106, + 110, 110, 110, 111, 0, 109, 109, 109, 111, 112, + 112, 112, 116, 114, 114, 114, 117, 0, 111, 113, + 115, 0, 0, 113, 113, 113, 120, 0, 0, 115, + 115, 115, 111, 155, 155, 155, 121, 111, 122, 0, + 116, 0, 122, 0, 117, 0, 111, 0, 0, 116, + 116, 116, 0, 0, 123, 120, 111, 111, 111, 123, + 126, 117, 117, 117, 121, 162, 0, 122, 126, 0, + + 125, 122, 127, 0, 0, 121, 121, 121, 120, 120, + 120, 125, 0, 123, 124, 124, 0, 123, 126, 0, + 122, 122, 122, 162, 124, 128, 126, 124, 125, 0, + 0, 127, 123, 123, 123, 126, 126, 126, 0, 125, + 162, 162, 162, 124, 124, 125, 125, 125, 129, 0, + 130, 132, 124, 128, 131, 124, 134, 127, 127, 127, + 0, 131, 0, 135, 133, 124, 124, 124, 0, 128, + 128, 128, 0, 0, 153, 0, 0, 129, 130, 146, + 132, 0, 0, 131, 134, 0, 130, 130, 130, 0, + 131, 136, 135, 133, 0, 134, 134, 134, 152, 156, + + 129, 129, 129, 153, 132, 132, 132, 0, 146, 131, + 131, 131, 133, 133, 133, 135, 135, 135, 159, 136, + 169, 164, 153, 153, 153, 0, 152, 156, 136, 136, + 136, 161, 146, 146, 146, 185, 0, 152, 152, 152, + 0, 156, 156, 156, 0, 160, 159, 160, 169, 0, + 164, 163, 159, 159, 159, 165, 0, 169, 169, 169, + 161, 0, 160, 185, 163, 171, 171, 171, 167, 168, + 0, 185, 185, 185, 160, 0, 160, 164, 164, 164, + 163, 170, 0, 165, 166, 161, 161, 161, 166, 172, + 160, 173, 163, 0, 165, 165, 165, 167, 168, 160, + + 160, 160, 163, 163, 163, 186, 186, 186, 174, 0, + 170, 175, 0, 166, 0, 177, 0, 166, 172, 173, + 167, 167, 167, 168, 168, 168, 0, 0, 176, 173, + 173, 173, 0, 170, 170, 170, 174, 0, 0, 175, + 166, 166, 166, 177, 178, 172, 172, 172, 179, 175, + 175, 175, 183, 174, 174, 174, 176, 180, 181, 0, + 177, 177, 177, 182, 188, 176, 176, 176, 204, 204, + 204, 0, 0, 178, 219, 219, 219, 179, 184, 0, + 183, 189, 0, 0, 187, 180, 0, 181, 0, 183, + 183, 183, 182, 188, 190, 0, 178, 178, 178, 180, + + 180, 180, 0, 179, 179, 179, 191, 184, 0, 189, + 181, 181, 181, 187, 192, 182, 182, 182, 188, 188, + 188, 193, 190, 0, 189, 189, 189, 194, 195, 196, + 184, 184, 184, 197, 191, 0, 187, 187, 187, 190, + 190, 190, 192, 0, 0, 191, 191, 191, 0, 198, + 193, 192, 192, 192, 200, 194, 195, 0, 196, 0, + 199, 0, 197, 226, 226, 226, 195, 195, 195, 201, + 215, 194, 194, 194, 0, 193, 193, 193, 198, 196, + 196, 196, 200, 203, 202, 197, 197, 197, 199, 210, + 0, 200, 200, 200, 202, 205, 208, 201, 211, 215, + + 207, 198, 198, 198, 0, 199, 199, 199, 0, 0, + 206, 0, 203, 202, 201, 201, 201, 210, 209, 215, + 215, 215, 202, 205, 0, 208, 0, 211, 207, 210, + 210, 210, 202, 202, 202, 203, 203, 203, 206, 212, + 205, 205, 205, 207, 207, 207, 209, 0, 208, 208, + 208, 206, 206, 206, 211, 211, 211, 213, 0, 214, + 209, 209, 209, 214, 224, 0, 0, 212, 0, 220, + 221, 222, 225, 227, 227, 227, 0, 228, 0, 0, + 229, 233, 212, 212, 212, 213, 0, 214, 237, 237, + 237, 214, 0, 224, 213, 213, 213, 220, 221, 230, + + 222, 225, 214, 214, 214, 228, 220, 220, 220, 229, + 233, 231, 221, 221, 221, 232, 224, 224, 224, 222, + 222, 222, 0, 228, 228, 228, 238, 230, 225, 225, + 225, 234, 235, 233, 233, 233, 229, 229, 229, 231, + 0, 0, 236, 232, 230, 230, 230, 0, 231, 231, + 231, 0, 232, 232, 232, 238, 239, 239, 239, 234, + 235, 240, 241, 242, 242, 242, 243, 234, 234, 234, + 236, 235, 235, 235, 238, 238, 238, 244, 0, 236, + 236, 236, 245, 249, 246, 247, 247, 247, 250, 240, + 241, 254, 254, 254, 0, 243, 257, 257, 257, 241, + + 241, 241, 240, 240, 240, 0, 244, 248, 0, 0, + 245, 251, 249, 246, 252, 0, 250, 253, 243, 243, + 243, 250, 250, 250, 245, 245, 245, 255, 261, 244, + 244, 244, 246, 246, 246, 248, 249, 249, 249, 259, + 251, 260, 252, 256, 262, 253, 248, 248, 248, 258, + 258, 258, 0, 252, 252, 252, 255, 261, 0, 251, + 251, 251, 253, 253, 253, 270, 270, 270, 259, 0, + 260, 256, 263, 262, 264, 265, 255, 255, 255, 256, + 256, 256, 266, 272, 261, 261, 261, 259, 259, 259, + 267, 268, 0, 260, 260, 260, 262, 262, 262, 269, + + 0, 263, 264, 265, 271, 274, 274, 274, 265, 265, + 265, 266, 272, 264, 264, 264, 0, 0, 267, 0, + 268, 273, 0, 0, 263, 263, 263, 0, 269, 267, + 267, 267, 0, 271, 276, 272, 272, 272, 266, 266, + 266, 275, 275, 275, 0, 277, 268, 268, 268, 273, + 278, 279, 269, 269, 269, 0, 280, 282, 271, 271, + 271, 288, 276, 273, 273, 273, 281, 281, 281, 0, + 276, 276, 276, 277, 0, 0, 283, 0, 278, 285, + 279, 277, 277, 277, 280, 286, 282, 278, 278, 278, + 288, 0, 280, 280, 280, 284, 284, 284, 287, 0, + + 0, 279, 279, 279, 283, 0, 290, 285, 291, 282, + 282, 282, 293, 286, 288, 288, 288, 0, 283, 283, + 283, 292, 285, 285, 285, 294, 295, 287, 286, 286, + 286, 289, 289, 289, 290, 296, 0, 291, 297, 0, + 0, 293, 0, 290, 290, 290, 301, 301, 301, 292, + 287, 287, 287, 294, 295, 298, 291, 291, 291, 299, + 292, 292, 292, 296, 293, 293, 293, 297, 294, 294, + 294, 295, 295, 295, 296, 296, 296, 300, 0, 302, + 304, 305, 0, 298, 307, 307, 307, 0, 299, 0, + 297, 297, 297, 303, 306, 308, 0, 0, 298, 298, + + 298, 311, 311, 311, 0, 300, 0, 302, 309, 304, + 305, 299, 299, 299, 0, 300, 300, 300, 302, 302, + 302, 303, 310, 306, 308, 0, 312, 303, 303, 303, + 304, 304, 304, 305, 305, 305, 309, 313, 315, 0, + 0, 314, 306, 306, 306, 309, 309, 309, 0, 0, + 310, 308, 308, 308, 312, 316, 316, 316, 317, 317, + 317, 318, 0, 319, 320, 313, 315, 310, 310, 310, + 314, 312, 312, 312, 313, 313, 313, 315, 315, 315, + 321, 322, 323, 323, 323, 325, 325, 325, 324, 327, + 318, 319, 331, 320, 314, 314, 314, 330, 330, 330, + + 332, 332, 332, 326, 319, 319, 319, 328, 0, 321, + 322, 329, 0, 318, 318, 318, 324, 327, 320, 320, + 320, 331, 334, 334, 334, 324, 324, 324, 321, 321, + 321, 326, 327, 327, 327, 0, 328, 322, 322, 322, + 329, 333, 326, 326, 326, 335, 0, 336, 331, 331, + 331, 337, 0, 0, 338, 339, 340, 0, 342, 328, + 328, 328, 0, 329, 329, 329, 341, 341, 341, 333, + 345, 345, 345, 346, 335, 336, 0, 333, 333, 333, + 337, 0, 0, 338, 339, 340, 342, 343, 350, 344, + 336, 336, 336, 344, 353, 342, 342, 342, 0, 335, + + 335, 335, 346, 337, 337, 337, 338, 338, 338, 339, + 339, 339, 340, 340, 340, 343, 351, 350, 344, 347, + 347, 347, 344, 353, 343, 343, 343, 346, 346, 346, + 348, 348, 348, 349, 349, 349, 350, 350, 350, 352, + 352, 352, 354, 0, 351, 344, 344, 344, 357, 358, + 353, 353, 353, 355, 355, 355, 356, 356, 356, 351, + 351, 351, 359, 0, 361, 362, 362, 362, 360, 0, + 354, 366, 366, 366, 363, 364, 357, 367, 358, 369, + 369, 369, 0, 0, 365, 0, 0, 354, 354, 354, + 368, 359, 361, 357, 357, 357, 360, 358, 358, 358, + + 360, 360, 360, 363, 364, 0, 367, 361, 361, 361, + 359, 359, 359, 365, 370, 370, 370, 0, 371, 368, + 372, 373, 374, 374, 374, 0, 363, 363, 363, 364, + 364, 364, 0, 367, 367, 367, 0, 378, 365, 365, + 365, 377, 379, 368, 368, 368, 371, 0, 372, 373, + 375, 375, 375, 376, 376, 376, 383, 372, 372, 372, + 373, 373, 373, 371, 371, 371, 378, 381, 0, 377, + 384, 379, 379, 379, 380, 380, 380, 382, 377, 377, + 377, 385, 385, 385, 383, 378, 378, 378, 386, 387, + 388, 388, 388, 383, 383, 383, 381, 0, 384, 0, + + 389, 391, 391, 391, 0, 390, 382, 0, 392, 393, + 393, 393, 395, 384, 384, 384, 386, 387, 394, 398, + 398, 398, 381, 381, 381, 386, 386, 386, 389, 0, + 382, 382, 382, 390, 387, 387, 387, 392, 396, 397, + 395, 0, 389, 389, 389, 400, 394, 0, 390, 390, + 390, 399, 399, 399, 0, 394, 394, 394, 395, 395, + 395, 402, 392, 392, 392, 403, 396, 404, 397, 401, + 401, 401, 407, 408, 400, 0, 0, 396, 396, 396, + 0, 403, 405, 405, 405, 406, 406, 406, 411, 402, + 0, 397, 397, 397, 403, 404, 0, 400, 400, 400, + + 409, 407, 408, 410, 402, 402, 402, 412, 0, 403, + 0, 0, 404, 404, 404, 416, 0, 411, 403, 403, + 403, 0, 407, 407, 407, 408, 408, 408, 409, 417, + 415, 410, 409, 409, 409, 0, 412, 419, 411, 411, + 411, 413, 413, 413, 416, 0, 410, 410, 410, 414, + 414, 414, 418, 420, 421, 0, 0, 417, 415, 412, + 412, 412, 415, 415, 415, 0, 419, 0, 416, 416, + 416, 0, 0, 417, 417, 417, 422, 422, 422, 0, + 418, 0, 420, 421, 423, 423, 423, 427, 0, 418, + 418, 418, 0, 419, 419, 419, 424, 424, 424, 430, + + 0, 420, 420, 420, 432, 0, 421, 421, 421, 425, + 425, 425, 426, 426, 426, 427, 428, 428, 428, 429, + 429, 429, 431, 431, 431, 427, 427, 427, 430, 433, + 0, 0, 432, 434, 434, 434, 435, 435, 435, 436, + 437, 432, 432, 432, 440, 440, 440, 438, 0, 439, + 0, 430, 430, 430, 442, 442, 442, 433, 447, 447, + 447, 446, 0, 0, 0, 0, 444, 436, 441, 437, + 445, 0, 0, 433, 433, 433, 438, 439, 0, 0, + 0, 443, 436, 436, 436, 0, 439, 439, 439, 446, + 0, 0, 437, 437, 437, 444, 441, 0, 445, 438, + + 438, 438, 446, 446, 446, 0, 441, 441, 441, 443, + 0, 0, 0, 0, 445, 445, 445, 0, 443, 443, + 443, 0, 444, 444, 444, 449, 0, 449, 449, 449, + 449, 449, 450, 0, 450, 450, 450, 450, 450, 451, + 451, 452, 452, 452, 452, 453, 0, 453, 453, 453, + 453, 453, 454, 0, 454, 454, 454, 454, 454, 455, + 455, 456, 456, 456, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + 448, 448, 448, 448, 448, 448, 448, 448, 448 + } ; + +static const flex_int16_t yy_rule_linenum[120] = + { 0, + 80, 81, 83, 89, 113, 114, 115, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 206, 207, 208, 209, 210, 211, + + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 231 + } ; + +/* 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 +#line 1 "sqlite3_lexer.ll" +#line 2 "sqlite3_lexer.ll" +#include +#include "ParserDriver.h" +#include "sqlite3_parser.hpp" +#line 1192 "sqlite3_lexer.cpp" +#define YY_NO_UNISTD_H 1 +#line 12 "sqlite3_lexer.ll" + #define TOKEN(n) sqlb::parser::parser::symbol_type(sqlb::parser::parser::token::TOK_##n, yytext, loc) + + std::string unquote_string(std::string s, char quote_char) + { + if(s.size() < 2) + return s; + + if(quote_char == '[') + { + if(s.front() == '[' && s.back() == ']') + s = s.substr(1, s.size()-2); + } else { + if(s.front() == quote_char && s.back() == quote_char) + { + s = s.substr(1, s.size()-2); + auto pos = s.npos; + while((pos = s.find(std::string(2, quote_char))) != s.npos) + s = s.replace(pos, 2, std::string(1, quote_char)); + } + } + + return s; + } +#line 1218 "sqlite3_lexer.cpp" +#line 55 "sqlite3_lexer.ll" + /* TODO Add $ bind parameters */ + // Code run each time a pattern is matched. + #define YY_USER_ACTION loc.columns(yyleng); +#line 1223 "sqlite3_lexer.cpp" + +#line 1225 "sqlite3_lexer.cpp" + +#define INITIAL 0 +#define BETWEEN_MODE 1 + +#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 */ + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + }; /* end struct yyguts_t */ + +/* %if-c-only */ + +static int yy_init_globals ( yyscan_t yyscanner ); + +/* %endif */ + +/* %if-reentrant */ + +int yylex_init (yyscan_t* scanner); + +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); + +/* %endif */ + +/* %endif End reentrant structures and macros. */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( yyscan_t yyscanner ); + +int yyget_debug ( yyscan_t yyscanner ); + +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); + +FILE *yyget_in ( yyscan_t yyscanner ); + +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); + +FILE *yyget_out ( yyscan_t yyscanner ); + +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); + + int yyget_leng ( yyscan_t yyscanner ); + +char *yyget_text ( yyscan_t yyscanner ); + +int yyget_lineno ( yyscan_t yyscanner ); + +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); + +int yyget_column ( yyscan_t yyscanner ); + +void yyset_column ( int _column_no , yyscan_t yyscanner ); + +/* %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 ( yyscan_t yyscanner ); +#else +extern int yywrap ( yyscan_t yyscanner ); +#endif +#endif + +/* %not-for-header */ +#ifndef YY_NO_UNPUT + +#endif +/* %ok-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ +#ifdef __cplusplus +static int yyinput ( yyscan_t yyscanner ); +#else +static int input ( yyscan_t yyscanner ); +#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 , yyscanner) +/* %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 (yyscan_t yyscanner); + +#define YY_DECL int yylex (yyscan_t yyscanner) +/* %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; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->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 (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + } + + yy_load_buffer_state( yyscanner ); + } + + { +/* %% [7.0] user's declarations go here */ +#line 69 "sqlite3_lexer.ll" + + + +#line 73 "sqlite3_lexer.ll" + // Shortcut to the location held by the driver + sqlb::parser::location& loc = drv.location; + + // Code run each time yylex is called. + loc.step(); + + +#line 1563 "sqlite3_lexer.cpp" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { +/* %% [8.0] yymore()-related code goes here */ + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->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 = yyg->yy_start; +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->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 >= 449 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 448 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: +/* %% [10.0] code to find the action number goes here */ + 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 < 120 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], yytext ); + else if ( yy_act == 120 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + yytext ); + else if ( yy_act == 121 ) + 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 = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 80 "sqlite3_lexer.ll" +loc.step(); + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 81 "sqlite3_lexer.ll" +loc.lines(yyleng); loc.step(); + YY_BREAK +case 3: +YY_RULE_SETUP +#line 83 "sqlite3_lexer.ll" +{ + int c; + while((c = yyinput(yyscanner)) != '\n' && c != EOF) + ; /* eat up text of comment */ + } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 89 "sqlite3_lexer.ll" +{ + int c; + + for(;;) + { + while((c = yyinput(yyscanner)) != '*' && c != EOF) + ; /* eat up text of comment */ + + if(c == '*') + { + while((c = yyinput(yyscanner)) == '*') + ; + if(c == '/') + break; /* found the end */ + } + + if(c == EOF) + throw sqlb::parser::parser::syntax_error(loc, "EOF in comment"); + } + } + YY_BREAK +/* For lack of a better idea, we need this hack to avoid reduce/reduce conflicts in the rules for parsing BETWEEN expressions. + * What we do here is distinguish two types of AND operators: the regular one and the special case when the AND follows a BETWEEN keyword. + */ +case 5: +YY_RULE_SETUP +#line 113 "sqlite3_lexer.ll" +{ BEGIN INITIAL; return TOKEN(AND_BETWEEN); } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 114 "sqlite3_lexer.ll" +return TOKEN(AND); + YY_BREAK +case 7: +YY_RULE_SETUP +#line 115 "sqlite3_lexer.ll" +{ BEGIN BETWEEN_MODE; return TOKEN(BETWEEN); } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 117 "sqlite3_lexer.ll" +return TOKEN(ABORT); + YY_BREAK +case 9: +YY_RULE_SETUP +#line 118 "sqlite3_lexer.ll" +return TOKEN(ACTION); + YY_BREAK +case 10: +YY_RULE_SETUP +#line 119 "sqlite3_lexer.ll" +return TOKEN(AS); + YY_BREAK +case 11: +YY_RULE_SETUP +#line 120 "sqlite3_lexer.ll" +return TOKEN(ASC); + YY_BREAK +case 12: +YY_RULE_SETUP +#line 121 "sqlite3_lexer.ll" +return TOKEN(AUTOINCREMENT); + YY_BREAK +case 13: +YY_RULE_SETUP +#line 122 "sqlite3_lexer.ll" +return TOKEN(CASCADE); + YY_BREAK +case 14: +YY_RULE_SETUP +#line 123 "sqlite3_lexer.ll" +return TOKEN(CASE); + YY_BREAK +case 15: +YY_RULE_SETUP +#line 124 "sqlite3_lexer.ll" +return TOKEN(CAST); + YY_BREAK +case 16: +YY_RULE_SETUP +#line 125 "sqlite3_lexer.ll" +return TOKEN(CHECK); + YY_BREAK +case 17: +YY_RULE_SETUP +#line 126 "sqlite3_lexer.ll" +return TOKEN(COLLATE); + YY_BREAK +case 18: +YY_RULE_SETUP +#line 127 "sqlite3_lexer.ll" +return TOKEN(CONFLICT); + YY_BREAK +case 19: +YY_RULE_SETUP +#line 128 "sqlite3_lexer.ll" +return TOKEN(CONSTRAINT); + YY_BREAK +case 20: +YY_RULE_SETUP +#line 129 "sqlite3_lexer.ll" +return TOKEN(CREATE); + YY_BREAK +case 21: +YY_RULE_SETUP +#line 130 "sqlite3_lexer.ll" +return TOKEN(CURRENT_DATE); + YY_BREAK +case 22: +YY_RULE_SETUP +#line 131 "sqlite3_lexer.ll" +return TOKEN(CURRENT_TIME); + YY_BREAK +case 23: +YY_RULE_SETUP +#line 132 "sqlite3_lexer.ll" +return TOKEN(CURRENT_TIMESTAMP); + YY_BREAK +case 24: +YY_RULE_SETUP +#line 133 "sqlite3_lexer.ll" +return TOKEN(DEFAULT); + YY_BREAK +case 25: +YY_RULE_SETUP +#line 134 "sqlite3_lexer.ll" +return TOKEN(DEFERRABLE); + YY_BREAK +case 26: +YY_RULE_SETUP +#line 135 "sqlite3_lexer.ll" +return TOKEN(DEFERRED); + YY_BREAK +case 27: +YY_RULE_SETUP +#line 136 "sqlite3_lexer.ll" +return TOKEN(DELETE); + YY_BREAK +case 28: +YY_RULE_SETUP +#line 137 "sqlite3_lexer.ll" +return TOKEN(DESC); + YY_BREAK +case 29: +YY_RULE_SETUP +#line 138 "sqlite3_lexer.ll" +return TOKEN(DISTINCT); + YY_BREAK +case 30: +YY_RULE_SETUP +#line 139 "sqlite3_lexer.ll" +return TOKEN(ELSE); + YY_BREAK +case 31: +YY_RULE_SETUP +#line 140 "sqlite3_lexer.ll" +return TOKEN(END); + YY_BREAK +case 32: +YY_RULE_SETUP +#line 141 "sqlite3_lexer.ll" +return TOKEN(ESCAPE); + YY_BREAK +case 33: +YY_RULE_SETUP +#line 142 "sqlite3_lexer.ll" +return TOKEN(EXISTS); + YY_BREAK +case 34: +YY_RULE_SETUP +#line 143 "sqlite3_lexer.ll" +return TOKEN(FAIL); + YY_BREAK +case 35: +YY_RULE_SETUP +#line 144 "sqlite3_lexer.ll" +return TOKEN(FALSE); + YY_BREAK +case 36: +YY_RULE_SETUP +#line 145 "sqlite3_lexer.ll" +return TOKEN(FILTER); + YY_BREAK +case 37: +YY_RULE_SETUP +#line 146 "sqlite3_lexer.ll" +return TOKEN(FOLLOWING); + YY_BREAK +case 38: +YY_RULE_SETUP +#line 147 "sqlite3_lexer.ll" +return TOKEN(FOREIGN); + YY_BREAK +case 39: +YY_RULE_SETUP +#line 148 "sqlite3_lexer.ll" +return TOKEN(GLOB); + YY_BREAK +case 40: +YY_RULE_SETUP +#line 149 "sqlite3_lexer.ll" +return TOKEN(IF); + YY_BREAK +case 41: +YY_RULE_SETUP +#line 150 "sqlite3_lexer.ll" +return TOKEN(IGNORE); + YY_BREAK +case 42: +YY_RULE_SETUP +#line 151 "sqlite3_lexer.ll" +return TOKEN(IMMEDIATE); + YY_BREAK +case 43: +YY_RULE_SETUP +#line 152 "sqlite3_lexer.ll" +return TOKEN(IN); + YY_BREAK +case 44: +YY_RULE_SETUP +#line 153 "sqlite3_lexer.ll" +return TOKEN(INDEX); + YY_BREAK +case 45: +YY_RULE_SETUP +#line 154 "sqlite3_lexer.ll" +return TOKEN(INITIALLY); + YY_BREAK +case 46: +YY_RULE_SETUP +#line 155 "sqlite3_lexer.ll" +return TOKEN(INSERT); + YY_BREAK +case 47: +YY_RULE_SETUP +#line 156 "sqlite3_lexer.ll" +return TOKEN(IS); + YY_BREAK +case 48: +YY_RULE_SETUP +#line 157 "sqlite3_lexer.ll" +return TOKEN(ISNULL); + YY_BREAK +case 49: +YY_RULE_SETUP +#line 158 "sqlite3_lexer.ll" +return TOKEN(KEY); + YY_BREAK +case 50: +YY_RULE_SETUP +#line 159 "sqlite3_lexer.ll" +return TOKEN(LIKE); + YY_BREAK +case 51: +YY_RULE_SETUP +#line 160 "sqlite3_lexer.ll" +return TOKEN(MATCH); + YY_BREAK +case 52: +YY_RULE_SETUP +#line 161 "sqlite3_lexer.ll" +return TOKEN(NO); + YY_BREAK +case 53: +YY_RULE_SETUP +#line 162 "sqlite3_lexer.ll" +return TOKEN(NOT); + YY_BREAK +case 54: +YY_RULE_SETUP +#line 163 "sqlite3_lexer.ll" +return TOKEN(NOTNULL); + YY_BREAK +case 55: +YY_RULE_SETUP +#line 164 "sqlite3_lexer.ll" +return TOKEN(NULL); + YY_BREAK +case 56: +YY_RULE_SETUP +#line 165 "sqlite3_lexer.ll" +return TOKEN(ON); + YY_BREAK +case 57: +YY_RULE_SETUP +#line 166 "sqlite3_lexer.ll" +return TOKEN(OR); + YY_BREAK +case 58: +YY_RULE_SETUP +#line 167 "sqlite3_lexer.ll" +return TOKEN(OVER); + YY_BREAK +case 59: +YY_RULE_SETUP +#line 168 "sqlite3_lexer.ll" +return TOKEN(PARTITION); + YY_BREAK +case 60: +YY_RULE_SETUP +#line 169 "sqlite3_lexer.ll" +return TOKEN(PRECEDING); + YY_BREAK +case 61: +YY_RULE_SETUP +#line 170 "sqlite3_lexer.ll" +return TOKEN(PRIMARY); + YY_BREAK +case 62: +YY_RULE_SETUP +#line 171 "sqlite3_lexer.ll" +return TOKEN(RAISE); + YY_BREAK +case 63: +YY_RULE_SETUP +#line 172 "sqlite3_lexer.ll" +return TOKEN(RANGE); + YY_BREAK +case 64: +YY_RULE_SETUP +#line 173 "sqlite3_lexer.ll" +return TOKEN(REFERENCES); + YY_BREAK +case 65: +YY_RULE_SETUP +#line 174 "sqlite3_lexer.ll" +return TOKEN(REGEXP); + YY_BREAK +case 66: +YY_RULE_SETUP +#line 175 "sqlite3_lexer.ll" +return TOKEN(REPLACE); + YY_BREAK +case 67: +YY_RULE_SETUP +#line 176 "sqlite3_lexer.ll" +return TOKEN(RESTRICT); + YY_BREAK +case 68: +YY_RULE_SETUP +#line 177 "sqlite3_lexer.ll" +return TOKEN(ROLLBACK); + YY_BREAK +case 69: +YY_RULE_SETUP +#line 178 "sqlite3_lexer.ll" +return TOKEN(ROWID); + YY_BREAK +case 70: +YY_RULE_SETUP +#line 179 "sqlite3_lexer.ll" +return TOKEN(ROWS); + YY_BREAK +case 71: +YY_RULE_SETUP +#line 180 "sqlite3_lexer.ll" +return TOKEN(SELECT); + YY_BREAK +case 72: +YY_RULE_SETUP +#line 181 "sqlite3_lexer.ll" +return TOKEN(SET); + YY_BREAK +case 73: +YY_RULE_SETUP +#line 182 "sqlite3_lexer.ll" +return TOKEN(TABLE); + YY_BREAK +case 74: +YY_RULE_SETUP +#line 183 "sqlite3_lexer.ll" +return TOKEN(TEMP); + YY_BREAK +case 75: +YY_RULE_SETUP +#line 184 "sqlite3_lexer.ll" +return TOKEN(TEMPORARY); + YY_BREAK +case 76: +YY_RULE_SETUP +#line 185 "sqlite3_lexer.ll" +return TOKEN(THEN); + YY_BREAK +case 77: +YY_RULE_SETUP +#line 186 "sqlite3_lexer.ll" +return TOKEN(TRUE); + YY_BREAK +case 78: +YY_RULE_SETUP +#line 187 "sqlite3_lexer.ll" +return TOKEN(UNBOUNDED); + YY_BREAK +case 79: +YY_RULE_SETUP +#line 188 "sqlite3_lexer.ll" +return TOKEN(UNIQUE); + YY_BREAK +case 80: +YY_RULE_SETUP +#line 189 "sqlite3_lexer.ll" +return TOKEN(UPDATE); + YY_BREAK +case 81: +YY_RULE_SETUP +#line 190 "sqlite3_lexer.ll" +return TOKEN(USING); + YY_BREAK +case 82: +YY_RULE_SETUP +#line 191 "sqlite3_lexer.ll" +return TOKEN(VIRTUAL); + YY_BREAK +case 83: +YY_RULE_SETUP +#line 192 "sqlite3_lexer.ll" +return TOKEN(WHEN); + YY_BREAK +case 84: +YY_RULE_SETUP +#line 193 "sqlite3_lexer.ll" +return TOKEN(WHERE); + YY_BREAK +case 85: +YY_RULE_SETUP +#line 194 "sqlite3_lexer.ll" +return TOKEN(WITHOUT); + YY_BREAK +case 86: +YY_RULE_SETUP +#line 196 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_IDENTIFIER(yytext, loc); + YY_BREAK +case 87: +YY_RULE_SETUP +#line 197 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_IDENTIFIER(unquote_string(yytext, '`'), loc); + YY_BREAK +case 88: +YY_RULE_SETUP +#line 198 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_IDENTIFIER(unquote_string(yytext, '['), loc); + YY_BREAK +case 89: +YY_RULE_SETUP +#line 199 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_QUOTEDLITERAL(unquote_string(yytext, '"'), loc); + YY_BREAK +case 90: +YY_RULE_SETUP +#line 200 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_STRINGLITERAL(yytext, loc); + YY_BREAK +case 91: +YY_RULE_SETUP +#line 201 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_NUMERIC(yytext, loc); + YY_BREAK +case 92: +YY_RULE_SETUP +#line 202 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_BLOBLITERAL(yytext, loc); + YY_BREAK +case 93: +YY_RULE_SETUP +#line 203 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_BINDPARAMETER(yytext, loc); + YY_BREAK +case 94: +YY_RULE_SETUP +#line 204 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_BINDPARAMETER(yytext, loc); + YY_BREAK +case 95: +YY_RULE_SETUP +#line 206 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_LPAREN(loc); + YY_BREAK +case 96: +YY_RULE_SETUP +#line 207 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_RPAREN(loc); + YY_BREAK +case 97: +YY_RULE_SETUP +#line 208 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_DOT(loc); + YY_BREAK +case 98: +YY_RULE_SETUP +#line 209 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_COMMA(loc); + YY_BREAK +case 99: +YY_RULE_SETUP +#line 210 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_SEMI(loc); + YY_BREAK +case 100: +YY_RULE_SETUP +#line 211 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_PLUS(loc); + YY_BREAK +case 101: +YY_RULE_SETUP +#line 212 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_MINUS(loc); + YY_BREAK +case 102: +YY_RULE_SETUP +#line 213 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_STAR(loc); + YY_BREAK +case 103: +YY_RULE_SETUP +#line 214 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_SLASH(loc); + YY_BREAK +case 104: +YY_RULE_SETUP +#line 215 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_TILDE(loc); + YY_BREAK +case 105: +YY_RULE_SETUP +#line 216 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_AMPERSAND(loc); + YY_BREAK +case 106: +YY_RULE_SETUP +#line 217 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_PERCENT(loc); + YY_BREAK +case 107: +YY_RULE_SETUP +#line 218 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_BITOR(loc); + YY_BREAK +case 108: +YY_RULE_SETUP +#line 219 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_OROP(loc); + YY_BREAK +case 109: +YY_RULE_SETUP +#line 220 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_EQUAL(loc); + YY_BREAK +case 110: +YY_RULE_SETUP +#line 221 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_EQUAL2(loc); + YY_BREAK +case 111: +YY_RULE_SETUP +#line 222 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_GREATER(loc); + YY_BREAK +case 112: +YY_RULE_SETUP +#line 223 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_GREATEREQUAL(loc); + YY_BREAK +case 113: +YY_RULE_SETUP +#line 224 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_LOWER(loc); + YY_BREAK +case 114: +YY_RULE_SETUP +#line 225 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_LOWEREQUAL(loc); + YY_BREAK +case 115: +YY_RULE_SETUP +#line 226 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_UNEQUAL(loc); + YY_BREAK +case 116: +YY_RULE_SETUP +#line 227 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_UNEQUAL2(loc); + YY_BREAK +case 117: +YY_RULE_SETUP +#line 228 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_BITWISELEFT(loc); + YY_BREAK +case 118: +YY_RULE_SETUP +#line 229 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_BITWISERIGHT(loc); + YY_BREAK +case 119: +YY_RULE_SETUP +#line 231 "sqlite3_lexer.ll" +throw sqlb::parser::parser::syntax_error(loc, "Invalid character: " + std::string(yytext)); + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(BETWEEN_MODE): +#line 233 "sqlite3_lexer.ll" +return sqlb::parser::parser::make_EOF(loc); + YY_BREAK +case 120: +YY_RULE_SETUP +#line 235 "sqlite3_lexer.ll" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 2271 "sqlite3_lexer.cpp" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->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. + */ + yyg->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 ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* 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 , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->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 = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( yywrap( yyscanner ) ) + { + /* 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. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->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 (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->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 ( yyg->yy_c_buf_p - yyg->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) (yyg->yy_c_buf_p - yyg->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 = yyg->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) (yyg->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) , yyscanner ); + } + 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" ); + + yyg->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]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin , yyscanner); + } + + 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 ((yyg->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 = yyg->yy_n_chars + number_to_move + (yyg->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 , yyscanner ); + 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); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->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 (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + yy_state_type yy_current_state; + char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->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] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->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 >= 449 ) + 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 , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ +/* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + char *yy_cp = yyg->yy_c_buf_p; + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->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 >= 449 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 448); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT +/* %if-c-only */ + +/* %endif */ +#endif + +/* %if-c-only */ +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->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 ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + 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 , yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( yyscanner ) ) + return 0; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->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. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void yyrestart (FILE * input_file , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); + yy_load_buffer_state( yyscanner ); +} + +/* %if-c++-only */ +/* %endif */ + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ +/* %if-c-only */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( yyscanner ); + + /* 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. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/* %if-c-only */ +static void yy_load_buffer_state (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->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 */ + yyg->yy_hold_char = *yyg->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. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + 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) , yyscanner ); + 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 , yyscanner); + + return b; +} + +/* %if-c++-only */ +/* %endif */ + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ +/* %if-c-only */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + 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 , yyscanner ); + + yyfree( (void *) b , yyscanner ); +} + +/* 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 , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer( b , yyscanner); + +/* %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 = 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. + * @param yyscanner The scanner object. + */ +/* %if-c-only */ + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + 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( yyscanner ); +} + +/* %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. + * @param yyscanner The scanner object. + */ +/* %if-c-only */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( yyscanner ); + yyg->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. + * @param yyscanner The scanner object. + */ +/* %if-c-only */ +void yypop_buffer_state (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( yyscanner ); + yyg->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 (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + yy_size_t num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->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... */ + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->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 = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->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 + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + 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 ) , yyscanner ); + 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 , yyscanner ); + + 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 + * @param yyscanner The scanner object. + * @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 , yyscan_t yyscanner) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); +} +/* %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. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + 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 , yyscanner ); + 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 , yyscanner); + 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 , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + 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] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* %if-c-only */ +/* %if-reentrant */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/* %endif */ + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/* %if-reentrant */ + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/* %endif */ + +/** Set the current line number. + * @param _line_number line number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int _line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); + + yylineno = _line_number; +} + +/** Set the current column. + * @param _column_no column number + * @param yyscanner The scanner object. + */ +void yyset_column (int _column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_column called with no buffer" ); + + yycolumn = _column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = _out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int _bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = _bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* Accessor methods for yylval and yylloc */ + +/* %if-bison-bridge */ +/* %endif */ + +/* User-visible API */ + +/* yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ +int yylex_init(yyscan_t* ptr_yy_globals) +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* yylex_init_extra has the same functionality as yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to yyalloc in + * the yyextra field. + */ +int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) +{ + struct yyguts_t dummy_yyguts; + + yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* %endif if-c-only */ + +/* %if-c-only */ +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = NULL; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = NULL; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* 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 (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack , yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree( yyg->yy_start_stack , yyscanner ); + yyg->yy_start_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( yyscanner); + +/* %if-reentrant */ + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + 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 , yyscan_t yyscanner) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + /* 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 , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + 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 */ + +#line 235 "sqlite3_lexer.ll" + + +namespace sqlb +{ +namespace parser +{ + +void ParserDriver::begin_scan() +{ + yylex_init(&scanner); + location.initialize(); + yyset_debug(trace_scanner, scanner); + buffer = yy_scan_string(source.c_str(), scanner); +} + +void ParserDriver::end_scan() +{ + yy_delete_buffer(buffer, scanner); + yylex_destroy(scanner); +} + +} +} + diff --git a/src/sql/parser/sqlite3_lexer.h b/src/sql/parser/sqlite3_lexer.h new file mode 100644 index 00000000..3b337eac --- /dev/null +++ b/src/sql/parser/sqlite3_lexer.h @@ -0,0 +1,610 @@ +#ifndef yyHEADER_H +#define yyHEADER_H 1 +#define yyIN_HEADER 1 + +#line 6 "sqlite3_lexer.h" + +#line 8 "sqlite3_lexer.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +/* %not-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 */ + +/* %endif */ + +/* %if-c-only */ + +/* %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 */ + +/* %not-for-header */ + +/* %if-reentrant */ + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* %endif */ + +/* %if-not-reentrant */ +/* %endif */ + +/* 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 + +#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 */ +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +/* %endif */ +/* %endif */ + +#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; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %endif */ + +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ + +/* %endif */ + +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); + +/* %endif */ + +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); + +/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ +/* Begin user sect3 */ + +#define yywrap(yyscanner) (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG + +#define yytext_ptr yytext_r + +/* %if-c-only Standard (non-C++) definition */ + +/* %endif */ + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define BETWEEN_MODE 1 + +#endif + +#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 */ + +/* %endif */ + +/* %if-reentrant */ + +int yylex_init (yyscan_t* scanner); + +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); + +/* %endif */ + +/* %endif End reentrant structures and macros. */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( yyscan_t yyscanner ); + +int yyget_debug ( yyscan_t yyscanner ); + +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); + +FILE *yyget_in ( yyscan_t yyscanner ); + +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); + +FILE *yyget_out ( yyscan_t yyscanner ); + +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); + + int yyget_leng ( yyscan_t yyscanner ); + +char *yyget_text ( yyscan_t yyscanner ); + +int yyget_lineno ( yyscan_t yyscanner ); + +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); + +int yyget_column ( yyscan_t yyscanner ); + +void yyset_column ( int _column_no , yyscan_t yyscanner ); + +/* %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 ( yyscan_t yyscanner ); +#else +extern int yywrap ( yyscan_t yyscanner ); +#endif +#endif + +/* %not-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-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 + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %not-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 (yyscan_t yyscanner); + +#define YY_DECL int yylex (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* %not-for-header */ + +/* %if-c++-only */ +/* %not-for-header */ + +/* %endif */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +/* %if-c-only */ +/* %not-for-header */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#ifndef yy_create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef yy_delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef yy_scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef yy_scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef yy_scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef yy_init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef yy_flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef yy_load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef yy_switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef yypush_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef yypop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef yyensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef yylex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef yyrestart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef yylex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef yylex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef yylex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef yyget_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef yyset_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef yyget_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef yyset_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef yyget_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef yyset_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef yyget_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef yyset_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef yyget_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef yyget_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef yyget_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef yyset_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef yyget_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef yyset_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef yywrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef yyget_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef yyset_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef yyget_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef yyset_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef yyalloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef yyrealloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef yyfree_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef yytext_ALREADY_DEFINED +#undef yytext +#endif +#ifndef yyleng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef yyin_ALREADY_DEFINED +#undef yyin +#endif +#ifndef yyout_ALREADY_DEFINED +#undef yyout +#endif +#ifndef yy_flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef yylineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef yytables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef yytables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef yyTABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#line 235 "sqlite3_lexer.ll" + + +#line 609 "sqlite3_lexer.h" +#undef yyIN_HEADER +#endif /* yyHEADER_H */ diff --git a/src/sql/parser/sqlite3_lexer.ll b/src/sql/parser/sqlite3_lexer.ll new file mode 100644 index 00000000..974ab35f --- /dev/null +++ b/src/sql/parser/sqlite3_lexer.ll @@ -0,0 +1,256 @@ +%{ +#include +#include "ParserDriver.h" +#include "sqlite3_parser.hpp" +%} + +%option noyywrap nounput batch debug case-insensitive 8bit never-interactive nodefault nounistd reentrant warn +%option header-file="sqlite3_lexer.h" +%option outfile="sqlite3_lexer.cpp" + +%{ + #define TOKEN(n) sqlb::parser::parser::symbol_type(sqlb::parser::parser::token::TOK_##n, yytext, loc) + + std::string unquote_string(std::string s, char quote_char) + { + if(s.size() < 2) + return s; + + if(quote_char == '[') + { + if(s.front() == '[' && s.back() == ']') + s = s.substr(1, s.size()-2); + } else { + if(s.front() == quote_char && s.back() == quote_char) + { + s = s.substr(1, s.size()-2); + auto pos = s.npos; + while((pos = s.find(std::string(2, quote_char))) != s.npos) + s = s.replace(pos, 2, std::string(1, quote_char)); + } + } + + return s; + } +%} + +U [\x80-\xbf] +U2 [\xc2-\xdf] +U3 [\xe0-\xef] +U4 [\xf0-\xf4] +UNICODE {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} + +ID ([a-z_]|{UNICODE})([a-z0-9_]|{UNICODE})* + +GRAVEQUOTEDID `([^\n`]|(``))*` +SQUAREBRACKETID \[([^\n\]])*\] + +QUOTEDLITERAL \"([^\n\"]|(\"\"))*\" +STRINGLITERAL \'([^\n\']|(\'\'))*\' +BLOBLITERAL X\'[0-9a-f]*\' + +BINDPARAMETER_NUM \?([1-9]{DIGIT}*)? +BINDPARAMETER_STR [:@][a-z]+ + /* TODO Add $ bind parameters */ + +DIGIT [0-9] +NUMERIC (({DIGIT}+(\.{DIGIT}*)?|(\.{DIGIT}+))(e[\+\-]?{DIGIT}+)?)|(0x[0-9a-f]+) + +NL [\r\n] +WS [ \t\f] + +%{ + // Code run each time a pattern is matched. + #define YY_USER_ACTION loc.columns(yyleng); +%} + +%s BETWEEN_MODE + +%% + +%{ + // Shortcut to the location held by the driver + sqlb::parser::location& loc = drv.location; + + // Code run each time yylex is called. + loc.step(); +%} + +{WS}+ loc.step(); +{NL}+ loc.lines(yyleng); loc.step(); + +"--" { + int c; + while((c = yyinput(yyscanner)) != '\n' && c != EOF) + ; /* eat up text of comment */ + } + +"/*" { + int c; + + for(;;) + { + while((c = yyinput(yyscanner)) != '*' && c != EOF) + ; /* eat up text of comment */ + + if(c == '*') + { + while((c = yyinput(yyscanner)) == '*') + ; + if(c == '/') + break; /* found the end */ + } + + if(c == EOF) + throw sqlb::parser::parser::syntax_error(loc, "EOF in comment"); + } + } + + /* For lack of a better idea, we need this hack to avoid reduce/reduce conflicts in the rules for parsing BETWEEN expressions. + * What we do here is distinguish two types of AND operators: the regular one and the special case when the AND follows a BETWEEN keyword. + */ +"AND" { BEGIN INITIAL; return TOKEN(AND_BETWEEN); } +"AND" return TOKEN(AND); +"BETWEEN" { BEGIN BETWEEN_MODE; return TOKEN(BETWEEN); } + +"ABORT" return TOKEN(ABORT); +"ACTION" return TOKEN(ACTION); +"AS" return TOKEN(AS); +"ASC" return TOKEN(ASC); +"AUTOINCREMENT" return TOKEN(AUTOINCREMENT); +"CASCADE" return TOKEN(CASCADE); +"CASE" return TOKEN(CASE); +"CAST" return TOKEN(CAST); +"CHECK" return TOKEN(CHECK); +"COLLATE" return TOKEN(COLLATE); +"CONFLICT" return TOKEN(CONFLICT); +"CONSTRAINT" return TOKEN(CONSTRAINT); +"CREATE" return TOKEN(CREATE); +"CURRENT_DATE" return TOKEN(CURRENT_DATE); +"CURRENT_TIME" return TOKEN(CURRENT_TIME); +"CURRENT_TIMESTAMP" return TOKEN(CURRENT_TIMESTAMP); +"DEFAULT" return TOKEN(DEFAULT); +"DEFERRABLE" return TOKEN(DEFERRABLE); +"DEFERRED" return TOKEN(DEFERRED); +"DELETE" return TOKEN(DELETE); +"DESC" return TOKEN(DESC); +"DISTINCT" return TOKEN(DISTINCT); +"ELSE" return TOKEN(ELSE); +"END" return TOKEN(END); +"ESCAPE" return TOKEN(ESCAPE); +"EXISTS" return TOKEN(EXISTS); +"FAIL" return TOKEN(FAIL); +"FALSE" return TOKEN(FALSE); +"FILTER" return TOKEN(FILTER); +"FOLLOWING" return TOKEN(FOLLOWING); +"FOREIGN" return TOKEN(FOREIGN); +"GLOB" return TOKEN(GLOB); +"IF" return TOKEN(IF); +"IGNORE" return TOKEN(IGNORE); +"IMMEDIATE" return TOKEN(IMMEDIATE); +"IN" return TOKEN(IN); +"INDEX" return TOKEN(INDEX); +"INITIALLY" return TOKEN(INITIALLY); +"INSERT" return TOKEN(INSERT); +"IS" return TOKEN(IS); +"ISNULL" return TOKEN(ISNULL); +"KEY" return TOKEN(KEY); +"LIKE" return TOKEN(LIKE); +"MATCH" return TOKEN(MATCH); +"NO" return TOKEN(NO); +"NOT" return TOKEN(NOT); +"NOTNULL" return TOKEN(NOTNULL); +"NULL" return TOKEN(NULL); +"ON" return TOKEN(ON); +"OR" return TOKEN(OR); +"OVER" return TOKEN(OVER); +"PARTITION" return TOKEN(PARTITION); +"PRECEDING" return TOKEN(PRECEDING); +"PRIMARY" return TOKEN(PRIMARY); +"RAISE" return TOKEN(RAISE); +"RANGE" return TOKEN(RANGE); +"REFERENCES" return TOKEN(REFERENCES); +"REGEXP" return TOKEN(REGEXP); +"REPLACE" return TOKEN(REPLACE); +"RESTRICT" return TOKEN(RESTRICT); +"ROLLBACK" return TOKEN(ROLLBACK); +"ROWID" return TOKEN(ROWID); +"ROWS" return TOKEN(ROWS); +"SELECT" return TOKEN(SELECT); +"SET" return TOKEN(SET); +"TABLE" return TOKEN(TABLE); +"TEMP" return TOKEN(TEMP); +"TEMPORARY" return TOKEN(TEMPORARY); +"THEN" return TOKEN(THEN); +"TRUE" return TOKEN(TRUE); +"UNBOUNDED" return TOKEN(UNBOUNDED); +"UNIQUE" return TOKEN(UNIQUE); +"UPDATE" return TOKEN(UPDATE); +"USING" return TOKEN(USING); +"VIRTUAL" return TOKEN(VIRTUAL); +"WHEN" return TOKEN(WHEN); +"WHERE" return TOKEN(WHERE); +"WITHOUT" return TOKEN(WITHOUT); + +{ID} return sqlb::parser::parser::make_IDENTIFIER(yytext, loc); +{GRAVEQUOTEDID} return sqlb::parser::parser::make_IDENTIFIER(unquote_string(yytext, '`'), loc); +{SQUAREBRACKETID} return sqlb::parser::parser::make_IDENTIFIER(unquote_string(yytext, '['), loc); +{QUOTEDLITERAL} return sqlb::parser::parser::make_QUOTEDLITERAL(unquote_string(yytext, '"'), loc); +{STRINGLITERAL} return sqlb::parser::parser::make_STRINGLITERAL(yytext, loc); +{NUMERIC} return sqlb::parser::parser::make_NUMERIC(yytext, loc); +{BLOBLITERAL} return sqlb::parser::parser::make_BLOBLITERAL(yytext, loc); +{BINDPARAMETER_NUM} return sqlb::parser::parser::make_BINDPARAMETER(yytext, loc); +{BINDPARAMETER_STR} return sqlb::parser::parser::make_BINDPARAMETER(yytext, loc); + +"(" return sqlb::parser::parser::make_LPAREN(loc); +")" return sqlb::parser::parser::make_RPAREN(loc); +"." return sqlb::parser::parser::make_DOT(loc); +"," return sqlb::parser::parser::make_COMMA(loc); +";" return sqlb::parser::parser::make_SEMI(loc); +"+" return sqlb::parser::parser::make_PLUS(loc); +"-" return sqlb::parser::parser::make_MINUS(loc); +"*" return sqlb::parser::parser::make_STAR(loc); +"/" return sqlb::parser::parser::make_SLASH(loc); +"~" return sqlb::parser::parser::make_TILDE(loc); +"&" return sqlb::parser::parser::make_AMPERSAND(loc); +"%" return sqlb::parser::parser::make_PERCENT(loc); +"|" return sqlb::parser::parser::make_BITOR(loc); +"||" return sqlb::parser::parser::make_OROP(loc); +"=" return sqlb::parser::parser::make_EQUAL(loc); +"==" return sqlb::parser::parser::make_EQUAL2(loc); +">" return sqlb::parser::parser::make_GREATER(loc); +">=" return sqlb::parser::parser::make_GREATEREQUAL(loc); +"<" return sqlb::parser::parser::make_LOWER(loc); +"<=" return sqlb::parser::parser::make_LOWEREQUAL(loc); +"!=" return sqlb::parser::parser::make_UNEQUAL(loc); +"<>" return sqlb::parser::parser::make_UNEQUAL2(loc); +"<<" return sqlb::parser::parser::make_BITWISELEFT(loc); +">>" return sqlb::parser::parser::make_BITWISERIGHT(loc); + +. throw sqlb::parser::parser::syntax_error(loc, "Invalid character: " + std::string(yytext)); + +<> return sqlb::parser::parser::make_EOF(loc); + +%% + +namespace sqlb +{ +namespace parser +{ + +void ParserDriver::begin_scan() +{ + yylex_init(&scanner); + location.initialize(); + yyset_debug(trace_scanner, scanner); + buffer = yy_scan_string(source.c_str(), scanner); +} + +void ParserDriver::end_scan() +{ + yy_delete_buffer(buffer, scanner); + yylex_destroy(scanner); +} + +} +} diff --git a/src/sql/parser/sqlite3_location.h b/src/sql/parser/sqlite3_location.h new file mode 100644 index 00000000..bbb586b5 --- /dev/null +++ b/src/sql/parser/sqlite3_location.h @@ -0,0 +1,324 @@ +// A Bison parser, made by GNU Bison 3.4.1. + +// Locations for Bison parsers in C++ + +// Copyright (C) 2002-2015, 2018-2019 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. + +/** + ** \file sqlite3_location.h + ** Define the sqlb::parser ::location class. + */ + +#ifndef YY_YY_SQLITE3_LOCATION_H_INCLUDED +# define YY_YY_SQLITE3_LOCATION_H_INCLUDED + +# include // std::max +# include +# include + +# 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 + +#line 10 "sqlite3_parser.yy" +namespace sqlb { namespace parser { +#line 60 "sqlite3_location.h" + + /// A point in a source file. + class position + { + public: + /// Construct a position. + explicit position (std::string* f = YY_NULLPTR, + unsigned l = 1u, + unsigned c = 1u) + : filename (f) + , line (l) + , column (c) + {} + + + /// Initialization. + void initialize (std::string* fn = YY_NULLPTR, + unsigned l = 1u, + unsigned c = 1u) + { + filename = fn; + line = l; + column = c; + } + + /** \name Line and Column related manipulators + ** \{ */ + /// (line related) Advance to the COUNT next lines. + void lines (int count = 1) + { + if (count) + { + column = 1u; + line = add_ (line, count, 1); + } + } + + /// (column related) Advance to the COUNT next columns. + void columns (int count = 1) + { + column = add_ (column, count, 1); + } + /** \} */ + + /// File name to which this position refers. + std::string* filename; + /// Current line number. + unsigned line; + /// Current column number. + unsigned column; + + private: + /// Compute max (min, lhs+rhs). + static unsigned add_ (unsigned lhs, int rhs, int min) + { + return static_cast (std::max (min, + static_cast (lhs) + rhs)); + } + }; + + /// Add \a width columns, in place. + inline position& + operator+= (position& res, int width) + { + res.columns (width); + return res; + } + + /// Add \a width columns. + inline position + operator+ (position res, int width) + { + return res += width; + } + + /// Subtract \a width columns, in place. + inline position& + operator-= (position& res, int width) + { + return res += -width; + } + + /// Subtract \a width columns. + inline position + operator- (position res, int width) + { + return res -= width; + } + + /// Compare two position objects. + inline bool + operator== (const position& pos1, const position& pos2) + { + return (pos1.line == pos2.line + && pos1.column == pos2.column + && (pos1.filename == pos2.filename + || (pos1.filename && pos2.filename + && *pos1.filename == *pos2.filename))); + } + + /// Compare two position objects. + inline bool + operator!= (const position& pos1, const position& pos2) + { + return !(pos1 == pos2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + template + std::basic_ostream& + operator<< (std::basic_ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + + /// Two points in a source file. + class location + { + public: + + /// Construct a location from \a b to \a e. + location (const position& b, const position& e) + : begin (b) + , end (e) + {} + + /// Construct a 0-width location in \a p. + explicit location (const position& p = position ()) + : begin (p) + , end (p) + {} + + /// Construct a 0-width location in \a f, \a l, \a c. + explicit location (std::string* f, + unsigned l = 1u, + unsigned c = 1u) + : begin (f, l, c) + , end (f, l, c) + {} + + + /// Initialization. + void initialize (std::string* f = YY_NULLPTR, + unsigned l = 1u, + unsigned c = 1u) + { + begin.initialize (f, l, c); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + void columns (int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + void lines (int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two locations, in place. + inline location& operator+= (location& res, const location& end) + { + res.end = end.end; + return res; + } + + /// Join two locations. + inline location operator+ (location res, const location& end) + { + return res += end; + } + + /// Add \a width columns to the end position, in place. + inline location& operator+= (location& res, int width) + { + res.columns (width); + return res; + } + + /// Add \a width columns to the end position. + inline location operator+ (location res, int width) + { + return res += width; + } + + /// Subtract \a width columns to the end position, in place. + inline location& operator-= (location& res, int width) + { + return res += -width; + } + + /// Subtract \a width columns to the end position. + inline location operator- (location res, int width) + { + return res -= width; + } + + /// Compare two location objects. + inline bool + operator== (const location& loc1, const location& loc2) + { + return loc1.begin == loc2.begin && loc1.end == loc2.end; + } + + /// Compare two location objects. + inline bool + operator!= (const location& loc1, const location& loc2) + { + return !(loc1 == loc2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + template + std::basic_ostream& + operator<< (std::basic_ostream& ostr, const location& loc) + { + unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; + ostr << loc.begin; + if (loc.end.filename + && (!loc.begin.filename + || *loc.begin.filename != *loc.end.filename)) + ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col; + else if (loc.begin.line < loc.end.line) + ostr << '-' << loc.end.line << '.' << end_col; + else if (loc.begin.column < end_col) + ostr << '-' << end_col; + return ostr; + } + +#line 10 "sqlite3_parser.yy" +} } // sqlb::parser +#line 323 "sqlite3_location.h" + +#endif // !YY_YY_SQLITE3_LOCATION_H_INCLUDED diff --git a/src/sql/parser/sqlite3_parser.cpp b/src/sql/parser/sqlite3_parser.cpp new file mode 100644 index 00000000..3380fe96 --- /dev/null +++ b/src/sql/parser/sqlite3_parser.cpp @@ -0,0 +1,4388 @@ +// A Bison parser, made by GNU Bison 3.4.1. + +// Skeleton implementation for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015, 2018-2019 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. + + + + + +#include "sqlite3_parser.hpp" + + +// Unqualified %code blocks. +#line 85 "sqlite3_parser.yy" + + #include "ParserDriver.h" + + static std::string unquote_text(std::string str, char quote_char) + { + if(str.front() != quote_char || str.back() != quote_char) + return str; + + str = str.substr(1, str.size()-2); + + std::string quote(2, quote_char); + + size_t pos = 0; + while((pos = str.find(quote, pos)) != std::string::npos) + { + str.erase(pos, 1); + pos += 1; // Don't remove the other quote char too + } + return str; + } + +#line 67 "sqlite3_parser.cpp" + + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include // FIXME: INFRINGES ON USER NAME SPACE. +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +// Whether we are compiled with exception support. +#ifndef YY_EXCEPTIONS +# if defined __GNUC__ && !defined __EXCEPTIONS +# define YY_EXCEPTIONS 0 +# else +# define YY_EXCEPTIONS 1 +# endif +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +# ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).begin = YYRHSLOC (Rhs, 1).begin; \ + (Current).end = YYRHSLOC (Rhs, N).end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ + } \ + while (false) +# endif + + +// Suppress unused-variable warnings by "using" E. +#define YYUSE(E) ((void) (E)) + +// Enable debugging if requested. +#if YYDEBUG + +// A pseudo ostream that takes yydebug_ into account. +# define YYCDEBUG if (yydebug_) (*yycdebug_) + +# define YY_SYMBOL_PRINT(Title, Symbol) \ + do { \ + if (yydebug_) \ + { \ + *yycdebug_ << Title << ' '; \ + yy_print_ (*yycdebug_, Symbol); \ + *yycdebug_ << '\n'; \ + } \ + } while (false) + +# define YY_REDUCE_PRINT(Rule) \ + do { \ + if (yydebug_) \ + yy_reduce_print_ (Rule); \ + } while (false) + +# define YY_STACK_PRINT() \ + do { \ + if (yydebug_) \ + yystack_print_ (); \ + } while (false) + +#else // !YYDEBUG + +# define YYCDEBUG if (false) std::cerr +# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol) +# define YY_REDUCE_PRINT(Rule) static_cast (0) +# define YY_STACK_PRINT() static_cast (0) + +#endif // !YYDEBUG + +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yyla.clear ()) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) + +#line 10 "sqlite3_parser.yy" +namespace sqlb { namespace parser { +#line 162 "sqlite3_parser.cpp" + + + /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + std::string + parser::yytnamerr_ (const char *yystr) + { + if (*yystr == '"') + { + std::string yyr; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + else + goto append; + + append: + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; + } + + + /// Build a parser object. + parser::parser (yyscan_t yyscanner_yyarg, ParserDriver& drv_yyarg) + : +#if YYDEBUG + yydebug_ (false), + yycdebug_ (&std::cerr), +#endif + yyscanner (yyscanner_yyarg), + drv (drv_yyarg) + {} + + parser::~parser () + {} + + parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW + {} + + /*---------------. + | Symbol types. | + `---------------*/ + + + + // by_state. + parser::by_state::by_state () YY_NOEXCEPT + : state (empty_state) + {} + + parser::by_state::by_state (const by_state& that) YY_NOEXCEPT + : state (that.state) + {} + + void + parser::by_state::clear () YY_NOEXCEPT + { + state = empty_state; + } + + void + parser::by_state::move (by_state& that) + { + state = that.state; + that.clear (); + } + + parser::by_state::by_state (state_type s) YY_NOEXCEPT + : state (s) + {} + + parser::symbol_number_type + parser::by_state::type_get () const YY_NOEXCEPT + { + if (state == empty_state) + return empty_symbol; + else + return yystos_[state]; + } + + parser::stack_symbol_type::stack_symbol_type () + {} + + parser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that) + : super_type (YY_MOVE (that.state), YY_MOVE (that.location)) + { + switch (that.type_get ()) + { + case 153: // columnconstraint + value.YY_MOVE_OR_COPY< ColumnConstraintInfo > (YY_MOVE (that.value)); + break; + + case 154: // columnconstraint_list + value.YY_MOVE_OR_COPY< ColumnConstraintInfoVector > (YY_MOVE (that.value)); + break; + + case 155: // columndef + value.YY_MOVE_OR_COPY< ColumndefData > (YY_MOVE (that.value)); + break; + + case 139: // optional_if_not_exists + case 141: // optional_unique + case 149: // optional_temporary + case 150: // optional_withoutrowid + value.YY_MOVE_OR_COPY< bool > (YY_MOVE (that.value)); + break; + + case 163: // tableconstraint + value.YY_MOVE_OR_COPY< sqlb::ConstraintPtr > (YY_MOVE (that.value)); + break; + + case 164: // tableconstraint_list + case 165: // optional_tableconstraint_list + value.YY_MOVE_OR_COPY< sqlb::ConstraintSet > (YY_MOVE (that.value)); + break; + + case 146: // createindex_stmt + value.YY_MOVE_OR_COPY< sqlb::IndexPtr > (YY_MOVE (that.value)); + break; + + case 144: // indexed_column + value.YY_MOVE_OR_COPY< sqlb::IndexedColumn > (YY_MOVE (that.value)); + break; + + case 145: // indexed_column_list + value.YY_MOVE_OR_COPY< sqlb::IndexedColumnVector > (YY_MOVE (that.value)); + break; + + case 158: // columnid_list + case 159: // optional_columnid_with_paren_list + value.YY_MOVE_OR_COPY< sqlb::StringVector > (YY_MOVE (that.value)); + break; + + case 148: // createvirtualtable_stmt + case 166: // createtable_stmt + value.YY_MOVE_OR_COPY< sqlb::TablePtr > (YY_MOVE (that.value)); + break; + + case 27: // "ABORT" + case 28: // "ACTION" + case 29: // "AND" + case 30: // "AND BETWEEN" + case 31: // "AS" + case 32: // "ASC" + case 33: // "AUTOINCREMENT" + case 34: // "BETWEEN" + case 35: // "CASCADE" + case 36: // "CASE" + case 37: // "CAST" + case 38: // "CHECK" + case 39: // "COLLATE" + case 40: // "CONFLICT" + case 41: // "CONSTRAINT" + case 42: // "CREATE" + case 43: // "CURRENT_DATE" + case 44: // "CURRENT_TIME" + case 45: // "CURRENT_TIMESTAMP" + case 46: // "DEFAULT" + case 47: // "DEFERRABLE" + case 48: // "DEFERRED" + case 49: // "DELETE" + case 50: // "DESC" + case 51: // "DISTINCT" + case 52: // "ELSE" + case 53: // "END" + case 54: // "ESCAPE" + case 55: // "EXISTS" + case 56: // "FAIL" + case 57: // "FALSE" + case 58: // "FILTER" + case 59: // "FOLLOWING" + case 60: // "FOREIGN" + case 61: // "GLOB" + case 62: // "IF" + case 63: // "IGNORE" + case 64: // "IMMEDIATE" + case 65: // "IN" + case 66: // "INDEX" + case 67: // "INITIALLY" + case 68: // "INSERT" + case 69: // "IS" + case 70: // "ISNULL" + case 71: // "KEY" + case 72: // "LIKE" + case 73: // "MATCH" + case 74: // "NO" + case 75: // "NOT" + case 76: // "NOTNULL" + case 77: // "NULL" + case 78: // "ON" + case 79: // "OR" + case 80: // "OVER" + case 81: // "PARTITION" + case 82: // "PRECEDING" + case 83: // "PRIMARY" + case 84: // "RAISE" + case 85: // "RANGE" + case 86: // "REFERENCES" + case 87: // "REGEXP" + case 88: // "REPLACE" + case 89: // "RESTRICT" + case 90: // "ROLLBACK" + case 91: // "ROWID" + case 92: // "ROWS" + case 93: // "SELECT" + case 94: // "SET" + case 95: // "TABLE" + case 96: // "TEMP" + case 97: // "TEMPORARY" + case 98: // "THEN" + case 99: // "TRUE" + case 100: // "UNBOUNDED" + case 101: // "UNIQUE" + case 102: // "UPDATE" + case 103: // "USING" + case 104: // "VIRTUAL" + case 105: // "WHEN" + case 106: // "WHERE" + case 107: // "WITHOUT" + case 108: // "identifier" + case 109: // "numeric" + case 110: // "string literal" + case 111: // "quoted literal" + case 112: // "blob literal" + case 113: // "bind parameter" + case 117: // literalvalue + case 118: // id + case 119: // allowed_keywords_as_identifier + case 120: // tableid + case 121: // columnid + case 122: // signednumber + case 123: // signednumber_or_numeric + case 124: // typename_namelist + case 125: // type_name + case 126: // unary_expr + case 127: // binary_expr + case 128: // like_expr + case 129: // exprlist_expr + case 130: // function_expr + case 131: // isnull_expr + case 132: // between_expr + case 133: // in_expr + case 134: // whenthenlist_expr + case 135: // case_expr + case 136: // raise_expr + case 137: // expr + case 138: // select_stmt + case 140: // optional_sort_order + case 142: // optional_where + case 143: // tableid_with_uninteresting_schema + case 147: // optional_exprlist_with_paren + case 151: // optional_conflictclause + case 152: // optional_typename + case 157: // optional_constraintname + case 160: // fk_clause_part + case 161: // fk_clause_part_list + case 162: // optional_fk_clause + value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value)); + break; + + case 156: // columndef_list + value.YY_MOVE_OR_COPY< std::vector > (YY_MOVE (that.value)); + break; + + default: + break; + } + +#if 201103L <= YY_CPLUSPLUS + // that is emptied. + that.state = empty_state; +#endif + } + + parser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that) + : super_type (s, YY_MOVE (that.location)) + { + switch (that.type_get ()) + { + case 153: // columnconstraint + value.move< ColumnConstraintInfo > (YY_MOVE (that.value)); + break; + + case 154: // columnconstraint_list + value.move< ColumnConstraintInfoVector > (YY_MOVE (that.value)); + break; + + case 155: // columndef + value.move< ColumndefData > (YY_MOVE (that.value)); + break; + + case 139: // optional_if_not_exists + case 141: // optional_unique + case 149: // optional_temporary + case 150: // optional_withoutrowid + value.move< bool > (YY_MOVE (that.value)); + break; + + case 163: // tableconstraint + value.move< sqlb::ConstraintPtr > (YY_MOVE (that.value)); + break; + + case 164: // tableconstraint_list + case 165: // optional_tableconstraint_list + value.move< sqlb::ConstraintSet > (YY_MOVE (that.value)); + break; + + case 146: // createindex_stmt + value.move< sqlb::IndexPtr > (YY_MOVE (that.value)); + break; + + case 144: // indexed_column + value.move< sqlb::IndexedColumn > (YY_MOVE (that.value)); + break; + + case 145: // indexed_column_list + value.move< sqlb::IndexedColumnVector > (YY_MOVE (that.value)); + break; + + case 158: // columnid_list + case 159: // optional_columnid_with_paren_list + value.move< sqlb::StringVector > (YY_MOVE (that.value)); + break; + + case 148: // createvirtualtable_stmt + case 166: // createtable_stmt + value.move< sqlb::TablePtr > (YY_MOVE (that.value)); + break; + + case 27: // "ABORT" + case 28: // "ACTION" + case 29: // "AND" + case 30: // "AND BETWEEN" + case 31: // "AS" + case 32: // "ASC" + case 33: // "AUTOINCREMENT" + case 34: // "BETWEEN" + case 35: // "CASCADE" + case 36: // "CASE" + case 37: // "CAST" + case 38: // "CHECK" + case 39: // "COLLATE" + case 40: // "CONFLICT" + case 41: // "CONSTRAINT" + case 42: // "CREATE" + case 43: // "CURRENT_DATE" + case 44: // "CURRENT_TIME" + case 45: // "CURRENT_TIMESTAMP" + case 46: // "DEFAULT" + case 47: // "DEFERRABLE" + case 48: // "DEFERRED" + case 49: // "DELETE" + case 50: // "DESC" + case 51: // "DISTINCT" + case 52: // "ELSE" + case 53: // "END" + case 54: // "ESCAPE" + case 55: // "EXISTS" + case 56: // "FAIL" + case 57: // "FALSE" + case 58: // "FILTER" + case 59: // "FOLLOWING" + case 60: // "FOREIGN" + case 61: // "GLOB" + case 62: // "IF" + case 63: // "IGNORE" + case 64: // "IMMEDIATE" + case 65: // "IN" + case 66: // "INDEX" + case 67: // "INITIALLY" + case 68: // "INSERT" + case 69: // "IS" + case 70: // "ISNULL" + case 71: // "KEY" + case 72: // "LIKE" + case 73: // "MATCH" + case 74: // "NO" + case 75: // "NOT" + case 76: // "NOTNULL" + case 77: // "NULL" + case 78: // "ON" + case 79: // "OR" + case 80: // "OVER" + case 81: // "PARTITION" + case 82: // "PRECEDING" + case 83: // "PRIMARY" + case 84: // "RAISE" + case 85: // "RANGE" + case 86: // "REFERENCES" + case 87: // "REGEXP" + case 88: // "REPLACE" + case 89: // "RESTRICT" + case 90: // "ROLLBACK" + case 91: // "ROWID" + case 92: // "ROWS" + case 93: // "SELECT" + case 94: // "SET" + case 95: // "TABLE" + case 96: // "TEMP" + case 97: // "TEMPORARY" + case 98: // "THEN" + case 99: // "TRUE" + case 100: // "UNBOUNDED" + case 101: // "UNIQUE" + case 102: // "UPDATE" + case 103: // "USING" + case 104: // "VIRTUAL" + case 105: // "WHEN" + case 106: // "WHERE" + case 107: // "WITHOUT" + case 108: // "identifier" + case 109: // "numeric" + case 110: // "string literal" + case 111: // "quoted literal" + case 112: // "blob literal" + case 113: // "bind parameter" + case 117: // literalvalue + case 118: // id + case 119: // allowed_keywords_as_identifier + case 120: // tableid + case 121: // columnid + case 122: // signednumber + case 123: // signednumber_or_numeric + case 124: // typename_namelist + case 125: // type_name + case 126: // unary_expr + case 127: // binary_expr + case 128: // like_expr + case 129: // exprlist_expr + case 130: // function_expr + case 131: // isnull_expr + case 132: // between_expr + case 133: // in_expr + case 134: // whenthenlist_expr + case 135: // case_expr + case 136: // raise_expr + case 137: // expr + case 138: // select_stmt + case 140: // optional_sort_order + case 142: // optional_where + case 143: // tableid_with_uninteresting_schema + case 147: // optional_exprlist_with_paren + case 151: // optional_conflictclause + case 152: // optional_typename + case 157: // optional_constraintname + case 160: // fk_clause_part + case 161: // fk_clause_part_list + case 162: // optional_fk_clause + value.move< std::string > (YY_MOVE (that.value)); + break; + + case 156: // columndef_list + value.move< std::vector > (YY_MOVE (that.value)); + break; + + default: + break; + } + + // that is emptied. + that.type = empty_symbol; + } + +#if YY_CPLUSPLUS < 201103L + parser::stack_symbol_type& + parser::stack_symbol_type::operator= (stack_symbol_type& that) + { + state = that.state; + switch (that.type_get ()) + { + case 153: // columnconstraint + value.move< ColumnConstraintInfo > (that.value); + break; + + case 154: // columnconstraint_list + value.move< ColumnConstraintInfoVector > (that.value); + break; + + case 155: // columndef + value.move< ColumndefData > (that.value); + break; + + case 139: // optional_if_not_exists + case 141: // optional_unique + case 149: // optional_temporary + case 150: // optional_withoutrowid + value.move< bool > (that.value); + break; + + case 163: // tableconstraint + value.move< sqlb::ConstraintPtr > (that.value); + break; + + case 164: // tableconstraint_list + case 165: // optional_tableconstraint_list + value.move< sqlb::ConstraintSet > (that.value); + break; + + case 146: // createindex_stmt + value.move< sqlb::IndexPtr > (that.value); + break; + + case 144: // indexed_column + value.move< sqlb::IndexedColumn > (that.value); + break; + + case 145: // indexed_column_list + value.move< sqlb::IndexedColumnVector > (that.value); + break; + + case 158: // columnid_list + case 159: // optional_columnid_with_paren_list + value.move< sqlb::StringVector > (that.value); + break; + + case 148: // createvirtualtable_stmt + case 166: // createtable_stmt + value.move< sqlb::TablePtr > (that.value); + break; + + case 27: // "ABORT" + case 28: // "ACTION" + case 29: // "AND" + case 30: // "AND BETWEEN" + case 31: // "AS" + case 32: // "ASC" + case 33: // "AUTOINCREMENT" + case 34: // "BETWEEN" + case 35: // "CASCADE" + case 36: // "CASE" + case 37: // "CAST" + case 38: // "CHECK" + case 39: // "COLLATE" + case 40: // "CONFLICT" + case 41: // "CONSTRAINT" + case 42: // "CREATE" + case 43: // "CURRENT_DATE" + case 44: // "CURRENT_TIME" + case 45: // "CURRENT_TIMESTAMP" + case 46: // "DEFAULT" + case 47: // "DEFERRABLE" + case 48: // "DEFERRED" + case 49: // "DELETE" + case 50: // "DESC" + case 51: // "DISTINCT" + case 52: // "ELSE" + case 53: // "END" + case 54: // "ESCAPE" + case 55: // "EXISTS" + case 56: // "FAIL" + case 57: // "FALSE" + case 58: // "FILTER" + case 59: // "FOLLOWING" + case 60: // "FOREIGN" + case 61: // "GLOB" + case 62: // "IF" + case 63: // "IGNORE" + case 64: // "IMMEDIATE" + case 65: // "IN" + case 66: // "INDEX" + case 67: // "INITIALLY" + case 68: // "INSERT" + case 69: // "IS" + case 70: // "ISNULL" + case 71: // "KEY" + case 72: // "LIKE" + case 73: // "MATCH" + case 74: // "NO" + case 75: // "NOT" + case 76: // "NOTNULL" + case 77: // "NULL" + case 78: // "ON" + case 79: // "OR" + case 80: // "OVER" + case 81: // "PARTITION" + case 82: // "PRECEDING" + case 83: // "PRIMARY" + case 84: // "RAISE" + case 85: // "RANGE" + case 86: // "REFERENCES" + case 87: // "REGEXP" + case 88: // "REPLACE" + case 89: // "RESTRICT" + case 90: // "ROLLBACK" + case 91: // "ROWID" + case 92: // "ROWS" + case 93: // "SELECT" + case 94: // "SET" + case 95: // "TABLE" + case 96: // "TEMP" + case 97: // "TEMPORARY" + case 98: // "THEN" + case 99: // "TRUE" + case 100: // "UNBOUNDED" + case 101: // "UNIQUE" + case 102: // "UPDATE" + case 103: // "USING" + case 104: // "VIRTUAL" + case 105: // "WHEN" + case 106: // "WHERE" + case 107: // "WITHOUT" + case 108: // "identifier" + case 109: // "numeric" + case 110: // "string literal" + case 111: // "quoted literal" + case 112: // "blob literal" + case 113: // "bind parameter" + case 117: // literalvalue + case 118: // id + case 119: // allowed_keywords_as_identifier + case 120: // tableid + case 121: // columnid + case 122: // signednumber + case 123: // signednumber_or_numeric + case 124: // typename_namelist + case 125: // type_name + case 126: // unary_expr + case 127: // binary_expr + case 128: // like_expr + case 129: // exprlist_expr + case 130: // function_expr + case 131: // isnull_expr + case 132: // between_expr + case 133: // in_expr + case 134: // whenthenlist_expr + case 135: // case_expr + case 136: // raise_expr + case 137: // expr + case 138: // select_stmt + case 140: // optional_sort_order + case 142: // optional_where + case 143: // tableid_with_uninteresting_schema + case 147: // optional_exprlist_with_paren + case 151: // optional_conflictclause + case 152: // optional_typename + case 157: // optional_constraintname + case 160: // fk_clause_part + case 161: // fk_clause_part_list + case 162: // optional_fk_clause + value.move< std::string > (that.value); + break; + + case 156: // columndef_list + value.move< std::vector > (that.value); + break; + + default: + break; + } + + location = that.location; + // that is emptied. + that.state = empty_state; + return *this; + } +#endif + + template + void + parser::yy_destroy_ (const char* yymsg, basic_symbol& yysym) const + { + if (yymsg) + YY_SYMBOL_PRINT (yymsg, yysym); + } + +#if YYDEBUG + template + void + parser::yy_print_ (std::ostream& yyo, + const basic_symbol& yysym) const + { + std::ostream& yyoutput = yyo; + YYUSE (yyoutput); + symbol_number_type yytype = yysym.type_get (); +#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408 + // Avoid a (spurious) G++ 4.8 warning about "array subscript is + // below array bounds". + if (yysym.empty ()) + std::abort (); +#endif + yyo << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << yysym.location << ": "; + YYUSE (yytype); + yyo << ')'; + } +#endif + + void + parser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym) + { + if (m) + YY_SYMBOL_PRINT (m, sym); + yystack_.push (YY_MOVE (sym)); + } + + void + parser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym) + { +#if 201103L <= YY_CPLUSPLUS + yypush_ (m, stack_symbol_type (s, std::move (sym))); +#else + stack_symbol_type ss (s, sym); + yypush_ (m, ss); +#endif + } + + void + parser::yypop_ (int n) + { + yystack_.pop (n); + } + +#if YYDEBUG + std::ostream& + parser::debug_stream () const + { + return *yycdebug_; + } + + void + parser::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + parser::debug_level_type + parser::debug_level () const + { + return yydebug_; + } + + void + parser::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } +#endif // YYDEBUG + + parser::state_type + parser::yy_lr_goto_state_ (state_type yystate, int yysym) + { + int yyr = yypgoto_[yysym - yyntokens_] + yystate; + if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) + return yytable_[yyr]; + else + return yydefgoto_[yysym - yyntokens_]; + } + + bool + parser::yy_pact_value_is_default_ (int yyvalue) + { + return yyvalue == yypact_ninf_; + } + + bool + parser::yy_table_value_is_error_ (int yyvalue) + { + return yyvalue == yytable_ninf_; + } + + int + parser::operator() () + { + return parse (); + } + + int + parser::parse () + { + // State. + int yyn; + /// Length of the RHS of the rule being reduced. + int yylen = 0; + + // Error handling. + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// The lookahead symbol. + symbol_type yyla; + + /// The locations where the error started and ended. + stack_symbol_type yyerror_range[3]; + + /// The return value of parse (). + int yyresult; + +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + YYCDEBUG << "Starting parse\n"; + + + /* Initialize the stack. The initial state will be set in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystack_.clear (); + yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla)); + + /*-----------------------------------------------. + | yynewstate -- push a new symbol on the stack. | + `-----------------------------------------------*/ + yynewstate: + YYCDEBUG << "Entering state " << yystack_[0].state << '\n'; + + // Accept? + if (yystack_[0].state == yyfinal_) + YYACCEPT; + + goto yybackup; + + + /*-----------. + | yybackup. | + `-----------*/ + yybackup: + // Try to take a decision without lookahead. + yyn = yypact_[yystack_[0].state]; + if (yy_pact_value_is_default_ (yyn)) + goto yydefault; + + // Read a lookahead token. + if (yyla.empty ()) + { + YYCDEBUG << "Reading a token: "; +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + symbol_type yylookahead (yylex (yyscanner, drv)); + yyla.move (yylookahead); + } +#if YY_EXCEPTIONS + catch (const syntax_error& yyexc) + { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; + error (yyexc); + goto yyerrlab1; + } +#endif // YY_EXCEPTIONS + } + YY_SYMBOL_PRINT ("Next token is", yyla); + + /* If the proper action on seeing token YYLA.TYPE is to reduce or + to detect an error, take that action. */ + yyn += yyla.type_get (); + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ()) + goto yydefault; + + // Reduce or error. + yyn = yytable_[yyn]; + if (yyn <= 0) + { + if (yy_table_value_is_error_ (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + // Count tokens shifted since error; after three, turn off error status. + if (yyerrstatus_) + --yyerrstatus_; + + // Shift the lookahead token. + yypush_ ("Shifting", yyn, YY_MOVE (yyla)); + goto yynewstate; + + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[yystack_[0].state]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + + /*-----------------------------. + | yyreduce -- do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + { + stack_symbol_type yylhs; + yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]); + /* Variants are always initialized to an empty instance of the + correct type. The default '$$ = $1' action is NOT applied + when using variants. */ + switch (yyr1_[yyn]) + { + case 153: // columnconstraint + yylhs.value.emplace< ColumnConstraintInfo > (); + break; + + case 154: // columnconstraint_list + yylhs.value.emplace< ColumnConstraintInfoVector > (); + break; + + case 155: // columndef + yylhs.value.emplace< ColumndefData > (); + break; + + case 139: // optional_if_not_exists + case 141: // optional_unique + case 149: // optional_temporary + case 150: // optional_withoutrowid + yylhs.value.emplace< bool > (); + break; + + case 163: // tableconstraint + yylhs.value.emplace< sqlb::ConstraintPtr > (); + break; + + case 164: // tableconstraint_list + case 165: // optional_tableconstraint_list + yylhs.value.emplace< sqlb::ConstraintSet > (); + break; + + case 146: // createindex_stmt + yylhs.value.emplace< sqlb::IndexPtr > (); + break; + + case 144: // indexed_column + yylhs.value.emplace< sqlb::IndexedColumn > (); + break; + + case 145: // indexed_column_list + yylhs.value.emplace< sqlb::IndexedColumnVector > (); + break; + + case 158: // columnid_list + case 159: // optional_columnid_with_paren_list + yylhs.value.emplace< sqlb::StringVector > (); + break; + + case 148: // createvirtualtable_stmt + case 166: // createtable_stmt + yylhs.value.emplace< sqlb::TablePtr > (); + break; + + case 27: // "ABORT" + case 28: // "ACTION" + case 29: // "AND" + case 30: // "AND BETWEEN" + case 31: // "AS" + case 32: // "ASC" + case 33: // "AUTOINCREMENT" + case 34: // "BETWEEN" + case 35: // "CASCADE" + case 36: // "CASE" + case 37: // "CAST" + case 38: // "CHECK" + case 39: // "COLLATE" + case 40: // "CONFLICT" + case 41: // "CONSTRAINT" + case 42: // "CREATE" + case 43: // "CURRENT_DATE" + case 44: // "CURRENT_TIME" + case 45: // "CURRENT_TIMESTAMP" + case 46: // "DEFAULT" + case 47: // "DEFERRABLE" + case 48: // "DEFERRED" + case 49: // "DELETE" + case 50: // "DESC" + case 51: // "DISTINCT" + case 52: // "ELSE" + case 53: // "END" + case 54: // "ESCAPE" + case 55: // "EXISTS" + case 56: // "FAIL" + case 57: // "FALSE" + case 58: // "FILTER" + case 59: // "FOLLOWING" + case 60: // "FOREIGN" + case 61: // "GLOB" + case 62: // "IF" + case 63: // "IGNORE" + case 64: // "IMMEDIATE" + case 65: // "IN" + case 66: // "INDEX" + case 67: // "INITIALLY" + case 68: // "INSERT" + case 69: // "IS" + case 70: // "ISNULL" + case 71: // "KEY" + case 72: // "LIKE" + case 73: // "MATCH" + case 74: // "NO" + case 75: // "NOT" + case 76: // "NOTNULL" + case 77: // "NULL" + case 78: // "ON" + case 79: // "OR" + case 80: // "OVER" + case 81: // "PARTITION" + case 82: // "PRECEDING" + case 83: // "PRIMARY" + case 84: // "RAISE" + case 85: // "RANGE" + case 86: // "REFERENCES" + case 87: // "REGEXP" + case 88: // "REPLACE" + case 89: // "RESTRICT" + case 90: // "ROLLBACK" + case 91: // "ROWID" + case 92: // "ROWS" + case 93: // "SELECT" + case 94: // "SET" + case 95: // "TABLE" + case 96: // "TEMP" + case 97: // "TEMPORARY" + case 98: // "THEN" + case 99: // "TRUE" + case 100: // "UNBOUNDED" + case 101: // "UNIQUE" + case 102: // "UPDATE" + case 103: // "USING" + case 104: // "VIRTUAL" + case 105: // "WHEN" + case 106: // "WHERE" + case 107: // "WITHOUT" + case 108: // "identifier" + case 109: // "numeric" + case 110: // "string literal" + case 111: // "quoted literal" + case 112: // "blob literal" + case 113: // "bind parameter" + case 117: // literalvalue + case 118: // id + case 119: // allowed_keywords_as_identifier + case 120: // tableid + case 121: // columnid + case 122: // signednumber + case 123: // signednumber_or_numeric + case 124: // typename_namelist + case 125: // type_name + case 126: // unary_expr + case 127: // binary_expr + case 128: // like_expr + case 129: // exprlist_expr + case 130: // function_expr + case 131: // isnull_expr + case 132: // between_expr + case 133: // in_expr + case 134: // whenthenlist_expr + case 135: // case_expr + case 136: // raise_expr + case 137: // expr + case 138: // select_stmt + case 140: // optional_sort_order + case 142: // optional_where + case 143: // tableid_with_uninteresting_schema + case 147: // optional_exprlist_with_paren + case 151: // optional_conflictclause + case 152: // optional_typename + case 157: // optional_constraintname + case 160: // fk_clause_part + case 161: // fk_clause_part_list + case 162: // optional_fk_clause + yylhs.value.emplace< std::string > (); + break; + + case 156: // columndef_list + yylhs.value.emplace< std::vector > (); + break; + + default: + break; + } + + + // Default location. + { + stack_type::slice range (yystack_, yylen); + YYLLOC_DEFAULT (yylhs.location, range, yylen); + yyerror_range[1].location = yylhs.location; + } + + // Perform the reduction. + YY_REDUCE_PRINT (yyn); +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + switch (yyn) + { + case 4: +#line 306 "sqlite3_parser.yy" + { drv.result = yystack_[0].value.as < sqlb::IndexPtr > (); } +#line 1278 "sqlite3_parser.cpp" + break; + + case 5: +#line 307 "sqlite3_parser.yy" + { drv.result = yystack_[0].value.as < sqlb::TablePtr > (); } +#line 1284 "sqlite3_parser.cpp" + break; + + case 6: +#line 308 "sqlite3_parser.yy" + { drv.result = yystack_[0].value.as < sqlb::TablePtr > (); } +#line 1290 "sqlite3_parser.cpp" + break; + + case 7: +#line 316 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1296 "sqlite3_parser.cpp" + break; + + case 8: +#line 317 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1302 "sqlite3_parser.cpp" + break; + + case 9: +#line 318 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1308 "sqlite3_parser.cpp" + break; + + case 10: +#line 319 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1314 "sqlite3_parser.cpp" + break; + + case 11: +#line 320 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1320 "sqlite3_parser.cpp" + break; + + case 12: +#line 321 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1326 "sqlite3_parser.cpp" + break; + + case 13: +#line 322 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1332 "sqlite3_parser.cpp" + break; + + case 14: +#line 323 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1338 "sqlite3_parser.cpp" + break; + + case 15: +#line 324 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1344 "sqlite3_parser.cpp" + break; + + case 16: +#line 328 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1350 "sqlite3_parser.cpp" + break; + + case 17: +#line 329 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1356 "sqlite3_parser.cpp" + break; + + case 18: +#line 334 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1362 "sqlite3_parser.cpp" + break; + + case 19: +#line 335 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1368 "sqlite3_parser.cpp" + break; + + case 20: +#line 336 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1374 "sqlite3_parser.cpp" + break; + + case 21: +#line 337 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1380 "sqlite3_parser.cpp" + break; + + case 22: +#line 338 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1386 "sqlite3_parser.cpp" + break; + + case 23: +#line 339 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1392 "sqlite3_parser.cpp" + break; + + case 24: +#line 340 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1398 "sqlite3_parser.cpp" + break; + + case 25: +#line 341 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1404 "sqlite3_parser.cpp" + break; + + case 26: +#line 342 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1410 "sqlite3_parser.cpp" + break; + + case 27: +#line 343 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1416 "sqlite3_parser.cpp" + break; + + case 28: +#line 344 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1422 "sqlite3_parser.cpp" + break; + + case 29: +#line 345 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1428 "sqlite3_parser.cpp" + break; + + case 30: +#line 346 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1434 "sqlite3_parser.cpp" + break; + + case 31: +#line 347 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1440 "sqlite3_parser.cpp" + break; + + case 32: +#line 348 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1446 "sqlite3_parser.cpp" + break; + + case 33: +#line 349 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1452 "sqlite3_parser.cpp" + break; + + case 34: +#line 350 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1458 "sqlite3_parser.cpp" + break; + + case 35: +#line 351 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1464 "sqlite3_parser.cpp" + break; + + case 36: +#line 352 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1470 "sqlite3_parser.cpp" + break; + + case 37: +#line 353 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1476 "sqlite3_parser.cpp" + break; + + case 38: +#line 354 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1482 "sqlite3_parser.cpp" + break; + + case 39: +#line 355 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1488 "sqlite3_parser.cpp" + break; + + case 40: +#line 356 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1494 "sqlite3_parser.cpp" + break; + + case 41: +#line 357 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1500 "sqlite3_parser.cpp" + break; + + case 42: +#line 358 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1506 "sqlite3_parser.cpp" + break; + + case 43: +#line 359 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1512 "sqlite3_parser.cpp" + break; + + case 44: +#line 360 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1518 "sqlite3_parser.cpp" + break; + + case 45: +#line 361 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1524 "sqlite3_parser.cpp" + break; + + case 46: +#line 362 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1530 "sqlite3_parser.cpp" + break; + + case 47: +#line 363 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1536 "sqlite3_parser.cpp" + break; + + case 48: +#line 364 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1542 "sqlite3_parser.cpp" + break; + + case 49: +#line 365 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1548 "sqlite3_parser.cpp" + break; + + case 50: +#line 366 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1554 "sqlite3_parser.cpp" + break; + + case 51: +#line 367 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1560 "sqlite3_parser.cpp" + break; + + case 52: +#line 368 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1566 "sqlite3_parser.cpp" + break; + + case 53: +#line 369 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1572 "sqlite3_parser.cpp" + break; + + case 54: +#line 373 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1578 "sqlite3_parser.cpp" + break; + + case 55: +#line 374 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1584 "sqlite3_parser.cpp" + break; + + case 56: +#line 375 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1590 "sqlite3_parser.cpp" + break; + + case 57: +#line 376 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1596 "sqlite3_parser.cpp" + break; + + case 58: +#line 377 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1602 "sqlite3_parser.cpp" + break; + + case 59: +#line 378 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = unquote_text(yystack_[0].value.as < std::string > (), '\''); } +#line 1608 "sqlite3_parser.cpp" + break; + + case 60: +#line 382 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1614 "sqlite3_parser.cpp" + break; + + case 61: +#line 383 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1620 "sqlite3_parser.cpp" + break; + + case 62: +#line 384 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1626 "sqlite3_parser.cpp" + break; + + case 63: +#line 385 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1632 "sqlite3_parser.cpp" + break; + + case 64: +#line 386 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1638 "sqlite3_parser.cpp" + break; + + case 65: +#line 387 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1644 "sqlite3_parser.cpp" + break; + + case 66: +#line 388 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = unquote_text(yystack_[0].value.as < std::string > (), '\''); } +#line 1650 "sqlite3_parser.cpp" + break; + + case 67: +#line 392 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "+" + yystack_[0].value.as < std::string > (); } +#line 1656 "sqlite3_parser.cpp" + break; + + case 68: +#line 393 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "-" + yystack_[0].value.as < std::string > (); } +#line 1662 "sqlite3_parser.cpp" + break; + + case 69: +#line 397 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1668 "sqlite3_parser.cpp" + break; + + case 70: +#line 398 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1674 "sqlite3_parser.cpp" + break; + + case 71: +#line 402 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1680 "sqlite3_parser.cpp" + break; + + case 72: +#line 403 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 1686 "sqlite3_parser.cpp" + break; + + case 73: +#line 407 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1692 "sqlite3_parser.cpp" + break; + + case 74: +#line 408 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + "(" + yystack_[1].value.as < std::string > () + ")"; } +#line 1698 "sqlite3_parser.cpp" + break; + + case 75: +#line 409 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + "(" + yystack_[3].value.as < std::string > () + ", " + yystack_[1].value.as < std::string > () + ")"; } +#line 1704 "sqlite3_parser.cpp" + break; + + case 76: +#line 413 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "-" + yystack_[0].value.as < std::string > (); } +#line 1710 "sqlite3_parser.cpp" + break; + + case 77: +#line 414 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "+" + yystack_[0].value.as < std::string > (); } +#line 1716 "sqlite3_parser.cpp" + break; + + case 78: +#line 415 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "~" + yystack_[0].value.as < std::string > (); } +#line 1722 "sqlite3_parser.cpp" + break; + + case 79: +#line 416 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "NOT " + yystack_[0].value.as < std::string > (); } +#line 1728 "sqlite3_parser.cpp" + break; + + case 80: +#line 420 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " || " + yystack_[0].value.as < std::string > (); } +#line 1734 "sqlite3_parser.cpp" + break; + + case 81: +#line 421 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " * " + yystack_[0].value.as < std::string > (); } +#line 1740 "sqlite3_parser.cpp" + break; + + case 82: +#line 422 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " / " + yystack_[0].value.as < std::string > (); } +#line 1746 "sqlite3_parser.cpp" + break; + + case 83: +#line 423 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " % " + yystack_[0].value.as < std::string > (); } +#line 1752 "sqlite3_parser.cpp" + break; + + case 84: +#line 424 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " + " + yystack_[0].value.as < std::string > (); } +#line 1758 "sqlite3_parser.cpp" + break; + + case 85: +#line 425 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " - " + yystack_[0].value.as < std::string > (); } +#line 1764 "sqlite3_parser.cpp" + break; + + case 86: +#line 426 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " << " + yystack_[0].value.as < std::string > (); } +#line 1770 "sqlite3_parser.cpp" + break; + + case 87: +#line 427 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " >> " + yystack_[0].value.as < std::string > (); } +#line 1776 "sqlite3_parser.cpp" + break; + + case 88: +#line 428 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " & " + yystack_[0].value.as < std::string > (); } +#line 1782 "sqlite3_parser.cpp" + break; + + case 89: +#line 429 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " | " + yystack_[0].value.as < std::string > (); } +#line 1788 "sqlite3_parser.cpp" + break; + + case 90: +#line 430 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " < " + yystack_[0].value.as < std::string > (); } +#line 1794 "sqlite3_parser.cpp" + break; + + case 91: +#line 431 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " <= " + yystack_[0].value.as < std::string > (); } +#line 1800 "sqlite3_parser.cpp" + break; + + case 92: +#line 432 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " > " + yystack_[0].value.as < std::string > (); } +#line 1806 "sqlite3_parser.cpp" + break; + + case 93: +#line 433 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " >= " + yystack_[0].value.as < std::string > (); } +#line 1812 "sqlite3_parser.cpp" + break; + + case 94: +#line 434 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " = " + yystack_[0].value.as < std::string > (); } +#line 1818 "sqlite3_parser.cpp" + break; + + case 95: +#line 435 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " == " + yystack_[0].value.as < std::string > (); } +#line 1824 "sqlite3_parser.cpp" + break; + + case 96: +#line 436 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " != " + yystack_[0].value.as < std::string > (); } +#line 1830 "sqlite3_parser.cpp" + break; + + case 97: +#line 437 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " <> " + yystack_[0].value.as < std::string > (); } +#line 1836 "sqlite3_parser.cpp" + break; + + case 98: +#line 438 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " IS " + yystack_[0].value.as < std::string > (); } +#line 1842 "sqlite3_parser.cpp" + break; + + case 99: +#line 439 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " AND " + yystack_[0].value.as < std::string > (); } +#line 1848 "sqlite3_parser.cpp" + break; + + case 100: +#line 440 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " OR " + yystack_[0].value.as < std::string > (); } +#line 1854 "sqlite3_parser.cpp" + break; + + case 101: +#line 444 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " LIKE " + yystack_[0].value.as < std::string > (); } +#line 1860 "sqlite3_parser.cpp" + break; + + case 102: +#line 445 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " GLOB " + yystack_[0].value.as < std::string > (); } +#line 1866 "sqlite3_parser.cpp" + break; + + case 103: +#line 446 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " MATCH " + yystack_[0].value.as < std::string > (); } +#line 1872 "sqlite3_parser.cpp" + break; + + case 104: +#line 447 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " REGEXP " + yystack_[0].value.as < std::string > (); } +#line 1878 "sqlite3_parser.cpp" + break; + + case 105: +#line 448 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " NOT LIKE " + yystack_[0].value.as < std::string > (); } +#line 1884 "sqlite3_parser.cpp" + break; + + case 106: +#line 449 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " NOT GLOB " + yystack_[0].value.as < std::string > (); } +#line 1890 "sqlite3_parser.cpp" + break; + + case 107: +#line 450 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " NOT MATCH " + yystack_[0].value.as < std::string > (); } +#line 1896 "sqlite3_parser.cpp" + break; + + case 108: +#line 451 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " NOT REGEXP " + yystack_[0].value.as < std::string > (); } +#line 1902 "sqlite3_parser.cpp" + break; + + case 109: +#line 452 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " LIKE " + yystack_[2].value.as < std::string > () + " ESCAPE " + yystack_[0].value.as < std::string > (); } +#line 1908 "sqlite3_parser.cpp" + break; + + case 110: +#line 453 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " GLOB " + yystack_[2].value.as < std::string > () + " ESCAPE " + yystack_[0].value.as < std::string > (); } +#line 1914 "sqlite3_parser.cpp" + break; + + case 111: +#line 454 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " MATCH " + yystack_[2].value.as < std::string > () + " ESCAPE " + yystack_[0].value.as < std::string > (); } +#line 1920 "sqlite3_parser.cpp" + break; + + case 112: +#line 455 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " REGEXP " + yystack_[2].value.as < std::string > () + " ESCAPE " + yystack_[0].value.as < std::string > (); } +#line 1926 "sqlite3_parser.cpp" + break; + + case 113: +#line 456 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " NOT LIKE " + yystack_[3].value.as < std::string > () + " ESCAPE " + yystack_[0].value.as < std::string > (); } +#line 1932 "sqlite3_parser.cpp" + break; + + case 114: +#line 457 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " NOT GLOB " + yystack_[3].value.as < std::string > () + " ESCAPE " + yystack_[0].value.as < std::string > (); } +#line 1938 "sqlite3_parser.cpp" + break; + + case 115: +#line 458 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " NOT MATCH " + yystack_[3].value.as < std::string > () + " ESCAPE " + yystack_[0].value.as < std::string > (); } +#line 1944 "sqlite3_parser.cpp" + break; + + case 116: +#line 459 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " NOT REGEXP " + yystack_[3].value.as < std::string > () + " ESCAPE " + yystack_[0].value.as < std::string > (); } +#line 1950 "sqlite3_parser.cpp" + break; + + case 117: +#line 463 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 1956 "sqlite3_parser.cpp" + break; + + case 118: +#line 464 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + ", " + yystack_[0].value.as < std::string > (); } +#line 1962 "sqlite3_parser.cpp" + break; + + case 119: +#line 468 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + "(" + yystack_[1].value.as < std::string > () + ")"; } +#line 1968 "sqlite3_parser.cpp" + break; + + case 120: +#line 469 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + "(DISTINCT " + yystack_[1].value.as < std::string > () + ")"; } +#line 1974 "sqlite3_parser.cpp" + break; + + case 121: +#line 470 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + "()"; } +#line 1980 "sqlite3_parser.cpp" + break; + + case 122: +#line 471 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + "(*)"; } +#line 1986 "sqlite3_parser.cpp" + break; + + case 123: +#line 475 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > () + " ISNULL"; } +#line 1992 "sqlite3_parser.cpp" + break; + + case 124: +#line 476 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > () + " NOTNULL"; } +#line 1998 "sqlite3_parser.cpp" + break; + + case 125: +#line 477 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " NOT NULL"; } +#line 2004 "sqlite3_parser.cpp" + break; + + case 126: +#line 481 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " BETWEEN " + yystack_[2].value.as < std::string > () + " AND " + yystack_[0].value.as < std::string > (); } +#line 2010 "sqlite3_parser.cpp" + break; + + case 127: +#line 482 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " NOT BETWEEN " + yystack_[2].value.as < std::string > () + " AND " + yystack_[0].value.as < std::string > (); } +#line 2016 "sqlite3_parser.cpp" + break; + + case 128: +#line 486 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " IN ()"; } +#line 2022 "sqlite3_parser.cpp" + break; + + case 129: +#line 487 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " IN (" + yystack_[1].value.as < std::string > () + ")"; } +#line 2028 "sqlite3_parser.cpp" + break; + + case 130: +#line 488 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " IN (" + yystack_[1].value.as < std::string > () + ")"; } +#line 2034 "sqlite3_parser.cpp" + break; + + case 131: +#line 489 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " IN " + sqlb::escapeIdentifier(yystack_[2].value.as < std::string > ()) + "." + sqlb::escapeIdentifier(yystack_[0].value.as < std::string > ()); } +#line 2040 "sqlite3_parser.cpp" + break; + + case 132: +#line 490 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " IN " + sqlb::escapeIdentifier(yystack_[0].value.as < std::string > ()); } +#line 2046 "sqlite3_parser.cpp" + break; + + case 133: +#line 491 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[6].value.as < std::string > () + " IN " + sqlb::escapeIdentifier(yystack_[4].value.as < std::string > ()) + "." + yystack_[2].value.as < std::string > () + "()"; } +#line 2052 "sqlite3_parser.cpp" + break; + + case 134: +#line 492 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[7].value.as < std::string > () + " IN " + sqlb::escapeIdentifier(yystack_[5].value.as < std::string > ()) + "." + yystack_[3].value.as < std::string > () + "(" + yystack_[1].value.as < std::string > () + ")"; } +#line 2058 "sqlite3_parser.cpp" + break; + + case 135: +#line 493 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " IN " + yystack_[3].value.as < std::string > () + "(" + yystack_[1].value.as < std::string > () + ")"; } +#line 2064 "sqlite3_parser.cpp" + break; + + case 136: +#line 494 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " NOT IN ()"; } +#line 2070 "sqlite3_parser.cpp" + break; + + case 137: +#line 495 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " NOT IN (" + yystack_[1].value.as < std::string > () + ")"; } +#line 2076 "sqlite3_parser.cpp" + break; + + case 138: +#line 496 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " NOT IN (" + yystack_[1].value.as < std::string > () + ")"; } +#line 2082 "sqlite3_parser.cpp" + break; + + case 139: +#line 497 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[5].value.as < std::string > () + " NOT IN " + sqlb::escapeIdentifier(yystack_[2].value.as < std::string > ()) + "." + sqlb::escapeIdentifier(yystack_[0].value.as < std::string > ()); } +#line 2088 "sqlite3_parser.cpp" + break; + + case 140: +#line 498 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " NOT IN " + sqlb::escapeIdentifier(yystack_[0].value.as < std::string > ()); } +#line 2094 "sqlite3_parser.cpp" + break; + + case 141: +#line 499 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[7].value.as < std::string > () + " NOT IN " + sqlb::escapeIdentifier(yystack_[4].value.as < std::string > ()) + "." + yystack_[2].value.as < std::string > () + "()"; } +#line 2100 "sqlite3_parser.cpp" + break; + + case 142: +#line 500 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[8].value.as < std::string > () + " NOT IN " + sqlb::escapeIdentifier(yystack_[5].value.as < std::string > ()) + "." + yystack_[3].value.as < std::string > () + "(" + yystack_[1].value.as < std::string > () + ")"; } +#line 2106 "sqlite3_parser.cpp" + break; + + case 143: +#line 501 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[6].value.as < std::string > () + " NOT IN " + yystack_[3].value.as < std::string > () + "(" + yystack_[1].value.as < std::string > () + ")"; } +#line 2112 "sqlite3_parser.cpp" + break; + + case 144: +#line 505 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "WHEN " + yystack_[2].value.as < std::string > () + " THEN " + yystack_[0].value.as < std::string > (); } +#line 2118 "sqlite3_parser.cpp" + break; + + case 145: +#line 506 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " WHEN" + yystack_[2].value.as < std::string > () + " THEN " + yystack_[0].value.as < std::string > (); } +#line 2124 "sqlite3_parser.cpp" + break; + + case 146: +#line 510 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "CASE " + yystack_[4].value.as < std::string > () + " " + yystack_[3].value.as < std::string > () + " ELSE " + yystack_[1].value.as < std::string > () + " END"; } +#line 2130 "sqlite3_parser.cpp" + break; + + case 147: +#line 511 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "CASE " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " END"; } +#line 2136 "sqlite3_parser.cpp" + break; + + case 148: +#line 512 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "CASE " + yystack_[3].value.as < std::string > () + " ELSE " + yystack_[1].value.as < std::string > () + " END"; } +#line 2142 "sqlite3_parser.cpp" + break; + + case 149: +#line 513 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "CASE " + yystack_[1].value.as < std::string > () + " END"; } +#line 2148 "sqlite3_parser.cpp" + break; + + case 150: +#line 517 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "RAISE(IGNORE)"; } +#line 2154 "sqlite3_parser.cpp" + break; + + case 151: +#line 518 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "RAISE(ROLLBACK, " + yystack_[1].value.as < std::string > () + ")"; } +#line 2160 "sqlite3_parser.cpp" + break; + + case 152: +#line 519 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "RAISE(ABORT, " + yystack_[1].value.as < std::string > () + ")"; } +#line 2166 "sqlite3_parser.cpp" + break; + + case 153: +#line 520 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "RAISE(FAIL, " + yystack_[1].value.as < std::string > () + ")"; } +#line 2172 "sqlite3_parser.cpp" + break; + + case 154: +#line 524 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2178 "sqlite3_parser.cpp" + break; + + case 155: +#line 525 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = sqlb::escapeIdentifier(yystack_[0].value.as < std::string > ()); } +#line 2184 "sqlite3_parser.cpp" + break; + + case 156: +#line 526 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2190 "sqlite3_parser.cpp" + break; + + case 157: +#line 527 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = sqlb::escapeIdentifier(yystack_[4].value.as < std::string > ()) + "." + sqlb::escapeIdentifier(yystack_[2].value.as < std::string > ()) + "." + sqlb::escapeIdentifier(yystack_[0].value.as < std::string > ()); } +#line 2196 "sqlite3_parser.cpp" + break; + + case 158: +#line 528 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = sqlb::escapeIdentifier(yystack_[2].value.as < std::string > ()) + "." + sqlb::escapeIdentifier(yystack_[0].value.as < std::string > ()); } +#line 2202 "sqlite3_parser.cpp" + break; + + case 159: +#line 529 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = sqlb::escapeIdentifier(yystack_[0].value.as < std::string > ()); } +#line 2208 "sqlite3_parser.cpp" + break; + + case 160: +#line 530 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2214 "sqlite3_parser.cpp" + break; + + case 161: +#line 531 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2220 "sqlite3_parser.cpp" + break; + + case 162: +#line 532 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2226 "sqlite3_parser.cpp" + break; + + case 163: +#line 533 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "(" + yystack_[1].value.as < std::string > () + ")"; } +#line 2232 "sqlite3_parser.cpp" + break; + + case 164: +#line 534 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "CAST(" + yystack_[3].value.as < std::string > () + " AS " + yystack_[1].value.as < std::string > () + ")"; } +#line 2238 "sqlite3_parser.cpp" + break; + + case 165: +#line 535 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " COLLATE " + yystack_[0].value.as < std::string > (); } +#line 2244 "sqlite3_parser.cpp" + break; + + case 166: +#line 536 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2250 "sqlite3_parser.cpp" + break; + + case 167: +#line 537 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2256 "sqlite3_parser.cpp" + break; + + case 168: +#line 538 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2262 "sqlite3_parser.cpp" + break; + + case 169: +#line 539 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2268 "sqlite3_parser.cpp" + break; + + case 170: +#line 540 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2274 "sqlite3_parser.cpp" + break; + + case 171: +#line 541 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2280 "sqlite3_parser.cpp" + break; + + case 172: +#line 550 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "SELECT"; } +#line 2286 "sqlite3_parser.cpp" + break; + + case 173: +#line 558 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = false; } +#line 2292 "sqlite3_parser.cpp" + break; + + case 174: +#line 559 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = true; } +#line 2298 "sqlite3_parser.cpp" + break; + + case 175: +#line 563 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = ""; } +#line 2304 "sqlite3_parser.cpp" + break; + + case 176: +#line 564 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "ASC"; } +#line 2310 "sqlite3_parser.cpp" + break; + + case 177: +#line 565 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = "DESC"; } +#line 2316 "sqlite3_parser.cpp" + break; + + case 178: +#line 573 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = false; } +#line 2322 "sqlite3_parser.cpp" + break; + + case 179: +#line 574 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = true; } +#line 2328 "sqlite3_parser.cpp" + break; + + case 180: +#line 578 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = ""; } +#line 2334 "sqlite3_parser.cpp" + break; + + case 181: +#line 579 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2340 "sqlite3_parser.cpp" + break; + + case 182: +#line 583 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2346 "sqlite3_parser.cpp" + break; + + case 183: +#line 584 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2352 "sqlite3_parser.cpp" + break; + + case 184: +#line 585 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2358 "sqlite3_parser.cpp" + break; + + case 185: +#line 589 "sqlite3_parser.yy" + { + // If the expression is only one column name and nothing else, treat it as a column name; otherwise as an expression. + char quote = getIdentifierQuoteChar(); + if((quote == '[' && std::count(yystack_[1].value.as < std::string > ().begin(), yystack_[1].value.as < std::string > ().end(), quote) == 1 && yystack_[1].value.as < std::string > ().front() == '[' && yystack_[1].value.as < std::string > ().back() == ']') || + (quote != '[' && std::count(yystack_[1].value.as < std::string > ().begin(), yystack_[1].value.as < std::string > ().end(), quote) == 2 && yystack_[1].value.as < std::string > ().front() == quote && yystack_[1].value.as < std::string > ().back() == quote)) + { + yylhs.value.as < sqlb::IndexedColumn > () = sqlb::IndexedColumn(unquote_text(yystack_[1].value.as < std::string > (), quote), false, yystack_[0].value.as < std::string > ()); + } else { + yylhs.value.as < sqlb::IndexedColumn > () = sqlb::IndexedColumn(yystack_[1].value.as < std::string > (), true, yystack_[0].value.as < std::string > ()); + } + } +#line 2374 "sqlite3_parser.cpp" + break; + + case 186: +#line 603 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::IndexedColumnVector > () = sqlb::IndexedColumnVector(1, yystack_[0].value.as < sqlb::IndexedColumn > ()); } +#line 2380 "sqlite3_parser.cpp" + break; + + case 187: +#line 604 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::IndexedColumnVector > () = yystack_[2].value.as < sqlb::IndexedColumnVector > (); yylhs.value.as < sqlb::IndexedColumnVector > ().push_back(yystack_[0].value.as < sqlb::IndexedColumn > ()); } +#line 2386 "sqlite3_parser.cpp" + break; + + case 188: +#line 608 "sqlite3_parser.yy" + { + yylhs.value.as < sqlb::IndexPtr > () = sqlb::IndexPtr(new sqlb::Index(yystack_[6].value.as < std::string > ())); + yylhs.value.as < sqlb::IndexPtr > ()->setTable(yystack_[4].value.as < std::string > ()); + yylhs.value.as < sqlb::IndexPtr > ()->setUnique(yystack_[9].value.as < bool > ()); + yylhs.value.as < sqlb::IndexPtr > ()->setWhereExpr(yystack_[0].value.as < std::string > ()); + yylhs.value.as < sqlb::IndexPtr > ()->fields = yystack_[2].value.as < sqlb::IndexedColumnVector > (); + yylhs.value.as < sqlb::IndexPtr > ()->setFullyParsed(true); + } +#line 2399 "sqlite3_parser.cpp" + break; + + case 189: +#line 623 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = {}; } +#line 2405 "sqlite3_parser.cpp" + break; + + case 190: +#line 624 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = {}; } +#line 2411 "sqlite3_parser.cpp" + break; + + case 191: +#line 625 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > (); } +#line 2417 "sqlite3_parser.cpp" + break; + + case 192: +#line 629 "sqlite3_parser.yy" + { + yylhs.value.as < sqlb::TablePtr > () = sqlb::TablePtr(new sqlb::Table(yystack_[3].value.as < std::string > ())); + yylhs.value.as < sqlb::TablePtr > ()->setVirtualUsing(yystack_[1].value.as < std::string > ()); + yylhs.value.as < sqlb::TablePtr > ()->setFullyParsed(false); + } +#line 2427 "sqlite3_parser.cpp" + break; + + case 193: +#line 641 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = false; } +#line 2433 "sqlite3_parser.cpp" + break; + + case 194: +#line 642 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = true; } +#line 2439 "sqlite3_parser.cpp" + break; + + case 195: +#line 643 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = true; } +#line 2445 "sqlite3_parser.cpp" + break; + + case 196: +#line 647 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = false; } +#line 2451 "sqlite3_parser.cpp" + break; + + case 197: +#line 648 "sqlite3_parser.yy" + { yylhs.value.as < bool > () = true; } +#line 2457 "sqlite3_parser.cpp" + break; + + case 198: +#line 652 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = ""; } +#line 2463 "sqlite3_parser.cpp" + break; + + case 199: +#line 653 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2469 "sqlite3_parser.cpp" + break; + + case 200: +#line 654 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2475 "sqlite3_parser.cpp" + break; + + case 201: +#line 655 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2481 "sqlite3_parser.cpp" + break; + + case 202: +#line 656 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2487 "sqlite3_parser.cpp" + break; + + case 203: +#line 657 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2493 "sqlite3_parser.cpp" + break; + + case 204: +#line 661 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = ""; } +#line 2499 "sqlite3_parser.cpp" + break; + + case 205: +#line 662 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2505 "sqlite3_parser.cpp" + break; + + case 206: +#line 666 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::PrimaryKey; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = true; + sqlb::PrimaryKeyConstraint* pk = new sqlb::PrimaryKeyConstraint({sqlb::IndexedColumn("", false, yystack_[1].value.as < std::string > ())}); + pk->setName(yystack_[4].value.as < std::string > ()); + pk->setConflictAction(yystack_[0].value.as < std::string > ()); + yylhs.value.as < ColumnConstraintInfo > ().table_constraint = sqlb::ConstraintPtr(pk); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = true; + } +#line 2519 "sqlite3_parser.cpp" + break; + + case 207: +#line 675 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::PrimaryKey; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = true; + sqlb::PrimaryKeyConstraint* pk = new sqlb::PrimaryKeyConstraint({sqlb::IndexedColumn("", false, yystack_[2].value.as < std::string > ())}); + pk->setName(yystack_[5].value.as < std::string > ()); + pk->setConflictAction(yystack_[1].value.as < std::string > ()); + pk->setAutoIncrement(true); + yylhs.value.as < ColumnConstraintInfo > ().table_constraint = sqlb::ConstraintPtr(pk); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = true; + } +#line 2534 "sqlite3_parser.cpp" + break; + + case 208: +#line 685 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::NotNull; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[3].value.as < std::string > () == "" && yystack_[0].value.as < std::string > () == ""); + } +#line 2544 "sqlite3_parser.cpp" + break; + + case 209: +#line 690 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::None; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = true; + } +#line 2554 "sqlite3_parser.cpp" + break; + + case 210: +#line 695 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Unique; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[2].value.as < std::string > () == "" && yystack_[0].value.as < std::string > () == ""); + } +#line 2564 "sqlite3_parser.cpp" + break; + + case 211: +#line 700 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Check; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().text = yystack_[1].value.as < std::string > (); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[4].value.as < std::string > () == ""); + } +#line 2575 "sqlite3_parser.cpp" + break; + + case 212: +#line 706 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Default; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().text = yystack_[0].value.as < std::string > (); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[2].value.as < std::string > () == ""); + } +#line 2586 "sqlite3_parser.cpp" + break; + + case 213: +#line 712 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Default; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().text = yystack_[0].value.as < std::string > (); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[2].value.as < std::string > () == ""); + } +#line 2597 "sqlite3_parser.cpp" + break; + + case 214: +#line 718 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Default; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().text = yystack_[0].value.as < std::string > (); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[2].value.as < std::string > () == ""); + } +#line 2608 "sqlite3_parser.cpp" + break; + + case 215: +#line 724 "sqlite3_parser.yy" + { // We must allow the same keywords as unquoted default values as in the columnid context. + // But we do not use columnid here in order to avoid reduce/reduce conflicts. + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Default; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().text = yystack_[0].value.as < std::string > (); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[2].value.as < std::string > () == ""); + } +#line 2620 "sqlite3_parser.cpp" + break; + + case 216: +#line 731 "sqlite3_parser.yy" + { // Same as above. + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Default; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().text = yystack_[0].value.as < std::string > (); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[2].value.as < std::string > () == ""); + } +#line 2631 "sqlite3_parser.cpp" + break; + + case 217: +#line 737 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Default; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().text = "(" + yystack_[1].value.as < std::string > () + ")"; + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[4].value.as < std::string > () == ""); + } +#line 2642 "sqlite3_parser.cpp" + break; + + case 218: +#line 743 "sqlite3_parser.yy" + { + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::Collate; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = false; + yylhs.value.as < ColumnConstraintInfo > ().text = yystack_[0].value.as < std::string > (); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = (yystack_[2].value.as < std::string > () == ""); + } +#line 2653 "sqlite3_parser.cpp" + break; + + case 219: +#line 749 "sqlite3_parser.yy" + { // TODO Solve shift/reduce conflict. It is not super important though as shifting seems to be right here. + yylhs.value.as < ColumnConstraintInfo > ().type = ColumnConstraintInfo::ForeignKey; + yylhs.value.as < ColumnConstraintInfo > ().is_table_constraint = true; + sqlb::ForeignKeyClause* fk = new sqlb::ForeignKeyClause(); + fk->setName(yystack_[4].value.as < std::string > ()); + fk->setTable(yystack_[2].value.as < std::string > ()); + fk->setColumns(yystack_[1].value.as < sqlb::StringVector > ()); + fk->setConstraint(yystack_[0].value.as < std::string > ()); + yylhs.value.as < ColumnConstraintInfo > ().table_constraint = sqlb::ConstraintPtr(fk); + yylhs.value.as < ColumnConstraintInfo > ().fully_parsed = true; + } +#line 2669 "sqlite3_parser.cpp" + break; + + case 220: +#line 763 "sqlite3_parser.yy" + { yylhs.value.as < ColumnConstraintInfoVector > () = { yystack_[0].value.as < ColumnConstraintInfo > () }; } +#line 2675 "sqlite3_parser.cpp" + break; + + case 221: +#line 764 "sqlite3_parser.yy" + { yylhs.value.as < ColumnConstraintInfoVector > () = yystack_[1].value.as < ColumnConstraintInfoVector > (); yylhs.value.as < ColumnConstraintInfoVector > ().push_back(yystack_[0].value.as < ColumnConstraintInfo > ()); } +#line 2681 "sqlite3_parser.cpp" + break; + + case 222: +#line 768 "sqlite3_parser.yy" + { + sqlb::Field f(yystack_[2].value.as < std::string > (), yystack_[1].value.as < std::string > ()); + bool fully_parsed = true; + sqlb::ConstraintSet table_constraints{}; + for(auto c : yystack_[0].value.as < ColumnConstraintInfoVector > ()) + { + if(c.fully_parsed == false) + fully_parsed = false; + + if(c.type == ColumnConstraintInfo::None) + continue; + + if(c.is_table_constraint) + { + if(c.table_constraint->columnList().empty()) + c.table_constraint->setColumnList({yystack_[2].value.as < std::string > ()}); + else + c.table_constraint->replaceInColumnList("", yystack_[2].value.as < std::string > ()); + table_constraints.insert(c.table_constraint); + } else { + if(c.type == ColumnConstraintInfo::NotNull) { + f.setNotNull(true); + } else if(c.type == ColumnConstraintInfo::Unique) { + f.setUnique(true); + } else if(c.type == ColumnConstraintInfo::Check) { + f.setCheck(c.text); + } else if(c.type == ColumnConstraintInfo::Default) { + f.setDefaultValue(c.text); + } else if(c.type == ColumnConstraintInfo::Collate) { + f.setCollation(c.text); + } else { + fully_parsed = false; + } + } + } + + yylhs.value.as < ColumndefData > () = std::make_tuple(f, table_constraints, fully_parsed); + } +#line 2724 "sqlite3_parser.cpp" + break; + + case 223: +#line 806 "sqlite3_parser.yy" + { yylhs.value.as < ColumndefData > () = std::make_tuple(sqlb::Field(yystack_[1].value.as < std::string > (), yystack_[0].value.as < std::string > ()), sqlb::ConstraintSet{}, true); } +#line 2730 "sqlite3_parser.cpp" + break; + + case 224: +#line 810 "sqlite3_parser.yy" + { yylhs.value.as < std::vector > () = {yystack_[0].value.as < ColumndefData > ()}; } +#line 2736 "sqlite3_parser.cpp" + break; + + case 225: +#line 811 "sqlite3_parser.yy" + { yylhs.value.as < std::vector > () = yystack_[2].value.as < std::vector > (); yylhs.value.as < std::vector > ().push_back(yystack_[0].value.as < ColumndefData > ()); } +#line 2742 "sqlite3_parser.cpp" + break; + + case 226: +#line 815 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = ""; } +#line 2748 "sqlite3_parser.cpp" + break; + + case 227: +#line 816 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2754 "sqlite3_parser.cpp" + break; + + case 228: +#line 820 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::StringVector > () = sqlb::StringVector(1, yystack_[0].value.as < std::string > ()); } +#line 2760 "sqlite3_parser.cpp" + break; + + case 229: +#line 821 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::StringVector > () = yystack_[2].value.as < sqlb::StringVector > (); yylhs.value.as < sqlb::StringVector > ().push_back(yystack_[0].value.as < std::string > ()); } +#line 2766 "sqlite3_parser.cpp" + break; + + case 230: +#line 825 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::StringVector > () = sqlb::StringVector(); } +#line 2772 "sqlite3_parser.cpp" + break; + + case 231: +#line 826 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::StringVector > () = yystack_[1].value.as < sqlb::StringVector > (); } +#line 2778 "sqlite3_parser.cpp" + break; + + case 232: +#line 830 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2784 "sqlite3_parser.cpp" + break; + + case 233: +#line 831 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2790 "sqlite3_parser.cpp" + break; + + case 234: +#line 832 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2796 "sqlite3_parser.cpp" + break; + + case 235: +#line 833 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2802 "sqlite3_parser.cpp" + break; + + case 236: +#line 834 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2808 "sqlite3_parser.cpp" + break; + + case 237: +#line 835 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2814 "sqlite3_parser.cpp" + break; + + case 238: +#line 836 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2820 "sqlite3_parser.cpp" + break; + + case 239: +#line 837 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2826 "sqlite3_parser.cpp" + break; + + case 240: +#line 838 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2832 "sqlite3_parser.cpp" + break; + + case 241: +#line 839 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2838 "sqlite3_parser.cpp" + break; + + case 242: +#line 840 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2844 "sqlite3_parser.cpp" + break; + + case 243: +#line 841 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2850 "sqlite3_parser.cpp" + break; + + case 244: +#line 842 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2856 "sqlite3_parser.cpp" + break; + + case 245: +#line 843 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2862 "sqlite3_parser.cpp" + break; + + case 246: +#line 844 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2868 "sqlite3_parser.cpp" + break; + + case 247: +#line 845 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2874 "sqlite3_parser.cpp" + break; + + case 248: +#line 849 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2880 "sqlite3_parser.cpp" + break; + + case 249: +#line 850 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2886 "sqlite3_parser.cpp" + break; + + case 250: +#line 854 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = ""; } +#line 2892 "sqlite3_parser.cpp" + break; + + case 251: +#line 855 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2898 "sqlite3_parser.cpp" + break; + + case 252: +#line 856 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2904 "sqlite3_parser.cpp" + break; + + case 253: +#line 857 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2910 "sqlite3_parser.cpp" + break; + + case 254: +#line 858 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2916 "sqlite3_parser.cpp" + break; + + case 255: +#line 859 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " " + yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2922 "sqlite3_parser.cpp" + break; + + case 256: +#line 860 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[4].value.as < std::string > () + " " + yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2928 "sqlite3_parser.cpp" + break; + + case 257: +#line 861 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2934 "sqlite3_parser.cpp" + break; + + case 258: +#line 862 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2940 "sqlite3_parser.cpp" + break; + + case 259: +#line 863 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2946 "sqlite3_parser.cpp" + break; + + case 260: +#line 864 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[0].value.as < std::string > (); } +#line 2952 "sqlite3_parser.cpp" + break; + + case 261: +#line 865 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2958 "sqlite3_parser.cpp" + break; + + case 262: +#line 866 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[3].value.as < std::string > () + " " + yystack_[2].value.as < std::string > () + " " + yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2964 "sqlite3_parser.cpp" + break; + + case 263: +#line 867 "sqlite3_parser.yy" + { yylhs.value.as < std::string > () = yystack_[1].value.as < std::string > () + " " + yystack_[0].value.as < std::string > (); } +#line 2970 "sqlite3_parser.cpp" + break; + + case 264: +#line 871 "sqlite3_parser.yy" + { + sqlb::PrimaryKeyConstraint* pk = new sqlb::PrimaryKeyConstraint(yystack_[2].value.as < sqlb::IndexedColumnVector > ()); + pk->setName(yystack_[6].value.as < std::string > ()); + pk->setConflictAction(yystack_[0].value.as < std::string > ()); + yylhs.value.as < sqlb::ConstraintPtr > () = sqlb::ConstraintPtr(pk); + } +#line 2981 "sqlite3_parser.cpp" + break; + + case 265: +#line 877 "sqlite3_parser.yy" + { + sqlb::PrimaryKeyConstraint* pk = new sqlb::PrimaryKeyConstraint(yystack_[3].value.as < sqlb::IndexedColumnVector > ()); + pk->setName(yystack_[7].value.as < std::string > ()); + pk->setConflictAction(yystack_[0].value.as < std::string > ()); + pk->setAutoIncrement(true); + yylhs.value.as < sqlb::ConstraintPtr > () = sqlb::ConstraintPtr(pk); + } +#line 2993 "sqlite3_parser.cpp" + break; + + case 266: +#line 884 "sqlite3_parser.yy" + { + sqlb::UniqueConstraint* u = new sqlb::UniqueConstraint(yystack_[2].value.as < sqlb::IndexedColumnVector > ()); + u->setName(yystack_[5].value.as < std::string > ()); + u->setConflictAction(yystack_[0].value.as < std::string > ()); + yylhs.value.as < sqlb::ConstraintPtr > () = sqlb::ConstraintPtr(u); + } +#line 3004 "sqlite3_parser.cpp" + break; + + case 267: +#line 890 "sqlite3_parser.yy" + { + yylhs.value.as < sqlb::ConstraintPtr > () = sqlb::ConstraintPtr(new sqlb::CheckConstraint(yystack_[1].value.as < std::string > ())); + yylhs.value.as < sqlb::ConstraintPtr > ()->setName(yystack_[4].value.as < std::string > ()); + } +#line 3013 "sqlite3_parser.cpp" + break; + + case 268: +#line 894 "sqlite3_parser.yy" + { + yylhs.value.as < sqlb::ConstraintPtr > () = sqlb::ConstraintPtr(new sqlb::ForeignKeyClause(yystack_[2].value.as < std::string > (), yystack_[1].value.as < sqlb::StringVector > (), yystack_[0].value.as < std::string > ())); + yylhs.value.as < sqlb::ConstraintPtr > ()->setColumnList(yystack_[5].value.as < sqlb::StringVector > ()); + yylhs.value.as < sqlb::ConstraintPtr > ()->setName(yystack_[9].value.as < std::string > ()); + } +#line 3023 "sqlite3_parser.cpp" + break; + + case 269: +#line 902 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::ConstraintSet > () = {yystack_[0].value.as < sqlb::ConstraintPtr > ()}; } +#line 3029 "sqlite3_parser.cpp" + break; + + case 270: +#line 903 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::ConstraintSet > () = yystack_[2].value.as < sqlb::ConstraintSet > (); yylhs.value.as < sqlb::ConstraintSet > ().insert(yystack_[0].value.as < sqlb::ConstraintPtr > ()); } +#line 3035 "sqlite3_parser.cpp" + break; + + case 271: +#line 904 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::ConstraintSet > () = yystack_[1].value.as < sqlb::ConstraintSet > (); yylhs.value.as < sqlb::ConstraintSet > ().insert(yystack_[0].value.as < sqlb::ConstraintPtr > ()); } +#line 3041 "sqlite3_parser.cpp" + break; + + case 272: +#line 908 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::ConstraintSet > () = {}; } +#line 3047 "sqlite3_parser.cpp" + break; + + case 273: +#line 909 "sqlite3_parser.yy" + { yylhs.value.as < sqlb::ConstraintSet > () = yystack_[0].value.as < sqlb::ConstraintSet > (); } +#line 3053 "sqlite3_parser.cpp" + break; + + case 274: +#line 913 "sqlite3_parser.yy" + { + yylhs.value.as < sqlb::TablePtr > () = sqlb::TablePtr(new sqlb::Table(yystack_[2].value.as < std::string > ())); + yylhs.value.as < sqlb::TablePtr > ()->setFullyParsed(false); + } +#line 3062 "sqlite3_parser.cpp" + break; + + case 275: +#line 917 "sqlite3_parser.yy" + { + yylhs.value.as < sqlb::TablePtr > () = sqlb::TablePtr(new sqlb::Table(yystack_[5].value.as < std::string > ())); + yylhs.value.as < sqlb::TablePtr > ()->setWithoutRowidTable(yystack_[0].value.as < bool > ()); + yylhs.value.as < sqlb::TablePtr > ()->setConstraints(yystack_[2].value.as < sqlb::ConstraintSet > ()); + yylhs.value.as < sqlb::TablePtr > ()->setFullyParsed(true); + + for(const auto& column : yystack_[3].value.as < std::vector > ()) + { + sqlb::Field f; + sqlb::ConstraintSet c; + bool fully_parsed; + std::tie(f, c, fully_parsed) = column; + + if(fully_parsed == false) + yylhs.value.as < sqlb::TablePtr > ()->setFullyParsed(false); + yylhs.value.as < sqlb::TablePtr > ()->fields.push_back(f); + for(const auto& i : c) + yylhs.value.as < sqlb::TablePtr > ()->addConstraint(i); + } + } +#line 3087 "sqlite3_parser.cpp" + break; + + +#line 3091 "sqlite3_parser.cpp" + + default: + break; + } + } +#if YY_EXCEPTIONS + catch (const syntax_error& yyexc) + { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; + error (yyexc); + YYERROR; + } +#endif // YY_EXCEPTIONS + YY_SYMBOL_PRINT ("-> $$ =", yylhs); + yypop_ (yylen); + yylen = 0; + YY_STACK_PRINT (); + + // Shift the result of the reduction. + yypush_ (YY_NULLPTR, YY_MOVE (yylhs)); + } + goto yynewstate; + + + /*--------------------------------------. + | yyerrlab -- here on detecting error. | + `--------------------------------------*/ + yyerrlab: + // If not already recovering from an error, report this error. + if (!yyerrstatus_) + { + ++yynerrs_; + error (yyla.location, yysyntax_error_ (yystack_[0].state, yyla)); + } + + + yyerror_range[1].location = yyla.location; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + // Return failure if at end of input. + if (yyla.type_get () == yyeof_) + YYABORT; + else if (!yyla.empty ()) + { + yy_destroy_ ("Error: discarding", yyla); + yyla.clear (); + } + } + + // Else will try to reuse lookahead token after shifting the error token. + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and + the label yyerrorlab therefore never appears in user code. */ + if (false) + YYERROR; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + yypop_ (yylen); + yylen = 0; + goto yyerrlab1; + + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; // Each real token shifted decrements this. + { + stack_symbol_type error_token; + for (;;) + { + yyn = yypact_[yystack_[0].state]; + if (!yy_pact_value_is_default_ (yyn)) + { + yyn += 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 (yystack_.size () == 1) + YYABORT; + + yyerror_range[1].location = yystack_[0].location; + yy_destroy_ ("Error: popping", yystack_[0]); + yypop_ (); + YY_STACK_PRINT (); + } + + yyerror_range[2].location = yyla.location; + YYLLOC_DEFAULT (error_token.location, yyerror_range, 2); + + // Shift the error token. + error_token.state = yyn; + yypush_ ("Shifting", YY_MOVE (error_token)); + } + goto yynewstate; + + + /*-------------------------------------. + | yyacceptlab -- YYACCEPT comes here. | + `-------------------------------------*/ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + + /*-----------------------------------. + | yyabortlab -- YYABORT comes here. | + `-----------------------------------*/ + yyabortlab: + yyresult = 1; + goto yyreturn; + + + /*-----------------------------------------------------. + | yyreturn -- parsing is finished, return the result. | + `-----------------------------------------------------*/ + yyreturn: + if (!yyla.empty ()) + yy_destroy_ ("Cleanup: discarding lookahead", yyla); + + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + yypop_ (yylen); + while (1 < yystack_.size ()) + { + yy_destroy_ ("Cleanup: popping", yystack_[0]); + yypop_ (); + } + + return yyresult; + } +#if YY_EXCEPTIONS + catch (...) + { + YYCDEBUG << "Exception caught: cleaning lookahead and stack\n"; + // Do not try to display the values of the reclaimed symbols, + // as their printers might throw an exception. + if (!yyla.empty ()) + yy_destroy_ (YY_NULLPTR, yyla); + + while (1 < yystack_.size ()) + { + yy_destroy_ (YY_NULLPTR, yystack_[0]); + yypop_ (); + } + throw; + } +#endif // YY_EXCEPTIONS + } + + void + parser::error (const syntax_error& yyexc) + { + error (yyexc.location, yyexc.what ()); + } + + // Generate an error message. + std::string + parser::yysyntax_error_ (state_type yystate, const symbol_type& yyla) const + { + // Number of reported tokens (one for the "unexpected", one per + // "expected"). + size_t yycount = 0; + // Its maximum. + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + // Arguments of yyformat. + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yyla) is + if this state is a consistent state with a default action. + Thus, detecting the absence of a lookahead is sufficient to + determine that there is no unexpected or expected token to + report. In that case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is + a consistent state with a default action. There might have + been a previous inconsistent state, consistent state with a + non-default action, or user semantic action that manipulated + yyla. (However, yyla is currently not documented for users.) + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state + merging (from LALR or IELR) and default reductions corrupt the + expected token list. However, the list is correct for + canonical LR with one exception: it will still contain any + token that will not be accepted due to an error action in a + later state. + */ + if (!yyla.empty ()) + { + int yytoken = yyla.type_get (); + yyarg[yycount++] = yytname_[yytoken]; + int yyn = yypact_[yystate]; + if (!yy_pact_value_is_default_ (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + // Stay within bounds of both yycheck and yytname. + int yychecklim = yylast_ - yyn + 1; + int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_ + && !yy_table_value_is_error_ (yytable_[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + break; + } + else + yyarg[yycount++] = yytname_[yyx]; + } + } + } + + char const* yyformat = YY_NULLPTR; + switch (yycount) + { +#define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + default: // Avoid compiler warnings. + YYCASE_ (0, YY_("syntax error")); + YYCASE_ (1, YY_("syntax error, unexpected %s")); + YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +#undef YYCASE_ + } + + std::string yyres; + // Argument number. + size_t yyi = 0; + for (char const* yyp = yyformat; *yyp; ++yyp) + if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) + { + yyres += yytnamerr_ (yyarg[yyi++]); + ++yyp; + } + else + yyres += *yyp; + return yyres; + } + + + const short parser::yypact_ninf_ = -333; + + const short parser::yytable_ninf_ = -274; + + const short + parser::yypact_[] = + { + 1, 98, 51, 66, -333, -333, -333, -333, -333, -333, + 44, 10, 47, -333, -333, 96, 96, 96, 21, 2202, + 2202, 2202, 110, -333, -333, -333, -333, -333, -333, -333, + -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, + -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, + -333, -333, -333, -333, -333, -333, -333, 193, -333, -333, + -333, -333, -333, -333, -333, 205, -333, -333, 111, 143, + 32, -333, 2287, 2287, -20, 2287, 2117, 131, -333, -333, + -333, -333, 227, 228, -333, -333, -333, -333, -333, -333, + -333, 2287, -333, 230, -333, -333, 961, -333, 1405, -333, + 1606, -333, 25, 2032, 237, 1405, -333, 1405, 1405, 1405, + 1072, 239, -333, -333, -333, -333, 1405, -333, 257, -333, + -333, -333, -333, -333, -333, 27, -333, -333, -333, -333, + 126, -333, -333, -333, -333, -333, -333, 2997, 2547, -333, + 134, 5, -333, -20, -333, 30, 89, -333, -18, -333, + 34, 158, 180, -333, -333, -333, 1405, -35, 84, 1405, + 3104, 22, 628, -20, -333, 1405, 1405, 1405, 1405, 1405, + 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1405, + 1405, 1405, 1405, 1405, 1405, 1405, -20, 1405, 1696, 1405, + -333, 1405, 1405, 139, -333, 1405, 1405, -333, -333, -333, + 177, 1405, 176, 188, -333, -333, 181, -333, -333, 283, + -20, 1516, 225, -333, 232, 2287, 231, 298, 242, 243, + 305, 269, -333, 226, -333, -333, 1890, 1405, -333, 1405, + -31, 2622, 309, 310, 315, 314, -333, 317, 1405, 223, + 318, 2997, 241, 241, 9, 9, 209, 9, 209, 286, + 2574, 2574, 279, 279, 279, 279, 2574, 2574, 209, 209, + 3104, 2697, -333, 224, 739, 210, -333, 2574, 332, 391, + 1405, 1405, 1786, 1405, 1405, -333, 1405, 3072, 476, 1405, + -333, -333, -333, -333, -333, 5, 1405, -333, 1405, -333, + -333, -333, -333, -333, 231, -6, 319, 287, -333, 1405, + 323, 327, 1405, -333, -333, 1405, 2772, 1976, 1405, -333, + 2287, 221, 222, -333, 229, -333, 250, -333, -20, 1405, + 1405, -333, 255, 330, 1405, 2287, 1405, 1405, 2847, 1917, + 850, 261, -333, 2003, 2419, 2499, 1405, 2997, 331, 503, + 2392, -333, 231, 2117, -28, 92, 2472, 2117, 1405, 263, + 2997, -333, 1405, 2922, 334, 340, 345, 346, -333, -333, + 2574, 2574, -333, -333, 264, 333, -333, 2574, 2574, 1405, + 1405, -333, 267, 351, 1405, 2287, 1405, 1405, 1405, 2574, + -333, -333, -333, 326, -333, 270, 293, -20, 316, -22, + -333, 130, -333, -333, -333, -333, -333, -333, -333, 271, + 35, 231, 2997, -333, -333, -333, -333, -333, -333, 1183, + 2574, 2574, -333, -333, 275, 359, -333, 2574, 2574, 2574, + -333, -333, 2117, 67, -333, 297, 52, 87, 94, 299, + 320, -333, 284, 231, 361, -333, -333, 278, -333, 1294, + -333, -333, -333, 69, -333, 341, -333, -13, -333, 344, + -333, 70, -333, 347, -333, 74, 73, 306, 2287, -333, + 231, -333, -333, 294, -333, -333, -333, -333, -333, -333, + -333, -333, -333, -333, -333, -333, -333, 86, 319, -333, + -333, -333, -333, -28, -333 + }; + + const unsigned short + parser::yydefact_[] = + { + 0, 178, 0, 2, 4, 5, 6, 194, 195, 179, + 0, 0, 0, 1, 3, 173, 173, 173, 0, 0, + 0, 0, 0, 18, 19, 20, 21, 22, 23, 56, + 55, 57, 24, 25, 26, 27, 28, 29, 30, 33, + 35, 34, 31, 32, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 50, 49, 51, + 52, 53, 16, 59, 17, 58, 54, 184, 0, 0, + 0, 174, 0, 0, 0, 0, 0, 0, 50, 58, + 183, 182, 189, 0, 62, 61, 63, 64, 66, 65, + 60, 204, 224, 272, 172, 274, 0, 192, 0, 71, + 73, 205, 226, 226, 0, 0, 190, 0, 0, 0, + 0, 22, 14, 13, 15, 12, 0, 10, 41, 11, + 7, 8, 9, 156, 154, 159, 155, 160, 161, 166, + 0, 162, 167, 168, 169, 170, 171, 117, 175, 186, + 0, 0, 72, 0, 220, 226, 0, 225, 0, 269, + 226, 196, 0, 77, 76, 78, 0, 0, 0, 0, + 79, 0, 0, 0, 191, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 123, 0, 0, 0, 124, 0, 0, 176, 177, 185, + 180, 0, 0, 0, 70, 69, 0, 227, 221, 0, + 0, 0, 0, 209, 0, 0, 198, 0, 0, 0, + 0, 226, 271, 0, 275, 163, 0, 0, 149, 0, + 0, 0, 0, 0, 0, 0, 121, 0, 0, 0, + 158, 118, 84, 85, 81, 82, 88, 83, 89, 80, + 94, 95, 92, 93, 90, 91, 96, 97, 86, 87, + 99, 0, 165, 102, 0, 58, 132, 98, 101, 103, + 0, 0, 0, 0, 0, 125, 0, 100, 104, 0, + 188, 187, 67, 68, 74, 0, 0, 218, 0, 216, + 213, 214, 215, 212, 198, 175, 230, 0, 210, 0, + 0, 0, 0, 270, 197, 0, 0, 0, 0, 147, + 0, 0, 0, 150, 0, 122, 0, 119, 0, 0, + 0, 128, 0, 0, 0, 0, 0, 0, 0, 106, + 0, 58, 140, 105, 107, 108, 0, 181, 0, 0, + 0, 208, 198, 0, 250, 0, 0, 0, 0, 0, + 144, 148, 0, 0, 0, 0, 0, 0, 120, 157, + 126, 110, 130, 129, 0, 58, 131, 109, 111, 0, + 0, 136, 0, 0, 0, 0, 0, 0, 0, 112, + 75, 211, 217, 206, 228, 0, 260, 0, 0, 0, + 248, 251, 219, 200, 201, 202, 203, 199, 267, 0, + 0, 198, 145, 146, 164, 152, 153, 151, 135, 0, + 127, 114, 138, 137, 0, 58, 139, 113, 115, 116, + 207, 231, 0, 0, 247, 263, 0, 0, 0, 254, + 0, 249, 0, 198, 0, 266, 133, 0, 143, 0, + 229, 258, 259, 0, 234, 0, 235, 0, 244, 0, + 245, 0, 239, 0, 240, 0, 0, 257, 0, 264, + 198, 134, 141, 0, 261, 262, 236, 233, 232, 246, + 243, 242, 241, 238, 237, 252, 253, 0, 230, 265, + 142, 255, 256, 250, 268 + }; + + const short + parser::yypgoto_[] = + { + -333, -333, -333, 163, -19, -14, -63, -332, 165, 93, + -333, 71, -333, -333, -333, -102, -333, -333, -333, -333, + 219, -333, -333, 281, -248, 162, 85, -333, -333, 186, + 182, -279, -333, -333, -333, -333, -333, -290, -333, 240, + -333, 289, -333, -78, 37, -96, -4, -333, -90, -142, + -333, -333, -333 + }; + + const short + parser::yydefgoto_[] = + { + -1, 2, 3, 124, 125, 126, 67, 91, 205, 206, + 100, 101, 127, 128, 129, 130, 131, 132, 133, 134, + 157, 135, 136, 137, 95, 19, 199, 11, 280, 68, + 139, 140, 4, 97, 5, 12, 224, 298, 102, 144, + 145, 92, 93, 148, 385, 344, 390, 391, 392, 149, + 150, 104, 6 + }; + + const short + parser::yytable_[] = + { + 65, 65, 65, 152, 341, 66, 66, 66, 222, 80, + 81, 384, 83, 202, 203, 384, 323, 227, 228, 386, + 217, 308, 309, 349, 146, 173, 197, 426, 99, -223, + 162, -223, 163, 467, -222, 76, -222, 142, -273, 433, + 221, 201, 218, 1, 198, 387, 427, 388, 186, 232, + 389, 13, 383, 79, 79, 82, 79, 89, 66, 66, + 239, 66, 90, 77, 468, 219, 143, 146, 434, 400, + 229, 143, 79, 14, 229, 143, 16, 66, 233, 303, + 428, 79, 373, 220, 89, 234, 66, 444, 62, 90, + 440, 64, 166, 167, 168, 169, 22, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 435, 235, 184, 204, 441, 470, 464, 185, 393, + 473, 475, 448, 186, 207, 266, 445, 209, 210, 452, + 164, 442, 165, 465, 481, 211, 316, 476, 200, 15, + 201, 446, 17, 459, 240, 187, 447, 471, 394, 188, + 482, 474, 296, 189, 190, 395, 191, 192, 18, 193, + 194, 449, 322, 195, 212, 71, 213, 262, 453, 265, + 479, 196, 214, 270, 66, 215, 450, 429, 20, 21, + 396, 451, 397, 454, 225, 284, 165, 285, 455, 156, + 216, 287, 291, -193, 7, 8, 79, 292, 72, 9, + 271, 66, 10, 387, 272, 430, 69, 70, 389, 332, + 73, 273, 274, 324, 74, 325, 275, 166, 167, 168, + 169, 75, 364, 171, 94, 173, 276, 317, 372, 165, + 96, 98, 166, 167, 168, 169, 103, 170, 171, 172, + 173, 151, 159, 176, 177, 178, 179, 99, 186, 182, + 183, 168, 169, 331, 358, 171, 165, 173, 66, 362, + 161, 165, 366, 186, 374, 223, 375, 401, 408, 201, + 165, 412, 414, 165, 421, 432, 422, 422, 320, 438, + 186, 165, 461, 279, 165, 282, 286, 166, 167, 168, + 169, 79, 170, 171, 172, 173, 66, 283, 480, 359, + 165, 299, 294, 295, 182, 183, 365, 437, 302, 297, + 143, 66, 416, 300, 301, 311, 312, 304, 186, 313, + 314, 315, 343, 318, 89, 186, 347, 345, 89, 90, + 348, 355, 356, 90, 363, 380, 409, 463, 404, 357, + 166, 167, 168, 169, 405, 170, 171, 172, 173, 406, + 407, 176, 177, 178, 179, 413, 415, 182, 183, 420, + 423, 66, 439, 425, 443, 460, 456, 457, 424, 466, + 458, 186, 469, 477, 290, 472, 293, 230, 338, 138, + 342, 354, 483, 281, 399, 208, 326, 431, 153, 154, + 155, 158, 147, 484, 0, 478, 0, 160, 0, 166, + 167, 168, 169, 89, 170, 171, 172, 173, 90, 0, + 176, 177, 178, 179, 0, 0, 182, 183, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 186, 0, 0, 0, 0, 0, 0, 226, 0, 79, + 231, 0, 0, 0, 66, 327, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 0, 263, 0, + 267, 0, 268, 269, 0, 0, 277, 278, 0, 0, + 0, 0, 138, 0, 166, 167, 168, 169, 0, 170, + 171, 172, 173, 0, 0, 176, 177, 178, 179, 0, + 0, 182, 183, 0, 0, 0, 0, 381, 306, 0, + 307, 166, 167, 168, 169, 186, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 336, 0, 184, 0, 0, 0, 0, 185, 0, 0, + 0, 0, 186, 0, 0, 0, 0, 0, 0, 0, + 0, 328, 329, 0, 333, 334, 0, 335, 0, 0, + 337, 0, 0, 0, 187, 0, 0, 339, 188, 340, + 0, 0, 189, 190, 0, 191, 192, 0, 193, 194, + 346, 0, 195, 138, 0, 0, 350, 0, 0, 353, + 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 360, 361, 0, 0, 0, 0, 0, 367, 368, 0, + 0, 0, 0, 0, 0, 0, 0, 379, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, + 0, 105, 236, 402, 0, 0, 107, 108, 237, 0, + 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 410, 411, 0, 0, 0, 23, 24, 417, 418, 419, + 25, 0, 0, 26, 110, 111, 0, 0, 28, 0, + 0, 112, 113, 114, 0, 0, 32, 0, 33, 238, + 0, 34, 0, 0, 35, 115, 36, 37, 0, 38, + 0, 39, 40, 0, 0, 41, 0, 0, 0, 42, + 43, 44, 45, 116, 0, 117, 0, 0, 46, 47, + 48, 0, 118, 50, 0, 51, 52, 53, 54, 55, + 56, 0, 0, 0, 78, 58, 0, 119, 59, 0, + 0, 0, 60, 0, 0, 61, 62, 120, 121, 64, + 122, 123, 105, 321, 0, 0, 0, 107, 108, 0, + 0, 109, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 23, 24, 0, 0, + 0, 25, 0, 0, 26, 110, 111, 0, 0, 28, + 0, 0, 112, 113, 114, 0, 0, 32, 0, 33, + 0, 0, 34, 0, 0, 35, 115, 36, 37, 0, + 38, 0, 39, 40, 0, 0, 41, 0, 0, 0, + 42, 43, 44, 45, 116, 0, 117, 0, 0, 46, + 47, 48, 0, 118, 50, 0, 51, 52, 53, 54, + 55, 56, 94, 0, 0, 78, 58, 0, 119, 59, + 0, 0, 0, 60, 0, 0, 61, 62, 120, 121, + 64, 122, 123, 105, 371, 0, 0, 0, 107, 108, + 0, 0, 109, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 23, 24, 0, + 0, 0, 25, 0, 0, 26, 110, 111, 0, 0, + 28, 0, 0, 112, 113, 114, 0, 0, 32, 0, + 33, 0, 0, 34, 0, 0, 35, 115, 36, 37, + 0, 38, 0, 39, 40, 0, 0, 41, 0, 0, + 0, 42, 43, 44, 45, 116, 0, 117, 0, 0, + 46, 47, 48, 0, 118, 50, 0, 51, 52, 53, + 54, 55, 56, 94, 0, 0, 78, 58, 0, 119, + 59, 0, 0, 0, 60, 0, 0, 61, 62, 120, + 121, 64, 122, 123, 105, 106, 0, 0, 0, 107, + 108, 0, 0, 109, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 23, 24, + 0, 0, 0, 25, 0, 0, 26, 110, 111, 0, + 0, 28, 0, 0, 112, 113, 114, 0, 0, 32, + 0, 33, 0, 0, 34, 0, 0, 35, 115, 36, + 37, 0, 38, 0, 39, 40, 0, 0, 41, 0, + 0, 0, 42, 43, 44, 45, 116, 0, 117, 0, + 0, 46, 47, 48, 0, 118, 50, 0, 51, 52, + 53, 54, 55, 56, 0, 0, 0, 78, 58, 0, + 119, 59, 0, 0, 0, 60, 0, 0, 61, 62, + 120, 121, 64, 122, 123, 105, 0, 0, 0, 0, + 107, 108, 0, 0, 109, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, + 24, 0, 0, 0, 25, 0, 0, 26, 110, 111, + 0, 0, 28, 0, 0, 112, 113, 114, 0, 0, + 32, 0, 33, 0, 0, 34, 0, 0, 35, 115, + 36, 37, 0, 38, 0, 39, 40, 0, 0, 41, + 0, 0, 0, 42, 43, 44, 45, 116, 0, 117, + 0, 0, 46, 47, 48, 0, 118, 50, 0, 51, + 52, 53, 54, 55, 56, 0, 0, 0, 78, 58, + 0, 119, 59, 0, 0, 0, 60, 156, 0, 61, + 62, 120, 121, 64, 122, 123, 105, 436, 0, 0, + 0, 107, 108, 0, 0, 109, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 23, 24, 0, 0, 0, 25, 0, 0, 26, 110, + 111, 0, 0, 28, 0, 0, 112, 113, 114, 0, + 0, 32, 0, 33, 0, 0, 34, 0, 0, 35, + 115, 36, 37, 0, 38, 0, 39, 40, 0, 0, + 41, 0, 0, 0, 42, 43, 44, 45, 116, 0, + 117, 0, 0, 46, 47, 48, 0, 118, 50, 0, + 51, 52, 53, 54, 55, 56, 0, 0, 0, 78, + 58, 0, 119, 59, 0, 0, 0, 60, 0, 0, + 61, 62, 120, 121, 64, 122, 123, 105, 462, 0, + 0, 0, 107, 108, 0, 0, 109, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 23, 24, 0, 0, 0, 25, 0, 0, 26, + 110, 111, 0, 0, 28, 0, 0, 112, 113, 114, + 0, 0, 32, 0, 33, 0, 0, 34, 0, 0, + 35, 115, 36, 37, 0, 38, 0, 39, 40, 0, + 0, 41, 0, 0, 0, 42, 43, 44, 45, 116, + 0, 117, 0, 0, 46, 47, 48, 0, 118, 50, + 0, 51, 52, 53, 54, 55, 56, 0, 0, 0, + 78, 58, 0, 119, 59, 0, 0, 0, 60, 0, + 0, 61, 62, 120, 121, 64, 122, 123, 105, 0, + 0, 0, 0, 107, 108, 0, 0, 109, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 23, 24, 0, 0, 0, 25, 0, 0, + 26, 110, 111, 0, 0, 28, 0, 0, 112, 113, + 114, 0, 0, 32, 0, 33, 0, 0, 34, 0, + 0, 35, 115, 36, 37, 0, 38, 0, 39, 40, + 0, 0, 41, 0, 0, 0, 42, 43, 44, 45, + 116, 0, 117, 0, 0, 46, 47, 48, 0, 118, + 50, 0, 51, 52, 53, 54, 55, 56, 0, 0, + 0, 78, 58, 0, 119, 59, 0, 0, 0, 60, + 0, 0, 61, 62, 120, 121, 64, 122, 123, 288, + 0, 0, 0, 0, 202, 203, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 23, 24, 0, 0, 0, 25, 0, + 0, 26, 0, 27, 0, 0, 28, 0, 0, 112, + 113, 114, 0, 0, 32, 0, 33, 0, 0, 34, + 0, 0, 35, 115, 36, 37, 0, 38, 289, 39, + 40, 0, 0, 41, 0, 0, 0, 42, 43, 44, + 45, 0, 0, 117, 0, 0, 46, 47, 48, 0, + 49, 50, 0, 51, 52, 53, 54, 55, 56, 141, + 0, 0, 78, 58, 0, 119, 59, 0, 0, 0, + 60, 0, 0, 61, 62, 120, 121, 64, 122, 0, + 0, 0, 0, 23, 24, 0, 0, 0, 25, 0, + 0, 26, 0, 27, 0, 0, 28, 0, 0, 29, + 30, 31, 0, 0, 32, 0, 33, 0, 0, 34, + 0, 0, 35, 0, 36, 37, 0, 38, 0, 39, + 40, 0, 0, 41, 0, 0, 0, 42, 43, 44, + 45, 0, 0, 0, 0, 0, 46, 47, 48, 0, + 49, 50, 0, 51, 52, 53, 54, 55, 56, 264, + 0, 0, 78, 58, 0, 0, 59, 0, 0, 0, + 60, 0, 0, 61, 62, 0, 63, 64, 0, 0, + 0, 0, 0, 23, 24, 0, 0, 0, 25, 0, + 0, 26, 0, 27, 0, 0, 28, 0, 0, 29, + 30, 31, 0, 0, 32, 0, 33, 0, 0, 34, + 0, 0, 35, 0, 36, 37, 0, 38, 0, 39, + 40, 0, 0, 41, 0, 0, 0, 42, 43, 44, + 45, 0, 0, 0, 0, 0, 46, 47, 48, 0, + 49, 50, 0, 51, 52, 53, 54, 55, 56, 330, + 0, 0, 78, 58, 0, 0, 59, 0, 0, 0, + 60, 0, 0, 61, 62, 0, 63, 64, 0, 0, + 0, 0, 0, 23, 24, 0, 0, 0, 25, 0, + 0, 26, 0, 27, 0, 0, 28, 0, 0, 29, + 30, 31, 0, 0, 32, 0, 33, 0, 0, 34, + 0, 0, 35, 0, 36, 37, 0, 38, 0, 39, + 40, 0, 0, 41, 0, 0, 0, 42, 43, 44, + 45, 0, 0, 0, 0, 0, 46, 47, 48, 0, + 49, 50, 0, 51, 52, 53, 54, 55, 56, 0, + 0, 0, 78, 58, 0, 0, 59, 0, 0, 0, + 60, 0, 0, 61, 62, 0, 63, 64, 166, 167, + 168, 169, 0, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 0, 0, 184, + 0, 0, 0, 0, 185, 166, 167, 168, 169, 186, + 170, 171, 172, 173, 0, 0, 176, 177, 178, 179, + 0, 0, 182, 183, 0, 0, 0, 0, 0, 0, + 0, 187, 0, 0, 0, 188, 186, 0, 0, 189, + 190, 0, 191, 192, 0, 193, 194, 0, 0, 195, + 0, 370, 0, 0, 0, 0, 0, 196, 0, 0, + 0, 0, 0, 0, 166, 167, 168, 169, 305, 170, + 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, + 181, 182, 183, 0, 0, 184, 0, 0, 0, 0, + 185, 166, 167, 168, 169, 186, 170, 171, 172, 173, + 0, 0, 176, 177, 178, 179, 0, 0, 182, 183, + 0, 0, 0, 0, 0, 0, 0, 187, 0, 0, + 0, 188, 186, 0, 0, 189, 190, 0, 191, 192, + 0, 193, 194, 0, 0, 195, 0, 376, 0, 23, + 24, 0, 0, 196, 25, 0, 0, 26, 0, 27, + 0, 0, 28, 143, 352, 84, 85, 86, 0, 0, + 32, 0, 33, 0, 0, 34, 0, 0, 35, 0, + 36, 37, 0, 38, 87, 39, 40, 0, 0, 41, + 0, 0, 0, 42, 43, 44, 45, 0, 0, 0, + 0, 0, 46, 47, 48, 0, 49, 50, 0, 51, + 52, 53, 54, 55, 56, 0, 0, 0, 78, 58, + 0, 0, 59, 0, 0, 0, 60, 0, 0, 61, + 62, 0, 88, 64, 23, 24, 0, 0, 0, 25, + 0, 0, 26, 0, 27, 0, 0, 28, 0, 0, + 84, 85, 86, 0, 0, 32, 0, 33, 0, 0, + 34, 0, 0, 35, 0, 36, 37, 0, 38, 87, + 39, 40, 0, 0, 41, 0, 0, 0, 42, 43, + 44, 45, 0, 0, 0, 0, 0, 46, 47, 48, + 0, 49, 50, 0, 51, 52, 53, 54, 55, 56, + 0, 0, 0, 78, 58, 0, 0, 59, 0, 0, + 0, 60, 0, 0, 61, 62, 0, 88, 64, 23, + 24, 0, 0, 0, 25, 0, 0, 26, 0, 27, + 0, 0, 28, 0, 0, 29, 30, 31, 0, 0, + 32, 0, 33, 0, 0, 34, 0, 0, 35, 0, + 36, 37, 0, 38, 0, 39, 40, 0, 0, 41, + 0, 0, 0, 42, 43, 44, 45, 0, 0, 0, + 0, 0, 46, 47, 48, 0, 49, 50, 0, 51, + 52, 53, 54, 55, 56, 0, 0, 0, 57, 58, + 0, 0, 59, 0, 0, 0, 60, 0, 0, 61, + 62, 0, 63, 64, 23, 24, 0, 0, 0, 25, + 0, 0, 26, 0, 27, 0, 0, 28, 0, 0, + 29, 30, 31, 0, 0, 32, 0, 33, 0, 0, + 34, 0, 0, 35, 0, 36, 37, 0, 38, 0, + 39, 40, 0, 0, 41, 0, 0, 0, 42, 43, + 44, 45, 0, 0, 0, 0, 0, 46, 47, 48, + 0, 49, 50, 0, 51, 52, 53, 54, 55, 56, + 0, 0, 0, 78, 58, 0, 0, 59, 0, 0, + 0, 60, 0, 0, 61, 62, 382, 63, 64, 0, + 166, 167, 168, 169, 0, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 0, + 0, 184, 0, 0, 0, 0, 185, 166, 167, 168, + 169, 186, 170, 171, 172, 173, 0, 0, 176, 177, + 178, 179, 0, 0, 182, 183, 0, 0, 0, 0, + 0, 0, 0, 187, 0, 0, 0, 188, 186, 0, + 0, 189, 190, 0, 191, 192, 0, 193, 194, 0, + 0, 195, 0, 377, 0, 0, 398, 0, 0, 196, + 166, 167, 168, 169, 0, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 0, + 0, 184, 0, 0, 0, 0, 185, 166, 167, 168, + 169, 186, 170, 171, 172, 173, 0, 0, 176, 177, + 178, 179, 0, 0, 182, 183, 0, 0, 0, 0, + 0, 0, 0, 187, 0, 0, 0, 188, 186, 0, + 0, 189, 190, 0, 191, 192, 0, 193, 194, 0, + 0, 195, 0, 378, 0, 166, 167, 168, 169, 196, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 0, 0, 184, 0, 0, 197, + 0, 185, 166, 167, 168, 169, 186, 170, 171, 172, + 173, 0, 0, 176, 177, 178, 179, 198, 0, 182, + 183, 0, 0, 0, 0, 0, 0, 0, 187, 0, + 0, 0, 188, 186, 0, 0, 189, 190, 0, 191, + 192, 0, 193, 194, 0, 0, 195, 0, 0, 0, + 166, 167, 168, 169, 196, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 0, + 0, 184, 0, 310, 0, 0, 185, 0, 0, 0, + 0, 186, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 187, 0, 0, 0, 188, 0, 0, + 0, 189, 190, 0, 191, 192, 0, 193, 194, 0, + 0, 195, 0, 0, 0, 166, 167, 168, 169, 196, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 0, 0, 184, 319, 0, 0, + 0, 185, 0, 0, 0, 0, 186, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 187, 0, + 0, 0, 188, 0, 0, 0, 189, 190, 0, 191, + 192, 0, 193, 194, 0, 0, 195, 0, 0, 0, + 166, 167, 168, 169, 196, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 0, + 0, 184, 0, 0, 0, 0, 185, 0, 0, 0, + 0, 186, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 351, 0, 0, 0, 0, + 0, 0, 0, 187, 0, 0, 0, 188, 0, 0, + 0, 189, 190, 0, 191, 192, 0, 193, 194, 0, + 0, 195, 0, 0, 0, 166, 167, 168, 169, 196, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 0, 0, 184, 369, 0, 0, + 0, 185, 0, 0, 0, 0, 186, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 187, 0, + 0, 0, 188, 0, 0, 0, 189, 190, 0, 191, + 192, 0, 193, 194, 0, 0, 195, 0, 0, 0, + 166, 167, 168, 169, 196, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 0, + 0, 184, 0, 0, 0, 0, 185, 0, 0, 0, + 0, 186, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 403, 0, 0, 0, 0, + 0, 0, 0, 187, 0, 0, 0, 188, 0, 0, + 0, 189, 190, 0, 191, 192, 0, 193, 194, 0, + 0, 195, 0, 0, 0, 166, 167, 168, 169, 196, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 0, 0, 184, 0, 0, 0, + 0, 185, 0, 0, 0, 0, 186, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 187, 0, + 0, 0, 188, 0, 0, 0, 189, 190, 0, 191, + 192, 0, 193, 194, 0, 0, 195, 0, 0, 0, + 166, 167, 168, 169, 196, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 0, + 0, 184, 0, 0, 0, 0, 185, 0, 0, 0, + 0, 186, 166, 167, 168, 169, 0, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 0, 0, 187, 0, 0, 0, 188, 185, 0, + 0, 189, 190, 186, 191, 192, 0, 193, 194, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, + 0, 0, 0, 0, 0, 187, 0, 0, 0, 188, + 0, 0, 0, 189, 190, 0, 191, 192, 0, 193, + 194, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 196 + }; + + const short + parser::yycheck_[] = + { + 19, 20, 21, 105, 294, 19, 20, 21, 150, 72, + 73, 343, 75, 8, 9, 347, 264, 52, 53, 47, + 38, 52, 53, 302, 102, 16, 32, 49, 91, 4, + 3, 6, 5, 46, 4, 3, 6, 100, 4, 4, + 6, 6, 60, 42, 50, 73, 68, 75, 39, 27, + 78, 0, 342, 72, 73, 74, 75, 76, 72, 73, + 162, 75, 76, 31, 77, 83, 41, 145, 33, 348, + 105, 41, 91, 7, 105, 41, 66, 91, 56, 221, + 102, 100, 330, 101, 103, 63, 100, 35, 108, 103, + 422, 111, 8, 9, 10, 11, 75, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 401, 90, 29, 109, 48, 46, 48, 34, 27, + 46, 48, 35, 39, 143, 188, 74, 38, 39, 35, + 4, 64, 6, 64, 48, 46, 238, 64, 4, 95, + 6, 89, 95, 433, 163, 61, 94, 77, 56, 65, + 64, 77, 215, 69, 70, 63, 72, 73, 62, 75, + 76, 74, 264, 79, 75, 55, 77, 186, 74, 188, + 460, 87, 83, 34, 188, 86, 89, 47, 16, 17, + 88, 94, 90, 89, 4, 4, 6, 6, 94, 105, + 101, 210, 211, 95, 96, 97, 215, 211, 5, 101, + 61, 215, 104, 73, 65, 75, 20, 21, 78, 272, + 5, 72, 73, 3, 103, 5, 77, 8, 9, 10, + 11, 78, 324, 14, 93, 16, 87, 4, 330, 6, + 3, 3, 8, 9, 10, 11, 6, 13, 14, 15, + 16, 4, 3, 19, 20, 21, 22, 310, 39, 25, + 26, 10, 11, 272, 4, 14, 6, 16, 272, 4, + 3, 6, 325, 39, 3, 107, 5, 4, 4, 6, + 6, 4, 374, 6, 4, 4, 6, 6, 54, 4, + 39, 6, 4, 106, 6, 109, 3, 8, 9, 10, + 11, 310, 13, 14, 15, 16, 310, 109, 4, 318, + 6, 3, 77, 71, 25, 26, 325, 409, 3, 78, + 41, 325, 375, 71, 71, 6, 6, 91, 39, 4, + 6, 4, 3, 5, 343, 39, 3, 40, 347, 343, + 3, 110, 110, 347, 4, 4, 3, 439, 4, 110, + 8, 9, 10, 11, 4, 13, 14, 15, 16, 4, + 4, 19, 20, 21, 22, 4, 375, 25, 26, 33, + 67, 375, 3, 47, 67, 4, 67, 47, 387, 28, + 86, 39, 28, 67, 211, 28, 211, 158, 285, 98, + 295, 310, 478, 201, 347, 145, 54, 391, 107, 108, + 109, 110, 103, 483, -1, 458, -1, 116, -1, 8, + 9, 10, 11, 422, 13, 14, 15, 16, 422, -1, + 19, 20, 21, 22, -1, -1, 25, 26, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 39, -1, -1, -1, -1, -1, -1, 156, -1, 458, + 159, -1, -1, -1, 458, 54, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, -1, 187, -1, + 189, -1, 191, 192, -1, -1, 195, 196, -1, -1, + -1, -1, 201, -1, 8, 9, 10, 11, -1, 13, + 14, 15, 16, -1, -1, 19, 20, 21, 22, -1, + -1, 25, 26, -1, -1, -1, -1, 4, 227, -1, + 229, 8, 9, 10, 11, 39, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 54, -1, 29, -1, -1, -1, -1, 34, -1, -1, + -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, + -1, 270, 271, -1, 273, 274, -1, 276, -1, -1, + 279, -1, -1, -1, 61, -1, -1, 286, 65, 288, + -1, -1, 69, 70, -1, 72, 73, -1, 75, 76, + 299, -1, 79, 302, -1, -1, 305, -1, -1, 308, + 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 319, 320, -1, -1, -1, -1, -1, 326, 327, -1, + -1, -1, -1, -1, -1, -1, -1, 336, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 348, + -1, 3, 4, 352, -1, -1, 8, 9, 10, -1, + 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 369, 370, -1, -1, -1, 27, 28, 376, 377, 378, + 32, -1, -1, 35, 36, 37, -1, -1, 40, -1, + -1, 43, 44, 45, -1, -1, 48, -1, 50, 51, + -1, 53, -1, -1, 56, 57, 58, 59, -1, 61, + -1, 63, 64, -1, -1, 67, -1, -1, -1, 71, + 72, 73, 74, 75, -1, 77, -1, -1, 80, 81, + 82, -1, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, -1, -1, 96, 97, -1, 99, 100, -1, + -1, -1, 104, -1, -1, 107, 108, 109, 110, 111, + 112, 113, 3, 4, -1, -1, -1, 8, 9, -1, + -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 27, 28, -1, -1, + -1, 32, -1, -1, 35, 36, 37, -1, -1, 40, + -1, -1, 43, 44, 45, -1, -1, 48, -1, 50, + -1, -1, 53, -1, -1, 56, 57, 58, 59, -1, + 61, -1, 63, 64, -1, -1, 67, -1, -1, -1, + 71, 72, 73, 74, 75, -1, 77, -1, -1, 80, + 81, 82, -1, 84, 85, -1, 87, 88, 89, 90, + 91, 92, 93, -1, -1, 96, 97, -1, 99, 100, + -1, -1, -1, 104, -1, -1, 107, 108, 109, 110, + 111, 112, 113, 3, 4, -1, -1, -1, 8, 9, + -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 27, 28, -1, + -1, -1, 32, -1, -1, 35, 36, 37, -1, -1, + 40, -1, -1, 43, 44, 45, -1, -1, 48, -1, + 50, -1, -1, 53, -1, -1, 56, 57, 58, 59, + -1, 61, -1, 63, 64, -1, -1, 67, -1, -1, + -1, 71, 72, 73, 74, 75, -1, 77, -1, -1, + 80, 81, 82, -1, 84, 85, -1, 87, 88, 89, + 90, 91, 92, 93, -1, -1, 96, 97, -1, 99, + 100, -1, -1, -1, 104, -1, -1, 107, 108, 109, + 110, 111, 112, 113, 3, 4, -1, -1, -1, 8, + 9, -1, -1, 12, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 27, 28, + -1, -1, -1, 32, -1, -1, 35, 36, 37, -1, + -1, 40, -1, -1, 43, 44, 45, -1, -1, 48, + -1, 50, -1, -1, 53, -1, -1, 56, 57, 58, + 59, -1, 61, -1, 63, 64, -1, -1, 67, -1, + -1, -1, 71, 72, 73, 74, 75, -1, 77, -1, + -1, 80, 81, 82, -1, 84, 85, -1, 87, 88, + 89, 90, 91, 92, -1, -1, -1, 96, 97, -1, + 99, 100, -1, -1, -1, 104, -1, -1, 107, 108, + 109, 110, 111, 112, 113, 3, -1, -1, -1, -1, + 8, 9, -1, -1, 12, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, + 28, -1, -1, -1, 32, -1, -1, 35, 36, 37, + -1, -1, 40, -1, -1, 43, 44, 45, -1, -1, + 48, -1, 50, -1, -1, 53, -1, -1, 56, 57, + 58, 59, -1, 61, -1, 63, 64, -1, -1, 67, + -1, -1, -1, 71, 72, 73, 74, 75, -1, 77, + -1, -1, 80, 81, 82, -1, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, -1, 96, 97, + -1, 99, 100, -1, -1, -1, 104, 105, -1, 107, + 108, 109, 110, 111, 112, 113, 3, 4, -1, -1, + -1, 8, 9, -1, -1, 12, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 27, 28, -1, -1, -1, 32, -1, -1, 35, 36, + 37, -1, -1, 40, -1, -1, 43, 44, 45, -1, + -1, 48, -1, 50, -1, -1, 53, -1, -1, 56, + 57, 58, 59, -1, 61, -1, 63, 64, -1, -1, + 67, -1, -1, -1, 71, 72, 73, 74, 75, -1, + 77, -1, -1, 80, 81, 82, -1, 84, 85, -1, + 87, 88, 89, 90, 91, 92, -1, -1, -1, 96, + 97, -1, 99, 100, -1, -1, -1, 104, -1, -1, + 107, 108, 109, 110, 111, 112, 113, 3, 4, -1, + -1, -1, 8, 9, -1, -1, 12, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 27, 28, -1, -1, -1, 32, -1, -1, 35, + 36, 37, -1, -1, 40, -1, -1, 43, 44, 45, + -1, -1, 48, -1, 50, -1, -1, 53, -1, -1, + 56, 57, 58, 59, -1, 61, -1, 63, 64, -1, + -1, 67, -1, -1, -1, 71, 72, 73, 74, 75, + -1, 77, -1, -1, 80, 81, 82, -1, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, -1, -1, + 96, 97, -1, 99, 100, -1, -1, -1, 104, -1, + -1, 107, 108, 109, 110, 111, 112, 113, 3, -1, + -1, -1, -1, 8, 9, -1, -1, 12, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 27, 28, -1, -1, -1, 32, -1, -1, + 35, 36, 37, -1, -1, 40, -1, -1, 43, 44, + 45, -1, -1, 48, -1, 50, -1, -1, 53, -1, + -1, 56, 57, 58, 59, -1, 61, -1, 63, 64, + -1, -1, 67, -1, -1, -1, 71, 72, 73, 74, + 75, -1, 77, -1, -1, 80, 81, 82, -1, 84, + 85, -1, 87, 88, 89, 90, 91, 92, -1, -1, + -1, 96, 97, -1, 99, 100, -1, -1, -1, 104, + -1, -1, 107, 108, 109, 110, 111, 112, 113, 3, + -1, -1, -1, -1, 8, 9, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 27, 28, -1, -1, -1, 32, -1, + -1, 35, -1, 37, -1, -1, 40, -1, -1, 43, + 44, 45, -1, -1, 48, -1, 50, -1, -1, 53, + -1, -1, 56, 57, 58, 59, -1, 61, 62, 63, + 64, -1, -1, 67, -1, -1, -1, 71, 72, 73, + 74, -1, -1, 77, -1, -1, 80, 81, 82, -1, + 84, 85, -1, 87, 88, 89, 90, 91, 92, 3, + -1, -1, 96, 97, -1, 99, 100, -1, -1, -1, + 104, -1, -1, 107, 108, 109, 110, 111, 112, -1, + -1, -1, -1, 27, 28, -1, -1, -1, 32, -1, + -1, 35, -1, 37, -1, -1, 40, -1, -1, 43, + 44, 45, -1, -1, 48, -1, 50, -1, -1, 53, + -1, -1, 56, -1, 58, 59, -1, 61, -1, 63, + 64, -1, -1, 67, -1, -1, -1, 71, 72, 73, + 74, -1, -1, -1, -1, -1, 80, 81, 82, -1, + 84, 85, -1, 87, 88, 89, 90, 91, 92, 3, + -1, -1, 96, 97, -1, -1, 100, -1, -1, -1, + 104, -1, -1, 107, 108, -1, 110, 111, -1, -1, + -1, -1, -1, 27, 28, -1, -1, -1, 32, -1, + -1, 35, -1, 37, -1, -1, 40, -1, -1, 43, + 44, 45, -1, -1, 48, -1, 50, -1, -1, 53, + -1, -1, 56, -1, 58, 59, -1, 61, -1, 63, + 64, -1, -1, 67, -1, -1, -1, 71, 72, 73, + 74, -1, -1, -1, -1, -1, 80, 81, 82, -1, + 84, 85, -1, 87, 88, 89, 90, 91, 92, 3, + -1, -1, 96, 97, -1, -1, 100, -1, -1, -1, + 104, -1, -1, 107, 108, -1, 110, 111, -1, -1, + -1, -1, -1, 27, 28, -1, -1, -1, 32, -1, + -1, 35, -1, 37, -1, -1, 40, -1, -1, 43, + 44, 45, -1, -1, 48, -1, 50, -1, -1, 53, + -1, -1, 56, -1, 58, 59, -1, 61, -1, 63, + 64, -1, -1, 67, -1, -1, -1, 71, 72, 73, + 74, -1, -1, -1, -1, -1, 80, 81, 82, -1, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, -1, 96, 97, -1, -1, 100, -1, -1, -1, + 104, -1, -1, 107, 108, -1, 110, 111, 8, 9, + 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, -1, -1, 29, + -1, -1, -1, -1, 34, 8, 9, 10, 11, 39, + 13, 14, 15, 16, -1, -1, 19, 20, 21, 22, + -1, -1, 25, 26, -1, -1, -1, -1, -1, -1, + -1, 61, -1, -1, -1, 65, 39, -1, -1, 69, + 70, -1, 72, 73, -1, 75, 76, -1, -1, 79, + -1, 54, -1, -1, -1, -1, -1, 87, -1, -1, + -1, -1, -1, -1, 8, 9, 10, 11, 98, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, -1, -1, 29, -1, -1, -1, -1, + 34, 8, 9, 10, 11, 39, 13, 14, 15, 16, + -1, -1, 19, 20, 21, 22, -1, -1, 25, 26, + -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, + -1, 65, 39, -1, -1, 69, 70, -1, 72, 73, + -1, 75, 76, -1, -1, 79, -1, 54, -1, 27, + 28, -1, -1, 87, 32, -1, -1, 35, -1, 37, + -1, -1, 40, 41, 98, 43, 44, 45, -1, -1, + 48, -1, 50, -1, -1, 53, -1, -1, 56, -1, + 58, 59, -1, 61, 62, 63, 64, -1, -1, 67, + -1, -1, -1, 71, 72, 73, 74, -1, -1, -1, + -1, -1, 80, 81, 82, -1, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, -1, 96, 97, + -1, -1, 100, -1, -1, -1, 104, -1, -1, 107, + 108, -1, 110, 111, 27, 28, -1, -1, -1, 32, + -1, -1, 35, -1, 37, -1, -1, 40, -1, -1, + 43, 44, 45, -1, -1, 48, -1, 50, -1, -1, + 53, -1, -1, 56, -1, 58, 59, -1, 61, 62, + 63, 64, -1, -1, 67, -1, -1, -1, 71, 72, + 73, 74, -1, -1, -1, -1, -1, 80, 81, 82, + -1, 84, 85, -1, 87, 88, 89, 90, 91, 92, + -1, -1, -1, 96, 97, -1, -1, 100, -1, -1, + -1, 104, -1, -1, 107, 108, -1, 110, 111, 27, + 28, -1, -1, -1, 32, -1, -1, 35, -1, 37, + -1, -1, 40, -1, -1, 43, 44, 45, -1, -1, + 48, -1, 50, -1, -1, 53, -1, -1, 56, -1, + 58, 59, -1, 61, -1, 63, 64, -1, -1, 67, + -1, -1, -1, 71, 72, 73, 74, -1, -1, -1, + -1, -1, 80, 81, 82, -1, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, -1, 96, 97, + -1, -1, 100, -1, -1, -1, 104, -1, -1, 107, + 108, -1, 110, 111, 27, 28, -1, -1, -1, 32, + -1, -1, 35, -1, 37, -1, -1, 40, -1, -1, + 43, 44, 45, -1, -1, 48, -1, 50, -1, -1, + 53, -1, -1, 56, -1, 58, 59, -1, 61, -1, + 63, 64, -1, -1, 67, -1, -1, -1, 71, 72, + 73, 74, -1, -1, -1, -1, -1, 80, 81, 82, + -1, 84, 85, -1, 87, 88, 89, 90, 91, 92, + -1, -1, -1, 96, 97, -1, -1, 100, -1, -1, + -1, 104, -1, -1, 107, 108, 4, 110, 111, -1, + 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, 29, -1, -1, -1, -1, 34, 8, 9, 10, + 11, 39, 13, 14, 15, 16, -1, -1, 19, 20, + 21, 22, -1, -1, 25, 26, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, 65, 39, -1, + -1, 69, 70, -1, 72, 73, -1, 75, 76, -1, + -1, 79, -1, 54, -1, -1, 4, -1, -1, 87, + 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, 29, -1, -1, -1, -1, 34, 8, 9, 10, + 11, 39, 13, 14, 15, 16, -1, -1, 19, 20, + 21, 22, -1, -1, 25, 26, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, 65, 39, -1, + -1, 69, 70, -1, 72, 73, -1, 75, 76, -1, + -1, 79, -1, 54, -1, 8, 9, 10, 11, 87, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, -1, -1, 32, + -1, 34, 8, 9, 10, 11, 39, 13, 14, 15, + 16, -1, -1, 19, 20, 21, 22, 50, -1, 25, + 26, -1, -1, -1, -1, -1, -1, -1, 61, -1, + -1, -1, 65, 39, -1, -1, 69, 70, -1, 72, + 73, -1, 75, 76, -1, -1, 79, -1, -1, -1, + 8, 9, 10, 11, 87, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, 29, -1, 31, -1, -1, 34, -1, -1, -1, + -1, 39, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, 65, -1, -1, + -1, 69, 70, -1, 72, 73, -1, 75, 76, -1, + -1, 79, -1, -1, -1, 8, 9, 10, 11, 87, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, -1, + -1, 34, -1, -1, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, + -1, -1, 65, -1, -1, -1, 69, 70, -1, 72, + 73, -1, 75, 76, -1, -1, 79, -1, -1, -1, + 8, 9, 10, 11, 87, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, 29, -1, -1, -1, -1, 34, -1, -1, -1, + -1, 39, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, 65, -1, -1, + -1, 69, 70, -1, 72, 73, -1, 75, 76, -1, + -1, 79, -1, -1, -1, 8, 9, 10, 11, 87, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, -1, + -1, 34, -1, -1, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, + -1, -1, 65, -1, -1, -1, 69, 70, -1, 72, + 73, -1, 75, 76, -1, -1, 79, -1, -1, -1, + 8, 9, 10, 11, 87, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, 29, -1, -1, -1, -1, 34, -1, -1, -1, + -1, 39, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, 65, -1, -1, + -1, 69, 70, -1, 72, 73, -1, 75, 76, -1, + -1, 79, -1, -1, -1, 8, 9, 10, 11, 87, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, -1, -1, -1, + -1, 34, -1, -1, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, + -1, -1, 65, -1, -1, -1, 69, 70, -1, 72, + 73, -1, 75, 76, -1, -1, 79, -1, -1, -1, + 8, 9, 10, 11, 87, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, 29, -1, -1, -1, -1, 34, -1, -1, -1, + -1, 39, 8, 9, 10, 11, -1, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, -1, -1, 61, -1, -1, -1, 65, 34, -1, + -1, 69, 70, 39, 72, 73, -1, 75, 76, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 87, + -1, -1, -1, -1, -1, 61, -1, -1, -1, 65, + -1, -1, -1, 69, 70, -1, 72, 73, -1, 75, + 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 87 + }; + + const unsigned char + parser::yystos_[] = + { + 0, 42, 115, 116, 146, 148, 166, 96, 97, 101, + 104, 141, 149, 0, 7, 95, 66, 95, 62, 139, + 139, 139, 75, 27, 28, 32, 35, 37, 40, 43, + 44, 45, 48, 50, 53, 56, 58, 59, 61, 63, + 64, 67, 71, 72, 73, 74, 80, 81, 82, 84, + 85, 87, 88, 89, 90, 91, 92, 96, 97, 100, + 104, 107, 108, 110, 111, 118, 119, 120, 143, 143, + 143, 55, 5, 5, 103, 78, 3, 31, 96, 118, + 120, 120, 118, 120, 43, 44, 45, 62, 110, 118, + 119, 121, 155, 156, 93, 138, 3, 147, 3, 120, + 124, 125, 152, 6, 165, 3, 4, 8, 9, 12, + 36, 37, 43, 44, 45, 57, 75, 77, 84, 99, + 109, 110, 112, 113, 117, 118, 119, 126, 127, 128, + 129, 130, 131, 132, 133, 135, 136, 137, 137, 144, + 145, 3, 120, 41, 153, 154, 157, 155, 157, 163, + 164, 4, 129, 137, 137, 137, 105, 134, 137, 3, + 137, 3, 3, 5, 4, 6, 8, 9, 10, 11, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 29, 34, 39, 61, 65, 69, + 70, 72, 73, 75, 76, 79, 87, 32, 50, 140, + 4, 6, 8, 9, 109, 122, 123, 118, 153, 38, + 39, 46, 75, 77, 83, 86, 101, 38, 60, 83, + 101, 6, 163, 107, 150, 4, 137, 52, 53, 105, + 134, 137, 27, 56, 63, 90, 4, 10, 51, 129, + 118, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 118, 137, 3, 118, 120, 137, 137, 137, + 34, 61, 65, 72, 73, 77, 87, 137, 137, 106, + 142, 144, 109, 109, 4, 6, 3, 118, 3, 62, + 117, 118, 119, 122, 77, 71, 120, 78, 151, 3, + 71, 71, 3, 163, 91, 98, 137, 137, 52, 53, + 31, 6, 6, 4, 6, 4, 129, 4, 5, 30, + 54, 4, 129, 138, 3, 5, 54, 54, 137, 137, + 3, 118, 120, 137, 137, 137, 54, 137, 123, 137, + 137, 151, 140, 3, 159, 40, 137, 3, 3, 145, + 137, 53, 98, 137, 125, 110, 110, 110, 4, 118, + 137, 137, 4, 4, 129, 118, 120, 137, 137, 30, + 54, 4, 129, 138, 3, 5, 54, 54, 54, 137, + 4, 4, 4, 151, 121, 158, 47, 73, 75, 78, + 160, 161, 162, 27, 56, 63, 88, 90, 4, 158, + 145, 4, 137, 53, 4, 4, 4, 4, 4, 3, + 137, 137, 4, 4, 129, 118, 120, 137, 137, 137, + 33, 4, 6, 67, 118, 47, 49, 68, 102, 47, + 75, 160, 4, 4, 33, 151, 4, 129, 4, 3, + 121, 48, 64, 67, 35, 74, 89, 94, 35, 74, + 89, 94, 35, 74, 89, 94, 67, 47, 86, 151, + 4, 4, 4, 129, 48, 64, 28, 46, 77, 28, + 46, 77, 28, 46, 77, 48, 64, 67, 120, 151, + 4, 48, 64, 159, 162 + }; + + const unsigned char + parser::yyr1_[] = + { + 0, 114, 115, 115, 116, 116, 116, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 118, 118, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, + 121, 121, 121, 121, 121, 121, 121, 122, 122, 123, + 123, 124, 124, 125, 125, 125, 126, 126, 126, 126, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 129, 129, 130, + 130, 130, 130, 131, 131, 131, 132, 132, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 134, 134, 135, 135, 135, 135, + 136, 136, 136, 136, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 138, 139, 139, 140, 140, 140, 141, 141, + 142, 142, 143, 143, 143, 144, 145, 145, 146, 147, + 147, 147, 148, 149, 149, 149, 150, 150, 151, 151, + 151, 151, 151, 151, 152, 152, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 154, 154, 155, 155, 156, 156, 157, 157, 158, 158, + 159, 159, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 161, 161, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 163, 163, 163, 163, 163, 164, + 164, 164, 165, 165, 166, 166 + }; + + const unsigned char + parser::yyr2_[] = + { + 0, 2, 1, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, + 1, 1, 2, 1, 4, 6, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, + 5, 5, 5, 6, 6, 6, 6, 1, 3, 4, + 5, 3, 4, 2, 2, 3, 5, 6, 4, 5, + 5, 5, 3, 7, 8, 6, 5, 6, 6, 6, + 4, 8, 9, 7, 4, 5, 6, 4, 5, 3, + 4, 6, 6, 6, 1, 1, 1, 5, 3, 1, + 1, 1, 1, 3, 6, 3, 1, 1, 1, 1, + 1, 1, 1, 0, 3, 0, 1, 1, 0, 1, + 0, 2, 3, 3, 1, 2, 1, 3, 11, 0, + 2, 3, 8, 0, 1, 1, 0, 2, 0, 3, + 3, 3, 3, 3, 0, 1, 5, 6, 4, 2, + 3, 5, 3, 3, 3, 3, 3, 5, 3, 5, + 1, 2, 3, 2, 1, 3, 0, 2, 1, 3, + 0, 3, 4, 4, 3, 3, 4, 4, 4, 3, + 3, 4, 4, 4, 3, 3, 4, 2, 1, 2, + 0, 1, 4, 4, 2, 5, 5, 3, 3, 3, + 1, 4, 4, 2, 7, 8, 6, 5, 10, 1, + 3, 2, 0, 2, 7, 10 + }; + + + + // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + // First, the terminals, then, starting at \a yyntokens_, nonterminals. + const char* + const parser::yytname_[] = + { + "\"end of file\"", "error", "$undefined", "\"(\"", "\")\"", "\".\"", + "\",\"", "\";\"", "\"+\"", "\"-\"", "\"*\"", "\"/\"", "\"~\"", "\"&\"", + "\"%\"", "\"|\"", "\"||\"", "\"=\"", "\"==\"", "\">\"", "\">=\"", + "\"<\"", "\"<=\"", "\"!=\"", "\"<>\"", "\"<<\"", "\">>\"", "\"ABORT\"", + "\"ACTION\"", "\"AND\"", "\"AND BETWEEN\"", "\"AS\"", "\"ASC\"", + "\"AUTOINCREMENT\"", "\"BETWEEN\"", "\"CASCADE\"", "\"CASE\"", + "\"CAST\"", "\"CHECK\"", "\"COLLATE\"", "\"CONFLICT\"", "\"CONSTRAINT\"", + "\"CREATE\"", "\"CURRENT_DATE\"", "\"CURRENT_TIME\"", + "\"CURRENT_TIMESTAMP\"", "\"DEFAULT\"", "\"DEFERRABLE\"", "\"DEFERRED\"", + "\"DELETE\"", "\"DESC\"", "\"DISTINCT\"", "\"ELSE\"", "\"END\"", + "\"ESCAPE\"", "\"EXISTS\"", "\"FAIL\"", "\"FALSE\"", "\"FILTER\"", + "\"FOLLOWING\"", "\"FOREIGN\"", "\"GLOB\"", "\"IF\"", "\"IGNORE\"", + "\"IMMEDIATE\"", "\"IN\"", "\"INDEX\"", "\"INITIALLY\"", "\"INSERT\"", + "\"IS\"", "\"ISNULL\"", "\"KEY\"", "\"LIKE\"", "\"MATCH\"", "\"NO\"", + "\"NOT\"", "\"NOTNULL\"", "\"NULL\"", "\"ON\"", "\"OR\"", "\"OVER\"", + "\"PARTITION\"", "\"PRECEDING\"", "\"PRIMARY\"", "\"RAISE\"", + "\"RANGE\"", "\"REFERENCES\"", "\"REGEXP\"", "\"REPLACE\"", + "\"RESTRICT\"", "\"ROLLBACK\"", "\"ROWID\"", "\"ROWS\"", "\"SELECT\"", + "\"SET\"", "\"TABLE\"", "\"TEMP\"", "\"TEMPORARY\"", "\"THEN\"", + "\"TRUE\"", "\"UNBOUNDED\"", "\"UNIQUE\"", "\"UPDATE\"", "\"USING\"", + "\"VIRTUAL\"", "\"WHEN\"", "\"WHERE\"", "\"WITHOUT\"", "\"identifier\"", + "\"numeric\"", "\"string literal\"", "\"quoted literal\"", + "\"blob literal\"", "\"bind parameter\"", "$accept", "sql", "statement", + "literalvalue", "id", "allowed_keywords_as_identifier", "tableid", + "columnid", "signednumber", "signednumber_or_numeric", + "typename_namelist", "type_name", "unary_expr", "binary_expr", + "like_expr", "exprlist_expr", "function_expr", "isnull_expr", + "between_expr", "in_expr", "whenthenlist_expr", "case_expr", + "raise_expr", "expr", "select_stmt", "optional_if_not_exists", + "optional_sort_order", "optional_unique", "optional_where", + "tableid_with_uninteresting_schema", "indexed_column", + "indexed_column_list", "createindex_stmt", + "optional_exprlist_with_paren", "createvirtualtable_stmt", + "optional_temporary", "optional_withoutrowid", "optional_conflictclause", + "optional_typename", "columnconstraint", "columnconstraint_list", + "columndef", "columndef_list", "optional_constraintname", + "columnid_list", "optional_columnid_with_paren_list", "fk_clause_part", + "fk_clause_part_list", "optional_fk_clause", "tableconstraint", + "tableconstraint_list", "optional_tableconstraint_list", + "createtable_stmt", YY_NULLPTR + }; + +#if YYDEBUG + const unsigned short + parser::yyrline_[] = + { + 0, 301, 301, 302, 306, 307, 308, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 328, 329, 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, 373, 374, 375, 376, 377, 378, + 382, 383, 384, 385, 386, 387, 388, 392, 393, 397, + 398, 402, 403, 407, 408, 409, 413, 414, 415, 416, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, + 440, 444, 445, 446, 447, 448, 449, 450, 451, 452, + 453, 454, 455, 456, 457, 458, 459, 463, 464, 468, + 469, 470, 471, 475, 476, 477, 481, 482, 486, 487, + 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, + 498, 499, 500, 501, 505, 506, 510, 511, 512, 513, + 517, 518, 519, 520, 524, 525, 526, 527, 528, 529, + 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, + 540, 541, 550, 558, 559, 563, 564, 565, 573, 574, + 578, 579, 583, 584, 585, 589, 603, 604, 608, 623, + 624, 625, 629, 641, 642, 643, 647, 648, 652, 653, + 654, 655, 656, 657, 661, 662, 666, 675, 685, 690, + 695, 700, 706, 712, 718, 724, 731, 737, 743, 749, + 763, 764, 768, 806, 810, 811, 815, 816, 820, 821, + 825, 826, 830, 831, 832, 833, 834, 835, 836, 837, + 838, 839, 840, 841, 842, 843, 844, 845, 849, 850, + 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, + 864, 865, 866, 867, 871, 877, 884, 890, 894, 902, + 903, 904, 908, 909, 913, 917 + }; + + // Print the state stack on the debug stream. + void + parser::yystack_print_ () + { + *yycdebug_ << "Stack now"; + for (stack_type::const_iterator + i = yystack_.begin (), + i_end = yystack_.end (); + i != i_end; ++i) + *yycdebug_ << ' ' << i->state; + *yycdebug_ << '\n'; + } + + // Report on the debug stream that the rule \a yyrule is going to be reduced. + void + parser::yy_reduce_print_ (int yyrule) + { + unsigned yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + // Print the symbols being reduced, and their result. + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 + << " (line " << yylno << "):\n"; + // The symbols being reduced. + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", + yystack_[(yynrhs) - (yyi + 1)]); + } +#endif // YYDEBUG + + +#line 10 "sqlite3_parser.yy" +} } // sqlb::parser +#line 4381 "sqlite3_parser.cpp" + +#line 939 "sqlite3_parser.yy" + + +void sqlb::parser::parser::error(const location_type& l, const std::string& m) +{ + std::cerr << l << ": " << m << std::endl; +} diff --git a/src/sql/parser/sqlite3_parser.hpp b/src/sql/parser/sqlite3_parser.hpp new file mode 100644 index 00000000..6e13d018 --- /dev/null +++ b/src/sql/parser/sqlite3_parser.hpp @@ -0,0 +1,4033 @@ +// A Bison parser, made by GNU Bison 3.4.1. + +// Skeleton interface for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015, 2018-2019 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. + + +/** + ** \file sqlite3_parser.hpp + ** Define the sqlb::parser ::parser class. + */ + +// C++ LALR(1) parser skeleton written by Akim Demaille. + +// Undocumented macros, especially those whose name start with YY_, +// are private implementation details. Do not rely on them. + +#ifndef YY_YY_SQLITE3_PARSER_HPP_INCLUDED +# define YY_YY_SQLITE3_PARSER_HPP_INCLUDED +// // "%code requires" blocks. +#line 12 "sqlite3_parser.yy" + + #include + #include + #include "../sqlitetypes.h" + #include "../ObjectIdentifier.h" + namespace sqlb { namespace parser { class ParserDriver; } } + typedef void* yyscan_t; + + // Unfortunately we do not store column constraints in a systematic manner yet. + // Instead there is a variable for most column constraints directly inside the + // sqlb::Field class. This means that when parsing a column constraint we cannot + // just build a column constraint object with all the information and insert that + // into the Field object. Instead, the information needs to be passed upwards in + // some other way. This is what these declarations are for. We need to be able + // to pass information to the Field object as well as to the Table object too + // because some column constraints need to be transformed into Table constraints + // with our current layout. + class ColumnConstraintInfo + { + public: + ColumnConstraintInfo() : is_table_constraint(false), fully_parsed(false) {} + ~ColumnConstraintInfo() {} + ColumnConstraintInfo& operator=(const ColumnConstraintInfo& other) + { + type = other.type; + is_table_constraint = other.is_table_constraint; + fully_parsed = other.fully_parsed; + if(is_table_constraint) + table_constraint = other.table_constraint; + text = other.text; + + return *this; + } + ColumnConstraintInfo(const ColumnConstraintInfo& other) + { + *this = other; + } + + enum ConstraintType + { + None, + AutoIncrement, + PrimaryKey, + NotNull, + Unique, + Check, + Default, + Collate, + ForeignKey, + }; + + ConstraintType type; + bool is_table_constraint; + bool fully_parsed; + + sqlb::ConstraintPtr table_constraint; + std::string text; + }; + using ColumnConstraintInfoVector = std::vector; + + // Colum definitions are a tuple of three elements: the Field object, a set of table constraints, and a bool to indicate whether parsing was complete + using ColumndefData = std::tuple; + +#line 112 "sqlite3_parser.hpp" + +# include +# include // std::abort +# include +# include +# include +# include + +#if defined __cplusplus +# define YY_CPLUSPLUS __cplusplus +#else +# define YY_CPLUSPLUS 199711L +#endif + +// Support move semantics when possible. +#if 201103L <= YY_CPLUSPLUS +# define YY_MOVE std::move +# define YY_MOVE_OR_COPY move +# define YY_MOVE_REF(Type) Type&& +# define YY_RVREF(Type) Type&& +# define YY_COPY(Type) Type +#else +# define YY_MOVE +# define YY_MOVE_OR_COPY copy +# define YY_MOVE_REF(Type) Type& +# define YY_RVREF(Type) const Type& +# define YY_COPY(Type) const Type& +#endif + +// Support noexcept when possible. +#if 201103L <= YY_CPLUSPLUS +# define YY_NOEXCEPT noexcept +# define YY_NOTHROW +#else +# define YY_NOEXCEPT +# define YY_NOTHROW throw () +#endif + +// Support constexpr when possible. +#if 201703 <= YY_CPLUSPLUS +# define YY_CONSTEXPR constexpr +#else +# define YY_CONSTEXPR +#endif +# include "sqlite3_location.h" +#include +#ifndef YYASSERT +# include +# define YYASSERT assert +#endif + + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#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 + +# 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 + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +#line 10 "sqlite3_parser.yy" +namespace sqlb { namespace parser { +#line 228 "sqlite3_parser.hpp" + + + + + /// A Bison parser. + class parser + { + public: +#ifndef YYSTYPE + /// A buffer to store and retrieve objects. + /// + /// Sort of a variant, but does not keep track of the nature + /// of the stored data, since that knowledge is available + /// via the current parser state. + class semantic_type + { + public: + /// Type of *this. + typedef semantic_type self_type; + + /// Empty construction. + semantic_type () YY_NOEXCEPT + : yybuffer_ () + , yytypeid_ (YY_NULLPTR) + {} + + /// Construct and fill. + template + semantic_type (YY_RVREF (T) t) + : yytypeid_ (&typeid (T)) + { + YYASSERT (sizeof (T) <= size); + new (yyas_ ()) T (YY_MOVE (t)); + } + + /// Destruction, allowed only if empty. + ~semantic_type () YY_NOEXCEPT + { + YYASSERT (!yytypeid_); + } + +# if 201103L <= YY_CPLUSPLUS + /// Instantiate a \a T in here from \a t. + template + T& + emplace (U&&... u) + { + YYASSERT (!yytypeid_); + YYASSERT (sizeof (T) <= size); + yytypeid_ = & typeid (T); + return *new (yyas_ ()) T (std::forward (u)...); + } +# else + /// Instantiate an empty \a T in here. + template + T& + emplace () + { + YYASSERT (!yytypeid_); + YYASSERT (sizeof (T) <= size); + yytypeid_ = & typeid (T); + return *new (yyas_ ()) T (); + } + + /// Instantiate a \a T in here from \a t. + template + T& + emplace (const T& t) + { + YYASSERT (!yytypeid_); + YYASSERT (sizeof (T) <= size); + yytypeid_ = & typeid (T); + return *new (yyas_ ()) T (t); + } +# endif + + /// Instantiate an empty \a T in here. + /// Obsolete, use emplace. + template + T& + build () + { + return emplace (); + } + + /// Instantiate a \a T in here from \a t. + /// Obsolete, use emplace. + template + T& + build (const T& t) + { + return emplace (t); + } + + /// Accessor to a built \a T. + template + T& + as () YY_NOEXCEPT + { + YYASSERT (yytypeid_); + YYASSERT (*yytypeid_ == typeid (T)); + YYASSERT (sizeof (T) <= size); + return *yyas_ (); + } + + /// Const accessor to a built \a T (for %printer). + template + const T& + as () const YY_NOEXCEPT + { + YYASSERT (yytypeid_); + YYASSERT (*yytypeid_ == typeid (T)); + YYASSERT (sizeof (T) <= size); + return *yyas_ (); + } + + /// Swap the content with \a that, of same type. + /// + /// Both variants must be built beforehand, because swapping the actual + /// data requires reading it (with as()), and this is not possible on + /// unconstructed variants: it would require some dynamic testing, which + /// should not be the variant's responsibility. + /// Swapping between built and (possibly) non-built is done with + /// self_type::move (). + template + void + swap (self_type& that) YY_NOEXCEPT + { + YYASSERT (yytypeid_); + YYASSERT (*yytypeid_ == *that.yytypeid_); + std::swap (as (), that.as ()); + } + + /// Move the content of \a that to this. + /// + /// Destroys \a that. + template + void + move (self_type& that) + { +# if 201103L <= YY_CPLUSPLUS + emplace (std::move (that.as ())); +# else + emplace (); + swap (that); +# endif + that.destroy (); + } + +# if 201103L <= YY_CPLUSPLUS + /// Move the content of \a that to this. + template + void + move (self_type&& that) + { + emplace (std::move (that.as ())); + that.destroy (); + } +#endif + + /// Copy the content of \a that to this. + template + void + copy (const self_type& that) + { + emplace (that.as ()); + } + + /// Destroy the stored \a T. + template + void + destroy () + { + as ().~T (); + yytypeid_ = YY_NULLPTR; + } + + private: + /// Prohibit blind copies. + self_type& operator= (const self_type&); + semantic_type (const self_type&); + + /// Accessor to raw memory as \a T. + template + T* + yyas_ () YY_NOEXCEPT + { + void *yyp = yybuffer_.yyraw; + return static_cast (yyp); + } + + /// Const accessor to raw memory as \a T. + template + const T* + yyas_ () const YY_NOEXCEPT + { + const void *yyp = yybuffer_.yyraw; + return static_cast (yyp); + } + + /// An auxiliary type to compute the largest semantic type. + union union_type + { + // columnconstraint + char dummy1[sizeof (ColumnConstraintInfo)]; + + // columnconstraint_list + char dummy2[sizeof (ColumnConstraintInfoVector)]; + + // columndef + char dummy3[sizeof (ColumndefData)]; + + // optional_if_not_exists + // optional_unique + // optional_temporary + // optional_withoutrowid + char dummy4[sizeof (bool)]; + + // tableconstraint + char dummy5[sizeof (sqlb::ConstraintPtr)]; + + // tableconstraint_list + // optional_tableconstraint_list + char dummy6[sizeof (sqlb::ConstraintSet)]; + + // createindex_stmt + char dummy7[sizeof (sqlb::IndexPtr)]; + + // indexed_column + char dummy8[sizeof (sqlb::IndexedColumn)]; + + // indexed_column_list + char dummy9[sizeof (sqlb::IndexedColumnVector)]; + + // columnid_list + // optional_columnid_with_paren_list + char dummy10[sizeof (sqlb::StringVector)]; + + // createvirtualtable_stmt + // createtable_stmt + char dummy11[sizeof (sqlb::TablePtr)]; + + // "ABORT" + // "ACTION" + // "AND" + // "AND BETWEEN" + // "AS" + // "ASC" + // "AUTOINCREMENT" + // "BETWEEN" + // "CASCADE" + // "CASE" + // "CAST" + // "CHECK" + // "COLLATE" + // "CONFLICT" + // "CONSTRAINT" + // "CREATE" + // "CURRENT_DATE" + // "CURRENT_TIME" + // "CURRENT_TIMESTAMP" + // "DEFAULT" + // "DEFERRABLE" + // "DEFERRED" + // "DELETE" + // "DESC" + // "DISTINCT" + // "ELSE" + // "END" + // "ESCAPE" + // "EXISTS" + // "FAIL" + // "FALSE" + // "FILTER" + // "FOLLOWING" + // "FOREIGN" + // "GLOB" + // "IF" + // "IGNORE" + // "IMMEDIATE" + // "IN" + // "INDEX" + // "INITIALLY" + // "INSERT" + // "IS" + // "ISNULL" + // "KEY" + // "LIKE" + // "MATCH" + // "NO" + // "NOT" + // "NOTNULL" + // "NULL" + // "ON" + // "OR" + // "OVER" + // "PARTITION" + // "PRECEDING" + // "PRIMARY" + // "RAISE" + // "RANGE" + // "REFERENCES" + // "REGEXP" + // "REPLACE" + // "RESTRICT" + // "ROLLBACK" + // "ROWID" + // "ROWS" + // "SELECT" + // "SET" + // "TABLE" + // "TEMP" + // "TEMPORARY" + // "THEN" + // "TRUE" + // "UNBOUNDED" + // "UNIQUE" + // "UPDATE" + // "USING" + // "VIRTUAL" + // "WHEN" + // "WHERE" + // "WITHOUT" + // "identifier" + // "numeric" + // "string literal" + // "quoted literal" + // "blob literal" + // "bind parameter" + // literalvalue + // id + // allowed_keywords_as_identifier + // tableid + // columnid + // signednumber + // signednumber_or_numeric + // typename_namelist + // type_name + // unary_expr + // binary_expr + // like_expr + // exprlist_expr + // function_expr + // isnull_expr + // between_expr + // in_expr + // whenthenlist_expr + // case_expr + // raise_expr + // expr + // select_stmt + // optional_sort_order + // optional_where + // tableid_with_uninteresting_schema + // optional_exprlist_with_paren + // optional_conflictclause + // optional_typename + // optional_constraintname + // fk_clause_part + // fk_clause_part_list + // optional_fk_clause + char dummy12[sizeof (std::string)]; + + // columndef_list + char dummy13[sizeof (std::vector)]; + }; + + /// The size of the largest semantic type. + enum { size = sizeof (union_type) }; + + /// A buffer to store semantic values. + union + { + /// Strongest alignment constraints. + long double yyalign_me; + /// A buffer large enough to store any of the semantic values. + char yyraw[size]; + } yybuffer_; + + /// Whether the content is built: if defined, the name of the stored type. + const std::type_info *yytypeid_; + }; + +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef location location_type; + + /// Syntax errors thrown from user actions. + struct syntax_error : std::runtime_error + { + syntax_error (const location_type& l, const std::string& m) + : std::runtime_error (m) + , location (l) + {} + + syntax_error (const syntax_error& s) + : std::runtime_error (s.what ()) + , location (s.location) + {} + + ~syntax_error () YY_NOEXCEPT YY_NOTHROW; + + location_type location; + }; + + /// Tokens. + struct token + { + enum yytokentype + { + TOK_EOF = 0, + TOK_LPAREN = 258, + TOK_RPAREN = 259, + TOK_DOT = 260, + TOK_COMMA = 261, + TOK_SEMI = 262, + TOK_PLUS = 263, + TOK_MINUS = 264, + TOK_STAR = 265, + TOK_SLASH = 266, + TOK_TILDE = 267, + TOK_AMPERSAND = 268, + TOK_PERCENT = 269, + TOK_BITOR = 270, + TOK_OROP = 271, + TOK_EQUAL = 272, + TOK_EQUAL2 = 273, + TOK_GREATER = 274, + TOK_GREATEREQUAL = 275, + TOK_LOWER = 276, + TOK_LOWEREQUAL = 277, + TOK_UNEQUAL = 278, + TOK_UNEQUAL2 = 279, + TOK_BITWISELEFT = 280, + TOK_BITWISERIGHT = 281, + TOK_ABORT = 282, + TOK_ACTION = 283, + TOK_AND = 284, + TOK_AND_BETWEEN = 285, + TOK_AS = 286, + TOK_ASC = 287, + TOK_AUTOINCREMENT = 288, + TOK_BETWEEN = 289, + TOK_CASCADE = 290, + TOK_CASE = 291, + TOK_CAST = 292, + TOK_CHECK = 293, + TOK_COLLATE = 294, + TOK_CONFLICT = 295, + TOK_CONSTRAINT = 296, + TOK_CREATE = 297, + TOK_CURRENT_DATE = 298, + TOK_CURRENT_TIME = 299, + TOK_CURRENT_TIMESTAMP = 300, + TOK_DEFAULT = 301, + TOK_DEFERRABLE = 302, + TOK_DEFERRED = 303, + TOK_DELETE = 304, + TOK_DESC = 305, + TOK_DISTINCT = 306, + TOK_ELSE = 307, + TOK_END = 308, + TOK_ESCAPE = 309, + TOK_EXISTS = 310, + TOK_FAIL = 311, + TOK_FALSE = 312, + TOK_FILTER = 313, + TOK_FOLLOWING = 314, + TOK_FOREIGN = 315, + TOK_GLOB = 316, + TOK_IF = 317, + TOK_IGNORE = 318, + TOK_IMMEDIATE = 319, + TOK_IN = 320, + TOK_INDEX = 321, + TOK_INITIALLY = 322, + TOK_INSERT = 323, + TOK_IS = 324, + TOK_ISNULL = 325, + TOK_KEY = 326, + TOK_LIKE = 327, + TOK_MATCH = 328, + TOK_NO = 329, + TOK_NOT = 330, + TOK_NOTNULL = 331, + TOK_NULL = 332, + TOK_ON = 333, + TOK_OR = 334, + TOK_OVER = 335, + TOK_PARTITION = 336, + TOK_PRECEDING = 337, + TOK_PRIMARY = 338, + TOK_RAISE = 339, + TOK_RANGE = 340, + TOK_REFERENCES = 341, + TOK_REGEXP = 342, + TOK_REPLACE = 343, + TOK_RESTRICT = 344, + TOK_ROLLBACK = 345, + TOK_ROWID = 346, + TOK_ROWS = 347, + TOK_SELECT = 348, + TOK_SET = 349, + TOK_TABLE = 350, + TOK_TEMP = 351, + TOK_TEMPORARY = 352, + TOK_THEN = 353, + TOK_TRUE = 354, + TOK_UNBOUNDED = 355, + TOK_UNIQUE = 356, + TOK_UPDATE = 357, + TOK_USING = 358, + TOK_VIRTUAL = 359, + TOK_WHEN = 360, + TOK_WHERE = 361, + TOK_WITHOUT = 362, + TOK_IDENTIFIER = 363, + TOK_NUMERIC = 364, + TOK_STRINGLITERAL = 365, + TOK_QUOTEDLITERAL = 366, + TOK_BLOBLITERAL = 367, + TOK_BINDPARAMETER = 368 + }; + }; + + /// (External) token type, as returned by yylex. + typedef token::yytokentype token_type; + + /// Symbol type: an internal symbol number. + typedef int symbol_number_type; + + /// The symbol type number to denote an empty symbol. + enum { empty_symbol = -2 }; + + /// Internal symbol number for tokens (subsumed by symbol_number_type). + typedef unsigned char token_number_type; + + /// A complete symbol. + /// + /// Expects its Base type to provide access to the symbol type + /// via type_get (). + /// + /// Provide access to semantic value and location. + template + struct basic_symbol : Base + { + /// Alias to Base. + typedef Base super_type; + + /// Default constructor. + basic_symbol () + : value () + , location () + {} + +#if 201103L <= YY_CPLUSPLUS + /// Move constructor. + basic_symbol (basic_symbol&& that); +#endif + + /// Copy constructor. + basic_symbol (const basic_symbol& that); + + /// Constructor for valueless symbols, and symbols from each type. +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, location_type&& l) + : Base (t) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const location_type& l) + : Base (t) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, ColumnConstraintInfo&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const ColumnConstraintInfo& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, ColumnConstraintInfoVector&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const ColumnConstraintInfoVector& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, ColumndefData&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const ColumndefData& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, bool&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const bool& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, sqlb::ConstraintPtr&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const sqlb::ConstraintPtr& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, sqlb::ConstraintSet&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const sqlb::ConstraintSet& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, sqlb::IndexPtr&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const sqlb::IndexPtr& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, sqlb::IndexedColumn&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const sqlb::IndexedColumn& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, sqlb::IndexedColumnVector&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const sqlb::IndexedColumnVector& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, sqlb::StringVector&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const sqlb::StringVector& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, sqlb::TablePtr&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const sqlb::TablePtr& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif +#if 201103L <= YY_CPLUSPLUS + basic_symbol (typename Base::kind_type t, std::vector&& v, location_type&& l) + : Base (t) + , value (std::move (v)) + , location (std::move (l)) + {} +#else + basic_symbol (typename Base::kind_type t, const std::vector& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} +#endif + + /// Destroy the symbol. + ~basic_symbol () + { + clear (); + } + + /// Destroy contents, and record that is empty. + void clear () + { + // User destructor. + symbol_number_type yytype = this->type_get (); + basic_symbol& yysym = *this; + (void) yysym; + switch (yytype) + { + default: + break; + } + + // Type destructor. +switch (yytype) + { + case 153: // columnconstraint + value.template destroy< ColumnConstraintInfo > (); + break; + + case 154: // columnconstraint_list + value.template destroy< ColumnConstraintInfoVector > (); + break; + + case 155: // columndef + value.template destroy< ColumndefData > (); + break; + + case 139: // optional_if_not_exists + case 141: // optional_unique + case 149: // optional_temporary + case 150: // optional_withoutrowid + value.template destroy< bool > (); + break; + + case 163: // tableconstraint + value.template destroy< sqlb::ConstraintPtr > (); + break; + + case 164: // tableconstraint_list + case 165: // optional_tableconstraint_list + value.template destroy< sqlb::ConstraintSet > (); + break; + + case 146: // createindex_stmt + value.template destroy< sqlb::IndexPtr > (); + break; + + case 144: // indexed_column + value.template destroy< sqlb::IndexedColumn > (); + break; + + case 145: // indexed_column_list + value.template destroy< sqlb::IndexedColumnVector > (); + break; + + case 158: // columnid_list + case 159: // optional_columnid_with_paren_list + value.template destroy< sqlb::StringVector > (); + break; + + case 148: // createvirtualtable_stmt + case 166: // createtable_stmt + value.template destroy< sqlb::TablePtr > (); + break; + + case 27: // "ABORT" + case 28: // "ACTION" + case 29: // "AND" + case 30: // "AND BETWEEN" + case 31: // "AS" + case 32: // "ASC" + case 33: // "AUTOINCREMENT" + case 34: // "BETWEEN" + case 35: // "CASCADE" + case 36: // "CASE" + case 37: // "CAST" + case 38: // "CHECK" + case 39: // "COLLATE" + case 40: // "CONFLICT" + case 41: // "CONSTRAINT" + case 42: // "CREATE" + case 43: // "CURRENT_DATE" + case 44: // "CURRENT_TIME" + case 45: // "CURRENT_TIMESTAMP" + case 46: // "DEFAULT" + case 47: // "DEFERRABLE" + case 48: // "DEFERRED" + case 49: // "DELETE" + case 50: // "DESC" + case 51: // "DISTINCT" + case 52: // "ELSE" + case 53: // "END" + case 54: // "ESCAPE" + case 55: // "EXISTS" + case 56: // "FAIL" + case 57: // "FALSE" + case 58: // "FILTER" + case 59: // "FOLLOWING" + case 60: // "FOREIGN" + case 61: // "GLOB" + case 62: // "IF" + case 63: // "IGNORE" + case 64: // "IMMEDIATE" + case 65: // "IN" + case 66: // "INDEX" + case 67: // "INITIALLY" + case 68: // "INSERT" + case 69: // "IS" + case 70: // "ISNULL" + case 71: // "KEY" + case 72: // "LIKE" + case 73: // "MATCH" + case 74: // "NO" + case 75: // "NOT" + case 76: // "NOTNULL" + case 77: // "NULL" + case 78: // "ON" + case 79: // "OR" + case 80: // "OVER" + case 81: // "PARTITION" + case 82: // "PRECEDING" + case 83: // "PRIMARY" + case 84: // "RAISE" + case 85: // "RANGE" + case 86: // "REFERENCES" + case 87: // "REGEXP" + case 88: // "REPLACE" + case 89: // "RESTRICT" + case 90: // "ROLLBACK" + case 91: // "ROWID" + case 92: // "ROWS" + case 93: // "SELECT" + case 94: // "SET" + case 95: // "TABLE" + case 96: // "TEMP" + case 97: // "TEMPORARY" + case 98: // "THEN" + case 99: // "TRUE" + case 100: // "UNBOUNDED" + case 101: // "UNIQUE" + case 102: // "UPDATE" + case 103: // "USING" + case 104: // "VIRTUAL" + case 105: // "WHEN" + case 106: // "WHERE" + case 107: // "WITHOUT" + case 108: // "identifier" + case 109: // "numeric" + case 110: // "string literal" + case 111: // "quoted literal" + case 112: // "blob literal" + case 113: // "bind parameter" + case 117: // literalvalue + case 118: // id + case 119: // allowed_keywords_as_identifier + case 120: // tableid + case 121: // columnid + case 122: // signednumber + case 123: // signednumber_or_numeric + case 124: // typename_namelist + case 125: // type_name + case 126: // unary_expr + case 127: // binary_expr + case 128: // like_expr + case 129: // exprlist_expr + case 130: // function_expr + case 131: // isnull_expr + case 132: // between_expr + case 133: // in_expr + case 134: // whenthenlist_expr + case 135: // case_expr + case 136: // raise_expr + case 137: // expr + case 138: // select_stmt + case 140: // optional_sort_order + case 142: // optional_where + case 143: // tableid_with_uninteresting_schema + case 147: // optional_exprlist_with_paren + case 151: // optional_conflictclause + case 152: // optional_typename + case 157: // optional_constraintname + case 160: // fk_clause_part + case 161: // fk_clause_part_list + case 162: // optional_fk_clause + value.template destroy< std::string > (); + break; + + case 156: // columndef_list + value.template destroy< std::vector > (); + break; + + default: + break; + } + + Base::clear (); + } + + /// Whether empty. + bool empty () const YY_NOEXCEPT; + + /// Destructive move, \a s is emptied into this. + void move (basic_symbol& s); + + /// The semantic value. + semantic_type value; + + /// The location. + location_type location; + + private: +#if YY_CPLUSPLUS < 201103L + /// Assignment operator. + basic_symbol& operator= (const basic_symbol& that); +#endif + }; + + /// Type access provider for token (enum) based symbols. + struct by_type + { + /// Default constructor. + by_type (); + +#if 201103L <= YY_CPLUSPLUS + /// Move constructor. + by_type (by_type&& that); +#endif + + /// Copy constructor. + by_type (const by_type& that); + + /// The symbol type as needed by the constructor. + typedef token_type kind_type; + + /// Constructor from (external) token numbers. + by_type (kind_type t); + + /// Record that this symbol is empty. + void clear (); + + /// Steal the symbol type from \a that. + void move (by_type& that); + + /// The (internal) type number (corresponding to \a type). + /// \a empty when empty. + symbol_number_type type_get () const YY_NOEXCEPT; + + /// The token. + token_type token () const YY_NOEXCEPT; + + /// The symbol type. + /// \a empty_symbol when empty. + /// An int, not token_number_type, to be able to store empty_symbol. + int type; + }; + + /// "External" symbols: returned by the scanner. + struct symbol_type : basic_symbol + { + /// Superclass. + typedef basic_symbol super_type; + + /// Empty symbol. + symbol_type () {} + + /// Constructor for valueless symbols, and symbols from each type. +#if 201103L <= YY_CPLUSPLUS + symbol_type (int tok, location_type l) + : super_type(token_type (tok), std::move (l)) + { + YYASSERT (tok == token::TOK_EOF || tok == token::TOK_LPAREN || tok == token::TOK_RPAREN || tok == token::TOK_DOT || tok == token::TOK_COMMA || tok == token::TOK_SEMI || tok == token::TOK_PLUS || tok == token::TOK_MINUS || tok == token::TOK_STAR || tok == token::TOK_SLASH || tok == token::TOK_TILDE || tok == token::TOK_AMPERSAND || tok == token::TOK_PERCENT || tok == token::TOK_BITOR || tok == token::TOK_OROP || tok == token::TOK_EQUAL || tok == token::TOK_EQUAL2 || tok == token::TOK_GREATER || tok == token::TOK_GREATEREQUAL || tok == token::TOK_LOWER || tok == token::TOK_LOWEREQUAL || tok == token::TOK_UNEQUAL || tok == token::TOK_UNEQUAL2 || tok == token::TOK_BITWISELEFT || tok == token::TOK_BITWISERIGHT); + } +#else + symbol_type (int tok, const location_type& l) + : super_type(token_type (tok), l) + { + YYASSERT (tok == token::TOK_EOF || tok == token::TOK_LPAREN || tok == token::TOK_RPAREN || tok == token::TOK_DOT || tok == token::TOK_COMMA || tok == token::TOK_SEMI || tok == token::TOK_PLUS || tok == token::TOK_MINUS || tok == token::TOK_STAR || tok == token::TOK_SLASH || tok == token::TOK_TILDE || tok == token::TOK_AMPERSAND || tok == token::TOK_PERCENT || tok == token::TOK_BITOR || tok == token::TOK_OROP || tok == token::TOK_EQUAL || tok == token::TOK_EQUAL2 || tok == token::TOK_GREATER || tok == token::TOK_GREATEREQUAL || tok == token::TOK_LOWER || tok == token::TOK_LOWEREQUAL || tok == token::TOK_UNEQUAL || tok == token::TOK_UNEQUAL2 || tok == token::TOK_BITWISELEFT || tok == token::TOK_BITWISERIGHT); + } +#endif +#if 201103L <= YY_CPLUSPLUS + symbol_type (int tok, std::string v, location_type l) + : super_type(token_type (tok), std::move (v), std::move (l)) + { + YYASSERT (tok == token::TOK_ABORT || tok == token::TOK_ACTION || tok == token::TOK_AND || tok == token::TOK_AND_BETWEEN || tok == token::TOK_AS || tok == token::TOK_ASC || tok == token::TOK_AUTOINCREMENT || tok == token::TOK_BETWEEN || tok == token::TOK_CASCADE || tok == token::TOK_CASE || tok == token::TOK_CAST || tok == token::TOK_CHECK || tok == token::TOK_COLLATE || tok == token::TOK_CONFLICT || tok == token::TOK_CONSTRAINT || tok == token::TOK_CREATE || tok == token::TOK_CURRENT_DATE || tok == token::TOK_CURRENT_TIME || tok == token::TOK_CURRENT_TIMESTAMP || tok == token::TOK_DEFAULT || tok == token::TOK_DEFERRABLE || tok == token::TOK_DEFERRED || tok == token::TOK_DELETE || tok == token::TOK_DESC || tok == token::TOK_DISTINCT || tok == token::TOK_ELSE || tok == token::TOK_END || tok == token::TOK_ESCAPE || tok == token::TOK_EXISTS || tok == token::TOK_FAIL || tok == token::TOK_FALSE || tok == token::TOK_FILTER || tok == token::TOK_FOLLOWING || tok == token::TOK_FOREIGN || tok == token::TOK_GLOB || tok == token::TOK_IF || tok == token::TOK_IGNORE || tok == token::TOK_IMMEDIATE || tok == token::TOK_IN || tok == token::TOK_INDEX || tok == token::TOK_INITIALLY || tok == token::TOK_INSERT || tok == token::TOK_IS || tok == token::TOK_ISNULL || tok == token::TOK_KEY || tok == token::TOK_LIKE || tok == token::TOK_MATCH || tok == token::TOK_NO || tok == token::TOK_NOT || tok == token::TOK_NOTNULL || tok == token::TOK_NULL || tok == token::TOK_ON || tok == token::TOK_OR || tok == token::TOK_OVER || tok == token::TOK_PARTITION || tok == token::TOK_PRECEDING || tok == token::TOK_PRIMARY || tok == token::TOK_RAISE || tok == token::TOK_RANGE || tok == token::TOK_REFERENCES || tok == token::TOK_REGEXP || tok == token::TOK_REPLACE || tok == token::TOK_RESTRICT || tok == token::TOK_ROLLBACK || tok == token::TOK_ROWID || tok == token::TOK_ROWS || tok == token::TOK_SELECT || tok == token::TOK_SET || tok == token::TOK_TABLE || tok == token::TOK_TEMP || tok == token::TOK_TEMPORARY || tok == token::TOK_THEN || tok == token::TOK_TRUE || tok == token::TOK_UNBOUNDED || tok == token::TOK_UNIQUE || tok == token::TOK_UPDATE || tok == token::TOK_USING || tok == token::TOK_VIRTUAL || tok == token::TOK_WHEN || tok == token::TOK_WHERE || tok == token::TOK_WITHOUT || tok == token::TOK_IDENTIFIER || tok == token::TOK_NUMERIC || tok == token::TOK_STRINGLITERAL || tok == token::TOK_QUOTEDLITERAL || tok == token::TOK_BLOBLITERAL || tok == token::TOK_BINDPARAMETER); + } +#else + symbol_type (int tok, const std::string& v, const location_type& l) + : super_type(token_type (tok), v, l) + { + YYASSERT (tok == token::TOK_ABORT || tok == token::TOK_ACTION || tok == token::TOK_AND || tok == token::TOK_AND_BETWEEN || tok == token::TOK_AS || tok == token::TOK_ASC || tok == token::TOK_AUTOINCREMENT || tok == token::TOK_BETWEEN || tok == token::TOK_CASCADE || tok == token::TOK_CASE || tok == token::TOK_CAST || tok == token::TOK_CHECK || tok == token::TOK_COLLATE || tok == token::TOK_CONFLICT || tok == token::TOK_CONSTRAINT || tok == token::TOK_CREATE || tok == token::TOK_CURRENT_DATE || tok == token::TOK_CURRENT_TIME || tok == token::TOK_CURRENT_TIMESTAMP || tok == token::TOK_DEFAULT || tok == token::TOK_DEFERRABLE || tok == token::TOK_DEFERRED || tok == token::TOK_DELETE || tok == token::TOK_DESC || tok == token::TOK_DISTINCT || tok == token::TOK_ELSE || tok == token::TOK_END || tok == token::TOK_ESCAPE || tok == token::TOK_EXISTS || tok == token::TOK_FAIL || tok == token::TOK_FALSE || tok == token::TOK_FILTER || tok == token::TOK_FOLLOWING || tok == token::TOK_FOREIGN || tok == token::TOK_GLOB || tok == token::TOK_IF || tok == token::TOK_IGNORE || tok == token::TOK_IMMEDIATE || tok == token::TOK_IN || tok == token::TOK_INDEX || tok == token::TOK_INITIALLY || tok == token::TOK_INSERT || tok == token::TOK_IS || tok == token::TOK_ISNULL || tok == token::TOK_KEY || tok == token::TOK_LIKE || tok == token::TOK_MATCH || tok == token::TOK_NO || tok == token::TOK_NOT || tok == token::TOK_NOTNULL || tok == token::TOK_NULL || tok == token::TOK_ON || tok == token::TOK_OR || tok == token::TOK_OVER || tok == token::TOK_PARTITION || tok == token::TOK_PRECEDING || tok == token::TOK_PRIMARY || tok == token::TOK_RAISE || tok == token::TOK_RANGE || tok == token::TOK_REFERENCES || tok == token::TOK_REGEXP || tok == token::TOK_REPLACE || tok == token::TOK_RESTRICT || tok == token::TOK_ROLLBACK || tok == token::TOK_ROWID || tok == token::TOK_ROWS || tok == token::TOK_SELECT || tok == token::TOK_SET || tok == token::TOK_TABLE || tok == token::TOK_TEMP || tok == token::TOK_TEMPORARY || tok == token::TOK_THEN || tok == token::TOK_TRUE || tok == token::TOK_UNBOUNDED || tok == token::TOK_UNIQUE || tok == token::TOK_UPDATE || tok == token::TOK_USING || tok == token::TOK_VIRTUAL || tok == token::TOK_WHEN || tok == token::TOK_WHERE || tok == token::TOK_WITHOUT || tok == token::TOK_IDENTIFIER || tok == token::TOK_NUMERIC || tok == token::TOK_STRINGLITERAL || tok == token::TOK_QUOTEDLITERAL || tok == token::TOK_BLOBLITERAL || tok == token::TOK_BINDPARAMETER); + } +#endif + }; + + /// Build a parser object. + parser (yyscan_t yyscanner_yyarg, ParserDriver& drv_yyarg); + virtual ~parser (); + + /// Parse. An alias for parse (). + /// \returns 0 iff parsing succeeded. + int operator() (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if YYDEBUG + /// The current debugging stream. + std::ostream& debug_stream () const YY_ATTRIBUTE_PURE; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const YY_ATTRIBUTE_PURE; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Report a syntax error. + void error (const syntax_error& err); + + // Implementation of make_symbol for each symbol type. +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_EOF (location_type l) + { + return symbol_type (token::TOK_EOF, std::move (l)); + } +#else + static + symbol_type + make_EOF (const location_type& l) + { + return symbol_type (token::TOK_EOF, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_LPAREN (location_type l) + { + return symbol_type (token::TOK_LPAREN, std::move (l)); + } +#else + static + symbol_type + make_LPAREN (const location_type& l) + { + return symbol_type (token::TOK_LPAREN, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_RPAREN (location_type l) + { + return symbol_type (token::TOK_RPAREN, std::move (l)); + } +#else + static + symbol_type + make_RPAREN (const location_type& l) + { + return symbol_type (token::TOK_RPAREN, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_DOT (location_type l) + { + return symbol_type (token::TOK_DOT, std::move (l)); + } +#else + static + symbol_type + make_DOT (const location_type& l) + { + return symbol_type (token::TOK_DOT, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_COMMA (location_type l) + { + return symbol_type (token::TOK_COMMA, std::move (l)); + } +#else + static + symbol_type + make_COMMA (const location_type& l) + { + return symbol_type (token::TOK_COMMA, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_SEMI (location_type l) + { + return symbol_type (token::TOK_SEMI, std::move (l)); + } +#else + static + symbol_type + make_SEMI (const location_type& l) + { + return symbol_type (token::TOK_SEMI, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_PLUS (location_type l) + { + return symbol_type (token::TOK_PLUS, std::move (l)); + } +#else + static + symbol_type + make_PLUS (const location_type& l) + { + return symbol_type (token::TOK_PLUS, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_MINUS (location_type l) + { + return symbol_type (token::TOK_MINUS, std::move (l)); + } +#else + static + symbol_type + make_MINUS (const location_type& l) + { + return symbol_type (token::TOK_MINUS, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_STAR (location_type l) + { + return symbol_type (token::TOK_STAR, std::move (l)); + } +#else + static + symbol_type + make_STAR (const location_type& l) + { + return symbol_type (token::TOK_STAR, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_SLASH (location_type l) + { + return symbol_type (token::TOK_SLASH, std::move (l)); + } +#else + static + symbol_type + make_SLASH (const location_type& l) + { + return symbol_type (token::TOK_SLASH, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_TILDE (location_type l) + { + return symbol_type (token::TOK_TILDE, std::move (l)); + } +#else + static + symbol_type + make_TILDE (const location_type& l) + { + return symbol_type (token::TOK_TILDE, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_AMPERSAND (location_type l) + { + return symbol_type (token::TOK_AMPERSAND, std::move (l)); + } +#else + static + symbol_type + make_AMPERSAND (const location_type& l) + { + return symbol_type (token::TOK_AMPERSAND, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_PERCENT (location_type l) + { + return symbol_type (token::TOK_PERCENT, std::move (l)); + } +#else + static + symbol_type + make_PERCENT (const location_type& l) + { + return symbol_type (token::TOK_PERCENT, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_BITOR (location_type l) + { + return symbol_type (token::TOK_BITOR, std::move (l)); + } +#else + static + symbol_type + make_BITOR (const location_type& l) + { + return symbol_type (token::TOK_BITOR, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_OROP (location_type l) + { + return symbol_type (token::TOK_OROP, std::move (l)); + } +#else + static + symbol_type + make_OROP (const location_type& l) + { + return symbol_type (token::TOK_OROP, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_EQUAL (location_type l) + { + return symbol_type (token::TOK_EQUAL, std::move (l)); + } +#else + static + symbol_type + make_EQUAL (const location_type& l) + { + return symbol_type (token::TOK_EQUAL, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_EQUAL2 (location_type l) + { + return symbol_type (token::TOK_EQUAL2, std::move (l)); + } +#else + static + symbol_type + make_EQUAL2 (const location_type& l) + { + return symbol_type (token::TOK_EQUAL2, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_GREATER (location_type l) + { + return symbol_type (token::TOK_GREATER, std::move (l)); + } +#else + static + symbol_type + make_GREATER (const location_type& l) + { + return symbol_type (token::TOK_GREATER, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_GREATEREQUAL (location_type l) + { + return symbol_type (token::TOK_GREATEREQUAL, std::move (l)); + } +#else + static + symbol_type + make_GREATEREQUAL (const location_type& l) + { + return symbol_type (token::TOK_GREATEREQUAL, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_LOWER (location_type l) + { + return symbol_type (token::TOK_LOWER, std::move (l)); + } +#else + static + symbol_type + make_LOWER (const location_type& l) + { + return symbol_type (token::TOK_LOWER, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_LOWEREQUAL (location_type l) + { + return symbol_type (token::TOK_LOWEREQUAL, std::move (l)); + } +#else + static + symbol_type + make_LOWEREQUAL (const location_type& l) + { + return symbol_type (token::TOK_LOWEREQUAL, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_UNEQUAL (location_type l) + { + return symbol_type (token::TOK_UNEQUAL, std::move (l)); + } +#else + static + symbol_type + make_UNEQUAL (const location_type& l) + { + return symbol_type (token::TOK_UNEQUAL, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_UNEQUAL2 (location_type l) + { + return symbol_type (token::TOK_UNEQUAL2, std::move (l)); + } +#else + static + symbol_type + make_UNEQUAL2 (const location_type& l) + { + return symbol_type (token::TOK_UNEQUAL2, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_BITWISELEFT (location_type l) + { + return symbol_type (token::TOK_BITWISELEFT, std::move (l)); + } +#else + static + symbol_type + make_BITWISELEFT (const location_type& l) + { + return symbol_type (token::TOK_BITWISELEFT, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_BITWISERIGHT (location_type l) + { + return symbol_type (token::TOK_BITWISERIGHT, std::move (l)); + } +#else + static + symbol_type + make_BITWISERIGHT (const location_type& l) + { + return symbol_type (token::TOK_BITWISERIGHT, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ABORT (std::string v, location_type l) + { + return symbol_type (token::TOK_ABORT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ABORT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ABORT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ACTION (std::string v, location_type l) + { + return symbol_type (token::TOK_ACTION, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ACTION (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ACTION, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_AND (std::string v, location_type l) + { + return symbol_type (token::TOK_AND, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_AND (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_AND, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_AND_BETWEEN (std::string v, location_type l) + { + return symbol_type (token::TOK_AND_BETWEEN, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_AND_BETWEEN (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_AND_BETWEEN, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_AS (std::string v, location_type l) + { + return symbol_type (token::TOK_AS, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_AS (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_AS, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ASC (std::string v, location_type l) + { + return symbol_type (token::TOK_ASC, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ASC (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ASC, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_AUTOINCREMENT (std::string v, location_type l) + { + return symbol_type (token::TOK_AUTOINCREMENT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_AUTOINCREMENT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_AUTOINCREMENT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_BETWEEN (std::string v, location_type l) + { + return symbol_type (token::TOK_BETWEEN, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_BETWEEN (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_BETWEEN, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CASCADE (std::string v, location_type l) + { + return symbol_type (token::TOK_CASCADE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CASCADE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CASCADE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CASE (std::string v, location_type l) + { + return symbol_type (token::TOK_CASE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CASE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CASE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CAST (std::string v, location_type l) + { + return symbol_type (token::TOK_CAST, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CAST (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CAST, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CHECK (std::string v, location_type l) + { + return symbol_type (token::TOK_CHECK, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CHECK (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CHECK, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_COLLATE (std::string v, location_type l) + { + return symbol_type (token::TOK_COLLATE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_COLLATE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_COLLATE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CONFLICT (std::string v, location_type l) + { + return symbol_type (token::TOK_CONFLICT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CONFLICT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CONFLICT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CONSTRAINT (std::string v, location_type l) + { + return symbol_type (token::TOK_CONSTRAINT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CONSTRAINT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CONSTRAINT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CREATE (std::string v, location_type l) + { + return symbol_type (token::TOK_CREATE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CREATE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CREATE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CURRENT_DATE (std::string v, location_type l) + { + return symbol_type (token::TOK_CURRENT_DATE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CURRENT_DATE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CURRENT_DATE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CURRENT_TIME (std::string v, location_type l) + { + return symbol_type (token::TOK_CURRENT_TIME, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CURRENT_TIME (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CURRENT_TIME, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_CURRENT_TIMESTAMP (std::string v, location_type l) + { + return symbol_type (token::TOK_CURRENT_TIMESTAMP, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_CURRENT_TIMESTAMP (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_CURRENT_TIMESTAMP, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_DEFAULT (std::string v, location_type l) + { + return symbol_type (token::TOK_DEFAULT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_DEFAULT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_DEFAULT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_DEFERRABLE (std::string v, location_type l) + { + return symbol_type (token::TOK_DEFERRABLE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_DEFERRABLE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_DEFERRABLE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_DEFERRED (std::string v, location_type l) + { + return symbol_type (token::TOK_DEFERRED, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_DEFERRED (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_DEFERRED, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_DELETE (std::string v, location_type l) + { + return symbol_type (token::TOK_DELETE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_DELETE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_DELETE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_DESC (std::string v, location_type l) + { + return symbol_type (token::TOK_DESC, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_DESC (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_DESC, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_DISTINCT (std::string v, location_type l) + { + return symbol_type (token::TOK_DISTINCT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_DISTINCT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_DISTINCT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ELSE (std::string v, location_type l) + { + return symbol_type (token::TOK_ELSE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ELSE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ELSE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_END (std::string v, location_type l) + { + return symbol_type (token::TOK_END, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_END (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_END, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ESCAPE (std::string v, location_type l) + { + return symbol_type (token::TOK_ESCAPE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ESCAPE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ESCAPE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_EXISTS (std::string v, location_type l) + { + return symbol_type (token::TOK_EXISTS, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_EXISTS (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_EXISTS, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_FAIL (std::string v, location_type l) + { + return symbol_type (token::TOK_FAIL, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_FAIL (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_FAIL, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_FALSE (std::string v, location_type l) + { + return symbol_type (token::TOK_FALSE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_FALSE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_FALSE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_FILTER (std::string v, location_type l) + { + return symbol_type (token::TOK_FILTER, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_FILTER (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_FILTER, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_FOLLOWING (std::string v, location_type l) + { + return symbol_type (token::TOK_FOLLOWING, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_FOLLOWING (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_FOLLOWING, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_FOREIGN (std::string v, location_type l) + { + return symbol_type (token::TOK_FOREIGN, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_FOREIGN (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_FOREIGN, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_GLOB (std::string v, location_type l) + { + return symbol_type (token::TOK_GLOB, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_GLOB (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_GLOB, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_IF (std::string v, location_type l) + { + return symbol_type (token::TOK_IF, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_IF (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_IF, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_IGNORE (std::string v, location_type l) + { + return symbol_type (token::TOK_IGNORE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_IGNORE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_IGNORE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_IMMEDIATE (std::string v, location_type l) + { + return symbol_type (token::TOK_IMMEDIATE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_IMMEDIATE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_IMMEDIATE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_IN (std::string v, location_type l) + { + return symbol_type (token::TOK_IN, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_IN (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_IN, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_INDEX (std::string v, location_type l) + { + return symbol_type (token::TOK_INDEX, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_INDEX (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_INDEX, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_INITIALLY (std::string v, location_type l) + { + return symbol_type (token::TOK_INITIALLY, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_INITIALLY (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_INITIALLY, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_INSERT (std::string v, location_type l) + { + return symbol_type (token::TOK_INSERT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_INSERT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_INSERT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_IS (std::string v, location_type l) + { + return symbol_type (token::TOK_IS, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_IS (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_IS, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ISNULL (std::string v, location_type l) + { + return symbol_type (token::TOK_ISNULL, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ISNULL (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ISNULL, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_KEY (std::string v, location_type l) + { + return symbol_type (token::TOK_KEY, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_KEY (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_KEY, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_LIKE (std::string v, location_type l) + { + return symbol_type (token::TOK_LIKE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_LIKE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_LIKE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_MATCH (std::string v, location_type l) + { + return symbol_type (token::TOK_MATCH, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_MATCH (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_MATCH, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_NO (std::string v, location_type l) + { + return symbol_type (token::TOK_NO, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_NO (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_NO, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_NOT (std::string v, location_type l) + { + return symbol_type (token::TOK_NOT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_NOT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_NOT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_NOTNULL (std::string v, location_type l) + { + return symbol_type (token::TOK_NOTNULL, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_NOTNULL (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_NOTNULL, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_NULL (std::string v, location_type l) + { + return symbol_type (token::TOK_NULL, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_NULL (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_NULL, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ON (std::string v, location_type l) + { + return symbol_type (token::TOK_ON, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ON (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ON, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_OR (std::string v, location_type l) + { + return symbol_type (token::TOK_OR, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_OR (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_OR, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_OVER (std::string v, location_type l) + { + return symbol_type (token::TOK_OVER, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_OVER (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_OVER, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_PARTITION (std::string v, location_type l) + { + return symbol_type (token::TOK_PARTITION, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_PARTITION (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_PARTITION, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_PRECEDING (std::string v, location_type l) + { + return symbol_type (token::TOK_PRECEDING, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_PRECEDING (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_PRECEDING, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_PRIMARY (std::string v, location_type l) + { + return symbol_type (token::TOK_PRIMARY, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_PRIMARY (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_PRIMARY, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_RAISE (std::string v, location_type l) + { + return symbol_type (token::TOK_RAISE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_RAISE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_RAISE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_RANGE (std::string v, location_type l) + { + return symbol_type (token::TOK_RANGE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_RANGE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_RANGE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_REFERENCES (std::string v, location_type l) + { + return symbol_type (token::TOK_REFERENCES, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_REFERENCES (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_REFERENCES, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_REGEXP (std::string v, location_type l) + { + return symbol_type (token::TOK_REGEXP, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_REGEXP (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_REGEXP, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_REPLACE (std::string v, location_type l) + { + return symbol_type (token::TOK_REPLACE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_REPLACE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_REPLACE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_RESTRICT (std::string v, location_type l) + { + return symbol_type (token::TOK_RESTRICT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_RESTRICT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_RESTRICT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ROLLBACK (std::string v, location_type l) + { + return symbol_type (token::TOK_ROLLBACK, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ROLLBACK (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ROLLBACK, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ROWID (std::string v, location_type l) + { + return symbol_type (token::TOK_ROWID, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ROWID (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ROWID, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_ROWS (std::string v, location_type l) + { + return symbol_type (token::TOK_ROWS, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_ROWS (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_ROWS, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_SELECT (std::string v, location_type l) + { + return symbol_type (token::TOK_SELECT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_SELECT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_SELECT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_SET (std::string v, location_type l) + { + return symbol_type (token::TOK_SET, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_SET (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_SET, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_TABLE (std::string v, location_type l) + { + return symbol_type (token::TOK_TABLE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_TABLE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_TABLE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_TEMP (std::string v, location_type l) + { + return symbol_type (token::TOK_TEMP, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_TEMP (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_TEMP, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_TEMPORARY (std::string v, location_type l) + { + return symbol_type (token::TOK_TEMPORARY, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_TEMPORARY (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_TEMPORARY, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_THEN (std::string v, location_type l) + { + return symbol_type (token::TOK_THEN, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_THEN (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_THEN, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_TRUE (std::string v, location_type l) + { + return symbol_type (token::TOK_TRUE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_TRUE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_TRUE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_UNBOUNDED (std::string v, location_type l) + { + return symbol_type (token::TOK_UNBOUNDED, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_UNBOUNDED (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_UNBOUNDED, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_UNIQUE (std::string v, location_type l) + { + return symbol_type (token::TOK_UNIQUE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_UNIQUE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_UNIQUE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_UPDATE (std::string v, location_type l) + { + return symbol_type (token::TOK_UPDATE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_UPDATE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_UPDATE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_USING (std::string v, location_type l) + { + return symbol_type (token::TOK_USING, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_USING (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_USING, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_VIRTUAL (std::string v, location_type l) + { + return symbol_type (token::TOK_VIRTUAL, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_VIRTUAL (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_VIRTUAL, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_WHEN (std::string v, location_type l) + { + return symbol_type (token::TOK_WHEN, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_WHEN (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_WHEN, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_WHERE (std::string v, location_type l) + { + return symbol_type (token::TOK_WHERE, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_WHERE (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_WHERE, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_WITHOUT (std::string v, location_type l) + { + return symbol_type (token::TOK_WITHOUT, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_WITHOUT (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_WITHOUT, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_IDENTIFIER (std::string v, location_type l) + { + return symbol_type (token::TOK_IDENTIFIER, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_IDENTIFIER (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_IDENTIFIER, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_NUMERIC (std::string v, location_type l) + { + return symbol_type (token::TOK_NUMERIC, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_NUMERIC (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_NUMERIC, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_STRINGLITERAL (std::string v, location_type l) + { + return symbol_type (token::TOK_STRINGLITERAL, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_STRINGLITERAL (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_STRINGLITERAL, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_QUOTEDLITERAL (std::string v, location_type l) + { + return symbol_type (token::TOK_QUOTEDLITERAL, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_QUOTEDLITERAL (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_QUOTEDLITERAL, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_BLOBLITERAL (std::string v, location_type l) + { + return symbol_type (token::TOK_BLOBLITERAL, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_BLOBLITERAL (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_BLOBLITERAL, v, l); + } +#endif +#if 201103L <= YY_CPLUSPLUS + static + symbol_type + make_BINDPARAMETER (std::string v, location_type l) + { + return symbol_type (token::TOK_BINDPARAMETER, std::move (v), std::move (l)); + } +#else + static + symbol_type + make_BINDPARAMETER (const std::string& v, const location_type& l) + { + return symbol_type (token::TOK_BINDPARAMETER, v, l); + } +#endif + + + private: + /// This class is not copyable. + parser (const parser&); + parser& operator= (const parser&); + + /// State numbers. + typedef int state_type; + + /// Generate an error message. + /// \param yystate the state where the error occurred. + /// \param yyla the lookahead token. + virtual std::string yysyntax_error_ (state_type yystate, + const symbol_type& yyla) const; + + /// Compute post-reduction state. + /// \param yystate the current state + /// \param yysym the nonterminal to push on the stack + state_type yy_lr_goto_state_ (state_type yystate, int yysym); + + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_ (int yyvalue); + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_ (int yyvalue); + + static const short yypact_ninf_; + static const short yytable_ninf_; + + /// Convert a scanner token number \a t to a symbol number. + static token_number_type yytranslate_ (token_type t); + + // Tables. + // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + // STATE-NUM. + static const short yypact_[]; + + // 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 unsigned short yydefact_[]; + + // YYPGOTO[NTERM-NUM]. + static const short yypgoto_[]; + + // YYDEFGOTO[NTERM-NUM]. + static const short yydefgoto_[]; + + // 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 short yytable_[]; + + static const short yycheck_[]; + + // YYSTOS[STATE-NUM] -- The (internal number of the) accessing + // symbol of state STATE-NUM. + static const unsigned char yystos_[]; + + // YYR1[YYN] -- Symbol number of symbol that rule YYN derives. + static const unsigned char yyr1_[]; + + // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. + static const unsigned char yyr2_[]; + + + /// Convert the symbol name \a n to a form suitable for a diagnostic. + static std::string yytnamerr_ (const char *n); + + + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#if YYDEBUG + // YYRLINE[YYN] -- Source line where rule number YYN was defined. + static const unsigned short yyrline_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); + + /// Debugging level. + int yydebug_; + /// Debug stream. + std::ostream* yycdebug_; + + /// \brief Display a symbol type, value and location. + /// \param yyo The output stream. + /// \param yysym The symbol. + template + void yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const; +#endif + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// If null, print nothing. + /// \param yysym The symbol. + template + void yy_destroy_ (const char* yymsg, basic_symbol& yysym) const; + + private: + /// Type access provider for state based symbols. + struct by_state + { + /// Default constructor. + by_state () YY_NOEXCEPT; + + /// The symbol type as needed by the constructor. + typedef state_type kind_type; + + /// Constructor. + by_state (kind_type s) YY_NOEXCEPT; + + /// Copy constructor. + by_state (const by_state& that) YY_NOEXCEPT; + + /// Record that this symbol is empty. + void clear () YY_NOEXCEPT; + + /// Steal the symbol type from \a that. + void move (by_state& that); + + /// The (internal) type number (corresponding to \a state). + /// \a empty_symbol when empty. + symbol_number_type type_get () const YY_NOEXCEPT; + + /// The state number used to denote an empty symbol. + enum { empty_state = -1 }; + + /// The state. + /// \a empty when empty. + state_type state; + }; + + /// "Internal" symbol: element of the stack. + struct stack_symbol_type : basic_symbol + { + /// Superclass. + typedef basic_symbol super_type; + /// Construct an empty symbol. + stack_symbol_type (); + /// Move or copy construction. + stack_symbol_type (YY_RVREF (stack_symbol_type) that); + /// Steal the contents from \a sym to build this. + stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym); +#if YY_CPLUSPLUS < 201103L + /// Assignment, needed by push_back by some old implementations. + /// Moves the contents of that. + stack_symbol_type& operator= (stack_symbol_type& that); +#endif + }; + + /// A stack with random access from its top. + template > + class stack + { + public: + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + typedef typename S::size_type size_type; + + stack (size_type n = 200) + : seq_ (n) + {} + + /// Random access. + /// + /// Index 0 returns the topmost element. + T& + operator[] (size_type i) + { + return seq_[size () - 1 - i]; + } + + /// Random access. + /// + /// Index 0 returns the topmost element. + T& + operator[] (int i) + { + return operator[] (size_type (i)); + } + + /// Random access. + /// + /// Index 0 returns the topmost element. + const T& + operator[] (size_type i) const + { + return seq_[size () - 1 - i]; + } + + /// Random access. + /// + /// Index 0 returns the topmost element. + const T& + operator[] (int i) const + { + return operator[] (size_type (i)); + } + + /// Steal the contents of \a t. + /// + /// Close to move-semantics. + void + push (YY_MOVE_REF (T) t) + { + seq_.push_back (T ()); + operator[] (0).move (t); + } + + /// Pop elements from the stack. + void + pop (int n = 1) YY_NOEXCEPT + { + for (; 0 < n; --n) + seq_.pop_back (); + } + + /// Pop all elements from the stack. + void + clear () YY_NOEXCEPT + { + seq_.clear (); + } + + /// Number of elements on the stack. + size_type + size () const YY_NOEXCEPT + { + return seq_.size (); + } + + /// Iterator on top of the stack (going downwards). + const_iterator + begin () const YY_NOEXCEPT + { + return seq_.rbegin (); + } + + /// Bottom of the stack. + const_iterator + end () const YY_NOEXCEPT + { + return seq_.rend (); + } + + /// Present a slice of the top of a stack. + class slice + { + public: + slice (const stack& stack, int range) + : stack_ (stack) + , range_ (range) + {} + + const T& + operator[] (int i) const + { + return stack_[range_ - i]; + } + + private: + const stack& stack_; + int range_; + }; + + private: + stack (const stack&); + stack& operator= (const stack&); + /// The wrapped container. + S seq_; + }; + + + /// Stack type. + typedef stack stack_type; + + /// The stack. + stack_type yystack_; + + /// Push a new state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param sym the symbol + /// \warning the contents of \a s.value is stolen. + void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym); + + /// Push a new look ahead token on the state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param s the state + /// \param sym the symbol (for its value and location). + /// \warning the contents of \a sym.value is stolen. + void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym); + + /// Pop \a n symbols from the stack. + void yypop_ (int n = 1); + + /// Constants. + enum + { + yyeof_ = 0, + yylast_ = 3191, ///< Last index in yytable_. + yynnts_ = 53, ///< Number of nonterminal symbols. + yyfinal_ = 13, ///< Termination state number. + yyterror_ = 1, + yyerrcode_ = 256, + yyntokens_ = 114 ///< Number of tokens. + }; + + + // User arguments. + yyscan_t yyscanner; + ParserDriver& drv; + }; + + inline + parser::token_number_type + parser::yytranslate_ (token_type t) + { + // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to + // TOKEN-NUM as returned by yylex. + static + const token_number_type + translate_table[] = + { + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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 + }; + const unsigned user_token_number_max_ = 368; + const token_number_type undef_token_ = 2; + + if (static_cast (t) <= yyeof_) + return yyeof_; + else if (static_cast (t) <= user_token_number_max_) + return translate_table[t]; + else + return undef_token_; + } + + // basic_symbol. +#if 201103L <= YY_CPLUSPLUS + template + parser::basic_symbol::basic_symbol (basic_symbol&& that) + : Base (std::move (that)) + , value () + , location (std::move (that.location)) + { + switch (this->type_get ()) + { + case 153: // columnconstraint + value.move< ColumnConstraintInfo > (std::move (that.value)); + break; + + case 154: // columnconstraint_list + value.move< ColumnConstraintInfoVector > (std::move (that.value)); + break; + + case 155: // columndef + value.move< ColumndefData > (std::move (that.value)); + break; + + case 139: // optional_if_not_exists + case 141: // optional_unique + case 149: // optional_temporary + case 150: // optional_withoutrowid + value.move< bool > (std::move (that.value)); + break; + + case 163: // tableconstraint + value.move< sqlb::ConstraintPtr > (std::move (that.value)); + break; + + case 164: // tableconstraint_list + case 165: // optional_tableconstraint_list + value.move< sqlb::ConstraintSet > (std::move (that.value)); + break; + + case 146: // createindex_stmt + value.move< sqlb::IndexPtr > (std::move (that.value)); + break; + + case 144: // indexed_column + value.move< sqlb::IndexedColumn > (std::move (that.value)); + break; + + case 145: // indexed_column_list + value.move< sqlb::IndexedColumnVector > (std::move (that.value)); + break; + + case 158: // columnid_list + case 159: // optional_columnid_with_paren_list + value.move< sqlb::StringVector > (std::move (that.value)); + break; + + case 148: // createvirtualtable_stmt + case 166: // createtable_stmt + value.move< sqlb::TablePtr > (std::move (that.value)); + break; + + case 27: // "ABORT" + case 28: // "ACTION" + case 29: // "AND" + case 30: // "AND BETWEEN" + case 31: // "AS" + case 32: // "ASC" + case 33: // "AUTOINCREMENT" + case 34: // "BETWEEN" + case 35: // "CASCADE" + case 36: // "CASE" + case 37: // "CAST" + case 38: // "CHECK" + case 39: // "COLLATE" + case 40: // "CONFLICT" + case 41: // "CONSTRAINT" + case 42: // "CREATE" + case 43: // "CURRENT_DATE" + case 44: // "CURRENT_TIME" + case 45: // "CURRENT_TIMESTAMP" + case 46: // "DEFAULT" + case 47: // "DEFERRABLE" + case 48: // "DEFERRED" + case 49: // "DELETE" + case 50: // "DESC" + case 51: // "DISTINCT" + case 52: // "ELSE" + case 53: // "END" + case 54: // "ESCAPE" + case 55: // "EXISTS" + case 56: // "FAIL" + case 57: // "FALSE" + case 58: // "FILTER" + case 59: // "FOLLOWING" + case 60: // "FOREIGN" + case 61: // "GLOB" + case 62: // "IF" + case 63: // "IGNORE" + case 64: // "IMMEDIATE" + case 65: // "IN" + case 66: // "INDEX" + case 67: // "INITIALLY" + case 68: // "INSERT" + case 69: // "IS" + case 70: // "ISNULL" + case 71: // "KEY" + case 72: // "LIKE" + case 73: // "MATCH" + case 74: // "NO" + case 75: // "NOT" + case 76: // "NOTNULL" + case 77: // "NULL" + case 78: // "ON" + case 79: // "OR" + case 80: // "OVER" + case 81: // "PARTITION" + case 82: // "PRECEDING" + case 83: // "PRIMARY" + case 84: // "RAISE" + case 85: // "RANGE" + case 86: // "REFERENCES" + case 87: // "REGEXP" + case 88: // "REPLACE" + case 89: // "RESTRICT" + case 90: // "ROLLBACK" + case 91: // "ROWID" + case 92: // "ROWS" + case 93: // "SELECT" + case 94: // "SET" + case 95: // "TABLE" + case 96: // "TEMP" + case 97: // "TEMPORARY" + case 98: // "THEN" + case 99: // "TRUE" + case 100: // "UNBOUNDED" + case 101: // "UNIQUE" + case 102: // "UPDATE" + case 103: // "USING" + case 104: // "VIRTUAL" + case 105: // "WHEN" + case 106: // "WHERE" + case 107: // "WITHOUT" + case 108: // "identifier" + case 109: // "numeric" + case 110: // "string literal" + case 111: // "quoted literal" + case 112: // "blob literal" + case 113: // "bind parameter" + case 117: // literalvalue + case 118: // id + case 119: // allowed_keywords_as_identifier + case 120: // tableid + case 121: // columnid + case 122: // signednumber + case 123: // signednumber_or_numeric + case 124: // typename_namelist + case 125: // type_name + case 126: // unary_expr + case 127: // binary_expr + case 128: // like_expr + case 129: // exprlist_expr + case 130: // function_expr + case 131: // isnull_expr + case 132: // between_expr + case 133: // in_expr + case 134: // whenthenlist_expr + case 135: // case_expr + case 136: // raise_expr + case 137: // expr + case 138: // select_stmt + case 140: // optional_sort_order + case 142: // optional_where + case 143: // tableid_with_uninteresting_schema + case 147: // optional_exprlist_with_paren + case 151: // optional_conflictclause + case 152: // optional_typename + case 157: // optional_constraintname + case 160: // fk_clause_part + case 161: // fk_clause_part_list + case 162: // optional_fk_clause + value.move< std::string > (std::move (that.value)); + break; + + case 156: // columndef_list + value.move< std::vector > (std::move (that.value)); + break; + + default: + break; + } + + } +#endif + + template + parser::basic_symbol::basic_symbol (const basic_symbol& that) + : Base (that) + , value () + , location (that.location) + { + switch (this->type_get ()) + { + case 153: // columnconstraint + value.copy< ColumnConstraintInfo > (YY_MOVE (that.value)); + break; + + case 154: // columnconstraint_list + value.copy< ColumnConstraintInfoVector > (YY_MOVE (that.value)); + break; + + case 155: // columndef + value.copy< ColumndefData > (YY_MOVE (that.value)); + break; + + case 139: // optional_if_not_exists + case 141: // optional_unique + case 149: // optional_temporary + case 150: // optional_withoutrowid + value.copy< bool > (YY_MOVE (that.value)); + break; + + case 163: // tableconstraint + value.copy< sqlb::ConstraintPtr > (YY_MOVE (that.value)); + break; + + case 164: // tableconstraint_list + case 165: // optional_tableconstraint_list + value.copy< sqlb::ConstraintSet > (YY_MOVE (that.value)); + break; + + case 146: // createindex_stmt + value.copy< sqlb::IndexPtr > (YY_MOVE (that.value)); + break; + + case 144: // indexed_column + value.copy< sqlb::IndexedColumn > (YY_MOVE (that.value)); + break; + + case 145: // indexed_column_list + value.copy< sqlb::IndexedColumnVector > (YY_MOVE (that.value)); + break; + + case 158: // columnid_list + case 159: // optional_columnid_with_paren_list + value.copy< sqlb::StringVector > (YY_MOVE (that.value)); + break; + + case 148: // createvirtualtable_stmt + case 166: // createtable_stmt + value.copy< sqlb::TablePtr > (YY_MOVE (that.value)); + break; + + case 27: // "ABORT" + case 28: // "ACTION" + case 29: // "AND" + case 30: // "AND BETWEEN" + case 31: // "AS" + case 32: // "ASC" + case 33: // "AUTOINCREMENT" + case 34: // "BETWEEN" + case 35: // "CASCADE" + case 36: // "CASE" + case 37: // "CAST" + case 38: // "CHECK" + case 39: // "COLLATE" + case 40: // "CONFLICT" + case 41: // "CONSTRAINT" + case 42: // "CREATE" + case 43: // "CURRENT_DATE" + case 44: // "CURRENT_TIME" + case 45: // "CURRENT_TIMESTAMP" + case 46: // "DEFAULT" + case 47: // "DEFERRABLE" + case 48: // "DEFERRED" + case 49: // "DELETE" + case 50: // "DESC" + case 51: // "DISTINCT" + case 52: // "ELSE" + case 53: // "END" + case 54: // "ESCAPE" + case 55: // "EXISTS" + case 56: // "FAIL" + case 57: // "FALSE" + case 58: // "FILTER" + case 59: // "FOLLOWING" + case 60: // "FOREIGN" + case 61: // "GLOB" + case 62: // "IF" + case 63: // "IGNORE" + case 64: // "IMMEDIATE" + case 65: // "IN" + case 66: // "INDEX" + case 67: // "INITIALLY" + case 68: // "INSERT" + case 69: // "IS" + case 70: // "ISNULL" + case 71: // "KEY" + case 72: // "LIKE" + case 73: // "MATCH" + case 74: // "NO" + case 75: // "NOT" + case 76: // "NOTNULL" + case 77: // "NULL" + case 78: // "ON" + case 79: // "OR" + case 80: // "OVER" + case 81: // "PARTITION" + case 82: // "PRECEDING" + case 83: // "PRIMARY" + case 84: // "RAISE" + case 85: // "RANGE" + case 86: // "REFERENCES" + case 87: // "REGEXP" + case 88: // "REPLACE" + case 89: // "RESTRICT" + case 90: // "ROLLBACK" + case 91: // "ROWID" + case 92: // "ROWS" + case 93: // "SELECT" + case 94: // "SET" + case 95: // "TABLE" + case 96: // "TEMP" + case 97: // "TEMPORARY" + case 98: // "THEN" + case 99: // "TRUE" + case 100: // "UNBOUNDED" + case 101: // "UNIQUE" + case 102: // "UPDATE" + case 103: // "USING" + case 104: // "VIRTUAL" + case 105: // "WHEN" + case 106: // "WHERE" + case 107: // "WITHOUT" + case 108: // "identifier" + case 109: // "numeric" + case 110: // "string literal" + case 111: // "quoted literal" + case 112: // "blob literal" + case 113: // "bind parameter" + case 117: // literalvalue + case 118: // id + case 119: // allowed_keywords_as_identifier + case 120: // tableid + case 121: // columnid + case 122: // signednumber + case 123: // signednumber_or_numeric + case 124: // typename_namelist + case 125: // type_name + case 126: // unary_expr + case 127: // binary_expr + case 128: // like_expr + case 129: // exprlist_expr + case 130: // function_expr + case 131: // isnull_expr + case 132: // between_expr + case 133: // in_expr + case 134: // whenthenlist_expr + case 135: // case_expr + case 136: // raise_expr + case 137: // expr + case 138: // select_stmt + case 140: // optional_sort_order + case 142: // optional_where + case 143: // tableid_with_uninteresting_schema + case 147: // optional_exprlist_with_paren + case 151: // optional_conflictclause + case 152: // optional_typename + case 157: // optional_constraintname + case 160: // fk_clause_part + case 161: // fk_clause_part_list + case 162: // optional_fk_clause + value.copy< std::string > (YY_MOVE (that.value)); + break; + + case 156: // columndef_list + value.copy< std::vector > (YY_MOVE (that.value)); + break; + + default: + break; + } + + } + + + + template + bool + parser::basic_symbol::empty () const YY_NOEXCEPT + { + return Base::type_get () == empty_symbol; + } + + template + void + parser::basic_symbol::move (basic_symbol& s) + { + super_type::move (s); + switch (this->type_get ()) + { + case 153: // columnconstraint + value.move< ColumnConstraintInfo > (YY_MOVE (s.value)); + break; + + case 154: // columnconstraint_list + value.move< ColumnConstraintInfoVector > (YY_MOVE (s.value)); + break; + + case 155: // columndef + value.move< ColumndefData > (YY_MOVE (s.value)); + break; + + case 139: // optional_if_not_exists + case 141: // optional_unique + case 149: // optional_temporary + case 150: // optional_withoutrowid + value.move< bool > (YY_MOVE (s.value)); + break; + + case 163: // tableconstraint + value.move< sqlb::ConstraintPtr > (YY_MOVE (s.value)); + break; + + case 164: // tableconstraint_list + case 165: // optional_tableconstraint_list + value.move< sqlb::ConstraintSet > (YY_MOVE (s.value)); + break; + + case 146: // createindex_stmt + value.move< sqlb::IndexPtr > (YY_MOVE (s.value)); + break; + + case 144: // indexed_column + value.move< sqlb::IndexedColumn > (YY_MOVE (s.value)); + break; + + case 145: // indexed_column_list + value.move< sqlb::IndexedColumnVector > (YY_MOVE (s.value)); + break; + + case 158: // columnid_list + case 159: // optional_columnid_with_paren_list + value.move< sqlb::StringVector > (YY_MOVE (s.value)); + break; + + case 148: // createvirtualtable_stmt + case 166: // createtable_stmt + value.move< sqlb::TablePtr > (YY_MOVE (s.value)); + break; + + case 27: // "ABORT" + case 28: // "ACTION" + case 29: // "AND" + case 30: // "AND BETWEEN" + case 31: // "AS" + case 32: // "ASC" + case 33: // "AUTOINCREMENT" + case 34: // "BETWEEN" + case 35: // "CASCADE" + case 36: // "CASE" + case 37: // "CAST" + case 38: // "CHECK" + case 39: // "COLLATE" + case 40: // "CONFLICT" + case 41: // "CONSTRAINT" + case 42: // "CREATE" + case 43: // "CURRENT_DATE" + case 44: // "CURRENT_TIME" + case 45: // "CURRENT_TIMESTAMP" + case 46: // "DEFAULT" + case 47: // "DEFERRABLE" + case 48: // "DEFERRED" + case 49: // "DELETE" + case 50: // "DESC" + case 51: // "DISTINCT" + case 52: // "ELSE" + case 53: // "END" + case 54: // "ESCAPE" + case 55: // "EXISTS" + case 56: // "FAIL" + case 57: // "FALSE" + case 58: // "FILTER" + case 59: // "FOLLOWING" + case 60: // "FOREIGN" + case 61: // "GLOB" + case 62: // "IF" + case 63: // "IGNORE" + case 64: // "IMMEDIATE" + case 65: // "IN" + case 66: // "INDEX" + case 67: // "INITIALLY" + case 68: // "INSERT" + case 69: // "IS" + case 70: // "ISNULL" + case 71: // "KEY" + case 72: // "LIKE" + case 73: // "MATCH" + case 74: // "NO" + case 75: // "NOT" + case 76: // "NOTNULL" + case 77: // "NULL" + case 78: // "ON" + case 79: // "OR" + case 80: // "OVER" + case 81: // "PARTITION" + case 82: // "PRECEDING" + case 83: // "PRIMARY" + case 84: // "RAISE" + case 85: // "RANGE" + case 86: // "REFERENCES" + case 87: // "REGEXP" + case 88: // "REPLACE" + case 89: // "RESTRICT" + case 90: // "ROLLBACK" + case 91: // "ROWID" + case 92: // "ROWS" + case 93: // "SELECT" + case 94: // "SET" + case 95: // "TABLE" + case 96: // "TEMP" + case 97: // "TEMPORARY" + case 98: // "THEN" + case 99: // "TRUE" + case 100: // "UNBOUNDED" + case 101: // "UNIQUE" + case 102: // "UPDATE" + case 103: // "USING" + case 104: // "VIRTUAL" + case 105: // "WHEN" + case 106: // "WHERE" + case 107: // "WITHOUT" + case 108: // "identifier" + case 109: // "numeric" + case 110: // "string literal" + case 111: // "quoted literal" + case 112: // "blob literal" + case 113: // "bind parameter" + case 117: // literalvalue + case 118: // id + case 119: // allowed_keywords_as_identifier + case 120: // tableid + case 121: // columnid + case 122: // signednumber + case 123: // signednumber_or_numeric + case 124: // typename_namelist + case 125: // type_name + case 126: // unary_expr + case 127: // binary_expr + case 128: // like_expr + case 129: // exprlist_expr + case 130: // function_expr + case 131: // isnull_expr + case 132: // between_expr + case 133: // in_expr + case 134: // whenthenlist_expr + case 135: // case_expr + case 136: // raise_expr + case 137: // expr + case 138: // select_stmt + case 140: // optional_sort_order + case 142: // optional_where + case 143: // tableid_with_uninteresting_schema + case 147: // optional_exprlist_with_paren + case 151: // optional_conflictclause + case 152: // optional_typename + case 157: // optional_constraintname + case 160: // fk_clause_part + case 161: // fk_clause_part_list + case 162: // optional_fk_clause + value.move< std::string > (YY_MOVE (s.value)); + break; + + case 156: // columndef_list + value.move< std::vector > (YY_MOVE (s.value)); + break; + + default: + break; + } + + location = YY_MOVE (s.location); + } + + // by_type. + inline + parser::by_type::by_type () + : type (empty_symbol) + {} + +#if 201103L <= YY_CPLUSPLUS + inline + parser::by_type::by_type (by_type&& that) + : type (that.type) + { + that.clear (); + } +#endif + + inline + parser::by_type::by_type (const by_type& that) + : type (that.type) + {} + + inline + parser::by_type::by_type (token_type t) + : type (yytranslate_ (t)) + {} + + inline + void + parser::by_type::clear () + { + type = empty_symbol; + } + + inline + void + parser::by_type::move (by_type& that) + { + type = that.type; + that.clear (); + } + + inline + int + parser::by_type::type_get () const YY_NOEXCEPT + { + return type; + } + + inline + parser::token_type + parser::by_type::token () const YY_NOEXCEPT + { + // YYTOKNUM[NUM] -- (External) token number corresponding to the + // (internal) symbol number NUM (which must be that of a token). */ + static + const unsigned short + yytoken_number_[] = + { + 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 + }; + return token_type (yytoken_number_[type]); + } + +#line 10 "sqlite3_parser.yy" +} } // sqlb::parser +#line 4028 "sqlite3_parser.hpp" + + + + + +#endif // !YY_YY_SQLITE3_PARSER_HPP_INCLUDED diff --git a/src/sql/parser/sqlite3_parser.yy b/src/sql/parser/sqlite3_parser.yy new file mode 100644 index 00000000..3127457f --- /dev/null +++ b/src/sql/parser/sqlite3_parser.yy @@ -0,0 +1,944 @@ +%skeleton "lalr1.cc" +%require "3.4.1" +%defines + +%define api.token.constructor +%define api.value.type variant +%define parse.assert +%output "sqlite3_parser.cpp" +%define api.location.file "sqlite3_location.h" +%define api.namespace { sqlb::parser } + +%code requires { + #include + #include + #include "../sqlitetypes.h" + #include "../ObjectIdentifier.h" + namespace sqlb { namespace parser { class ParserDriver; } } + typedef void* yyscan_t; + + // Unfortunately we do not store column constraints in a systematic manner yet. + // Instead there is a variable for most column constraints directly inside the + // sqlb::Field class. This means that when parsing a column constraint we cannot + // just build a column constraint object with all the information and insert that + // into the Field object. Instead, the information needs to be passed upwards in + // some other way. This is what these declarations are for. We need to be able + // to pass information to the Field object as well as to the Table object too + // because some column constraints need to be transformed into Table constraints + // with our current layout. + class ColumnConstraintInfo + { + public: + ColumnConstraintInfo() : is_table_constraint(false), fully_parsed(false) {} + ~ColumnConstraintInfo() {} + ColumnConstraintInfo& operator=(const ColumnConstraintInfo& other) + { + type = other.type; + is_table_constraint = other.is_table_constraint; + fully_parsed = other.fully_parsed; + if(is_table_constraint) + table_constraint = other.table_constraint; + text = other.text; + + return *this; + } + ColumnConstraintInfo(const ColumnConstraintInfo& other) + { + *this = other; + } + + enum ConstraintType + { + None, + AutoIncrement, + PrimaryKey, + NotNull, + Unique, + Check, + Default, + Collate, + ForeignKey, + }; + + ConstraintType type; + bool is_table_constraint; + bool fully_parsed; + + sqlb::ConstraintPtr table_constraint; + std::string text; + }; + using ColumnConstraintInfoVector = std::vector; + + // Colum definitions are a tuple of three elements: the Field object, a set of table constraints, and a bool to indicate whether parsing was complete + using ColumndefData = std::tuple; +} + +// The parsing context +%param { yyscan_t yyscanner } +%param { ParserDriver& drv } + +%locations + +%define parse.trace +%define parse.error verbose + +%code { + #include "ParserDriver.h" + + static std::string unquote_text(std::string str, char quote_char) + { + if(str.front() != quote_char || str.back() != quote_char) + return str; + + str = str.substr(1, str.size()-2); + + std::string quote(2, quote_char); + + size_t pos = 0; + while((pos = str.find(quote, pos)) != std::string::npos) + { + str.erase(pos, 1); + pos += 1; // Don't remove the other quote char too + } + return str; + } +} + +%define api.token.prefix {TOK_} +%token + EOF 0 "end of file" + LPAREN "(" + RPAREN ")" + DOT "." + COMMA "," + SEMI ";" + PLUS "+" + MINUS "-" + STAR "*" + SLASH "/" + TILDE "~" + AMPERSAND "&" + PERCENT "%" + BITOR "|" + OROP "||" + EQUAL "=" + EQUAL2 "==" + GREATER ">" + GREATEREQUAL ">=" + LOWER "<" + LOWEREQUAL "<=" + UNEQUAL "!=" + UNEQUAL2 "<>" + BITWISELEFT "<<" + BITWISERIGHT ">>" +; + +%token ABORT "ABORT" +%token ACTION "ACTION" +%token AND "AND" +%token AND_BETWEEN "AND BETWEEN" +%token AS "AS" +%token ASC "ASC" +%token AUTOINCREMENT "AUTOINCREMENT" +%token BETWEEN "BETWEEN" +%token CASCADE "CASCADE" +%token CASE "CASE" +%token CAST "CAST" +%token CHECK "CHECK" +%token COLLATE "COLLATE" +%token CONFLICT "CONFLICT" +%token CONSTRAINT "CONSTRAINT" +%token CREATE "CREATE" +%token CURRENT_DATE "CURRENT_DATE" +%token CURRENT_TIME "CURRENT_TIME" +%token CURRENT_TIMESTAMP "CURRENT_TIMESTAMP" +%token DEFAULT "DEFAULT" +%token DEFERRABLE "DEFERRABLE" +%token DEFERRED "DEFERRED" +%token DELETE "DELETE" +%token DESC "DESC" +%token DISTINCT "DISTINCT" +%token ELSE "ELSE" +%token END "END" +%token ESCAPE "ESCAPE" +%token EXISTS "EXISTS" +%token FAIL "FAIL" +%token FALSE "FALSE" +%token FILTER "FILTER" +%token FOLLOWING "FOLLOWING" +%token FOREIGN "FOREIGN" +%token GLOB "GLOB" +%token IF "IF" +%token IGNORE "IGNORE" +%token IMMEDIATE "IMMEDIATE" +%token IN "IN" +%token INDEX "INDEX" +%token INITIALLY "INITIALLY" +%token INSERT "INSERT" +%token IS "IS" +%token ISNULL "ISNULL" +%token KEY "KEY" +%token LIKE "LIKE" +%token MATCH "MATCH" +%token NO "NO" +%token NOT "NOT" +%token NOTNULL "NOTNULL" +%token NULL "NULL" +%token ON "ON" +%token OR "OR" +%token OVER "OVER" +%token PARTITION "PARTITION" +%token PRECEDING "PRECEDING" +%token PRIMARY "PRIMARY" +%token RAISE "RAISE" +%token RANGE "RANGE" +%token REFERENCES "REFERENCES" +%token REGEXP "REGEXP" +%token REPLACE "REPLACE" +%token RESTRICT "RESTRICT" +%token ROLLBACK "ROLLBACK" +%token ROWID "ROWID" +%token ROWS "ROWS" +%token SELECT "SELECT" +%token SET "SET" +%token TABLE "TABLE" +%token TEMP "TEMP" +%token TEMPORARY "TEMPORARY" +%token THEN "THEN" +%token TRUE "TRUE" +%token UNBOUNDED "UNBOUNDED" +%token UNIQUE "UNIQUE" +%token UPDATE "UPDATE" +%token USING "USING" +%token VIRTUAL "VIRTUAL" +%token WHEN "WHEN" +%token WHERE "WHERE" +%token WITHOUT "WITHOUT" + +%token IDENTIFIER "identifier" +%token NUMERIC "numeric" +%token STRINGLITERAL "string literal" +%token QUOTEDLITERAL "quoted literal" +%token BLOBLITERAL "blob literal" +%token BINDPARAMETER "bind parameter" + +%type literalvalue +%type signednumber +%type signednumber_or_numeric +%type id +%type allowed_keywords_as_identifier +%type tableid +%type columnid +%type typename_namelist +%type type_name +%type unary_expr +%type binary_expr +%type like_expr +%type exprlist_expr +%type function_expr +%type isnull_expr +%type between_expr +%type in_expr +%type whenthenlist_expr +%type case_expr +%type raise_expr +%type expr +%type optional_if_not_exists +%type optional_unique +%type optional_temporary +%type optional_withoutrowid +%type optional_sort_order +%type optional_where +%type optional_constraintname +%type optional_conflictclause +%type tableid_with_uninteresting_schema +%type optional_exprlist_with_paren +%type select_stmt + +%type indexed_column +%type indexed_column_list +%type createindex_stmt +%type createvirtualtable_stmt + +%type optional_typename +%type columnconstraint_list +%type columnconstraint +%type columndef +%type > columndef_list +%type columnid_list +%type optional_columnid_with_paren_list +%type fk_clause_part +%type fk_clause_part_list +%type optional_fk_clause +%type tableconstraint +%type tableconstraint_list +%type optional_tableconstraint_list +%type createtable_stmt + +%% + +%left OR; +%left AND; +%right NOT; +%left IS MATCH LIKE BETWEEN IN UNEQUAL UNEQUAL2 EQUAL EQUAL2 GLOB REGEXP ISNULL NOTNULL; +%left GREATER LOWEREQUAL LOWER GREATEREQUAL; +%right ESCAPE; +%left AMPERSAND BITOR BITWISELEFT BITWISERIGHT; +%left PLUS MINUS; +%left STAR SLASH PERCENT; +%left OROP; +%left COLLATE; +%right TILDE; +%nonassoc ON; + +/* + * Statements + */ + +%start sql; + +sql: + statement + | statement ";" + ; + +statement: + createindex_stmt { drv.result = $1; } + | createvirtualtable_stmt { drv.result = $1; } + | createtable_stmt { drv.result = $1; } + ; + +/* + * Expressions + */ + +literalvalue: + NUMERIC + | STRINGLITERAL + | BLOBLITERAL + | NULL + | TRUE + | FALSE + | CURRENT_TIME + | CURRENT_DATE + | CURRENT_TIMESTAMP + ; + +id: + IDENTIFIER + | QUOTEDLITERAL + //| STRINGLITERAL + ; + +allowed_keywords_as_identifier: + ABORT + | ACTION + | ASC + | CASCADE + | CAST + | CONFLICT + | DEFERRED + | DESC + | END + | FAIL + | FILTER + | FOLLOWING + | GLOB + | KEY + | LIKE + | IGNORE + | INITIALLY + | IMMEDIATE + | MATCH + | NO + | OVER + | PARTITION + | PRECEDING + | RAISE + | RANGE + | REGEXP + | REPLACE + | RESTRICT + | ROLLBACK + | ROWID + | ROWS + | TEMPORARY + | TEMP + | UNBOUNDED + | VIRTUAL + | WITHOUT + ; + +tableid: + allowed_keywords_as_identifier + | CURRENT_TIME + | CURRENT_DATE + | CURRENT_TIMESTAMP + | id + | STRINGLITERAL { $$ = unquote_text($1, '\''); } + ; + +columnid: + allowed_keywords_as_identifier + | CURRENT_TIME + | CURRENT_DATE + | CURRENT_TIMESTAMP + | IF + | id + | STRINGLITERAL { $$ = unquote_text($1, '\''); } + ; + +signednumber: + "+" NUMERIC { $$ = "+" + $2; } // No NUMERIC without "+" or "-" here because that is just a literalvalue + | "-" NUMERIC { $$ = "-" + $2; } + ; + +signednumber_or_numeric: + signednumber + | NUMERIC + ; + +typename_namelist: + tableid { $$ = $1; } + | typename_namelist tableid { $$ = $1 + " " + $2; } + ; + +type_name: + typename_namelist { $$ = $1; } + | typename_namelist "(" signednumber_or_numeric ")" { $$ = $1 + "(" + $3 + ")"; } + | typename_namelist "(" signednumber_or_numeric "," signednumber_or_numeric ")" { $$ = $1 + "(" + $3 + ", " + $5 + ")"; } + ; + +unary_expr: + "-" expr %prec TILDE { $$ = "-" + $2; } + | "+" expr %prec TILDE { $$ = "+" + $2; } + | "~" expr { $$ = "~" + $2; } + | NOT expr { $$ = "NOT " + $2; } + ; + +binary_expr: + expr "||" expr { $$ = $1 + " || " + $3; } + | expr "*" expr { $$ = $1 + " * " + $3; } + | expr "/" expr { $$ = $1 + " / " + $3; } + | expr "%" expr { $$ = $1 + " % " + $3; } + | expr "+" expr { $$ = $1 + " + " + $3; } + | expr "-" expr { $$ = $1 + " - " + $3; } + | expr "<<" expr { $$ = $1 + " << " + $3; } + | expr ">>" expr { $$ = $1 + " >> " + $3; } + | expr "&" expr { $$ = $1 + " & " + $3; } + | expr "|" expr { $$ = $1 + " | " + $3; } + | expr "<" expr { $$ = $1 + " < " + $3; } + | expr "<=" expr { $$ = $1 + " <= " + $3; } + | expr ">" expr { $$ = $1 + " > " + $3; } + | expr ">=" expr { $$ = $1 + " >= " + $3; } + | expr "=" expr { $$ = $1 + " = " + $3; } + | expr "==" expr { $$ = $1 + " == " + $3; } + | expr "!=" expr { $$ = $1 + " != " + $3; } + | expr "<>" expr { $$ = $1 + " <> " + $3; } + | expr IS expr { $$ = $1 + " IS " + $3; } + | expr AND expr { $$ = $1 + " AND " + $3; } + | expr OR expr { $$ = $1 + " OR " + $3; } + ; + +like_expr: + expr LIKE expr { $$ = $1 + " LIKE " + $3; } + | expr GLOB expr { $$ = $1 + " GLOB " + $3; } + | expr MATCH expr { $$ = $1 + " MATCH " + $3; } + | expr REGEXP expr { $$ = $1 + " REGEXP " + $3; } + | expr NOT LIKE expr { $$ = $1 + " NOT LIKE " + $4; } + | expr NOT GLOB expr { $$ = $1 + " NOT GLOB " + $4; } + | expr NOT MATCH expr { $$ = $1 + " NOT MATCH " + $4; } + | expr NOT REGEXP expr { $$ = $1 + " NOT REGEXP " + $4; } + | expr LIKE expr ESCAPE expr %prec LIKE { $$ = $1 + " LIKE " + $3 + " ESCAPE " + $5; } + | expr GLOB expr ESCAPE expr %prec GLOB { $$ = $1 + " GLOB " + $3 + " ESCAPE " + $5; } + | expr MATCH expr ESCAPE expr %prec MATCH { $$ = $1 + " MATCH " + $3 + " ESCAPE " + $5; } + | expr REGEXP expr ESCAPE expr %prec REGEXP { $$ = $1 + " REGEXP " + $3 + " ESCAPE " + $5; } + | expr NOT LIKE expr ESCAPE expr %prec LIKE { $$ = $1 + " NOT LIKE " + $3 + " ESCAPE " + $6; } + | expr NOT GLOB expr ESCAPE expr %prec GLOB { $$ = $1 + " NOT GLOB " + $3 + " ESCAPE " + $6; } + | expr NOT MATCH expr ESCAPE expr %prec MATCH { $$ = $1 + " NOT MATCH " + $3 + " ESCAPE " + $6; } + | expr NOT REGEXP expr ESCAPE expr %prec REGEXP { $$ = $1 + " NOT REGEXP " + $3 + " ESCAPE " + $6; } + ; + +exprlist_expr: + expr { $$ = $1; } + | exprlist_expr "," expr { $$ = $1 + ", " + $3; } + ; + +function_expr: + id "(" exprlist_expr ")" { $$ = $1 + "(" + $3 + ")"; } + | id "(" DISTINCT exprlist_expr ")" { $$ = $1 + "(DISTINCT " + $4 + ")"; } + | id "(" ")" { $$ = $1 + "()"; } + | id "(" "*" ")" { $$ = $1 + "(*)"; } + ; + +isnull_expr: + expr ISNULL { $$ = $1 + " ISNULL"; } + | expr NOTNULL { $$ = $1 + " NOTNULL"; } + | expr NOT NULL %prec NOTNULL { $$ = $1 + " NOT NULL"; } + ; + +between_expr: + expr BETWEEN expr AND_BETWEEN expr %prec BETWEEN { $$ = $1 + " BETWEEN " + $3 + " AND " + $5; } + | expr NOT BETWEEN expr AND_BETWEEN expr %prec BETWEEN { $$ = $1 + " NOT BETWEEN " + $4 + " AND " + $6; } + ; + +in_expr: + expr IN "(" ")" { $$ = $1 + " IN ()"; } + | expr IN "(" select_stmt ")" { $$ = $1 + " IN (" + $4 + ")"; } + | expr IN "(" exprlist_expr ")" { $$ = $1 + " IN (" + $4 + ")"; } + | expr IN id "." tableid { $$ = $1 + " IN " + sqlb::escapeIdentifier($3) + "." + sqlb::escapeIdentifier($5); } + | expr IN tableid { $$ = $1 + " IN " + sqlb::escapeIdentifier($3); } + | expr IN id "." id "(" ")" { $$ = $1 + " IN " + sqlb::escapeIdentifier($3) + "." + $5 + "()"; } + | expr IN id "." id "(" exprlist_expr ")" { $$ = $1 + " IN " + sqlb::escapeIdentifier($3) + "." + $5 + "(" + $7 + ")"; } + | expr IN id "(" exprlist_expr ")" { $$ = $1 + " IN " + $3 + "(" + $5 + ")"; } + | expr NOT IN "(" ")" { $$ = $1 + " NOT IN ()"; } + | expr NOT IN "(" select_stmt ")" { $$ = $1 + " NOT IN (" + $5 + ")"; } + | expr NOT IN "(" exprlist_expr ")" { $$ = $1 + " NOT IN (" + $5 + ")"; } + | expr NOT IN id "." tableid { $$ = $1 + " NOT IN " + sqlb::escapeIdentifier($4) + "." + sqlb::escapeIdentifier($6); } + | expr NOT IN tableid { $$ = $1 + " NOT IN " + sqlb::escapeIdentifier($4); } + | expr NOT IN id "." id "(" ")" { $$ = $1 + " NOT IN " + sqlb::escapeIdentifier($4) + "." + $6 + "()"; } + | expr NOT IN id "." id "(" exprlist_expr ")" { $$ = $1 + " NOT IN " + sqlb::escapeIdentifier($4) + "." + $6 + "(" + $8 + ")"; } + | expr NOT IN id "(" exprlist_expr ")" { $$ = $1 + " NOT IN " + $4 + "(" + $6 + ")"; } + ; + +whenthenlist_expr: + WHEN expr THEN expr { $$ = "WHEN " + $2 + " THEN " + $4; } + | whenthenlist_expr WHEN expr THEN expr { $$ = $1 + " WHEN" + $3 + " THEN " + $5; } + ; + +case_expr: + CASE expr whenthenlist_expr ELSE expr END { $$ = "CASE " + $2 + " " + $3 + " ELSE " + $5 + " END"; } + | CASE expr whenthenlist_expr END { $$ = "CASE " + $2 + " " + $3 + " END"; } + | CASE whenthenlist_expr ELSE expr END { $$ = "CASE " + $2 + " ELSE " + $4 + " END"; } + | CASE whenthenlist_expr END { $$ = "CASE " + $2 + " END"; } + ; + +raise_expr: + RAISE "(" IGNORE ")" { $$ = "RAISE(IGNORE)"; } + | RAISE "(" ROLLBACK "," STRINGLITERAL ")" { $$ = "RAISE(ROLLBACK, " + $5 + ")"; } + | RAISE "(" ABORT "," STRINGLITERAL ")" { $$ = "RAISE(ABORT, " + $5 + ")"; } + | RAISE "(" FAIL "," STRINGLITERAL ")" { $$ = "RAISE(FAIL, " + $5 + ")"; } + ; + +expr: + literalvalue + | allowed_keywords_as_identifier { $$ = sqlb::escapeIdentifier($1); } + | BINDPARAMETER + | id "." id "." id { $$ = sqlb::escapeIdentifier($1) + "." + sqlb::escapeIdentifier($3) + "." + sqlb::escapeIdentifier($5); } + | id "." id { $$ = sqlb::escapeIdentifier($1) + "." + sqlb::escapeIdentifier($3); } + | id { $$ = sqlb::escapeIdentifier($1); } + | unary_expr + | binary_expr + | function_expr + | "(" exprlist_expr ")" { $$ = "(" + $2 + ")"; } + | CAST "(" expr AS type_name ")" { $$ = "CAST(" + $3 + " AS " + $5 + ")"; } + | expr COLLATE id { $$ = $1 + " COLLATE " + $3; } + | like_expr + | isnull_expr + | between_expr + | in_expr + | case_expr + | raise_expr + // TODO Window functions + ; + +/* + * SELECT + */ + +select_stmt: + SELECT { $$ = "SELECT"; } // TODO + ; + +/* + * Helper rules for CREATE statements + */ + +optional_if_not_exists: + %empty { $$ = false; } + | IF NOT EXISTS { $$ = true; } + ; + +optional_sort_order: + %empty { $$ = ""; } + | ASC { $$ = "ASC"; } + | DESC { $$ = "DESC"; } + ; + +/* + * CREATE INDEX + */ + +optional_unique: + %empty { $$ = false; } + | UNIQUE { $$ = true; } + ; + +optional_where: + %empty { $$ = ""; } + | WHERE expr { $$ = $2; } + ; + +tableid_with_uninteresting_schema: + id "." tableid { $$ = $3; } + | TEMP "." tableid { $$ = $3; } + | tableid { $$ = $1; } + ; + +indexed_column: + expr optional_sort_order { + // If the expression is only one column name and nothing else, treat it as a column name; otherwise as an expression. + char quote = getIdentifierQuoteChar(); + if((quote == '[' && std::count($1.begin(), $1.end(), quote) == 1 && $1.front() == '[' && $1.back() == ']') || + (quote != '[' && std::count($1.begin(), $1.end(), quote) == 2 && $1.front() == quote && $1.back() == quote)) + { + $$ = sqlb::IndexedColumn(unquote_text($1, quote), false, $2); + } else { + $$ = sqlb::IndexedColumn($1, true, $2); + } + } + ; + +indexed_column_list: + indexed_column { $$ = sqlb::IndexedColumnVector(1, $1); } + | indexed_column_list "," indexed_column { $$ = $1; $$.push_back($3); } + ; + +createindex_stmt: + CREATE optional_unique INDEX optional_if_not_exists tableid_with_uninteresting_schema ON tableid "(" indexed_column_list ")" optional_where { + $$ = sqlb::IndexPtr(new sqlb::Index($5)); + $$->setTable($7); + $$->setUnique($2); + $$->setWhereExpr($11); + $$->fields = $9; + $$->setFullyParsed(true); + } + ; + +/* + * CREATE VIRTUAL TABLE + */ + +optional_exprlist_with_paren: + %empty { $$ = {}; } + | "(" ")" { $$ = {}; } + | "(" exprlist_expr ")" { $$ = $2; } + ; + +createvirtualtable_stmt: + CREATE VIRTUAL TABLE optional_if_not_exists tableid_with_uninteresting_schema USING id optional_exprlist_with_paren { + $$ = sqlb::TablePtr(new sqlb::Table($5)); + $$->setVirtualUsing($7); + $$->setFullyParsed(false); + } + ; + +/* + * CREATE TABLE + */ + +optional_temporary: + %empty { $$ = false; } + | TEMP { $$ = true; } + | TEMPORARY { $$ = true; } + ; + +optional_withoutrowid: + %empty { $$ = false; } + | WITHOUT ROWID { $$ = true; } + ; + +optional_conflictclause: + %empty { $$ = ""; } + | ON CONFLICT ROLLBACK { $$ = $3; } + | ON CONFLICT ABORT { $$ = $3; } + | ON CONFLICT FAIL { $$ = $3; } + | ON CONFLICT IGNORE { $$ = $3; } + | ON CONFLICT REPLACE { $$ = $3; } + ; + +optional_typename: + %empty { $$ = ""; } + | type_name { $$ = $1; } + ; + +columnconstraint: + optional_constraintname PRIMARY KEY optional_sort_order optional_conflictclause { + $$.type = ColumnConstraintInfo::PrimaryKey; + $$.is_table_constraint = true; + sqlb::PrimaryKeyConstraint* pk = new sqlb::PrimaryKeyConstraint({sqlb::IndexedColumn("", false, $4)}); + pk->setName($1); + pk->setConflictAction($5); + $$.table_constraint = sqlb::ConstraintPtr(pk); + $$.fully_parsed = true; + } + | optional_constraintname PRIMARY KEY optional_sort_order optional_conflictclause AUTOINCREMENT { + $$.type = ColumnConstraintInfo::PrimaryKey; + $$.is_table_constraint = true; + sqlb::PrimaryKeyConstraint* pk = new sqlb::PrimaryKeyConstraint({sqlb::IndexedColumn("", false, $4)}); + pk->setName($1); + pk->setConflictAction($5); + pk->setAutoIncrement(true); + $$.table_constraint = sqlb::ConstraintPtr(pk); + $$.fully_parsed = true; + } + | optional_constraintname NOT NULL optional_conflictclause { + $$.type = ColumnConstraintInfo::NotNull; + $$.is_table_constraint = false; + $$.fully_parsed = ($1 == "" && $4 == ""); + } + | optional_constraintname NULL { + $$.type = ColumnConstraintInfo::None; + $$.is_table_constraint = false; + $$.fully_parsed = true; + } + | optional_constraintname UNIQUE optional_conflictclause { + $$.type = ColumnConstraintInfo::Unique; + $$.is_table_constraint = false; + $$.fully_parsed = ($1 == "" && $3 == ""); + } + | optional_constraintname CHECK "(" expr ")" { + $$.type = ColumnConstraintInfo::Check; + $$.is_table_constraint = false; + $$.text = $4; + $$.fully_parsed = ($1 == ""); + } + | optional_constraintname DEFAULT signednumber { + $$.type = ColumnConstraintInfo::Default; + $$.is_table_constraint = false; + $$.text = $3; + $$.fully_parsed = ($1 == ""); + } + | optional_constraintname DEFAULT literalvalue { + $$.type = ColumnConstraintInfo::Default; + $$.is_table_constraint = false; + $$.text = $3; + $$.fully_parsed = ($1 == ""); + } + | optional_constraintname DEFAULT id { + $$.type = ColumnConstraintInfo::Default; + $$.is_table_constraint = false; + $$.text = $3; + $$.fully_parsed = ($1 == ""); + } + | optional_constraintname DEFAULT allowed_keywords_as_identifier { // We must allow the same keywords as unquoted default values as in the columnid context. + // But we do not use columnid here in order to avoid reduce/reduce conflicts. + $$.type = ColumnConstraintInfo::Default; + $$.is_table_constraint = false; + $$.text = $3; + $$.fully_parsed = ($1 == ""); + } + | optional_constraintname DEFAULT IF { // Same as above. + $$.type = ColumnConstraintInfo::Default; + $$.is_table_constraint = false; + $$.text = $3; + $$.fully_parsed = ($1 == ""); + } + | optional_constraintname DEFAULT "(" expr ")" { + $$.type = ColumnConstraintInfo::Default; + $$.is_table_constraint = false; + $$.text = "(" + $4 + ")"; + $$.fully_parsed = ($1 == ""); + } + | optional_constraintname COLLATE id { + $$.type = ColumnConstraintInfo::Collate; + $$.is_table_constraint = false; + $$.text = $3; + $$.fully_parsed = ($1 == ""); + } + | optional_constraintname REFERENCES tableid optional_columnid_with_paren_list optional_fk_clause { // TODO Solve shift/reduce conflict. It is not super important though as shifting seems to be right here. + $$.type = ColumnConstraintInfo::ForeignKey; + $$.is_table_constraint = true; + sqlb::ForeignKeyClause* fk = new sqlb::ForeignKeyClause(); + fk->setName($1); + fk->setTable($3); + fk->setColumns($4); + fk->setConstraint($5); + $$.table_constraint = sqlb::ConstraintPtr(fk); + $$.fully_parsed = true; + } + ; + +columnconstraint_list: + columnconstraint { $$ = { $1 }; } + | columnconstraint_list columnconstraint { $$ = $1; $$.push_back($2); } + ; + +columndef: + columnid optional_typename columnconstraint_list { + sqlb::Field f($1, $2); + bool fully_parsed = true; + sqlb::ConstraintSet table_constraints{}; + for(auto c : $3) + { + if(c.fully_parsed == false) + fully_parsed = false; + + if(c.type == ColumnConstraintInfo::None) + continue; + + if(c.is_table_constraint) + { + if(c.table_constraint->columnList().empty()) + c.table_constraint->setColumnList({$1}); + else + c.table_constraint->replaceInColumnList("", $1); + table_constraints.insert(c.table_constraint); + } else { + if(c.type == ColumnConstraintInfo::NotNull) { + f.setNotNull(true); + } else if(c.type == ColumnConstraintInfo::Unique) { + f.setUnique(true); + } else if(c.type == ColumnConstraintInfo::Check) { + f.setCheck(c.text); + } else if(c.type == ColumnConstraintInfo::Default) { + f.setDefaultValue(c.text); + } else if(c.type == ColumnConstraintInfo::Collate) { + f.setCollation(c.text); + } else { + fully_parsed = false; + } + } + } + + $$ = std::make_tuple(f, table_constraints, fully_parsed); + } + | columnid optional_typename { $$ = std::make_tuple(sqlb::Field($1, $2), sqlb::ConstraintSet{}, true); } + ; + +columndef_list: + columndef { $$ = {$1}; } + | columndef_list "," columndef { $$ = $1; $$.push_back($3); } + ; + +optional_constraintname: + %empty { $$ = ""; } + | CONSTRAINT id { $$ = $2; } + ; + +columnid_list: + columnid { $$ = sqlb::StringVector(1, $1); } + | columnid_list "," columnid { $$ = $1; $$.push_back($3); } + ; + +optional_columnid_with_paren_list: + %empty { $$ = sqlb::StringVector(); } + | "(" columnid_list ")" { $$ = $2; } + ; + +fk_clause_part: + ON DELETE SET NULL { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | ON DELETE SET DEFAULT { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | ON DELETE CASCADE { $$ = $1 + " " + $2 + " " + $3; } + | ON DELETE RESTRICT { $$ = $1 + " " + $2 + " " + $3; } + | ON DELETE NO ACTION { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | ON UPDATE SET NULL { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | ON UPDATE SET DEFAULT { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | ON UPDATE CASCADE { $$ = $1 + " " + $2 + " " + $3; } + | ON UPDATE RESTRICT { $$ = $1 + " " + $2 + " " + $3; } + | ON UPDATE NO ACTION { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | ON INSERT SET NULL { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | ON INSERT SET DEFAULT { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | ON INSERT CASCADE { $$ = $1 + " " + $2 + " " + $3; } + | ON INSERT RESTRICT { $$ = $1 + " " + $2 + " " + $3; } + | ON INSERT NO ACTION { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | MATCH id { $$ = $1 + " " + $2; } + ; + +fk_clause_part_list: + fk_clause_part { $$ = $1; } + | fk_clause_part_list fk_clause_part { $$ = $1 + " " + $2; } + ; + +optional_fk_clause: + %empty { $$ = ""; } + | fk_clause_part_list { $$ = $1; } + | fk_clause_part_list DEFERRABLE INITIALLY DEFERRED { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | fk_clause_part_list DEFERRABLE INITIALLY IMMEDIATE { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | fk_clause_part_list DEFERRABLE { $$ = $1 + " " + $2; } + | fk_clause_part_list NOT DEFERRABLE INITIALLY DEFERRED { $$ = $1 + " " + $2 + " " + $3 + " " + $4 + " " + $5; } + | fk_clause_part_list NOT DEFERRABLE INITIALLY IMMEDIATE { $$ = $1 + " " + $2 + " " + $3 + " " + $4 + " " + $5; } + | fk_clause_part_list NOT DEFERRABLE { $$ = $1 + " " + $2 + " " + $3; } + | DEFERRABLE INITIALLY DEFERRED { $$ = $1 + " " + $2 + " " + $3; } + | DEFERRABLE INITIALLY IMMEDIATE { $$ = $1 + " " + $2 + " " + $3; } + | DEFERRABLE { $$ = $1; } + | NOT DEFERRABLE INITIALLY DEFERRED { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | NOT DEFERRABLE INITIALLY IMMEDIATE { $$ = $1 + " " + $2 + " " + $3 + " " + $4; } + | NOT DEFERRABLE { $$ = $1 + " " + $2; } + ; + +tableconstraint: + optional_constraintname PRIMARY KEY "(" indexed_column_list ")" optional_conflictclause { + sqlb::PrimaryKeyConstraint* pk = new sqlb::PrimaryKeyConstraint($5); + pk->setName($1); + pk->setConflictAction($7); + $$ = sqlb::ConstraintPtr(pk); + } + | optional_constraintname PRIMARY KEY "(" indexed_column_list AUTOINCREMENT ")" optional_conflictclause { + sqlb::PrimaryKeyConstraint* pk = new sqlb::PrimaryKeyConstraint($5); + pk->setName($1); + pk->setConflictAction($8); + pk->setAutoIncrement(true); + $$ = sqlb::ConstraintPtr(pk); + } + | optional_constraintname UNIQUE "(" indexed_column_list ")" optional_conflictclause { + sqlb::UniqueConstraint* u = new sqlb::UniqueConstraint($4); + u->setName($1); + u->setConflictAction($6); + $$ = sqlb::ConstraintPtr(u); + } + | optional_constraintname CHECK "(" expr ")" { + $$ = sqlb::ConstraintPtr(new sqlb::CheckConstraint($4)); + $$->setName($1); + } + | optional_constraintname FOREIGN KEY "(" columnid_list ")" REFERENCES tableid optional_columnid_with_paren_list optional_fk_clause { + $$ = sqlb::ConstraintPtr(new sqlb::ForeignKeyClause($8, $9, $10)); + $$->setColumnList($5); + $$->setName($1); + } + ; + +tableconstraint_list: + tableconstraint { $$ = {$1}; } + | tableconstraint_list "," tableconstraint { $$ = $1; $$.insert($3); } + | tableconstraint_list tableconstraint { $$ = $1; $$.insert($2); } + ; + +optional_tableconstraint_list: + %empty { $$ = {}; } + | "," tableconstraint_list { $$ = $2; } + ; + +createtable_stmt: + CREATE optional_temporary TABLE optional_if_not_exists tableid_with_uninteresting_schema AS select_stmt { + $$ = sqlb::TablePtr(new sqlb::Table($5)); + $$->setFullyParsed(false); + } + | CREATE optional_temporary TABLE optional_if_not_exists tableid_with_uninteresting_schema "(" columndef_list optional_tableconstraint_list ")" optional_withoutrowid { + $$ = sqlb::TablePtr(new sqlb::Table($5)); + $$->setWithoutRowidTable($10); + $$->setConstraints($8); + $$->setFullyParsed(true); + + for(const auto& column : $7) + { + sqlb::Field f; + sqlb::ConstraintSet c; + bool fully_parsed; + std::tie(f, c, fully_parsed) = column; + + if(fully_parsed == false) + $$->setFullyParsed(false); + $$->fields.push_back(f); + for(const auto& i : c) + $$->addConstraint(i); + } + } + ; + +%% + +void sqlb::parser::parser::error(const location_type& l, const std::string& m) +{ + std::cerr << l << ": " << m << std::endl; +} diff --git a/src/sql/sqlitetypes.cpp b/src/sql/sqlitetypes.cpp index 444a4551..2f5543df 100644 --- a/src/sql/sqlitetypes.cpp +++ b/src/sql/sqlitetypes.cpp @@ -1,23 +1,10 @@ #include "sqlitetypes.h" #include "ObjectIdentifier.h" -#include "grammar/Sqlite3Lexer.hpp" -#include "grammar/Sqlite3Parser.hpp" +#include "parser/ParserDriver.h" -#include // This include seems to only be necessary for the Windows build #include #include #include -#include - -namespace { -bool starts_with_ci(const std::string& str, const std::string& with) -{ - if(str.size() < with.size()) - return false; - else - return compare_ci(str.substr(0, with.size()), with); -} -} namespace sqlb { @@ -36,77 +23,6 @@ std::string joinStringVector(const StringVector& vec, const std::string& delim) }); } -/** - * @brief The SetLocaleToC class - * This is a stupid helper class which sets the current locale as used by the C++ standard library to the C locale. - * Upon destruction it resets it to whatever the previous locale was. This is used to work around a problem in Antlr's - * string comparison which because it is case-independent relies on the current locale. However, when parsind SQL - * statements we don't want the locale to interfere here. Especially the Turkish locale is problematic here because - * of the dotted I problem. - */ -class SetLocaleToC -{ -public: - SetLocaleToC() - : oldLocale(std::setlocale(LC_CTYPE, nullptr)) // Query current locale and save it - { - // Set locale for standard library functions - std::setlocale(LC_CTYPE, "C.UTF-8"); - } - - ~SetLocaleToC() - { - // Reset old locale - std::setlocale(LC_CTYPE, oldLocale.c_str()); - } - -private: - std::string oldLocale; -}; - -/** - * @brief The CreateTableWalker class - * Goes trough the createtable AST and returns - * Table object. - */ -class CreateTableWalker -{ -public: - explicit CreateTableWalker(antlr::RefAST r) - : m_root(r) - {} - - TablePtr table(); - -private: - void parsecolumn(Table* table, antlr::RefAST c); - std::string parseConflictClause(antlr::RefAST c); - -private: - antlr::RefAST m_root; -}; - -/** - * @brief The CreateIndexWalker class - * Goes trough the createtable AST and returns - * Index object. - */ -class CreateIndexWalker -{ -public: - explicit CreateIndexWalker(antlr::RefAST r) - : m_root(r) - {} - - IndexPtr index(); - -private: - void parsecolumn(Index* index, antlr::RefAST c); - -private: - antlr::RefAST m_root; -}; - bool Object::operator==(const Object& rhs) const { if(m_name != rhs.m_name) @@ -128,7 +44,34 @@ std::string Object::typeToString(Types type) case Types::View: return "view"; case Types::Trigger: return "trigger"; } - return ""; + return std::string(); +} + +ConstraintPtr Constraint::makeConstraint(ConstraintTypes type) +{ + switch(type) + { + case PrimaryKeyConstraintType: + return std::make_shared(); + case UniqueConstraintType: + return std::make_shared(); + case ForeignKeyConstraintType: + return std::make_shared(); + case CheckConstraintType: + return std::make_shared(); + default: + return nullptr; + } +} + +void Constraint::replaceInColumnList(const std::string& from, const std::string& to) +{ + std::replace(column_list.begin(), column_list.end(), from, to); +} + +void Constraint::removeFromColumnList(const std::string& key) +{ + column_list.erase(std::remove(column_list.begin(), column_list.end(), key), column_list.end()); } bool ForeignKeyClause::isSet() const @@ -139,7 +82,7 @@ bool ForeignKeyClause::isSet() const std::string ForeignKeyClause::toString() const { if(!isSet()) - return ""; + return std::string(); if(m_override.size()) return m_override; @@ -160,32 +103,81 @@ void ForeignKeyClause::setFromString(const std::string& fk) m_override = fk; } -std::string ForeignKeyClause::toSql(const StringVector& applyOn) const +std::string ForeignKeyClause::toSql() const { std::string result; if(!m_name.empty()) result = "CONSTRAINT " + escapeIdentifier(m_name) + " "; - result += "FOREIGN KEY(" + joinStringVector(escapeIdentifier(applyOn), ",") + ") REFERENCES " + this->toString(); + result += "FOREIGN KEY(" + joinStringVector(escapeIdentifier(column_list), ",") + ") REFERENCES " + this->toString(); return result; } -std::string UniqueConstraint::toSql(const StringVector& applyOn) const +UniqueConstraint::UniqueConstraint(const IndexedColumnVector& columns) : + m_columns(columns) { - std::string result; - if(!m_name.empty()) - result = "CONSTRAINT " + escapeIdentifier(m_name) + " "; - result += "UNIQUE(" + joinStringVector(escapeIdentifier(applyOn), ",") + ")"; - - return result; + // Extract column names and give them to the column list in the base class + for(const auto& c : columns) + column_list.push_back(c.name()); } -std::string PrimaryKeyConstraint::toSql(const StringVector& applyOn) const +UniqueConstraint::UniqueConstraint(const StringVector& columns) : + Constraint(columns) +{ + setColumnList(columns); +} + +void UniqueConstraint::setColumnList(const StringVector& list) +{ + Constraint::setColumnList(list); + + // Create our own column list without sort orders etc + m_columns.clear(); + for(const auto& c : list) + m_columns.push_back(IndexedColumn(c, false)); +} + +void UniqueConstraint::addToColumnList(const std::string& key) +{ + Constraint::addToColumnList(key); + + // Also add to our own column list + m_columns.push_back(IndexedColumn(key, false)); +} + +void UniqueConstraint::replaceInColumnList(const std::string& from, const std::string& to) +{ + Constraint::replaceInColumnList(from, to); + + for(auto& c : m_columns) + { + if(c.name() == from) + c.setName(to); + } +} + +void UniqueConstraint::removeFromColumnList(const std::string& key) +{ + Constraint::removeFromColumnList(key); + + m_columns.erase(std::remove_if(m_columns.begin(), m_columns.end(), [key](const IndexedColumn& c) { + if(c.name() == key) + return true; + else + return false; + }), m_columns.end()); +} + +std::string UniqueConstraint::toSql() const { std::string result; if(!m_name.empty()) result = "CONSTRAINT " + escapeIdentifier(m_name) + " "; - result += "PRIMARY KEY(" + joinStringVector(escapeIdentifier(applyOn), ",") + ")"; + + std::vector u_columns; + for(const auto& c : m_columns) + u_columns.push_back(c.toString("", " ")); + result += "UNIQUE(" + joinStringVector(u_columns, ",") + ")"; if(!m_conflictAction.empty()) result += " ON CONFLICT " + m_conflictAction; @@ -193,7 +185,36 @@ std::string PrimaryKeyConstraint::toSql(const StringVector& applyOn) const return result; } -std::string CheckConstraint::toSql(const StringVector&) const +PrimaryKeyConstraint::PrimaryKeyConstraint(const IndexedColumnVector& columns) : + UniqueConstraint(columns), + m_auto_increment(false) +{ +} + +PrimaryKeyConstraint::PrimaryKeyConstraint(const StringVector& columns) : + UniqueConstraint(columns), + m_auto_increment(false) +{ +} + +std::string PrimaryKeyConstraint::toSql() const +{ + std::string result; + if(!m_name.empty()) + result = "CONSTRAINT " + escapeIdentifier(m_name) + " "; + + std::vector pk_columns; + for(const auto& c : m_columns) + pk_columns.push_back(c.toString("", " ")); + result += "PRIMARY KEY(" + joinStringVector(pk_columns, ",") + (m_auto_increment ? " AUTOINCREMENT" : "") + ")"; + + if(!m_conflictAction.empty()) + result += " ON CONFLICT " + m_conflictAction; + + return result; +} + +std::string CheckConstraint::toSql() const { std::string result; if(!m_name.empty()) @@ -215,8 +236,6 @@ bool Field::operator==(const Field& rhs) const return false; if(m_defaultvalue != rhs.m_defaultvalue) return false; - if(m_autoincrement != rhs.m_autoincrement) - return false; if(m_unique != rhs.m_unique) return false; if(m_collation != rhs.m_collation) @@ -234,8 +253,6 @@ std::string Field::toString(const std::string& indent, const std::string& sep) c str += " DEFAULT " + m_defaultvalue; if(!m_check.empty()) str += " CHECK(" + m_check + ")"; - if(m_autoincrement) - str += " PRIMARY KEY AUTOINCREMENT"; if(m_unique) str += " UNIQUE"; if(!m_collation.empty()) @@ -296,17 +313,23 @@ bool Field::isBlob() const return false; } -std::string Field::affinity() const +Field::Affinity Field::affinity() const { - if (isInteger()) return "INTEGER"; + if (isInteger()) return IntegerAffinity; - if (isText()) return "TEXT"; + if (isText()) return TextAffinity; - if (isBlob()) return "BLOB"; + if (isBlob()) return BlobAffinity; - if (isReal()) return "REAL"; + if (isReal() || isNumeric()) return FloatAffinity; - return "NUMERIC"; + return BlobAffinity; +} + +Table::Table(const Table& table) + : Object(table.name()) +{ + *this = table; } Table& Table::operator=(const Table& rhs) @@ -341,31 +364,8 @@ bool Table::operator==(const Table& rhs) const return false; if(fields != rhs.fields) return false; - - // We need to compare the constraint maps manually here. The reason is that the values are pointers and the default implementation - // would compare the pointers not the actual objects. - if(m_constraints.size() != rhs.m_constraints.size()) + if(m_constraints != rhs.m_constraints) return false; - for(auto it=m_constraints.cbegin();it!=m_constraints.end();++it) - { - // For each element in this map we get the list of all elements with the same key from the other map. - // Then we loop through that list and check if we find an element of the same type which produces the same SQL substring. We use this - // approach to avoid casting both objects to their actual type, then dereferencing it etc. - auto range = rhs.m_constraints.equal_range(it->first); - bool found_something = false; - for(auto jt=range.first;jt!=range.second;++jt) - { - if(it->second->type() == jt->second->type() && it->second->toSql(it->first) == jt->second->toSql(jt->first)) - { - found_something = true; - break; - } - } - - // If no match was found, the constraint maps aren't equal - if(!found_something) - return false; - } return true; } @@ -394,7 +394,7 @@ StringVector Table::rowidColumns() const { // For WITHOUT ROWID tables this function returns the names of the primary key column. For ordinary tables with a rowid column, it returns "_rowid_" if(m_withoutRowid) - return primaryKey(); + return const_cast(this)->primaryKey()->columnList(); else return {"_rowid_"}; } @@ -407,50 +407,18 @@ FieldInfoList Table::fieldInformation() const return result; } -bool Table::hasAutoIncrement() const -{ - return std::any_of(fields.begin(), fields.end(), [](const Field& f) {return f.autoIncrement(); }); -} - TablePtr Table::parseSQL(const std::string& sSQL) { - SetLocaleToC locale; - - std::stringstream s; - s << sSQL; - Sqlite3Lexer lex(s); - - Sqlite3Parser parser(lex); - - antlr::ASTFactory ast_factory; - parser.initializeASTFactory(ast_factory); - parser.setASTFactory(&ast_factory); - - try + parser::ParserDriver drv; + if(!drv.parse(sSQL)) { - if(sSQL.find("[ blank]") != sSQL.npos) - { - int a = 0; - a++; - } - - parser.createtable(); - CreateTableWalker ctw(parser.getAST()); - - auto t = ctw.table(); + TablePtr t = std::dynamic_pointer_cast(drv.result); t->setOriginalSql(sSQL); return t; + } else { + std::cerr << "Sqlite parse error: " << sSQL << std::endl; + return std::make_shared
(""); } - catch(antlr::ANTLRException& ex) - { - std::cerr << "Sqlite parse error: " << ex.toString() << "(" << sSQL << ")" << std::endl; - } - catch(...) - { - std::cerr << "Sqlite parse error: " << sSQL << std::endl; //TODO - } - - return TablePtr(new Table("")); } std::string Table::sql(const std::string& schema, bool ifNotExists) const @@ -469,21 +437,14 @@ std::string Table::sql(const std::string& schema, bool ifNotExists) const sql += joinStringVector(fieldList(), ",\n"); // Constraints - ConstraintMap::const_iterator it = m_constraints.cbegin(); - bool autoincrement = hasAutoIncrement(); - while(it != m_constraints.cend()) + for(const auto& it : m_constraints) { - // Ignore auto increment primary key constraint - if((!autoincrement || it->second->type() != Constraint::PrimaryKeyConstraintType)) + // Ignore all constraints without any fields, except for check constraints which don't rely on a field vector + if(!it->columnList().empty() || it->type() == Constraint::CheckConstraintType) { - // Ignore all constraints without any fields, except for check constraints which don't rely on a field vector - if(!(it->first.empty() && it->second->type() != Constraint::CheckConstraintType)) - { - sql += ",\n\t"; - sql += it->second->toSql(it->first); - } + sql += ",\n\t"; + sql += it->toSql(); } - ++it; } sql += "\n)"; @@ -495,25 +456,39 @@ std::string Table::sql(const std::string& schema, bool ifNotExists) const return sql + ";"; } -void Table::addConstraint(const StringVector& vStrFields, ConstraintPtr constraint) +void Table::addConstraint(ConstraintPtr constraint) { - m_constraints.insert({vStrFields, constraint}); + m_constraints.insert(constraint); } -void Table::setConstraint(const StringVector& vStrFields, ConstraintPtr constraint) +void Table::setConstraint(ConstraintPtr constraint) { // Delete any old constraints of this type for these fields - removeConstraints(vStrFields, constraint->type()); + removeConstraints(constraint->columnList(), constraint->type()); // Add the new constraint to the table, effectively overwriting all old constraints for that fields/type combination - addConstraint(vStrFields, constraint); + addConstraint(constraint); +} + +void Table::removeConstraint(ConstraintPtr constraint) +{ + for(auto it = m_constraints.begin();it!=m_constraints.end();++it) + { + if((*it)->toSql() == constraint->toSql()) + { + m_constraints.erase(it); + + // Only remove the first constraint matching these criteria + return; + } + } } void Table::removeConstraints(const StringVector& vStrFields, Constraint::ConstraintTypes type) { for(auto it = m_constraints.begin();it!=m_constraints.end();) { - if(it->first == vStrFields && it->second->type() == type) + if((*it)->columnList() == vStrFields && (*it)->type() == type) m_constraints.erase(it++); else ++it; @@ -531,70 +506,55 @@ ConstraintPtr Table::constraint(const StringVector& vStrFields, Constraint::Cons std::vector Table::constraints(const StringVector& vStrFields, Constraint::ConstraintTypes type) const { - ConstraintMap::const_iterator begin, end; - if(vStrFields.empty()) - { - begin = m_constraints.begin(); - end = m_constraints.end(); - } else { - std::tie(begin, end) = m_constraints.equal_range(vStrFields); - } - std::vector clist; - std::transform(begin, end, std::back_inserter(clist), [](std::pair elem){return elem.second;}); - - if(type == Constraint::NoType) + for(const auto& it : m_constraints) { - return clist; - } else { - std::vector clist_typed; - for(const ConstraintPtr& ptr : clist) - { - if(ptr->type() == type) - clist_typed.push_back(ptr); - } - return clist_typed; + if((type == Constraint::NoType || it->type() == type) && (vStrFields.empty() || it->columnList() == vStrFields)) + clist.push_back(it); } + return clist; } -void Table::setConstraints(const ConstraintMap& constraints) +void Table::setConstraints(const ConstraintSet& constraints) { m_constraints = constraints; } -StringVector& Table::primaryKeyRef() +void Table::replaceConstraint(ConstraintPtr from, ConstraintPtr to) { - return const_cast(static_cast(this)->primaryKey()); + auto it = m_constraints.find(from); + if(it == m_constraints.end()) + return; + + m_constraints.erase(it); // Erase old constraint + m_constraints.insert(to); // Insert new constraint } -const StringVector& Table::primaryKey() const +std::shared_ptr Table::primaryKey() { - auto it = m_constraints.cbegin(); - while(it != m_constraints.cend()) - { - if(it->second->type() == Constraint::PrimaryKeyConstraintType) - return it->first; - ++it; - } - - static StringVector emptyFieldVector; - return emptyFieldVector; + const auto c = constraint({}, Constraint::PrimaryKeyConstraintType); + if(c) + return std::dynamic_pointer_cast(c); + else + return nullptr; } void Table::removeKeyFromAllConstraints(const std::string& key) { - // First remove all constraints with exactly that one key - m_constraints.erase({key}); - - // Then delete all occurrences of the key in compound columns + // Update all constraints for(auto it=m_constraints.begin();it!=m_constraints.end();) { - if(contains(it->first, key)) + // Check if they contain the old key name + if(contains((*it)->columnList(), key)) { - StringVector k = it->first; - k.erase(std::remove(k.begin(), k.end(), key), k.end()); - m_constraints.insert({k, it->second}); - it = m_constraints.erase(it); + // If so, remove it from the column list + (*it)->removeFromColumnList(key); + + // If the column list is empty now, remove the entire constraint. Otherwise save the updated column list + if((*it)->columnList().empty()) + it = m_constraints.erase(it); + else + ++it; } else { ++it; } @@ -608,626 +568,13 @@ void Table::renameKeyInAllConstraints(const std::string& key, const std::string& return; // Find all occurrences of the key and change it to the new one - for(auto it=m_constraints.begin();it!=m_constraints.end();) + for(auto& it : m_constraints) { - if(contains(it->first, key)) - { - StringVector k = it->first; - std::replace(k.begin(), k.end(), key, to); - m_constraints.insert({k, it->second}); - it = m_constraints.erase(it); - } else { - ++it; - } + if(contains(it->columnList(), key)) + it->replaceInColumnList(key, to); } } -namespace -{ -std::string unescape_identifier(std::string str, char quote_char) -{ - std::string quote(2, quote_char); - - size_t pos = 0; - while((pos = str.find(quote, pos)) != std::string::npos) - { - str.erase(pos, 1); - pos += 1; // Don't remove the other quote char too - } - return str; -} - -std::string identifier(antlr::RefAST ident) -{ - std::string sident = ident->getText(); - if(ident->getType() == sqlite3TokenTypes::QUOTEDID || - ident->getType() == Sqlite3Lexer::QUOTEDLITERAL || - ident->getType() == sqlite3TokenTypes::STRINGLITERAL) - { - // Remember the way the identifier is quoted - char quoteChar = sident.at(0); - - // Remove first and final character, i.e. the quotes - sident = sident.substr(1, sident.size() - 2); - - // Replace all remaining occurences of two succeeding quote characters and replace them - // by a single instance. This is done because two quotes can be used as a means of escaping - // the quote character, thus only the visual representation has its two quotes, the actual - // name contains only one. - sident = unescape_identifier(sident, quoteChar); - } - - return sident; -} - -std::string textAST(antlr::RefAST t) -{ - // When this is called for a KEYWORDASTABLENAME token, we must take the child's content to get the actual value - // instead of 'KEYWORDASTABLENAME' as a string. The same applies for KEYWORDASCOLUMNNAME tokens. - if(t != antlr::nullAST && (t->getType() == sqlite3TokenTypes::KEYWORDASTABLENAME || t->getType() == sqlite3TokenTypes::KEYWORDASCOLUMNNAME)) - return t->getFirstChild()->getText(); - else - return t->getText(); -} - -std::string concatTextAST(antlr::RefAST t, bool withspace = false) -{ - StringVector stext; - while(t != antlr::nullAST) - { - stext.push_back(textAST(t)); - t = t->getNextSibling(); - } - return joinStringVector(stext, withspace ? " " : ""); -} - -std::string concatExprAST(antlr::RefAST t) -{ - std::string expr; - - int num_paren = 1; - while(t) - { - if(t->getType() == sqlite3TokenTypes::LPAREN) - num_paren++; - else if(t->getType() == sqlite3TokenTypes::RPAREN) - num_paren--; - - if(num_paren == 0) - break; - - switch(t->getType()) - { - case sqlite3TokenTypes::AND: - case sqlite3TokenTypes::OR: - case sqlite3TokenTypes::IN: - case sqlite3TokenTypes::LIKE: - case sqlite3TokenTypes::MATCH: - case sqlite3TokenTypes::REGEXP: - case sqlite3TokenTypes::EXISTS: - case sqlite3TokenTypes::GLOB: - case sqlite3TokenTypes::BETWEEN: - expr += " " + textAST(t) + " "; - break; - case sqlite3TokenTypes::NOT: - expr += " " + textAST(t); - break; - default: - expr += textAST(t); - } - - t = t->getNextSibling(); - } - - return expr; -} -} - -namespace { -std::string tablename(const antlr::RefAST& n) -{ - if(n->getType() == sqlite3TokenTypes::KEYWORDASTABLENAME) - return concatTextAST(n->getFirstChild()); - else - return identifier(n); -} -std::string columnname(const antlr::RefAST& n) -{ - if(n->getType() == sqlite3TokenTypes::KEYWORDASCOLUMNNAME) - return concatTextAST(n->getFirstChild()); - else if(n->getType() == sqlite3TokenTypes::INDEXEDCOLUMN) - return columnname(n->getFirstChild()); - else - return identifier(n); -} -} - -TablePtr CreateTableWalker::table() -{ - Table* tab = new Table(""); - tab->setFullyParsed(true); - - if( m_root ) //CREATE TABLE - { - antlr::RefAST s = m_root->getFirstChild(); - - // If the primary tree isn't filled, this isn't a normal CREATE TABLE statement. Switch to the next alternative tree. - if(s == nullptr) - s = m_root->getNextSibling(); - - // Skip to table name - bool is_virtual_table = false; - while(s->getType() != Sqlite3Lexer::ID && - s->getType() != Sqlite3Lexer::QUOTEDID && - s->getType() != Sqlite3Lexer::QUOTEDLITERAL && - s->getType() != Sqlite3Lexer::STRINGLITERAL && - s->getType() != sqlite3TokenTypes::KEYWORDASTABLENAME) - { - // Is this one of these virtual tables? - if(s->getType() == Sqlite3Lexer::VIRTUAL) - is_virtual_table = true; - - s = s->getNextSibling(); - } - - // Extract and set table name - tab->setName(tablename(s)); - - // Special handling for virtual tables. If this is a virtual table, extract the USING part and skip all the - // rest of this function because virtual tables don't have column definitons - if(is_virtual_table) - { - s = s->getNextSibling(); // USING - s = s->getNextSibling(); // module name - tab->setVirtualUsing(concatTextAST(s, true)); - tab->setFullyParsed(false); - - return TablePtr(tab); - } - - // This is a normal table, not a virtual one - s = s->getNextSibling(); // LPAREN - s = s->getNextSibling(); // first column name - antlr::RefAST column = s; - // loop columndefs - while(column != antlr::nullAST && column->getType() == sqlite3TokenTypes::COLUMNDEF) - { - parsecolumn(tab, column->getFirstChild()); - column = column->getNextSibling(); //COMMA or RPAREN - column = column->getNextSibling(); //null or tableconstraint - - s = s->getNextSibling(); // COLUMNDEF - s = s->getNextSibling(); // COMMA or RPAREN - } - - // now we are finished or it is a tableconstraint - while(s != antlr::nullAST) - { - // Is this a 'without rowid' definiton? - if(s->getType() != sqlite3TokenTypes::WITHOUT) - { - // It's not, so treat this as table constraints - - antlr::RefAST tc = s->getFirstChild(); - - // Extract constraint name, if there is any - std::string constraint_name; - if(tc->getType() == sqlite3TokenTypes::CONSTRAINT) - { - tc = tc->getNextSibling(); // CONSTRAINT - constraint_name = identifier(tc); - tc = tc->getNextSibling(); // identifier - } - - switch(tc->getType()) - { - case sqlite3TokenTypes::PRIMARY: - { - PrimaryKeyConstraint* pk = new PrimaryKeyConstraint; - pk->setName(constraint_name); - - tc = tc->getNextSibling()->getNextSibling(); // skip primary and key - tc = tc->getNextSibling(); // skip LPAREN - - StringVector fields; - do - { - antlr::RefAST indexed_column = tc->getFirstChild(); - - std::string col = columnname(indexed_column); - fields.push_back(col); - - indexed_column = indexed_column->getNextSibling(); - if(indexed_column != antlr::nullAST - && (indexed_column->getType() == sqlite3TokenTypes::ASC - || indexed_column->getType() == sqlite3TokenTypes::DESC)) - { - // TODO save ASC / DESC information? - tab->setFullyParsed(false); - indexed_column = indexed_column->getNextSibling(); - } - - if(indexed_column != antlr::nullAST && indexed_column->getType() == sqlite3TokenTypes::COLLATE) - { - indexed_column = indexed_column->getNextSibling(); // COLLATE - // TODO save collation name - tab->setFullyParsed(false); - indexed_column = indexed_column->getNextSibling(); // collation name - } - - if(indexed_column != antlr::nullAST && indexed_column->getType() == sqlite3TokenTypes::AUTOINCREMENT) - { - auto field = findField(tab, col); - field->setAutoIncrement(true); - indexed_column = indexed_column->getNextSibling(); - } - - tc = tc->getNextSibling(); // indexed column - - while(tc != antlr::nullAST && tc->getType() == sqlite3TokenTypes::COMMA) - { - tc = tc->getNextSibling(); // skip ident and comma - } - } while(tc != antlr::nullAST && tc->getType() != sqlite3TokenTypes::RPAREN); - - // We're either done now or there is a conflict clause - tc = tc->getNextSibling(); // skip RPAREN - pk->setConflictAction(parseConflictClause(tc)); - - tab->addConstraint(fields, ConstraintPtr(pk)); - } - break; - case sqlite3TokenTypes::UNIQUE: - { - UniqueConstraint* unique = new UniqueConstraint; - unique->setName(constraint_name); - - tc = tc->getNextSibling(); // skip UNIQUE - tc = tc->getNextSibling(); // skip LPAREN - StringVector fields; - do - { - antlr::RefAST indexed_column = tc->getFirstChild(); - - std::string col = columnname(indexed_column); - auto field = findField(tab, col); - fields.push_back(field->name()); - - indexed_column = indexed_column->getNextSibling(); - if(indexed_column != antlr::nullAST - && (indexed_column->getType() == sqlite3TokenTypes::ASC - || indexed_column->getType() == sqlite3TokenTypes::DESC)) - { - // TODO save ASC / DESC information? - tab->setFullyParsed(false); - indexed_column = indexed_column->getNextSibling(); - } - - if(indexed_column != antlr::nullAST && indexed_column->getType() == sqlite3TokenTypes::COLLATE) - { - indexed_column = indexed_column->getNextSibling(); // COLLATE - // TODO save collation name - tab->setFullyParsed(false); - indexed_column = indexed_column->getNextSibling(); // collation name - } - - tc = tc->getNextSibling(); // indexed column - - while(tc != antlr::nullAST && tc->getType() == sqlite3TokenTypes::COMMA) - { - tc = tc->getNextSibling(); // skip ident and comma - } - } while(tc != antlr::nullAST && tc->getType() != sqlite3TokenTypes::RPAREN); - - if(fields.size() == 1 && constraint_name.empty()) - { - findField(tab, fields[0])->setUnique(true); - delete unique; - } else { - tab->addConstraint(fields, ConstraintPtr(unique)); - } - } - break; - case sqlite3TokenTypes::FOREIGN: - { - ForeignKeyClause* fk = new ForeignKeyClause; - fk->setName(constraint_name); - - tc = tc->getNextSibling(); // FOREIGN - tc = tc->getNextSibling(); // KEY - tc = tc->getNextSibling(); // LPAREN - - StringVector fields; - do - { - std::string col = columnname(tc); - fields.push_back(findField(tab, col)->name()); - - tc = tc->getNextSibling(); - - while(tc != antlr::nullAST && tc->getType() == sqlite3TokenTypes::COMMA) - tc = tc->getNextSibling(); // skip ident and comma - } while(tc != antlr::nullAST && tc->getType() != sqlite3TokenTypes::RPAREN); - - tc = tc->getNextSibling(); - tc = tc->getNextSibling(); // REFERENCES - - fk->setTable(identifier(tc)); - tc = tc->getNextSibling(); // identifier - - if(tc != antlr::nullAST && tc->getType() == sqlite3TokenTypes::LPAREN) - { - tc = tc->getNextSibling(); // LPAREN - - StringVector fk_cols; - while(tc != antlr::nullAST && tc->getType() != sqlite3TokenTypes::RPAREN) - { - if(tc->getType() != sqlite3TokenTypes::COMMA) - fk_cols.push_back(identifier(tc)); - tc = tc->getNextSibling(); - } - fk->setColumns(fk_cols); - - tc = tc->getNextSibling(); // RPAREN - } - - fk->setConstraint(concatTextAST(tc, true)); - tab->addConstraint(fields, ConstraintPtr(fk)); - } - break; - case sqlite3TokenTypes::CHECK: - { - CheckConstraint* check = new CheckConstraint; - check->setName(constraint_name); - - tc = tc->getNextSibling(); // skip CHECK - tc = tc->getNextSibling(); // skip LPAREN - - check->setExpression(concatExprAST(tc)); - tab->addConstraint(StringVector(), ConstraintPtr(check)); - } - break; - default: - { - std::cout << "unknown table constraint in " << tab->name() << std::endl; - tab->setFullyParsed(false); - } - break; - } - - s = s->getNextSibling(); //COMMA or RPAREN - if(s->getType() == sqlite3TokenTypes::COMMA || s->getType() == sqlite3TokenTypes::RPAREN) - s = s->getNextSibling(); - } else { - // It is - - s = s->getNextSibling(); // WITHOUT - s = s->getNextSibling(); // ROWID - - tab->setWithoutRowidTable(true); - } - } - } - - return TablePtr(tab); -} - -void CreateTableWalker::parsecolumn(Table* table, antlr::RefAST c) -{ - std::string colname; - std::string type = "TEXT"; - bool autoincrement = false; - bool notnull = false; - bool unique = false; - std::string defaultvalue; - std::string check; - std::string collation; - sqlb::PrimaryKeyConstraint* primaryKey = nullptr; - std::vector foreignKeys; - - colname = columnname(c); - c = c->getNextSibling(); //type? - if(c != antlr::nullAST && c->getType() == sqlite3TokenTypes::TYPE_NAME) - { - antlr::RefAST t = c->getFirstChild(); - - if(t != antlr::nullAST) - { - type.clear(); - } - - while(t != antlr::nullAST) - { - int thisType = t->getType(); - type += textAST(t); - t = t->getNextSibling(); - if(t != antlr::nullAST) - { - int nextType = t->getType(); - if(nextType != sqlite3TokenTypes::LPAREN && nextType != sqlite3TokenTypes::RPAREN && - thisType != sqlite3TokenTypes::LPAREN) - { - type.append(" "); - } - } - } - c = c->getNextSibling(); - } - - // finished with type parsing - // now columnconstraints - while(c != antlr::nullAST) - { - antlr::RefAST con = c->getFirstChild(); - - // Extract constraint name, if there is any - std::string constraint_name; - if(con->getType() == sqlite3TokenTypes::CONSTRAINT) - { - con = con->getNextSibling(); // CONSTRAINT - constraint_name = identifier(con); - con = con->getNextSibling(); // identifier - } - - switch(con->getType()) - { - case sqlite3TokenTypes::PRIMARY: - { - // If we have already allocated a primary key object, delete it first. This should never happen in real world situations because - // SQLite only supports one primary key constraint per field. - if(primaryKey) - delete primaryKey; - - primaryKey = new PrimaryKeyConstraint; - primaryKey->setName(constraint_name); - - con = con->getNextSibling()->getNextSibling(); // skip KEY - if(con != antlr::nullAST && (con->getType() == sqlite3TokenTypes::ASC - || con->getType() == sqlite3TokenTypes::DESC)) - { - table->setFullyParsed(false); - con = con->getNextSibling(); //skip - } - - primaryKey->setConflictAction(parseConflictClause(con)); - - if(con != antlr::nullAST && con->getType() == sqlite3TokenTypes::AUTOINCREMENT) - autoincrement = true; - } - break; - case sqlite3TokenTypes::NOT: - { - // TODO Support constraint names here - if(!constraint_name.empty()) - table->setFullyParsed(false); - - notnull = true; - } - break; - case sqlite3TokenTypes::NULL_T: - { - notnull = false; - } - break; - case sqlite3TokenTypes::CHECK: - { - con = con->getNextSibling(); //CHECK - con = con->getNextSibling(); //LPAREN - - check = concatExprAST(con); - - // If we have a constraint name, convert this constraint from a column into a table constaint in order to save it with our data model - if(!constraint_name.empty()) - { - CheckConstraint* check_constraint = new CheckConstraint(check); - check_constraint->setName(constraint_name); - table->addConstraint({colname}, ConstraintPtr(check_constraint)); - check.clear(); - } - } - break; - case sqlite3TokenTypes::DEFAULT: - { - // TODO Support constraint names here - if(!constraint_name.empty()) - table->setFullyParsed(false); - - con = con->getNextSibling(); //SIGNEDNUMBER,STRING,LPAREN - defaultvalue = concatTextAST(con); - } - break; - case sqlite3TokenTypes::UNIQUE: - { - // TODO Support constraint names here - if(!constraint_name.empty()) - table->setFullyParsed(false); - - unique = true; - } - break; - case sqlite3TokenTypes::REFERENCES: - { - con = con->getNextSibling(); // REFERENCES - - sqlb::ForeignKeyClause* foreignKey = new ForeignKeyClause; - foreignKey->setTable(identifier(con)); - foreignKey->setName(constraint_name); - con = con->getNextSibling(); // identifier - - if(con != antlr::nullAST && con->getType() == sqlite3TokenTypes::LPAREN) - { - con = con->getNextSibling(); // LPAREN - - StringVector fk_cols; - while(con != antlr::nullAST && con->getType() != sqlite3TokenTypes::RPAREN) - { - if(con->getType() != sqlite3TokenTypes::COMMA) - fk_cols.push_back(identifier(con)); - con = con->getNextSibling(); - } - foreignKey->setColumns(fk_cols); - - con = con->getNextSibling(); // RPAREN - } - - foreignKey->setConstraint(concatTextAST(con, true)); - foreignKeys.push_back(foreignKey); - } - break; - case sqlite3TokenTypes::COLLATE: - { - con = con->getNextSibling(); // COLLATE - collation = identifier(con); - con = con->getNextSibling(); // collation name - } - break; - default: - { - std::cout << "unknown column constraint in " << table->name() << "." << colname << std::endl; - table->setFullyParsed(false); - } - break; - } - c = c->getNextSibling(); - } - - Field f(colname, type, notnull, defaultvalue, check, unique, collation); - f.setAutoIncrement(autoincrement); - table->fields.push_back(f); - - for(sqlb::ForeignKeyClause* fk : foreignKeys) - table->addConstraint({f.name()}, ConstraintPtr(fk)); - if(primaryKey) - { - StringVector v; - if(table->constraint(v, Constraint::PrimaryKeyConstraintType)) - { - table->primaryKeyRef().push_back(f.name()); - - // Delete useless primary key constraint. There already is a primary key object for this table, we - // don't need another one. - delete primaryKey; - } else { - table->addConstraint({f.name()}, ConstraintPtr(primaryKey)); - } - } -} - -std::string CreateTableWalker::parseConflictClause(antlr::RefAST c) -{ - std::string conflictAction; - - if(c != antlr::nullAST && c->getType() == sqlite3TokenTypes::ON && c->getNextSibling()->getType() == sqlite3TokenTypes::CONFLICT) - { - c = c->getNextSibling(); // skip ON - c = c->getNextSibling(); // skip CONFLICT - conflictAction = identifier(c); - c = c->getNextSibling(); // skip action - } - - return conflictAction; -} - std::string IndexedColumn::toString(const std::string& indent, const std::string& sep) const @@ -1299,157 +646,16 @@ FieldInfoList Index::fieldInformation() const IndexPtr Index::parseSQL(const std::string& sSQL) { - SetLocaleToC locale; - - std::stringstream s; - s << sSQL; - Sqlite3Lexer lex(s); - - Sqlite3Parser parser(lex); - - antlr::ASTFactory ast_factory; - parser.initializeASTFactory(ast_factory); - parser.setASTFactory(&ast_factory); - - try + parser::ParserDriver drv; + if(!drv.parse(sSQL)) { - parser.createindex(); - CreateIndexWalker ctw(parser.getAST()); - - auto i = ctw.index(); + IndexPtr i = std::dynamic_pointer_cast(drv.result); i->setOriginalSql(sSQL); return i; - } - catch(antlr::ANTLRException& ex) - { - std::cerr << "Sqlite parse error: " << ex.toString() << "(" << sSQL << ")" << std::endl; - } - catch(...) - { - std::cerr << "Sqlite parse error: " << sSQL << std::endl; //TODO - } - - return IndexPtr(new Index("")); -} - -IndexPtr CreateIndexWalker::index() -{ - Index* index = new Index(""); - index->setFullyParsed(true); - - if(m_root) // CREATE INDEX - { - antlr::RefAST s = m_root->getFirstChild(); - - // Skip to index name - while(s->getType() != Sqlite3Lexer::ID && - s->getType() != Sqlite3Lexer::QUOTEDID && - s->getType() != Sqlite3Lexer::QUOTEDLITERAL && - s->getType() != Sqlite3Lexer::STRINGLITERAL && - s->getType() != sqlite3TokenTypes::KEYWORDASTABLENAME) - { - // Is this a unique index? - if(s->getType() == Sqlite3Lexer::UNIQUE) - index->setUnique(true); - - s = s->getNextSibling(); - } - - // Extract and set index name - index->setName(tablename(s)); - - // Get table name - s = s->getNextSibling(); // ON - s = s->getNextSibling(); // table name - index->setTable(tablename(s)); - - s = s->getNextSibling(); // LPAREN - s = s->getNextSibling(); // first column name - antlr::RefAST column = s; - // loop columndefs - while(column != antlr::nullAST && column->getType() == sqlite3TokenTypes::INDEXEDCOLUMN) - { - parsecolumn(index, column->getFirstChild()); - column = column->getNextSibling(); // COMMA or RPAREN - column = column->getNextSibling(); // null or WHERE - - s = s->getNextSibling(); // COLUMNDEF - s = s->getNextSibling(); // COMMA or RPAREN - } - - // Now we are finished or it is a partial index - if(s != antlr::nullAST) - { - // This should be a 'where' then - if(s->getType() != sqlite3TokenTypes::WHERE) - { - // It is something else - index->setFullyParsed(false); - } else { - s = s->getNextSibling(); // expr - index->setWhereExpr(concatTextAST(s, true)); - } - } - } - - return IndexPtr(index); -} - -void CreateIndexWalker::parsecolumn(Index* index, antlr::RefAST c) -{ - std::string name; - bool isExpression; - std::string order; - - // First count the number of nodes used for the name or the expression. We reach the end of the name nodes list when we either - // get to the end of the list, get to a COMMA or a RPAREN, or get to the COLLATE keyword or get to the ASC/DESC keywords. - // Then see how many items there are: if it's one it's a normal index column with only a column name. In this case get the identifier. - // If it's more than one item it's an expression. In this case get all the items as they are. - int number_of_name_items = 0; - antlr::RefAST n = c; - while(n != antlr::nullAST - && n->getType() != sqlite3TokenTypes::COLLATE - && n->getType() != sqlite3TokenTypes::ASC - && n->getType() != sqlite3TokenTypes::DESC - && n->getType() != sqlite3TokenTypes::COMMA - && n->getType() != sqlite3TokenTypes::RPAREN) - { - number_of_name_items++; - n = n->getNextSibling(); - } - if(number_of_name_items == 1) - { - name = identifier(c); - isExpression = false; - c = c->getNextSibling(); } else { - for(int i=0;igetText() + " "; - c = c->getNextSibling(); - } - name = name.substr(0, name.size()-1); - isExpression = true; + std::cerr << "Sqlite parse error: " << sSQL << std::endl; + return std::make_shared(""); } - - // Parse the rest of the column definition - while(c != antlr::nullAST) - { - switch(c->getType()) - { - case sqlite3TokenTypes::ASC: - case sqlite3TokenTypes::DESC: - order = c->getText().c_str(); - break; - default: - // TODO Add support for COLLATE - index->setFullyParsed(false); - } - - c = c->getNextSibling(); - } - - index->fields.emplace_back(name, isExpression, order); } @@ -1458,7 +664,7 @@ ViewPtr View::parseSQL(const std::string& sSQL) { // TODO - auto v = ViewPtr(new View("")); + auto v = std::make_shared(""); v->setOriginalSql(sSQL); return v; } @@ -1486,7 +692,7 @@ TriggerPtr Trigger::parseSQL(const std::string& sSQL) { // TODO - auto t = TriggerPtr(new Trigger("")); + auto t = std::make_shared(""); t->setOriginalSql(sSQL); return t; } diff --git a/src/sql/sqlitetypes.h b/src/sql/sqlitetypes.h index 20be76fa..2a0c1bc3 100644 --- a/src/sql/sqlitetypes.h +++ b/src/sql/sqlitetypes.h @@ -4,10 +4,10 @@ #include #include -#include #include #include #include +#include template bool contains(const C& container, E element) @@ -18,10 +18,18 @@ bool contains(const C& container, E element) template bool compare_ci(const T& a, const T& b) { + // Note: This function does not have to be (actually it must not be) fully UTF-8 aware because SQLite itself is not either. + + if(a.length() != b.length()) + return false; return std::equal(a.begin(), a.end(), b.begin(), [](unsigned char c1, unsigned char c2) { - // TODO: Do we need to make this UTF-8-aware? return std::tolower(c1) == std::tolower(c2); }); + + // TODO Replace the entire code above by the following once we have enabled C++14 support + /*return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](unsigned char c1, unsigned char c2) { + return std::tolower(c1) == std::tolower(c2); + });*/ } template @@ -30,6 +38,14 @@ bool compare_ci(const T& a, const char* b) return compare_ci(a, std::string(b)); } +inline bool starts_with_ci(const std::string& str, const std::string& with) +{ + if(str.size() < with.size()) + return false; + else + return compare_ci(str.substr(0, with.size()), with); +} + namespace sqlb { using StringVector = std::vector; @@ -37,18 +53,6 @@ using StringVector = std::vector; StringVector escapeIdentifier(StringVector ids); std::string joinStringVector(const StringVector& vec, const std::string& delim); -struct StringVectorHash -{ - size_t operator()(const StringVector& key) const - { - // This is taken from Boost - size_t seed = 0; - for(const std::string& s : key) - seed ^= std::hash{}(s) + 0x9e3779b9 + (seed << 6) + ( seed >> 2); - return seed; - } -}; - class Object; class Table; class Index; @@ -66,7 +70,7 @@ using TriggerPtr = std::shared_ptr; using ConstraintPtr = std::shared_ptr; using FieldVector = std::vector; using IndexedColumnVector = std::vector; -using ConstraintMap = std::unordered_multimap; +using ConstraintSet = std::set; using FieldInfoList = std::vector; struct FieldInfo @@ -92,7 +96,7 @@ public: }; explicit Object(const std::string& name): m_name(name), m_fullyParsed(false) {} - virtual ~Object() {} + virtual ~Object() = default; bool operator==(const Object& rhs) const; @@ -131,27 +135,38 @@ class Constraint public: enum ConstraintTypes { - NoType, PrimaryKeyConstraintType, UniqueConstraintType, ForeignKeyConstraintType, CheckConstraintType, + + NoType = 999, }; - explicit Constraint(const std::string& name = std::string()) - : m_name(name) + explicit Constraint(const StringVector& columns = {}, const std::string& name = std::string()) + : column_list(columns), + m_name(name) { } - virtual ~Constraint() {} + virtual ~Constraint() = default; + + static ConstraintPtr makeConstraint(ConstraintTypes type); virtual ConstraintTypes type() const = 0; void setName(const std::string& name) { m_name = name; } const std::string& name() const { return m_name; } - virtual std::string toSql(const StringVector& applyOn) const = 0; + StringVector columnList() const { return column_list; } + virtual void setColumnList(const StringVector& list) { column_list = list; } + virtual void addToColumnList(const std::string& key) { column_list.push_back(key); } + virtual void replaceInColumnList(const std::string& from, const std::string& to); + virtual void removeFromColumnList(const std::string& key); + + virtual std::string toSql() const = 0; protected: + StringVector column_list; std::string m_name; }; @@ -178,7 +193,7 @@ public: void setConstraint(const std::string& constraint) { m_constraint = constraint; } const std::string& constraint() const { return m_constraint; } - std::string toSql(const StringVector& applyOn) const override; + std::string toSql() const override; ConstraintTypes type() const override { return ForeignKeyConstraintType; } @@ -193,27 +208,47 @@ private: class UniqueConstraint : public Constraint { public: - UniqueConstraint() {} - - std::string toSql(const StringVector& applyOn) const override; - - ConstraintTypes type() const override { return UniqueConstraintType; } -}; - -class PrimaryKeyConstraint : public Constraint -{ -public: - PrimaryKeyConstraint() {} + explicit UniqueConstraint(const IndexedColumnVector& columns = {}); + explicit UniqueConstraint(const StringVector& columns); void setConflictAction(const std::string& conflict) { m_conflictAction = conflict; } const std::string& conflictAction() const { return m_conflictAction; } - std::string toSql(const StringVector& applyOn) const override; + // We override these because we maintain our own copy of the column_list variable in m_columns. + // This needs to be done because in a unique constraint we can add expressions, sort order, etc. to the + // list of columns. + void setColumnList(const StringVector& list) override; + void addToColumnList(const std::string& key) override; + void replaceInColumnList(const std::string& from, const std::string& to) override; + void removeFromColumnList(const std::string& key) override; + + std::string toSql() const override; + + ConstraintTypes type() const override { return UniqueConstraintType; } + +protected: + IndexedColumnVector m_columns; + std::string m_conflictAction; +}; + +class PrimaryKeyConstraint : public UniqueConstraint +{ + // Primary keys are a sort of unique constraint for us. This matches quite nicely as both can have a conflict action + // and both need to maintain a copy of the column list with sort order information etc. + +public: + explicit PrimaryKeyConstraint(const IndexedColumnVector& columns = {}); + explicit PrimaryKeyConstraint(const StringVector& columns); + + void setAutoIncrement(bool ai) { m_auto_increment = ai; } + bool autoIncrement() const { return m_auto_increment; } + + std::string toSql() const override; ConstraintTypes type() const override { return PrimaryKeyConstraintType; } private: - std::string m_conflictAction; + bool m_auto_increment; }; class CheckConstraint : public Constraint @@ -227,7 +262,7 @@ public: void setExpression(const std::string& expr) { m_expression = expr; } const std::string& expression() const { return m_expression; } - std::string toSql(const StringVector& applyOn) const override; + std::string toSql() const override; ConstraintTypes type() const override { return CheckConstraintType; } @@ -240,23 +275,21 @@ class Field public: Field() : m_notnull(false), - m_autoincrement(false), m_unique(false) {} Field(const std::string& name, const std::string& type, bool notnull = false, - const std::string& defaultvalue = "", - const std::string& check = "", + const std::string& defaultvalue = std::string(), + const std::string& check = std::string(), bool unique = false, - const std::string& collation = "") + const std::string& collation = std::string()) : m_name(name) , m_type(type) , m_notnull(notnull) , m_check(check) , m_defaultvalue(defaultvalue) - , m_autoincrement(false) , m_unique(unique) , m_collation(collation) {} @@ -270,7 +303,6 @@ public: void setNotNull(bool notnull = true) { m_notnull = notnull; } void setCheck(const std::string& check) { m_check = check; } void setDefaultValue(const std::string& defaultvalue) { m_defaultvalue = defaultvalue; } - void setAutoIncrement(bool autoinc) { m_autoincrement = autoinc; } void setUnique(bool u) { m_unique = u; } void setCollation(const std::string& collation) { m_collation = collation; } @@ -280,15 +312,22 @@ public: bool isReal() const; bool isNumeric() const; - // Type affinity of the column according to SQLite3 rules - std::string affinity() const; + // Type affinity of the column according to SQLite3 rules. + // The Affinity enum values match the SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_BLOB, and SQLITE_TEXT constants + enum Affinity + { + IntegerAffinity = 1, + FloatAffinity = 2, + TextAffinity = 3, + BlobAffinity = 4, + }; + Affinity affinity() const; const std::string& name() const { return m_name; } const std::string& type() const { return m_type; } bool notnull() const { return m_notnull; } const std::string& check() const { return m_check; } const std::string& defaultValue() const { return m_defaultvalue; } - bool autoIncrement() const { return m_autoincrement; } bool unique() const { return m_unique; } const std::string& collation() const { return m_collation; } @@ -298,7 +337,6 @@ private: bool m_notnull; std::string m_check; std::string m_defaultvalue; - bool m_autoincrement; //! this is stored here for simplification bool m_unique; std::string m_collation; }; @@ -307,6 +345,7 @@ class Table : public Object { public: explicit Table(const std::string& name): Object(name), m_withoutRowid(false) {} + explicit Table(const Table& table); Table& operator=(const Table& rhs); bool operator==(const Table& rhs) const; @@ -335,15 +374,16 @@ public: FieldInfoList fieldInformation() const override; - void addConstraint(const StringVector& vStrFields, ConstraintPtr constraint); - void setConstraint(const StringVector& vStrFields, ConstraintPtr constraint); - void removeConstraints(const StringVector& vStrFields = StringVector(), Constraint::ConstraintTypes type = Constraint::NoType); //! Only removes the first constraint, if any + void addConstraint(ConstraintPtr constraint); + void setConstraint(ConstraintPtr constraint); + void removeConstraint(ConstraintPtr constraint); + void removeConstraints(const StringVector& vStrFields = StringVector(), Constraint::ConstraintTypes type = Constraint::NoType); ConstraintPtr constraint(const StringVector& vStrFields = StringVector(), Constraint::ConstraintTypes type = Constraint::NoType) const; //! Only returns the first constraint, if any std::vector constraints(const StringVector& vStrFields = StringVector(), Constraint::ConstraintTypes type = Constraint::NoType) const; - ConstraintMap allConstraints() const { return m_constraints; } - void setConstraints(const ConstraintMap& constraints); - StringVector& primaryKeyRef(); - const StringVector& primaryKey() const; + ConstraintSet allConstraints() const { return m_constraints; } + void setConstraints(const ConstraintSet& constraints); + void replaceConstraint(ConstraintPtr from, ConstraintPtr to); + std::shared_ptr primaryKey(); void removeKeyFromAllConstraints(const std::string& key); void renameKeyInAllConstraints(const std::string& key, const std::string& to); @@ -355,17 +395,18 @@ public: static TablePtr parseSQL(const std::string& sSQL); private: StringVector fieldList() const; - bool hasAutoIncrement() const; private: bool m_withoutRowid; - ConstraintMap m_constraints; + ConstraintSet m_constraints; std::string m_virtual; }; class IndexedColumn { public: + IndexedColumn() {} + IndexedColumn(const std::string& name, bool expr, const std::string& order = std::string()) : m_name(name), m_isExpression(expr), diff --git a/src/sqlitedb.cpp b/src/sqlitedb.cpp index 4bd42fc8..0128ba55 100644 --- a/src/sqlitedb.cpp +++ b/src/sqlitedb.cpp @@ -13,19 +13,21 @@ #include #include #include -#include #include #include -#include -#include -#include -#include +#include #include -#include + +#include +#include +#include +#include +#include +#include using json = nlohmann::json; -QStringList DBBrowserDB::Datatypes = QStringList() << "INTEGER" << "TEXT" << "BLOB" << "REAL" << "NUMERIC"; +QStringList DBBrowserDB::Datatypes = {"INTEGER", "TEXT", "BLOB", "REAL", "NUMERIC"}; // Helper template to allow turning member functions into a C-style function pointer // See https://stackoverflow.com/questions/19808054/convert-c-function-pointer-to-c-function-pointer/19809787 @@ -45,6 +47,10 @@ QString escapeIdentifier(const QString& id) { return QString::fromStdString(escapeIdentifier(id.toStdString())); } +QString escapeString(const QString& literal) +{ + return QString::fromStdString(escapeString(literal.toStdString())); +} } // collation callbacks @@ -123,21 +129,39 @@ void DBBrowserDB::errorLogCallback(void* /*user_data*/, int error_code, const ch static void regexp(sqlite3_context* ctx, int /*argc*/, sqlite3_value* argv[]) { + // This is a cache for the last 50 regular expressions. Compiling them takes some time, so we want to cache the compiled + // regular expressions for performance purposes. + static std::array, 50> regex_cache; + + // Check if pattern is in cache + QString pattern{reinterpret_cast(sqlite3_value_text(argv[0]))}; + QRegularExpression regex; + const auto it = std::find_if(regex_cache.begin(), regex_cache.end(), [pattern](const std::pair& val) { + return val.first == pattern; + }); + if(it == regex_cache.end()) + { + // Pattern is not in cache. Create a new regular expressions object, compile it, and insert it into the cache + regex.setPattern(pattern); + regex.setPatternOptions(QRegularExpression::UseUnicodePropertiesOption); + if(!regex.isValid()) + return sqlite3_result_error(ctx, "invalid operand", -1); + regex.optimize(); + + static size_t regex_cache_size; + regex_cache_size = (regex_cache_size + 1) % regex_cache.size(); + regex_cache[regex_cache_size] = {pattern, regex}; + } else { + // Pattern is in the cache. Just retrieve it + regex = it->second; + } + // Get arguments and check their values - QRegExp arg1(reinterpret_cast(sqlite3_value_text(argv[0]))); - QString arg2(reinterpret_cast(sqlite3_value_text(argv[1]))); - if(!arg1.isValid()) - return sqlite3_result_error(ctx, "invalid operand", -1); + QString arg2{reinterpret_cast(sqlite3_value_text(argv[1]))}; - // Set the pattern matching syntax to a Perl-like one. This is the default in Qt 4.x but Qt 5 - // changes this to a greedy one (QRegExp::RegExp2). To make sure the behaviour of our application - // doesn't change depending on the build environment, we make sure to always set the same pattern - // matching syntax. - arg1.setPatternSyntax(QRegExp::RegExp); - - // Perform the actual matching and return the result. Note that Qt's QRegExp returns -1 if the regex - // doesn't match and the position in the string otherwise; SQLite expects a 0 for not found and a 1 for found. - sqlite3_result_int(ctx, arg1.indexIn(arg2) >= 0); + // Perform the actual matching and return the result. + // SQLite expects a 0 for not found and a 1 for found. + sqlite3_result_int(ctx, regex.match(arg2).hasMatch()); } bool DBBrowserDB::isOpen ( ) const @@ -173,11 +197,12 @@ bool DBBrowserDB::open(const QString& db, bool readOnly) #ifdef ENABLE_SQLCIPHER if(isEncrypted && cipherSettings) { - executeSQL(QString("PRAGMA key = %1").arg(cipherSettings->getPassword()), false, false); - executeSQL(QString("PRAGMA cipher_page_size = %1;").arg(cipherSettings->getPageSize()), false, false); - executeSQL(QString("PRAGMA kdf_iter = %1;").arg(cipherSettings->getKdfIterations()), false, false); - executeSQL(QString("PRAGMA cipher_hmac_algorithm = %1;").arg(cipherSettings->getHmacAlgorithm()), false, false); - executeSQL(QString("PRAGMA cipher_kdf_algorithm = %1;").arg(cipherSettings->getKdfAlgorithm()), false, false); + executeSQL("PRAGMA key = " + cipherSettings->getPassword(), false, false); + executeSQL("PRAGMA cipher_page_size = " + std::to_string(cipherSettings->getPageSize()), false, false); + executeSQL("PRAGMA kdf_iter = " + std::to_string(cipherSettings->getKdfIterations()), false, false); + executeSQL("PRAGMA cipher_hmac_algorithm = " + cipherSettings->getHmacAlgorithm(), false, false); + executeSQL("PRAGMA cipher_kdf_algorithm = " + cipherSettings->getKdfAlgorithm(), false, false); + executeSQL("PRAGMA cipher_plaintext_header_size = " + std::to_string(cipherSettings->getPlaintextHeaderSize()), false, false); } #endif delete cipherSettings; @@ -254,25 +279,21 @@ bool DBBrowserDB::attach(const QString& filePath, QString attach_as) waitForDbRelease(); // Check if this file has already been attached and abort if this is the case - QString sql = "PRAGMA database_list;"; - logSQL(sql, kLogMsg_App); - sqlite3_stmt* db_vm; - if(sqlite3_prepare_v2(_db, sql.toUtf8(), sql.toUtf8().length(), &db_vm, nullptr) == SQLITE_OK) - { - // Loop through all the databases - QFileInfo fi(filePath); - while(sqlite3_step(db_vm) == SQLITE_ROW) + QFileInfo fi(filePath); + bool ok = executeSQL("PRAGMA database_list", false, true, [fi](int, std::vector values, std::vector) -> bool { + QFileInfo path(values.at(2)); + if(fi == path) { - QFileInfo path(QString::fromUtf8(reinterpret_cast(sqlite3_column_text(db_vm, 2)))); - if(fi == path) - { - QString schema = QString::fromUtf8(reinterpret_cast(sqlite3_column_text(db_vm, 1))); - QMessageBox::information(nullptr, qApp->applicationName(), tr("This database has already been attached. Its schema name is '%1'.").arg(schema)); - return false; - } + QString schema = values.at(1); + QMessageBox::information(nullptr, qApp->applicationName(), tr("This database has already been attached. Its schema name is '%1'.").arg(schema)); + return true; } - sqlite3_finalize(db_vm); - } + + return false; + }); + + if(ok == false) + return false; // Ask for name to be given to the attached database if none was provided if(attach_as.isEmpty()) @@ -293,7 +314,7 @@ bool DBBrowserDB::attach(const QString& filePath, QString attach_as) return false; // Attach database - QString key; + std::string key; if(cipherSettings && is_encrypted) key = "KEY " + cipherSettings->getPassword(); else @@ -302,29 +323,34 @@ bool DBBrowserDB::attach(const QString& filePath, QString attach_as) // Only apply cipher settings if the database is encrypted if(cipherSettings && is_encrypted) { - if(!executeSQL(QString("PRAGMA cipher_default_page_size = %1").arg(cipherSettings->getPageSize()), false)) + if(!executeSQL("PRAGMA cipher_default_page_size = " + std::to_string(cipherSettings->getPageSize()), false)) { QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage); return false; } - if(!executeSQL(QString("PRAGMA cipher_default_kdf_iter = %1").arg(cipherSettings->getKdfIterations()), false)) + if(!executeSQL("PRAGMA cipher_default_kdf_iter = " + std::to_string(cipherSettings->getKdfIterations()), false)) { QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage); return false; } - if(!executeSQL(QString("PRAGMA cipher_hmac_algorithm = %1").arg(cipherSettings->getHmacAlgorithm()), false)) + if(!executeSQL("PRAGMA cipher_hmac_algorithm = " + cipherSettings->getHmacAlgorithm(), false)) { QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage); return false; } - if(!executeSQL(QString("PRAGMA cipher_kdf_algorithm = %1").arg(cipherSettings->getKdfAlgorithm()), false)) + if(!executeSQL("PRAGMA cipher_kdf_algorithm = " + cipherSettings->getKdfAlgorithm(), false)) + { + QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage); + return false; + } + if(!executeSQL("PRAGMA cipher_plaintext_header_size = " + std::to_string(cipherSettings->getPlaintextHeaderSize()), false)) { QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage); return false; } } - if(!executeSQL(QString("ATTACH '%1' AS %2 %3").arg(filePath).arg(sqlb::escapeIdentifier(attach_as)).arg(key), false)) + if(!executeSQL("ATTACH " + sqlb::escapeString(filePath.toStdString()) + " AS " + sqlb::escapeIdentifier(attach_as.toStdString()) + " " + key, false)) { QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage); return false; @@ -334,7 +360,7 @@ bool DBBrowserDB::attach(const QString& filePath, QString attach_as) delete cipherSettings; #else // Attach database - if(!executeSQL(QString("ATTACH '%1' AS %2").arg(filePath).arg(sqlb::escapeIdentifier(attach_as)), false)) + if(!executeSQL("ATTACH " + sqlb::escapeString(filePath.toStdString()) + " AS " + sqlb::escapeIdentifier(attach_as.toStdString()), false)) { QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage); return false; @@ -347,7 +373,7 @@ bool DBBrowserDB::attach(const QString& filePath, QString attach_as) return true; } -bool DBBrowserDB::tryEncryptionSettings(const QString& filePath, bool* encrypted, CipherSettings*& cipherSettings) +bool DBBrowserDB::tryEncryptionSettings(const QString& filePath, bool* encrypted, CipherSettings*& cipherSettings) const { lastErrorMessage = tr("Invalid file format"); @@ -365,7 +391,8 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filePath, bool* encrypted QString sqlite_version, sqlcipher_version; getSqliteVersion(sqlite_version, sqlcipher_version); int enc_default_page_size, enc_default_kdf_iter; - QString enc_default_hmac_algorithm, enc_default_kdf_algorithm; + int enc_default_plaintext_header_size = 0; + std::string enc_default_hmac_algorithm, enc_default_kdf_algorithm; if(sqlcipher_version.startsWith('4')) { enc_default_page_size = 4096; @@ -384,11 +411,10 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filePath, bool* encrypted cipherSettings = nullptr; while(true) { - QString statement = "SELECT COUNT(*) FROM sqlite_master;"; - QByteArray utf8Statement = statement.toUtf8(); + const std::string statement = "SELECT COUNT(*) FROM sqlite_master;"; sqlite3_stmt* vm; const char* tail; - int err = sqlite3_prepare_v2(dbHandle, utf8Statement, utf8Statement.length(), &vm, &tail); + int err = sqlite3_prepare_v2(dbHandle, statement.c_str(), static_cast(statement.size()), &vm, &tail); if(err == SQLITE_BUSY || err == SQLITE_PERM || err == SQLITE_NOMEM || err == SQLITE_IOERR || err == SQLITE_CORRUPT || err == SQLITE_CANTOPEN) { lastErrorMessage = QString::fromUtf8(sqlite3_errmsg(dbHandle)); @@ -422,15 +448,16 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filePath, bool* encrypted if (foundDotenvPassword) { - QString password = passwordValue.toString(); + std::string password = passwordValue.toString().toStdString(); QVariant keyFormatValue = dotenv.value(databaseFileName + "_keyFormat", QVariant(CipherSettings::KeyFormats::Passphrase)); CipherSettings::KeyFormats keyFormat = CipherSettings::getKeyFormat(keyFormatValue.toInt()); int pageSize = dotenv.value(databaseFileName + "_pageSize", enc_default_page_size).toInt(); int kdfIterations = dotenv.value(databaseFileName + "_kdfIter", enc_default_kdf_iter).toInt(); - QString hmacAlgorithm = dotenv.value(databaseFileName + "_hmacAlgorithm", enc_default_hmac_algorithm).toString(); - QString kdfAlgorithm = dotenv.value(databaseFileName + "_kdfAlgorithm", enc_default_kdf_algorithm).toString(); + int plaintextHeaderSize = dotenv.value(databaseFileName + "_plaintextHeaderSize", enc_default_kdf_iter).toInt(); + std::string hmacAlgorithm = dotenv.value(databaseFileName + "_hmacAlgorithm", QString::fromStdString(enc_default_hmac_algorithm)).toString().toStdString(); + std::string kdfAlgorithm = dotenv.value(databaseFileName + "_kdfAlgorithm", QString::fromStdString(enc_default_kdf_algorithm)).toString().toStdString(); delete cipherSettings; cipherSettings = new CipherSettings(); @@ -441,6 +468,7 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filePath, bool* encrypted cipherSettings->setKdfIterations(kdfIterations); cipherSettings->setHmacAlgorithm(hmacAlgorithm); cipherSettings->setKdfAlgorithm(kdfAlgorithm); + cipherSettings->setPlaintextHeaderSize(plaintextHeaderSize); } } @@ -472,17 +500,19 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filePath, bool* encrypted } // Set the key - sqlite3_exec(dbHandle, QString("PRAGMA key = %1").arg(cipherSettings->getPassword()).toUtf8(), nullptr, nullptr, nullptr); + sqlite3_exec(dbHandle, ("PRAGMA key = " + cipherSettings->getPassword()).c_str(), nullptr, nullptr, nullptr); // Set the page size if it differs from the default value if(cipherSettings->getPageSize() != enc_default_page_size) - sqlite3_exec(dbHandle, QString("PRAGMA cipher_page_size = %1;").arg(cipherSettings->getPageSize()).toUtf8(), nullptr, nullptr, nullptr); + sqlite3_exec(dbHandle, ("PRAGMA cipher_page_size = " + std::to_string(cipherSettings->getPageSize())).c_str(), nullptr, nullptr, nullptr); if(cipherSettings->getKdfIterations() != enc_default_kdf_iter) - sqlite3_exec(dbHandle, QString("PRAGMA kdf_iter = %1;").arg(cipherSettings->getKdfIterations()).toUtf8(), nullptr, nullptr, nullptr); + sqlite3_exec(dbHandle, ("PRAGMA kdf_iter = " + std::to_string(cipherSettings->getKdfIterations())).c_str(), nullptr, nullptr, nullptr); if(cipherSettings->getHmacAlgorithm() != enc_default_hmac_algorithm) - sqlite3_exec(dbHandle, QString("PRAGMA cipher_hmac_algorithm = %1;").arg(cipherSettings->getHmacAlgorithm()).toUtf8(), nullptr, nullptr, nullptr); + sqlite3_exec(dbHandle, ("PRAGMA cipher_hmac_algorithm = " + cipherSettings->getHmacAlgorithm()).c_str(), nullptr, nullptr, nullptr); if(cipherSettings->getKdfAlgorithm() != enc_default_kdf_algorithm) - sqlite3_exec(dbHandle, QString("PRAGMA cipher_kdf_algorithm = %1;").arg(cipherSettings->getKdfAlgorithm()).toUtf8(), nullptr, nullptr, nullptr); + sqlite3_exec(dbHandle, ("PRAGMA cipher_kdf_algorithm = " + cipherSettings->getKdfAlgorithm()).c_str(), nullptr, nullptr, nullptr); + if(cipherSettings->getPlaintextHeaderSize() != enc_default_plaintext_header_size) + sqlite3_exec(dbHandle, ("PRAGMA cipher_plaintext_header_size = " + std::to_string(cipherSettings->getPlaintextHeaderSize())).c_str(), nullptr, nullptr, nullptr); *encrypted = true; #else @@ -524,58 +554,54 @@ void DBBrowserDB::getSqliteVersion(QString& sqlite, QString& sqlcipher) #endif } -bool DBBrowserDB::setSavepoint(const QString& pointname) +bool DBBrowserDB::setSavepoint(const std::string& pointname) { if(!isOpen()) return false; - if(savepointList.contains(pointname)) + if(contains(savepointList, pointname)) return true; - QString query = QString("SAVEPOINT %1;").arg(sqlb::escapeIdentifier(pointname)); - executeSQL(query, false, true); - savepointList.append(pointname); + executeSQL("SAVEPOINT " + sqlb::escapeIdentifier(pointname) + ";", false, true); + savepointList.push_back(pointname); emit dbChanged(getDirty()); return true; } -bool DBBrowserDB::releaseSavepoint(const QString& pointname) +bool DBBrowserDB::releaseSavepoint(const std::string& pointname) { if(!isOpen()) return false; - if(savepointList.contains(pointname) == false) + if(contains(savepointList, pointname) == false) // If there is no such savepoint in the list, // we have already released it, so in this case // the operation should be successfull return true; - QString query = QString("RELEASE %1;").arg(sqlb::escapeIdentifier(pointname)); - if(!executeSQL(query, false, true)) + if(!executeSQL("RELEASE " + sqlb::escapeIdentifier(pointname) + ";", false, true)) return false; // SQLite releases all savepoints that were created between // creation of given savepoint and releasing of it, // so we should too - int point_index = savepointList.lastIndexOf(pointname); - savepointList.erase(savepointList.begin()+point_index, savepointList.end()); + auto it = std::find(savepointList.rbegin(), savepointList.rend(), pointname).base() - 1; + savepointList.erase(it, savepointList.end()); emit dbChanged(getDirty()); return true; } -bool DBBrowserDB::revertToSavepoint(const QString& pointname) +bool DBBrowserDB::revertToSavepoint(const std::string& pointname) { - if(!isOpen() || savepointList.contains(pointname) == false) + if(!isOpen() || contains(savepointList, pointname) == false) return false; - QString query = QString("ROLLBACK TO SAVEPOINT %1;").arg(sqlb::escapeIdentifier(pointname)); - executeSQL(query, false, true); - query = QString("RELEASE %1;").arg(sqlb::escapeIdentifier(pointname)); - executeSQL(query, false, true); + executeSQL("ROLLBACK TO SAVEPOINT " + sqlb::escapeIdentifier(pointname) + ";", false, true); + executeSQL("RELEASE " + sqlb::escapeIdentifier(pointname) + ";", false, true); // SQLite releases all savepoints that were created between // creation of given savepoint and releasing of it, // so we should too - int point_index = savepointList.lastIndexOf(pointname); - savepointList.erase(savepointList.begin()+point_index, savepointList.end()); + auto it = std::find(savepointList.rbegin(), savepointList.rend(), pointname).base() - 1; + savepointList.erase(it, savepointList.end()); emit dbChanged(getDirty()); return true; @@ -588,9 +614,9 @@ bool DBBrowserDB::releaseAllSavepoints() waitForDbRelease(); - for(const QString& point : savepointList) + while(!savepointList.empty()) { - if(!releaseSavepoint(point)) + if(!releaseSavepoint(savepointList.front())) return false; } @@ -603,9 +629,9 @@ bool DBBrowserDB::releaseAllSavepoints() bool DBBrowserDB::revertAll() { - for(const QString& point : savepointList) + while(!savepointList.empty()) { - if(!revertToSavepoint(point)) + if(!revertToSavepoint(savepointList.front())) return false; } return true; @@ -675,7 +701,7 @@ bool DBBrowserDB::close() reply = QMessageBox::question(nullptr, QApplication::applicationName(), tr("Do you want to save the changes made to the database file %1?").arg(curDBFilename), - QMessageBox::Save | QMessageBox::No | QMessageBox::Cancel); + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); } // If the user clicked the cancel button stop here and return false @@ -716,7 +742,7 @@ DBBrowserDB::db_pointer_type DBBrowserDB::get(const QString& user, bool force_wa return db_pointer_type(_db, DatabaseReleaser(this)); } -void DBBrowserDB::waitForDbRelease(ChoiceOnUse choice) +void DBBrowserDB::waitForDbRelease(ChoiceOnUse choice) const { if(!_db) return; @@ -752,12 +778,12 @@ void DBBrowserDB::waitForDbRelease(ChoiceOnUse choice) } bool DBBrowserDB::dump(const QString& filePath, - const QStringList& tablesToDump, + const std::vector& tablesToDump, bool insertColNames, bool insertNewSyntx, bool exportSchema, bool exportData, - bool keepOldSchema) + bool keepOldSchema) const { waitForDbRelease(); @@ -769,18 +795,17 @@ bool DBBrowserDB::dump(const QString& filePath, // Count the total number of all records in all tables for the progress dialog size_t numRecordsTotal = 0; - objectMap objMap = schemata["main"]; // We only always export the main database, not the attached databases + objectMap objMap = schemata.at("main"); // We only always export the main database, not the attached databases std::vector tables; auto all_tables = objMap.equal_range("table"); for(auto it=all_tables.first;it!=all_tables.second;++it) { // Never export the sqlite_stat1 and the sqlite_sequence tables if they exist. Also only export any tables which are selected for export. - if(it->second->name() != "sqlite_stat1" && it->second->name() != "sqlite_sequence" && tablesToDump.contains(QString::fromStdString(it->second->name()))) + if(it->second->name() != "sqlite_stat1" && it->second->name() != "sqlite_sequence" && contains(tablesToDump, it->second->name())) { // Get the number of records in this table and remember to export it tables.push_back(it->second); - numRecordsTotal += querySingleValueFromDb(QString("SELECT COUNT(*) FROM %1;") - .arg(QString::fromStdString(sqlb::ObjectIdentifier("main", it->second->name()).toString()))).toUInt(); + numRecordsTotal += querySingleValueFromDb("SELECT COUNT(*) FROM " + sqlb::ObjectIdentifier("main", it->second->name()).toString()).toUInt(); } } @@ -800,7 +825,7 @@ bool DBBrowserDB::dump(const QString& filePath, // make sure foreign keys are working properly. if(exportSchema) { - for(auto it : tables) + for(const auto& it : tables) { // Write the SQL string used to create this table to the output file if(!keepOldSchema) @@ -816,17 +841,16 @@ bool DBBrowserDB::dump(const QString& filePath, // Now export the data as well if(exportData) { - for(auto it : tables) + for(const auto& it : tables) { // get columns sqlb::StringVector cols = std::dynamic_pointer_cast(it)->fieldNames(); - QString sQuery = QString("SELECT * FROM %1;").arg(QString::fromStdString(sqlb::escapeIdentifier(it->name()))); - QByteArray utf8Query = sQuery.toUtf8(); + std::string sQuery = "SELECT * FROM " + sqlb::escapeIdentifier(it->name()); sqlite3_stmt *stmt; QString lineSep(QString(")%1\n").arg(insertNewSyntx?',':';')); - int status = sqlite3_prepare_v2(_db, utf8Query.data(), utf8Query.size(), &stmt, nullptr); + int status = sqlite3_prepare_v2(_db, sQuery.c_str(), static_cast(sQuery.size()), &stmt, nullptr); if(SQLITE_OK == status) { int columns = sqlite3_column_count(stmt); @@ -867,7 +891,7 @@ bool DBBrowserDB::dump(const QString& filePath, { case SQLITE_TEXT: case SQLITE_BLOB: - stream << "'" << bcontent.replace("'", "''") << "'"; + stream << sqlb::escapeString(bcontent); break; case SQLITE_NULL: stream << "NULL"; @@ -919,16 +943,16 @@ bool DBBrowserDB::dump(const QString& filePath, // If this object is based on a table (e.g. is an index for that table) it depends on the existence of this table. // So if we didn't export the base table this depends on, don't export this object either. - if(!it->baseTable().empty() && !tablesToDump.contains(QString::fromStdString(it->baseTable()))) + if(!it->baseTable().empty() && !contains(tablesToDump, it->baseTable())) continue; // Write the SQL string used to create this object to the output file if(!it->originalSql().empty()) { if(!keepOldSchema) - stream << QString("DROP %1 IF EXISTS %2;\n") - .arg(QString::fromStdString(sqlb::Object::typeToString(it->type())).toUpper()) - .arg(QString::fromStdString(sqlb::escapeIdentifier(it->name()))); + stream << QString("DROP %1 IF EXISTS %2;\n").arg( + QString::fromStdString(sqlb::Object::typeToString(it->type())).toUpper(), + QString::fromStdString(sqlb::escapeIdentifier(it->name()))); if(it->fullyParsed()) stream << QString::fromStdString(it->sql("main", true)) << "\n"; @@ -953,19 +977,19 @@ bool DBBrowserDB::dump(const QString& filePath, // to C++ classes and calls user callback. int DBBrowserDB::callbackWrapper (void* callback, int numberColumns, char** values, char** columnNames) { - QStringList valuesList; - QStringList namesList; + std::vector valuesList; + std::vector namesList; for (int i=0; i(callback)); return userCallback(numberColumns, valuesList, namesList); } -bool DBBrowserDB::executeSQL(QString statement, bool dirtyDB, bool logsql, execCallback callback) +bool DBBrowserDB::executeSQL(const std::string& statement, bool dirtyDB, bool logsql, execCallback callback) { waitForDbRelease(); if(!_db) @@ -974,25 +998,23 @@ bool DBBrowserDB::executeSQL(QString statement, bool dirtyDB, bool logsql, execC return false; } - statement = statement.trimmed(); - - if (logsql) logSQL(statement, kLogMsg_App); + if (logsql) logSQL(QString::fromStdString(statement), kLogMsg_App); if (dirtyDB) setSavepoint(); char* errmsg; - if (SQLITE_OK == sqlite3_exec(_db, statement.toUtf8(), callback ? callbackWrapper : nullptr, &callback, &errmsg)) + if (SQLITE_OK == sqlite3_exec(_db, statement.c_str(), callback ? callbackWrapper : nullptr, &callback, &errmsg)) { // Update DB structure after executing an SQL statement. But try to avoid doing unnecessary updates. - if(!dontCheckForStructureUpdates && (statement.startsWith("ALTER", Qt::CaseInsensitive) || - statement.startsWith("CREATE", Qt::CaseInsensitive) || - statement.startsWith("DROP", Qt::CaseInsensitive) || - statement.startsWith("ROLLBACK", Qt::CaseInsensitive))) + if(!dontCheckForStructureUpdates && (starts_with_ci(statement, "ALTER") || + starts_with_ci(statement, "CREATE") || + starts_with_ci(statement, "DROP") || + starts_with_ci(statement, "ROLLBACK"))) updateSchema(); return true; } else { - lastErrorMessage = QString("%1 (%2)").arg(QString::fromUtf8(errmsg)).arg(statement); - qWarning() << "executeSQL: " << statement << "->" << errmsg; + lastErrorMessage = QString("%1 (%2)").arg(QString::fromUtf8(errmsg), QString::fromStdString(statement)); + qWarning() << "executeSQL: " << lastErrorMessage; sqlite3_free(errmsg); return false; @@ -1028,13 +1050,13 @@ bool DBBrowserDB::executeMultiSQL(QByteArray query, bool dirty, bool log) unsigned int line = 0; bool structure_updated = false; int last_progress_value = -1; - QString savepoint_name; + std::string savepoint_name; while(tail && *tail != 0 && (res == SQLITE_OK || res == SQLITE_DONE)) { line++; // Update progress dialog, keep UI responsive. Make sure to not spend too much time updating the progress dialog in case there are many small statements. - int progress_value = static_cast(static_cast(tail - tail_start) / total_tail_length * 100.0f); + int progress_value = static_cast(static_cast(tail - tail_start) / static_cast(total_tail_length) * 100.0f); if(progress_value > last_progress_value) { progress.setValue(progress_value); @@ -1072,7 +1094,7 @@ bool DBBrowserDB::executeMultiSQL(QByteArray query, bool dirty, bool log) } // Set DB to dirty and create a restore point if we haven't done that yet - if(savepoint_name.isNull()) + if(savepoint_name.empty()) { savepoint_name = generateSavepointName("execmultisql"); setSavepoint(savepoint_name); @@ -1112,10 +1134,10 @@ bool DBBrowserDB::executeMultiSQL(QByteArray query, bool dirty, bool log) // In case of *any* error abort the execution and roll back the transaction // Make sure to save the error message first before any other function can mess around with it - lastErrorMessage = tr("Error in statement #%1: %2.\nAborting execution%3.") - .arg(line) - .arg(sqlite3_errmsg(_db)) - .arg(dirty ? tr(" and rolling back") : ""); + lastErrorMessage = tr("Error in statement #%1: %2.\nAborting execution%3.").arg( + QString::number(line), + sqlite3_errmsg(_db), + dirty ? tr(" and rolling back") : ""); qWarning() << lastErrorMessage; // Clean up @@ -1125,10 +1147,10 @@ bool DBBrowserDB::executeMultiSQL(QByteArray query, bool dirty, bool log) return false; } } else { - lastErrorMessage = tr("Error in statement #%1: %2.\nAborting execution%3.") - .arg(line) - .arg(sqlite3_errmsg(_db)) - .arg(dirty ? tr(" and rolling back") : ""); + lastErrorMessage = tr("Error in statement #%1: %2.\nAborting execution%3.").arg( + QString::number(line), + sqlite3_errmsg(_db), + dirty ? tr(" and rolling back") : ""); qWarning() << lastErrorMessage; if(dirty) revertToSavepoint(savepoint_name); @@ -1144,20 +1166,19 @@ bool DBBrowserDB::executeMultiSQL(QByteArray query, bool dirty, bool log) return true; } -QByteArray DBBrowserDB::querySingleValueFromDb(const QString& sql, bool log, ChoiceOnUse choice) +QByteArray DBBrowserDB::querySingleValueFromDb(const std::string& sql, bool log, ChoiceOnUse choice) const { waitForDbRelease(choice); if(!_db) return QByteArray(); if(log) - logSQL(sql, kLogMsg_App); + logSQL(QString::fromStdString(sql), kLogMsg_App); QByteArray retval; - QByteArray utf8Query = sql.toUtf8(); sqlite3_stmt* stmt; - if(sqlite3_prepare_v2(_db, utf8Query, utf8Query.size(), &stmt, nullptr) == SQLITE_OK) + if(sqlite3_prepare_v2(_db, sql.c_str(), static_cast(sql.size()), &stmt, nullptr) == SQLITE_OK) { // Execute the statement. We distinguish three types of results: // SQLITE_ROW in case some data was returned from the database. This data is then used as a return value. @@ -1175,7 +1196,7 @@ QByteArray DBBrowserDB::querySingleValueFromDb(const QString& sql, bool log, Cho retval = ""; } } else if(result != SQLITE_DONE) { - lastErrorMessage = tr("didn't receive any output from %1").arg(sql); + lastErrorMessage = tr("didn't receive any output from %1").arg(QString::fromStdString(sql)); qWarning() << lastErrorMessage; } @@ -1188,30 +1209,24 @@ QByteArray DBBrowserDB::querySingleValueFromDb(const QString& sql, bool log, Cho return retval; } -bool DBBrowserDB::getRow(const sqlb::ObjectIdentifier& table, const QString& rowid, std::vector& rowdata) +bool DBBrowserDB::getRow(const sqlb::ObjectIdentifier& table, const QString& rowid, std::vector& rowdata) const { waitForDbRelease(); if(!_db) return false; - QString sQuery = QString("SELECT * FROM %1 WHERE ") - .arg(QString::fromStdString(table.toString())); + std::string query = "SELECT * FROM " + table.toString() + " WHERE "; // For a single rowid column we can use a simple WHERE condition, for multiple rowid columns we have to use sqlb_make_single_value to decode the composed rowid values. sqlb::StringVector pks = getObjectByName(table)->rowidColumns(); if(pks.size() == 1) - { - sQuery += QString("%1='%2;").arg(QString::fromStdString(sqlb::escapeIdentifier(pks.front()))).arg(rowid); - } else { - sQuery += QString("sqlb_make_single_value(%1)='%2';") - .arg(QString::fromStdString(sqlb::joinStringVector(sqlb::escapeIdentifier(pks), ","))) - .arg(QString(rowid).replace("'", "''")); - } + query += sqlb::escapeIdentifier(pks.front()) + "='" + rowid.toStdString() + "'"; + else + query += "sqlb_make_single_value(" + sqlb::joinStringVector(sqlb::escapeIdentifier(pks), ",") + ")=" + sqlb::escapeString(rowid.toStdString()); - QByteArray utf8Query = sQuery.toUtf8(); sqlite3_stmt *stmt; bool ret = false; - if(sqlite3_prepare_v2(_db, utf8Query, utf8Query.size(), &stmt, nullptr) == SQLITE_OK) + if(sqlite3_prepare_v2(_db, query.c_str(), static_cast(query.size()), &stmt, nullptr) == SQLITE_OK) { // even this is a while loop, the statement should always only return 1 row while(sqlite3_step(stmt) == SQLITE_ROW) @@ -1237,32 +1252,17 @@ bool DBBrowserDB::getRow(const sqlb::ObjectIdentifier& table, const QString& row return ret; } -QString DBBrowserDB::max(const sqlb::ObjectIdentifier& tableName, const sqlb::Field& field) const +unsigned long DBBrowserDB::max(const sqlb::ObjectIdentifier& tableName, const std::string& field) const { - QString sQuery = QString("SELECT MAX(CAST(%2 AS INTEGER)) FROM %1;").arg(QString::fromStdString(tableName.toString())).arg(QString::fromStdString(sqlb::escapeIdentifier(field.name()))); - QByteArray utf8Query = sQuery.toUtf8(); - sqlite3_stmt *stmt; - QString ret = "0"; - - if(sqlite3_prepare_v2(_db, utf8Query, utf8Query.size(), &stmt, nullptr) == SQLITE_OK) - { - // even this is a while loop, the statement should always only return 1 row - while(sqlite3_step(stmt) == SQLITE_ROW) - { - if(sqlite3_column_count(stmt) == 1) - ret = QString::fromUtf8(reinterpret_cast(sqlite3_column_text(stmt, 0))); - } - } - sqlite3_finalize(stmt); - - return ret; + std::string query = "SELECT MAX(CAST(" + sqlb::escapeIdentifier(field) + " AS INTEGER)) FROM " + tableName.toString(); + return querySingleValueFromDb(query).toULong(); } -QString DBBrowserDB::emptyInsertStmt(const std::string& schemaName, const sqlb::Table& t, const QString& pk_value) const +std::string DBBrowserDB::emptyInsertStmt(const std::string& schemaName, const sqlb::Table& t, const QString& pk_value) const { - QString stmt = QString("INSERT INTO %1.%2").arg(QString::fromStdString(sqlb::escapeIdentifier(schemaName))).arg(QString::fromStdString(sqlb::escapeIdentifier(t.name()))); + std::string stmt = "INSERT INTO " + sqlb::escapeIdentifier(schemaName) + "." + sqlb::escapeIdentifier(t.name()); - QStringList vals; + sqlb::StringVector vals; sqlb::StringVector fields; for(const sqlb::Field& f : t.fields) { @@ -1273,31 +1273,31 @@ QString DBBrowserDB::emptyInsertStmt(const std::string& schemaName, const sqlb:: if(!pk_value.isNull()) { - vals << (f.isText()? "'" + pk_value + "'" : pk_value); + vals.push_back(f.isText()? "'" + pk_value.toStdString() + "'" : pk_value.toStdString()); } else { if(f.notnull()) { - QString maxval = this->max(sqlb::ObjectIdentifier(schemaName, t.name()), f); - QString newval = QString::number(maxval.toLongLong() + 1); - vals << (f.isText()? "'" + newval + "'" : newval); + unsigned long maxval = this->max(sqlb::ObjectIdentifier(schemaName, t.name()), f.name()); + std::string newval = std::to_string(maxval + 1); + vals.push_back(f.isText()? "'" + newval + "'" : newval); } else { - vals << "NULL"; + vals.push_back("NULL"); } } } else if(f.notnull() && f.defaultValue().length() == 0) { fields.push_back(f.name()); if(f.isInteger()) - vals << "0"; + vals.push_back("0"); else - vals << "''"; + vals.push_back("''"); } else { // don't insert into fields with a default value // or we will never see it. if(f.defaultValue().length() == 0) { fields.push_back(f.name()); - vals << "NULL"; + vals.push_back("NULL"); } } } @@ -1307,9 +1307,9 @@ QString DBBrowserDB::emptyInsertStmt(const std::string& schemaName, const sqlb:: stmt.append(" DEFAULT VALUES;"); } else { stmt.append("("); - stmt.append(QString::fromStdString(sqlb::joinStringVector(sqlb::escapeIdentifier(fields), ","))); + stmt.append(sqlb::joinStringVector(sqlb::escapeIdentifier(fields), ",")); stmt.append(") VALUES ("); - stmt.append(vals.join(",")); + stmt.append(sqlb::joinStringVector(vals, ",")); stmt.append(");"); } @@ -1328,13 +1328,13 @@ QString DBBrowserDB::addRecord(const sqlb::ObjectIdentifier& tablename) // For tables without rowid we have to set the primary key by ourselves. We do so by querying for the largest value in the PK column // and adding one to it. - QString sInsertstmt; + std::string sInsertstmt; QString pk_value; if(table->withoutRowidTable()) { // For multiple rowid columns we just use the value of the last one and increase that one by one. If this doesn't yield a valid combination // the insert record dialog should pop up automatically. - pk_value = QString::number(max(tablename, *sqlb::findField(table, table->rowidColumns().back())).toLongLong() + 1); + pk_value = QString::number(max(tablename, table->rowidColumns().back()) + 1); sInsertstmt = emptyInsertStmt(tablename.schema(), *table, pk_value); } else { sInsertstmt = emptyInsertStmt(tablename.schema(), *table); @@ -1352,7 +1352,7 @@ QString DBBrowserDB::addRecord(const sqlb::ObjectIdentifier& tablename) } } -bool DBBrowserDB::deleteRecords(const sqlb::ObjectIdentifier& table, const QStringList& rowids, const sqlb::StringVector& pseudo_pk) +bool DBBrowserDB::deleteRecords(const sqlb::ObjectIdentifier& table, const std::vector& rowids, const sqlb::StringVector& pseudo_pk) { if (!isOpen()) return false; @@ -1365,27 +1365,24 @@ bool DBBrowserDB::deleteRecords(const sqlb::ObjectIdentifier& table, const QStri } // Quote all values in advance - QStringList quoted_rowids; + std::vector quoted_rowids; for(QString rowid : rowids) - quoted_rowids.append("'" + rowid.replace("'", "''") + "'"); + quoted_rowids.push_back(sqlb::escapeString(rowid.toStdString())); // For a single rowid column we can use a SELECT ... IN(...) statement which is faster. // For multiple rowid columns we have to use sqlb_make_single_value to decode the composed rowid values. - QString statement; + std::string statement; if(pks.size() == 1) { - statement = QString("DELETE FROM %1 WHERE %2 IN (%3);") - .arg(QString::fromStdString(table.toString())) - .arg(QString::fromStdString(pks.at(0))) - .arg(quoted_rowids.join(", ")); + statement = "DELETE FROM " + table.toString() + " WHERE " + pks.at(0) + " IN ("+ sqlb::joinStringVector(quoted_rowids, ", ") + ");"; } else { - statement = QString("DELETE FROM %1 WHERE ").arg(QString::fromStdString(table.toString())); + statement = "DELETE FROM " + table.toString() + " WHERE "; statement += "sqlb_make_single_value("; for(const auto& pk : pks) - statement += QString::fromStdString(sqlb::escapeIdentifier(pk)) + ","; - statement.chop(1); - statement += QString(") IN (%1)").arg(quoted_rowids.join(", ")); + statement += sqlb::escapeIdentifier(pk) + ","; + statement.erase(statement.end()-1); + statement += ") IN (" + sqlb::joinStringVector(quoted_rowids, ", ") + ")"; } if(executeSQL(statement)) @@ -1398,7 +1395,7 @@ bool DBBrowserDB::deleteRecords(const sqlb::ObjectIdentifier& table, const QStri } bool DBBrowserDB::updateRecord(const sqlb::ObjectIdentifier& table, const std::string& column, - const QString& rowid, const QByteArray& value, bool itsBlob, const sqlb::StringVector& pseudo_pk) + const QString& rowid, const QByteArray& value, int force_type, const sqlb::StringVector& pseudo_pk) { waitForDbRelease(); if (!isOpen()) return false; @@ -1411,23 +1408,15 @@ bool DBBrowserDB::updateRecord(const sqlb::ObjectIdentifier& table, const std::s return false; } - QString sql = QString("UPDATE %1 SET %2=? WHERE ") - .arg(QString::fromStdString(table.toString())) - .arg(QString::fromStdString(sqlb::escapeIdentifier(column))); + std::string sql = "UPDATE " + table.toString() + " SET " + sqlb::escapeIdentifier(column) + "=? WHERE "; // For a single rowid column we can use a simple WHERE condition, for multiple rowid columns we have to use sqlb_make_single_value to decode the composed rowid values. if(pks.size() == 1) - { - sql += QString("%1='%2';") - .arg(QString::fromStdString(sqlb::escapeIdentifier(pks.front()))) - .arg(QString(rowid).replace("'", "''")); - } else { - sql += QString("sqlb_make_single_value(%1)='%2';") - .arg(QString::fromStdString(sqlb::joinStringVector(sqlb::escapeIdentifier(pks), ","))) - .arg(QString(rowid).replace("'", "''")); - } + sql += sqlb::escapeIdentifier(pks.front()) + "=" + sqlb::escapeString(rowid.toStdString()); + else + sql += "sqlb_make_single_value(" + sqlb::joinStringVector(sqlb::escapeIdentifier(pks), ",") + ")=" + sqlb::escapeString(rowid.toStdString()); - logSQL(sql, kLogMsg_App); + logSQL(QString::fromStdString(sql), kLogMsg_App); setSavepoint(); // If we get a NULL QByteArray we insert a NULL value, and for that @@ -1436,16 +1425,20 @@ bool DBBrowserDB::updateRecord(const sqlb::ObjectIdentifier& table, const std::s sqlite3_stmt* stmt; int success = 1; - if(sqlite3_prepare_v2(_db, sql.toUtf8(), -1, &stmt, nullptr) != SQLITE_OK) + if(sqlite3_prepare_v2(_db, sql.c_str(), static_cast(sql.size()), &stmt, nullptr) != SQLITE_OK) success = 0; if(success == 1) { - if(itsBlob) + if(force_type == SQLITE_BLOB) { if(sqlite3_bind_blob(stmt, 1, rawValue, value.length(), SQLITE_STATIC)) success = -1; - } - else - { + } else if(force_type == SQLITE_INTEGER) { + if(sqlite3_bind_int64(stmt, 1, value.toLongLong())) + success = -1; + } else if(force_type == SQLITE_FLOAT) { + if(sqlite3_bind_double(stmt, 1, value.toDouble())) + success = -1; + } else { if(sqlite3_bind_text(stmt, 1, rawValue, value.length(), SQLITE_STATIC)) success = -1; } @@ -1491,15 +1484,12 @@ bool DBBrowserDB::createTable(const sqlb::ObjectIdentifier& name, const sqlb::Fi table.fields.push_back(structure.at(i)); // Execute it and update the schema - return executeSQL(QString::fromStdString(table.sql(name.schema()))); + return executeSQL(table.sql(name.schema())); } bool DBBrowserDB::addColumn(const sqlb::ObjectIdentifier& tablename, const sqlb::Field& field) { - QString sql = QString("ALTER TABLE %1 ADD COLUMN %2").arg(QString::fromStdString(tablename.toString())).arg(QString::fromStdString(field.toString())); - - // Execute it and update the schema - return executeSQL(sql); + return executeSQL("ALTER TABLE " + tablename.toString() + " ADD COLUMN " + field.toString()); } bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb::Table& new_table, AlterTableTrackColumns track_columns, std::string newSchemaName) @@ -1521,14 +1511,14 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb // When renaming the table in the current schema, check if it doesn't exist already in there if(tablename.name() != new_table.name() && getObjectByName(sqlb::ObjectIdentifier(newSchemaName, new_table.name())) != nullptr) { - lastErrorMessage = tr("A table with the name '%1' already exists in schema '%2'.").arg(QString::fromStdString(new_table.name())).arg(QString::fromStdString(newSchemaName)); + lastErrorMessage = tr("A table with the name '%1' already exists in schema '%2'.").arg(QString::fromStdString(new_table.name()), QString::fromStdString(newSchemaName)); return false; } } else { // We're moving the table to a different schema. So check first if it doesn't already exist in the new schema. if(newSchemaName != tablename.schema() && getObjectByName(sqlb::ObjectIdentifier(newSchemaName, new_table.name())) != nullptr) { - lastErrorMessage = tr("A table with the name '%1' already exists in schema '%2'.").arg(QString::fromStdString(new_table.name())).arg(QString::fromStdString(newSchemaName)); + lastErrorMessage = tr("A table with the name '%1' already exists in schema '%2'.").arg(QString::fromStdString(new_table.name()), QString::fromStdString(newSchemaName)); return false; } } @@ -1537,10 +1527,10 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb sqlb::TablePtr old_table_ptr = getObjectByName(tablename); if(old_table_ptr == nullptr) { - lastErrorMessage = tr("No table with name '%1' exists in schema '%2'.").arg(QString::fromStdString(tablename.name())).arg(QString::fromStdString(tablename.schema())); + lastErrorMessage = tr("No table with name '%1' exists in schema '%2'.").arg(QString::fromStdString(tablename.name()), QString::fromStdString(tablename.schema())); return false; } - sqlb::Table old_table = *old_table_ptr; + sqlb::Table old_table(*old_table_ptr); // Check if tracked fields actually exist in the old table for(const auto& old_it : track_columns) @@ -1578,7 +1568,7 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb return true; // Create savepoint to be able to go back to it in case of any error - QString savepointName = generateSavepointName("renamecolumn"); + std::string savepointName = generateSavepointName("renamecolumn"); if(!setSavepoint(savepointName)) { lastErrorMessage = tr("Creating savepoint failed. DB says: %1").arg(lastErrorMessage); @@ -1641,10 +1631,8 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb QString new_name = track_columns[old_name]; if(!old_name.isNull() && !new_name.isNull() && new_name != old_name) { - if(!executeSQL(QString("ALTER TABLE %1 RENAME COLUMN %2 TO %3;") - .arg(QString::fromStdString(sqlb::ObjectIdentifier(tablename.schema(), new_table.name()).toString())) - .arg(sqlb::escapeIdentifier(old_name)) - .arg(sqlb::escapeIdentifier(new_name)))) + if(!executeSQL("ALTER TABLE " + sqlb::ObjectIdentifier(tablename.schema(), new_table.name()).toString() + " RENAME COLUMN " + + sqlb::escapeIdentifier(old_name.toStdString()) + " TO " + sqlb::escapeIdentifier(new_name.toStdString()))) { QString error(tr("Renaming the column failed. DB says:\n%1").arg(lastErrorMessage)); revertToSavepoint(savepointName); @@ -1689,9 +1677,9 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb // Create a new table with the desired schema and a name that doesn't exist yet std::string new_table_name = new_table.name(); - sqlb::Table new_table_with_random_name = new_table; + sqlb::Table new_table_with_random_name(new_table); new_table_with_random_name.setName(generateTemporaryTableName(newSchemaName)); - if(!executeSQL(QString::fromStdString(new_table_with_random_name.sql(newSchemaName)), true, true)) + if(!executeSQL(new_table_with_random_name.sql(newSchemaName), true, true)) { QString error(tr("Creating new table failed. DB says: %1").arg(lastErrorMessage)); revertToSavepoint(savepointName); @@ -1720,13 +1708,10 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb } // Copy the data from the old table to the new one - if(!executeSQL(QString("INSERT INTO %1.%2 (%3) SELECT %4 FROM %5.%6;") - .arg(QString::fromStdString(sqlb::escapeIdentifier(newSchemaName))) - .arg(QString::fromStdString(sqlb::escapeIdentifier(new_table_with_random_name.name()))) - .arg(QString::fromStdString(sqlb::joinStringVector(sqlb::escapeIdentifier(copy_values_to), ","))) - .arg(QString::fromStdString(sqlb::joinStringVector(sqlb::escapeIdentifier(copy_values_from), ","))) - .arg(QString::fromStdString(sqlb::escapeIdentifier(tablename.schema()))) - .arg(QString::fromStdString(sqlb::escapeIdentifier(old_table.name()))))) + if(!executeSQL("INSERT INTO " + sqlb::escapeIdentifier(newSchemaName) + "." + sqlb::escapeIdentifier(new_table_with_random_name.name()) + + " (" + sqlb::joinStringVector(sqlb::escapeIdentifier(copy_values_to), ",") + ") SELECT " + + sqlb::joinStringVector(sqlb::escapeIdentifier(copy_values_from), ",") + " FROM " + + sqlb::escapeIdentifier(tablename.schema()) + "." + sqlb::escapeIdentifier(old_table.name()))) { QString error(tr("Copying data to new table failed. DB says:\n%1").arg(lastErrorMessage)); revertToSavepoint(savepointName); @@ -1735,7 +1720,7 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb } // Save all indices, triggers and views associated with this table because SQLite deletes them when we drop the table in the next step - QStringList otherObjectsSql; + std::vector otherObjectsSql; for(const auto& schema : schemata[tablename.schema()]) { const auto& it = schema.second; @@ -1775,11 +1760,11 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb // Only try to add the index later if it has any columns remaining. Also use the new schema name here, too, to basically move // any index that references the table to the same new schema as the table. if(idx->fields.size()) - otherObjectsSql << QString::fromStdString(idx->sql(newSchemaName)); + otherObjectsSql.push_back(idx->sql(newSchemaName)); } else { // If it's a view or a trigger we don't have any chance to corrections yet. Just store the statement as is and // hope for the best. - otherObjectsSql << QString::fromStdString(it->originalSql()) + ";"; + otherObjectsSql.push_back(it->originalSql() + ";"); } } } @@ -1793,7 +1778,7 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb setPragma("defer_foreign_keys", "1"); // Delete the old table - if(!executeSQL(QString("DROP TABLE %1.%2;").arg(QString::fromStdString(sqlb::escapeIdentifier(tablename.schema()))).arg(QString::fromStdString(sqlb::escapeIdentifier(old_table.name()))), true, true)) + if(!executeSQL("DROP TABLE " + sqlb::escapeIdentifier(tablename.schema()) + "." + sqlb::escapeIdentifier(old_table.name()), true, true)) { QString error(tr("Deleting old table failed. DB says: %1").arg(lastErrorMessage)); revertToSavepoint(savepointName); @@ -1812,18 +1797,18 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb setPragma("defer_foreign_keys", foreignKeysOldSettings); // Restore the saved triggers, views and indices - QString errored_sqls; - for(const QString& sql : otherObjectsSql) + std::string errored_sqls; + for(const std::string& sql : otherObjectsSql) { if(!executeSQL(sql, true, true)) errored_sqls += sql + "\n"; } - if(!errored_sqls.isEmpty()) + if(!errored_sqls.empty()) { QMessageBox::information(nullptr, qApp->applicationName(), tr("Restoring some of the objects associated with this table failed. " "This is most likely because some column names changed. " "Here's the SQL statement which you might want to fix and execute manually:\n\n") - + errored_sqls); + + QString::fromStdString(errored_sqls)); } // Release the savepoint - everything went fine @@ -1862,14 +1847,11 @@ bool DBBrowserDB::renameTable(const std::string& schema, const std::string& from // The old and the new table names differ (and that not only in case) // Rename the table - QString sql = QString("ALTER TABLE %1.%2 RENAME TO %3") - .arg(QString::fromStdString(sqlb::escapeIdentifier(schema))) - .arg(QString::fromStdString(sqlb::escapeIdentifier(from_table))) - .arg(QString::fromStdString(sqlb::escapeIdentifier(to_table))); + std::string sql = "ALTER TABLE " + sqlb::escapeIdentifier(schema) + "." + sqlb::escapeIdentifier(from_table) + " RENAME TO " + sqlb::escapeIdentifier(to_table); if(!executeSQL(sql)) { - QString error = tr("Error renaming table '%1' to '%2'." - "Message from database engine:\n%3").arg(QString::fromStdString(from_table)).arg(QString::fromStdString(to_table)).arg(lastErrorMessage); + QString error = tr("Error renaming table '%1' to '%2'.\n" + "Message from database engine:\n%3").arg(QString::fromStdString(from_table), QString::fromStdString(to_table), lastErrorMessage); lastErrorMessage = error; qWarning() << lastErrorMessage; return false; @@ -1878,41 +1860,10 @@ bool DBBrowserDB::renameTable(const std::string& schema, const std::string& from } } -objectMap DBBrowserDB::getBrowsableObjects(const std::string& schema) const -{ - objectMap res; - - const objectMap map = schemata.at(schema); - for(const auto& it : map) - { - if(it.first == "table" || it.first == "view") - res.insert({it.first, it.second}); - } - - return res; -} - -void DBBrowserDB::logSQL(QString statement, LogMessageType msgtype) +void DBBrowserDB::logSQL(const QString& statement, LogMessageType msgtype) const { // Remove any leading and trailing spaces, tabs, or line breaks first - statement = statement.trimmed(); - - // Replace binary log messages by a placeholder text instead of printing gibberish - for(int i=0;i0?i-1:0); - statement.append(tr("... ...")); - - // early exit if we detect a binary character, - // to prevent checking all characters in a potential big string - break; - } - } - - emit sqlExecuted(statement, msgtype); + emit sqlExecuted(statement.trimmed(), msgtype); } void DBBrowserDB::updateSchema() @@ -1926,113 +1877,98 @@ void DBBrowserDB::updateSchema() return; // Get a list of all databases. This list always includes the main and the temp database but can include more items if there are attached databases - QString db_statement = "PRAGMA database_list;"; - QByteArray db_utf8Statement = db_statement.toUtf8(); - logSQL(db_statement, kLogMsg_App); - sqlite3_stmt* db_vm; - if(sqlite3_prepare_v2(_db, db_utf8Statement, db_utf8Statement.length(), &db_vm, nullptr) == SQLITE_OK) - { - // Loop through all the databases - while(sqlite3_step(db_vm) == SQLITE_ROW) - { - // Get the schema name which is in column 1 (counting starts with 0). 0 contains an ID and 2 the file path. - std::string schema_name = reinterpret_cast(sqlite3_column_text(db_vm, 1)); + if(!executeSQL("PRAGMA database_list;", false, true, [this](int, std::vector db_values, std::vector) -> bool { + // Get the schema name which is in column 1 (counting starts with 0). 0 contains an ID and 2 the file path. + const std::string schema_name = db_values.at(1).toStdString(); - // Always add the schema to the map. This makes sure it's even then added when there are no objects in the database - schemata[schema_name] = objectMap(); + // Always add the schema to the map. This makes sure it's even then added when there are no objects in the database + schemata[schema_name] = objectMap(); - // Get a list of all the tables for the current database schema. We need to do this differently for normal databases and the temporary schema - // because SQLite doesn't understand the "temp.sqlite_master" notation. - QString statement; - if(schema_name == "temp") - statement = QString("SELECT type,name,sql,tbl_name FROM sqlite_temp_master;"); - else - statement = QString("SELECT type,name,sql,tbl_name FROM %1.sqlite_master;").arg(QString::fromStdString(sqlb::escapeIdentifier(schema_name))); - QByteArray utf8Statement = statement.toUtf8(); - logSQL(statement, kLogMsg_App); + // Get a list of all the tables for the current database schema. We need to do this differently for normal databases and the temporary schema + // because SQLite doesn't understand the "temp.sqlite_master" notation. + std::string statement; + if(schema_name == "temp") + statement = "SELECT type,name,sql,tbl_name FROM sqlite_temp_master;"; + else + statement = "SELECT type,name,sql,tbl_name FROM " + sqlb::escapeIdentifier(schema_name) + ".sqlite_master;"; - sqlite3_stmt* vm; - int err = sqlite3_prepare_v2(_db, utf8Statement, utf8Statement.length(), &vm, nullptr); - if(err == SQLITE_OK) + if(!executeSQL(statement, false, true, [this, schema_name](int, std::vector values, std::vector) -> bool { + const std::string val_type = values.at(0).toStdString(); + const std::string val_name = values.at(1).toStdString(); + std::string val_sql = values.at(2).toStdString(); + const std::string val_tblname = values.at(3).toStdString(); + + if(!val_sql.empty()) { - while(sqlite3_step(vm) == SQLITE_ROW) - { - std::string val_type = reinterpret_cast(sqlite3_column_text(vm, 0)); - std::string val_name = reinterpret_cast(sqlite3_column_text(vm, 1)); - QString val_sql = QString::fromUtf8(reinterpret_cast(sqlite3_column_text(vm, 2))); - std::string val_tblname = reinterpret_cast(sqlite3_column_text(vm, 3)); - val_sql = val_sql.replace("\r", ""); + val_sql.erase(std::remove(val_sql.begin(), val_sql.end(), '\r'), val_sql.end()); - if(!val_sql.isEmpty()) - { - sqlb::ObjectPtr object; - if(val_type == "table") - object = sqlb::Table::parseSQL(val_sql.toStdString()); - else if(val_type == "index") - object = sqlb::Index::parseSQL(val_sql.toStdString()); - else if(val_type == "trigger") - object = sqlb::Trigger::parseSQL(val_sql.toStdString()); - else if(val_type == "view") - object = sqlb::View::parseSQL(val_sql.toStdString()); - else - continue; + sqlb::ObjectPtr object; + if(val_type == "table") + object = sqlb::Table::parseSQL(val_sql); + else if(val_type == "index") + object = sqlb::Index::parseSQL(val_sql); + else if(val_type == "trigger") + object = sqlb::Trigger::parseSQL(val_sql); + else if(val_type == "view") + object = sqlb::View::parseSQL(val_sql); + else + return false; - // If parsing wasn't successful set the object name manually, so that at least the name is going to be correct - if(!object->fullyParsed()) - object->setName(val_name); + // If parsing wasn't successful set the object name manually, so that at least the name is going to be correct + if(!object->fullyParsed()) + object->setName(val_name); - // For virtual tables and views query the column list using the SQLite pragma because for both we can't yet rely on our grammar parser - if((object->type() == sqlb::Object::Types::Table && std::dynamic_pointer_cast(object)->isVirtual()) || object->type() == sqlb::Object::Types::View) - { - auto columns = queryColumnInformation(schema_name, val_name); + // For virtual tables and views query the column list using the SQLite pragma because for both we can't yet rely on our grammar parser + if((object->type() == sqlb::Object::Types::Table && std::dynamic_pointer_cast(object)->isVirtual()) || object->type() == sqlb::Object::Types::View) + { + const auto columns = queryColumnInformation(schema_name, val_name); - if(object->type() == sqlb::Object::Types::Table) - { - sqlb::TablePtr tab = std::dynamic_pointer_cast(object); - for(const auto& column : columns) - tab->fields.emplace_back(column.first, column.second); - } else { - sqlb::ViewPtr view = std::dynamic_pointer_cast(object); - for(const auto& column : columns) - view->fields.emplace_back(column.first, column.second); - } - } else if(object->type() == sqlb::Object::Types::Trigger) { - // For triggers set the name of the table the trigger operates on here because we don't have a parser for trigger statements yet. - sqlb::TriggerPtr trg = std::dynamic_pointer_cast(object); - trg->setTable(val_tblname); - } + if(object->type() == sqlb::Object::Types::Table) + { + sqlb::TablePtr tab = std::dynamic_pointer_cast(object); + for(const auto& column : columns) + tab->fields.emplace_back(column.first, column.second); + } else { + sqlb::ViewPtr view = std::dynamic_pointer_cast(object); + for(const auto& column : columns) + view->fields.emplace_back(column.first, column.second); + } + } else if(object->type() == sqlb::Object::Types::Trigger) { + // For triggers set the name of the table the trigger operates on here because we don't have a parser for trigger statements yet. + sqlb::TriggerPtr trg = std::dynamic_pointer_cast(object); + trg->setTable(val_tblname); + } - schemata[schema_name].insert({val_type, object}); - } - } - sqlite3_finalize(vm); - } else { - qWarning() << tr("could not get list of db objects: %1, %2").arg(err).arg(sqlite3_errmsg(_db)); + schemata[schema_name].insert({val_type, object}); } + + return false; + })) + { + qWarning() << tr("could not get list of db objects: %1").arg(sqlite3_errmsg(_db)); } - sqlite3_finalize(db_vm); - } else { + return false; + })) + { qWarning() << tr("could not get list of databases: %1").arg(sqlite3_errmsg(_db)); } emit structureUpdated(); } -QString DBBrowserDB::getPragma(const QString& pragma) +QString DBBrowserDB::getPragma(const std::string& pragma) const { - QString sql; if (pragma=="case_sensitive_like") - sql = "SELECT 'x' NOT LIKE 'X'"; + return querySingleValueFromDb("SELECT 'x' NOT LIKE 'X';"); else - sql = QString("PRAGMA %1").arg(pragma); - return querySingleValueFromDb(sql); + return querySingleValueFromDb("PRAGMA " + pragma + ";"); } -bool DBBrowserDB::setPragma(const QString& pragma, const QString& value) +bool DBBrowserDB::setPragma(const std::string& pragma, const QString& value) { // Set the pragma value - QString sql = QString("PRAGMA %1 = '%2';").arg(pragma).arg(value); + std::string sql = "PRAGMA " + pragma + " = '" + value.toStdString() + "';"; // In general, we want to commit changes before running pragmas because most of them can't be rolled back and some of them // even fail when run in a transaction. However, the defer_foreign_keys pragma has neither problem and we need it to be settable @@ -2043,7 +1979,7 @@ bool DBBrowserDB::setPragma(const QString& pragma, const QString& value) bool res = executeSQL(sql, false, true); // PRAGMA statements are usually not transaction bound, so we can't revert if( !res ) - qWarning() << tr("Error setting pragma %1 to %2: %3").arg(pragma).arg(value).arg(lastErrorMessage); + qWarning() << tr("Error setting pragma %1 to %2: %3").arg(QString::fromStdString(pragma), value, lastErrorMessage); // If this is the page_size or the auto_vacuum pragma being set, we need to execute the vacuum command right after the pragma statement or the new // settings won't be saved. @@ -2053,7 +1989,7 @@ bool DBBrowserDB::setPragma(const QString& pragma, const QString& value) return res; } -bool DBBrowserDB::setPragma(const QString& pragma, const QString& value, QString& originalvalue) +bool DBBrowserDB::setPragma(const std::string& pragma, const QString& value, QString& originalvalue) { if( originalvalue != value ) { @@ -2066,7 +2002,7 @@ bool DBBrowserDB::setPragma(const QString& pragma, const QString& value, QString return false; } -bool DBBrowserDB::setPragma(const QString& pragma, int value, int& originalvalue) +bool DBBrowserDB::setPragma(const std::string& pragma, int value, int& originalvalue) { if( originalvalue != value ) { @@ -2131,17 +2067,17 @@ void DBBrowserDB::loadExtensionsFromSettings() } } -std::vector> DBBrowserDB::queryColumnInformation(const std::string& schema_name, const std::string& object_name) +std::vector> DBBrowserDB::queryColumnInformation(const std::string& schema_name, const std::string& object_name) const { waitForDbRelease(); std::vector> result; - QString statement = QString("PRAGMA %1.TABLE_INFO(%2);").arg(QString::fromStdString(sqlb::escapeIdentifier(schema_name))).arg(QString::fromStdString(sqlb::escapeIdentifier(object_name))); - logSQL(statement, kLogMsg_App); + std::string statement = "PRAGMA " + sqlb::escapeIdentifier(schema_name) + ".TABLE_INFO(" + sqlb::escapeIdentifier(object_name) + ");"; + logSQL(QString::fromStdString(statement), kLogMsg_App); sqlite3_stmt* vm; const char* tail; - if(sqlite3_prepare_v2(_db, statement.toUtf8(), statement.length(), &vm, &tail) == SQLITE_OK) + if(sqlite3_prepare_v2(_db, statement.c_str(), static_cast(statement.size()), &vm, &tail) == SQLITE_OK) { while(sqlite3_step(vm) == SQLITE_ROW) { @@ -2158,10 +2094,10 @@ std::vector> DBBrowserDB::queryColumnInforma return result; } -QString DBBrowserDB::generateSavepointName(const QString& identifier) const +std::string DBBrowserDB::generateSavepointName(const std::string& identifier) const { // Generate some sort of unique name for a savepoint for internal use. - return QString("db4s_%1_%2").arg(identifier).arg(QDateTime::currentMSecsSinceEpoch()); + return "db4s_" + identifier + "_" + std::to_string(std::chrono::system_clock::now().time_since_epoch().count()); } std::string DBBrowserDB::generateTemporaryTableName(const std::string& schema) const diff --git a/src/sqlitedb.h b/src/sqlitedb.h index 4df1ab11..87e5f91a 100644 --- a/src/sqlitedb.h +++ b/src/sqlitedb.h @@ -33,6 +33,7 @@ int collCompare(void* pArg, int sizeA, const void* sA, int sizeB, const void* sB namespace sqlb { QString escapeIdentifier(const QString& id); +QString escapeString(const QString& literal); } /// represents a single SQLite database. except when noted otherwise, @@ -66,10 +67,10 @@ private: public: explicit DBBrowserDB(); - ~DBBrowserDB () override {} + ~DBBrowserDB () override = default; bool open(const QString& db, bool readOnly = false); - bool attach(const QString& filename, QString attach_as = ""); + bool attach(const QString& filename, QString attach_as = QString()); bool create ( const QString & db); bool close(); @@ -101,13 +102,13 @@ public: **/ db_pointer_type get (const QString& user, bool force_wait = false); - bool setSavepoint(const QString& pointname = "RESTOREPOINT"); - bool releaseSavepoint(const QString& pointname = "RESTOREPOINT"); - bool revertToSavepoint(const QString& pointname = "RESTOREPOINT"); + bool setSavepoint(const std::string& pointname = "RESTOREPOINT"); + bool releaseSavepoint(const std::string& pointname = "RESTOREPOINT"); + bool revertToSavepoint(const std::string& pointname = "RESTOREPOINT"); bool releaseAllSavepoints(); bool revertAll(); - bool dump(const QString& filename, const QStringList& tablesToDump, bool insertColNames, bool insertNew, bool exportSchema, bool exportData, bool keepOldSchema); + bool dump(const QString& filename, const std::vector& tablesToDump, bool insertColNames, bool insertNew, bool exportSchema, bool exportData, bool keepOldSchema) const; enum ChoiceOnUse { @@ -124,10 +125,10 @@ public: // callback is the text representation of the values, one for each // column. The 3rd argument is a list of strings where each entry // represents the name of corresponding result column. - using execCallback = std::function; - bool executeSQL(QString statement, bool dirtyDB = true, bool logsql = true, execCallback callback = nullptr); + using execCallback = std::function, std::vector)>; + bool executeSQL(const std::string& statement, bool dirtyDB = true, bool logsql = true, execCallback callback = nullptr); bool executeMultiSQL(QByteArray query, bool dirty = true, bool log = false); - QByteArray querySingleValueFromDb(const QString& sql, bool log = true, ChoiceOnUse choice = Ask); + QByteArray querySingleValueFromDb(const std::string& sql, bool log = true, ChoiceOnUse choice = Ask) const; const QString& lastError() const { return lastErrorMessage; } @@ -140,7 +141,7 @@ public: * @param rowdata A list of QByteArray containing the row data. * @return true if statement execution was ok, else false. */ - bool getRow(const sqlb::ObjectIdentifier& table, const QString& rowid, std::vector& rowdata); + bool getRow(const sqlb::ObjectIdentifier& table, const QString& rowid, std::vector& rowdata) const; /** * @brief Interrupts the currenty running statement as soon as possible. @@ -151,15 +152,15 @@ private: /** * @brief max Queries the table t for the max value of field. * @param tableName Table to query - * @param field Field to get the max value + * @param field Name of the field to get the max value * @return the max value of the field or 0 on error */ - QString max(const sqlb::ObjectIdentifier& tableName, const sqlb::Field& field) const; + unsigned long max(const sqlb::ObjectIdentifier& tableName, const std::string& field) const; static int callbackWrapper (void* callback, int numberColumns, char** values, char** columnNames); public: - void updateSchema(); + void updateSchema(); // Please don't call this from threads other than the main thread. private: /** @@ -168,12 +169,12 @@ private: * @param pk_value This optional parameter can be used to manually set a specific value for the primary key column * @return An sqlite conform INSERT INTO statement with empty values. (NULL,'',0) */ - QString emptyInsertStmt(const std::string& schemaName, const sqlb::Table& t, const QString& pk_value = QString()) const; + std::string emptyInsertStmt(const std::string& schemaName, const sqlb::Table& t, const QString& pk_value = QString()) const; public: QString addRecord(const sqlb::ObjectIdentifier& tablename); - bool deleteRecords(const sqlb::ObjectIdentifier& table, const QStringList& rowids, const sqlb::StringVector& pseudo_pk = {}); - bool updateRecord(const sqlb::ObjectIdentifier& table, const std::string& column, const QString& rowid, const QByteArray& value, bool itsBlob, const sqlb::StringVector& pseudo_pk = {}); + bool deleteRecords(const sqlb::ObjectIdentifier& table, const std::vector& rowids, const sqlb::StringVector& pseudo_pk = {}); + bool updateRecord(const sqlb::ObjectIdentifier& table, const std::string& column, const QString& rowid, const QByteArray& value, int force_type = 0, const sqlb::StringVector& pseudo_pk = {}); bool createTable(const sqlb::ObjectIdentifier& name, const sqlb::FieldVector& structure); bool renameTable(const std::string& schema, const std::string& from_table, const std::string& to_table); @@ -198,9 +199,7 @@ public: * @param newSchema Set this to a non-empty string to move the table to a new schema * @return true if renaming was successful, false if not. In the latter case also lastErrorMessage is set */ - bool alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb::Table& new_table, AlterTableTrackColumns track_columns, std::string newSchemaName = ""); - - objectMap getBrowsableObjects(const std::string& schema) const; + bool alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb::Table& new_table, AlterTableTrackColumns track_columns, std::string newSchemaName = std::string()); template const std::shared_ptr getObjectByName(const sqlb::ObjectIdentifier& name) const @@ -220,12 +219,12 @@ public: QString currentFile() const { return curDBFilename; } /// log an SQL statement [thread-safe] - void logSQL(QString statement, LogMessageType msgtype); + void logSQL(const QString& statement, LogMessageType msgtype) const; - QString getPragma(const QString& pragma); - bool setPragma(const QString& pragma, const QString& value); - bool setPragma(const QString& pragma, const QString& value, QString& originalvalue); - bool setPragma(const QString& pragma, int value, int& originalvalue); + QString getPragma(const std::string& pragma) const; + bool setPragma(const std::string& pragma, const QString& value); + bool setPragma(const std::string& pragma, const QString& value, QString& originalvalue); + bool setPragma(const std::string& pragma, int value, int& originalvalue); bool loadExtension(const QString& filename); void loadExtensionsFromSettings(); @@ -233,10 +232,10 @@ public: static QStringList Datatypes; private: - std::vector > queryColumnInformation(const std::string& schema_name, const std::string& object_name); + std::vector > queryColumnInformation(const std::string& schema_name, const std::string& object_name) const; public: - QString generateSavepointName(const QString& identifier = QString()) const; + std::string generateSavepointName(const std::string& identifier = std::string()) const; // This function generates the name for a temporary table. It guarantees that there is no table with this name yet std::string generateTemporaryTableName(const std::string& schema) const; @@ -244,7 +243,7 @@ public: schemaMap schemata; signals: - void sqlExecuted(QString sql, int msgtype); + void sqlExecuted(QString sql, int msgtype) const; void dbChanged(bool dirty); void structureUpdated(); void requestCollation(QString name, int eTextRep); @@ -253,19 +252,19 @@ signals: private: /// external code needs to go through get() to obtain access to the database sqlite3 * _db; - std::mutex m; - std::condition_variable cv; + mutable std::mutex m; + mutable std::condition_variable cv; bool db_used; QString db_user; /// wait for release of the DB locked through a previous get(), /// giving users the option to discard running task through a /// message box. - void waitForDbRelease(ChoiceOnUse choice = Ask); + void waitForDbRelease(ChoiceOnUse choice = Ask) const; QString curDBFilename; - QString lastErrorMessage; - QStringList savepointList; + mutable QString lastErrorMessage; + std::vector savepointList; bool isEncrypted; bool isReadOnly; @@ -275,7 +274,7 @@ private: void collationNeeded(void* pData, sqlite3* db, int eTextRep, const char* sCollationName); void errorLogCallback(void* user_data, int error_code, const char* message); - bool tryEncryptionSettings(const QString& filename, bool* encrypted, CipherSettings*& cipherSettings); + bool tryEncryptionSettings(const QString& filename, bool* encrypted, CipherSettings*& cipherSettings) const; bool dontCheckForStructureUpdates; diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index 1502da55..84eef437 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -13,20 +13,23 @@ #include #include #include +#include #include #include "RowLoader.h" using json = nlohmann::json; -SqliteTableModel::SqliteTableModel(DBBrowserDB& db, QObject* parent, size_t chunkSize, const QString& encoding) +SqliteTableModel::SqliteTableModel(DBBrowserDB& db, QObject* parent, const QString& encoding) : QAbstractTableModel(parent) , m_db(db) , m_lifeCounter(0) , m_currentRowCount(0) - , m_chunkSize(chunkSize) , m_encoding(encoding) { + // Load initial settings first + reloadSettings(); + worker = new RowLoader( [this](){ return m_db.get(tr("reading rows")); }, [this](QString stmt){ return m_db.logSQL(stmt, kLogMsg_App); }, @@ -109,15 +112,11 @@ void SqliteTableModel::reset() m_headers.clear(); m_vDataTypes.clear(); m_mCondFormats.clear(); + m_mRowIdFormats.clear(); endResetModel(); } -void SqliteTableModel::setChunkSize(size_t chunksize) -{ - m_chunkSize = chunksize; -} - void SqliteTableModel::setQuery(const sqlb::Query& query) { // Unset all previous settings. When setting a table all information on the previously browsed data set is removed first. @@ -130,41 +129,25 @@ void SqliteTableModel::setQuery(const sqlb::Query& query) m_vDataTypes.emplace_back(SQLITE_INTEGER); // Get the data types of all other columns as well as the column names - bool allOk = false; - if(m_db.getObjectByName(query.table()) && m_db.getObjectByName(query.table())->type() == sqlb::Object::Types::Table) + sqlb::TablePtr t = m_db.getObjectByName(query.table()); + if(t && t->fields.size()) // It is a table and parsing was OK { - sqlb::TablePtr t = m_db.getObjectByName(query.table()); - if(t && t->fields.size()) // parsing was OK + sqlb::StringVector rowids = t->rowidColumns(); + m_query.setRowIdColumns(rowids); + m_headers.push_back(sqlb::joinStringVector(rowids, ",")); + + // Store field names and affinity data types + for(const sqlb::Field& fld : t->fields) { - sqlb::StringVector rowids = t->rowidColumns(); - m_query.setRowIdColumns(rowids); - m_headers.push_back(sqlb::joinStringVector(rowids, ",")); - for(const auto& n : t->fieldNames()) - m_headers.push_back(n); - - // parse columns types - static QStringList dataTypes = QStringList() - << "INTEGER" - << "REAL" - << "TEXT" - << "BLOB"; - for(const sqlb::Field& fld : t->fields) - { - QString name = QString::fromStdString(fld.type()).toUpper(); - int colType = dataTypes.indexOf(name); - colType = (colType == -1) ? SQLITE_TEXT : colType + 1; - m_vDataTypes.push_back(colType); - } - allOk = true; + m_headers.push_back(fld.name()); + m_vDataTypes.push_back(fld.affinity()); } - } + } else { + // If for one reason or another (either it's a view or we couldn't parse the table statement) we couldn't get the field + // information we retrieve it from SQLite using an extra query. + // NOTE: It would be nice to eventually get rid of this piece here. As soon as the grammar parser is good enough... - // If for one reason or another (either it's a view or we couldn't parse the table statement) we couldn't get the field - // information we retrieve it from SQLite using an extra query. - // NOTE: It would be nice to eventually get rid of this piece here. As soon as the grammar parser is good enough... - if(!allOk) - { - QString sColumnQuery = QString::fromUtf8("SELECT * FROM %1;").arg(QString::fromStdString(query.table().toString())); + std::string sColumnQuery = "SELECT * FROM " + query.table().toString() + ";"; if(m_query.rowIdColumns().empty()) m_query.setRowIdColumn("_rowid_"); m_headers.emplace_back("_rowid_"); @@ -198,7 +181,7 @@ void SqliteTableModel::setQuery(const QString& sQuery, const QString& sCountQuer if(!dontClearHeaders) { - auto columns = getColumns(worker->getDb(), sQuery, m_vDataTypes); + auto columns = getColumns(worker->getDb(), sQuery.toStdString(), m_vDataTypes); m_headers.insert(m_headers.end(), columns.begin(), columns.end()); } @@ -243,50 +226,91 @@ static QString toSuperScript(T number) QVariant SqliteTableModel::headerData(int section, Qt::Orientation orientation, int role) const { - if (role != Qt::DisplayRole) + if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant(); if (orientation == Qt::Horizontal) { // if we have a VIRTUAL table the model will not be valid, with no header data if(static_cast(section) < m_headers.size()) { - QString sortIndicator; - for(size_t i = 0; i < m_query.orderBy().size(); i++) { - const sqlb::SortedColumn sortedColumn = m_query.orderBy()[i]; - // Append sort indicator with direction and ordinal number in superscript style - if (sortedColumn.column == static_cast(section)) { - sortIndicator = sortedColumn.direction == sqlb::Ascending ? " ▾" : " ▴"; - sortIndicator.append(toSuperScript(i+1)); - break; + const QString plainHeader = QString::fromStdString(m_headers.at(static_cast(section))); + // In the edit role, return a plain column name, but in the display role, add the sort indicator. + if (role == Qt::EditRole) + return plainHeader; + else { + QString sortIndicator; + for(size_t i = 0; i < m_query.orderBy().size(); i++) { + const sqlb::SortedColumn sortedColumn = m_query.orderBy()[i]; + // Append sort indicator with direction and ordinal number in superscript style + if (sortedColumn.column == static_cast(section)) { + sortIndicator = sortedColumn.direction == sqlb::Ascending ? " ▾" : " ▴"; + sortIndicator.append(toSuperScript(i+1)); + break; + } } + return plainHeader + sortIndicator; } - return QString::fromStdString(m_headers.at(static_cast(section))) + sortIndicator; } - return QString("%1").arg(section + 1); + return QString::number(section + 1); } else - return QString("%1").arg(section + 1); + return QString::number(section + 1); } -QColor SqliteTableModel::getMatchingCondFormatColor(int column, const QString& value, int role) const +QVariant SqliteTableModel::getMatchingCondFormat(const std::map>& mCondFormats, size_t column, const QString& value, int role) const { + if (!mCondFormats.count(column)) + return QVariant(); + bool isNumber; - value.toFloat(&isNumber); - QString sql; + value.toDouble(&isNumber); + std::string sql; + // For each conditional format for this column, - // if the condition matches the current data, return the associated colour. - for (const CondFormat& eachCondFormat : m_mCondFormats.at(column)) { - if (isNumber && !eachCondFormat.sqlCondition().contains("'")) - sql = QString("SELECT %1 %2").arg(value, eachCondFormat.sqlCondition()); + // if the condition matches the current data, return the associated format. + for (const CondFormat& eachCondFormat : mCondFormats.at(column)) { + if (isNumber && !contains(eachCondFormat.sqlCondition(), '\'')) + sql = "SELECT " + value.toStdString() + " " + eachCondFormat.sqlCondition(); else - sql = QString("SELECT '%1' %2").arg(value, eachCondFormat.sqlCondition()); + sql = "SELECT " + sqlb::escapeString(value.toStdString()) + " " + eachCondFormat.sqlCondition(); // Empty filter means: apply format to any row. // Query the DB for the condition, waiting in case there is a loading in progress. if (eachCondFormat.filter().isEmpty() || m_db.querySingleValueFromDb(sql, false, DBBrowserDB::Wait) == "1") - return role == Qt::ForegroundRole ? eachCondFormat.foregroundColor() : eachCondFormat.backgroundColor(); + switch (role) { + case Qt::ForegroundRole: + return eachCondFormat.foregroundColor(); + case Qt::BackgroundRole: + return eachCondFormat.backgroundColor(); + case Qt::FontRole: + return eachCondFormat.font(); + case Qt::TextAlignmentRole: + return static_cast(eachCondFormat.alignmentFlag() | Qt::AlignVCenter); + } } - return QColor(); + return QVariant(); +} + +QVariant SqliteTableModel::getMatchingCondFormat(size_t row, size_t column, const QString& value, int role) const +{ + QVariant format; + // Check first for a row-id format and when there is none, for a conditional format. + if (m_mRowIdFormats.count(column)) + { + std::unique_lock lock(m_mutexDataCache); + const bool row_available = m_cache.count(row); + const QByteArray blank_data(""); + const QByteArray& row_id_data = row_available ? m_cache.at(row).at(0) : blank_data; + lock.unlock(); + + format = getMatchingCondFormat(m_mRowIdFormats, column, row_id_data, role); + if (format.isValid()) + return format; + } + if (m_mCondFormats.count(column)) + return getMatchingCondFormat(m_mCondFormats, column, value, role); + else + return QVariant(); } QVariant SqliteTableModel::data(const QModelIndex &index, int role) const @@ -297,99 +321,113 @@ QVariant SqliteTableModel::data(const QModelIndex &index, int role) const if (index.row() >= rowCount()) return QVariant(); - QMutexLocker lock(&m_mutexDataCache); + std::unique_lock lock(m_mutexDataCache); - Row blank_data; - bool row_available; - - const Row * cached_row; const size_t row = static_cast(index.row()); const size_t column = static_cast(index.column()); - if(m_cache.count(row)) - { - cached_row = &m_cache.at(row); - row_available = true; - } else { - blank_data = makeDefaultCacheEntry(); - cached_row = &blank_data; - row_available = false; - } - if(role == Qt::DisplayRole || role == Qt::EditRole) + const bool row_available = m_cache.count(row); + const QByteArray blank_data(""); + const QByteArray& data = row_available ? m_cache.at(row).at(column) : blank_data; + + if(role == Qt::DisplayRole) { if(!row_available) return tr("loading..."); - if(role == Qt::DisplayRole && cached_row->at(column).isNull()) + if(data.isNull()) { - return Settings::getValue("databrowser", "null_text").toString(); - } else if(role == Qt::DisplayRole && nosync_isBinary(index)) { - return Settings::getValue("databrowser", "blob_text").toString(); - } else if(role == Qt::DisplayRole) { - int limit = Settings::getValue("databrowser", "symbol_limit").toInt(); - QByteArray displayText = cached_row->at(column); - if (displayText.length() > limit) { - // Add "..." to the end of truncated strings - return decode(displayText.left(limit).append(" ...")); - } else { - return decode(displayText); - } + return m_nullText; + } else if(isBinary(data)) { + return m_blobText; } else { - return decode(cached_row->at(column)); + if (data.length() > m_symbolLimit) { + // Add "..." to the end of truncated strings + return decode(data.left(m_symbolLimit).append(" ...")); + } else { + return decode(data); + } } + } else if(role == Qt::EditRole) { + if(!row_available) + return QVariant(); + return decode(data); } else if(role == Qt::FontRole) { QFont font; - if(!row_available || cached_row->at(column).isNull() || nosync_isBinary(index)) + if(!row_available || data.isNull() || isBinary(data)) font.setItalic(true); + else { + // Unlock before querying from DB + lock.unlock(); + QVariant condFormatFont = getMatchingCondFormat(row, column, data, role); + if (condFormatFont.isValid()) + return condFormatFont; + } return font; } else if(role == Qt::ForegroundRole) { if(!row_available) return QColor(100, 100, 100); - if(cached_row->at(column).isNull()) - return QColor(Settings::getValue("databrowser", "null_fg_colour").toString()); - else if (nosync_isBinary(index)) - return QColor(Settings::getValue("databrowser", "bin_fg_colour").toString()); - else if (m_mCondFormats.find(index.column()) != m_mCondFormats.end()) { - QString value = cached_row->at(column); + if(data.isNull()) + return m_nullFgColour; + else if (isBinary(data)) + return m_binFgColour; + else { // Unlock before querying from DB lock.unlock(); - QColor condFormatColor = getMatchingCondFormatColor(index.column(), value, role); + QVariant condFormatColor = getMatchingCondFormat(row, column, data, role); if (condFormatColor.isValid()) return condFormatColor; } // Regular case (not null, not binary and no matching conditional format) - return QColor(Settings::getValue("databrowser", "reg_fg_colour").toString()); + return m_regFgColour; } else if (role == Qt::BackgroundRole) { if(!row_available) return QColor(255, 200, 200); - if(cached_row->at(column).isNull()) - return QColor(Settings::getValue("databrowser", "null_bg_colour").toString()); - else if (nosync_isBinary(index)) - return QColor(Settings::getValue("databrowser", "bin_bg_colour").toString()); - else if (m_mCondFormats.find(index.column()) != m_mCondFormats.end()) { - QString value = cached_row->at(column); + if(data.isNull()) + return m_nullBgColour; + else if (isBinary(data)) + return m_binBgColour; + else { // Unlock before querying from DB lock.unlock(); - QColor condFormatColor = getMatchingCondFormatColor(index.column(), value, role); + QVariant condFormatColor = getMatchingCondFormat(row, column, data, role); if (condFormatColor.isValid()) return condFormatColor; } // Regular case (not null, not binary and no matching conditional format) - return QColor(Settings::getValue("databrowser", "reg_bg_colour").toString()); + return m_regBgColour; } else if(role == Qt::ToolTipRole) { - sqlb::ForeignKeyClause fk = getForeignKeyClause(index.column()-1); + sqlb::ForeignKeyClause fk = getForeignKeyClause(column-1); if(fk.isSet()) - return tr("References %1(%2)\nHold %3Shift and click to jump there") - .arg(QString::fromStdString(fk.table())) - .arg(QString::fromStdString(sqlb::joinStringVector(fk.columns(), ","))) - .arg(QKeySequence(Qt::CTRL).toString(QKeySequence::NativeText)); - else - return QString(); + return tr("References %1(%2)\nHold %3Shift and click to jump there").arg( + QString::fromStdString(fk.table()), + QString::fromStdString(sqlb::joinStringVector(fk.columns(), ",")), + QKeySequence(Qt::CTRL).toString(QKeySequence::NativeText)); + } else if (role == Qt::TextAlignmentRole) { + // Align horizontally according to conditional format or default (left for text and right for numbers) + // Align vertically to the center, which displays better. + lock.unlock(); + QVariant condFormat = getMatchingCondFormat(row, column, data, role); + if (condFormat.isValid()) + return condFormat; + bool isNumber = m_vDataTypes.at(column) == SQLITE_INTEGER || m_vDataTypes.at(column) == SQLITE_FLOAT; + return static_cast((isNumber ? Qt::AlignRight : Qt::AlignLeft) | Qt::AlignVCenter); + } else if(role == Qt::DecorationRole) { + if(!row_available) + return QVariant(); + + if(m_imagePreviewEnabled && !isImageData(data).isNull()) + { + QImage img; + img.loadFromData(data); + return QPixmap::fromImage(img); + } } + return QVariant(); } -sqlb::ForeignKeyClause SqliteTableModel::getForeignKeyClause(int column) const +sqlb::ForeignKeyClause SqliteTableModel::getForeignKeyClause(size_t column) const { static const sqlb::ForeignKeyClause empty_foreign_key_clause; @@ -407,12 +445,12 @@ sqlb::ForeignKeyClause SqliteTableModel::getForeignKeyClause(int column) const // Convert object to a table and check if the column number is in the valid range sqlb::TablePtr tbl = std::dynamic_pointer_cast(obj); - if(tbl && tbl->name().size() && (column >= 0 && column < static_cast(tbl->fields.size()))) + if(tbl && tbl->name().size() && column < tbl->fields.size()) { // Note that the rowid column has number -1 here, it can safely be excluded since there will never be a // foreign key on that column. - sqlb::ConstraintPtr ptr = tbl->constraint({tbl->fields.at(static_cast(column)).name()}, sqlb::Constraint::ForeignKeyConstraintType); + sqlb::ConstraintPtr ptr = tbl->constraint({tbl->fields.at(column).name()}, sqlb::Constraint::ForeignKeyConstraintType); if(ptr) return *(std::dynamic_pointer_cast(ptr)); } @@ -440,7 +478,7 @@ bool SqliteTableModel::setTypedData(const QModelIndex& index, bool isBlob, const if(index.isValid() && role == Qt::EditRole) { - QMutexLocker lock(&m_mutexDataCache); + std::unique_lock lock(m_mutexDataCache); auto & cached_row = m_cache.at(static_cast(index.row())); const size_t column = static_cast(index.column()); @@ -456,7 +494,8 @@ bool SqliteTableModel::setTypedData(const QModelIndex& index, bool isBlob, const if(table) { auto field = sqlb::findField(table, m_headers.at(column)); - if(contains(table->primaryKey(), field->name()) && field->isInteger()) + const auto pk = table->primaryKey(); + if(pk && contains(pk->columnList(), field->name()) && field->isInteger()) newValue = "0"; } } @@ -466,7 +505,26 @@ bool SqliteTableModel::setTypedData(const QModelIndex& index, bool isBlob, const if(oldValue == newValue && oldValue.isNull() == newValue.isNull()) return true; - if(m_db.updateRecord(m_query.table(), m_headers.at(column), cached_row.at(0), newValue, isBlob, m_query.rowIdColumns())) + // Determine type. If the BLOB flag is set, it's always BLOB. If the affinity data type of the modified column is something numeric, + // we check if the new value is also numeric. In that case we can safely set the data type to INTEGER or FLOAT. In all other cases we + // default to TEXT. + int type = SQLITE_TEXT; + if(isBlob) + { + type = SQLITE_BLOB; + } else if(m_vDataTypes.at(column) == SQLITE_INTEGER) { + bool ok; + newValue.toLongLong(&ok); + if(ok) + type = SQLITE_INTEGER; + } else if(m_vDataTypes.at(column) == SQLITE_FLOAT) { + bool ok; + newValue.toDouble(&ok); + if(ok) + type = SQLITE_FLOAT; + } + + if(m_db.updateRecord(m_query.table(), m_headers.at(column), cached_row.at(0), newValue, type, m_query.rowIdColumns())) { cached_row[column] = newValue; @@ -519,7 +577,7 @@ Qt::ItemFlags SqliteTableModel::flags(const QModelIndex& index) const if(m_query.selectedColumns().size()) { if(index.column() > 0) - custom_display_format = QString::fromStdString(m_query.selectedColumns().at(static_cast(index.column())-1).selector) != sqlb::escapeIdentifier(headerData(index.column(), Qt::Horizontal).toString()); + custom_display_format = m_query.selectedColumns().at(static_cast(index.column())-1).selector != m_query.selectedColumns().at(static_cast(index.column())-1).original_column; } if(!isBinary(index) && !custom_display_format) @@ -619,11 +677,11 @@ bool SqliteTableModel::removeRows(int row, int count, const QModelIndex& parent) return false; } - QStringList rowids; + std::vector rowids; for(int i=count-1;i>=0;i--) { if(m_cache.count(static_cast(row+i))) { - rowids.append(m_cache.at(static_cast(row + i)).at(0)); + rowids.push_back(m_cache.at(static_cast(row + i)).at(0)); } } @@ -656,9 +714,9 @@ QModelIndex SqliteTableModel::dittoRecord(int old_row) sqlb::TablePtr t = m_db.getObjectByName(m_query.table()); - sqlb::StringVector pk = t->primaryKey(); + const auto pk = t->primaryKey(); for (size_t col = 0; col < t->fields.size(); ++col) { - if(!contains(pk, t->fields.at(col).name())) { + if(!pk || !contains(pk->columnList(), t->fields.at(col).name())) { if (!firstEditedColumn) firstEditedColumn = col + 1; @@ -693,7 +751,7 @@ void SqliteTableModel::removeCommentsFromQuery(QString& query) query = rxSQL.cap(3); } else { result += query; - query = ""; + query.clear(); } } query = result; @@ -723,7 +781,7 @@ void SqliteTableModel::removeCommentsFromQuery(QString& query) query = rxSQL.cap(4); } else { result += query; - query = ""; + query.clear(); } } @@ -739,14 +797,13 @@ void SqliteTableModel::removeCommentsFromQuery(QString& query) } } -std::vector SqliteTableModel::getColumns(std::shared_ptr pDb, const QString& sQuery, std::vector& fieldsTypes) +std::vector SqliteTableModel::getColumns(std::shared_ptr pDb, const std::string& sQuery, std::vector& fieldsTypes) const { if(!pDb) pDb = m_db.get(tr("retrieving list of columns")); sqlite3_stmt* stmt; - QByteArray utf8Query = sQuery.toUtf8(); - int status = sqlite3_prepare_v2(pDb.get(), utf8Query, utf8Query.size(), &stmt, nullptr); + int status = sqlite3_prepare_v2(pDb.get(), sQuery.c_str(), static_cast(sQuery.size()), &stmt, nullptr); std::vector listColumns; if(SQLITE_OK == status) { @@ -763,27 +820,61 @@ std::vector SqliteTableModel::getColumns(std::shared_ptr p return listColumns; } -void SqliteTableModel::addCondFormat(int column, const CondFormat& condFormat) +void addCondFormatToMap(std::map>& mCondFormats, size_t column, const CondFormat& condFormat) { - m_mCondFormats[column].push_back(condFormat); + // If the condition is already present in the vector, update that entry and respect the order, since two entries with the same + // condition do not make sense. + auto it = std::find_if(mCondFormats[column].begin(), mCondFormats[column].end(), [condFormat](const CondFormat& format) { + return format.sqlCondition() == condFormat.sqlCondition(); + }); + // Replace cond-format if present. push it back if it's a conditionless format (apply to every cell in column) or insert + // as first element otherwise. + if(it != mCondFormats[column].end()) { + *it = condFormat; + } else if (condFormat.filter().isEmpty()) + mCondFormats[column].push_back(condFormat); + else + mCondFormats[column].insert(mCondFormats[column].begin(), condFormat); +} + +void SqliteTableModel::addCondFormat(const bool isRowIdFormat, size_t column, const CondFormat& condFormat) +{ + if(isRowIdFormat) + addCondFormatToMap(m_mRowIdFormats, column, condFormat); + else + addCondFormatToMap(m_mCondFormats, column, condFormat); emit layoutChanged(); } -void SqliteTableModel::setCondFormats(int column, const std::vector& condFormats) +void SqliteTableModel::setCondFormats(const bool isRowIdFormat, size_t column, const std::vector& condFormats) { - m_mCondFormats[column] = condFormats; + if(isRowIdFormat) + m_mRowIdFormats[column] = condFormats; + else + m_mCondFormats[column] = condFormats; emit layoutChanged(); } -void SqliteTableModel::updateFilter(int column, const QString& value) +void SqliteTableModel::updateFilter(size_t column, const QString& value) { - QString whereClause = CondFormat::filterToSqlCondition(value, m_encoding); + std::string whereClause = CondFormat::filterToSqlCondition(value, m_encoding); // If the value was set to an empty string remove any filter for this column. Otherwise insert a new filter rule or replace the old one if there is already one - if(whereClause.isEmpty()) - m_query.where().erase(static_cast(column)); + if(whereClause.empty()) + m_query.where().erase(column); else - m_query.where()[static_cast(column)] = whereClause.toStdString(); + m_query.where()[column] = whereClause; + + // Build the new query + buildQuery(); +} + +void SqliteTableModel::updateGlobalFilter(const std::vector& values) +{ + std::vector filters; + for(auto& v : values) + filters.push_back(CondFormat::filterToSqlCondition(v, m_encoding)); + m_query.setGlobalWhere(filters); // Build the new query buildQuery(); @@ -811,19 +902,19 @@ void SqliteTableModel::clearCache() bool SqliteTableModel::isBinary(const QModelIndex& index) const { - QMutexLocker lock(&m_mutexDataCache); - return nosync_isBinary(index); -} + std::lock_guard lock(m_mutexDataCache); -bool SqliteTableModel::nosync_isBinary(const QModelIndex& index) const -{ const size_t row = static_cast(index.row()); if(!m_cache.count(row)) return false; const auto & cached_row = m_cache.at(row); + return isBinary(cached_row.at(static_cast(index.column()))); +} - return !isTextOnly(cached_row.at(static_cast(index.column())), m_encoding, true); +bool SqliteTableModel::isBinary(const QByteArray& data) const +{ + return !isTextOnly(data, m_encoding, true); } QByteArray SqliteTableModel::encode(const QByteArray& str) const @@ -904,7 +995,7 @@ void SqliteTableModel::triggerCacheLoad (int row) const } // avoid re-fetching data - QMutexLocker lk(&m_mutexDataCache); + std::lock_guard lk(m_mutexDataCache); m_cache.smallestNonAvailableRange(row_begin, row_end); if(row_end != row_begin) @@ -949,7 +1040,7 @@ bool SqliteTableModel::isCacheComplete () const { if(readingData()) return false; - QMutexLocker lock(&m_mutexDataCache); + std::lock_guard lock(m_mutexDataCache); return m_cache.numSet() == m_currentRowCount; } @@ -957,3 +1048,127 @@ void SqliteTableModel::waitUntilIdle () const { worker->waitUntilIdle(); } + +QModelIndex SqliteTableModel::nextMatch(const QModelIndex& start, const std::vector& column_list, const QString& value, Qt::MatchFlags flags, bool reverse, bool dont_skip_to_next_field) const +{ + // Extract flags + bool whole_cell = !(flags & Qt::MatchContains); + bool regex = flags & Qt::MatchRegExp; + Qt::CaseSensitivity case_sensitive = ((flags & Qt::MatchCaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive); + bool wrap = flags & Qt::MatchWrap; + int increment = (reverse ? -1 : 1); + + // Prepare the regular expression for regex mode + QRegularExpression reg_exp; + if(regex) + { + reg_exp = QRegularExpression(value, (case_sensitive ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption)); + if(!reg_exp.isValid()) + return QModelIndex(); + + if(whole_cell) + { +#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) + reg_exp.setPattern("\\A(" + reg_exp.pattern() + ")\\Z"); +#else + reg_exp.setPattern(QRegularExpression::anchoredPattern(reg_exp.pattern())); +#endif + } + } + + // Wait until the row count is there + waitUntilIdle(); + + // Stop right away if there is no data in the table + if(rowCount() == 0) + return QModelIndex(); + + // Make sure the start position starts in a column from the list of columns to search in + QModelIndex pos = start; + if(std::find(column_list.begin(), column_list.end(), pos.column()) == column_list.end()) + { + // If for some weird reason the start index is not in the column list, we simply use the first column of the column list instead + pos = pos.sibling(pos.row(), reverse ? column_list.back() : column_list.front()); + } + + // Get the last cell to search in. If wrapping is enabled, we search until we hit the start cell again. If wrapping is not enabled, we start at the last + // cell of the table. + QModelIndex end = (wrap ? pos : index(rowCount(), column_list.back())); + + // Loop through all cells for the search + while(true) + { + // Go to the next cell and skip all columns in between which we do not care about. This is done as the first step in order + // to skip the start index when matching the first cell is disabled. + if(dont_skip_to_next_field == false) + { + while(true) + { + // Next cell position + int next_row = pos.row(); + int next_column = pos.column() + increment; + + // Have we reached the end of the row? Then go to the next one + if(next_column < 0 || next_column >= static_cast(m_headers.size())) + { + next_row += increment; + next_column = (reverse ? column_list.back() : column_list.front()); + } + + // Have we reached the last row? Then wrap around to the first one + if(wrap && (next_row < 0 || next_row >= rowCount())) + next_row = (reverse ? rowCount()-1 : 0); + + // Set next index for search + pos = pos.sibling(next_row, next_column); + + // Have we hit the last column? We have not found anything then + if(pos == end) + return QModelIndex(); + + // Is this a column which we are supposed to search in? If so, stop looking for the next cell and start comparing + if(std::find(column_list.begin(), column_list.end(), next_column) != column_list.end()) + break; + } + } + + // Make sure the next time we hit the above check, we actuall move on to the next cell and do not skip the loop again. + dont_skip_to_next_field = false; + + // Get row from cache. If it is not in the cache, load the next chunk from the database + const size_t row = static_cast(pos.row()); + if(!m_cache.count(row)) + { + triggerCacheLoad(static_cast(row)); + waitUntilIdle(); + } + const Row* row_data = &m_cache.at(row); + + // Get cell data + const size_t column = static_cast(pos.column()); + QString data = row_data->at(column); + + // Perform comparison + if(whole_cell && !regex && data.compare(value, case_sensitive) == 0) + return pos; + else if(!whole_cell && !regex && data.contains(value, case_sensitive)) + return pos; + else if(regex && reg_exp.match(data).hasMatch()) + return pos; + } +} + +void SqliteTableModel::reloadSettings() +{ + m_nullText = Settings::getValue("databrowser", "null_text").toString(); + m_blobText = Settings::getValue("databrowser", "blob_text").toString(); + m_regFgColour = QColor(Settings::getValue("databrowser", "reg_fg_colour").toString()); + m_regBgColour = QColor(Settings::getValue("databrowser", "reg_bg_colour").toString()); + m_nullFgColour = QColor(Settings::getValue("databrowser", "null_fg_colour").toString()); + m_nullBgColour = QColor(Settings::getValue("databrowser", "null_bg_colour").toString()); + m_binFgColour = QColor(Settings::getValue("databrowser", "bin_fg_colour").toString()); + m_binBgColour = QColor(Settings::getValue("databrowser", "bin_bg_colour").toString()); + m_symbolLimit = Settings::getValue("databrowser", "symbol_limit").toInt(); + m_imagePreviewEnabled = Settings::getValue("databrowser", "image_preview").toBool(); + m_chunkSize = static_cast(Settings::getValue("db", "prefetchsize").toUInt()); +} diff --git a/src/sqlitetablemodel.h b/src/sqlitetablemodel.h index 2c5da49a..b9e6c6ac 100644 --- a/src/sqlitetablemodel.h +++ b/src/sqlitetablemodel.h @@ -2,11 +2,12 @@ #define SQLITETABLEMODEL_H #include -#include #include -#include -#include + #include +#include +#include +#include #include "RowCache.h" #include "sql/Query.h" @@ -25,7 +26,7 @@ class SqliteTableModel : public QAbstractTableModel #endif public: - explicit SqliteTableModel(DBBrowserDB& db, QObject *parent = nullptr, size_t chunkSize = 50000, const QString& encoding = QString()); + explicit SqliteTableModel(DBBrowserDB& db, QObject *parent = nullptr, const QString& encoding = QString()); ~SqliteTableModel() override; /// reset to state after construction @@ -80,14 +81,12 @@ public: /// configure for browsing results of specified query void setQuery(const QString& sQuery, const QString& sCountQuery = QString(), bool dontClearHeaders = false); - QString query() const { return m_sQuery; } - QString customQuery(bool withRowid) const { return QString::fromStdString(m_query.buildQuery(withRowid)); } + std::string query() const { return m_sQuery.toStdString(); } + std::string customQuery(bool withRowid) const { return m_query.buildQuery(withRowid); } /// configure for browsing specified table void setQuery(const sqlb::Query& query); - void setChunkSize(size_t chunksize); - size_t chunkSize() { return m_chunkSize; } void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; void sort(const std::vector& columns); sqlb::ObjectIdentifier currentTableName() const { return m_query.table(); } @@ -104,7 +103,7 @@ public: bool hasPseudoPk() const; std::vector pseudoPk() const { return m_query.rowIdColumns(); } - sqlb::ForeignKeyClause getForeignKeyClause(int column) const; + sqlb::ForeignKeyClause getForeignKeyClause(size_t column) const; // This returns true if the model is set up for editing. The model is able to operate in more or less two different modes, table browsing // and query browsing. We only support editing data for the table browsing mode and not for the query mode. This function returns true if @@ -114,13 +113,32 @@ public: // Helper function for removing all comments from a SQL query static void removeCommentsFromQuery(QString& query); - void addCondFormat(int column, const CondFormat& condFormat); - void setCondFormats(int column, const std::vector& condFormats); + // Conditional formats are of two kinds: regular conditional formats (including condition-free formats applying to any value in the + // column) and formats applying to a particular row-id and which have always precedence over the first kind and whose filter apply + // to the row-id column. + void addCondFormat(const bool isRowIdFormat, size_t column, const CondFormat& condFormat); + void setCondFormats(const bool isRowIdFormat, size_t column, const std::vector& condFormats); + + // Search for the specified expression in the given cells. This intended as a replacement for QAbstractItemModel::match() even though + // it does not override it, which - because of the different parameters - is not possible. + // start contains the index to start with, column_list contains the ordered list of the columns to look in, value is the value to search for, + // flags allows to modify the search process (Qt::MatchContains, Qt::MatchRegExp, Qt::MatchCaseSensitive, and Qt::MatchWrap are understood), + // reverse can be set to true to progress through the cells in backwards direction, and dont_skip_to_next_field can be set to true if the current + // cell can be matched as well. + QModelIndex nextMatch(const QModelIndex& start, + const std::vector& column_list, + const QString& value, + Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchContains), + bool reverse = false, + bool dont_skip_to_next_field = false) const; DBBrowserDB& db() { return m_db; } + void reloadSettings(); + public slots: - void updateFilter(int column, const QString& value); + void updateFilter(size_t column, const QString& value); + void updateGlobalFilter(const std::vector& values); signals: void finishedFetch(int fetched_row_begin, int fetched_row_end); @@ -144,14 +162,15 @@ private: void buildQuery(); /// \param pDb connection to query; if null, obtains it from 'm_db'. - std::vector getColumns(std::shared_ptr pDb, const QString& sQuery, std::vector& fieldsTypes); + std::vector getColumns(std::shared_ptr pDb, const std::string& sQuery, std::vector& fieldsTypes) const; QByteArray encode(const QByteArray& str) const; QByteArray decode(const QByteArray& str) const; - // Return matching conditional format color or invalid color, otherwise. - // Only Qt::ForegroundRole and Qt::BackgroundRole are expected in role (Qt::ItemDataRole) - QColor getMatchingCondFormatColor(int column, const QString& value, int role) const; + // Return matching conditional format color/font or invalid value, otherwise. + // Only format roles are expected in role (Qt::ItemDataRole) + QVariant getMatchingCondFormat(size_t row, size_t column, const QString& value, int role) const; + QVariant getMatchingCondFormat(const std::map>& mCondFormats, size_t column, const QString& value, int role) const; DBBrowserDB& m_db; @@ -179,13 +198,39 @@ private: Row makeDefaultCacheEntry () const; - bool nosync_isBinary(const QModelIndex& index) const; + bool isBinary(const QByteArray& index) const; QString m_sQuery; std::vector m_vDataTypes; - std::map> m_mCondFormats; + std::map> m_mCondFormats; + std::map> m_mRowIdFormats; sqlb::Query m_query; + QString m_encoding; + + /** + * These are used for multi-threaded population of the table + */ + mutable std::mutex m_mutexDataCache; + +private: + /** + * Settings. These are stored here to avoid fetching and converting them every time we need them. Because this class + * uses a lot of settings and because some of its functions are called very often, this should speed things up noticeable. + * Call reloadSettings() to update these. + */ + + QString m_nullText; + QString m_blobText; + QColor m_regFgColour; + QColor m_regBgColour; + QColor m_nullFgColour; + QColor m_nullBgColour; + QColor m_binFgColour; + QColor m_binBgColour; + int m_symbolLimit; + bool m_imagePreviewEnabled; + /** * @brief m_chunkSize Size of the next chunk fetch more will try to fetch. * This value should be rather high, because our query @@ -195,13 +240,6 @@ private: * to that row count. */ size_t m_chunkSize; - - QString m_encoding; - - /** - * These are used for multi-threaded population of the table - */ - mutable QMutex m_mutexDataCache; }; #endif diff --git a/src/sqltextedit.cpp b/src/sqltextedit.cpp index 41353be0..eabf43fc 100644 --- a/src/sqltextedit.cpp +++ b/src/sqltextedit.cpp @@ -45,10 +45,6 @@ SqlTextEdit::SqlTextEdit(QWidget* parent) : reloadSettings(); } -SqlTextEdit::~SqlTextEdit() -{ -} - void SqlTextEdit::reloadSettings() { // Enable auto completion if it hasn't been disabled @@ -82,7 +78,8 @@ void SqlTextEdit::reloadSettings() break; case sqlb::GraveAccents: sqlLexer->setQuotedIdentifiers(true); - // Fall through, treat quoted string as literal string + setupSyntaxHighlightingFormat(sqlLexer, "string", QsciLexerSQL::DoubleQuotedString); // treat quoted string as literal string + break; case sqlb::SquareBrackets: setupSyntaxHighlightingFormat(sqlLexer, "string", QsciLexerSQL::DoubleQuotedString); break; diff --git a/src/sqltextedit.h b/src/sqltextedit.h index 7b50e4a6..ffcd6cf8 100644 --- a/src/sqltextedit.h +++ b/src/sqltextedit.h @@ -15,7 +15,6 @@ class SqlTextEdit : public ExtendedScintilla public: explicit SqlTextEdit(QWidget *parent = nullptr); - ~SqlTextEdit() override; static SqlUiLexer* sqlLexer; diff --git a/src/src.pro b/src/src.pro index 5943421f..91670311 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,7 +1,6 @@ TEMPLATE = app QT += core gui network widgets printsupport concurrent xml -macx: QT += opengl TARGET = sqlitebrowser @@ -37,9 +36,6 @@ HEADERS += \ sql/sqlitetypes.h \ csvparser.h \ ExtendedTableWidget.h \ - grammar/Sqlite3Lexer.hpp \ - grammar/Sqlite3Parser.hpp \ - grammar/sqlite3TokenTypes.hpp \ sqlitetablemodel.h \ RowCache.h \ RowLoader.h \ @@ -76,7 +72,13 @@ HEADERS += \ RunSql.h \ sql/ObjectIdentifier.h \ ProxyDialog.h \ - IconCache.h + IconCache.h \ + SelectItemsPopup.h \ + TableBrowser.h \ + sql/parser/ParserDriver.h \ + sql/parser/sqlite3_lexer.h \ + sql/parser/sqlite3_location.h \ + sql/parser/sqlite3_parser.hpp SOURCES += \ sqlitedb.cpp \ @@ -94,8 +96,6 @@ SOURCES += \ sql/sqlitetypes.cpp \ csvparser.cpp \ ExtendedTableWidget.cpp \ - grammar/Sqlite3Lexer.cpp \ - grammar/Sqlite3Parser.cpp \ sqlitetablemodel.cpp \ RowLoader.cpp \ FilterTableHeader.cpp \ @@ -129,7 +129,12 @@ SOURCES += \ RunSql.cpp \ sql/ObjectIdentifier.cpp \ ProxyDialog.cpp \ - IconCache.cpp + IconCache.cpp \ + SelectItemsPopup.cpp \ + TableBrowser.cpp \ + sql/parser/ParserDriver.cpp \ + sql/parser/sqlite3_lexer.cpp \ + sql/parser/sqlite3_parser.cpp RESOURCES += icons/icons.qrc \ translations/flags/flags.qrc \ @@ -158,7 +163,9 @@ FORMS += \ FindReplaceDialog.ui \ FileExtensionManager.ui \ CondFormatManager.ui \ - ProxyDialog.ui + ProxyDialog.ui \ + SelectItemsPopup.ui \ + TableBrowser.ui TRANSLATIONS += \ translations/sqlb_ar_SA.ts \ @@ -183,7 +190,7 @@ CONFIG(sqlcipher) { LIBS += -lsqlcipher # Add the paths for Homebrew installed SQLCipher - mac { + macx { INCLUDEPATH += /usr/local/opt/sqlcipher/include LIBS += -L/usr/local/opt/sqlcipher/lib } @@ -191,14 +198,13 @@ CONFIG(sqlcipher) { LIBS += -lsqlite3 # Add the paths for Homebrew installed SQLite - mac { + macx { INCLUDEPATH += /usr/local/opt/sqlite/include LIBS += -L/usr/local/opt/sqlite/lib } } LIBPATH_QHEXEDIT=$$OUT_PWD/../libs/qhexedit -LIBPATH_ANTLR=$$OUT_PWD/../libs/antlr-2.7.7 LIBPATH_QCUSTOMPLOT=$$OUT_PWD/../libs/qcustomplot-source LIBPATH_QSCINTILLA=$$OUT_PWD/../libs/qscintilla/Qt4Qt5 LIBPATH_JSON=$$OUT_PWD/../libs/json @@ -214,14 +220,12 @@ win32 { INCLUDEPATH += $$PWD CONFIG(debug,debug|release) { LIBPATH_QHEXEDIT = $$LIBPATH_QHEXEDIT/debug - LIBPATH_ANTLR = $$LIBPATH_ANTLR/debug LIBPATH_QCUSTOMPLOT = $$LIBPATH_QCUSTOMPLOT/debug LIBPATH_QSCINTILLA = $$LIBPATH_QSCINTILLA/debug LIBPATH_JSON = $$LIBPATH_JSON/debug } CONFIG(release,debug|release) { LIBPATH_QHEXEDIT = $$LIBPATH_QHEXEDIT/release - LIBPATH_ANTLR = $$LIBPATH_ANTLR/release LIBPATH_QCUSTOMPLOT = $$LIBPATH_QCUSTOMPLOT/release LIBPATH_QSCINTILLA = $$LIBPATH_QSCINTILLA/release LIBPATH_JSON = $$LIBPATH_JSON/release @@ -233,10 +237,10 @@ win32 { INCLUDEPATH += $$PWD/../../../dev/SQLite DEPENDPATH += $$PWD/../../../dev/SQLite } -mac { +macx { TARGET = "DB Browser for SQLite" RC_FILE = macapp.icns - QT+= macextras + QT += macextras opengl INCLUDEPATH += /usr/local/include LIBS += -L/usr/local/lib -framework Carbon QMAKE_INFO_PLIST = app.plist @@ -249,9 +253,9 @@ CONFIG(all_warnings) { } UI_DIR = .ui -INCLUDEPATH += $$PWD/../libs/antlr-2.7.7 $$PWD/../libs/qhexedit/src $$PWD/../libs/qcustomplot-source $$PWD/../libs/qscintilla/Qt4Qt5 $$PWD/../libs/json $$PWD/.. -LIBS += -L$$LIBPATH_QHEXEDIT -L$$LIBPATH_ANTLR -L$$LIBPATH_QCUSTOMPLOT -L$$LIBPATH_QSCINTILLA -lantlr -lqhexedit -lqcustomplot -lqscintilla2 -DEPENDPATH += $$PWD/../libs/antlr-2.7.7 $$PWD/../libs/qhexedit $$PWD/../libs/qcustomplot-source $$PWD/../libs/qscintilla/Qt4Qt5 $$PWD/../libs/json +INCLUDEPATH += $$PWD/../libs/qhexedit/src $$PWD/../libs/qcustomplot-source $$PWD/../libs/qscintilla/Qt4Qt5 $$PWD/../libs/json $$PWD/.. +LIBS += -L$$LIBPATH_QHEXEDIT -L$$LIBPATH_QCUSTOMPLOT -L$$LIBPATH_QSCINTILLA -lqhexedit -lqcustomplot -lqscintilla2 +DEPENDPATH += $$PWD/../libs/qhexedit $$PWD/../libs/qcustomplot-source $$PWD/../libs/qscintilla/Qt4Qt5 $$PWD/../libs/json unix { # Below, the user can specify where all generated file can be placed diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 1ec7b642..ccf87c64 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -14,24 +14,26 @@ set(TESTSQLOBJECTS_SRC ../sql/Query.cpp ../sql/ObjectIdentifier.cpp ../csvparser.cpp - ../grammar/Sqlite3Lexer.cpp - ../grammar/Sqlite3Parser.cpp ../Settings.cpp testsqlobjects.cpp ../Data.cpp ../CipherSettings.cpp ../DotenvFormat.cpp ../CondFormat.cpp + ../sql/parser/ParserDriver.cpp + ../sql/parser/sqlite3_lexer.cpp + ../sql/parser/sqlite3_parser.cpp ) set(TESTSQLOBJECTS_HDR - ../grammar/sqlite3TokenTypes.hpp - ../grammar/Sqlite3Lexer.hpp - ../grammar/Sqlite3Parser.hpp ../sql/sqlitetypes.h ../sql/Query.h ../sql/ObjectIdentifier.h ../Data.h + ../sql/parser/ParserDriver.h + ../sql/parser/sqlite3_lexer.h + ../sql/parser/sqlite3_location.h + ../sql/parser/sqlite3_parser.hpp ) set(TESTSQLOBJECTS_MOC_HDR @@ -59,15 +61,7 @@ target_link_libraries(test-sqlobjects Qt5::Test Qt5::Widgets Qt5::Gui) set(QT_LIBRARIES "") -if(NOT ANTLR2_FOUND) - add_dependencies(test-sqlobjects antlr) -endif() target_link_libraries(test-sqlobjects ${QT_LIBRARIES} ${LIBSQLITE}) -if(ANTLR2_FOUND) - target_link_libraries(test-sqlobjects ${ANTLR2_LIBRARIES}) -else() - target_link_libraries(test-sqlobjects antlr) -endif() target_link_libraries(test-sqlobjects ${LPTHREAD}) add_test(test-sqlobjects test-sqlobjects) @@ -101,24 +95,26 @@ set(TESTREGEX_SRC ../sql/sqlitetypes.cpp ../sql/Query.cpp ../sql/ObjectIdentifier.cpp - ../grammar/Sqlite3Lexer.cpp - ../grammar/Sqlite3Parser.cpp ../Settings.cpp TestRegex.cpp ../Data.cpp ../CipherSettings.cpp ../DotenvFormat.cpp ../CondFormat.cpp + ../sql/parser/ParserDriver.cpp + ../sql/parser/sqlite3_lexer.cpp + ../sql/parser/sqlite3_parser.cpp ) set(TESTREGEX_HDR - ../grammar/sqlite3TokenTypes.hpp - ../grammar/Sqlite3Lexer.hpp - ../grammar/Sqlite3Parser.hpp ../sql/sqlitetypes.h ../sql/Query.h ../sql/ObjectIdentifier.h ../Data.h + ../sql/parser/ParserDriver.h + ../sql/parser/sqlite3_lexer.h + ../sql/parser/sqlite3_location.h + ../sql/parser/sqlite3_parser.hpp ) set(TESTREGEX_MOC_HDR @@ -142,15 +138,7 @@ target_link_libraries(test-regex Qt5::Test Qt5::Core Qt5::Gui Qt5::Widgets) set(QT_LIBRARIES "") -if(NOT ANTLR2_FOUND) - add_dependencies(test-regex antlr) -endif() target_link_libraries(test-regex ${QT_LIBRARIES} ${LIBSQLITE}) -if(ANTLR2_FOUND) - target_link_libraries(test-regex ${ANTLR2_LIBRARIES}) -else() - target_link_libraries(test-regex antlr) -endif() target_link_libraries(test-regex ${LPTHREAD}) add_test(test-regex test-regex) diff --git a/src/tests/testsqlobjects.cpp b/src/tests/testsqlobjects.cpp index 6ebea504..bdc847b4 100644 --- a/src/tests/testsqlobjects.cpp +++ b/src/tests/testsqlobjects.cpp @@ -5,6 +5,7 @@ #include QTEST_APPLESS_MAIN(TestTable) +Q_DECLARE_METATYPE(std::string) using namespace sqlb; @@ -29,7 +30,7 @@ void TestTable::sqlOutput() tt.fields.push_back(f); tt.fields.emplace_back("car", "text"); tt.fields.push_back(fkm); - tt.addConstraint({f.name(), fkm.name()}, ConstraintPtr(new PrimaryKeyConstraint())); + tt.addConstraint(ConstraintPtr(new PrimaryKeyConstraint({f.name(), fkm.name()}))); QCOMPARE(tt.sql(), "CREATE TABLE \"testtable\" (\n" "\t\"id\"\tinteger,\n" @@ -47,7 +48,7 @@ void TestTable::sqlGraveAccentOutput() tt.fields.push_back(f); tt.fields.emplace_back("car", "text"); tt.fields.push_back(fkm); - tt.addConstraint({f.name(), fkm.name()}, ConstraintPtr(new PrimaryKeyConstraint())); + tt.addConstraint(ConstraintPtr(new PrimaryKeyConstraint({f.name(), fkm.name()}))); sqlb::setIdentifierQuoting(sqlb::GraveAccents); QCOMPARE(tt.sql(), "CREATE TABLE `testtable` (\n" @@ -69,7 +70,7 @@ void TestTable::sqlSquareBracketsOutput() tt.fields.push_back(f); tt.fields.emplace_back("car", "text"); tt.fields.push_back(fkm); - tt.addConstraint({f.name(), fkm.name()}, ConstraintPtr(new PrimaryKeyConstraint())); + tt.addConstraint(ConstraintPtr(new PrimaryKeyConstraint({f.name(), fkm.name()}))); sqlb::setIdentifierQuoting(sqlb::SquareBrackets); QCOMPARE(tt.sql(), "CREATE TABLE [testtable] (\n" @@ -86,17 +87,19 @@ void TestTable::autoincrement() { Table tt("testtable"); Field f("id", "integer"); - f.setAutoIncrement(true); Field fkm("km", "integer"); tt.fields.push_back(f); tt.fields.emplace_back("car", "text"); tt.fields.push_back(fkm); - tt.addConstraint({f.name()}, ConstraintPtr(new PrimaryKeyConstraint())); + PrimaryKeyConstraint pk({f.name()}); + pk.setAutoIncrement(true); + tt.addConstraint(ConstraintPtr(new PrimaryKeyConstraint(pk))); QCOMPARE(tt.sql(), "CREATE TABLE \"testtable\" (\n" - "\t\"id\"\tinteger PRIMARY KEY AUTOINCREMENT,\n" + "\t\"id\"\tinteger,\n" "\t\"car\"\ttext,\n" - "\t\"km\"\tinteger\n" + "\t\"km\"\tinteger,\n" + "\tPRIMARY KEY(\"id\" AUTOINCREMENT)\n" ");"); } @@ -104,17 +107,19 @@ void TestTable::notnull() { Table tt("testtable"); Field f("id", "integer"); - f.setAutoIncrement(true); Field fkm("km", "integer"); tt.fields.push_back(f); tt.fields.emplace_back("car", "text", true); tt.fields.push_back(fkm); - tt.addConstraint({f.name()}, ConstraintPtr(new PrimaryKeyConstraint())); + PrimaryKeyConstraint pk({f.name()}); + pk.setAutoIncrement(true); + tt.addConstraint(ConstraintPtr(new PrimaryKeyConstraint(pk))); QCOMPARE(tt.sql(), "CREATE TABLE \"testtable\" (\n" - "\t\"id\"\tinteger PRIMARY KEY AUTOINCREMENT,\n" + "\t\"id\"\tinteger,\n" "\t\"car\"\ttext NOT NULL,\n" - "\t\"km\"\tinteger\n" + "\t\"km\"\tinteger,\n" + "\tPRIMARY KEY(\"id\" AUTOINCREMENT)\n" ");"); } @@ -122,15 +127,15 @@ void TestTable::withoutRowid() { Table tt("testtable"); Field f("a", "integer"); - f.setAutoIncrement(true); tt.fields.push_back(f); tt.fields.emplace_back("b", "integer"); tt.setWithoutRowidTable(true); - tt.addConstraint({f.name()}, ConstraintPtr(new PrimaryKeyConstraint())); + tt.addConstraint(ConstraintPtr(new PrimaryKeyConstraint({f.name()}))); QCOMPARE(tt.sql(), "CREATE TABLE \"testtable\" (\n" - "\t\"a\"\tinteger PRIMARY KEY AUTOINCREMENT,\n" - "\t\"b\"\tinteger\n" + "\t\"a\"\tinteger,\n" + "\t\"b\"\tinteger,\n" + "\tPRIMARY KEY(\"a\")\n" ") WITHOUT ROWID;"); } @@ -139,7 +144,9 @@ void TestTable::foreignKeys() Table tt("testtable"); Field f("a", "integer"); tt.fields.push_back(f); - tt.addConstraint({f.name()}, sqlb::ConstraintPtr(new sqlb::ForeignKeyClause("b", sqlb::StringVector{"c"}))); + sqlb::ConstraintPtr fk = sqlb::ConstraintPtr(new sqlb::ForeignKeyClause("b", sqlb::StringVector{"c"})); + fk->setColumnList({f.name()}); + tt.addConstraint(fk); QCOMPARE(tt.sql(), "CREATE TABLE \"testtable\" (\n" "\t\"a\"\tinteger,\n" @@ -157,7 +164,7 @@ void TestTable::uniqueConstraint() tt.fields.push_back(f1); tt.fields.push_back(f2); tt.fields.push_back(f3); - tt.addConstraint({f2.name(), f3.name()}, sqlb::ConstraintPtr(new sqlb::UniqueConstraint())); + tt.addConstraint(sqlb::ConstraintPtr(new sqlb::UniqueConstraint({f2.name(), f3.name()}))); QCOMPARE(tt.sql(), "CREATE TABLE \"testtable\" (\n" "\t\"a\"\tinteger UNIQUE,\n" @@ -175,7 +182,7 @@ void TestTable::parseSQL() "\tinfo VARCHAR(255) CHECK (info == 'x')\n" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "hero"); QCOMPARE(tab.rowidColumns(), {"_rowid_"}); @@ -187,14 +194,14 @@ void TestTable::parseSQL() QCOMPARE(tab.fields.at(1).type(), "text"); QCOMPARE(tab.fields.at(2).type(), "VARCHAR(255)"); - sqlb::StringVector pk = tab.primaryKey(); - QVERIFY(tab.fields.at(0).autoIncrement()); - QCOMPARE(pk.size(), 1); - QCOMPARE(pk.at(0), tab.fields.at(0).name()); + auto pk = tab.primaryKey(); + QVERIFY(pk->autoIncrement()); + QCOMPARE(pk->columnList().size(), 1); + QCOMPARE(pk->columnList().at(0), tab.fields.at(0).name()); QVERIFY(tab.fields.at(1).notnull()); QCOMPARE(tab.fields.at(1).defaultValue(), "'xxxx'"); QCOMPARE(tab.fields.at(1).check(), ""); - QCOMPARE(tab.fields.at(2).check(), "info=='x'"); + QCOMPARE(tab.fields.at(2).check(), "\"info\" == 'x'"); } void TestTable::parseSQLdefaultexpr() @@ -205,7 +212,7 @@ void TestTable::parseSQLdefaultexpr() "date datetime default CURRENT_TIMESTAMP," "zoi integer)"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "chtest"); QCOMPARE(tab.fields.at(0).name(), "id"); @@ -219,15 +226,15 @@ void TestTable::parseSQLdefaultexpr() QCOMPARE(tab.fields.at(3).type(), "integer"); QCOMPARE(tab.fields.at(1).defaultValue(), "('axa')"); - QCOMPARE(tab.fields.at(1).check(), "dumpytext==\"aa\""); + QCOMPARE(tab.fields.at(1).check(), "\"dumpytext\" == \"aa\""); QCOMPARE(tab.fields.at(2).defaultValue(), "CURRENT_TIMESTAMP"); QCOMPARE(tab.fields.at(2).check(), ""); QCOMPARE(tab.fields.at(3).defaultValue(), ""); QCOMPARE(tab.fields.at(3).check(), ""); - sqlb::StringVector pk = tab.primaryKey(); - QCOMPARE(pk.size(), 1); - QCOMPARE(pk.at(0), tab.fields.at(0).name()); + auto pk = tab.primaryKey(); + QCOMPARE(pk->columnList().size(), 1); + QCOMPARE(pk->columnList().at(0), tab.fields.at(0).name()); } void TestTable::parseSQLMultiPk() @@ -239,7 +246,7 @@ void TestTable::parseSQLMultiPk() "PRIMARY KEY(\"id1\",\"id2\")\n" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "hero"); QCOMPARE(tab.fields.at(0).name(), "id1"); @@ -248,17 +255,17 @@ void TestTable::parseSQLMultiPk() QCOMPARE(tab.fields.at(0).type(), "integer"); QCOMPARE(tab.fields.at(1).type(), "integer"); - sqlb::StringVector pk = tab.primaryKey(); - QCOMPARE(pk.size(), 2); - QCOMPARE(pk.at(0), tab.fields.at(0).name()); - QCOMPARE(pk.at(1), tab.fields.at(1).name()); + auto pk = tab.primaryKey(); + QCOMPARE(pk->columnList().size(), 2); + QCOMPARE(pk->columnList().at(0), tab.fields.at(0).name()); + QCOMPARE(pk->columnList().at(1), tab.fields.at(1).name()); } void TestTable::parseSQLForeignKey() { std::string sSQL = "CREATE TABLE grammar_test(id, test, FOREIGN KEY(test) REFERENCES other_table);"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "grammar_test"); QCOMPARE(tab.fields.at(0).name(), "id"); @@ -269,7 +276,7 @@ void TestTable::parseSQLSingleQuotes() { std::string sSQL = "CREATE TABLE 'test'('id','test');"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "test"); QCOMPARE(tab.fields.at(0).name(), "id"); @@ -280,7 +287,7 @@ void TestTable::parseSQLSquareBrackets() { std::string sSQL = "CREATE TABLE [test]([id],[test]);"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "test"); QCOMPARE(tab.fields.at(0).name(), "id"); @@ -292,7 +299,7 @@ void TestTable::parseSQLKeywordInIdentifier() { std::string sSQL = "CREATE TABLE deffered(key integer primary key, if text);"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "deffered"); QCOMPARE(tab.fields.at(0).name(), "key"); @@ -306,7 +313,7 @@ void TestTable::parseSQLSomeKeywordsInIdentifier() "`Area of Work` TEXT," "`Average Number of Volunteers` INTEGER);"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "Average Number of Volunteers by Area of Work"); QCOMPARE(tab.fields.at(0).name(), "Area of Work"); @@ -317,9 +324,9 @@ void TestTable::parseSQLWithoutRowid() { std::string sSQL = "CREATE TABLE test(a integer primary key, b integer) WITHOUT ROWID;"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); - QCOMPARE(tab.primaryKey(), {"a"}); + QCOMPARE(tab.primaryKey()->columnList(), {"a"}); QCOMPARE(tab.rowidColumns(), {"a"}); } @@ -330,7 +337,7 @@ void TestTable::parseNonASCIIChars() "PRIMARY KEY(`Fieldöäüß`)" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "lösung"); QCOMPARE(tab.fields.at(0).name(), "Fieldöäüß"); @@ -343,7 +350,7 @@ void TestTable::parseNonASCIICharsEs() "PRIMARY KEY(\"Field áéíóúÁÉÍÓÚñÑçÇ\")" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "Cigüeñas de Alcalá"); QCOMPARE(tab.fields.at(0).name(), "Field áéíóúÁÉÍÓÚñÑçÇ"); @@ -353,7 +360,7 @@ void TestTable::parseSQLEscapedQuotes() { std::string sSql = "CREATE TABLE double_quotes(a text default 'a''a');"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSql))); + Table tab(*Table::parseSQL(sSql)); QCOMPARE(tab.name(), "double_quotes"); QCOMPARE(tab.fields.at(0).name(), "a"); @@ -364,7 +371,7 @@ void TestTable::parseSQLForeignKeys() { std::string sql = "CREATE TABLE foreign_key_test(a int, b int, foreign key (a) references x, foreign key (b) references w(y,z) on delete set null);"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sql))); + Table tab(*Table::parseSQL(sql)); QCOMPARE(tab.name(), "foreign_key_test"); QCOMPARE(tab.fields.at(0).name(), "a"); @@ -379,19 +386,19 @@ void TestTable::parseSQLCheckConstraint() { std::string sql = "CREATE TABLE a (\"b\" text CHECK(\"b\"='A' or \"b\"='B'));"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sql))); + Table tab(*Table::parseSQL(sql)); QCOMPARE(tab.name(), "a"); QCOMPARE(tab.fields.at(0).name(), "b"); QCOMPARE(tab.fields.at(0).type(), "text"); - QCOMPARE(tab.fields.at(0).check(), "\"b\"='A' or \"b\"='B'"); + QCOMPARE(tab.fields.at(0).check(), "\"b\" = 'A' OR \"b\" = 'B'"); } void TestTable::parseDefaultValues() { std::string sql = "CREATE TABLE test(a int DEFAULT 0, b int DEFAULT -1, c text DEFAULT 'hello', d text DEFAULT '0');"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sql))); + Table tab(*Table::parseSQL(sql)); QCOMPARE(tab.name(), "test"); QCOMPARE(tab.fields.at(0).name(), "a"); @@ -415,10 +422,10 @@ void TestTable::createTableWithIn() "value NVARCHAR(5) CHECK (value IN ('a', 'b', 'c'))" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "not_working"); - QCOMPARE(tab.fields.at(1).check(), "value IN ('a','b','c')"); + QCOMPARE(tab.fields.at(1).check(), "\"value\" IN ('a', 'b', 'c')"); } void TestTable::createTableWithNotLikeConstraint() @@ -432,15 +439,15 @@ void TestTable::createTableWithNotLikeConstraint() "value6 INTEGER CHECK(value6 NOT BETWEEN 1 AND 100)\n" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sSQL))); + Table tab(*Table::parseSQL(sSQL)); QCOMPARE(tab.name(), "hopefully_working"); - QCOMPARE(tab.fields.at(0).check(), "value NOT LIKE 'prefix%'"); - QCOMPARE(tab.fields.at(1).check(), "value2 NOT MATCH 'prefix%'"); - QCOMPARE(tab.fields.at(2).check(), "value3 NOT REGEXP 'prefix%'"); - QCOMPARE(tab.fields.at(3).check(), "value4 NOT GLOB 'prefix%'"); - QCOMPARE(tab.fields.at(4).check(), "value5 BETWEEN 1+4 AND 100 OR 200"); - QCOMPARE(tab.fields.at(5).check(), "value6 NOT BETWEEN 1 AND 100"); + QCOMPARE(tab.fields.at(0).check(), "\"value\" NOT LIKE 'prefix%'"); + QCOMPARE(tab.fields.at(1).check(), "\"value2\" NOT MATCH 'prefix%'"); + QCOMPARE(tab.fields.at(2).check(), "\"value3\" NOT REGEXP 'prefix%'"); + QCOMPARE(tab.fields.at(3).check(), "\"value4\" NOT GLOB 'prefix%'"); + QCOMPARE(tab.fields.at(4).check(), "\"value5\" BETWEEN 1 + 4 AND 100 OR 200"); + QCOMPARE(tab.fields.at(5).check(), "\"value6\" NOT BETWEEN 1 AND 100"); } void TestTable::rowValues() @@ -451,10 +458,10 @@ void TestTable::rowValues() "CHECK((a, b) = (1, 2))\n" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sql))); + Table tab(*Table::parseSQL(sql)); QCOMPARE(tab.name(), "test"); - QCOMPARE(std::dynamic_pointer_cast(tab.constraint({}, sqlb::Constraint::CheckConstraintType))->expression(), "(a,b)=(1,2)"); + QCOMPARE(std::dynamic_pointer_cast(tab.constraint({}, sqlb::Constraint::CheckConstraintType))->expression(), "(\"a\", \"b\") = (1, 2)"); } void TestTable::complexExpressions() @@ -466,13 +473,13 @@ void TestTable::complexExpressions() "d INTEGER CHECK((((d > 0))))\n" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sql))); + Table tab(*Table::parseSQL(sql)); QCOMPARE(tab.name(), "test"); - QCOMPARE(tab.fields.at(0).check(), "(a>0)"); - QCOMPARE(tab.fields.at(1).check(), "(b>0 and b>1)"); - QCOMPARE(tab.fields.at(2).check(), "(c=-1) or (c>0 and c>1) or (c=0)"); - QCOMPARE(tab.fields.at(3).check(), "(((d>0)))"); + QCOMPARE(tab.fields.at(0).check(), "(\"a\" > 0)"); + QCOMPARE(tab.fields.at(1).check(), "(\"b\" > 0 AND \"b\" > 1)"); + QCOMPARE(tab.fields.at(2).check(), "(\"c\" = -1) OR (\"c\" > 0 AND \"c\" > 1) OR (\"c\" = 0)"); + QCOMPARE(tab.fields.at(3).check(), "(((\"d\" > 0)))"); } void TestTable::datetimeExpression() @@ -481,10 +488,286 @@ void TestTable::datetimeExpression() "entry INTEGER DEFAULT (DATETIME(CURRENT_TIMESTAMP, 'LOCALTIME'))\n" ");"; - Table tab = *(std::dynamic_pointer_cast(Table::parseSQL(sql))); + Table tab(*Table::parseSQL(sql)); QCOMPARE(tab.name(), "test"); QCOMPARE(tab.fields.at(0).name(), "entry"); QCOMPARE(tab.fields.at(0).type(), "INTEGER"); - QCOMPARE(tab.fields.at(0).defaultValue(), "(DATETIME(CURRENT_TIMESTAMP,'LOCALTIME'))"); + QCOMPARE(tab.fields.at(0).defaultValue(), "(DATETIME(CURRENT_TIMESTAMP, 'LOCALTIME'))"); +} + +void TestTable::extraParentheses() +{ + std::string sql = "CREATE TABLE test(\n" + "xy INTEGER DEFAULT (1 + (5) - 4)\n" + ");"; + + Table tab(*Table::parseSQL(sql)); + QCOMPARE(tab.name(), "test"); + + QCOMPARE(tab.fields.at(0).name(), "xy"); + QCOMPARE(tab.fields.at(0).type(), "INTEGER"); + QCOMPARE(tab.fields.at(0).defaultValue(), "(1 + (5) - 4)"); +} + +void TestTable::moduloOperator() +{ + std::string sql = "CREATE TABLE test(\n" + "xy INTEGER DEFAULT (7 % 2)\n" + ");"; + + Table tab(*Table::parseSQL(sql)); + QCOMPARE(tab.name(), "test"); + + QCOMPARE(tab.fields.at(0).name(), "xy"); + QCOMPARE(tab.fields.at(0).type(), "INTEGER"); + QCOMPARE(tab.fields.at(0).defaultValue(), "(7 % 2)"); +} + +void TestTable::complexExpression() +{ + std::string sql = "CREATE TABLE test(\n" + "uuid INTEGER DEFAULT (hex(randomblob(4))||'-'||hex(randomblob(2))||'-'||'4'||substr(hex(randomblob(2)),2)||'-'||substr('AB89',1+(abs(random())%4),1)||substr(hex(randomblob(2)),2)||'-'||hex(randomblob(6))),\n" + "a INTEGER,\n" + "b INTEGER,\n" + "CHECK((a = 'S' AND b IS NOT NULL) OR (a IN ('A', 'P')))" + ");"; + + Table tab(*Table::parseSQL(sql)); + QCOMPARE(tab.name(), "test"); + + QCOMPARE(tab.fields.at(0).name(), "uuid"); + QCOMPARE(tab.fields.at(0).type(), "INTEGER"); + QCOMPARE(tab.fields.at(0).defaultValue(), "(hex(randomblob(4)) || '-' || hex(randomblob(2)) || '-' || '4' || substr(hex(randomblob(2)), 2) || '-' || substr('AB89', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(2)), 2) || '-' || hex(randomblob(6)))"); + + auto c = tab.constraints({}, sqlb::Constraint::CheckConstraintType); + QCOMPARE(c.size(), 1); + QCOMPARE(std::dynamic_pointer_cast(c.at(0))->expression(), "(\"a\" = 'S' AND \"b\" IS NOT NULL) OR (\"a\" IN ('A', 'P'))"); +} + +void TestTable::parseTest() +{ + QFETCH(std::string, sql); + + Table tab(*Table::parseSQL(sql)); + QVERIFY(tab.fullyParsed()); +} + +void TestTable::parseTest_data() +{ + // These are some rather unspecific queries but we include them here to test some basic parser features. They are + // extracted from this file: https://www.sqlite.org/cgi/src/artifact/1c602347e73ab80b + + QTest::addColumn("sql"); + + QTest::newRow("1") << std::string("CREATE TABLE t1(c1 one)"); + QTest::newRow("2") << std::string("CREATE TABLE t1(c1 one two)"); + QTest::newRow("3") << std::string("CREATE TABLE t1(c1 one two three)"); + QTest::newRow("4") << std::string("CREATE TABLE t1(c1 one two three four)"); + QTest::newRow("5") << std::string("CREATE TABLE t1(c1 one two three four(14))"); + QTest::newRow("6") << std::string("CREATE TABLE t1(c1 one two three four(14, 22))"); + QTest::newRow("7") << std::string("CREATE TABLE t1(c1 var(+14, -22.3))"); + QTest::newRow("8") << std::string("CREATE TABLE t1(c1 var(1.0e10))"); + QTest::newRow("9") << std::string("CREATE TABLE t1(c1 text PRIMARY KEY)"); + QTest::newRow("10") << std::string("CREATE TABLE t1(c1 text PRIMARY KEY ASC)"); + QTest::newRow("11") << std::string("CREATE TABLE t1(c1 text PRIMARY KEY DESC)"); + QTest::newRow("12") << std::string("CREATE TABLE t1(c1 text CONSTRAINT cons PRIMARY KEY DESC)"); + QTest::newRow("13") << std::string("CREATE TABLE t1(c1 text NOT NULL)"); + // TODO Requires named column constraint: QTest::newRow("14") << std::string("CREATE TABLE t1(c1 text CONSTRAINT nm NOT NULL)"); + QTest::newRow("15") << std::string("CREATE TABLE t1(c1 text NULL)"); + QTest::newRow("16") << std::string("CREATE TABLE t1(c1 text CONSTRAINT nm NULL)"); + QTest::newRow("17") << std::string("CREATE TABLE t1(c1 text UNIQUE)"); + // TODO Requires named column constraint: QTest::newRow("18") << std::string("CREATE TABLE t1(c1 text CONSTRAINT un UNIQUE)"); + QTest::newRow("19") << std::string("CREATE TABLE t1(c1 text CHECK(c1!=0))"); + // TODO Requires named column constraint: QTest::newRow("20") << std::string("CREATE TABLE t1(c1 text CONSTRAINT chk CHECK(c1!=0))"); + QTest::newRow("21") << std::string("CREATE TABLE t1(c1 text DEFAULT 1)"); + QTest::newRow("22") << std::string("CREATE TABLE t1(c1 text DEFAULT -1)"); + QTest::newRow("23") << std::string("CREATE TABLE t1(c1 text DEFAULT +1)"); + QTest::newRow("24") << std::string("CREATE TABLE t1(c1 text DEFAULT -45.8e22)"); + QTest::newRow("25") << std::string("CREATE TABLE t1(c1 text DEFAULT (1+1))"); + // TODO Requires named column constraint: QTest::newRow("26") << std::string("CREATE TABLE t1(c1 text CONSTRAINT \"1 2\" DEFAULT (1+1))"); + QTest::newRow("27") << std::string("CREATE TABLE t1(c1 text COLLATE nocase)"); + // TODO Requires named column constraint: QTest::newRow("28") << std::string("CREATE TABLE t1(c1 text CONSTRAINT 'a x' COLLATE nocase)"); + QTest::newRow("29") << std::string("CREATE TABLE t1(c1 REFERENCES t2)"); + QTest::newRow("30") << std::string("CREATE TABLE t1(c1 CONSTRAINT abc REFERENCES t2)"); + QTest::newRow("31") << std::string("CREATE TABLE t1(c1 PRIMARY KEY NOT NULL UNIQUE CHECK(c1 IS 'ten') DEFAULT 123 REFERENCES t1);"); + QTest::newRow("32") << std::string("CREATE TABLE t1(c1 REFERENCES t1 DEFAULT 123 CHECK(c1 IS 'ten') UNIQUE NOT NULL PRIMARY KEY);"); + QTest::newRow("33") << std::string("CREATE TABLE t1(c1, c2, PRIMARY KEY(c1))"); + QTest::newRow("34") << std::string("CREATE TABLE t1(c1, c2, PRIMARY KEY(c1, c2))"); + QTest::newRow("35") << std::string("CREATE TABLE t1(c1, c2, PRIMARY KEY(c1, c2) ON CONFLICT IGNORE)"); + QTest::newRow("36") << std::string("CREATE TABLE t1(c1, c2, UNIQUE(c1))"); + QTest::newRow("37") << std::string("CREATE TABLE t1(c1, c2, UNIQUE(c1, c2))"); + QTest::newRow("38") << std::string("CREATE TABLE t1(c1, c2, UNIQUE(c1, c2) ON CONFLICT IGNORE)"); + QTest::newRow("39") << std::string("CREATE TABLE t1(c1, c2, CHECK(c1 IS NOT c2))"); + QTest::newRow("40") << std::string("CREATE TABLE t1(c1, c2, FOREIGN KEY(c1) REFERENCES t2)"); + QTest::newRow("41") << std::string("CREATE TABLE t1(col1, col2 TEXT, col3 INTEGER UNIQUE, col4 VARCHAR(10, 10) PRIMARY KEY, \"name with spaces\" REFERENCES t1);"); + QTest::newRow("42") << std::string("CREATE TABLE t1(a, b, c)"); + QTest::newRow("43") << std::string("CREATE TEMP TABLE t1(a, b, c)"); + QTest::newRow("44") << std::string("CREATE TEMPORARY TABLE t1(a, b, c)"); + QTest::newRow("45") << std::string("CREATE TABLE IF NOT EXISTS t1(a, b, c)"); + QTest::newRow("46") << std::string("CREATE TEMP TABLE IF NOT EXISTS t1(a, b, c)"); + QTest::newRow("47") << std::string("CREATE TEMPORARY TABLE IF NOT EXISTS t1(a, b, c)"); + QTest::newRow("48") << std::string("CREATE TABLE main.t1(a, b, c)"); + QTest::newRow("49") << std::string("CREATE TEMP TABLE temp.t1(a, b, c)"); + QTest::newRow("50") << std::string("CREATE TEMPORARY TABLE temp.t1(a, b, c)"); + QTest::newRow("51") << std::string("CREATE TABLE IF NOT EXISTS main.t1(a, b, c)"); + QTest::newRow("52") << std::string("CREATE TEMP TABLE IF NOT EXISTS temp.t1(a, b, c)"); + QTest::newRow("53") << std::string("CREATE TEMPORARY TABLE IF NOT EXISTS temp.t1(a, b, c)"); + //QTest::newRow("54") << std::string("CREATE TABLE t1 AS SELECT * FROM t2"); + //QTest::newRow("55") << std::string("CREATE TEMP TABLE t1 AS SELECT c, b, a FROM t2"); + //QTest::newRow("56") << std::string("CREATE TABLE t1 AS SELECT count(*), max(b), min(a) FROM t2"); + QTest::newRow("57") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH FULL ON DELETE SET NULL ON UPDATE RESTRICT DEFERRABLE)"); + QTest::newRow("58") << std::string("CREATE TABLE t1(a REFERENCES t2(x) ON DELETE RESTRICT ON UPDATE SET NULL MATCH FULL NOT DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("59") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH PARTIAL ON DELETE SET NULL ON UPDATE CASCADE DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("60") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH PARTIAL ON DELETE RESTRICT ON UPDATE SET DEFAULT )"); + QTest::newRow("61") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH PARTIAL ON DELETE RESTRICT ON UPDATE RESTRICT DEFERRABLE)"); + QTest::newRow("62") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH PARTIAL ON DELETE NO ACTION ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("63") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH SIMPLE ON DELETE SET NULL ON UPDATE CASCADE NOT DEFERRABLE)"); + QTest::newRow("64") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE SET NULL DEFERRABLE)"); + QTest::newRow("65") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH SIMPLE ON DELETE SET DEFAULT NOT DEFERRABLE)"); + QTest::newRow("66") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY DEFERRED)"); + QTest::newRow("67") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH SIMPLE ON DELETE RESTRICT ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("68") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH SIMPLE ON DELETE NO ACTION ON UPDATE SET DEFAULT NOT DEFERRABLE)"); + QTest::newRow("69") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH STICK ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE)"); + QTest::newRow("70") << std::string("CREATE TABLE t1(a REFERENCES t2(x) MATCH STICK ON UPDATE SET NULL NOT DEFERRABLE INITIALLY DEFERRED)"); + QTest::newRow("71") << std::string("CREATE TABLE t1(a REFERENCES t2(x) ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("72") << std::string("CREATE TABLE t1(a REFERENCES t2(x) ON DELETE RESTRICT ON UPDATE NO ACTION NOT DEFERRABLE)"); + QTest::newRow("73") << std::string("CREATE TABLE t1(a REFERENCES t2(x) NOT DEFERRABLE INITIALLY DEFERRED)"); + QTest::newRow("74") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH FULL ON DELETE SET NULL ON UPDATE SET NULL DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("75") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH FULL ON DELETE SET NULL ON UPDATE SET DEFAULT NOT DEFERRABLE)"); + QTest::newRow("76") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET NULL )"); + QTest::newRow("77") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH FULL ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("78") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH PARTIAL ON DELETE SET NULL ON UPDATE RESTRICT NOT DEFERRABLE)"); + QTest::newRow("79") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH PARTIAL ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE)"); + QTest::newRow("80") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH PARTIAL ON DELETE CASCADE ON UPDATE SET DEFAULT )"); + QTest::newRow("81") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH PARTIAL NOT DEFERRABLE)"); + QTest::newRow("82") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH SIMPLE ON DELETE SET DEFAULT ON UPDATE CASCADE DEFERRABLE)"); + QTest::newRow("83") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH STICK ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("84") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH STICK ON DELETE NO ACTION ON UPDATE SET DEFAULT NOT DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("85") << std::string("CREATE TABLE t1(a REFERENCES t2 MATCH STICK ON UPDATE SET DEFAULT DEFERRABLE INITIALLY IMMEDIATE)"); + QTest::newRow("86") << std::string("CREATE TABLE t1(a REFERENCES t2 ON DELETE RESTRICT ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED)"); + QTest::newRow("87") << std::string("CREATE TABLE sqlit_abc(a, b, c)"); + QTest::newRow("88") << std::string("CREATE TABLE temp.sqlitehelloworld(x)"); + QTest::newRow("89") << std::string("CREATE TABLE auxa.\"sqlite\"(x, y)"); + QTest::newRow("90") << std::string("CREATE TABLE auxb.\"sqlite-\"(z)"); + QTest::newRow("91") << std::string("CREATE TABLE \"SQLITE-TBL\"(z)"); + QTest::newRow("92") << std::string("CREATE TABLE main.abc(a, b, c)"); + QTest::newRow("93") << std::string("CREATE TABLE temp.helloworld(x)"); + QTest::newRow("94") << std::string("CREATE TABLE auxa.\"t 1\"(x, y)"); + QTest::newRow("95") << std::string("CREATE TABLE auxb.xyz(z)"); + QTest::newRow("96") << std::string("CREATE TABLE main.abc(a, b, c)"); + QTest::newRow("97") << std::string("CREATE TABLE main.t1(a, b, c)"); + QTest::newRow("98") << std::string("CREATE TABLE temp.tmp(a, b, c)"); + QTest::newRow("99") << std::string("CREATE TABLE auxb.tbl(x, y)"); + QTest::newRow("100") << std::string("CREATE TABLE auxb.t1(k, v)"); + QTest::newRow("101") << std::string("CREATE TABLE auxa.next(c, d)"); + QTest::newRow("102") << std::string("CREATE TEMP TABLE t1(a, b)"); + QTest::newRow("103") << std::string("CREATE TEMPORARY TABLE t2(a, b)"); + QTest::newRow("104") << std::string("CREATE TEMP TABLE temp.t1(a, b)"); + QTest::newRow("105") << std::string("CREATE TEMPORARY TABLE temp.t2(a, b)"); + QTest::newRow("106") << std::string("CREATE TEMP TABLE TEMP.t3(a, b)"); + QTest::newRow("107") << std::string("CREATE TEMPORARY TABLE TEMP.xxx(x)"); + QTest::newRow("108") << std::string("CREATE TABLE t1(a, b)"); + QTest::newRow("109") << std::string("CREATE TABLE t2(a, b)"); + QTest::newRow("110") << std::string("CREATE TABLE t3(a, b)"); + QTest::newRow("111") << std::string("CREATE TABLE xxx(x)"); + QTest::newRow("112") << std::string("CREATE TABLE auxa.t1(a, b)"); + QTest::newRow("113") << std::string("CREATE TABLE auxa.i1(a, b)"); + QTest::newRow("114") << std::string("CREATE TABLE auxa.v1(a, b)"); + QTest::newRow("115") << std::string("CREATE TABLE tbl1(a, b)"); + QTest::newRow("116") << std::string("CREATE TABLE idx1(a, b)"); + QTest::newRow("117") << std::string("CREATE TABLE view1(a, b)"); + QTest::newRow("118") << std::string("CREATE TABLE IF NOT EXISTS t1(a, b)"); + QTest::newRow("119") << std::string("CREATE TABLE IF NOT EXISTS auxa.tbl1(a, b)"); + QTest::newRow("120") << std::string("CREATE TABLE IF NOT EXISTS v1(a, b)"); + QTest::newRow("121") << std::string("CREATE TABLE IF NOT EXISTS auxa.view1(a, b)"); + QTest::newRow("122") << std::string("CREATE TABLE t1(a, b, c);"); + QTest::newRow("123") << std::string("CREATE TABLE t2(d, e, f);"); + QTest::newRow("124") << std::string("CREATE TABLE t3(g BIGINT, h VARCHAR(10));"); + QTest::newRow("125") << std::string("CREATE TABLE t4(i BLOB, j ANYOLDATA);"); + QTest::newRow("126") << std::string("CREATE TABLE t5(k FLOAT, l INTEGER);"); + QTest::newRow("127") << std::string("CREATE TABLE t6(m DEFAULT 10, n DEFAULT 5, PRIMARY KEY(m, n));"); + QTest::newRow("128") << std::string("CREATE TABLE t7(x INTEGER PRIMARY KEY);"); + QTest::newRow("129") << std::string("CREATE TABLE t8(o COLLATE nocase DEFAULT 'abc');"); + QTest::newRow("130") << std::string("CREATE TABLE t9(p NOT NULL, q DOUBLE CHECK (q!=0), r STRING UNIQUE);"); + QTest::newRow("131") << std::string("CREATE TABLE t1(x VARCHAR(10), y INTEGER, z DOUBLE);"); + QTest::newRow("132") << std::string("CREATE TABLE t2(a DATETIME, b STRING, c REAL);"); + QTest::newRow("133") << std::string("CREATE TABLE t3(o, t);"); + QTest::newRow("134") << std::string("CREATE TABLE t4(a DEFAULT NULL,b DEFAULT 'string constant',c DEFAULT X'424C4F42',d DEFAULT 1,e DEFAULT -1,f DEFAULT 3.14,g DEFAULT -3.14,h DEFAULT ( substr('abcd', 0, 2) || 'cd' ),i DEFAULT CURRENT_TIME,j DEFAULT CURRENT_DATE,k DEFAULT CURRENT_TIMESTAMP);"); + QTest::newRow("135") << std::string("CREATE TABLE t5(x DEFAULT ( 'abc' ))"); + QTest::newRow("136") << std::string("CREATE TABLE t5(x DEFAULT ( 1 IN (1, 2, 3) ))"); + QTest::newRow("137") << std::string("CREATE TABLE t5(a DEFAULT NULL, b DEFAULT 'text value', c DEFAULT X'424C4F42',d DEFAULT -45678.6,e DEFAULT 394507);"); + QTest::newRow("138") << std::string("CREATE TABLE t6(a DEFAULT ( nextint() ), b DEFAULT ( nextint() ));"); + QTest::newRow("139") << std::string("CREATE TABLE t7(a DEFAULT CURRENT_TIME, b DEFAULT CURRENT_DATE, c DEFAULT CURRENT_TIMESTAMP);"); + QTest::newRow("140") << std::string("CREATE TABLE t8(a COLLATE nocase, b COLLATE rtrim, c COLLATE binary, d);"); + QTest::newRow("141") << std::string("CREATE TABLE t1(a, b, c)"); + QTest::newRow("142") << std::string("CREATE TABLE t2(a PRIMARY KEY, b, c)"); + QTest::newRow("143") << std::string("CREATE TABLE t3(a, b, c, PRIMARY KEY(a))"); + QTest::newRow("144") << std::string("CREATE TABLE t4(a, b, c, PRIMARY KEY(c,b,a))"); + QTest::newRow("145") << std::string("CREATE TABLE t5(a, b INTEGER PRIMARY KEY, c)"); + QTest::newRow("146") << std::string("CREATE TABLE t5(a PRIMARY KEY, b, c)"); + QTest::newRow("147") << std::string("CREATE TABLE t5(a, b, c, PRIMARY KEY(a))"); + QTest::newRow("148") << std::string("CREATE TABLE t5(a, b, c, PRIMARY KEY(c,b,a))"); + QTest::newRow("149") << std::string("CREATE TABLE t5(a, b INTEGER PRIMARY KEY, c)"); + QTest::newRow("150") << std::string("CREATE TABLE t1(a UNIQUE, b UNIQUE)"); + QTest::newRow("151") << std::string("CREATE TABLE t2(a UNIQUE, b, c, UNIQUE(c, b))"); + QTest::newRow("152") << std::string("CREATE TABLE t3(a, b, c, UNIQUE(a), UNIQUE(b), UNIQUE(c))"); + QTest::newRow("153") << std::string("CREATE TABLE t4(a, b, c, UNIQUE(a, b, c))"); + QTest::newRow("154") << std::string("CREATE TABLE t1(a TEXT PRIMARY KEY, b)"); + QTest::newRow("155") << std::string("CREATE TABLE t1(a INTEGER PRIMARY KEY, b)"); + QTest::newRow("156") << std::string("CREATE TABLE t1(a TEXT UNIQUE, b)"); + QTest::newRow("157") << std::string("CREATE TABLE t1(a PRIMARY KEY, b TEXT UNIQUE)"); + QTest::newRow("158") << std::string("CREATE TABLE t1(a PRIMARY KEY, b, c, UNIQUE(c, b))"); + QTest::newRow("159") << std::string("CREATE TABLE t1(a, b PRIMARY KEY);"); + QTest::newRow("160") << std::string("CREATE TABLE t2(a, b, c, UNIQUE(b, c));"); + QTest::newRow("161") << std::string("CREATE TABLE x1(a TEXT, b INTEGER CHECK( b>0 ));"); + QTest::newRow("162") << std::string("CREATE TABLE t1(a TEXT, b INTEGER, CHECK( b>0 ));"); + QTest::newRow("163") << std::string("CREATE TABLE x2(a CHECK( a||b ), b);"); + QTest::newRow("164") << std::string("CREATE TABLE t2(a, b, CHECK( a||b ));"); + QTest::newRow("165") << std::string("CREATE TABLE t1(a NOT NULL, b)"); + QTest::newRow("166") << std::string("CREATE TABLE t2(a PRIMARY KEY NOT NULL, b)"); + QTest::newRow("167") << std::string("CREATE TABLE t3(a NOT NULL, b NOT NULL, c NOT NULL UNIQUE)"); + // TODO Requires NOT NULL table constraints: QTest::newRow("168") << std::string("CREATE TABLE t4(a, b, NOT NULL(a))"); + // TODO Requires NOT NULL table constraints: QTest::newRow("169") << std::string("CREATE TABLE t4(a PRIMARY KEY, b, NOT NULL(a))"); + // TODO Requires NOT NULL table constraints: QTest::newRow("170") << std::string("CREATE TABLE t4(a, b, c UNIQUE, NOT NULL(a, b, c))"); + QTest::newRow("171") << std::string("CREATE TABLE t1_ab(a PRIMARY KEY ON CONFLICT ABORT, b);"); + QTest::newRow("172") << std::string("CREATE TABLE t1_ro(a PRIMARY KEY ON CONFLICT ROLLBACK, b);"); + QTest::newRow("173") << std::string("CREATE TABLE t1_ig(a PRIMARY KEY ON CONFLICT IGNORE, b);"); + QTest::newRow("174") << std::string("CREATE TABLE t1_fa(a PRIMARY KEY ON CONFLICT FAIL, b);"); + QTest::newRow("175") << std::string("CREATE TABLE t1_re(a PRIMARY KEY ON CONFLICT REPLACE, b);"); + QTest::newRow("176") << std::string("CREATE TABLE t1_xx(a PRIMARY KEY, b);"); + // TODO Requires NOT NULL conflict actions: QTest::newRow("177") << std::string("CREATE TABLE t2_ab(a, b NOT NULL ON CONFLICT ABORT);"); + // TODO Requires NOT NULL conflict actions: QTest::newRow("178") << std::string("CREATE TABLE t2_ro(a, b NOT NULL ON CONFLICT ROLLBACK);"); + // TODO Requires NOT NULL conflict actions: QTest::newRow("179") << std::string("CREATE TABLE t2_ig(a, b NOT NULL ON CONFLICT IGNORE);"); + // TODO Requires NOT NULL conflict actions: QTest::newRow("180") << std::string("CREATE TABLE t2_fa(a, b NOT NULL ON CONFLICT FAIL);"); + // TODO Requires NOT NULL conflict actions: QTest::newRow("181") << std::string("CREATE TABLE t2_re(a, b NOT NULL ON CONFLICT REPLACE);"); + QTest::newRow("182") << std::string("CREATE TABLE t2_xx(a, b NOT NULL);"); + QTest::newRow("183") << std::string("CREATE TABLE t3_ab(a, b, UNIQUE(a, b) ON CONFLICT ABORT);"); + QTest::newRow("184") << std::string("CREATE TABLE t3_ro(a, b, UNIQUE(a, b) ON CONFLICT ROLLBACK);"); + QTest::newRow("185") << std::string("CREATE TABLE t3_ig(a, b, UNIQUE(a, b) ON CONFLICT IGNORE);"); + QTest::newRow("186") << std::string("CREATE TABLE t3_fa(a, b, UNIQUE(a, b) ON CONFLICT FAIL);"); + QTest::newRow("187") << std::string("CREATE TABLE t3_re(a, b, UNIQUE(a, b) ON CONFLICT REPLACE);"); + QTest::newRow("188") << std::string("CREATE TABLE t3_xx(a, b, UNIQUE(a, b));"); + QTest::newRow("189") << std::string("CREATE TABLE t4(a, b CHECK (b!=10));"); + QTest::newRow("190") << std::string("CREATE TABLE t2(oid, b);"); + QTest::newRow("191") << std::string("CREATE TABLE t3(a, _rowid_);"); + QTest::newRow("192") << std::string("CREATE TABLE t4(a, b, rowid);"); + QTest::newRow("193") << std::string("CREATE TABLE t5(pk integer primary key)"); + QTest::newRow("194") << std::string("CREATE TABLE t5(pk integer, primary key(pk))"); + QTest::newRow("195") << std::string("CREATE TABLE t5(pk integer, v integer, primary key(pk))"); + QTest::newRow("196") << std::string("CREATE TABLE t5(pk integer, v integer, primary key(pk, v))"); + QTest::newRow("197") << std::string("CREATE TABLE t5(pk int, v integer, primary key(pk, v))"); + QTest::newRow("198") << std::string("CREATE TABLE t5(pk int, v integer, primary key(pk))"); + QTest::newRow("199") << std::string("CREATE TABLE t5(pk int primary key, v integer)"); + QTest::newRow("200") << std::string("CREATE TABLE t5(pk inTEger primary key)"); + QTest::newRow("201") << std::string("CREATE TABLE t5(pk inteGEr, primary key(pk))"); + QTest::newRow("202") << std::string("CREATE TABLE t5(pk INTEGER, v integer, primary key(pk))"); + QTest::newRow("203") << std::string("CREATE TABLE t6(pk INT primary key);"); + QTest::newRow("204") << std::string("CREATE TABLE t7(pk BIGINT primary key);"); + QTest::newRow("205") << std::string("CREATE TABLE t8(pk SHORT INTEGER primary key);"); + QTest::newRow("206") << std::string("CREATE TABLE t9(pk UNSIGNED INTEGER primary key);"); + QTest::newRow("207") << std::string("CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z)"); + QTest::newRow("208") << std::string("CREATE TABLE t(x INTEGER, y, z, PRIMARY KEY(x ASC))"); + QTest::newRow("209") << std::string("CREATE TABLE t(x INTEGER, y, z, PRIMARY KEY(x DESC))"); + QTest::newRow("210") << std::string("CREATE TABLE t(x INTEGER PRIMARY KEY DESC, y, z)"); } diff --git a/src/tests/testsqlobjects.h b/src/tests/testsqlobjects.h index 352f52d3..ed6a12fe 100644 --- a/src/tests/testsqlobjects.h +++ b/src/tests/testsqlobjects.h @@ -36,6 +36,12 @@ private slots: void rowValues(); void complexExpressions(); void datetimeExpression(); + void extraParentheses(); + void moduloOperator(); + void complexExpression(); + + void parseTest(); + void parseTest_data(); }; #endif diff --git a/src/translations/sqlb_pl.ts b/src/translations/sqlb_pl.ts index b97098ee..6bdf77e6 100644 --- a/src/translations/sqlb_pl.ts +++ b/src/translations/sqlb_pl.ts @@ -6,7 +6,7 @@ About DB Browser for SQLite - O Przeglądarce baz danych dla SQLite + O Przeglądarce SQLite @@ -16,12 +16,12 @@ <html><head/><body><p>DB Browser for SQLite is an open source, freeware visual tool used to create, design and edit SQLite database files.</p><p>It is bi-licensed under the Mozilla Public License Version 2, as well as the GNU General Public License Version 3 or later. You can modify or redistribute it under the conditions of these licenses.</p><p>See <a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a> and <a href="https://www.mozilla.org/MPL/2.0/index.txt">https://www.mozilla.org/MPL/2.0/index.txt</a> for details.</p><p>For more information on this program please visit our website at: <a href="http://sqlitebrowser.org">http://sqlitebrowser.org</a></p><p><span style=" font-size:small;">This software uses the GPL/LGPL Qt Toolkit from </span><a href="http://qt-project.org/"><span style=" font-size:small;">http://qt-project.org/</span></a><span style=" font-size:small;"><br/>See </span><a href="http://qt-project.org/doc/qt-5/licensing.html"><span style=" font-size:small;">http://qt-project.org/doc/qt-5/licensing.html</span></a><span style=" font-size:small;"> for licensing terms and information.</span></p><p><span style=" font-size:small;">It also uses the Silk icon set by Mark James licensed under a Creative Commons Attribution 2.5 and 3.0 license.<br/>See </span><a href="http://www.famfamfam.com/lab/icons/silk/"><span style=" font-size:small;">http://www.famfamfam.com/lab/icons/silk/</span></a><span style=" font-size:small;"> for details.</span></p></body></html> - <html><head/><body><p>Preglądarka Bazy Danych dla SQLite jest darmowym otwartym oprogramowaniem przeznaczonym do wizualnej edycji i kreacji plików bazy danych SQLite.</p><p>Program podlega podwójnej licencji użytkowania: Publiczna licencja Mozilli Wersja 2 jak również Powszechna Licencja Publiczna GNU wersja 3 i poźniejsza. Możesz modyfikować i rozpowszechniać program pod warunkami zawartymi w tych licencjach.</p><p>Zobacz <a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a> i <a href="https://www.mozilla.org/MPL/2.0/index.txt">https://www.mozilla.org/MPL/2.0/index.txt</a> dla szczegołów.</p><p>Odwiedź naszą stronę internetową aby zapoznać się z informacją na temat diałania tego programu: <a href="http://sqlitebrowser.org">http://sqlitebrowser.org</a></p><p><span style=" font-size:small;">To oprogramowanie używa GPL/LGPL Qt Toolkit z: </span><a href="http://qt-project.org/"><span style=" font-size:small;">http://qt-project.org/</span></a><span style=" font-size:small;"><br/>Zobacz </span><a href="http://qt-project.org/doc/qt-5/licensing.html"><span style=" font-size:small;">http://qt-project.org/doc/qt-5/licensing.html</span></a><span style=" font-size:small;"> na temat licancji i użytkowania.</span></p><p><span style=" font-size:small;">Używany również jest zestaw ikon Silk stworzony przez Mark James pod licencjią Creative Commons Attribution 2.5 i 3.0.<br/>Zobacz </span><a href="http://www.famfamfam.com/lab/icons/silk/"><span style=" font-size:small;">http://www.famfamfam.com/lab/icons/silk/</span></a><span style=" font-size:small;"> dla dalszej informacji.</span></p></body></html> + <html><head/><body><p>Przeglądarka SQLite jest darmowym otwartym oprogramowaniem przeznaczonym do graficznej edycji i tworzenia plików bazy danych SQLite.</p><p>Program podlega podwójnej licencji użytkowania: Publiczna licencja Mozilli Wersja 2 jak również Powszechna Licencja Publiczna GNU wersja 3 i późniejsza. Możesz zmieniać i rozpowszechniać program pod warunkami zawartymi w tych licencjach.</p><p>Zobacz <a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a> i <a href="https://www.mozilla.org/MPL/2.0/index.txt">https://www.mozilla.org/MPL/2.0/index.txt</a> dla szczegółów.</p><p>Odwiedź naszą stronę internetową aby zapoznać się ze szczegółami na temat działania tego programu: <a href="http://sqlitebrowser.org">http://sqlitebrowser.org</a></p><p><span style=" font-size:small;">To oprogramowanie używa GPL/LGPL Qt Toolkit z: </span><a href="http://qt-project.org/"><span style=" font-size:small;">http://qt-project.org/</span></a><span style=" font-size:small;"><br/>Zobacz </span><a href="http://qt-project.org/doc/qt-5/licensing.html"><span style=" font-size:small;">http://qt-project.org/doc/qt-5/licensing.html</span></a><span style=" font-size:small;"> na temat licencji i użytkowania.</span></p><p><span style=" font-size:small;">Używany również jest zestaw ikon Silk stworzony przez Mark James pod licencją Creative Commons Attribution 2.5 i 3.0.<br/>Zobacz </span><a href="http://www.famfamfam.com/lab/icons/silk/"><span style=" font-size:small;">http://www.famfamfam.com/lab/icons/silk/</span></a><span style=" font-size:small;"> po więcej szczegółów.</span></p></body></html> (based on SQLite %1) - + (oparte na SQLite %1) @@ -31,7 +31,7 @@ Built for - + Zbudowane dla @@ -84,7 +84,7 @@ Values to insert. Pre-filled default values are inserted automatically unless they are changed. - Wartości do wstawienia. Pola wypełnione są automatycznie domyślnymi wartościami wtedy tylko gdy te wartości nie są ręcznie zmienione. + Wartości do wstawienia. Uprzednio wypełnione domyślne wartości są wstawiane samoczynnie, chyba że zostały zmienione. @@ -94,26 +94,26 @@ <html><head/><body><p><span style=" font-weight:600;">Save</span> will submit the shown SQL statement to the database for inserting the new record.</p><p><span style=" font-weight:600;">Restore Defaults</span> will restore the initial values in the <span style=" font-weight:600;">Value</span> column.</p><p><span style=" font-weight:600;">Cancel</span> will close this dialog without executing the query.</p></body></html> - <html><head/><body><p><span style=" font-weight:600;">Zapisz</span> przekarze wyświetlone zapytanie SQL do bazy danych w celu zapisania nowego rekordu</p><p><span style=" font-weight:600;">Przywróć domyślne</span> przywróci wstępne wartości domyślne w kolumnie<span style=" font-weight:600;">Wartość</span></p><p><span style=" font-weight:600;">Anuluj</span> zamyka to okno bez robienia zmian.</p></body></html> + <html><head/><body><p><span style=" font-weight:600;">Zapisz</span> przekaże wyświetlone zapytanie SQL do bazy danych w celu zapisania nowego rekordu</p><p><span style=" font-weight:600;">Przywróć domyślne</span> przywróci wstępne wartości domyślne w kolumnie<span style=" font-weight:600;">Wartość</span></p><p><span style=" font-weight:600;">Zaniechaj</span> zamyka to okno bez robienia zmian.</p></body></html> Auto-increment - + Samoprzyrost Unique constraint - Unikat + Ograniczenie niepowtarzalności Check constraint: %1 - Weryfikator: %1 + Ograniczenie sprawdzania: %1 @@ -135,8 +135,7 @@ Error adding record. Message from database engine: %1 - Wystąpił błąd podczas dodawania rekordu. Baza danych podała następujący komunikat: - + Nie można dodać rekordu. Wiadomość z silnika bazy danych: %1 @@ -157,7 +156,7 @@ Possible command line arguments: - Dozwolone agrumenty wiersza poleceń: + Dozwolone argumenty wiersza poleceń: @@ -187,12 +186,12 @@ -o, --option [group/setting=value] Run application with this setting temporarily set to value - + -o, --option [grupa/ustawienia=wartość] Uruchamia aplikacje z ustawieniem tymczasowo równym wartości -O, --save-option [group/setting=value] Run application saving this value for this setting - + -O, --save-option [grupa/ustawienie=wartość] Uruchamia aplikacje wraz z zapisaniem dla ustawieniem wartości @@ -207,7 +206,7 @@ This is DB Browser for SQLite version %1. - Oto Przeglądarka baz danych dla SQLite w wersji %1. + Oto Przeglądarka SQLite w wersji %1. @@ -227,7 +226,7 @@ The -o/--option and -O/--save-option options require an argument in the form group/setting=value - + Ustawienia -o/--option oraz -O/--save-option wymagają argumentu w postaci group/setting=wartość @@ -255,22 +254,22 @@ Encr&yption settings - + Ustawienia sz&yfrowania SQLCipher &3 defaults - + Domyślne SQLCipher &3 SQLCipher &4 defaults - + Domyślne SQLCipher &4 Custo&m - + Włas&ny @@ -280,17 +279,17 @@ &KDF iterations - + Powtórzenia &KDF HMAC algorithm - + Algorytm HMAC KDF algorithm - + Algorytm KDF @@ -426,19 +425,21 @@ Jeśli zostały zmienione jakiekolwiek dodatkowe ustawienia dla pliku tej bazy d Custom display format must contain a function call applied to %1 - + Własny format wyświetlania musi zawierać wywołanie funkcji zastosowanej na %1 Error in custom display format. Message from database engine: %1 - + Błąd we własnym formacie wyświetlania. Wiadomość z silnika bazy danych: + +%1 Custom display format must return only one column but it returned %1. - + Własny format wyświetlania musi zwracać tylko jedną kolumnę, a zwrócił %1. @@ -446,42 +447,42 @@ Jeśli zostały zmienione jakiekolwiek dodatkowe ustawienia dla pliku tej bazy d Conditional Format Manager - + Zarządzanie formatowaniem warunkowym &Up - &W górę + W &górę &Down - W &dół + W &dół &Add - Dod&aj + Dod&aj &Remove - &Usuń + &Usuń Text color - Kolor tekstu + Barwa tekstu Background color - Kolor tła + Barwa tła Condition - + Warunek @@ -489,7 +490,7 @@ Jeśli zostały zmienione jakiekolwiek dodatkowe ustawienia dla pliku tej bazy d This database has already been attached. Its schema name is '%1'. - Baza danych została już załączona. Nazwa jej schematu to '%1'. + Baza danych została już dołączona. Nazwa jej schematu to '%1'. @@ -514,7 +515,7 @@ Jeśli zostały zmienione jakiekolwiek dodatkowe ustawienia dla pliku tej bazy d Database didn't close correctly, probably still busy - + Baza danych nie została zamknięta poprawnie, prawdopodobnie była nadal zajęta @@ -535,7 +536,7 @@ Jeśli zostały zmienione jakiekolwiek dodatkowe ustawienia dla pliku tej bazy d Cancel - Anuluj + Zaniechaj @@ -551,7 +552,7 @@ Jeśli zostały zmienione jakiekolwiek dodatkowe ustawienia dla pliku tej bazy d Action cancelled. - Anulowano akcję. + Zaniechano działania. @@ -570,12 +571,12 @@ Przerywam wykonywanie%3. didn't receive any output from %1 - + nie otrzymano żadnego wyniku z %1 could not execute command: %1 - + nie można wykonać polecenia: %1 @@ -596,46 +597,48 @@ Przerywam wykonywanie%3. No table with name '%1' exists in schema '%2'. - + Tabela o nazwie '%1' nie istnieje w schemacie '%2'. Cannot find column %1. - + Nie można znaleźć kolumny %1. Creating savepoint failed. DB says: %1 - + Nie można utworzyć punktu zapisu. BD zwraca: %1 Renaming the column failed. DB says: %1 - + Nie można przemianować tej kolumny. BD zwraca: +%1 Releasing savepoint failed. DB says: %1 - + Nie można zwolnić punktu zapisu. BD zwraca: %1 Creating new table failed. DB says: %1 - + Nie można utworzyć nowej tabeli. BD zwraca: %1 Copying data to new table failed. DB says: %1 - + Nie można skopiować nowej tabeli. BD zwraca: +%1 Deleting old table failed. DB says: %1 - + Nie można usunąć starej tabeli. BD zwraca: %1 renameColumn: cannot find column %1. @@ -670,7 +673,7 @@ Przerywam wykonywanie%3. renameColumn: releasing savepoint failed. DB says: %1 - renameColumn(zmiana nazwy kolumny): Wystąpił błąd podczas odłączenia punktu zapisu. Baza danych podała następujący komunikat: %1 + zmiana nazwy kolumny: Nie można zwolnić punktu zapisu. BD zwraca: %1 @@ -715,7 +718,7 @@ Przerywam wykonywanie%3. Error loading extension: %1 - Wystąpił błąd przy ładownaniu rozszerzenia: %1 + Nie można wczytać rozszerzenia: %1 @@ -738,12 +741,12 @@ Przerywam wykonywanie%3. Type - Typ + Rodzaj Schema - Schemat + Polecenie tworzące @@ -778,12 +781,12 @@ Przerywam wykonywanie%3. Views (%1) - Wyświetlenia (%1) + Widoki (%1) Triggers (%1) - Uruchomienia (%1) + Wyzwalacze (%1) @@ -791,7 +794,7 @@ Przerywam wykonywanie%3. Edit database cell - Edytuj komórkę bazy danych + Zmiana komórki bazy danych @@ -811,7 +814,7 @@ Przerywam wykonywanie%3. Binary - Wartość binarna + Dwójkowa @@ -833,64 +836,67 @@ Przerywam wykonywanie%3. Automatically adjust the editor mode to the loaded data type - Automatycznie dostosuj tryb edytora w zależności od załadowanych danych + Sam dostosuj tryb edytora w zależności od wczytanych danych This checkable button enables or disables the automatic switching of the editor mode. When a new cell is selected or new data is imported and the automatic switching is enabled, the mode adjusts to the detected data type. You can then change the editor mode manually. If you want to keep this manually switched mode while moving through the cells, switch the button off. - + To pole zaznaczane włącza lub wyłącza samoczynne przełączanie do trybu edytora. Po wybraniu nowej komórki lub zaimportowaniu nowych danych i przy włączonym samoczynnym przełączaniu, tryb dostosowuje się do wykrytego rodzaju danych. Następnie można zmienić tryb edytora ręcznie. Aby zapamiętać ten try ręczny przy przechodzeniu po komórkach, wystarczy odznaczyć to pole. Auto-switch - Automatyczny przełącznik + Sam przełączaj The text editor modes let you edit plain text, as well as JSON or XML data with syntax highlighting, automatic formatting and validation before saving. Errors are indicated with a red squiggle underline. - + Tryby edytora tekstu umożliwiają edycję zwykłego tekstu, a także danych JSON oraz XML +z podświetlaniem składni, samoformatowaniem oraz sprawdzaniem przed zapisem. + +Błędy są podkreślane czerwonym ślaczkiem. Open preview dialog for printing the data currently stored in the cell - + Otwiera okno dialogowe do podglądu drukowanych danych z danej komórki Auto-format: pretty print on loading, compact on saving. - Auto-formatowanie: upiększa tekst przy ładowaniu i kompaktuje przy zapisywaniu. + Auto-formatowanie: upiększa tekst przy wczytywaniu i ściska przy zapisywaniu. When enabled, the auto-format feature formats the data on loading, breaking the text in lines and indenting it for maximum readability. On data saving, the auto-format feature compacts the data removing end of lines, and unnecessary whitespace. - + Po zaznaczeniu, dane są formatowane podczas ich wczytywania, łamiąc tekst w wierszach oraz wcinając go dla najlepszej czytelności. Przed zapisaniem, dane są oczyszczane poprzez usunięcie zakończeń wierszy oraz niepotrzebnych białych znaków. Word Wrap - + Zawijaj słowa Wrap lines on word boundaries - + Zawijaj wiersze na granicach słów Autoformat - Automatyczne formatowanie + Sam formatuj &Export... - + &Eksportuj... &Import... - + &Importuj... @@ -984,7 +990,7 @@ Errors are indicated with a red squiggle underline. Open preview dialog for printing displayed text - + Otwiera okno dialogowe do podglądu wyświetlanego tekstu @@ -994,7 +1000,7 @@ Errors are indicated with a red squiggle underline. Copy selected hexadecimal and ASCII columns to the clipboard - + Skopiuj zaznaczone kolumny szesnastkowe oraz ASCII do schowka @@ -1014,7 +1020,7 @@ Errors are indicated with a red squiggle underline. Binary data can't be viewed in this mode. - Wartość binarna nie może być wyświetlona w tym trybie. + Wartość dwójkowa nie może być wyświetlona w tym trybie. @@ -1118,7 +1124,7 @@ Errors are indicated with a red squiggle underline. The cell contains invalid %1 data. Reason: %2. Do you really want to apply it to the cell? - + Komórka zawiera nieprawidłowe dane %1. Powód: %2. Czy na pewno wstawić je do komórki? @@ -1170,7 +1176,7 @@ Errors are indicated with a red squiggle underline. Type of data currently in cell: Binary - Rodzaj danych obecnie znajdujących się w komórce: Wartość binarna + Rodzaj danych obecnie znajdujących się w komórce: dwójkowa @@ -1178,7 +1184,7 @@ Errors are indicated with a red squiggle underline. Edit Index Schema - Edytuj Schemat Indeksu + Edytor tworzenia indeksu @@ -1193,17 +1199,18 @@ Errors are indicated with a red squiggle underline. &Unique - &Unikalny + &Niepowtarzalny For restricting the index to only a part of the table you can specify a WHERE clause here that selects the part of the table that should be indexed - + Aby ograniczyć indeks tylko do części tabeli można dopisać tutaj polecenie WHERE, które +zaznacza część tabeli, która ma zostać zaindeksowana Partial inde&x clause - + Polecenie częściowego &indeksu @@ -1223,7 +1230,7 @@ Errors are indicated with a red squiggle underline. Add a new expression column to the index. Expression columns contain SQL expression rather than column names. - + Dodaj nową kolumnę wyrażenia do indeksu. Kolumny wyrażeń zawierają raczej wyrażenia SQL niż nazwy kolumn. @@ -1255,7 +1262,7 @@ Errors are indicated with a red squiggle underline. Edit table definition - Edytuj definicję tabeli + Edycja tworzenia tabeli @@ -1270,17 +1277,17 @@ Errors are indicated with a red squiggle underline. Database schema - Schemat bazy danych + Struktura danych Without Rowid - Bez ID rzędu + Bez ID wiersza Make this a 'WITHOUT rowid' table. Setting this flag requires a field of type INTEGER with the primary key flag set and the auto increment flag unset. - + Uczyń z tej tabeli tablę 'WITHOUT rowid'. Ustawienie tej flagi wymaga pola rodzaju INTEGER z flagą klucza głównego ustawioną i flagą samoprzyrostu wyłączoną. @@ -1325,7 +1332,7 @@ Errors are indicated with a red squiggle underline. Not null - Nie pusty + Nie NULL @@ -1335,7 +1342,7 @@ Errors are indicated with a red squiggle underline. Primary key - + Klucz główny @@ -1345,7 +1352,7 @@ Errors are indicated with a red squiggle underline. Autoincrement - + Samoprzyrostowa @@ -1355,12 +1362,12 @@ Errors are indicated with a red squiggle underline. Unique - Unikatowy + Niepowtarzalna Default - Domyślny + Domyślna @@ -1370,84 +1377,89 @@ Errors are indicated with a red squiggle underline. Check - Sprawdź + Sprawdzenie Check constraint - + Ograniczenie sprawdzenia Foreign Key - + Obcy klucz <html><head/><body><p><span style=" font-weight:600; color:#ff0000;">Warning: </span>There is something with this table definition that our parser doesn't fully understand. Modifying and saving this table might result in problems.</p></body></html> - + <html><head/><body><p><span style=" font-weight:600; color:#ff0000;">Uwaga: </span>W określeniu tabeli jest coś, czego nasze przetwarzanie składni nie rozumie. Zmiana i zapis tej tabeli może skutkować kłopotami.</p></body></html> Error creating table. Message from database engine: %1 - + Nie można utworzyć tabeli. Wiadomość z silnika bazy danych: +%1 There already is a field with that name. Please rename it first or choose a different name for this field. - + Istnieje już pole o tej nazwie. Przemianuj je najpierw lub wybierz inną nazwę dla tego pola. This column is referenced in a foreign key in table %1 and thus its name cannot be changed. - + Kolumna ma odwołanie do klucza obcego w tabeli %1 więc jej nazwa nie można zmienić jej nazwy. There is at least one row with this field set to NULL. This makes it impossible to set this flag. Please change the table data first. - + W tym polu istnieje co najmniej jeden wiersz z wartością równą NULL. Czyni to niemożliwym ustawienie tej flagi. Najpierw zmień dane tabeli. There is at least one row with a non-integer value in this field. This makes it impossible to set the AI flag. Please change the table data first. - + W tym polu istnieje co najmniej jeden wiersz z wartością nie będącą liczbą całkowitą. Czyni to niemożliwym ustawienie flagi AI. Najpierw zmień dane tabeli. Column '%1' has duplicate data. - + Kolumna '%1' zawiera powielone dane. + This makes it impossible to enable the 'Unique' flag. Please remove the duplicate data, which will allow the 'Unique' flag to then be enabled. - + Czyni to niemożliwym nadanie flagi 'Unique'. Usuń powielone dane, aby móc nadać flagę 'Unique'. Column '%1' has no unique data. - Kolumna '%1' nie zawiera unikatowych danych. + Kolumna '%1' nie zawiera niepowtarzalnych danych. Modifying this column failed. Error returned from database: %1 - Modyfikowanie kolumny nie powiodło się. Otrzymany błąd: + Nie można zmienić tej kolumny. Błąd zwrócony przez bazę danych: %1 Are you sure you want to delete the field '%1'? All data currently stored in this field will be lost. - + Czy na pewno usunąć pole '%1'? +Wszystkie dane przechowywane w tym polu zostaną utracone. Please add a field which meets the following criteria before setting the without rowid flag: - Primary key flag set - Auto increment disabled - + Dodaj pola, które spełniają dane warunki przed ustawieniem flagi bez rowid: + - Ustawiono flagę głównego klucza + - Wyłączono samoprzyrost Changing the table schema failed. Error message: @@ -1678,7 +1690,7 @@ All data currently stored in this field will be lost. Export cancelled or failed. - Eksportowanie nie powiodło się lub zostało anulowane. + Eksportowanie nie udało się lub zostało zaniechane. @@ -1711,57 +1723,57 @@ All data currently stored in this field will be lost. Use as Exact Filter - + Użyj jako dokładnego filtra Containing - + Zawiera Not containing - + Nie zawiera Not equal to - + Nierówny Greater than - + Większy niż Less than - + Mniejszy niż Greater or equal - + Większy lub równy Less or equal - + Mniejszy lub równy Between this and... - + Pomiędzy tym a... Regular expression - + Wyrażenie regularne Edit Conditional Formats... - + Zmień format warunków... @@ -1776,12 +1788,12 @@ All data currently stored in this field will be lost. Copy with Headers - + Skopiuj wraz z nagłówkami Copy as SQL - + Skopiuj jako SQL @@ -1791,17 +1803,18 @@ All data currently stored in this field will be lost. Print... - Drukuj... + Drukuj... Use in Filter Expression - + Użyj w wyrażeniu filtra <p>Not all data has been loaded. <b>Do you want to load all data before selecting all the rows?</b><p><p>Answering <b>No</b> means that no more data will be loaded and the selection will not be performed.<br/>Answering <b>Yes</b> might take some time while the data is loaded but the selection will be complete.</p>Warning: Loading all the data might require a great amount of memory for big tables. - + <p>Nie wczytano wszystkich danych. <b>Czu chcesz wczytać wszystkie dane przez zaznaczeniem wszystkich wierszy?</b><p><p>Odpowiedź <b>Nie</b> oznacza, że nie +zostanie wczytanych więcej danych i nie zostanie nic zaznaczone.<br/>Odpowiedź <b>Tak</b> oznacza, że trochę czasu może być potrzebne na wczytanie danych za to zaznaczenie będzie pełne.</p>Uwaga: Wczytanie wszystkich danych może wymagać dużej ilości pamięci dla dużych tabel. Use as Filter @@ -1820,13 +1833,14 @@ All data currently stored in this field will be lost. Ctrl+Alt+C - + Ctrl+Alt+C The content of the clipboard is bigger than the range selected. Do you want to insert it anyway? - + Zawartość schowka jest większa niż zaznaczony zakres. +Czy chcesz go wstawić mimo tego? @@ -1838,7 +1852,7 @@ Do you want to insert it anyway? File Extension Manager - Menadżer Rozszerzeń Plików + Zarządzanie Rozszerzeniami Plików @@ -1874,7 +1888,7 @@ Do you want to insert it anyway? *.extension - *.extension + *.rozszerzenie @@ -1898,97 +1912,108 @@ The following operators are also supported: <> Unequal: exact inverse match x~y Range: values between x and y /regexp/ Values matching the regular expression - + Te pola wejściowe umożliwiają szybkie filtrowanie na bieżącej tabeli. +Domyślnie, wiersze zawierające tekst wejściowy są odfiltrowywane. +Obsługiwane są następujące operatory: +% Znak wieloznaczny +> Większe niż +< Mniejsze niż +>= Równe lub większe +<= Równe lub mniejsze += Równe: dokładnie pasuje +<> Nierówne: nie pasuje +x~y Zakres: wartości pomiędzy x oraz y +/regexp/ Wartości pasujące do wyrażenia regularnego Clear All Conditional Formats - + Wyczyść wszystkie formatowania warunkowe Use for Conditional Format - + Użyj do formatowania warunkowego Edit Conditional Formats... - + Edytuj formatowanie warunkowe... Set Filter Expression - + Ustaw wyrażenia filtra What's This? - + Co to jest? Is NULL - + Jest NULL Is not NULL - + Nie jest NULL Is empty - + Jest puste Is not empty - + Nie jest puste Not containing... - + Nie zawiera... Equal to... - + Równe... Not equal to... - + Nierówne... Greater than... - + Większe niż... Less than... - + Mniejsze niż... Greater or equal... - + Większe lub równe... Less or equal... - + Mniejsze lub równe... In range... - + W zakresie... Regular expression... - + Wyrażenie regularne... @@ -2011,27 +2036,27 @@ x~y Range: values between x and y Match &exact case - + Rozróżniaj wielkość lit&er Match &only whole words - + Tylk&o całe wyrazy When enabled, the search continues from the other end when it reaches one end of the page - + Po zaznaczeniu, wyszukiwanie jest wznawiane od przeciwległego końca strony po osiągnięciu końca strony. &Wrap around - + Za&wijaj When set, the search goes backwards from cursor position, otherwise it goes forward - + Po zaznaczeniu, wyszukiwanie postępuje wstecz od położenia wskaźnika, w przeciwnym przypadku postępuje wprzód @@ -2041,27 +2066,28 @@ x~y Range: values between x and y <html><head/><body><p>When checked, the pattern to find is searched only in the current selection.</p></body></html> - + <html><head/><body><p>Po zaznaczeniu, wzorzec do znalezienia jest szukany tylko w bieżącym zaznaczeniu.</p></body></html> &Selection only - + Tylko &zaznaczenie <html><head/><body><p>When checked, the pattern to find is interpreted as a UNIX regular expression. See <a href="https://en.wikibooks.org/wiki/Regular_Expressions">Regular Expression in Wikibooks</a>.</p></body></html> - + <html><head/><body><p>Po zaznaczeniu, wzorzec do znalezienia jest rozważany jako wyrażenie regularne UNIX. Zajrzyj do <a href="https://en.wikibooks.org/wiki/Regular_Expressions">Wyrażeń Regularnych w Wikibooks</a>.</p></body></html> Use regular e&xpressions - + Stosuj wyrażenie &regularne Find the next occurrence from the cursor position and in the direction set by "Search backwards" - + Szukaj kolejnego wystąpienia od położenia wskaźnika i w stronę określoną poprzez +"Wyszukiwanie wstecz" @@ -2134,7 +2160,7 @@ x~y Range: values between x and y Foreign key clauses (ON UPDATE, ON DELETE etc.) - + Polecenia obcego klucza (ON UPDATE, ON DELETE itp.) @@ -2240,7 +2266,7 @@ x~y Range: values between x and y When importing an empty value from the CSV file into an existing table with a default value for this column, that default value is inserted. Activate this option to insert an empty value instead. - + Przy importowaniu pustej wartości z pliku CSV do istniejącej tabeli z domyślną wartością dla tej kolumny, wstawiana jest ta domyślna wartość. Aby zamiast tego wstawić pustą wartość, wystarczy zaznaczyć to pole. @@ -2250,12 +2276,12 @@ x~y Range: values between x and y Activate this option to stop the import when trying to import an empty value into a NOT NULL column without a default value. - + Zaznacz to pole, aby zatrzymać importowanie, podczas importowania pustej wartości do kolumny NOT NULL bez domyślnej wartości. Fail on missing values - + Zgłaszaj błąd dla brakujących wartości @@ -2265,32 +2291,32 @@ x~y Range: values between x and y Disable the automatic data type detection when creating a new table. - Wyłącz automatyczne wykrywanie rodzaju danych przy tworzeniu nowej tabeli. + Wyłącz samowykrywanie rodzaju danych przy tworzeniu nowej tabeli. When importing into an existing table with a primary key, unique constraints or a unique index there is a chance for a conflict. This option allows you to select a strategy for that case: By default the import is aborted and rolled back but you can also choose to ignore and not import conflicting rows or to replace the existing row in the table. - + Przy importowaniu do istniejącej tabeli o głównym kluczu, ograniczeniu lub indeksie niepowtarzalności istnieje szansa na sprzeczność. To ustawienie umożliwia wybranie strategii dla tego przypadku. Domyślnie importowanie jest przerywane, a zmiany wycofywane, lecz można także pominąć wiersze będące w sprzeczności lub zastąpić istniejący wiersz w tabeli. Abort import - + Przerwij importowanie Ignore row - + Pomiń wiersz Replace existing row - + Zastąp istniejący wiersz Conflict strategy - + Strategia na sprzeczności @@ -2301,7 +2327,7 @@ x~y Range: values between x and y Match Similar - + Dopasuj do podobnych @@ -2326,7 +2352,7 @@ x~y Range: values between x and y Creating restore point failed: %1 - + Nie można utworzyć punktu przywracania: %1 @@ -2346,7 +2372,7 @@ x~y Range: values between x and y Importing the file '%1' took %2ms. Of this %3ms were spent in the row function. - + Importowanie pliku '%1' zajęło %2ms. Z tego %3ms spędzono na funkcji wiersza. @@ -2354,19 +2380,19 @@ x~y Range: values between x and y DB Browser for SQLite - Przeglądarka baz danych dla SQLite + Przeglądarka SQLite Database Structure This has to be equal to the tab title in all the main tabs - Struktura bazy danych + Struktura danych <html><head/><body><p>This button creates a new record in the database. Hold the mouse button to open a pop-up menu of different options:</p><ul><li><span style=" font-weight:600;">New Record</span>: insert a new record with default values in the database.</li><li><span style=" font-weight:600;">Insert Values...</span>: open a dialog for entering values before they are inserted in the database. This allows to enter values acomplishing the different constraints. This dialog is also open if the <span style=" font-weight:600;">New Record</span> option fails due to these constraints.</li></ul></body></html> - + <html><head/><body><p>Ten przycisk tworzy nowy rekord w bazie danych. Przyciśnij przycisk myszy, aby otworzyć menu podręczne z różnymi ustawieniami:</p><ul><li><span style=" font-weight:600;">Nowy rekord</span>: wstawia nowy rekord o domyślnych wartościach do bazy danych.</li><li><span style=" font-weight:600;">Wstaw wartości...</span>: otwiera okno dialogowe do wpisywania wartości przed ich wstawieniem do bazy danych. Umożliwia to wpisanie wartości przy zachowaniu różnych ograniczeń. To okno dialogowe jest także otwarte, gdy nie powiedzie się wykonanie polecenia <span style=" font-weight:600;">Nowy rekord</span> ze względu na te ograniczenia .</li></ul></body></html> @@ -2377,12 +2403,18 @@ x~y Range: values between x and y - Ctrl+" for duplicating the current record. - Ctrl+' for copying the value from the cell above. - Standard selection and copy/paste operations. - + Oto widok tabeli bazy danych. Możliwe są następujące działania: + - Pisanie do przeedytowania wartości w-wierszu. + - Dwukrotne kliknięcie na rekordzie, aby edytować jego zawartość w edytorze komórek. + - Alt+Del do usunięcia treści komórki i ustawienia NULL. + - Ctrl+" do powielenia bieżącego rekordu. + - Ctrl+' do skopiowania wartości z komórki powyżej. + - Standardowe zaznaczanie/kopiowanie/wklejanie. Warning: this pragma is not readable and this value has been inferred. Writing the pragma might overwrite a redefined LIKE provided by an SQLite extension. - + Uwaga: to polecenie pragma nie jest czytelne, więc ta wartość powstała z domysłu. Zapisanie polecenie pragma może zastąpić LIKE dostarczony przez rozszerzenie SQLite. @@ -2394,14 +2426,15 @@ x~y Range: values between x and y This is the structure of the opened database. You can drag SQL statements from an object row and drop them into other applications or into another instance of 'DB Browser for SQLite'. - + Oto struktura bieżącej bazy danych. +Można przeciągać polecenia SQL z wiersza obiektu i upuszczać je na innych aplikacjach lub wstawiać je do innego wystąpienia 'Przeglądarki SQLite'. Browse Data This has to be equal to the tab title in all the main tabs - Przeglądaj dane + Przeglądarka danych @@ -2421,7 +2454,7 @@ You can drag SQL statements from an object row and drop them into other applicat Execute line - + Wykonaj wiersz @@ -2436,47 +2469,47 @@ You can drag SQL statements from an object row and drop them into other applicat Un/comment block of SQL code - + Dodaj/Usuń uwagę do kawałka kodu SQL Un/comment block - + Dodaj/Usuń uwagę do kawałka kodu Comment or uncomment current line or selected block of code - + Dodaj lub usuń uwagę do bieżącego wiersza lub zaznaczonego kawałka kodu Comment or uncomment the selected lines or the current line, when there is no selection. All the block is toggled according to the first line. - + Dodaj lub usuń uwagę do bieżącego wiersza lub zaznaczonych wierszy, gdy jest coś zaznaczone. Cały kawałek przełączany jest wg pierwszego wiersza. Ctrl+/ - + Ctrl+/ Stop SQL execution - + Zatrzymaj wykonywanie SQL Stop execution - + Zatrzymaj wykonywanie Stop the currently running SQL script - + Zatrzymaj wykonywanie bieżącego skryptu SQL Clear Filters - + Wyczyść filtry @@ -2487,12 +2520,12 @@ You can drag SQL statements from an object row and drop them into other applicat This button clears all the filters set in the header input fields for the currently browsed table. - + Ten przycisk wyczyści wszystkie filtry ustawione na polach wejściowych nagłówka dla bieżącej tabeli. Save Table As... - + Zapisz tabelę jako... @@ -2503,7 +2536,7 @@ You can drag SQL statements from an object row and drop them into other applicat <html><head/><body><p>This popup menu provides the following options applying to the currently browsed and filtered table:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Export to CSV: this option exports the data of the browsed table as currently displayed (after filters, display formats and order column) to a CSV file.</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Save as view: this option saves the current setting of the browsed table (filters, display formats and order column) as an SQL view that you can later browse or use in SQL statements.</li></ul></body></html> - + <html><head/><body><p>To menu podręczne zawiera następujące ustawienie stosujące się do obecnie oglądanej i filtrowanej tabeli:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Eksportuj do CSV: eksportuje dane oglądanej tabeli tak jak jest obecnie wyświetlana (po filtrach, z formatami wyświetlania i kolejnością kolumn) do pliku CSV.</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Zapisz jako widok: zapisuje bieżące ustawienia oglądanej tabeli (filtry, formaty wyświetlania i kolejność kolumn) jako widok SQL, który można później przeglądać lub wstawić do polecenia SQL.</li></ul></body></html> ... @@ -2619,7 +2652,7 @@ You can drag SQL statements from an object row and drop them into other applicat <html><head/><body><p>This button is used to navigate to the record number specified in the Go to area.</p></body></html> - + <html><head/><body><p>Ten przycisk służy to przejścia do rekordu o podanej numerze w obszarze Przejścia.</p></body></html> @@ -2634,7 +2667,7 @@ You can drag SQL statements from an object row and drop them into other applicat Type a record number in this area and click the Go to: button to display the record in the database view - + Wpisz numer rekordu w tym obszarze i naciśnij na Przejdź Do, aby wyświetlić rekord w widoku bazy danych @@ -2646,7 +2679,7 @@ You can drag SQL statements from an object row and drop them into other applicat Edit Pragmas This has to be equal to the tab title in all the main tabs - + Polecenia Pragmy None @@ -2677,7 +2710,7 @@ You can drag SQL statements from an object row and drop them into other applicat Execute SQL This has to be equal to the tab title in all the main tabs - Wykonaj SQL + Polecenia SQL @@ -2697,7 +2730,7 @@ You can drag SQL statements from an object row and drop them into other applicat &Edit - &Edytuj + &Edycja @@ -2712,7 +2745,7 @@ You can drag SQL statements from an object row and drop them into other applicat &Tools - + &Narzędzia @@ -2722,7 +2755,7 @@ You can drag SQL statements from an object row and drop them into other applicat Edit Database &Cell - Edytuj &komórkę bazy danych + Zmiana komórki bazy dany&ch @@ -2732,7 +2765,7 @@ You can drag SQL statements from an object row and drop them into other applicat Show S&QL submitted by - + Pokaż S&QL wydane przez @@ -2747,7 +2780,7 @@ You can drag SQL statements from an object row and drop them into other applicat Error Log - + Dziennik błędów @@ -2762,22 +2795,22 @@ You can drag SQL statements from an object row and drop them into other applicat This panel lets you examine a log of all SQL commands issued by the application or by yourself - + Ten panel umożliwia przegląd dziennika wszystkich poleceń SQL wydanych przez aplikację lub przez ciebie &Plot - + &Wykres DB Sche&ma - Sche&mat bazy danych + Struktura da&nych &Remote - + &Odległe BD @@ -2863,7 +2896,7 @@ You can drag SQL statements from an object row and drop them into other applicat &Revert Changes - Odw&róć zmiany + &Wycofaj zmiany @@ -2874,7 +2907,7 @@ You can drag SQL statements from an object row and drop them into other applicat This option is used to revert the current database file to its last saved state. All changes made since the last save operation are lost. - + Ten działanie służy do przywrócenia bieżącej bazy danych do ostatnio zapisanego stanu. Wszystkie zmiany od czasu ostatniego zapisu zostaną utracone. @@ -2900,31 +2933,31 @@ You can drag SQL statements from an object row and drop them into other applicat &Save Project As... - + Zapi&sz projekt jako... Save the project in a file selected in a dialog - + Zapisuje projekt w pliku wskazanym w dialogu Save A&ll - + Zapisz w&szystko Save DB file, project file and opened SQL files - + Zapisuje plik bazy danych, projektu i otwarte pliki SQL Ctrl+Shift+S - + Ctrl+Shift+S @@ -2932,33 +2965,35 @@ You can drag SQL statements from an object row and drop them into other applicat You can drag multiple object names from the Name column and drop them into the SQL editor and you can adjust the properties of the dropped names using the context menu. This would help you in composing SQL statements. You can drag SQL statements from the Schema column and drop them into the SQL editor or into other applications. - + Oto struktura bieżącej bazy danych. +Można przeciągać wiele nazw obiektów z kolumny nazwy i upuszczać je w edytorze SQL. Następnie można dostosować właściwości upuszczonych nazw poprzez menu podręczne. To ma na celu pomoc w tworzeniu polecenia SQL. +Można przeciągać polecenia SQL z kolumny schematu i upuszczać je w edytorze SQL lub innych aplikacjach. Print currently browsed table data - + Drukuj dane bieżącej tabeli Print currently browsed table data. Print selection if more than one cell is selected. - + Drukuj dane bieżącej tabeli. Drukuj zaznaczenie, jeśli zaznaczono więcej niż jedną komórkę. Compact &Database... - + Ściśnij bazę &danych... Compact the database file, removing space wasted by deleted records - + Ściśnij plik bazę danych, usuwając przestrzenie marnowane przez usunięte rekordy Compact the database file, removing space wasted by deleted records. - + Ściśnij plik bazę danych, usuwając przestrzenie marnowane przez usunięte rekordy. @@ -2978,12 +3013,12 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Import data from an .sql dump text file into a new or existing database. - + Importuj dane z pliku tekstowego zrzutu .sql do nowej lub istniejącej bazy danych. This option lets you import data from an .sql dump text file into a new or existing database. SQL dump files can be created on most database engines, including MySQL and PostgreSQL. - + To działanie, umożliwia importowanie danych z pliku tekstowego zrzutu .sql do nowej lub istniejącej bazy danych. Pliki zrzutu SQL można utworzyć w większości silników baz danych, włączając w to MySQL oraz PostgreSQL. @@ -2993,27 +3028,28 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Open a wizard that lets you import data from a comma separated text file into a database table. - + Otwiera okno pomocnika do importowania danych z pliku CSV do tabeli bazy danych. Open a wizard that lets you import data from a comma separated text file into a database table. CSV files can be created on most database and spreadsheet applications. - + Otwiera okno pomocnika do importowania danych z pliku CSV do tabeli bazy danych. +Plik CSV można stworzyć na podstawie większości baz danych i aplikacji arkuszy kalkulacyjnych. &Database to SQL file... - Baza &danych fo pliku SQL… + Baza &danych do pliku SQL… Export a database to a .sql dump text file. - + Eksportuj bazę danych do pliku tekstowego zrzutu .sql This option lets you export a database to a .sql dump text file. SQL dump files contain all data necessary to recreate the database on most database engines, including MySQL and PostgreSQL. - + To działanie umożliwia eksportowanie bazy danych do pliku tekstowego zrzutu .sql. Plik zrzutu SQL zawiera wszystkie dane niezbędne do odtworzenia bazy danych na większości silników baz danych, włączając w to MySQL oraz PostgreSQL. @@ -3054,17 +3090,18 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Open the Delete Table wizard, where you can select a database table to be dropped. - + Otwiera pomocnika do Usunięcia Tabeli, gdzie można wybrać tabelę bazy danych do usunięcia. &Modify Table... - &Modyfikuj tabelę… + Z&mień tabelę… Open the Modify Table wizard, where it is possible to rename an existing table. It is also possible to add or delete fields form a table, as well as modify field names and types. - + Otwiera pomocnika do Zmiany Tabeli, gdzie można przemianować istniejącą tabelą. +Można także dodawać i usuwać pola z tabli, a także zmieniać nazwy oraz rodzaje pól. @@ -3074,18 +3111,18 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Open the Create Index wizard, where it is possible to define a new index on an existing database table. - + Otwiera pomocnika do Tworzenia Indeksu, gdzie można określić nowy indeks na istniejącej tabeli bazy danych. &Preferences... - &Preferencje… + &Ustawienia... Open the preferences window. - Otwiera okno preferencji. + Otwórz okno ustawień. @@ -3115,183 +3152,183 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed &About - + O progr&amie &Load Extension... - + &Wczytaj rozszerzenia... &Wiki - + &Wiki Bug &Report... - + &Zgłoszenie błędu... Feature Re&quest... - + Zgłoszenie ż&yczenia... Web&site - + Strona &sieciowa &Donate on Patreon... - + &Darowizna na Patreon... Open &Project... - + Otwórz &projekt... &Attach Database... - + Dołącz bazę d&anych... &Set Encryption... - + U&staw szyfrowanie... This button saves the content of the current SQL editor tab to a file - + Ten przycisk zapisuje treść bieżącej karty edytora SQL do pliku SQLCipher &FAQ - + &Najczęściej zadawane pytania SQLCipher Insert Values... - + Wstaw wartości... Open a dialog for inserting values in a new record - + Otwiera okno dialogowe do wstawiania wartości do nowego rekordu Insert new record using default values in browsed table - + Wstaw nowy rekord przy użyciu domyślnych wartości bieżącej tabeli New In-&Memory Database - + Nowa baza danych w-pa&mięci Drag && Drop Qualified Names - + Przeciągnij && upuść nazwy ze struktury Use qualified names (e.g. "Table"."Field") when dragging the objects and dropping them into the editor - + Używaj nazw ze struktury (np. "Tabela"."Pole") przy przeciąganiu obiektów i upuszczaniu ich w edytorze Drag && Drop Enquoted Names - + Przeciągnij && upuść nazw w cudzysłowach Use escaped identifiers (e.g. "Table1") when dragging the objects and dropping them into the editor - + Używaj nazw w cudzysłowach (np. "Tabela1") przy przeciąganiu obiektów i upuszczaniu ich w edytorze &Integrity Check - + Sprawdzanie spójnośc&i Runs the integrity_check pragma over the opened database and returns the results in the Execute SQL tab. This pragma does an integrity check of the entire database. - + Wykonuje polecenie pragma integrity_check na bieżącej bazie danych i zwraca wynik na karcie Wykonywania SQL. To polecenie pragma wykonuje sprawdzenie spójności całej bazy danych. &Foreign-Key Check - + &Sprawdzenie obcego klucza Runs the foreign_key_check pragma over the opened database and returns the results in the Execute SQL tab - + Wykonuje polecenie pragma foreign_key_check na bieżącej bazie danych i zwraca wynik na karcie Wykonywania SQL &Quick Integrity Check - + &Szybkie sprawdzenie spójności Run a quick integrity check over the open DB - + Wykonaj sprawdzenie spójności bieżącej bazy danych Runs the quick_check pragma over the opened database and returns the results in the Execute SQL tab. This command does most of the checking of PRAGMA integrity_check but runs much faster. - + Wykonuje polecenie pragma quick_check na bieżącej bazie danych i zwraca wynik na karcie Wykonywania SQL. To polecenie pragma wykonuje większość tego, co wykonuje polecenie pragma integrity_check lecz robi to znacznie szybciej. &Optimize - + &Optymalizacja Attempt to optimize the database - + Próba optymalizacji bazy danych Runs the optimize pragma over the opened database. This pragma might perform optimizations that will improve the performance of future queries. - + Wykonuje polecenie pragma optimize na bieżącej bazie danych. To polecenie może wykonać optymalizacje, które zwiększą wydajność przyszłych zapytań. Print - + Drukuj Print text from current SQL editor tab - + Drukuj tekst z bieżącej karty edytora SQL Open a dialog for printing the text in the current SQL editor tab - + Otwiera okno dialogowe do drukowania tekstu w bieżącej karcie edytora SQL Print the structure of the opened database - + Drukuj strukturę bieżącej bazy danych Open a dialog for printing the structure of the opened database - + Otwiera okno dialogowe do drukowania struktury bieżącej bazy danych &About... @@ -3325,7 +3362,7 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed This button executes the currently selected SQL statements. If no text is selected, all SQL statements are executed. - + Ten przycisk wykona obecnie zaznaczone polecenia SQL. Jeśli nie zaznaczone tekstu, to zostaną wykonane wszystkie polecenia SQL. @@ -3335,7 +3372,7 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed This button opens a file containing SQL statements and loads it in a new editor tab - + Ten przycisk otwiera plik zawierający polecenia SQL i wczytuje je do nowej karty edytora @@ -3346,13 +3383,13 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed &Load extension - &Załaduj rozszerzenie + &Wczytaj rozszerzenie Execute current line - Wykonaj obecny wiersz + Wykonaj bieżący wiersz @@ -3400,7 +3437,7 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed This button lets you save all the settings associated to the open DB to a DB4S project file - + Ten przycisk umożliwia zapisanie wszystkich ustawień potrzebnych do otwarcia BD do pliku projektu DB4S Open &Project @@ -3410,12 +3447,12 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Load a working session from a file - + Wczytaj otoczenie pracy z pliku This button lets you open a DB4S project file - + Ten przycisk umożliwia otwarcie pliku projektu DB4S &Attach Database @@ -3425,12 +3462,12 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Add another database file to the current database connection - + Dodaj kolejny plik bazy danych do połączenia bieżącej bazy danych This button lets you add another database file to the current database connection - + Ten przycisk umożliwia dodanie kolejnego pliku bazy danych do połączenia bieżącej bazy danych &Set Encryption @@ -3450,12 +3487,12 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Copy Create statement - + Skopiuj polecenie tworzące Copy the CREATE statement of the item to the clipboard - + Skopiuj polecenie CREATE elementu do schowka @@ -3465,17 +3502,17 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Edit the display format of the data in this column - + Zmień sposób wyświetlania danych w tej kolumnie Show rowid column - + Pokaż kolumnę ID wiersza Toggle the visibility of the rowid column - + Pokaż/Ukryj kolumnę ID wiersza @@ -3486,17 +3523,17 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Change the encoding of the text in the table cells - + Zmień kodowanie tekstu w komórkach tabeli Set encoding for all tables - + Ustaw kodowanie dla wszystkich tabel Change the default encoding assumed for all tables in the database - + Zmień domyślne kodowanie przyjęte dla wszystkich table w bazie danych SQLCipher &FAQ... @@ -3540,12 +3577,12 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Unlock view editing - + Umożliw zmianę widoku This unlocks the current view for editing. However, you will need appropriate triggers for editing. - + To umożliwia wprowadzanie zmian w bieżącym widoku. Jednakże potrzebne będą odpowiednie wyzwalacze do zmiany. @@ -3555,12 +3592,12 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Save the results view - + Zapisuje widok wyniku This button lets you save the results of the last executed query - + Ten przycisk umożliwia zapisanie wyników ostatnio wykonanego zapytania @@ -3571,12 +3608,12 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Find - + Znajdź This button opens the search bar of the editor - + Ten przycisk otwiera pasek wyszukiwania edytora @@ -3592,17 +3629,17 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Find or replace - + Znajdź i zastąp This button opens the find/replace dialog for the current editor tab - + Ten przycisk otwiera okno dialogowe znajdowania/zastępowania dla bieżącej karty edytora Ctrl+H - Ctrl+H + Ctrl+H @@ -3660,18 +3697,18 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed This button exports the data of the browsed table as currently displayed (after filters, display formats and order column) as a CSV file. - + Ten przycisk wyeksportuje dane bieżącej tabeli tak jak są obecnie wyświetlane (po filtrach, z formatami wyświetlania i kolejnością kolumn) jako plik CSV. Save the current filter, sort column and display formats as a view - + Zapisuje bieżący filtr, kolumnę do szeregowania oraz formaty wyświetlania jako widok This button saves the current setting of the browsed table (filters, display formats and order column) as an SQL view that you can later browse or use in SQL statements. - + Ten przycisk zapisuje bieżące ustawienia oglądanej tabeli (filtry, formaty wyświetlania i kolejność kolumn) jako widok SQL, który można później przeglądać lub wstawić do polecenia SQL. @@ -3708,22 +3745,22 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Reset Window Layout - + Wyzeruj układ okien Alt+0 - + Alt+0 The database is currenctly busy. - + Baza danych jest obecnie zajęta. Click here to interrupt the currently running query. - + Naciśnij tutaj, aby przerwać wykonywanie bieżącego zapytania. @@ -3825,7 +3862,9 @@ Wszystkie dane powiązane z %1 zostaną utracone. Setting PRAGMA values or vacuuming will commit your current transaction. Are you sure? - + Ustawianie wartości PRAGMA lub odkurzanie spowoduje wdrożenie twoich zmian +z bieżącej transakcji. +Czy na pewno? Execution aborted by user @@ -3834,115 +3873,122 @@ Are you sure? In-Memory database - + Baza danych w-pamięci You are still executing SQL statements. When closing the database now the execution will be stopped. maybe leaving the database in an incosistent state. Are you sure you want to close the database? - + Nadal wykonujesz polecenia SQL. Wykonywanie tych poleceń zostanie zatrzymane, po zamknięciu bazy danych, co może spowodować w niej niespójności. Czy na pewno zamknąć tę bazę danych? Are you sure you want to delete the table '%1'? All data associated with the table will be lost. - + Czy na pewno usunąć tabelę '%1'? +Wszystkie dane skojarzone z tą tabelą zostaną utracone. Are you sure you want to delete the view '%1'? - + Czy na pewno usunąć widok '%1'? Are you sure you want to delete the trigger '%1'? - + Czy na pewno usunąć wyzwalacz '%1'? + Are you sure you want to delete the index '%1'? - + Czy na pewno usunąć indeks '%1'? Error: could not delete the table. - + Błąd: nie można usunąć bazy danych. Error: could not delete the view. - + Błąd: nie można usunąć widoku. Error: could not delete the trigger. - + Błąd: nie można usunąć wyzwalacza. Error: could not delete the index. - + Błąd: nie można usunąć indeksu. Message from database engine: %1 - + Wiadomość z silnika bazy danych: +%1 Editing the table requires to save all pending changes now. Are you sure you want to save the database? - + Zmiana tabeli wymaga zapisania wszystkich oczekujących zmian. +Czy na pewno zapisać bazę danych? Error checking foreign keys after table modification. The changes will be reverted. - + Błąd sprawdzania kluczy obcych po zmianie tabeli. Zmiany zostaną wycofane. This table did not pass a foreign-key check.<br/>You should run 'Tools | Foreign-Key Check' and fix the reported issues. - + Tabela nie przeszła sprawdzenia klucza obcego.<br/>Należy wykonać 'Narzędzia | Sprawdzenie obcego klucza' i naprawić zgłoszone kłopoty. You are already executing SQL statements. Do you want to stop them in order to execute the current statements instead? Note that this might leave the database in an inconsistent state. - + Już wykonujesz polecenia SQL. Czy zatrzymać je, aby wykonać bieżące polecenia? Działanie to może spowodować niespójność w bazie danych. -- EXECUTING SELECTION IN '%1' -- - + -- WYKONYWANIE ZAZNACZENIA W '%1' +-- -- EXECUTING LINE IN '%1' -- - + -- WYKONYWANIE WIERSZA W '%1' +-- -- EXECUTING ALL IN '%1' -- - + -- WYKONYWANIE WSZYSTKIEGO W '%1' +-- At line %1: - + W wierszu %1: Result: %2 - + Wynik: %2 %1 rows returned in %2ms - + Zwrócono %1 wierszy w %2ms @@ -3959,12 +4005,14 @@ Are you sure you want to save the database? Error while saving the database file. This means that not all changes to the database were saved. You need to resolve the following error first. %1 - + Nie można zapisać bazy danych. Oznacza to, że nie wszystkie zmiany dało się zapisać w bazie danych. Najpierw trzeba pozbyć się następujących kłopotów. + +%1 Are you sure you want to undo all changes made to the database file '%1' since the last save? - + Czy na pewno wycofać wszystkie zmiany poczynione na pliku bazy danych '%1' od czasu ostatniego zapisu? @@ -3982,7 +4030,8 @@ Are you sure you want to save the database? Do you want to create a new database file to hold the imported data? If you answer no we will attempt to import the data in the SQL file to the current database. - + Czy utworzyć plik nowej bazy danych do przechowania zaimportowanych danych? +Jeśli nie, to dane zostaną zaimportowane do pliku bieżącej bazy danych. @@ -3997,7 +4046,7 @@ If you answer no we will attempt to import the data in the SQL file to the curre Import completed. Some foreign key constraints are violated. Please fix them before saving. - + Ukończono import. Nastąpiło przekroczenie niektórych z ograniczeń obcego klucza. Napraw je przed zapisaniem. @@ -4012,17 +4061,17 @@ If you answer no we will attempt to import the data in the SQL file to the curre Modify View - Modyfikuj widok + Zmień widok Delete Trigger - + Usuń wyzwalacz Modify Trigger - + Zmień wyzwalacz @@ -4032,12 +4081,12 @@ If you answer no we will attempt to import the data in the SQL file to the curre Modify Index - Modyfikuj indeks + Zmień indeks Modify Table - Modyfikuj tabelę + Zmień tabelę @@ -4048,7 +4097,9 @@ If you answer no we will attempt to import the data in the SQL file to the curre Setting PRAGMA values will commit your current transaction. Are you sure? - + Ustawianie wartości PRAGMA spowoduje wdrożenie twoich zmian +z bieżącej transakcji. +Czy na pewno? @@ -4082,52 +4133,52 @@ Are you sure? Execution finished with errors. - + Wykonywanie zakończyło z błędami. Execution finished without errors. - + Wykonywanie zakończyło bez błędów. Do you want to save the changes made to SQL tabs in a new project file? - + Czy chcesz zapisać zmiany poczynione w tabelach SQL do nowego pliku projektu? Do you want to save the changes made to SQL tabs in the project file %1? - + Czy chcesz zapisać zmiany poczynione w tabelach SQL do pliku projektu %1? Do you want to save the changes made to the SQL file %1? - + Czy chcesz zapisać zmiany poczynione w SQL do pliku %1? The statements in this tab are still executing. Closing the tab will stop the execution. This might leave the database in an inconsistent state. Are you sure you want to close the tab? - + Polecenia w tej karcie nadal są wykonywane. Wykonywanie tych poleceń zostanie zatrzymane, po zamknięciu karty, co może spowodować niespójności w bazie danych. Czy na pewno zamknąć tę kartę? Extensions(*.so *.dylib *.dll);;All files(*) - + Rozszerzenia(*.so *.dylib *.dll);;Wszystkie pliki(*) Extension successfully loaded. - Pomyślnie załadowano rozszerzenie. + Pomyślnie wczytano rozszerzenie. Error loading extension: %1 - Błąd ładowania rozszerzenia: %1 + Nie można wczytać rozszerzenia: %1 Could not open find resource file: %1 - + Nie można znaleźć pliku zasobów: %1 @@ -4143,7 +4194,7 @@ Are you sure? A new DB Browser for SQLite version is available (%1.%2.%3).<br/><br/>Please download at <a href='%4'>%4</a>. - + Dostępna jest nowa wersja Przeglądarki SQLite (%1.%2.%3).<br/><br/>Pobierz z <a href='%4'>%4</a>. @@ -4154,28 +4205,29 @@ Are you sure? DB Browser for SQLite project file (*.sqbpro) - Plik projektu Przeglądarki baz danych SQLite (*.sqbpro) + Plik projektu Przeglądarki SQLite (*.sqbpro) This project file is using an old file format because it was created using DB Browser for SQLite version 3.10 or lower. Loading this file format is still fully supported but we advice you to convert all your project files to the new file format because support for older formats might be dropped at some point in the future. You can convert your files by simply opening and re-saving them. - + Ten plik projektu używa starego formatu pliku, bo został stworzony przy użyciu Przeglądarki SQLite w wersji 3.10 lub niższej. Wczytywanie tego formatu pliku jest nadal w pełni obsługiwane, lecz zalecamy przekształcenie wszystkich plików projektu na nowy format pliku, bo obsługa starych formatów może zniknąć w przyszłości. Aby przekształcić plik, wystarczy go otworzyć i zapisać. Could not open project file for writing. Reason: %1 - + Nie można otworzyć pliku projektu do zapisu. +Powód: %1 Duplicate records - + Powielone rekordy Duplicate record - + Powielony rekord @@ -4196,7 +4248,8 @@ Reason: %1 %1 Leave the field empty for using the database encoding. - + %1 +Pozostaw pole pustym, aby użyć kodowania bazy danych. @@ -4206,29 +4259,31 @@ Leave the field empty for using the database encoding. Please enter a pseudo-primary key in order to enable editing on this view. This should be the name of a unique column in the view. - + Podaj pseudo-główny klucz, aby rozpocząć edytowanie w tym widoku. Powinna to być nazwa niepowtarzalnej kolumny w widoku. Collation needed! Proceed? - + Potrzebne zestawianie! Postąpić naprzód? A table in this database requires a special collation function '%1' that this application can't provide without further knowledge. If you choose to proceed, be aware bad things can happen to your database. Create a backup! - + Tabela w tej bazie danych wymaga wyjątkowej funkcji zestawienia '%1' której ta aplikacja nie może dostarczyć bez dalszej wiedzy. +Pójścia z tym dalej, może spowodować uszkodzenia w bazie danych. +Stwórz kopię zapasową! creating collation - + tworzenie zestawienia Set a new name for the SQL tab. Use the '&&' character to allow using the following character as a keyboard shortcut. - + Przemianowuje kartę SQL. Wstaw znaku '&&' aby móc wykorzystać następujący po nim znak jako skrót klawiszowy. @@ -4238,7 +4293,7 @@ Create a backup! There is already an object with that name. Please choose a different name. - + Istnieje już obiekt o tej nazwie. Nadaj inną nazwę. @@ -4263,17 +4318,17 @@ Create a backup! This action will open a new SQL tab for running: - + To działanie otworzy nową kartę SQL aby wykonać: Press Help for opening the corresponding SQLite reference page. - + Naciśnij Pomoc, aby otworzyć powiązaną stronę w podręczniku SQLite. Busy (%1) - + Zajęty (%1) @@ -4281,12 +4336,12 @@ Create a backup! Set to NULL - Ustaw jako NULL + Ustaw na NULL Alt+Del - Alt+Del + Alt+Del @@ -4299,7 +4354,7 @@ Create a backup! <html><head/><body><p>This pane shows the list of columns of the currently browsed table or the just executed query. You can select the columns that you want to be used as X or Y axis for the plot pane below. The table shows detected axis type that will affect the resulting plot. For the Y axis you can only select numeric columns, but for the X axis you will be able to select:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Date/Time</span>: strings with format &quot;yyyy-MM-dd hh:mm:ss&quot; or &quot;yyyy-MM-ddThh:mm:ss&quot;</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Date</span>: strings with format &quot;yyyy-MM-dd&quot;</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Time</span>: strings with format &quot;hh:mm:ss&quot;</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Label</span>: other string formats. Selecting this column as X axis will produce a Bars plot with the column values as labels for the bars</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Numeric</span>: integer or real values</li></ul><p>Double-clicking the Y cells you can change the used color for that graph.</p></body></html> - + <html><head/><body><p>To okno pokazuje wykaz wszystkich kolumn w bieżącej tabeli lub właśnie wykonane zapytanie. Można wybrać kolumny wykorzystywane jako oś X lub Y do okna wykresu poniżej. Tabela pokazuje wykryty rodzaj osi, który wpłynie na wynikowy wykres. Dla osi Y można wybrać tylko kolumny liczbowe, a dla osi X można wybrać:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Data/Czas</span>: ciągi znaków o formacie &quot;yyyy-MM-dd hh:mm:ss&quot; lub &quot;yyyy-MM-ddThh:mm:ss&quot;</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Data</span>: ciągi znaków o formacie &quot;yyyy-MM-dd&quot;</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Czas</span>: ciągi znaków o formacie &quot;hh:mm:ss&quot;</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Etykieta</span>: inne ciągi znaków. Wybranie tej kolumny jako osi X utworzy wykres słupkowy z wartościami z kolumny będącymi etykietami dla słupków</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Liczbowe</span>: liczby całkowite lub rzeczywiste</li></ul><p>Aby zmienić barwy wykresu, należy kliknąć dwukrotnie na komórkach Y.</p></body></html> @@ -4309,7 +4364,7 @@ Create a backup! X - + X @@ -4330,7 +4385,13 @@ Click on points to select them in the plot and in the table. Ctrl+Click for sele Use mouse-wheel for zooming and mouse drag for changing the axis range. Select the axes or axes labels to drag and zoom only in that orientation. - + Tutaj rysowany jest wykres po wybraniu wartości x oraz y powyżej. + +Aby zaznaczyć punkt na wykresie i w tabeli, należy kliknąć na niego. Ctrl+Klik aby zaznaczyć zakres punktów. + +Aby zmienić zakres osi, należy kliknąć i przeciągnąć myszą. Aby powiększyć należy przewinąć rolką myszy. + +Aby przeciągnąć i powiększyć tylko w jedną stronę, należy wybrać osie lub etykiety osi. @@ -4351,17 +4412,17 @@ Select the axes or axes labels to drag and zoom only in that orientation. StepLeft - + Krok w lewo StepRight - + Krok w prawo StepCenter - + Krok do środka @@ -4416,48 +4477,48 @@ Select the axes or axes labels to drag and zoom only in that orientation. TriangleInverted - + Trójkąt odwrócony CrossSquare - + Krzyż w kwadracie PlusSquare - + Plus w kwadracie CrossCircle - + Krzyż w okręgu PlusCircle - + Plus w okręgu Peace - + Znak pokoju <html><head/><body><p>Save current plot...</p><p>File format chosen by extension (png, jpg, pdf, bmp)</p></body></html> - + <html><head/><body><p>Zapisz bieżący wykres...</p><p>Format pliku wybierany na podstawie rozszerzenia (png, jpg, pdf, bmp)</p></body></html> Save current plot... - Zapisz obecny wykres… + Zapisz bieżący wykres… Load all data and redraw plot - + Wczytaj wszystkie dane i przerysuj wykres @@ -4467,17 +4528,17 @@ Select the axes or axes labels to drag and zoom only in that orientation. Print... - Drukuj... + Drukuj... Show legend - + Pokaż legendę Stacked bars - + Słupki na stosie @@ -4498,7 +4559,7 @@ Select the axes or axes labels to drag and zoom only in that orientation. Numeric - + Liczbowa @@ -4515,18 +4576,19 @@ Select the axes or axes labels to drag and zoom only in that orientation. Row # - Rząd # + Nr wiersza Load all data and redraw plot. Warning: not all data has been fetched from the table yet due to the partial fetch mechanism. - + Wczytaj wszystkie dane i przerysuj wykres. +Uwaga: jeszcze nie wczytano wszystkich danych z tabeli ze względu na mechanizm częściowego wczytywania. Choose an axis color - Wybierz kolor osi + Wybierz barwę osi @@ -4541,7 +4603,7 @@ Warning: not all data has been fetched from the table yet due to the partial fet There are curves in this plot and the selected line style can only be applied to graphs sorted by X. Either sort the table or query by X to remove curves or select one of the styles supported by curves: None or Line. - + W tym wykresie występują krzywe, a wybrany wygląd linii można zastosować tylko dla wykresów uszeregowanych po X. Uszereguj tabelę lub zapytaj po X, aby usunąć krzywe lub wybierz jeden z wyglądów obsługiwanych przez krzywe: Brak lub Linia. @@ -4549,7 +4611,7 @@ Warning: not all data has been fetched from the table yet due to the partial fet Preferences - Preferencje + Ustawienia @@ -4574,7 +4636,7 @@ Warning: not all data has been fetched from the table yet due to the partial fet Remember last location for session only - Pamiętaj ostatnie położenie tylko przez jedną sesję + Pamiętaj ostatnie położenie tylko podczas tego uruchomienia @@ -4591,7 +4653,7 @@ Warning: not all data has been fetched from the table yet due to the partial fet Toolbar style - Styl paska narzędzi + Wygląd paska narzędzi @@ -4600,7 +4662,7 @@ Warning: not all data has been fetched from the table yet due to the partial fet Only display the icon - Wyświetlaj tylko ikonę + Wyświetl tylko ikonę @@ -4609,7 +4671,7 @@ Warning: not all data has been fetched from the table yet due to the partial fet Only display the text - Wyświetlaj tylko tekst + Wyświetl tylko tekst @@ -4636,12 +4698,12 @@ Warning: not all data has been fetched from the table yet due to the partial fet Follow the style - Zgodnie ze stylem + Domyślnie dla wyglądu Show remote options - + Pokaż ustawienia odległych BD @@ -4653,12 +4715,12 @@ Warning: not all data has been fetched from the table yet due to the partial fet enabled - + włączone Automatic &updates - A&utomatyczne aktualizacje + Sam &uaktualniaj @@ -4673,47 +4735,48 @@ Warning: not all data has been fetched from the table yet due to the partial fet Main Window - + Główne okno Database Structure - Struktura bazy danych + Struktura danych Browse Data - Przeglądaj dane + Przeglądarka danych Execute SQL - Wykonaj SQL + Wykonaj SQL Edit Database Cell - + Zmiana komórki bazy danych When this value is changed, all the other color preferences are also set to matching colors. - + Po zmianie tej wartości, wszystkie inne ustawienia barw zostaną także ustawione na +pasujące barwy. Follow the desktop style - + Zgodny z systemem Dark style - + Ciemny Application style - + Wygląd programu @@ -4728,27 +4791,27 @@ Warning: not all data has been fetched from the table yet due to the partial fet Open databases with foreign keys enabled. - + Otwiera bazy danych z włączonymi kluczami obcymi. &Foreign keys - + &Obce klucze Remove line breaks in schema &view - + Usuń podziały wierszy w &widoku schematu When enabled, the line breaks in the Schema column of the DB Structure tab, dock and printed output are removed. - + Po zaznaczeniu, usuwany jest znak łamania wiersza w kolumnie schematu karty struktury bazy danych, doku oraz drukowanym wyniku. Prefetch block si&ze - + Ro&zmiar obszaru wczytanego z wyprzedzeniem @@ -4763,7 +4826,7 @@ Warning: not all data has been fetched from the table yet due to the partial fet Default field type - Domyślny rodzaj typu + Domyślny rodzaj pola @@ -4793,19 +4856,20 @@ Warning: not all data has been fetched from the table yet due to the partial fet Symbol limit in cell - Limit znaków w komórce + Graniczna liczba znaków w komórce This is the maximum number of rows in a table for enabling the value completion based on current values in the column. Can be set to 0 for disabling completion. - + Jest to graniczna liczba wierszy w tabeli do włączenia uzupełniania wartości na podstawie wartości znajdujących się już w kolumnie. +Można ustawić na 0, aby wyłączyć uzupełnianie. Row count threshold for completion - + Próg liczby wierszy do uzupełniania @@ -4820,7 +4884,7 @@ Can be set to 0 for disabling completion. Binary - Wartość binarna + Dwójkowa @@ -4830,7 +4894,7 @@ Can be set to 0 for disabling completion. Regular - + Zwykłe @@ -4840,22 +4904,22 @@ Can be set to 0 for disabling completion. Click to set this color - + Naciśnij, aby ustawić tę barwę Text color - Kolor tekstu + Barwa tekstu Background color - Kolor tła + Barwa tła Preview only (N/A) - + Tylko do podglądu (ND) @@ -4870,12 +4934,12 @@ Can be set to 0 for disabling completion. Delay time (&ms) - Czas odstępu (&ms) + Czas opóźnienia (&ms) Set the waiting time before a new filter value is applied. Can be set to 0 for disabling waiting. - + Ustaw czas oczekiwania przed zastosowaniem nowej wartości filtra. Może być ustawiony na 0, aby wyłączyć oczekiwanie. @@ -4890,12 +4954,12 @@ Can be set to 0 for disabling completion. Context - Kontekst + Występowanie Colour - + Barwa @@ -4930,7 +4994,7 @@ Can be set to 0 for disabling completion. Comment - Komentarz + Uwaga @@ -4945,7 +5009,7 @@ Can be set to 0 for disabling completion. Current line - Obecny wiersz + Bieżący wiersz @@ -4980,32 +5044,32 @@ Can be set to 0 for disabling completion. &Wrap lines - + Za&wijaj wiersze &Quotes for identifiers - + &Cudzysłowy dla identyfikatorów Choose the quoting mechanism used by the application for identifiers in SQL code. - + Wybierz zapis cudzysłowów stosowany w aplikacji do identyfikatorów w kodzie SQL. "Double quotes" - Standard SQL (recommended) - + "Podwójne cudzysłowy" - Standard SQL (zalecane) `Grave accents` - Traditional MySQL quotes - + `Pojedyncze cudzysłowy` - Tradycyjne cudzysłowy MySQL [Square brackets] - Traditional MS SQL Server quotes - + [Nawiasy kwadratowe] - Tradycyjne cudzysłowy MS SQL Server @@ -5015,12 +5079,12 @@ Can be set to 0 for disabling completion. Keywords in &UPPER CASE - + Słowa kl&uczowe WIELKIMI LITERAMI When set, the SQL keywords are completed in UPPER CASE letters. - + Po zaznaczeniu, polecenia SQL są uzupełniane wielkimi literami. @@ -5030,17 +5094,17 @@ Can be set to 0 for disabling completion. When set, the SQL code lines that caused errors during the last execution are highlighted and the results frame indicates the error in the background - + Po zaznaczeniu, wiersze kodu SQL, które powodowały błędy podczas ostatniego wykonywania, są podświetlana, a okno wyniku pokazuje błąd w tle Hori&zontal tiling - + Kafelki w po&ziomie If enabled the SQL code editor and the result table view are shown side by side instead of one over the other. - + Po zaznaczeniu, edytor kodu SQL oraz widok tabeli wynikowej będą wyświetlane obok siebie zamiast jedno nad drugim. @@ -5050,17 +5114,17 @@ Can be set to 0 for disabling completion. At word boundaries - + Na granicach słów At character boundaries - + Na granicach znaków At whitespace boundaries - + Na granicach białych znaków Wrap lines @@ -5074,7 +5138,7 @@ Can be set to 0 for disabling completion. Select extensions to load for every database: - Wybierz rozszerzenia ładowane w każdej bazie danych: + Wybierz rozszerzenia wczytywane dla każdej bazy danych: @@ -5089,7 +5153,7 @@ Can be set to 0 for disabling completion. <html><head/><body><p>While supporting the REGEXP operator SQLite doesn't implement any regular expression<br/>algorithm but calls back the running application. DB Browser for SQLite implements this<br/>algorithm for you to let you use REGEXP out of the box. However, as there are multiple possible<br/>implementations of this and you might want to use another one, you're free to disable the<br/>application's implementation and load your own by using an extension. Requires restart of the application.</p></body></html> - + <html><head/><body><p>Mimo obsługi polecenia REGEXP, SQLite nie implementuje żadnego z algorytmu wyrażeń regularnych<br/>lecz zwraca się z powrotem do aplikacji, która je uruchomiła. Przeglądarka SQLite implementuje ten<br/>algorytm, aby móc od razu korzystać z REGEXP. Jednakże, ze względu na to, że istnieje wiele możliwych<br/>implementacji wyrażeń regularnych, to można wyłączyć ten wbudowany<br/>i wczytać swój własny. Wymaga to jednak ponownego uruchomienia aplikacji.</p></body></html> @@ -5099,38 +5163,38 @@ Can be set to 0 for disabling completion. <html><head/><body><p>SQLite provides an SQL function for loading extensions from a shared library file. Activate this if you want to use the <span style=" font-style:italic;">load_extension()</span> function from SQL code.</p><p>For security reasons, extension loading is turned off by default and must be enabled through this setting. You can always load extensions through the GUI, even though this option is disabled.</p></body></html> - + <html><head/><body><p>SQLite dostarcza funkcję SQL do wczytywania rozszerzeń z pliku biblioteki współdzielonej. Zaznacz to, aby używać funkcji <span style=" font-style:italic;">load_extension()</span> z kodu SQL.</p><p>Ze względu na bezpieczeństwo, wczytywanie rozszerzeń jest domyślnie wyłączone i musi zostać włączone przez to ustawienie. Zawsze można wczytywać rozszerzenia przez interfejs użytkownika, nawet gdy pole to jest odznaczone.</p></body></html> Allow loading extensions from SQL code - + Zezwól na wczytywanie rozszerzeń z kodu SQL Remote - Zdalne działania + Odległe BD CA certificates - Certyfikaty CA + Certyfikaty UC Subject CN - Temat CN + NP podmiotu Common Name - + Nazwa powszechna Subject O - + O podmiotu @@ -5168,22 +5232,22 @@ Can be set to 0 for disabling completion. Subject Common Name - + Wspólna nazwa podmiotu Issuer CN - + NP wydawcy Issuer Common Name - + Nazwa powszechna wydawcy Clone databases into - Klonuj bazy danych do + Pobieraj bazy danych do @@ -5208,7 +5272,7 @@ Can be set to 0 for disabling completion. Extensions(*.so *.dylib *.dll);;All files(*) - + Rozszerzenia(*.so *.dylib *.dll);;Wszystkie pliki(*) @@ -5223,13 +5287,14 @@ Can be set to 0 for disabling completion. Are you sure you want do remove this certificate? All certificate data will be deleted from the application settings! - + Czy na pewno usunąć ten certyfikat? Wszystkie dane certyfikatu zostaną usunięte z ustawień aplikacji! Are you sure you want to clear all the saved settings? All your preferences will be lost and default values will be used. - + Czy na pewno wyczyścić wszystkie zapisane ustawienia? +Wszystkie zapisane ustawienia zostaną utracone i zastąpione domyślnymi. @@ -5264,7 +5329,7 @@ All your preferences will be lost and default values will be used. Cancel - Anuluj + Zaniechaj @@ -5278,7 +5343,8 @@ All your preferences will be lost and default values will be used. Error when connecting to %1. %2 - Wystąpił błąd podczas łączenia z %1. %2 + Nie można połączyć się z %1. +%2 @@ -5290,57 +5356,61 @@ All your preferences will be lost and default values will be used. Error: Invalid client certificate specified. - + Błąd: Podano nieprawidłowy certyfikat klienta. Please enter the passphrase for this client certificate in order to authenticate. - + Podaj hasło dla certyfikatu tego klienta, aby się uwierzytelnić. Cancel - Anuluj + Zaniechaj Uploading remote database to %1 - + Wysyłanie odleglej bazy danych do +%1 Downloading remote database from %1 - + Pobieranie zdalnej bazy danych z +%1 Error: The network is not accessible. - + Błąd: Sieć jest niedostępna. Error: Cannot open the file for sending. - + Błąd: Nie można otworzyć pliku do wysłania. Error opening local databases list. %1 - + Nie można otworzyć wykazu lokalnych baz danych. +%1 Error creating local databases list. %1 - + Nie można utworzyć wykazu lokalnych baz danych. +%1 The remote database has been updated since the last checkout. Do you want to update the local database to the newest version? Note that this discards any changes you have made locally! If you don't want to lose local changes, click No to open the local version. - + Uaktualniono odległą bazę danych od czasu jej ostatniego pobrania. Czy uaktualnić lokalną bazę danych do najnowszej wersji? Spowoduje to utratę wszystkich zmian poczynionych lokalnie! Aby nie utracić lokalnych zmian, naciśnij Nie, aby otworzyć lokalną wersję. @@ -5348,17 +5418,18 @@ All your preferences will be lost and default values will be used. Remote - Zdalne działania + Odległe BD Identity - + Tożsamość Connect to the remote server using the currently selected identity. The correct server is taken from the identity as well. - + Połącz się z odległym serwerem przy użyciu obecne wybranej tożsamości. Poprawny serwer +jest brany także z tożsamości. @@ -5368,17 +5439,17 @@ All your preferences will be lost and default values will be used. Push currently opened database to server - + Wypchnij bieżącą bazę danych na serwer <html><head/><body><p>In this pane, remote databases from dbhub.io website can be added to DB4S. First you need an identity:</p><ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Login to the dbhub.io website (use your GitHub credentials or whatever you want)</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click the button to create a DB4S certificate (that's your identity). That'll give you a certificate file (save it to your local disk).</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Go to the Remote tab in DB4S Preferences. Click the button to add a new certificate to DB4S and choose the just downloaded certificate file.</li></ol><p>Now the Remote panel shows your identity and you can add remote databases.</p></body></html> - + <html><head/><body><p>W tym oknie, można dodać zdalne bazy danych ze strony sieciowej dbhub.io do DB4S. Aby to zrobić, należy posiadać tożsamość:</p><ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Zaloguj się na stronie dbhub.io (po podaniu danych dostępowych GitHub lub dowolnych innych)</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Kliknij na przycisku, aby utworzyć certyfikat DB4S (to twoja tożsamość). Otrzymasz plik certyfikatu (zapisz go na swoim dysku).</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Przejdź do karty Zdalnych w Ustawieniach DB4S. Kliknij na przycisk, aby dodać nowy certyfikat do DB4S i wskaż dopiero co pobrany plik certyfikatu.</li></ol><p>Od teraz okno Zdalne pokazuje twoją tożsamość i możesz dodawać zdalne bazy danych.</p></body></html> <html><head/><body><p>No DBHub.io account yet? <a href="https://dbhub.io/"><span style=" text-decoration: underline; color:#007af4;">Create one now</span></a> and import your certificate <a href="#preferences"><span style=" text-decoration: underline; color:#007af4;">here</span></a> to share your databases.</p><p>For online help visit <a href="https://dbhub.io/about"><span style=" text-decoration: underline; color:#007af4;">here</span></a>.</p></body></html> - + <html><head/><body><p>Jeszcze nie masz konta na DBHub.io? <a href="https://dbhub.io/"><span style=" text-decoration: underline; color:#007af4;">Stwórz je teraz</span></a> i zaimportuj swój certyfikat <a href="#preferences"><span style=" text-decoration: underline; color:#007af4;">tutaj</span></a>, aby współdzielić swoje bazy danych.</p><p>Aby uzyskać pomoc wystarczy odwiedzić <a href="https://dbhub.io/about"><span style=" text-decoration: underline; color:#007af4;">to miejsce</span></a>.</p></body></html> @@ -5391,12 +5462,12 @@ All your preferences will be lost and default values will be used. Commit - + Wdroż Last modified - Ostatnia modyfikacja + Ostatnia zmiana @@ -5414,17 +5485,17 @@ All your preferences will be lost and default values will be used. Push database - + Wypchnij bazę danych Database na&me to push to - + &Nazwa bazy danych, do której wypchnąć Commit message - + Opis wdrożenia @@ -5433,7 +5504,11 @@ All your preferences will be lost and default values will be used. p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Oxygen-Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Oxygen-Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> @@ -5453,7 +5528,7 @@ p, li { white-space: pre-wrap; } Force push - + Wymuś wypchnięcie @@ -5468,7 +5543,7 @@ p, li { white-space: pre-wrap; } Use with care. This can cause remote commits to be deleted. - + Zachowaj ostrożność. Może to usunąć wdrożenia z odległych miejsc. @@ -5481,22 +5556,22 @@ p, li { white-space: pre-wrap; } Execution aborted by user - Wykonywanie przerwane przez użytkownika + Wykonywanie przerwane przez użytkownika , %1 rows affected - + , dotyczyło %1 wiersza query executed successfully. Took %1ms%2 - + pomyślnie wykonano zapytanie. Zajęło to %1ms%2 executing query - + wykonywanie zapytania @@ -5514,7 +5589,7 @@ p, li { white-space: pre-wrap; } Find previous match with mapping - + Znajdź poprzednie pasujące z zawijaniem @@ -5524,7 +5599,7 @@ p, li { white-space: pre-wrap; } The found pattern must be a whole word - + Wzorzec do znalezienia musi być całym słowem @@ -5534,7 +5609,7 @@ p, li { white-space: pre-wrap; } Text pattern to find considering the checks in this frame - + Wzorzec tekstu do znalezienia, biorąc pod uwagę pola zaznaczone w tym oknie @@ -5544,7 +5619,7 @@ p, li { white-space: pre-wrap; } The found pattern must match in letter case - + Wzorzec do znalezienia musi pasować wielkością liter @@ -5559,7 +5634,7 @@ p, li { white-space: pre-wrap; } Find next match with wrapping - + Znajdź następne pasujące z zawijaniem @@ -5569,12 +5644,12 @@ p, li { white-space: pre-wrap; } Interpret search pattern as a regular expression - + Rozpatrz wzorzec wyszukiwania jako wyrażenie regularne <html><head/><body><p>When checked, the pattern to find is interpreted as a UNIX regular expression. See <a href="https://en.wikibooks.org/wiki/Regular_Expressions">Regular Expression in Wikibooks</a>.</p></body></html> - + <html><head/><body><p>Po zaznaczeniu, wzorzec do znalezienia jest rozważany jako wyrażenie regularne UNIX. Zajrzyj do <a href="https://en.wikibooks.org/wiki/Regular_Expressions">Wyrażeń Regularnych w Wikibooks</a>.</p></body></html> @@ -5585,22 +5660,22 @@ p, li { white-space: pre-wrap; } Close Find Bar - + Zamknij pasek wyszukiwania <html><head/><body><p>Results of the last executed statements.</p><p>You may want to collapse this panel and use the <span style=" font-style:italic;">SQL Log</span> dock with <span style=" font-style:italic;">User</span> selection instead.</p></body></html> - + <html><head/><body><p>Wynik ostatnio wykonanych poleceń.</p><p>Zalecamy zwinięcie tego okna i otworzenie doku <span style=" font-style:italic;">Dziennika SQL</span> z wyborem <span style=" font-style:italic;">Użytkownika</span>.</p></body></html> Results of the last executed statements - + Wyniki ostatnio wykonanych poleceń This field shows the results and status codes of the last executed statements. - + To pole pokazuje wyniki i kody wyjścia ostatnio wykonanych poleceń @@ -5608,7 +5683,7 @@ p, li { white-space: pre-wrap; } Ctrl+/ - + Ctrl+/ @@ -5616,199 +5691,202 @@ p, li { white-space: pre-wrap; } (X) The abs(X) function returns the absolute value of the numeric argument X. - + (X) Funkcja abs(X) zwraca wartość bezwzględną argumentu liczbowego X. () The changes() function returns the number of database rows that were changed or inserted or deleted by the most recently completed INSERT, DELETE, or UPDATE statement. - + () Funkcja changes() zwraca liczbę wierszy bazy danych, które zostały wstawiony lub usunięte przez ostatnio ukończone polecenie INSERT, DELETE, or UPDATE. (X1,X2,...) The char(X1,X2,...,XN) function returns a string composed of characters having the unicode code point values of integers X1 through XN, respectively. - + (X1,X2,...) Funkcja char(X1,X2,...,XN) zwraca ciąg znaków składający się ze znaków mających wartości punków kodu unikod będących liczbami całkowitymi w zakresie od X1 do XN, odpowiednio. (X,Y,...) The coalesce() function returns a copy of its first non-NULL argument, or NULL if all arguments are NULL - + (X,Y,...) Funkcja coalesce() zwraca kopię swojego pierwszego argumentu nie-NULL lub NULL, jeśli wszystkie argumenty są NULL (X,Y) The glob(X,Y) function is equivalent to the expression "Y GLOB X". - + (X,Y) Funkcja glob(X,Y) jest tożsama wyrażeniu "Y GLOB X". (X,Y) The ifnull() function returns a copy of its first non-NULL argument, or NULL if both arguments are NULL. - + (X,Y) Funkcja ifnull() zwraca kopię swojego pierwszego argumentu nie-NULL lub NULL, jeśli oba argumenty są NULL. (X,Y) The instr(X,Y) function finds the first occurrence of string Y within string X and returns the number of prior characters plus 1, or 0 if Y is nowhere found within X. - + (X,Y) Funkcja instr(X,Y) znajduje pierwsze wystąpienie ciągu znaków Y wewnątrz ciągu znaków X i zwraca liczbę znaków poprzedzających plus 1, lub 0, jeśli nie można znaleźć Y w X. (X) The hex() function interprets its argument as a BLOB and returns a string which is the upper-case hexadecimal rendering of the content of that blob. - + (X) Funkcja hex() interpretuje swoje argumenty jako KAWAŁKI i zwraca ciągi znaków, które są przedstawieniem szesnastkowym treści kawałka, zapisanym wielkimi literami. () The last_insert_rowid() function returns the ROWID of the last row insert from the database connection which invoked the function. - + () Funkcja last_insert_rowid() zwraca ROWID ostatniego wstawionego wiersza z połączenia bazy danych, która wywołała tę funkcję. (X) For a string value X, the length(X) function returns the number of characters (not bytes) in X prior to the first NUL character. - + (X) Dla wartości ciągu znaków X, funkcja length(X) zwraca liczbę znaków (nie bajtów) w X do chwili napotkania pierwszego znaku NUL. (X,Y) The like() function is used to implement the "Y LIKE X" expression. - + (X,Y) Funkcja like() jest używana do implementacji wyrażenia "Y LIKE X". (X,Y,Z) The like() function is used to implement the "Y LIKE X ESCAPE Z" expression. - + (X,Y,Z) Funkcja like() jest używana do implementacji wyrażenia "Y LIKE X ESCAPE Z". (X) The load_extension(X) function loads SQLite extensions out of the shared library file named X. Use of this function must be authorized from Preferences. - + (X) Funkcja load_extension(X) wczytuje rozszerzenia SQLite z pliku biblioteki współdzielonej o nazwie X. +Aby użyć tej funkcji, należy wyrazić zgodę w Ustawieniach. (X,Y) The load_extension(X) function loads SQLite extensions out of the shared library file named X using the entry point Y. Use of this function must be authorized from Preferences. - + (X,Y) Funkcja load_extension(X) wczytuje rozszerzenia SQLite z pliku biblioteki współdzielonej o nazwie X przy użyciu punktu wejściowego Y. +Aby użyć tej funkcji, należy wyrazić zgodę w Ustawieniach. (X) The lower(X) function returns a copy of string X with all ASCII characters converted to lower case. - + (X) Funkcja lower(X) zwraca kopię ciągu znaków X po przekształceniu wszystkich znaków ASCII na pisane małymi literami. (X) ltrim(X) removes spaces from the left side of X. - + (X) ltrim(X) usuwa odstępy z lewej strony X. (X,Y) The ltrim(X,Y) function returns a string formed by removing any and all characters that appear in Y from the left side of X. - + (X,Y) Funkcja ltrim(X,Y) zwraca ciąg znaków utworzony po usunięciu dowolnego i wszystkich znaków, które ukazują się w Y z lewej strony X. (X,Y,...) The multi-argument max() function returns the argument with the maximum value, or return NULL if any argument is NULL. - + (X,Y,...) Funkcja wieloargumentowa max() zwraca argument o wartości największej lub NULL, jeśli dowolny argument jest NULL. (X,Y,...) The multi-argument min() function returns the argument with the minimum value. - + (X,Y,...) Funkcja wieloargumentowa min() zwraca argument o wartości najmniejszej. (X,Y) The nullif(X,Y) function returns its first argument if the arguments are different and NULL if the arguments are the same. - + (X,Y) Funkcja nullif(X,Y) zwraca swój pierwszy argument, jeśli argumenty są różne i NULL, jeśli argumenty są te same. (FORMAT,...) The printf(FORMAT,...) SQL function works like the sqlite3_mprintf() C-language function and the printf() function from the standard C library. - + (FORMAT,...) Funkcja SQL printf(FORMAT,...) działa jak funkcja sqlite3_mprintf() języka C oraz printf() ze standardowej biblioteki C. (X) The quote(X) function returns the text of an SQL literal which is the value of its argument suitable for inclusion into an SQL statement. - + (X) Funkcja quote(X) zwraca dosłowny tekst SQL, który jest wartością jego argumentów +gotową do wstawienia w polecenie SQL. () The random() function returns a pseudo-random integer between -9223372036854775808 and +9223372036854775807. - + () Funkcja random() zwraca pseudo-losową liczbę całkowitą z zakresu od -9223372036854775808 do +9223372036854775807. (N) The randomblob(N) function return an N-byte blob containing pseudo-random bytes. - + (N) Funkcja randomblob(N) zwraca N-bajtowy kawałek zawierający pseudo-losowe bajty. (X,Y,Z) The replace(X,Y,Z) function returns a string formed by substituting string Z for every occurrence of string Y in string X. - + (X,Y,Z) Funkcja replace(X,Y,Z) zwraca ciąg znaków utworzony poprzez podmianę ciągu znaków Z dla każdego wystąpienia ciągu znaków Y w ciągu znaków X. (X) The round(X) function returns a floating-point value X rounded to zero digits to the right of the decimal point. - + (X) Funkcja round(X) zwraca wartość liczby zmiennoprzecinkowej X zaokrąglonej do części całkowitej. (X,Y) The round(X,Y) function returns a floating-point value X rounded to Y digits to the right of the decimal point. - + (X,Y) Funkcja round(X,Y) zwraca wartość liczby zmiennoprzecinkowej X zaokrąglonej do liczby znaków dziesiętnych określonych przez Y. (X) rtrim(X) removes spaces from the right side of X. - + (X) rtrim(X) usuwa odstępy z prawej strony X. (X,Y) The rtrim(X,Y) function returns a string formed by removing any and all characters that appear in Y from the right side of X. - + (X,Y) Funkcja rtrim(X,Y) zwraca ciąg znaków utworzony po usunięciu dowolnego i wszystkich znaków, które ukazują się w Y z prawej strony X. (X) The soundex(X) function returns a string that is the soundex encoding of the string X. - + (X) Funkcja soundex(X) zwraca ciąg znaków X zakodowany jako soundex. (X,Y) substr(X,Y) returns all characters through the end of the string X beginning with the Y-th. - + (X,Y) substr(X,Y) zwraca wszystkie znaki do końca ciągu znaków X zaczynając od Y-tego. (X,Y,Z) The substr(X,Y,Z) function returns a substring of input string X that begins with the Y-th character and which is Z characters long. - + (X,Y,Z) Funkcja substr(X,Y,Z) zwraca podciąg znaków ciągu wejściowego znaków X, który zaczyna się na Y-tym znaku i który jest długi na Z znaków. () The total_changes() function returns the number of row changes caused by INSERT, UPDATE or DELETE statements since the current database connection was opened. - + () Funkcja total_changes() zwraca liczbę zmienionych wierszy przez polecenia INSERT, UPDATE lub DELETE od chwili nawiązania połączenia z bazą danych. (X) trim(X) removes spaces from both ends of X. - + (X) trim(X) usuwa odstępy z obu stron X. (X,Y) The trim(X,Y) function returns a string formed by removing any and all characters that appear in Y from both ends of X. - + (X,Y) Funkcja trim(X,Y) zwraca ciąg znaków utworzony po usunięciu dowolnego i wszystkich znaków, które ukazują się w Y z obu stron X. (X) The typeof(X) function returns a string that indicates the datatype of the expression X. - + (X) Funkcja typeof(X) zwraca ciąg znaków, który wskazuje na rodzaj danych wyrażenia X. (X) The unicode(X) function returns the numeric unicode code point corresponding to the first character of the string X. - + (X) Funkcja unicode(X) zwraca punkt numerycznego kodu unikodu odpowiadający pierwszemu znakowi ciągu X. (X) The upper(X) function returns a copy of input string X in which all lower-case ASCII characters are converted to their upper-case equivalent. - + (X) Funkcja upper(X) zwraca kopię ciągu znaków X po przekształceniu wszystkich znaków ASCII na pisane wielkimi literami. (N) The zeroblob(N) function returns a BLOB consisting of N bytes of 0x00. - + (N) Funkcja zeroblob(N) zwraca KAWAŁEK składający się z N bajtów 0x00. @@ -5816,119 +5894,121 @@ Use of this function must be authorized from Preferences. (timestring,modifier,modifier,...) - + (ciąg_znaków_czasu,zmieniacz,zmieniacz,...) (format,timestring,modifier,modifier,...) - + (format,ciąg_znaków_czasu,zmieniacz,zmieniacz,...) (X) The avg() function returns the average value of all non-NULL X within a group. - + (X) Funkcja avg() zwraca wartość średnią wszystkich nie-NULL X wewnątrz grupy. (X) The count(X) function returns a count of the number of times that X is not NULL in a group. - + (X) Funkcja count(X) zwraca liczbę tego ile razy X nie jest NULL w grupie. (X) The group_concat() function returns a string which is the concatenation of all non-NULL values of X. - + (X) Funkcja group_concat() zwraca ciąg znaków, który jest złączeniem wszystkich wartości nie-NULL X. (X,Y) The group_concat() function returns a string which is the concatenation of all non-NULL values of X. If parameter Y is present then it is used as the separator between instances of X. - + (X,Y) Funkcja group_concat() zwraca ciąg znaków będący złączeniem wszystkich wartości nie-NULL X. Jeśli obecne jest Y, to służy jako znak oddzielający wystąpienia X. (X) The max() aggregate function returns the maximum value of all values in the group. - + (X) Funkcja max() zwraca najwyższą wartość z wartości w grupie. (X) The min() aggregate function returns the minimum non-NULL value of all values in the group. - + (X) Funkcja min() zwraca najmniejszą wartość nie-NULL z wartości w grupie. (X) The sum() and total() aggregate functions return sum of all non-NULL values in the group. - + (X) Funkcje sum() oraz total() zwracają sumę wszystkich wartości nie-NULL w grupie. () The number of the row within the current partition. Rows are numbered starting from 1 in the order defined by the ORDER BY clause in the window definition, or in arbitrary order otherwise. - + () Numer wiersza wewnątrz bieżącej partycji. Partycje są ponumerowane od 1 w kolejności określonej przez wyrażenie ORDER BY w określeniu okna lub w dowolnej kolejności. () The row_number() of the first peer in each group - the rank of the current row with gaps. If there is no ORDER BY clause, then all rows are considered peers and this function always returns 1. - + () Numer wiersza row_number() pierwszego członka w każdej grupie - ranga bieżącego wiersza w rozstępach. Jeśli brak polecenia ORDER BY, to wszystkie wiersze są rozważane jako członkowie i funkcja zawsze zwraca 1. () The number of the current row's peer group within its partition - the rank of the current row without gaps. Partitions are numbered starting from 1 in the order defined by the ORDER BY clause in the window definition. If there is no ORDER BY clause, then all rows are considered peers and this function always returns 1. - + () Numer grupy bieżącego wiersza wewnątrz jego partycji - ranga bieżącego wiersza bez przerw. Partycje są ponumerowane od 1 w kolejności określonej przez wyrażenie ORDER BY w określeniu okna. Jeśli brak wyrażenia ORDER BY, to wszystkie wiersze są rozważane jako leżące obok siebie, a funkcja ta zwraca 1. () Despite the name, this function always returns a value between 0.0 and 1.0 equal to (rank - 1)/(partition-rows - 1), where rank is the value returned by built-in window function rank() and partition-rows is the total number of rows in the partition. If the partition contains only one row, this function returns 0.0. - + () Pomimo nazwy, funkcja ta zawsze zwraca wartość pomiędzy 0.0 oraz 1.0 równą (rank - 1)/(wiersze-partycji - 1), gdzie rank jest wartością zwracaną przez wbudowaną funkcję rank() okna, a wiersze-partycji jest całkowitą liczbą wierszy w partycji. Jeśli partycja zawiera tylko jeden wiersz, to ta funkcja zwraca 0.0. () The cumulative distribution. Calculated as row-number/partition-rows, where row-number is the value returned by row_number() for the last peer in the group and partition-rows the number of rows in the partition. - + () Rozkład nagromadzony. Obliczany jako numer-wiersza/wiersze-partycji, gdzie +numer-wiersza jest wartością zwracaną przez row_number() dla ostatniego +elementu w grupie, a wiersze-partycji to liczba wierszy w partycji. (N) Argument N is handled as an integer. This function divides the partition into N groups as evenly as possible and assigns an integer between 1 and N to each group, in the order defined by the ORDER BY clause, or in arbitrary order otherwise. If necessary, larger groups occur first. This function returns the integer value assigned to the group that the current row is a part of. - + (N) Argument N jest rozważany jako liczba całkowita. Ta funkcja dzieli partycję na N grup tak równo jak to możliwe i przypisuje liczbę całkowitą z zakresu od 1 do N każdej grupie w kolejności określonej przez polecenie ORDER BY lub dowolnej. Jeśli zajdzie taka potrzeba, to większe grupy wystąpią jako pierwsze. Ta funkcja zwraca liczbę całkowitą przypisaną do grupy, do której bieżący wiersz należy. (expr) Returns the result of evaluating expression expr against the previous row in the partition. Or, if there is no previous row (because the current row is the first), NULL. - + (expr) Zwraca wynik obliczania wyrażenia expr na poprzednim wierszu w partycji. Lub, jeśli nie ma poprzedniego wiersza (bo bieżący wiersz jest pierwszym), NULL. (expr,offset) If the offset argument is provided, then it must be a non-negative integer. In this case the value returned is the result of evaluating expr against the row offset rows before the current row within the partition. If offset is 0, then expr is evaluated against the current row. If there is no row offset rows before the current row, NULL is returned. - + (expr,przesunięcie) Jeśli podano argument przesunięcia, to musi on być nieujemną liczbą całkowitą. W tym przypadku wartością zwracaną jest wynik obliczenia wyrażenia na wierszu przesuniętym o daną liczbę wierszy wstecz względem bieżącego wiersza. Jeśli nie będzie takiego wiersza, to zwracane jest NULL. (expr,offset,default) If default is also provided, then it is returned instead of NULL if the row identified by offset does not exist. - + (expr,przesunięcie,domyślne) Jeśli podano także domyślne, to jest to wartości zwracana zamiast NULL, jeśli wiersz określony przez przesunięcie nie istnieje. (expr) Returns the result of evaluating expression expr against the next row in the partition. Or, if there is no next row (because the current row is the last), NULL. - + (expr) Zwraca wynik obliczania wyrażenia expr na następnym wierszu w partycji. Lub, jeśli nie ma następnego wiersza (bo bieżący wiersz jest ostatnim), NULL. (expr,offset) If the offset argument is provided, then it must be a non-negative integer. In this case the value returned is the result of evaluating expr against the row offset rows after the current row within the partition. If offset is 0, then expr is evaluated against the current row. If there is no row offset rows after the current row, NULL is returned. - + (expr,przesunięcie) Jeśli podano argument przesunięcia, to musi on być nieujemną liczbą całkowitą. W tym przypadku wartością zwracaną jest wynik obliczenia wyrażenia na wierszu przesuniętym o daną liczbę wierszy wprzód względem bieżącego wiersza. Jeśli nie będzie takiego wiersza, to zwracane jest NULL. (expr) This built-in window function calculates the window frame for each row in the same way as an aggregate window function. It returns the value of expr evaluated against the first row in the window frame for each row. - + (expr) Ta wbudowana funkcja okna oblicza ramę okna dla każdego wiersza w ten sam sposób jak funkcja okna złożonego. Zwraca wartość expr obliczoną na pierwszym wierszu ramy okna dla każdego wiersza. (expr) This built-in window function calculates the window frame for each row in the same way as an aggregate window function. It returns the value of expr evaluated against the last row in the window frame for each row. - + (expr) Ta wbudowana funkcja okna oblicza ramę okna dla każdego wiersza w ten sam sposób jak funkcja okna złożonego. Zwraca wartość expr obliczoną na ostatnim wierszu ramy okna dla każdego wiersza. (expr,N) This built-in window function calculates the window frame for each row in the same way as an aggregate window function. It returns the value of expr evaluated against the row N of the window frame. Rows are numbered within the window frame starting from 1 in the order defined by the ORDER BY clause if one is present, or in arbitrary order otherwise. If there is no Nth row in the partition, then NULL is returned. - + (expr,N) Ta wbudowana funkcja okna oblicza ramę okna dla każdego wiersza w ten sam sposób jak funkcja okna złożonego. Zwraca wartość expr obliczoną na N-tym wierszu ramy okna. Wiersze są numerowane wewnątrz ramy okna poczynając od 1 w kolejności określonej przez polecenie ORDER BY jeśli jest obecne lub w dowolnej kolejności. Jeśli N-ty wiersz nie istnieje w partycji, to zwracane jest NULL. @@ -5936,18 +6016,19 @@ Use of this function must be authorized from Preferences. reading rows - + czytanie wierszy loading... - ładowanie… + wczytywanie... References %1(%2) Hold %3Shift and click to jump there - + Odwołania %1(%2) +Przyciśnij %3Shift i kliknij, aby tu przejść @@ -5969,7 +6050,7 @@ Hold %3Shift and click to jump there Cancel - Anuluj + Zaniechaj @@ -5977,17 +6058,17 @@ Hold %3Shift and click to jump there Compact Database - + Ściśnij bazę danych... Warning: Compacting the database will commit all of your changes. - + Uwaga: Ściskanie bazy danych spowoduje wdrożenie wszystkich twoich zmian. Please select the databases to co&mpact: - + Wybierz bazę danych do ściś&nięcia: