diff options
| author | 2021-12-17 07:06:30 -0500 | |
|---|---|---|
| committer | 2021-12-17 07:06:30 -0500 | |
| commit | 1fdc150116cad39aae5c5da407c3312b47a59e3a (patch) | |
| tree | 123c79a4d7ad2d45781ba03ce939f7539fb428d8 /SQLiteStudio3/coreSQLiteStudio/parser | |
| parent | feda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff) | |
New upstream version 3.3.3+dfsg1.upstream/3.3.3+dfsg1
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/parser')
103 files changed, 6074 insertions, 11440 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp index 49763a5..5ca593f 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp @@ -106,7 +106,7 @@ TokenList SqliteAlterTable::rebuildTokensFromContents() builder.withKeyword("ALTER").withSpace().withKeyword("TABLE").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); builder.withOther(table).withSpace(); @@ -120,7 +120,7 @@ TokenList SqliteAlterTable::rebuildTokensFromContents() } else if (!newName.isNull()) { - builder.withKeyword("RENAME").withSpace().withKeyword("TO").withSpace().withOther(newName, dialect); + builder.withKeyword("RENAME").withSpace().withKeyword("TO").withSpace().withOther(newName); } builder.withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h index 360db45..fbac3fe 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h @@ -34,9 +34,9 @@ class API_EXPORT SqliteAlterTable : public SqliteQuery public: Command command = Command::null; - QString newName = QString::null; - QString database = QString::null; - QString table = QString::null; + QString newName = QString(); + QString database = QString(); + QString table = QString(); bool columnKw = false; SqliteCreateTable::Column* newColumn = nullptr; }; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp index 30396c1..4e79f3d 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp @@ -73,7 +73,7 @@ TokenList SqliteAnalyze::rebuildTokensFromContents() builder.withKeyword("ANALYZE").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); builder.withOther(table).withOperator(";"); return builder.build(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h index 194e4c9..a786621 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h @@ -12,8 +12,8 @@ class API_EXPORT SqliteAnalyze : public SqliteQuery SqliteAnalyze(const QString& name1, const QString& name2); SqliteStatement* clone(); - QString database = QString::null; - QString table = QString::null; + QString database = QString(); + QString table = QString(); protected: QStringList getTablesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp index 00ec9ac..899f8bb 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp @@ -9,7 +9,7 @@ SqliteBeginTrans::SqliteBeginTrans() } SqliteBeginTrans::SqliteBeginTrans(const SqliteBeginTrans& other) : - SqliteQuery(other), onConflict(other.onConflict), name(other.name), transactionKw(other.transactionKw), type(other.type) + SqliteQuery(other), name(other.name), transactionKw(other.transactionKw), type(other.type) { } @@ -21,9 +21,8 @@ SqliteBeginTrans::SqliteBeginTrans(SqliteBeginTrans::Type type, bool transaction this->name = name; } -SqliteBeginTrans::SqliteBeginTrans(bool transactionKw, const QString &name, SqliteConflictAlgo onConflict) +SqliteBeginTrans::SqliteBeginTrans(bool transactionKw, const QString &name) { - this->onConflict = onConflict; this->transactionKw = transactionKw; this->name = name; } @@ -62,10 +61,10 @@ TokenList SqliteBeginTrans::rebuildTokensFromContents() { builder.withSpace().withKeyword("TRANSACTION"); if (!name.isNull()) - builder.withSpace().withOther(name, dialect); + builder.withSpace().withOther(name); } - builder.withConflict(onConflict).withOperator(";"); + builder.withOperator(";"); return builder.build(); } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h index 48f5b37..b16b6c0 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h @@ -19,10 +19,9 @@ class API_EXPORT SqliteBeginTrans : public SqliteQuery SqliteBeginTrans(); SqliteBeginTrans(const SqliteBeginTrans& other); SqliteBeginTrans(Type type, bool transactionKw, const QString& name); - SqliteBeginTrans(bool transactionKw, const QString& name, SqliteConflictAlgo onConflict); + SqliteBeginTrans(bool transactionKw, const QString& name); SqliteStatement* clone(); - SqliteConflictAlgo onConflict = SqliteConflictAlgo::null; // sqlite2 only QString name; // in docs sqlite2 only, but in gramma it's also sqlite3 bool transactionKw = false; Type type = Type::null; // sqlite3 only diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp index 2c48119..5872ab1 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp @@ -1,6 +1,7 @@ #include "sqlitecolumntype.h" #include "parser/statementtokenbuilder.h" #include "common/utils_sql.h" +#include "parser/lexer.h" SqliteColumnType::SqliteColumnType() { @@ -50,7 +51,7 @@ TokenList SqliteColumnType::rebuildTokensFromContents() if (name.isEmpty()) return TokenList(); - builder.withOther(name); + TokenList resultTokens = Lexer::tokenize(name); if (!scale.isNull()) { @@ -79,7 +80,7 @@ TokenList SqliteColumnType::rebuildTokensFromContents() builder.withParRight(); } - return builder.build(); + return resultTokens + builder.build(); } DataType SqliteColumnType::toDataType() const diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h index fc87b6b..f003f9f 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h @@ -20,7 +20,7 @@ class API_EXPORT SqliteColumnType : public SqliteStatement TokenList rebuildTokensFromContents(); DataType toDataType() const; - QString name = QString::null; + QString name = QString(); QVariant scale = QVariant(); // first size number QVariant precision = QVariant(); // second size number }; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp index 2b1b707..4f8de49 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp @@ -39,7 +39,7 @@ TokenList SqliteCommitTrans::rebuildTokensFromContents() { builder.withSpace().withKeyword("TRANSACTION"); if (!name.isNull()) - builder.withSpace().withOther(name, dialect); + builder.withSpace().withOther(name); } builder.withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h index ec418a6..b5557a7 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h @@ -13,7 +13,7 @@ class API_EXPORT SqliteCommitTrans : public SqliteQuery SqliteStatement* clone(); bool endKw = false; - QString name = QString::null; + QString name = QString(); bool transactionKw = false; protected: diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp index 56fb42d..2246979 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp @@ -32,6 +32,6 @@ QString sqliteConflictAlgo(SqliteConflictAlgo value) case SqliteConflictAlgo::REPLACE: return "REPLACE"; default: - return QString::null; + return QString(); } } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp index 0d9ed9f..c3ff500 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp @@ -79,9 +79,9 @@ TokenList SqliteCopy::rebuildTokensFromContents() builder.withKeyword("OR").withSpace().withKeyword(sqliteConflictAlgo(onConflict)).withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withSpace(); + builder.withOther(database).withSpace(); - builder.withOther(table, dialect).withSpace().withKeyword("FROM").withSpace().withString(file); + builder.withOther(table).withSpace().withKeyword("FROM").withSpace().withString(file); if (!delimiter.isNull()) builder.withSpace().withKeyword("USING").withSpace().withKeyword("DELIMITERS").withSpace().withString(delimiter); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h index ff586df..1e4b5b7 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h @@ -9,14 +9,14 @@ class API_EXPORT SqliteCopy : public SqliteQuery public: SqliteCopy(); SqliteCopy(const SqliteCopy& other); - SqliteCopy(SqliteConflictAlgo onConflict, const QString& name1, const QString& name2, const QString& name3, const QString& delim = QString::null); + SqliteCopy(SqliteConflictAlgo onConflict, const QString& name1, const QString& name2, const QString& name3, const QString& delim = QString()); SqliteStatement* clone(); SqliteConflictAlgo onConflict = SqliteConflictAlgo::null; - QString database = QString::null; - QString table = QString::null; - QString file = QString::null; - QString delimiter = QString::null; + QString database = QString(); + QString table = QString(); + QString file = QString(); + QString delimiter = QString(); protected: QStringList getTablesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp index 5c11ff5..b747c33 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp @@ -17,32 +17,10 @@ SqliteCreateIndex::SqliteCreateIndex(const SqliteCreateIndex& other) : DEEP_COPY_COLLECTION(SqliteOrderBy, indexedColumns); } -SqliteCreateIndex::SqliteCreateIndex(bool unique, bool ifNotExists, const QString& name1, const QString& name2, const QString& name3, const QList<SqliteIndexedColumn*>& columns, SqliteConflictAlgo onConflict) - : SqliteCreateIndex() -{ - // Constructor for SQLite 2 - uniqueKw = unique; - ifNotExistsKw = ifNotExists; - - index = name1; - - if (!name3.isNull()) - { - database = name2; - table = name3; - } - else - table = name2; - - this->onConflict = onConflict; - this->indexedColumns = toOrderColumns(columns); -} - SqliteCreateIndex::SqliteCreateIndex(bool unique, bool ifNotExists, const QString& name1, const QString& name2, const QString& name3, const QList<SqliteOrderBy*>& columns, SqliteExpr* where) : SqliteCreateIndex() { - // Constructor for SQLite 3 uniqueKw = unique; ifNotExistsKw = ifNotExists; @@ -89,18 +67,12 @@ QStringList SqliteCreateIndex::getDatabasesInStatement() TokenList SqliteCreateIndex::getTableTokensInStatement() { - if (dialect == Dialect::Sqlite2) - return getObjectTokenListFromNmDbnm("nm2", "dbnm"); - else - return getTokenListFromNamedKey("nm2"); + return getTokenListFromNamedKey("nm2"); } TokenList SqliteCreateIndex::getDatabaseTokensInStatement() { - if (dialect == Dialect::Sqlite2) - return getDbTokenListFromNmDbnm("nm2", "dbnm"); - else - return getDbTokenListFromNmDbnm(); + return getDbTokenListFromNmDbnm(); } QList<SqliteStatement::FullObject> SqliteCreateIndex::getFullObjectsInStatement() @@ -109,14 +81,9 @@ QList<SqliteStatement::FullObject> SqliteCreateIndex::getFullObjectsInStatement( // Table object FullObject fullObj; - if (dialect == Dialect::Sqlite2) - fullObj = getFullObjectFromNmDbnm(FullObject::TABLE, "nm2", "dbnm"); - else - { - TokenList tableTokens = getTokenListFromNamedKey("nm2"); - if (tableTokens.size() > 0) - fullObj = getFullObject(FullObject::TABLE, TokenPtr(), tableTokens[0]); - } + TokenList tableTokens = getTokenListFromNamedKey("nm2"); + if (tableTokens.size() > 0) + fullObj = getFullObject(FullObject::TABLE, TokenPtr(), tableTokens[0]); if (fullObj.isValid()) result << fullObj; @@ -130,14 +97,10 @@ QList<SqliteStatement::FullObject> SqliteCreateIndex::getFullObjectsInStatement( } // Index object - if (dialect == Dialect::Sqlite2) - { - TokenList tableTokens = getTokenListFromNamedKey("nm"); - if (tableTokens.size() > 0) - fullObj = getFullObject(FullObject::INDEX, TokenPtr(), tableTokens[0]); - } - else - fullObj = getFullObjectFromNmDbnm(FullObject::INDEX, "nm", "dbnm"); + fullObj = getFullObjectFromNmDbnm(FullObject::INDEX, "nm", "dbnm"); + + if (fullObj.isValid()) + result << fullObj; return result; } @@ -155,28 +118,11 @@ TokenList SqliteCreateIndex::rebuildTokensFromContents() if (ifNotExistsKw) builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace(); - if (dialect == Dialect::Sqlite2) - { - builder.withOther(index, dialect).withSpace().withKeyword("ON").withSpace(); - - if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); - - builder.withOther(table, dialect).withSpace(); - builder.withParLeft().withStatementList(indexedColumns).withParRight(); - - - if (onConflict != SqliteConflictAlgo::null) - builder.withSpace().withKeyword(sqliteConflictAlgo(onConflict)); - } - else - { - if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + if (!database.isNull()) + builder.withOther(database).withOperator("."); - builder.withOther(index, dialect).withSpace().withKeyword("ON").withSpace().withOther(table, dialect).withSpace().withParLeft() - .withStatementList(indexedColumns).withParRight(); - } + builder.withOther(index).withSpace().withKeyword("ON").withSpace().withOther(table).withSpace().withParLeft() + .withStatementList(indexedColumns).withParRight(); if (where) builder.withSpace().withKeyword("WHERE").withStatement(where); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h index 033a663..870ed17 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h @@ -33,10 +33,9 @@ class API_EXPORT SqliteCreateIndex : public SqliteQuery, public SqliteTableRelat bool uniqueKw = false; bool ifNotExistsKw = false; QList<SqliteOrderBy*> indexedColumns; - // The database refers to index name in Sqlite3, but in Sqlite2 it refers to the table. - QString database = QString::null; - QString index = QString::null; - QString table = QString::null; + QString database = QString(); + QString index = QString(); + QString table = QString(); SqliteConflictAlgo onConflict = SqliteConflictAlgo::null; SqliteExpr* where = nullptr; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp index eb4ae85..d82270e 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp @@ -3,6 +3,8 @@ #include "common/utils_sql.h" #include "common/global.h" +const QRegExp SqliteCreateTable::Column::GENERATED_ALWAYS_REGEXP = QRegExp("GENERATED\\s+ALWAYS"); + SqliteCreateTable::SqliteCreateTable() { queryType = SqliteQueryType::CreateTable; @@ -219,10 +221,10 @@ TokenList SqliteCreateTable::rebuildTokensFromContents() builder.withSpace().withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS"); builder.withSpace(); - if (dialect == Dialect::Sqlite3 && !database.isNull()) - builder.withOther(database, dialect).withOperator("."); + if (!database.isNull()) + builder.withOther(database).withOperator("."); - builder.withOther(table, dialect); + builder.withOther(table); if (select) builder.withSpace().withKeyword("AS").withSpace().withStatement(select); @@ -267,8 +269,9 @@ SqliteCreateTable::Column::Constraint::Constraint() SqliteCreateTable::Column::Constraint::Constraint(const SqliteCreateTable::Column::Constraint& other) : SqliteStatement(other), type(other.type), name(other.name), sortOrder(other.sortOrder), onConflict(other.onConflict), - autoincrKw(other.autoincrKw), literalValue(other.literalValue), literalNull(other.literalNull), ctime(other.ctime), id(other.id), - collationName(other.collationName), deferrable(other.deferrable), initially(other.initially) + autoincrKw(other.autoincrKw), generatedKw(other.generatedKw), literalValue(other.literalValue), literalNull(other.literalNull), + ctime(other.ctime), id(other.id), collationName(other.collationName), generatedType(other.generatedType), + deferrable(other.deferrable), initially(other.initially) { DEEP_COPY_FIELD(SqliteExpr, expr); DEEP_COPY_FIELD(SqliteForeignKey, foreignKey); @@ -283,6 +286,30 @@ SqliteStatement* SqliteCreateTable::Column::Constraint::clone() return new SqliteCreateTable::Column::Constraint(*this); } +QString SqliteCreateTable::Column::Constraint::toString(SqliteCreateTable::Column::Constraint::GeneratedType type) +{ + switch (type) { + case SqliteCreateTable::Column::Constraint::GeneratedType::STORED: + return "STORED"; + case SqliteCreateTable::Column::Constraint::GeneratedType::VIRTUAL: + return "VIRTUAL"; + case SqliteCreateTable::Column::Constraint::GeneratedType::null: + break; + } + return QString(); +} + +SqliteCreateTable::Column::Constraint::GeneratedType SqliteCreateTable::Column::Constraint::generatedTypeFrom(const QString& type) +{ + QString upType = type.toUpper(); + if (upType == "STORED") + return GeneratedType::STORED; + else if (upType == "VIRTUAL") + return GeneratedType::VIRTUAL; + else + return GeneratedType::null; +} + void SqliteCreateTable::Column::Constraint::initDefNameOnly(const QString &name) { this->type = SqliteCreateTable::Column::Constraint::NAME_ONLY; @@ -404,6 +431,14 @@ void SqliteCreateTable::Column::Constraint::initColl(const QString &name) this->collationName = name; } +void SqliteCreateTable::Column::Constraint::initGeneratedAs(SqliteExpr* expr, bool genKw, const QString& type) +{ + this->type = SqliteCreateTable::Column::Constraint::GENERATED; + this->expr = expr; + this->generatedKw = genKw; + this->generatedType = generatedTypeFrom(type); +} + QString SqliteCreateTable::Column::Constraint::typeString() const { switch (type) @@ -418,6 +453,8 @@ QString SqliteCreateTable::Column::Constraint::typeString() const return "CHECK"; case SqliteCreateTable::Column::Constraint::DEFAULT: return "DEFAULT"; + case SqliteCreateTable::Column::Constraint::GENERATED: + return "GENERATED"; case SqliteCreateTable::Column::Constraint::COLLATE: return "COLLATE"; case SqliteCreateTable::Column::Constraint::FOREIGN_KEY: @@ -427,7 +464,7 @@ QString SqliteCreateTable::Column::Constraint::typeString() const case SqliteCreateTable::Column::Constraint::DEFERRABLE_ONLY: break; } - return QString::null; + return QString(); } SqliteCreateTable::Constraint::Constraint() @@ -551,9 +588,9 @@ QString SqliteCreateTable::Constraint::typeString() const case SqliteCreateTable::Constraint::FOREIGN_KEY: return "FOREIGN KEY"; case SqliteCreateTable::Constraint::NAME_ONLY: - return QString::null; + return QString(); } - return QString::null; + return QString(); } TokenList SqliteCreateTable::Constraint::rebuildTokensFromContents() @@ -561,7 +598,7 @@ TokenList SqliteCreateTable::Constraint::rebuildTokensFromContents() StatementTokenBuilder builder; if (!name.isNull()) - builder.withKeyword("CONSTRAINT").withSpace().withOther(name, dialect).withSpace(); + builder.withKeyword("CONSTRAINT").withSpace().withOther(name).withSpace(); switch (type) { @@ -694,6 +731,33 @@ QList<SqliteCreateTable::Column::Constraint*> SqliteCreateTable::Column::getFore return results; } +void SqliteCreateTable::Column::fixTypeVsGeneratedAs() +{ + // This is a workaround for lemon parser taking "GENERATED ALWAYS" as part of the typename, + // despite 2 days effort of forcing proper precedense to parse it as part of a constraint. + // Lemon keeps reducing these 2 keywords into the typename by using fallback of GENERATED & ALWAYS to ID, + // regardless of rule order and explicit precedence. By throwing the GENERATED keyword out of the fallback list, + // we would make the syntax incompatible with official SQLite syntax, which allows usage of GENERATED as ID. + // I've tried to use more recent Lemon parser, but it's different a lot from current one and it is no longer possible + // to collect tokens parsed per rule (needed tor SqliteStatement's tokens & tokenMap). At least not in the way + // that it used to be so far. + // This is the last resort to make it right. + // This method is called from parser rule that reduces column definition (rule "column(X)"). + Constraint* generatedConstr = getConstraint(Constraint::GENERATED); + if (generatedConstr && !generatedConstr->generatedKw && type && type->name.toUpper().contains(GENERATED_ALWAYS_REGEXP)) + { + type->name.replace(GENERATED_ALWAYS_REGEXP, ""); + type->tokens = type->rebuildTokensFromContents(); + type->tokensMap["typename"] = type->tokens; + generatedConstr->generatedKw = true; + } +} + +void SqliteCreateTable::Column::evaluatePostParsing() +{ + fixTypeVsGeneratedAs(); +} + QStringList SqliteCreateTable::Column::getColumnsInStatement() { return getStrListFromValue(name); @@ -707,7 +771,7 @@ TokenList SqliteCreateTable::Column::getColumnTokensInStatement() TokenList SqliteCreateTable::Column::rebuildTokensFromContents() { StatementTokenBuilder builder; - builder.withOther(name, dialect).withStatement(type).withStatementList(constraints, ""); + builder.withOther(name).withStatement(type).withStatementList(constraints, ""); return builder.build(); } @@ -715,7 +779,7 @@ TokenList SqliteCreateTable::Column::Constraint::rebuildTokensFromContents() { StatementTokenBuilder builder; if (!name.isNull()) - builder.withKeyword("CONSTRAINT").withSpace().withOther(name, dialect).withSpace(); + builder.withKeyword("CONSTRAINT").withSpace().withOther(name).withSpace(); switch (type) { @@ -746,7 +810,7 @@ TokenList SqliteCreateTable::Column::Constraint::rebuildTokensFromContents() { builder.withKeyword("DEFAULT").withSpace(); if (!id.isNull()) - builder.withOther(id, dialect); + builder.withOther(id); else if (!ctime.isNull()) builder.withKeyword(ctime.toUpper()); else if (expr) @@ -760,7 +824,7 @@ TokenList SqliteCreateTable::Column::Constraint::rebuildTokensFromContents() } case SqliteCreateTable::Column::Constraint::COLLATE: { - builder.withKeyword("COLLATE").withSpace().withOther(collationName, dialect); + builder.withKeyword("COLLATE").withSpace().withOther(collationName); break; } case SqliteCreateTable::Column::Constraint::FOREIGN_KEY: @@ -768,6 +832,17 @@ TokenList SqliteCreateTable::Column::Constraint::rebuildTokensFromContents() builder.withStatement(foreignKey); break; } + case SqliteCreateTable::Column::Constraint::GENERATED: + { + if (generatedKw) + builder.withKeyword("GENERATED").withSpace().withKeyword("ALWAYS").withSpace(); + + builder.withKeyword("AS").withSpace().withParLeft().withStatement(expr).withParRight(); + if (generatedType != GeneratedType::null) + builder.withSpace().withOther(toString(generatedType), false); + + break; + } case SqliteCreateTable::Column::Constraint::NULL_: case SqliteCreateTable::Column::Constraint::NAME_ONLY: case SqliteCreateTable::Column::Constraint::DEFERRABLE_ONLY: diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h index 74f4fce..d34688c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h @@ -13,6 +13,7 @@ #include "sqliteddlwithdbcontext.h" #include <QVariant> #include <QList> +#include <QRegExp> class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbContext { @@ -34,16 +35,27 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC DEFAULT, COLLATE, FOREIGN_KEY, + GENERATED, NULL_, // not officially supported NAME_ONLY, // unofficial, because of bizarre sqlite grammar DEFERRABLE_ONLY // unofficial, because of bizarre sqlite grammar }; + enum class GeneratedType + { + STORED, + VIRTUAL, + null + }; + Constraint(); Constraint(const Constraint& other); ~Constraint(); SqliteStatement* clone(); + static QString toString(GeneratedType type); + static GeneratedType generatedTypeFrom(const QString& type); + void initDefNameOnly(const QString& name); void initDefId(const QString& id); void initDefTerm(const QVariant& value, bool minus = false); @@ -59,19 +71,22 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC void initFk(const QString& table, const QList<SqliteIndexedColumn*>& indexedColumns, const QList<SqliteForeignKey::Condition*>& conditions); void initDefer(SqliteInitially initially, SqliteDeferrable deferrable); void initColl(const QString& name); + void initGeneratedAs(SqliteExpr* expr, bool genKw, const QString& type); QString typeString() const; Type type; - QString name = QString::null; + QString name = QString(); SqliteSortOrder sortOrder = SqliteSortOrder::null; SqliteConflictAlgo onConflict = SqliteConflictAlgo::null; bool autoincrKw = false; + bool generatedKw = false; SqliteExpr* expr = nullptr; QVariant literalValue; bool literalNull = false; QString ctime; QString id; - QString collationName = QString::null; + QString collationName = QString(); + GeneratedType generatedType = GeneratedType::null; SqliteForeignKey* foreignKey = nullptr; protected: @@ -96,8 +111,10 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC Constraint* getConstraint(Constraint::Type type) const; QList<Constraint*> getConstraints(Constraint::Type type) const; QList<Constraint*> getForeignKeysByTable(const QString& foreignTable) const; + void fixTypeVsGeneratedAs(); + void evaluatePostParsing(); - QString name = QString::null; + QString name = QString(); SqliteColumnType* type = nullptr; QList<Constraint*> constraints; @@ -106,12 +123,15 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC * Used to remember original name when column was edited and the name was changed. * It's defined in the constructor to the same value as the name member. */ - QString originalName = QString::null; + QString originalName = QString(); protected: QStringList getColumnsInStatement(); TokenList getColumnTokensInStatement(); TokenList rebuildTokensFromContents(); + + private: + static const QRegExp GENERATED_ALWAYS_REGEXP; }; typedef QSharedPointer<Column> ColumnPtr; @@ -149,7 +169,7 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC QString typeString() const; Type type; - QString name = QString::null; + QString name = QString(); bool autoincrKw = false; // not in docs, but needs to be supported SqliteConflictAlgo onConflict = SqliteConflictAlgo::null; SqliteForeignKey* foreignKey = nullptr; @@ -189,12 +209,12 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC bool ifNotExistsKw = false; bool tempKw = false; bool temporaryKw = false; - QString database = QString::null; - QString table = QString::null; + QString database = QString(); + QString table = QString(); QList<Column*> columns; QList<Constraint*> constraints; SqliteSelect* select = nullptr; - QString withOutRowId = QString::null; + QString withOutRowId = QString(); protected: QStringList getTablesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp index 001dd2d..3f2c4e3 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp @@ -126,7 +126,7 @@ QString SqliteCreateTrigger::time(SqliteCreateTrigger::Time eventTime) case SqliteCreateTrigger::Time::null: break; } - return QString::null; + return QString(); } SqliteCreateTrigger::Time SqliteCreateTrigger::time(const QString& eventTime) @@ -154,7 +154,7 @@ QString SqliteCreateTrigger::scopeToString(SqliteCreateTrigger::Scope scope) case SqliteCreateTrigger::Scope::null: break; } - return QString::null; + return QString(); } SqliteCreateTrigger::Scope SqliteCreateTrigger::stringToScope(const QString& scope) @@ -180,18 +180,12 @@ QStringList SqliteCreateTrigger::getDatabasesInStatement() TokenList SqliteCreateTrigger::getTableTokensInStatement() { - if (dialect == Dialect::Sqlite2) - return getObjectTokenListFromNmDbnm("nm2", "dbnm"); - else - return getTokenListFromNamedKey("nm2"); + return getTokenListFromNamedKey("nm2"); } TokenList SqliteCreateTrigger::getDatabaseTokensInStatement() { - if (dialect == Dialect::Sqlite2) - return getDbTokenListFromNmDbnm("nm2", "dbnm"); - else - return getDbTokenListFromNmDbnm(); + return getDbTokenListFromNmDbnm(); } QList<SqliteStatement::FullObject> SqliteCreateTrigger::getFullObjectsInStatement() @@ -200,14 +194,9 @@ QList<SqliteStatement::FullObject> SqliteCreateTrigger::getFullObjectsInStatemen // Table object FullObject fullObj; - if (dialect == Dialect::Sqlite2) - fullObj = getFullObjectFromNmDbnm(FullObject::TABLE, "nm2", "dbnm"); - else - { - TokenList tableTokens = getTokenListFromNamedKey("nm2"); - if (tableTokens.size() > 0) - fullObj = getFullObject(FullObject::TABLE, TokenPtr(), tableTokens[0]); - } + TokenList tableTokens = getTokenListFromNamedKey("nm2"); + if (tableTokens.size() > 0) + fullObj = getFullObject(FullObject::TABLE, TokenPtr(), tableTokens[0]); if (fullObj.isValid()) result << fullObj; @@ -221,14 +210,9 @@ QList<SqliteStatement::FullObject> SqliteCreateTrigger::getFullObjectsInStatemen } // Trigger object - if (dialect == Dialect::Sqlite2) - { - TokenList tableTokens = getTokenListFromNamedKey("nm"); - if (tableTokens.size() > 0) - fullObj = getFullObject(FullObject::TRIGGER, TokenPtr(), tableTokens[0]); - } - else - fullObj = getFullObjectFromNmDbnm(FullObject::TRIGGER, "nm", "dbnm"); + fullObj = getFullObjectFromNmDbnm(FullObject::TRIGGER, "nm", "dbnm"); + if (fullObj.isValid()) + result << fullObj; return result; } @@ -299,7 +283,7 @@ QString SqliteCreateTrigger::Event::typeToString(SqliteCreateTrigger::Event::Typ case SqliteCreateTrigger::Event::null: break; } - return QString::null; + return QString(); } SqliteCreateTrigger::Event::Type SqliteCreateTrigger::Event::stringToType(const QString& type) @@ -333,10 +317,10 @@ TokenList SqliteCreateTrigger::rebuildTokensFromContents() if (ifNotExistsKw) builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace(); - if (dialect == Dialect::Sqlite3 && !database.isNull()) - builder.withOther(database, dialect).withOperator("."); + if (!database.isNull()) + builder.withOther(database).withOperator("."); - builder.withOther(trigger, dialect).withSpace(); + builder.withOther(trigger).withSpace(); switch (eventTime) { case Time::BEFORE: @@ -353,10 +337,7 @@ TokenList SqliteCreateTrigger::rebuildTokensFromContents() } builder.withStatement(event).withSpace().withKeyword("ON").withSpace(); - if (dialect == Dialect::Sqlite2 && !database.isNull()) - builder.withOther(database, dialect).withOperator("."); - - builder.withOther(table, dialect).withSpace(); + builder.withOther(table).withSpace(); switch (scope) { diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h index 2ccf876..ac7b81f 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h @@ -70,10 +70,9 @@ class API_EXPORT SqliteCreateTrigger : public SqliteQuery, public SqliteTableRel bool tempKw = false; bool temporaryKw = false; bool ifNotExistsKw = false; - // The database refers to the trigger name in Sqlite3, but in Sqlite2 it refers to the table. - QString database = QString::null; - QString trigger = QString::null; - QString table = QString::null; // can also be a view name + QString database = QString(); + QString trigger = QString(); + QString table = QString(); // can also be a view name Event* event = nullptr; Time eventTime = Time::null; Scope scope = Scope::null; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp index fe638db..f5b54e7 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp @@ -67,10 +67,7 @@ QStringList SqliteCreateView::getDatabasesInStatement() TokenList SqliteCreateView::getDatabaseTokensInStatement() { - if (dialect == Dialect::Sqlite3) - return getDbTokenListFromFullname(); - else - return TokenList(); + return getDbTokenListFromFullname(); } QList<SqliteStatement::FullObject> SqliteCreateView::getFullObjectsInStatement() @@ -78,28 +75,17 @@ QList<SqliteStatement::FullObject> SqliteCreateView::getFullObjectsInStatement() QList<FullObject> result; // View object - FullObject fullObj; - if (dialect == Dialect::Sqlite3) - fullObj = getFullObjectFromFullname(FullObject::VIEW); - else - { - TokenList tokens = getTokenListFromNamedKey("nm"); - if (tokens.size() > 0) - fullObj = getFullObject(FullObject::VIEW, TokenPtr(), tokens[0]); - } + FullObject fullObj = getFullObjectFromFullname(FullObject::VIEW); if (fullObj.isValid()) result << fullObj; // Db object - if (dialect == Dialect::Sqlite3) + fullObj = getFirstDbFullObject(); + if (fullObj.isValid()) { - fullObj = getFirstDbFullObject(); - if (fullObj.isValid()) - { - result << fullObj; - dbTokenForFullObjects = fullObj.database; - } + result << fullObj; + dbTokenForFullObjects = fullObj.database; } return result; @@ -119,10 +105,10 @@ TokenList SqliteCreateView::rebuildTokensFromContents() if (ifNotExists) builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace(); - if (dialect == Dialect::Sqlite3 && !database.isNull()) - builder.withOther(database, dialect).withOperator("."); + if (!database.isNull()) + builder.withOther(database).withOperator("."); - builder.withOther(view, dialect).withSpace(); + builder.withOther(view).withSpace(); if (columns.size() > 0) builder.withParLeft().withStatementList<SqliteIndexedColumn>(columns).withParRight().withSpace(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h index 1f46d5e..74f6b91 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h @@ -25,8 +25,8 @@ class API_EXPORT SqliteCreateView : public SqliteQuery, public SqliteDdlWithDbCo bool tempKw = false; bool temporaryKw = false; bool ifNotExists = false; - QString database = QString::null; - QString view = QString::null; + QString database = QString(); + QString view = QString(); SqliteSelect* select = nullptr; QList<SqliteIndexedColumn*> columns; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp index 1d98c8d..3f1639a 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp @@ -97,9 +97,9 @@ TokenList SqliteCreateVirtualTable::rebuildTokensFromContents() builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); - builder.withKeyword("USING").withSpace().withOther(module, dialect); + builder.withKeyword("USING").withSpace().withOther(module); if (!args.isEmpty()) { builder.withSpace(); @@ -109,7 +109,7 @@ TokenList SqliteCreateVirtualTable::rebuildTokensFromContents() if (i > 0) builder.withOperator(",").withSpace(); - builder.withTokens(Lexer::tokenize(arg, Dialect::Sqlite3)); + builder.withTokens(Lexer::tokenize(arg)); i++; } } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h index cb2d231..28f91ce 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h @@ -31,9 +31,9 @@ class API_EXPORT SqliteCreateVirtualTable : public SqliteQuery public: bool ifNotExistsKw = false; - QString database = QString::null; - QString table = QString::null; - QString module = QString::null; + QString database = QString(); + QString table = QString(); + QString module = QString(); QList<QString> args; }; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp index 4ef4d51..50b7de2 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp @@ -11,7 +11,7 @@ QString sqliteDeferrable(SqliteDeferrable deferrable) case SqliteDeferrable::null: break; } - return QString::null; + return QString(); } SqliteDeferrable sqliteDeferrable(const QString& deferrable) @@ -38,7 +38,7 @@ QString sqliteInitially(SqliteInitially initially) case SqliteInitially::null: break; } - return QString::null; + return QString(); } SqliteInitially sqliteInitially(const QString& initially) diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp index 6026de3..dd4d7cb 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp @@ -119,12 +119,12 @@ TokenList SqliteDelete::rebuildTokensFromContents() builder.withKeyword("DELETE").withSpace().withKeyword("FROM").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); - builder.withOther(table, dialect); + builder.withOther(table); if (indexedByKw) - builder.withSpace().withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy, dialect); + builder.withSpace().withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy); else if (notIndexedKw) builder.withSpace().withKeyword("NOT").withSpace().withKeyword("INDEXED"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h index 90e1385..5d24619 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h @@ -31,11 +31,11 @@ class API_EXPORT SqliteDelete : public SqliteQuery void init(const QString& name1, const QString& name2, SqliteExpr* where, SqliteWith* with); public: - QString database = QString::null; - QString table = QString::null; + QString database = QString(); + QString table = QString(); bool indexedByKw = false; bool notIndexedKw = false; - QString indexedBy = QString::null; + QString indexedBy = QString(); SqliteExpr* where = nullptr; SqliteWith* with = nullptr; }; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp index 2e39312..8d5f878 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp @@ -70,7 +70,7 @@ TokenList SqliteDropIndex::rebuildTokensFromContents() builder.withKeyword("IF").withSpace().withKeyword("EXISTS").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); builder.withOther(index).withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h index 9ce7065..4f4364a 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h @@ -14,8 +14,8 @@ class API_EXPORT SqliteDropIndex : public SqliteQuery SqliteStatement* clone(); bool ifExistsKw = false; - QString database = QString::null; - QString index = QString::null; + QString database = QString(); + QString index = QString(); protected: QStringList getDatabasesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp index c4fc02d..f567cc0 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp @@ -78,7 +78,7 @@ TokenList SqliteDropTable::rebuildTokensFromContents() builder.withKeyword("IF").withSpace().withKeyword("EXISTS").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); builder.withOther(table).withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h index edc4da4..58706b2 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h @@ -14,8 +14,8 @@ class API_EXPORT SqliteDropTable : public SqliteQuery SqliteStatement* clone(); bool ifExistsKw = false; - QString database = QString::null; - QString table = QString::null; + QString database = QString(); + QString table = QString(); protected: QStringList getTablesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp index 8921af3..9794ed4 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp @@ -71,7 +71,7 @@ TokenList SqliteDropTrigger::rebuildTokensFromContents() builder.withKeyword("IF").withSpace().withKeyword("EXISTS").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); builder.withOther(trigger).withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h index 5221959..316af98 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h @@ -14,8 +14,8 @@ class API_EXPORT SqliteDropTrigger : public SqliteQuery SqliteStatement* clone(); bool ifExistsKw = false; - QString database = QString::null; - QString trigger = QString::null; + QString database = QString(); + QString trigger = QString(); protected: QStringList getDatabasesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp index b992e98..423b1da 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp @@ -34,17 +34,11 @@ SqliteStatement*SqliteDropView::clone() QStringList SqliteDropView::getDatabasesInStatement() { - if (dialect == Dialect::Sqlite2) - return QStringList(); - return getStrListFromValue(database); } TokenList SqliteDropView::getDatabaseTokensInStatement() { - if (dialect == Dialect::Sqlite2) - return TokenList(); - return getDbTokenListFromFullname(); } @@ -77,7 +71,7 @@ TokenList SqliteDropView::rebuildTokensFromContents() builder.withKeyword("IF").withSpace().withKeyword("EXISTS").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); builder.withOther(view).withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h index 853ccef..2f0882c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h @@ -14,8 +14,8 @@ class API_EXPORT SqliteDropView : public SqliteQuery SqliteStatement* clone(); bool ifExistsKw = false; - QString database = QString::null; - QString view = QString::null; + QString database = QString(); + QString view = QString(); protected: QStringList getDatabasesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp index d17205a..e2c79ea 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp @@ -2,6 +2,7 @@ #include "sqliteraise.h" #include "sqliteselect.h" #include "sqlitecolumntype.h" +#include "sqlitefilterover.h" #include "parser/statementtokenbuilder.h" #include "common/utils_sql.h" #include "common/global.h" @@ -25,6 +26,7 @@ SqliteExpr::SqliteExpr(const SqliteExpr& other) : DEEP_COPY_COLLECTION(SqliteExpr, exprList); DEEP_COPY_FIELD(SqliteSelect, select); DEEP_COPY_FIELD(SqliteRaise, raiseFunction); + DEEP_COPY_FIELD(SqliteFilterOver, filterOver); } SqliteExpr::~SqliteExpr() @@ -59,7 +61,7 @@ QString SqliteExpr::likeOp(SqliteExpr::LikeOp value) case SqliteExpr::LikeOp::MATCH: return "MATCH"; default: - return QString::null; + return QString(); } } @@ -87,7 +89,7 @@ QString SqliteExpr::notNullOp(SqliteExpr::NotNull value) case SqliteExpr::NotNull::NOTNULL: return "NOTNULL"; default: - return QString::null; + return QString(); } } @@ -168,10 +170,7 @@ void SqliteExpr::initFunction(const QString& fnName, int distinct, const QList<S mode = SqliteExpr::Mode::FUNCTION; function = fnName; this->exprList = exprList; - if (distinct == 1) - distinctKw = true; - else if (distinct == 2) - allKw = true; + initDistinct(distinct); for (SqliteExpr* expr : exprList) expr->setParent(this); @@ -184,6 +183,32 @@ void SqliteExpr::initFunction(const QString& fnName, bool star) this->star = star; } +void SqliteExpr::initWindowFunction(const QString& fnName, int distinct, const QList<SqliteExpr*>& exprList, SqliteFilterOver* filterOver) +{ + mode = SqliteExpr::Mode::WINDOW_FUNCTION; + this->function = fnName; + this->exprList = exprList; + initDistinct(distinct); + this->filterOver = filterOver; + + for (SqliteExpr* expr : exprList) + expr->setParent(this); + + if (filterOver) + filterOver->setParent(this); +} + +void SqliteExpr::initWindowFunction(const QString& fnName, SqliteFilterOver* filterOver) +{ + mode = SqliteExpr::Mode::WINDOW_FUNCTION; + this->function = fnName; + this->star = true; + this->filterOver = filterOver; + + if (filterOver) + filterOver->setParent(this); +} + void SqliteExpr::initBinOp(SqliteExpr *expr1, const QString& op, SqliteExpr *expr2) { mode = SqliteExpr::Mode::BINARY_OP; @@ -363,6 +388,36 @@ void SqliteExpr::detectDoubleQuotes(bool recursively) } } +bool SqliteExpr::replace(SqliteExpr* toBeReplaced, SqliteExpr* replaceWith) +{ + if (expr1 == toBeReplaced) + { + expr1 = replaceWith; + return true; + } + + if (expr2 == toBeReplaced) + { + expr2 = replaceWith; + return true; + } + + if (expr3 == toBeReplaced) + { + expr3 = replaceWith; + return true; + } + + int idx = exprList.indexOf(toBeReplaced); + if (idx > -1) + { + exprList.replace(idx, replaceWith); + return true; + } + + return false; +} + QStringList SqliteExpr::getColumnsInStatement() { return getStrListFromValue(column); @@ -498,6 +553,8 @@ TokenList SqliteExpr::rebuildTokensFromContents() builder.withOther(function).withParLeft(); if (distinctKw) builder.withKeyword("DISTINCT"); + else if (allKw) + builder.withKeyword("DISTINCT"); if (star) builder.withOperator("*").withParRight(); @@ -505,6 +562,20 @@ TokenList SqliteExpr::rebuildTokensFromContents() builder.withStatementList(exprList).withParRight(); break; + case SqliteExpr::Mode::WINDOW_FUNCTION: + builder.withOther(function).withParLeft(); + if (distinctKw) + builder.withKeyword("DISTINCT"); + else if (allKw) + builder.withKeyword("DISTINCT"); + + if (star) + builder.withOperator("*").withParRight(); + else + builder.withStatementList(exprList).withParRight(); + + builder.withSpace().withStatement(filterOver); + break; case SqliteExpr::Mode::SUB_EXPR: builder.withParLeft().withStatement(expr1).withParRight(); break; @@ -513,7 +584,7 @@ TokenList SqliteExpr::rebuildTokensFromContents() .withStatement(columnType).withParRight(); break; case SqliteExpr::Mode::COLLATE: - builder.withStatement(expr1).withSpace().withKeyword("COLLATE").withSpace().withOther(collation, dialect); + builder.withStatement(expr1).withSpace().withKeyword("COLLATE").withSpace().withOther(collation); break; case SqliteExpr::Mode::LIKE: builder.withTokens(rebuildLike()); @@ -562,15 +633,15 @@ TokenList SqliteExpr::rebuildId() { StatementTokenBuilder builder; if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); if (!table.isNull()) - builder.withOther(table, dialect).withOperator("."); + builder.withOther(table).withOperator("."); if (table.isNull() && possibleDoubleQuotedString) - builder.withStringPossiblyOther(column, dialect); + builder.withStringPossiblyOther(column); else - builder.withOther(column, dialect); + builder.withOther(column); return builder.build(); } @@ -652,9 +723,9 @@ TokenList SqliteExpr::rebuildIn() else { if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); - builder.withOther(table, dialect); + builder.withOther(table); } return builder.build(); } @@ -686,3 +757,11 @@ TokenList SqliteExpr::rebuildCase() builder.withKeyword("END"); return builder.build(); } + +void SqliteExpr::initDistinct(int distinct) +{ + if (distinct == 1) + distinctKw = true; + else if (distinct == 2) + allKw = true; +} diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h index c65a8e2..ef4c7da 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h @@ -6,6 +6,7 @@ #include <QVariant> #include <QList> +class SqliteFilterOver; class SqliteSelect; class SqliteColumnType; class SqliteRaise; @@ -26,7 +27,7 @@ class API_EXPORT SqliteExpr : public SqliteStatement SUB_EXPR, ROW_VALUE, CAST, - COLLATE, // in Sqlite2 exists only in expr of sortlist + COLLATE, LIKE, NULL_, NOTNULL, @@ -36,7 +37,8 @@ class API_EXPORT SqliteExpr : public SqliteStatement EXISTS, CASE, SUB_SELECT, - RAISE + RAISE, + WINDOW_FUNCTION }; enum class NotNull @@ -79,6 +81,8 @@ class API_EXPORT SqliteExpr : public SqliteStatement void initCast(SqliteExpr* expr, SqliteColumnType* type); void initFunction(const QString& fnName, int distinct, const QList<SqliteExpr*>& exprList); void initFunction(const QString& fnName, bool star = false); + void initWindowFunction(const QString& fnName, int distinct, const QList<SqliteExpr*>& exprList, SqliteFilterOver* filterOver); + void initWindowFunction(const QString& fnName, SqliteFilterOver* filterOver); void initBinOp(SqliteExpr* expr1, const QString& op, SqliteExpr* expr2); void initUnaryOp(SqliteExpr* expr, const QString& op); void initLike(SqliteExpr* expr1, bool notKw, SqliteExpr::LikeOp likeOp, SqliteExpr* expr2, SqliteExpr* expr3 = nullptr); @@ -91,27 +95,29 @@ class API_EXPORT SqliteExpr : public SqliteStatement void initExists(SqliteSelect* select); void initSubSelect(SqliteSelect* select); void initCase(SqliteExpr* expr1, const QList<SqliteExpr*>& exprList, SqliteExpr* expr2); - void initRaise(const QString& type, const QString& text = QString::null); + void initRaise(const QString& type, const QString& text = QString()); void detectDoubleQuotes(bool recursively = true); + bool replace(SqliteExpr* toBeReplaced, SqliteExpr* replaceWith); Mode mode = Mode::null; QVariant literalValue = QVariant(); bool literalNull = false; - QString bindParam = QString::null; - QString database = QString::null; - QString table = QString::null; - QString column = QString::null; - QString unaryOp = QString::null; - QString binaryOp = QString::null; - QString function = QString::null; - QString collation = QString::null; - QString ctime = QString::null; + QString bindParam = QString(); + QString database = QString(); + QString table = QString(); + QString column = QString(); + QString unaryOp = QString(); + QString binaryOp = QString(); + QString function = QString(); + QString collation = QString(); + QString ctime = QString(); SqliteColumnType* columnType = nullptr; SqliteExpr* expr1 = nullptr; SqliteExpr* expr2 = nullptr; SqliteExpr* expr3 = nullptr; QList<SqliteExpr*> exprList; SqliteSelect* select = nullptr; + SqliteFilterOver* filterOver = nullptr; bool distinctKw = false; bool allKw = false; // alias for DISTINCT as for sqlite3 grammar bool star = false; @@ -141,6 +147,7 @@ class API_EXPORT SqliteExpr : public SqliteStatement TokenList rebuildBetween(); TokenList rebuildIn(); TokenList rebuildCase(); + void initDistinct(int distinct); }; typedef QSharedPointer<SqliteExpr> SqliteExprPtr; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.cpp new file mode 100644 index 0000000..08b4f88 --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.cpp @@ -0,0 +1,138 @@ +#include "sqlitefilterover.h" +#include "sqliteexpr.h" +#include "parser/statementtokenbuilder.h" +#include "common/global.h" + +SqliteFilterOver::SqliteFilterOver() +{ + +} + +SqliteFilterOver::~SqliteFilterOver() +{ +} + +SqliteFilterOver::SqliteFilterOver(const SqliteFilterOver& other) : + SqliteStatement(other) +{ + DEEP_COPY_FIELD(Filter, filter); + DEEP_COPY_FIELD(Over, over); +} + +SqliteFilterOver::SqliteFilterOver(SqliteFilterOver::Filter* filter, SqliteFilterOver::Over* over) +{ + this->filter = filter; + this->over = over; + + if (filter) + filter->setParent(this); + + if (over) + over->setParent(this); +} + +SqliteStatement* SqliteFilterOver::clone() +{ + return new SqliteFilterOver(*this); +} + +TokenList SqliteFilterOver::rebuildTokensFromContents() +{ + StatementTokenBuilder builder; + + if (filter) + builder.withStatement(filter); + + if (filter || over) + builder.withSpace(); + + if (over) + builder.withStatement(over); + + return builder.build(); +} + +SqliteFilterOver::Over::Over() +{ +} + +SqliteFilterOver::Over::Over(const SqliteFilterOver::Over& other) : + SqliteStatement(other), name(other.name), mode(other.mode) +{ + DEEP_COPY_FIELD(SqliteWindowDefinition::Window, window); +} + +SqliteFilterOver::Over::~Over() +{ +} + +SqliteFilterOver::Over::Over(SqliteWindowDefinition::Window* window) +{ + this->mode = Mode::WINDOW; + this->window = window; + if (window) + window->setParent(this); +} + +SqliteFilterOver::Over::Over(const QString& name) +{ + this->mode = Mode::NAME; + this->name = name; +} + +SqliteStatement* SqliteFilterOver::Over::clone() +{ + return new SqliteFilterOver::Over(*this); +} + +TokenList SqliteFilterOver::Over::rebuildTokensFromContents() +{ + StatementTokenBuilder builder; + + builder.withKeyword("OVER").withSpace(); + + switch (mode) + { + case SqliteFilterOver::Over::Mode::WINDOW: + builder.withParLeft().withStatement(window).withParRight(); + break; + case SqliteFilterOver::Over::Mode::NAME: + builder.withOther(name); + break; + } + + return builder.build(); +} + + +SqliteFilterOver::Filter::Filter(SqliteExpr* expr) +{ + this->expr = expr; + if (expr) + expr->setParent(this); +} + +SqliteFilterOver::Filter::Filter(const SqliteFilterOver::Filter& other) : + SqliteStatement(other) +{ + DEEP_COPY_FIELD(SqliteExpr, expr); +} + +SqliteStatement* SqliteFilterOver::Filter::clone() +{ + return new SqliteFilterOver::Filter(*this); +} + +TokenList SqliteFilterOver::Filter::rebuildTokensFromContents() +{ + StatementTokenBuilder builder; + + builder.withKeyword("FILTER").withSpace().withParLeft().withKeyword("WHERE").withSpace().withStatement(expr).withParRight(); + + return builder.build(); +} + + +SqliteFilterOver::Filter::~Filter() +{ +} diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.h new file mode 100644 index 0000000..3f023d9 --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.h @@ -0,0 +1,65 @@ +#ifndef SQLITEFILTEROVER_H +#define SQLITEFILTEROVER_H + +#include "sqlitestatement.h" +#include "sqlitewindowdefinition.h" + +class SqliteFilterOver : public SqliteStatement +{ + public: + class Over : public SqliteStatement + { + public: + enum class Mode + { + WINDOW, + NAME + }; + + Over(); + Over(const Over& other); + ~Over(); + Over(SqliteWindowDefinition::Window* window); + Over(const QString& name); + + SqliteStatement* clone(); + + SqliteWindowDefinition::Window* window = nullptr; + QString name = QString(); + Mode mode = Mode::WINDOW; + + protected: + TokenList rebuildTokensFromContents(); + }; + + class Filter : public SqliteStatement + { + public: + Filter(); + Filter(const Filter& other); + ~Filter(); + Filter(SqliteExpr* expr); + + SqliteStatement* clone(); + + SqliteExpr* expr; + + protected: + TokenList rebuildTokensFromContents(); + }; + + SqliteFilterOver(); + ~SqliteFilterOver(); + SqliteFilterOver(const SqliteFilterOver& other); + SqliteFilterOver(Filter* filter, Over* over); + + SqliteStatement* clone(); + + Filter* filter = nullptr; + Over* over = nullptr; + + protected: + TokenList rebuildTokensFromContents(); +}; + +#endif // SQLITEFILTEROVER_H diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp index 9a29db2..9bfd56c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp @@ -35,7 +35,7 @@ QString SqliteForeignKey::Condition::toString(SqliteForeignKey::Condition::React case SqliteForeignKey::Condition::NO_ACTION: return "NO ACTION"; } - return QString::null; + return QString(); } SqliteForeignKey::Condition::Reaction SqliteForeignKey::Condition::toEnum(const QString& reaction) @@ -115,7 +115,7 @@ TokenList SqliteForeignKey::rebuildTokensFromContents() { StatementTokenBuilder builder; - builder.withKeyword("REFERENCES").withSpace().withOther(foreignTable, dialect); + builder.withKeyword("REFERENCES").withSpace().withOther(foreignTable); if (indexedColumns.size() > 0) builder.withSpace().withParLeft().withStatementList(indexedColumns).withParRight(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h index 18e0bcb..62dd84d 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h @@ -41,7 +41,7 @@ class API_EXPORT SqliteForeignKey : public SqliteStatement SqliteStatement* clone(); Action action; - QString name = QString::null; + QString name = QString(); Reaction reaction = NO_ACTION; protected: @@ -57,7 +57,7 @@ class API_EXPORT SqliteForeignKey : public SqliteStatement SqliteStatement* clone(); - QString foreignTable = QString::null; + QString foreignTable = QString(); QList<SqliteIndexedColumn*> indexedColumns; QList<Condition*> conditions; SqliteDeferrable deferrable = SqliteDeferrable::null; // Those two are for table constraint only, diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp index 142af06..54ebc89 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp @@ -58,9 +58,9 @@ TokenList SqliteIndexedColumn::getColumnTokensInStatement() TokenList SqliteIndexedColumn::rebuildTokensFromContents() { StatementTokenBuilder builder; - builder.withOther(name, dialect); + builder.withOther(name); if (!collate.isNull()) - builder.withSpace().withKeyword("COLLATE").withSpace().withOther(collate, dialect); + builder.withSpace().withKeyword("COLLATE").withSpace().withOther(collate); builder.withSortOrder(sortOrder); return builder.build(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h index c0fe680..34cf4a4 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h @@ -21,9 +21,9 @@ class API_EXPORT SqliteIndexedColumn : public SqliteStatement, public SqliteExte QString getCollation() const; void clearCollation(); - QString name = QString::null; + QString name = QString(); SqliteSortOrder sortOrder = SqliteSortOrder::null; - QString collate = QString::null; + QString collate = QString(); protected: QStringList getColumnsInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp index e48cffb..906b385 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp @@ -191,9 +191,9 @@ TokenList SqliteInsert::rebuildTokensFromContents() builder.withKeyword("INTO").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); - builder.withOther(table, dialect).withSpace(); + builder.withOther(table).withSpace(); if (defaultValuesKw) { @@ -202,7 +202,7 @@ TokenList SqliteInsert::rebuildTokensFromContents() else { if (columnNames.size() > 0) - builder.withParLeft().withOtherList(columnNames, dialect).withParRight().withSpace(); + builder.withParLeft().withOtherList(columnNames).withParRight().withSpace(); if (select) { @@ -210,10 +210,6 @@ TokenList SqliteInsert::rebuildTokensFromContents() if (upsert) builder.withSpace().withStatement(upsert); } - else if (dialect == Dialect::Sqlite2) // Sqlite2 uses classic single row values - { - builder.withKeyword("VALUES").withSpace().withParLeft().withStatementList(values).withParRight(); - } } builder.withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h index 2ee4965..40581cd 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h @@ -45,8 +45,8 @@ class API_EXPORT SqliteInsert : public SqliteQuery bool replaceKw = false; bool defaultValuesKw = false; SqliteConflictAlgo onConflict = SqliteConflictAlgo::null; - QString database = QString::null; - QString table = QString::null; + QString database = QString(); + QString table = QString(); QStringList columnNames; QList<SqliteExpr*> values; SqliteSelect* select = nullptr; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.cpp new file mode 100644 index 0000000..46102a9 --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.cpp @@ -0,0 +1,26 @@ +#include "sqlitenulls.h" + + +SqliteNulls sqliteNulls(const QString& value) +{ + if (value == "NULLS FIRST") + return SqliteNulls::FIRST; + else if (value == "NULLS LAST") + return SqliteNulls::LAST; + else + return SqliteNulls::null; +} + +QString sqliteNulls(SqliteNulls value) +{ + switch (value) + { + case SqliteNulls::FIRST: + return "FIRST"; + case SqliteNulls::LAST: + return "LAST"; + case SqliteNulls::null: + break; + } + return QString(); +} diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.h new file mode 100644 index 0000000..3553eae --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.h @@ -0,0 +1,17 @@ +#ifndef SQLITENULLS_H +#define SQLITENULLS_H + +#include "coreSQLiteStudio_global.h" +#include <QString> + +enum class SqliteNulls +{ + FIRST, + LAST, + null +}; + +API_EXPORT SqliteNulls sqliteNulls(const QString& value); +API_EXPORT QString sqliteNulls(SqliteNulls value); + +#endif // SQLITENULLS_H diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp index 8eb7b46..732c0a2 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp @@ -2,21 +2,23 @@ #include "sqliteexpr.h" #include "parser/statementtokenbuilder.h" #include "common/global.h" +#include <QDebug> SqliteOrderBy::SqliteOrderBy() { } SqliteOrderBy::SqliteOrderBy(const SqliteOrderBy& other) : - SqliteStatement(other), order(other.order) + SqliteStatement(other), order(other.order), nulls(other.nulls) { DEEP_COPY_FIELD(SqliteExpr, expr); } -SqliteOrderBy::SqliteOrderBy(SqliteExpr *expr, SqliteSortOrder order) +SqliteOrderBy::SqliteOrderBy(SqliteExpr *expr, SqliteSortOrder order, SqliteNulls nulls) { this->expr = expr; this->order = order; + this->nulls = nulls; if (expr) expr->setParent(this); } @@ -44,7 +46,7 @@ QString SqliteOrderBy::getColumnName() const return expr->column; if (expr->mode == SqliteExpr::Mode::COLLATE && expr->expr1 && expr->expr1->mode == SqliteExpr::Mode::ID) - return expr->expr1->literalValue.toString(); + return expr->expr1->column; return QString(); } @@ -107,9 +109,66 @@ TokenList SqliteOrderBy::rebuildTokensFromContents() if (order != SqliteSortOrder::null) builder.withSpace().withKeyword(sqliteSortOrder(order)); + if (nulls != SqliteNulls::null) + builder.withSpace().withKeyword("NULLS").withSpace().withKeyword(sqliteNulls(nulls)); + return builder.build(); } +void SqliteOrderBy::evaluatePostParsing() +{ + pullLastCollationAsOuterExpr(); +} + +void SqliteOrderBy::pullLastCollationAsOuterExpr() +{ + /* + * If the order statement is like: columnName + 2 COLLATE BINARY ASC + * then the COLLATE is associated with the "2" subexpr, instead of the most outer expr. + * Looks like SQLite's parser does the same, but they don't care about the depth as we do here. + * Therefore if we idenfity this case, we need to pull the inner expr to outside. + */ + TokenPtr collateToken = expr->tokens.findLast(Token::KEYWORD, "COLLATE", Qt::CaseInsensitive); + if (collateToken.isNull()) + return; + + int lastCollateIdx = expr->tokens.indexOf(collateToken); + if (expr->tokens.mid(lastCollateIdx).filterWhiteSpaces().size() != 2) + return; + + // This is the case. We need to pull the expr to the top level. + SqliteStatement* stmt = expr->findStatementWithToken(collateToken); + SqliteExpr* collateExpr = dynamic_cast<SqliteExpr*>(stmt); + if (!collateExpr) + { + qCritical() << "Could not cast statement to SqliteExpr, even though it's identified as COLLATE expr. The actual contents:" + << collateExpr->detokenize(); + return; + } + + if (collateExpr == expr) + return; // it's already the top-level expr, we're fine. + + SqliteExpr* parentExpr = dynamic_cast<SqliteExpr*>(collateExpr->parentStatement()); + if (!parentExpr) + { + qCritical() << "Could not cast parent statement to SqliteExpr, even though parent of COLLATE should be another expr at this stage." + << "The qobject type of parent:" << collateExpr->parentStatement()->metaObject()->className(); + return; + } + + // Take out COLLATE from its current place + collateExpr->expr1->setParent(parentExpr); // New parent of COLLATE's expr is now parent of COLLATE + parentExpr->replace(collateExpr, collateExpr->expr1); // New child expr of COLLATE's parent is now child of COLLATE + + // Put it at top level + collateExpr->expr1 = expr; // COLLATE's child is set to the old top level expr + expr->setParent(collateExpr); // Old top level expr gets COLLATE as parent + expr = collateExpr; // New top level is now COLLATE + collateExpr->setParent(this); // COLLATE's new parent is this + + rebuildTokens(); +} void SqliteOrderBy::clearCollation() { diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h index 4f75c78..4f05d50 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h @@ -3,6 +3,7 @@ #include "sqlitestatement.h" #include "sqlitesortorder.h" +#include "sqlitenulls.h" #include "sqliteextendedindexedcolumn.h" class SqliteExpr; @@ -12,7 +13,7 @@ class API_EXPORT SqliteOrderBy : public SqliteStatement, public SqliteExtendedIn public: SqliteOrderBy(); SqliteOrderBy(const SqliteOrderBy& other); - SqliteOrderBy(SqliteExpr* expr, SqliteSortOrder order); + SqliteOrderBy(SqliteExpr* expr, SqliteSortOrder order, SqliteNulls nulls); ~SqliteOrderBy(); SqliteStatement* clone(); @@ -26,9 +27,14 @@ class API_EXPORT SqliteOrderBy : public SqliteStatement, public SqliteExtendedIn SqliteExpr* expr = nullptr; SqliteSortOrder order = SqliteSortOrder::null; + SqliteNulls nulls = SqliteNulls::null; protected: TokenList rebuildTokensFromContents(); + void evaluatePostParsing(); + + private: + void pullLastCollationAsOuterExpr(); }; typedef QSharedPointer<SqliteOrderBy> SqliteOrderByPtr; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp index 4660e4f..4d13d36 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp @@ -53,7 +53,7 @@ QStringList SqlitePragma::getDatabasesInStatement() TokenList SqlitePragma::getDatabaseTokensInStatement() { - if (dialect == Dialect::Sqlite2 || database.isNull()) + if (database.isNull()) return TokenList(); return getTokenListFromNamedKey("nm"); @@ -62,7 +62,7 @@ TokenList SqlitePragma::getDatabaseTokensInStatement() QList<SqliteStatement::FullObject> SqlitePragma::getFullObjectsInStatement() { QList<FullObject> result; - if (dialect == Dialect::Sqlite2 || database.isNull()) + if (database.isNull()) return result; // Db object @@ -94,9 +94,9 @@ TokenList SqlitePragma::rebuildTokensFromContents() builder.withKeyword("PRAGMA").withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); - builder.withOther(pragmaName, dialect); + builder.withOther(pragmaName); if (equalsOp) builder.withSpace().withOperator("=").withSpace().withLiteralValue(value); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h index 364a16f..8d75ae4 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h @@ -29,8 +29,8 @@ class API_EXPORT SqlitePragma : public SqliteQuery void initName(const QString& name1, const QString& name2); public: - QString database = QString::null; - QString pragmaName = QString::null; + QString database = QString(); + QString pragmaName = QString(); QVariant value = QVariant(); bool equalsOp = false; bool parenthesis = false; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp index c369e0e..1c04ca6 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp @@ -61,6 +61,44 @@ QString sqliteQueryTypeToString(const SqliteQueryType& type) case SqliteQueryType::Vacuum: return "Vacuum"; default: - return QString::null; + return QString(); + } +} + +bool isDataReturningQuery(const SqliteQueryType& type) +{ + switch (type) + { + case SqliteQueryType::Select: + case SqliteQueryType::Pragma: + return true; + case SqliteQueryType::UNDEFINED: + case SqliteQueryType::EMPTY: + case SqliteQueryType::AlterTable: + case SqliteQueryType::Analyze: + case SqliteQueryType::Attach: + case SqliteQueryType::BeginTrans: + case SqliteQueryType::CommitTrans: + case SqliteQueryType::Copy: + case SqliteQueryType::CreateIndex: + case SqliteQueryType::CreateTable: + case SqliteQueryType::CreateTrigger: + case SqliteQueryType::CreateView: + case SqliteQueryType::CreateVirtualTable: + case SqliteQueryType::Delete: + case SqliteQueryType::Detach: + case SqliteQueryType::DropIndex: + case SqliteQueryType::DropTable: + case SqliteQueryType::DropTrigger: + case SqliteQueryType::DropView: + case SqliteQueryType::Insert: + case SqliteQueryType::Reindex: + case SqliteQueryType::Release: + case SqliteQueryType::Rollback: + case SqliteQueryType::Savepoint: + case SqliteQueryType::Update: + case SqliteQueryType::Vacuum: + default: + return false; } } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h index 763fcfa..9326bf4 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h @@ -37,5 +37,6 @@ enum class SqliteQueryType }; QString API_EXPORT sqliteQueryTypeToString(const SqliteQueryType& type); +bool API_EXPORT isDataReturningQuery(const SqliteQueryType& type); #endif // SQLITEQUERYTYPE_H diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp index b606baa..1e385b9 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp @@ -54,7 +54,7 @@ QString SqliteRaise::raiseType(SqliteRaise::Type value) case SqliteRaise::Type::FAIL: return "FAIL"; default: - return QString::null; + return QString(); } } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h index 1b844f8..2330867 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h @@ -27,7 +27,7 @@ class API_EXPORT SqliteRaise : public SqliteStatement static QString raiseType(Type value); Type type = Type::null; - QString message = QString::null; + QString message = QString(); protected: TokenList rebuildTokensFromContents(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp index 6f863f9..daf8893 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp @@ -74,7 +74,7 @@ TokenList SqliteReindex::rebuildTokensFromContents() builder.withTokens(SqliteQuery::rebuildTokensFromContents()); builder.withKeyword("REINDEX"); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); builder.withOther(table).withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h index 642b5bf..2fe05d5 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h @@ -14,8 +14,8 @@ class API_EXPORT SqliteReindex : public SqliteQuery SqliteStatement* clone(); - QString database = QString::null; - QString table = QString::null; + QString database = QString(); + QString table = QString(); protected: QStringList getTablesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp index f71d61c..8eb53c0 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp @@ -33,7 +33,7 @@ TokenList SqliteRelease::rebuildTokensFromContents() if (savepointKw) builder.withKeyword("SAVEPOINT").withSpace(); - builder.withOther(name, dialect).withOperator(";"); + builder.withOther(name).withOperator(";"); return builder.build(); } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h index d115669..64008f3 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h @@ -14,7 +14,7 @@ class API_EXPORT SqliteRelease : public SqliteQuery SqliteStatement* clone(); - QString name = QString::null; + QString name = QString(); bool savepointKw = false; protected: diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp index b21b6ae..3af6b8c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp @@ -50,7 +50,7 @@ TokenList SqliteRollback::rebuildTokensFromContents() if (savepointKw) builder.withKeyword("SAVEPOINT").withSpace(); - builder.withOther(name, dialect); + builder.withOther(name); } builder.withOperator(";"); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h index 1dc1574..6adc4c0 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h @@ -17,7 +17,7 @@ class API_EXPORT SqliteRollback : public SqliteQuery bool transactionKw = false; bool toKw = false; bool savepointKw = false; - QString name = QString::null; + QString name = QString(); protected: TokenList rebuildTokensFromContents(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp index 1ac50cd..e7bd451 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp @@ -28,6 +28,6 @@ TokenList SqliteSavepoint::rebuildTokensFromContents() { StatementTokenBuilder builder; builder.withTokens(SqliteQuery::rebuildTokensFromContents()); - builder.withKeyword("SAVEPOINT").withSpace().withOther(name, dialect).withOperator(";"); + builder.withKeyword("SAVEPOINT").withSpace().withOther(name).withOperator(";"); return builder.build(); } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h index bd75c76..f1ec356 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h @@ -14,7 +14,7 @@ class API_EXPORT SqliteSavepoint : public SqliteQuery SqliteStatement* clone(); - QString name = QString::null; + QString name = QString(); protected: TokenList rebuildTokensFromContents(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp index 8038cb6..e0439d2 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp @@ -3,6 +3,7 @@ #include "parser/statementtokenbuilder.h" #include "common/global.h" #include "sqlitewith.h" +#include "sqlitewindowdefinition.h" #include <QSet> SqliteSelect::SqliteSelect() @@ -66,7 +67,7 @@ SqliteSelect* SqliteSelect::append(SqliteSelect* select, SqliteSelect::CompoundO resColList.clear(); for (SqliteExpr* value : singleValues) { - resCol = new Core::ResultColumn(value, false, QString::null); + resCol = new Core::ResultColumn(value, false, QString()); value->detectDoubleQuotes(); // invoke explicitly before rebuilding tokens not to lose this information resCol->rebuildTokens(); resCol->setParent(core); @@ -97,7 +98,7 @@ QString SqliteSelect::compoundOperator(SqliteSelect::CompoundOperator op) case SqliteSelect::CompoundOperator::null: break; } - return QString::null; + return QString(); } SqliteSelect::CompoundOperator SqliteSelect::compoundOperator(const QString& op) @@ -142,11 +143,21 @@ SqliteSelect::Core::Core(const SqliteSelect::Core& other) : DEEP_COPY_FIELD(SqliteExpr, where); DEEP_COPY_FIELD(SqliteExpr, having); DEEP_COPY_COLLECTION(SqliteExpr, groupBy); + DEEP_COPY_COLLECTION(SqliteWindowDefinition, windows); DEEP_COPY_COLLECTION(SqliteOrderBy, orderBy); DEEP_COPY_FIELD(SqliteLimit, limit); } -SqliteSelect::Core::Core(int distinct, const QList<ResultColumn *> &resCols, SqliteSelect::Core::JoinSource *src, SqliteExpr *where, const QList<SqliteExpr *> &groupBy, SqliteExpr *having, const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit) +SqliteSelect::Core::Core(int distinct, const QList<ResultColumn*>& resCols, JoinSource* src, + SqliteExpr* where, const QList<SqliteExpr*>& groupBy, SqliteExpr* having, + const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit) : + Core(distinct, resCols, src, where, groupBy, having, QList<SqliteWindowDefinition*>(), orderBy, limit) +{ +} + +SqliteSelect::Core::Core(int distinct, const QList<ResultColumn *> &resCols, JoinSource *src, + SqliteExpr *where, const QList<SqliteExpr *> &groupBy, SqliteExpr *having, const QList<SqliteWindowDefinition*> windows, + const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit) { if (distinct == 1) distinctKw = true; @@ -156,6 +167,7 @@ SqliteSelect::Core::Core(int distinct, const QList<ResultColumn *> &resCols, Sql from = src; this->where = where; this->having = having; + this->windows = windows; this->groupBy = groupBy; resultColumns = resCols; this->limit = limit; @@ -173,6 +185,9 @@ SqliteSelect::Core::Core(int distinct, const QList<ResultColumn *> &resCols, Sql if (limit) limit->setParent(this); + for (SqliteWindowDefinition* win : windows) + win->setParent(this); + for (SqliteOrderBy* order : orderBy) order->setParent(this); @@ -246,7 +261,7 @@ TokenList SqliteSelect::Core::ResultColumn::getTableTokensInStatement() return TokenList(); // Now, we know table was specified - return getTokenListFromNamedKey("nm"); + return getTokenListFromNamedKey("tnm"); } QList<SqliteStatement::FullObject> SqliteSelect::Core::ResultColumn::getFullObjectsInStatement() @@ -574,7 +589,7 @@ TokenList SqliteSelect::Core::ResultColumn::rebuildTokensFromContents() if (star) { if (!table.isNull()) - builder.withOther(table, dialect).withOperator("."); + builder.withOther(table).withOperator("."); builder.withOperator("*"); } @@ -586,7 +601,7 @@ TokenList SqliteSelect::Core::ResultColumn::rebuildTokensFromContents() if (asKw) builder.withSpace().withKeyword("AS"); - builder.withSpace().withOther(alias, dialect); + builder.withSpace().withOther(alias); } } @@ -599,35 +614,35 @@ TokenList SqliteSelect::Core::SingleSource::rebuildTokensFromContents() if (!table.isNull()) { if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); - builder.withOther(table, dialect); + builder.withOther(table); if (!alias.isNull()) { if (asKw) builder.withSpace().withKeyword("AS"); - builder.withSpace().withOther(alias, dialect); + builder.withSpace().withOther(alias); } } else if (!funcName.isNull()) { if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); - builder.withOther(funcName, dialect).withParLeft().withStatementList(funcParams).withParRight(); + builder.withOther(funcName).withParLeft().withStatementList(funcParams).withParRight(); if (!alias.isNull()) { if (asKw) builder.withSpace().withKeyword("AS"); - builder.withSpace().withOther(alias, dialect); + builder.withSpace().withOther(alias); } if (indexedByKw) - builder.withSpace().withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy, dialect); + builder.withSpace().withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy); else if (notIndexedKw) builder.withSpace().withKeyword("NOT").withSpace().withKeyword("INDEXED"); } @@ -639,7 +654,7 @@ TokenList SqliteSelect::Core::SingleSource::rebuildTokensFromContents() if (asKw) builder.withSpace().withKeyword("AS"); - builder.withSpace().withOther(alias, dialect); + builder.withSpace().withOther(alias); } } else @@ -652,46 +667,7 @@ TokenList SqliteSelect::Core::SingleSource::rebuildTokensFromContents() TokenList SqliteSelect::Core::JoinOp::rebuildTokensFromContents() { - switch (dialect) - { - case Dialect::Sqlite3: - return rebuildTokensForSqlite2(); - case Dialect::Sqlite2: - return rebuildTokensForSqlite3(); - } - return TokenList(); -} - -TokenList SqliteSelect::Core::JoinOp::rebuildTokensForSqlite2() -{ - StatementTokenBuilder builder; - if (comma) - { - builder.withOperator(","); - } - else - { - if (naturalKw) - builder.withKeyword("NATURAL").withSpace(); - - if (leftKw) - builder.withKeyword("LEFT").withSpace(); - else if (rightKw) - builder.withKeyword("RIGHT").withSpace(); - else if (fullKw) - builder.withKeyword("FULL").withSpace(); - - if (innerKw) - builder.withKeyword("INNER").withSpace(); - else if (crossKw) - builder.withKeyword("CROSS").withSpace(); - else if (outerKw) - builder.withKeyword("OUTER").withSpace(); - - builder.withKeyword("JOIN"); - } - - return builder.build(); + return rebuildTokensForSqlite3(); } TokenList SqliteSelect::Core::JoinOp::rebuildTokensForSqlite3() @@ -730,7 +706,7 @@ TokenList SqliteSelect::Core::JoinConstraint::rebuildTokensFromContents() if (expr) builder.withKeyword("ON").withStatement(expr); else - builder.withKeyword("USING").withSpace().withParLeft().withOtherList(columnNames, dialect).withParRight(); + builder.withKeyword("USING").withSpace().withParLeft().withOtherList(columnNames).withParRight(); return builder.build(); } @@ -785,6 +761,9 @@ TokenList SqliteSelect::Core::rebuildTokensFromContents() builder.withSpace().withKeyword("HAVING").withStatement(having); } + if (windows.size() > 0) + builder.withSpace().withKeyword("WINDOW").withStatementList(windows); + if (orderBy.size() > 0) builder.withSpace().withKeyword("ORDER").withSpace().withKeyword("BY").withStatementList(orderBy); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h index b6f537d..58babfe 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h @@ -9,6 +9,7 @@ #include <QList> class SqliteWith; +class SqliteWindowDefinition; /** * @addtogroup sqlite_statement @@ -44,8 +45,8 @@ class API_EXPORT SqliteSelect : public SqliteQuery SqliteExpr* expr = nullptr; bool star = false; bool asKw = false; - QString alias = QString::null; - QString table = QString::null; + QString alias = QString(); + QString table = QString(); protected: QStringList getTablesInStatement(); @@ -70,15 +71,15 @@ class API_EXPORT SqliteSelect : public SqliteQuery SqliteStatement* clone(); - QString database = QString::null; - QString table = QString::null; - QString alias = QString::null; - QString funcName = QString::null; + QString database = QString(); + QString table = QString(); + QString alias = QString(); + QString funcName = QString(); QList<SqliteExpr*> funcParams; bool asKw = false; bool indexedByKw = false; bool notIndexedKw = false; - QString indexedBy = QString::null; + QString indexedBy = QString(); SqliteSelect* select = nullptr; JoinSource* joinSource = nullptr; @@ -116,15 +117,14 @@ class API_EXPORT SqliteSelect : public SqliteQuery bool crossKw = false; bool rightKw = false; bool fullKw = false; - QString customKw1 = QString::null; - QString customKw2 = QString::null; - QString customKw3 = QString::null; + QString customKw1 = QString(); + QString customKw2 = QString(); + QString customKw3 = QString(); protected: TokenList rebuildTokensFromContents(); private: - TokenList rebuildTokensForSqlite2(); TokenList rebuildTokensForSqlite3(); }; @@ -185,8 +185,11 @@ class API_EXPORT SqliteSelect : public SqliteQuery Core(); Core(const Core& other); Core(int distinct, const QList<ResultColumn*>& resCols, JoinSource* src, SqliteExpr* where, - const QList<SqliteExpr*>& groupBy, SqliteExpr* having, const QList<SqliteOrderBy*>& orderBy, - SqliteLimit* limit); + const QList<SqliteExpr*>& groupBy, SqliteExpr* having, + const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit); + Core(int distinct, const QList<ResultColumn*>& resCols, JoinSource* src, SqliteExpr* where, + const QList<SqliteExpr*>& groupBy, SqliteExpr* having, const QList<SqliteWindowDefinition*> windows, + const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit); SqliteStatement* clone(); @@ -199,6 +202,7 @@ class API_EXPORT SqliteSelect : public SqliteQuery SqliteExpr* having = nullptr; QList<SqliteExpr*> groupBy; QList<SqliteOrderBy*> orderBy; + QList<SqliteWindowDefinition*> windows; SqliteLimit* limit = nullptr; bool valuesMode = false; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp index 13f3951..eb0ca5c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp @@ -19,7 +19,7 @@ QString sqliteSortOrder(SqliteSortOrder value) case SqliteSortOrder::DESC: return "DESC"; default: - return QString::null; + return QString(); } } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp index 119461a..d349a86 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp @@ -9,7 +9,7 @@ SqliteStatement::SqliteStatement() } SqliteStatement::SqliteStatement(const SqliteStatement& other) : - QObject(), tokens(other.tokens), tokensMap(other.tokensMap), dialect(other.dialect) + QObject(), tokens(other.tokens), tokensMap(other.tokensMap) { } @@ -87,13 +87,6 @@ QList<SqliteStatement::FullObject> SqliteStatement::getContextFullObjects(bool c return fullObjects; } -void SqliteStatement::setSqliteDialect(Dialect dialect) -{ - this->dialect = dialect; - for (SqliteStatement* stmt : childStatements()) - stmt->setSqliteDialect(dialect); -} - SqliteStatementPtr SqliteStatement::detach() { if (!parent()) @@ -537,14 +530,6 @@ void SqliteStatement::rebuildTokens() // and then compare new tokens map with previous one. This way we should be able to get all maps correctly. } -void SqliteStatement::setParent(QObject* parent) -{ - QObject::setParent(parent); - SqliteStatement* stmt = qobject_cast<SqliteStatement*>(parent); - if (stmt) - dialect = stmt->dialect; -} - void SqliteStatement::attach(SqliteStatement*& memberForChild, SqliteStatement* childStatementToAttach) { memberForChild = childStatementToAttach; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h index 779bea3..43a60ba 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h @@ -3,7 +3,6 @@ #include "common/utils.h" #include "parser/token.h" -#include "dialect.h" #include <QList> #include <QHash> #include <QObject> @@ -50,7 +49,7 @@ typedef QSharedPointer<SqliteStatement> SqliteStatementPtr; * * There is also SqliteStatement::tokensMap, which is a table mapping grammar rule name * into tokens used to fulfill that rule. To learn possible keys for each SqliteStatement, - * you have to look into sqlite2.y and sqlite3.y files and see definition of the statement, + * you have to look into sqlite3.y file and see definition of the statement, * that you're examining SqliteStatement::tokensMap for. * * @note SqliteStatement::tokensMap is a low level API and it's not very predictible, @@ -89,7 +88,7 @@ typedef QSharedPointer<SqliteStatement> SqliteStatementPtr; * This is how it's usually done: * @code * // STEP 1 - * Parser parser(db->getDialect()); + * Parser parser; * if (!parser.parse("SELECT column FROM test WHERE value = 5") || parser.getQueries().size() == 0) * { * // handle parsing error, or no queries parsed (which is also some kind of error) @@ -152,7 +151,7 @@ typedef QSharedPointer<SqliteStatement> SqliteStatementPtr; * * Example: * @code - * Parser parser(db->getDialect()); + * Parser parser; * if (!parser.parse("SELECT column FROM test WHERE value = 5") || parser.getQueries().size() == 0) * { * // handle parsing error, or no queries parsed (which is also some kind of error) @@ -222,9 +221,7 @@ class API_EXPORT SqliteStatement : public QObject TokenList getContextTableTokens(bool checkParent = true, bool checkChilds = true); TokenList getContextDatabaseTokens(bool checkParent = true, bool checkChilds = true); QList<FullObject> getContextFullObjects(bool checkParent = true, bool checkChilds = true); - void setSqliteDialect(Dialect dialect); void rebuildTokens(); - void setParent(QObject* parent); void attach(SqliteStatement*& memberForChild, SqliteStatement* childStatementToAttach); SqliteStatementPtr detach(); void processPostParsing(); @@ -284,8 +281,6 @@ class API_EXPORT SqliteStatement : public QObject */ QHash<QString,TokenList> tokensMap; - Dialect dialect = Dialect::Sqlite3; - protected: QStringList getContextColumns(SqliteStatement* caller, bool checkParent, bool checkChilds); QStringList getContextTables(SqliteStatement* caller, bool checkParent, bool checkChilds); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp index 2063e0e..89c8195 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp @@ -26,6 +26,7 @@ SqliteUpdate::SqliteUpdate(const SqliteUpdate& other) : DEEP_COPY_FIELD(SqliteExpr, where); DEEP_COPY_FIELD(SqliteWith, with); + DEEP_COPY_FIELD(SqliteSelect::Core::JoinSource, from); } SqliteUpdate::~SqliteUpdate() @@ -33,7 +34,7 @@ SqliteUpdate::~SqliteUpdate() } SqliteUpdate::SqliteUpdate(SqliteConflictAlgo onConflict, const QString &name1, const QString &name2, bool notIndexedKw, const QString &indexedBy, - const QList<ColumnAndValue>& values, SqliteExpr *where, SqliteWith* with) + const QList<ColumnAndValue>& values, SqliteSelect::Core::JoinSource* from, SqliteExpr *where, SqliteWith* with) : SqliteUpdate() { this->onConflict = onConflict; @@ -51,6 +52,10 @@ SqliteUpdate::SqliteUpdate(SqliteConflictAlgo onConflict, const QString &name1, this->notIndexedKw = notIndexedKw; keyValueMap = values; + this->from = from; + if (from) + from->setParent(this); + this->where = where; if (where) where->setParent(this); @@ -188,12 +193,12 @@ TokenList SqliteUpdate::rebuildTokensFromContents() builder.withKeyword("OR").withSpace().withKeyword(sqliteConflictAlgo(onConflict)).withSpace(); if (!database.isNull()) - builder.withOther(database, dialect).withOperator("."); + builder.withOther(database).withOperator("."); - builder.withOther(table, dialect).withSpace(); + builder.withOther(table).withSpace(); if (indexedByKw) - builder.withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy, dialect).withSpace(); + builder.withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy).withSpace(); else if (notIndexedKw) builder.withKeyword("NOT").withSpace().withKeyword("INDEXED").withSpace(); @@ -206,14 +211,17 @@ TokenList SqliteUpdate::rebuildTokensFromContents() builder.withOperator(",").withSpace(); if (keyVal.first.type() == QVariant::StringList) - builder.withParLeft().withOtherList(keyVal.first.toStringList(), dialect).withParRight(); + builder.withParLeft().withOtherList(keyVal.first.toStringList()).withParRight(); else - builder.withOther(keyVal.first.toString(), dialect); + builder.withOther(keyVal.first.toString()); builder.withSpace().withOperator("=").withStatement(keyVal.second); first = false; } + if (from) + builder.withSpace().withKeyword("FROM").withStatement(from); + if (where) builder.withSpace().withKeyword("WHERE").withStatement(where); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h index 642473c..e843bcd 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h @@ -3,6 +3,7 @@ #include "sqlitequery.h" #include "sqliteconflictalgo.h" +#include "sqliteselect.h" #include <QStringList> #include <QMap> @@ -20,18 +21,19 @@ class API_EXPORT SqliteUpdate : public SqliteQuery ~SqliteUpdate(); SqliteUpdate(SqliteConflictAlgo onConflict, const QString& name1, const QString& name2, bool notIndexedKw, const QString& indexedBy, const QList<ColumnAndValue>& values, - SqliteExpr* where, SqliteWith* with); + SqliteSelect::Core::JoinSource* from, SqliteExpr* where, SqliteWith* with); SqliteStatement* clone(); SqliteExpr* getValueForColumnSet(const QString& column); SqliteConflictAlgo onConflict = SqliteConflictAlgo::null; - QString database = QString::null; - QString table = QString::null; + QString database = QString(); + QString table = QString(); bool indexedByKw = false; bool notIndexedKw = false; - QString indexedBy = QString::null; + QString indexedBy = QString(); QList<ColumnAndValue> keyValueMap; + SqliteSelect::Core::JoinSource* from = nullptr; SqliteExpr* where = nullptr; SqliteWith* with = nullptr; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp index ced9c2d..441cd6d 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp @@ -94,9 +94,9 @@ TokenList SqliteUpsert::rebuildTokensFromContents() builder.withOperator(",").withSpace(); if (keyVal.first.type() == QVariant::StringList) - builder.withParLeft().withOtherList(keyVal.first.toStringList(), dialect).withParRight(); + builder.withParLeft().withOtherList(keyVal.first.toStringList()).withParRight(); else - builder.withOther(keyVal.first.toString(), dialect); + builder.withOther(keyVal.first.toString()); builder.withSpace().withOperator("=").withStatement(keyVal.second); first = false; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp index 9d595ed..e65530a 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp @@ -1,7 +1,8 @@ #include "sqlitevacuum.h" #include "sqlitequerytype.h" - -#include <parser/statementtokenbuilder.h> +#include "common/global.h" +#include "parser/statementtokenbuilder.h" +#include "sqliteexpr.h" SqliteVacuum::SqliteVacuum() { @@ -11,13 +12,26 @@ SqliteVacuum::SqliteVacuum() SqliteVacuum::SqliteVacuum(const SqliteVacuum& other) : SqliteQuery(other), database(other.database) { + DEEP_COPY_FIELD(SqliteExpr, expr); +} + +SqliteVacuum::SqliteVacuum(SqliteExpr* expr) + : SqliteVacuum() +{ + this->expr = expr; + if (expr) + expr->setParent(this); } -SqliteVacuum::SqliteVacuum(const QString& name) +SqliteVacuum::SqliteVacuum(const QString& name, SqliteExpr* expr) : SqliteVacuum() { if (!name.isNull()) database = name; + + this->expr = expr; + if (expr) + expr->setParent(this); } SqliteStatement*SqliteVacuum::clone() @@ -55,6 +69,13 @@ TokenList SqliteVacuum::rebuildTokensFromContents() { StatementTokenBuilder builder; builder.withTokens(SqliteQuery::rebuildTokensFromContents()); - builder.withKeyword("VACUUM").withOperator(";"); + builder.withKeyword("VACUUM"); + if (!database.isNull()) + builder.withSpace().withOther(database); + + if (expr) + builder.withSpace().withKeyword("INTO").withSpace().withStatement(expr); + + builder.withOperator(";"); return builder.build(); } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h index 871b8f4..db9af95 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h @@ -5,16 +5,20 @@ #include <QString> +class SqliteExpr; + class API_EXPORT SqliteVacuum : public SqliteQuery { public: SqliteVacuum(); SqliteVacuum(const SqliteVacuum& other); - explicit SqliteVacuum(const QString &name); + SqliteVacuum(SqliteExpr* expr); + SqliteVacuum(const QString &name, SqliteExpr* expr); SqliteStatement* clone(); QString database; + SqliteExpr* expr = nullptr; protected: QStringList getDatabasesInStatement(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.cpp new file mode 100644 index 0000000..adf135f --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.cpp @@ -0,0 +1,308 @@ +#include "sqlitewindowdefinition.h" +#include "sqliteexpr.h" +#include "sqliteorderby.h" +#include "parser/statementtokenbuilder.h" +#include "common/global.h" +#include <QDebug> + +SqliteWindowDefinition::SqliteWindowDefinition() +{ + +} + +SqliteWindowDefinition::SqliteWindowDefinition(const SqliteWindowDefinition& other) : + SqliteStatement(other), name(other.name) +{ + DEEP_COPY_FIELD(Window, window); +} + +SqliteWindowDefinition::SqliteWindowDefinition(const QString& name, SqliteWindowDefinition::Window* window) +{ + this->name = name; + this->window = window; + if (window) + window->setParent(this); +} + +SqliteStatement* SqliteWindowDefinition::clone() +{ + return new SqliteWindowDefinition(*this); +} + +TokenList SqliteWindowDefinition::rebuildTokensFromContents() +{ + StatementTokenBuilder builder; + + builder.withOther(name).withSpace().withKeyword("AS").withParLeft().withStatement(window).withParRight(); + + return builder.build(); +} + +SqliteWindowDefinition::Window::Window() +{ +} + +SqliteWindowDefinition::Window::Window(const SqliteWindowDefinition::Window& other) : + SqliteStatement(other), name(other.name), mode(other.mode) +{ + DEEP_COPY_COLLECTION(SqliteExpr, exprList); + DEEP_COPY_COLLECTION(SqliteOrderBy, orderBy); + DEEP_COPY_FIELD(Frame, frame); +} + +SqliteStatement* SqliteWindowDefinition::Window::clone() +{ + return new Window(*this); +} + +void SqliteWindowDefinition::Window::initPartitionBy(const QString& name, const QList<SqliteExpr*>& exprList, const QList<SqliteOrderBy*>& orderBy, SqliteWindowDefinition::Window::Frame* frame) +{ + this->mode = Mode::PARTITION_BY; + this->name = name; + initExprList(exprList); + initOrderBy(orderBy); + initFrame(frame); +} + +void SqliteWindowDefinition::Window::initOrderBy(const QString& name, const QList<SqliteOrderBy*>& orderBy, SqliteWindowDefinition::Window::Frame* frame) +{ + this->mode = Mode::ORDER_BY; + this->name = name; + initOrderBy(orderBy); + initFrame(frame); +} + +void SqliteWindowDefinition::Window::init(const QString& name, SqliteWindowDefinition::Window::Frame* frame) +{ + this->mode = Mode::null; + this->name = name; + initFrame(frame); +} + +TokenList SqliteWindowDefinition::Window::rebuildTokensFromContents() +{ + StatementTokenBuilder builder; + + if (!name.isNull()) + builder.withOther(name).withSpace(); + + switch (mode) + { + case SqliteWindowDefinition::Window::Mode::PARTITION_BY: + builder.withKeyword("PARTITION").withSpace().withKeyword("BY").withSpace().withStatementList(exprList).withSpace(); + break; + case SqliteWindowDefinition::Window::Mode::ORDER_BY: + break; + case SqliteWindowDefinition::Window::Mode::null: + break; + } + + if (orderBy.size() > 0) + builder.withKeyword("ORDER").withSpace().withKeyword("BY").withSpace().withStatementList(orderBy); + + if (frame) + builder.withStatement(frame); + + return builder.build(); +} + +void SqliteWindowDefinition::Window::initExprList(const QList<SqliteExpr*>& exprList) +{ + this->exprList = exprList; + for (SqliteExpr* expr : exprList) + expr->setParent(this); +} + +void SqliteWindowDefinition::Window::initOrderBy(const QList<SqliteOrderBy*>& orderBy) +{ + this->orderBy = orderBy; + for (SqliteOrderBy* order : orderBy) + order->setParent(this); +} + +void SqliteWindowDefinition::Window::initFrame(SqliteWindowDefinition::Window::Frame* frame) +{ + this->frame = frame; + if (frame) + frame->setParent(this); +} + +SqliteWindowDefinition::Window::Frame::RangeOrRows SqliteWindowDefinition::Window::Frame::toRangeOrRows(const QString& value) +{ + QString upper = value.toUpper(); + if (upper == "RANGE") + return RangeOrRows::RANGE; + else if (upper == "ROWS") + return RangeOrRows::ROWS; + else if (upper == "GROUPS") + return RangeOrRows::GROUPS; + else + return RangeOrRows::null; +} + +QString SqliteWindowDefinition::Window::Frame::fromRangeOrRows(SqliteWindowDefinition::Window::Frame::RangeOrRows value) +{ + switch (value) + { + case SqliteWindowDefinition::Window::Frame::RangeOrRows::RANGE: + return "RANGE"; + case SqliteWindowDefinition::Window::Frame::RangeOrRows::ROWS: + return "ROWS"; + case SqliteWindowDefinition::Window::Frame::RangeOrRows::GROUPS: + return "GROUPS"; + case SqliteWindowDefinition::Window::Frame::RangeOrRows::null: + break; + } + return QString(); +} + +SqliteWindowDefinition::Window::Frame::Exclude SqliteWindowDefinition::Window::Frame::toExclude(const QString& value) +{ + QString upper = value.toUpper(); + if (upper == "NO OTHERS") + return Exclude::NO_OTHERS; + else if (upper == "CURRENT ROW") + return Exclude::CURRENT_ROW; + else if (upper == "GROUP") + return Exclude::GROUP; + else if (upper == "TIES") + return Exclude::TIES; + else + return Exclude::null; +} + +QString SqliteWindowDefinition::Window::Frame::fromExclude(SqliteWindowDefinition::Window::Frame::Exclude value) +{ + switch (value) + { + case SqliteWindowDefinition::Window::Frame::Exclude::TIES: + return "TIES"; + case SqliteWindowDefinition::Window::Frame::Exclude::NO_OTHERS: + return "NO OTHERS"; + case SqliteWindowDefinition::Window::Frame::Exclude::CURRENT_ROW: + return "CURRENT ROW"; + case SqliteWindowDefinition::Window::Frame::Exclude::GROUP: + return "GROUP"; + case SqliteWindowDefinition::Window::Frame::Exclude::null: + break; + } + return QString(); +} + +SqliteWindowDefinition::Window::Frame::Frame() +{ +} + +SqliteWindowDefinition::Window::Frame::Frame(const SqliteWindowDefinition::Window::Frame& other) : + SqliteStatement(other), rangeOrRows(other.rangeOrRows), exclude(other.exclude) +{ + DEEP_COPY_FIELD(Bound, startBound); + DEEP_COPY_FIELD(Bound, endBound); +} + +SqliteWindowDefinition::Window::Frame::Frame(SqliteWindowDefinition::Window::Frame::RangeOrRows rangeOrRows, + SqliteWindowDefinition::Window::Frame::Bound* startBound, + SqliteWindowDefinition::Window::Frame::Bound* endBound, + SqliteWindowDefinition::Window::Frame::Exclude exclude) +{ + this->rangeOrRows = rangeOrRows; + this->startBound = startBound; + this->endBound = endBound; + this->exclude = exclude; + + if (startBound) + startBound->setParent(this); + + if (endBound) + endBound->setParent(this); +} + +SqliteStatement* SqliteWindowDefinition::Window::Frame::clone() +{ + return new Frame(*this); +} + +TokenList SqliteWindowDefinition::Window::Frame::rebuildTokensFromContents() +{ + StatementTokenBuilder builder; + + if (rangeOrRows != RangeOrRows::null) + builder.withKeyword(fromRangeOrRows(rangeOrRows)).withSpace(); + + if (endBound) + builder.withKeyword("BETWEEN").withSpace().withStatement(startBound).withSpace() + .withKeyword("AND").withSpace().withStatement(endBound); + else + builder.withStatement(startBound); + + if (exclude != Exclude::null) + { + builder.withSpace().withKeyword("EXCLUDE"); + for (const QString& kw : fromExclude(exclude).split(" ")) + builder.withSpace().withKeyword(kw); + } + + return builder.build(); +} + +SqliteWindowDefinition::Window::Frame::Bound::Bound() +{ +} + +SqliteWindowDefinition::Window::Frame::Bound::Bound(const SqliteWindowDefinition::Window::Frame::Bound& other) : + SqliteStatement(other), type(other.type) +{ + DEEP_COPY_FIELD(SqliteExpr, expr); +} + +SqliteWindowDefinition::Window::Frame::Bound::Bound(SqliteExpr* expr, const QString& value) +{ + this->expr = expr; + if (expr) + expr->setParent(this); + + QString upper = value.toUpper(); + if (upper == "UNBOUNDED PRECEDING") + type = Type::UNBOUNDED_PRECEDING; + else if (expr && upper == "PRECEDING") + type = Type::EXPR_FOLLOWING; + else if (upper == "UNBOUNDED FOLLOWING") + type = Type::UNBOUNDED_FOLLOWING; + else if (expr && upper == "FOLLOWING") + type = Type::EXPR_FOLLOWING; + else if (upper == "CURRENT ROW") + type = Type::CURRENT_ROW; + else + qCritical() << "Unexpected Window Frame Bound:" << value; +} + +SqliteStatement* SqliteWindowDefinition::Window::Frame::Bound::clone() +{ + return new Bound(*this); +} + +TokenList SqliteWindowDefinition::Window::Frame::Bound::rebuildTokensFromContents() +{ + StatementTokenBuilder builder; + + switch (type) + { + case SqliteWindowDefinition::Window::Frame::Bound::Type::UNBOUNDED_PRECEDING: + builder.withKeyword("UNBOUNDED").withSpace().withKeyword("PRECEDING"); + break; + case SqliteWindowDefinition::Window::Frame::Bound::Type::UNBOUNDED_FOLLOWING: + builder.withKeyword("UNBOUNDED").withSpace().withKeyword("FOLLOWING"); + break; + case SqliteWindowDefinition::Window::Frame::Bound::Type::EXPR_PRECEDING: + builder.withStatement(expr).withSpace().withKeyword("PRECEDING"); + break; + case SqliteWindowDefinition::Window::Frame::Bound::Type::EXPR_FOLLOWING: + builder.withStatement(expr).withSpace().withKeyword("FOLLOWING"); + break; + case SqliteWindowDefinition::Window::Frame::Bound::Type::CURRENT_ROW: + builder.withKeyword("CURRENT").withSpace().withKeyword("ROW"); + break; + } + + return builder.build(); +} diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.h new file mode 100644 index 0000000..fb5cb8e --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.h @@ -0,0 +1,129 @@ +#ifndef SQLITEWINDOWDEFINITION_H +#define SQLITEWINDOWDEFINITION_H + +//#include "sqliteexpr.h" +//#include "sqliteorderby.h" +#include "sqlitestatement.h" + +class SqliteExpr; +class SqliteOrderBy; + +/** + * @addtogroup sqlite_statement + * @brief The SqliteWindowDefinition class + */ +class API_EXPORT SqliteWindowDefinition : public SqliteStatement +{ + public: + class API_EXPORT Window : public SqliteStatement + { + public: + class API_EXPORT Frame : public SqliteStatement + { + public: + class API_EXPORT Bound : public SqliteStatement + { + public: + enum class Type + { + UNBOUNDED_PRECEDING, + UNBOUNDED_FOLLOWING, + EXPR_PRECEDING, + EXPR_FOLLOWING, + CURRENT_ROW + }; + + Bound(); + Bound(const Bound& other); + Bound(SqliteExpr* expr, const QString& value); + + SqliteStatement* clone(); + + Type type = Type::CURRENT_ROW; + SqliteExpr* expr = nullptr; + + protected: + TokenList rebuildTokensFromContents(); + }; + + enum class RangeOrRows + { + RANGE, + ROWS, + GROUPS, + null + }; + + enum class Exclude + { + NO_OTHERS, + CURRENT_ROW, + GROUP, + TIES, + null + }; + + static RangeOrRows toRangeOrRows(const QString& value); + static QString fromRangeOrRows(RangeOrRows value); + static Exclude toExclude(const QString& value); + static QString fromExclude(Exclude value); + + Frame(); + Frame(const Frame& other); + Frame(RangeOrRows rangeOrRows, Bound* startBound, Bound* endBound, Exclude exclude); + + SqliteStatement* clone(); + + RangeOrRows rangeOrRows = RangeOrRows::null; + Exclude exclude = Exclude::null; + Bound* startBound = nullptr; + Bound* endBound = nullptr; + + protected: + TokenList rebuildTokensFromContents(); + }; + + enum class Mode + { + PARTITION_BY, + ORDER_BY, + null + }; + + Window(); + Window(const Window& other); + + SqliteStatement* clone(); + void initPartitionBy(const QString& name, const QList<SqliteExpr*>& exprList, const QList<SqliteOrderBy*>& orderBy, Frame* frame); + void initOrderBy(const QString& name, const QList<SqliteOrderBy*>& orderBy, Frame* frame); + void init(const QString& name, Frame* frame); + + QString name; + QList<SqliteExpr*> exprList; + QList<SqliteOrderBy*> orderBy; + Frame* frame = nullptr; + Mode mode = Mode::null; + + protected: + TokenList rebuildTokensFromContents(); + + private: + void initExprList(const QList<SqliteExpr*>& exprList); + void initOrderBy(const QList<SqliteOrderBy*>& orderBy); + void initFrame(Frame* frame); + }; + + SqliteWindowDefinition(); + SqliteWindowDefinition(const SqliteWindowDefinition& other); + SqliteWindowDefinition(const QString& name, Window* window); + + SqliteStatement* clone(); + + QString name = QString(); + Window* window = nullptr; + + protected: + TokenList rebuildTokensFromContents(); +}; + +#endif // SQLITEWINDOWDEFINITION_H diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp index 2b9c99f..901ac56 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp @@ -13,26 +13,6 @@ SqliteWith::SqliteWith(const SqliteWith& other) : DEEP_COPY_COLLECTION(CommonTableExpression, cteList); } -SqliteWith* SqliteWith::append(const QString& tableName, const QList<SqliteIndexedColumn*>& indexedColumns, SqliteSelect* select) -{ - SqliteWith* with = new SqliteWith(); - CommonTableExpression* cte = new CommonTableExpression(tableName, indexedColumns, select); - cte->setParent(with); - with->cteList << cte; - return with; -} - -SqliteWith* SqliteWith::append(SqliteWith* with, const QString& tableName, const QList<SqliteIndexedColumn*>& indexedColumns, SqliteSelect* select) -{ - if (!with) - with = new SqliteWith(); - - CommonTableExpression* cte = new CommonTableExpression(tableName, indexedColumns, select); - cte->setParent(with); - with->cteList << cte; - return with; -} - SqliteStatement*SqliteWith::clone() { return new SqliteWith(*this); @@ -76,7 +56,7 @@ SqliteStatement*SqliteWith::CommonTableExpression::clone() TokenList SqliteWith::CommonTableExpression::rebuildTokensFromContents() { StatementTokenBuilder builder; - builder.withOther(table, dialect); + builder.withOther(table); if (indexedColumns.size() > 0) builder.withSpace().withParLeft().withStatementList(indexedColumns).withParRight(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h index fe64c9c..30f8181 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h @@ -28,8 +28,6 @@ class SqliteWith : public SqliteStatement SqliteWith(); SqliteWith(const SqliteWith& other); - static SqliteWith* append(const QString& tableName, const QList<SqliteIndexedColumn*>& indexedColumns, SqliteSelect* select); - static SqliteWith* append(SqliteWith* with, const QString& tableName, const QList<SqliteIndexedColumn*>& indexedColumns, SqliteSelect* select); SqliteStatement* clone(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/compile_lemon.bat b/SQLiteStudio3/coreSQLiteStudio/parser/compile_lemon.bat new file mode 100644 index 0000000..683a997 --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/parser/compile_lemon.bat @@ -0,0 +1,6 @@ +@echo off +set LEMON=C:\utils\lemon.exe +set GCC=C:\Qt\Tools\mingw810_64\bin\gcc.exe + +%GCC% -o %LEMON% lemon.c + diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp index bc8112e..a5651db 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp @@ -1,24 +1,15 @@ #include "keywords.h" #include "sqlite3_parse.h" -#include "sqlite2_parse.h" #include <QDebug> #include <QList> -QHash<QString,int> keywords2; QHash<QString,int> keywords3; +QSet<QString> softKeywords3; QSet<QString> rowIdKeywords; QStringList joinKeywords; QStringList fkMatchKeywords; QStringList conflictAlgoKeywords; - -int getKeywordId2(const QString& str) -{ - QString upStr = str.toUpper(); - if (keywords2.contains(upStr)) - return keywords2[upStr]; - else - return TK2_ID; -} +QStringList generatedColumnKeywords; int getKeywordId3(const QString& str) { @@ -34,11 +25,6 @@ bool isRowIdKeyword(const QString& str) return rowIdKeywords.contains(str.toUpper()); } -const QHash<QString,int>& getKeywords2() -{ - return keywords2; -} - const QHash<QString,int>& getKeywords3() { return keywords3; @@ -47,234 +33,151 @@ const QHash<QString,int>& getKeywords3() void initKeywords() { // SQLite 3 - keywords3["REINDEX"] = TK3_REINDEX; - keywords3["INDEXED"] = TK3_INDEXED; - keywords3["INDEX"] = TK3_INDEX; - keywords3["DESC"] = TK3_DESC; - keywords3["ESCAPE"] = TK3_ESCAPE; - keywords3["EACH"] = TK3_EACH; - keywords3["CHECK"] = TK3_CHECK; - keywords3["KEY"] = TK3_KEY; - keywords3["BEFORE"] = TK3_BEFORE; - keywords3["FOREIGN"] = TK3_FOREIGN; - keywords3["FOR"] = TK3_FOR; - keywords3["IGNORE"] = TK3_IGNORE; - keywords3["REGEXP"] = TK3_LIKE_KW; - keywords3["EXPLAIN"] = TK3_EXPLAIN; - keywords3["INSTEAD"] = TK3_INSTEAD; - keywords3["ADD"] = TK3_ADD; - keywords3["DATABASE"] = TK3_DATABASE; - keywords3["AS"] = TK3_AS; - keywords3["SELECT"] = TK3_SELECT; - keywords3["TABLE"] = TK3_TABLE; - keywords3["LEFT"] = TK3_JOIN_KW; - keywords3["THEN"] = TK3_THEN; - keywords3["END"] = TK3_END; - keywords3["DEFERRABLE"] = TK3_DEFERRABLE; - keywords3["ELSE"] = TK3_ELSE; - keywords3["EXCEPT"] = TK3_EXCEPT; - keywords3["TRANSACTION"] = TK3_TRANSACTION; + keywords3["ABORT"] = TK3_ABORT; keywords3["ACTION"] = TK3_ACTION; - keywords3["ON"] = TK3_ON; - keywords3["NATURAL"] = TK3_JOIN_KW; + keywords3["ADD"] = TK3_ADD; + keywords3["AFTER"] = TK3_AFTER; + keywords3["ALL"] = TK3_ALL; keywords3["ALTER"] = TK3_ALTER; - keywords3["RAISE"] = TK3_RAISE; - keywords3["EXCLUSIVE"] = TK3_EXCLUSIVE; - keywords3["EXISTS"] = TK3_EXISTS; - keywords3["SAVEPOINT"] = TK3_SAVEPOINT; - keywords3["INTERSECT"] = TK3_INTERSECT; - keywords3["TRIGGER"] = TK3_TRIGGER; - keywords3["REFERENCES"] = TK3_REFERENCES; - keywords3["CONSTRAINT"] = TK3_CONSTRAINT; - keywords3["INTO"] = TK3_INTO; - keywords3["OFFSET"] = TK3_OFFSET; - keywords3["OF"] = TK3_OF; - keywords3["SET"] = TK3_SET; - keywords3["TEMP"] = TK3_TEMP; - keywords3["TEMPORARY"] = TK3_TEMP; - keywords3["OR"] = TK3_OR; - keywords3["UNIQUE"] = TK3_UNIQUE; - keywords3["QUERY"] = TK3_QUERY; + keywords3["ALWAYS"] = TK3_ALWAYS; + keywords3["ANALYZE"] = TK3_ANALYZE; + keywords3["AND"] = TK3_AND; + keywords3["AS"] = TK3_AS; + keywords3["ASC"] = TK3_ASC; keywords3["ATTACH"] = TK3_ATTACH; - keywords3["HAVING"] = TK3_HAVING; - keywords3["GROUP"] = TK3_GROUP; - keywords3["UPDATE"] = TK3_UPDATE; + keywords3["AUTOINCREMENT"] = TK3_AUTOINCR; + keywords3["BEFORE"] = TK3_BEFORE; keywords3["BEGIN"] = TK3_BEGIN; - keywords3["INNER"] = TK3_JOIN_KW; - keywords3["RELEASE"] = TK3_RELEASE; keywords3["BETWEEN"] = TK3_BETWEEN; - keywords3["NOTNULL"] = TK3_NOTNULL; - keywords3["NOT"] = TK3_NOT; - keywords3["NO"] = TK3_NO; - keywords3["DO"] = TK3_DO; - keywords3["NOTHING"] = TK3_NOTHING; - keywords3["NULL"] = TK3_NULL; - keywords3["LIKE"] = TK3_LIKE_KW; + keywords3["BY"] = TK3_BY; keywords3["CASCADE"] = TK3_CASCADE; - keywords3["ASC"] = TK3_ASC; - keywords3["DELETE"] = TK3_DELETE; keywords3["CASE"] = TK3_CASE; - keywords3["COLLATE"] = TK3_COLLATE; - keywords3["CREATE"] = TK3_CREATE; - keywords3["CURRENT_DATE"] = TK3_CTIME_KW; - keywords3["DETACH"] = TK3_DETACH; - keywords3["IMMEDIATE"] = TK3_IMMEDIATE; - keywords3["JOIN"] = TK3_JOIN; - keywords3["INSERT"] = TK3_INSERT; - keywords3["MATCH"] = TK3_MATCH; - keywords3["PLAN"] = TK3_PLAN; - keywords3["ANALYZE"] = TK3_ANALYZE; - keywords3["PRAGMA"] = TK3_PRAGMA; - keywords3["ABORT"] = TK3_ABORT; - keywords3["VALUES"] = TK3_VALUES; - keywords3["VIRTUAL"] = TK3_VIRTUAL; - keywords3["LIMIT"] = TK3_LIMIT; - keywords3["WHEN"] = TK3_WHEN; - keywords3["WHERE"] = TK3_WHERE; - keywords3["RENAME"] = TK3_RENAME; - keywords3["AFTER"] = TK3_AFTER; - keywords3["REPLACE"] = TK3_REPLACE; - keywords3["AND"] = TK3_AND; - keywords3["DEFAULT"] = TK3_DEFAULT; - keywords3["AUTOINCREMENT"] = TK3_AUTOINCR; - keywords3["TO"] = TK3_TO; - keywords3["IN"] = TK3_IN; keywords3["CAST"] = TK3_CAST; + keywords3["CHECK"] = TK3_CHECK; + keywords3["COLLATE"] = TK3_COLLATE; keywords3["COLUMN"] = TK3_COLUMNKW; keywords3["COMMIT"] = TK3_COMMIT; keywords3["CONFLICT"] = TK3_CONFLICT; + keywords3["CONSTRAINT"] = TK3_CONSTRAINT; + keywords3["CREATE"] = TK3_CREATE; keywords3["CROSS"] = TK3_JOIN_KW; - keywords3["CURRENT_TIMESTAMP"] = TK3_CTIME_KW; + keywords3["CURRENT"] = TK3_CURRENT; + keywords3["CURRENT_DATE"] = TK3_CTIME_KW; keywords3["CURRENT_TIME"] = TK3_CTIME_KW; - keywords3["PRIMARY"] = TK3_PRIMARY; + keywords3["CURRENT_TIMESTAMP"] = TK3_CTIME_KW; + keywords3["DATABASE"] = TK3_DATABASE; + keywords3["DEFAULT"] = TK3_DEFAULT; + keywords3["DEFERRABLE"] = TK3_DEFERRABLE; keywords3["DEFERRED"] = TK3_DEFERRED; + keywords3["DELETE"] = TK3_DELETE; + keywords3["DESC"] = TK3_DESC; + keywords3["DETACH"] = TK3_DETACH; keywords3["DISTINCT"] = TK3_DISTINCT; - keywords3["IS"] = TK3_IS; + keywords3["DO"] = TK3_DO; keywords3["DROP"] = TK3_DROP; + keywords3["EACH"] = TK3_EACH; + keywords3["ELSE"] = TK3_ELSE; + keywords3["END"] = TK3_END; + keywords3["ESCAPE"] = TK3_ESCAPE; + keywords3["EXCEPT"] = TK3_EXCEPT; + keywords3["EXCLUDE"] = TK3_EXCLUDE; + keywords3["EXCLUSIVE"] = TK3_EXCLUSIVE; + keywords3["EXISTS"] = TK3_EXISTS; + keywords3["EXPLAIN"] = TK3_EXPLAIN; keywords3["FAIL"] = TK3_FAIL; + keywords3["FILTER"] = TK3_FILTER; + keywords3["FIRST"] = TK3_FIRST; + keywords3["FOLLOWING"] = TK3_FOLLOWING; + keywords3["FOR"] = TK3_FOR; + keywords3["FOREIGN"] = TK3_FOREIGN; keywords3["FROM"] = TK3_FROM; keywords3["FULL"] = TK3_JOIN_KW; + keywords3["GENERATED"] = TK3_GENERATED; keywords3["GLOB"] = TK3_LIKE_KW; - keywords3["BY"] = TK3_BY; + keywords3["GROUP"] = TK3_GROUP; + keywords3["GROUPS"] = TK3_GROUPS; + keywords3["HAVING"] = TK3_HAVING; keywords3["IF"] = TK3_IF; + keywords3["IGNORE"] = TK3_IGNORE; + keywords3["IMMEDIATE"] = TK3_IMMEDIATE; + keywords3["IN"] = TK3_IN; + keywords3["INDEX"] = TK3_INDEX; + keywords3["INDEXED"] = TK3_INDEXED; + keywords3["INITIALLY"] = TK3_INITIALLY; + keywords3["INNER"] = TK3_JOIN_KW; + keywords3["INSERT"] = TK3_INSERT; + keywords3["INSTEAD"] = TK3_INSTEAD; + keywords3["INTERSECT"] = TK3_INTERSECT; + keywords3["INTO"] = TK3_INTO; + keywords3["IS"] = TK3_IS; keywords3["ISNULL"] = TK3_ISNULL; + keywords3["JOIN"] = TK3_JOIN; + keywords3["KEY"] = TK3_KEY; + keywords3["LAST"] = TK3_LAST; + keywords3["LEFT"] = TK3_JOIN_KW; + keywords3["LIKE"] = TK3_LIKE_KW; + keywords3["LIMIT"] = TK3_LIMIT; + keywords3["MATCH"] = TK3_MATCH; + keywords3["NATURAL"] = TK3_JOIN_KW; + keywords3["NO"] = TK3_NO; + keywords3["NOT"] = TK3_NOT; + keywords3["NOTHING"] = TK3_NOTHING; + keywords3["NOTNULL"] = TK3_NOTNULL; + keywords3["NULL"] = TK3_NULL; + keywords3["NULLS"] = TK3_NULLS; + keywords3["OF"] = TK3_OF; + keywords3["OFFSET"] = TK3_OFFSET; + keywords3["ON"] = TK3_ON; + keywords3["OR"] = TK3_OR; keywords3["ORDER"] = TK3_ORDER; - keywords3["RESTRICT"] = TK3_RESTRICT; + keywords3["OTHERS"] = TK3_OTHERS; + keywords3["OVER"] = TK3_OVER; keywords3["OUTER"] = TK3_JOIN_KW; + keywords3["PARTITION"] = TK3_PARTITION; + keywords3["PLAN"] = TK3_PLAN; + keywords3["PRAGMA"] = TK3_PRAGMA; + keywords3["PRECEDING"] = TK3_PRECEDING; + keywords3["PRIMARY"] = TK3_PRIMARY; + keywords3["QUERY"] = TK3_QUERY; + keywords3["RAISE"] = TK3_RAISE; + keywords3["RANGE"] = TK3_RANGE; + keywords3["RECURSIVE"] = TK3_RECURSIVE; + keywords3["REFERENCES"] = TK3_REFERENCES; + keywords3["REGEXP"] = TK3_LIKE_KW; + keywords3["REINDEX"] = TK3_REINDEX; + keywords3["RELEASE"] = TK3_RELEASE; + keywords3["RENAME"] = TK3_RENAME; + keywords3["REPLACE"] = TK3_REPLACE; + keywords3["RESTRICT"] = TK3_RESTRICT; keywords3["RIGHT"] = TK3_JOIN_KW; keywords3["ROLLBACK"] = TK3_ROLLBACK; keywords3["ROW"] = TK3_ROW; + keywords3["ROWS"] = TK3_ROWS; + keywords3["SAVEPOINT"] = TK3_SAVEPOINT; + keywords3["SELECT"] = TK3_SELECT; + keywords3["SET"] = TK3_SET; + keywords3["TABLE"] = TK3_TABLE; + keywords3["TEMP"] = TK3_TEMP; + keywords3["TEMPORARY"] = TK3_TEMP; + keywords3["THEN"] = TK3_THEN; + keywords3["TIES"] = TK3_TIES; + keywords3["TO"] = TK3_TO; + keywords3["TRANSACTION"] = TK3_TRANSACTION; + keywords3["TRIGGER"] = TK3_TRIGGER; + keywords3["UNBOUNDED"] = TK3_UNBOUNDED; keywords3["UNION"] = TK3_UNION; + keywords3["UNIQUE"] = TK3_UNIQUE; + keywords3["UPDATE"] = TK3_UPDATE; keywords3["USING"] = TK3_USING; keywords3["VACUUM"] = TK3_VACUUM; + keywords3["VALUES"] = TK3_VALUES; keywords3["VIEW"] = TK3_VIEW; - keywords3["INITIALLY"] = TK3_INITIALLY; - keywords3["WITHOUT"] = TK3_WITHOUT; - keywords3["ALL"] = TK3_ALL; + keywords3["VIRTUAL"] = TK3_VIRTUAL; + keywords3["WHEN"] = TK3_WHEN; + keywords3["WHERE"] = TK3_WHERE; + keywords3["WINDOW"] = TK3_WINDOW; keywords3["WITH"] = TK3_WITH; - keywords3["RECURSIVE"] = TK3_RECURSIVE; - - // SQLite 2 - keywords2["ABORT"] = TK2_ABORT; - keywords2["AFTER"] = TK2_AFTER; - keywords2["ALL"] = TK2_ALL; - keywords2["AND"] = TK2_AND; - keywords2["AS"] = TK2_AS; - keywords2["ASC"] = TK2_ASC; - keywords2["ATTACH"] = TK2_ATTACH; - keywords2["BEFORE"] = TK2_BEFORE; - keywords2["BEGIN"] = TK2_BEGIN; - keywords2["BETWEEN"] = TK2_BETWEEN; - keywords2["BY"] = TK2_BY; - keywords2["CASCADE"] = TK2_CASCADE; - keywords2["CASE"] = TK2_CASE; - keywords2["CHECK"] = TK2_CHECK; - keywords2["CLUSTER"] = TK2_CLUSTER; - keywords2["COLLATE"] = TK2_COLLATE; - keywords2["COMMIT"] = TK2_COMMIT; - keywords2["CONFLICT"] = TK2_CONFLICT; - keywords2["CONSTRAINT"] = TK2_CONSTRAINT; - keywords2["COPY"] = TK2_COPY; - keywords2["CREATE"] = TK2_CREATE; - keywords2["CROSS"] = TK2_JOIN_KW; - keywords2["DATABASE"] = TK2_DATABASE; - keywords2["DEFAULT"] = TK2_DEFAULT; - keywords2["DEFERRED"] = TK2_DEFERRED; - keywords2["DEFERRABLE"] = TK2_DEFERRABLE; - keywords2["DELETE"] = TK2_DELETE; - keywords2["DELIMITERS"] = TK2_DELIMITERS; - keywords2["DESC"] = TK2_DESC; - keywords2["DETACH"] = TK2_DETACH; - keywords2["DISTINCT"] = TK2_DISTINCT; - keywords2["DROP"] = TK2_DROP; - keywords2["END"] = TK2_END; - keywords2["EACH"] = TK2_EACH; - keywords2["ELSE"] = TK2_ELSE; - keywords2["EXCEPT"] = TK2_EXCEPT; - keywords2["EXPLAIN"] = TK2_EXPLAIN; - keywords2["FAIL"] = TK2_FAIL; - keywords2["FOR"] = TK2_FOR; - keywords2["FOREIGN"] = TK2_FOREIGN; - keywords2["FROM"] = TK2_FROM; - keywords2["FULL"] = TK2_JOIN_KW; - keywords2["GLOB"] = TK2_GLOB; - keywords2["GROUP"] = TK2_GROUP; - keywords2["HAVING"] = TK2_HAVING; - keywords2["IGNORE"] = TK2_IGNORE; - keywords2["IMMEDIATE"] = TK2_IMMEDIATE; - keywords2["IN"] = TK2_IN; - keywords2["INDEX"] = TK2_INDEX; - keywords2["INITIALLY"] = TK2_INITIALLY; - keywords2["INNER"] = TK2_JOIN_KW; - keywords2["INSERT"] = TK2_INSERT; - keywords2["INSTEAD"] = TK2_INSTEAD; - keywords2["INTERSECT"] = TK2_INTERSECT; - keywords2["INTO"] = TK2_INTO; - keywords2["IS"] = TK2_IS; - keywords2["ISNULL"] = TK2_ISNULL; - keywords2["JOIN"] = TK2_JOIN; - keywords2["KEY"] = TK2_KEY; - keywords2["LEFT"] = TK2_JOIN_KW; - keywords2["LIKE"] = TK2_LIKE; - keywords2["LIMIT"] = TK2_LIMIT; - keywords2["MATCH"] = TK2_MATCH; - keywords2["NATURAL"] = TK2_JOIN_KW; - keywords2["NOT"] = TK2_NOT; - keywords2["NOTNULL"] = TK2_NOTNULL; - keywords2["NULL"] = TK2_NULL; - keywords2["OF"] = TK2_OF; - keywords2["OFFSET"] = TK2_OFFSET; - keywords2["ON"] = TK2_ON; - keywords2["OR"] = TK2_OR; - keywords2["ORDER"] = TK2_ORDER; - keywords2["OUTER"] = TK2_JOIN_KW; - keywords2["PRAGMA"] = TK2_PRAGMA; - keywords2["PRIMARY"] = TK2_PRIMARY; - keywords2["RAISE"] = TK2_RAISE; - keywords2["REFERENCES"] = TK2_REFERENCES; - keywords2["REPLACE"] = TK2_REPLACE; - keywords2["RESTRICT"] = TK2_RESTRICT; - keywords2["RIGHT"] = TK2_JOIN_KW; - keywords2["ROLLBACK"] = TK2_ROLLBACK; - keywords2["ROW"] = TK2_ROW; - keywords2["SELECT"] = TK2_SELECT; - keywords2["SET"] = TK2_SET; - keywords2["STATEMENT"] = TK2_STATEMENT; - keywords2["TABLE"] = TK2_TABLE; - keywords2["TEMP"] = TK2_TEMP; - keywords2["TEMPORARY"] = TK2_TEMP; - keywords2["THEN"] = TK2_THEN; - keywords2["TRANSACTION"] = TK2_TRANSACTION; - keywords2["TRIGGER"] = TK2_TRIGGER; - keywords2["UNION"] = TK2_UNION; - keywords2["UNIQUE"] = TK2_UNIQUE; - keywords2["UPDATE"] = TK2_UPDATE; - keywords2["USING"] = TK2_USING; - keywords2["VACUUM"] = TK2_VACUUM; - keywords2["VALUES"] = TK2_VALUES; - keywords2["VIEW"] = TK2_VIEW; - keywords2["WHEN"] = TK2_WHEN; - keywords2["WHERE"] = TK2_WHERE; + keywords3["WITHOUT"] = TK3_WITHOUT; rowIdKeywords << "_ROWID_" << "ROWID" @@ -284,6 +187,16 @@ void initKeywords() joinKeywords << "NATURAL" << "LEFT" << "RIGHT" << "OUTER" << "INNER" << "CROSS"; fkMatchKeywords << "SIMPLE" << "FULL" << "PARTIAL"; conflictAlgoKeywords << "ROLLBACK" << "ABORT" << "FAIL" << "IGNORE" << "REPLACE"; + generatedColumnKeywords << "STORED" << "VIRTUAL"; + + softKeywords3 << "ABORT" << "ACTION" << "AFTER" << "ALWAYS" << "ANALYZE" << "ASC" << "ATTACH" << "BEFORE" << "BEGIN" << "BY" << "CASCADE" + << "CAST" << "COLUMNKW" << "CONFLICT" << "CURRENT" << "DATABASE" << "DEFERRED" << "DESC" << "DETACH" << "DO" << "EACH" + << "END" << "EXCLUDE" << "EXCLUSIVE" << "EXPLAIN" << "FAIL" << "FIRST" << "FOLLOWING" << "FOR" << "GENERATED" << "GROUPS" + << "IGNORE" << "IMMEDIATE" << "INDEXED" << "INITIALLY" << "INSTEAD" << "LAST" << "LIKE_KW" << "MATCH" << "NO" << "NULLS" + << "OTHERS" << "PLAN" << "QUERY" << "KEY" << "OF" << "OFFSET" << "PARTITION" << "PRAGMA" << "PRECEDING" << "RAISE" << "RANGE" + << "RECURSIVE" << "RELEASE" << "REPLACE" << "RESTRICT" << "ROW" << "ROWS" << "ROLLBACK" << "SAVEPOINT" << "TEMP" << "TIES" + << "TRIGGER" << "UNBOUNDED" << "VACUUM" << "VIEW" << "VIRTUAL" << "WITH" << "WITHOUT" << "REINDEX" << "RENAME" << "IF" + << "CURRENT_DATE" << "CURRENT_TIME" << "CURRENT_TIMESTAMP"; } @@ -307,20 +220,22 @@ bool isFkMatchKeyword(const QString &str) return fkMatchKeywords.contains(str); } - -bool isKeyword(const QString& str, Dialect dialect) +bool isKeyword(const QString& str) { - switch (dialect) - { - case Dialect::Sqlite3: - return keywords3.contains(str.toUpper()); - case Dialect::Sqlite2: - return keywords2.contains(str.toUpper()); - } - return false; + return keywords3.contains(str.toUpper()); } QStringList getConflictAlgorithms() { return conflictAlgoKeywords; } + +QStringList getGeneratedColumnTypes() +{ + return generatedColumnKeywords; +} + +bool isSoftKeyword(const QString& str) +{ + return softKeywords3.contains(str.toUpper()); +} diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/keywords.h b/SQLiteStudio3/coreSQLiteStudio/parser/keywords.h index a6e1d3d..4bd8ae5 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/keywords.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/keywords.h @@ -1,7 +1,6 @@ #ifndef KEYWORDS_H #define KEYWORDS_H -#include "dialect.h" #include "coreSQLiteStudio_global.h" #include <QString> #include <QStringList> @@ -10,34 +9,40 @@ /** @file */ /** - * @brief Translates keyword into it's Lemon token ID for SQLite 2 dialect. + * @brief Translates keyword into it's Lemon token ID for SQLite 3 dialect. * @param str The keyword. - * @return Lemon generated token ID, or TK2_ID value when the \p str parameter was not recognized as a valid SQLite 2 keyword. + * @return Lemon generated token ID, or TK3_ID value when the \p str parameter was not recognized as a valid SQLite 3 keyword. * * This method is used internally by the Lexer. * Comparision is done in case insensitive manner. */ -API_EXPORT int getKeywordId2(const QString& str); +API_EXPORT int getKeywordId3(const QString& str); /** - * @brief Translates keyword into it's Lemon token ID for SQLite 3 dialect. - * @param str The keyword. - * @return Lemon generated token ID, or TK3_ID value when the \p str parameter was not recognized as a valid SQLite 3 keyword. + * @brief Tests whether given string represents a keyword in SQLite dialect. + * @param str String to test. + * @return true if the string represents a keyword, or false otherwise. * - * This method is used internally by the Lexer. * Comparision is done in case insensitive manner. */ -API_EXPORT int getKeywordId3(const QString& str); +API_EXPORT bool isKeyword(const QString& str); /** - * @brief Tests whether given string represents a keyword in given SQLite dialect. + * @brief Tests whether given string represents a "soft" keyword in SQLite dialect. * @param str String to test. - * @param dialect SQLite dialect. - * @return true if the string represents a keyword, or false otherwise. + * @return true if the string represents a soft keyword, or false otherwise. + * + * "Soft" keywords are like any SQLite keywords, except these can be treated by SQLite as ID too, + * if it fits the syntax. It means that when SQLite parses a query, it first tries to parse these + * "soft" keywords are regular keywords and if it fails, it re-tries with treating them as ID. + * + * Quote from SQLite's parse.y: + * "The following directive causes tokens ABORT, AFTER, ASC, etc. to + * fallback to ID if they will not parse as their original value." * * Comparision is done in case insensitive manner. */ -API_EXPORT bool isKeyword(const QString& str, Dialect dialect); +API_EXPORT bool isSoftKeyword(const QString& str); /** * @brief Tests whether given string representing any variation of ROWID. @@ -50,12 +55,6 @@ API_EXPORT bool isKeyword(const QString& str, Dialect dialect); API_EXPORT bool isRowIdKeyword(const QString& str); /** - * @brief Provides map of SQLite 2 keywords and their Lemon token IDs. - * @return Keyword-to-Lemon-ID hash map, keywords are uppercase. - */ -API_EXPORT const QHash<QString,int>& getKeywords2(); - -/** * @brief Provides map of SQLite 3 keywords and their Lemon token IDs. * @return Keyword-to-Lemon-ID hash map, keywords are uppercase. */ @@ -120,4 +119,13 @@ API_EXPORT void initKeywords(); */ API_EXPORT QStringList getConflictAlgorithms(); +/** + * @brief Provides list of accepted Generated Column storage types in SQLite. + * + * Generated column storage keywords are: <tt>STORED</tt>, <tt>VIRTUAL</tt>. + * + * Those keywords are used for example on GUI, when user has the storage type to pick from drop-down list. + */ +API_EXPORT QStringList getGeneratedColumnTypes(); + #endif // KEYWORDS_H diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c b/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c index 2d0e610..3b239dc 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c +++ b/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c @@ -564,6 +564,7 @@ static int yy_find_reduce_action( ** The following routine is called if the stack overflows. */ static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){ + UNUSED(yypMinor); ParseARG_FETCH; yypParser->yyidx--; #ifndef NDEBUG @@ -1022,4 +1023,4 @@ void Parse( } }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); return; -} +}
\ No newline at end of file diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp index f6a23a0..bf5185b 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp @@ -2,21 +2,18 @@ #include "keywords.h" #include "log.h" #include "lexer_low_lev.h" -#include "sqlite2_parse.h" #include "sqlite3_parse.h" #include "common/utils_sql.h" #include <QString> #include <QMultiHash> #include <QDebug> -QHash<Token::Type,QSet<TokenPtr> > Lexer::everyTokenType2; QHash<Token::Type,QSet<TokenPtr> > Lexer::everyTokenType3; QHash<Token*,TokenPtr> Lexer::everyTokenTypePtrMap; -TokenPtr Lexer::semicolonTokenSqlite2; TokenPtr Lexer::semicolonTokenSqlite3; -Lexer::Lexer(Dialect dialect) - : dialect(dialect), sqlToTokenize(QString::null) +Lexer::Lexer() + : sqlToTokenize(QString()) { } @@ -25,7 +22,7 @@ Lexer::~Lexer() cleanUp(); } -TokenList Lexer::tokenize(const QString &sql) +TokenList Lexer::process(const QString &sql) { TokenList resultList; int lgt; @@ -40,7 +37,7 @@ TokenList Lexer::tokenize(const QString &sql) else token = TokenPtr::create(); - lgt = lexerGetToken(str, token, dialect == Dialect::Sqlite2 ? 2 : 3, tolerant); + lgt = lexerGetToken(str, token, 3, tolerant); if (lgt == 0) break; @@ -73,7 +70,7 @@ TokenPtr Lexer::getToken() else token = TokenPtr::create(); - int lgt = lexerGetToken(sqlToTokenize, token, dialect == Dialect::Sqlite2 ? 2 : 3, tolerant); + int lgt = lexerGetToken(sqlToTokenize, token, 3, tolerant); if (lgt == 0) return TokenPtr(); @@ -110,9 +107,7 @@ QSet<TokenPtr> Lexer::getEveryTokenType(QSet<Token::Type> types) { // Process set of types QSet<TokenPtr> results; - QHashIterator<Token::Type,QSet<TokenPtr> > i( - dialect == Dialect::Sqlite2 ? everyTokenType2 : everyTokenType3 - ); + QHashIterator<Token::Type,QSet<TokenPtr> > i(everyTokenType3); while (i.hasNext()) { i.next(); @@ -130,149 +125,79 @@ bool Lexer::isEnd() const return sqlToTokenize.isEmpty(); } -TokenPtr Lexer::getSemicolonToken(Dialect dialect) +TokenPtr Lexer::getSemicolonToken() { - return (dialect == Dialect::Sqlite3) ? semicolonTokenSqlite3 : semicolonTokenSqlite2; + return semicolonTokenSqlite3; } void Lexer::staticInit() { - createTokenType(Dialect::Sqlite3, TK3_SPACE, Token::SPACE, " "); - createTokenType(Dialect::Sqlite3, TK3_COMMENT, Token::COMMENT, "--"); - createTokenType(Dialect::Sqlite3, TK3_MINUS, Token::OPERATOR, "-"); - createTokenType(Dialect::Sqlite3, TK3_SPACE, Token::SPACE, " "); - createTokenType(Dialect::Sqlite3, TK3_LP, Token::PAR_LEFT, "("); - createTokenType(Dialect::Sqlite3, TK3_RP, Token::PAR_RIGHT, ")"); + createTokenType(TK3_SPACE, Token::SPACE, " "); + createTokenType(TK3_COMMENT, Token::COMMENT, "--"); + createTokenType(TK3_MINUS, Token::OPERATOR, "-"); + createTokenType(TK3_SPACE, Token::SPACE, " "); + createTokenType(TK3_LP, Token::PAR_LEFT, "("); + createTokenType(TK3_RP, Token::PAR_RIGHT, ")"); semicolonTokenSqlite3 = - createTokenType(Dialect::Sqlite3, TK3_SEMI, Token::OPERATOR, ";"); - createTokenType(Dialect::Sqlite3, TK3_PLUS, Token::OPERATOR, "+"); - createTokenType(Dialect::Sqlite3, TK3_STAR, Token::OPERATOR, "*"); - createTokenType(Dialect::Sqlite3, TK3_SLASH, Token::OPERATOR, "/"); - createTokenType(Dialect::Sqlite3, TK3_COMMENT, Token::COMMENT, "/* */"); - createTokenType(Dialect::Sqlite3, TK3_EQ, Token::OPERATOR, "="); - createTokenType(Dialect::Sqlite3, TK3_EQ, Token::OPERATOR, "=="); - createTokenType(Dialect::Sqlite3, TK3_LE, Token::OPERATOR, "<="); - createTokenType(Dialect::Sqlite3, TK3_NE, Token::OPERATOR, "<>"); - createTokenType(Dialect::Sqlite3, TK3_NE, Token::OPERATOR, "!="); - createTokenType(Dialect::Sqlite3, TK3_LSHIFT, Token::OPERATOR, "<<"); - createTokenType(Dialect::Sqlite3, TK3_LT, Token::OPERATOR, "<"); - createTokenType(Dialect::Sqlite3, TK3_GE, Token::OPERATOR, ">="); - createTokenType(Dialect::Sqlite3, TK3_RSHIFT, Token::OPERATOR, ">>"); - createTokenType(Dialect::Sqlite3, TK3_GT, Token::OPERATOR, ">"); - createTokenType(Dialect::Sqlite3, TK3_BITOR, Token::OPERATOR, "|"); - createTokenType(Dialect::Sqlite3, TK3_CONCAT, Token::OPERATOR, "||"); - createTokenType(Dialect::Sqlite3, TK3_COMMA, Token::OPERATOR, ","); - createTokenType(Dialect::Sqlite3, TK3_BITAND, Token::OPERATOR, "&"); - createTokenType(Dialect::Sqlite3, TK3_BITNOT, Token::OPERATOR, "~"); - createTokenType(Dialect::Sqlite3, TK3_STRING, Token::STRING, "' '"); - createTokenType(Dialect::Sqlite3, TK3_ID, Token::OTHER, "id"); - createTokenType(Dialect::Sqlite3, TK3_DOT, Token::OPERATOR, "."); - createTokenType(Dialect::Sqlite3, TK3_INTEGER, Token::INTEGER, "1"); - createTokenType(Dialect::Sqlite3, TK3_FLOAT, Token::FLOAT, "1.0"); - createTokenType(Dialect::Sqlite3, TK3_VARIABLE, Token::BIND_PARAM, "?"); - createTokenType(Dialect::Sqlite3, TK3_BLOB, Token::BLOB, "X'53'"); + createTokenType(TK3_SEMI, Token::OPERATOR, ";"); + createTokenType(TK3_PLUS, Token::OPERATOR, "+"); + createTokenType(TK3_STAR, Token::OPERATOR, "*"); + createTokenType(TK3_SLASH, Token::OPERATOR, "/"); + createTokenType(TK3_COMMENT, Token::COMMENT, "/* */"); + createTokenType(TK3_EQ, Token::OPERATOR, "="); + createTokenType(TK3_EQ, Token::OPERATOR, "=="); + createTokenType(TK3_LE, Token::OPERATOR, "<="); + createTokenType(TK3_NE, Token::OPERATOR, "<>"); + createTokenType(TK3_NE, Token::OPERATOR, "!="); + createTokenType(TK3_LSHIFT, Token::OPERATOR, "<<"); + createTokenType(TK3_LT, Token::OPERATOR, "<"); + createTokenType(TK3_GE, Token::OPERATOR, ">="); + createTokenType(TK3_RSHIFT, Token::OPERATOR, ">>"); + createTokenType(TK3_GT, Token::OPERATOR, ">"); + createTokenType(TK3_BITOR, Token::OPERATOR, "|"); + createTokenType(TK3_CONCAT, Token::OPERATOR, "||"); + createTokenType(TK3_COMMA, Token::OPERATOR, ","); + createTokenType(TK3_BITAND, Token::OPERATOR, "&"); + createTokenType(TK3_BITNOT, Token::OPERATOR, "~"); + createTokenType(TK3_STRING, Token::STRING, "' '"); + createTokenType(TK3_ID, Token::OTHER, "id"); + createTokenType(TK3_DOT, Token::OPERATOR, "."); + createTokenType(TK3_INTEGER, Token::INTEGER, "1"); + createTokenType(TK3_FLOAT, Token::FLOAT, "1.0"); + createTokenType(TK3_VARIABLE, Token::BIND_PARAM, "?"); + createTokenType(TK3_BLOB, Token::BLOB, "X'53'"); // Contextual ID tokens - createTokenType(Dialect::Sqlite3, TK3_ID_DB, Token::CTX_DATABASE, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_TAB, Token::CTX_TABLE, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_TAB_NEW, Token::CTX_TABLE_NEW, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_COL, Token::CTX_COLUMN, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_COL_NEW, Token::CTX_COLUMN_NEW, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_COL_TYPE, Token::CTX_COLUMN_TYPE, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_COLLATE, Token::CTX_COLLATION, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_FN, Token::CTX_FUNCTION, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_ERR_MSG, Token::CTX_ERROR_MESSAGE, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_IDX, Token::CTX_INDEX, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_IDX_NEW, Token::CTX_INDEX_NEW, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_VIEW, Token::CTX_VIEW, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_VIEW_NEW, Token::CTX_VIEW_NEW, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_JOIN_OPTS, Token::CTX_JOIN_OPTS, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_CONSTR, Token::CTX_CONSTRAINT, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_FK_MATCH, Token::CTX_FK_MATCH, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_TRANS, Token::CTX_TRANSACTION, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_ALIAS, Token::CTX_ALIAS, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_PRAGMA, Token::CTX_PRAGMA, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_TRIG, Token::CTX_TRIGGER, ""); - createTokenType(Dialect::Sqlite3, TK3_ID_TRIG_NEW, Token::CTX_TRIGGER_NEW, ""); - createTokenType(Dialect::Sqlite3, TK3_CTX_ROWID_KW, Token::CTX_ROWID_KW, "ROWID"); - createTokenType(Dialect::Sqlite3, TK3_ID, Token::CTX_OLD_KW, "OLD"); - createTokenType(Dialect::Sqlite3, TK3_ID, Token::CTX_NEW_KW, "NEW"); + createTokenType(TK3_ID_DB, Token::CTX_DATABASE, ""); + createTokenType(TK3_ID_TAB, Token::CTX_TABLE, ""); + createTokenType(TK3_ID_TAB_NEW, Token::CTX_TABLE_NEW, ""); + createTokenType(TK3_ID_COL, Token::CTX_COLUMN, ""); + createTokenType(TK3_ID_COL_NEW, Token::CTX_COLUMN_NEW, ""); + createTokenType(TK3_ID_COL_TYPE, Token::CTX_COLUMN_TYPE, ""); + createTokenType(TK3_ID_COLLATE, Token::CTX_COLLATION, ""); + createTokenType(TK3_ID_FN, Token::CTX_FUNCTION, ""); + createTokenType(TK3_ID_ERR_MSG, Token::CTX_ERROR_MESSAGE, ""); + createTokenType(TK3_ID_IDX, Token::CTX_INDEX, ""); + createTokenType(TK3_ID_IDX_NEW, Token::CTX_INDEX_NEW, ""); + createTokenType(TK3_ID_VIEW, Token::CTX_VIEW, ""); + createTokenType(TK3_ID_VIEW_NEW, Token::CTX_VIEW_NEW, ""); + createTokenType(TK3_ID_JOIN_OPTS, Token::CTX_JOIN_OPTS, ""); + createTokenType(TK3_ID_CONSTR, Token::CTX_CONSTRAINT, ""); + createTokenType(TK3_ID_FK_MATCH, Token::CTX_FK_MATCH, ""); + createTokenType(TK3_ID_TRANS, Token::CTX_TRANSACTION, ""); + createTokenType(TK3_ID_ALIAS, Token::CTX_ALIAS, ""); + createTokenType(TK3_ID_PRAGMA, Token::CTX_PRAGMA, ""); + createTokenType(TK3_ID_TRIG, Token::CTX_TRIGGER, ""); + createTokenType(TK3_ID_TRIG_NEW, Token::CTX_TRIGGER_NEW, ""); + createTokenType(TK3_CTX_ROWID_KW, Token::CTX_ROWID_KW, "ROWID"); + createTokenType(TK3_ID, Token::CTX_OLD_KW, "OLD"); + createTokenType(TK3_ID, Token::CTX_NEW_KW, "NEW"); QHashIterator<QString,int> i3(getKeywords3()); while (i3.hasNext()) { i3.next(); - createTokenType(Dialect::Sqlite3, i3.value(), Token::KEYWORD, i3.key()); - } - - // - // SQLite 2 - // - - createTokenType(Dialect::Sqlite2, TK2_SPACE, Token::SPACE, " "); - createTokenType(Dialect::Sqlite2, TK2_COMMENT, Token::COMMENT, "--"); - createTokenType(Dialect::Sqlite2, TK2_MINUS, Token::OPERATOR, "-"); - createTokenType(Dialect::Sqlite2, TK2_SPACE, Token::SPACE, " "); - createTokenType(Dialect::Sqlite2, TK2_LP, Token::PAR_LEFT, "("); - createTokenType(Dialect::Sqlite2, TK2_RP, Token::PAR_RIGHT, ")"); - semicolonTokenSqlite2 = - createTokenType(Dialect::Sqlite2, TK2_SEMI, Token::OPERATOR, ";"); - createTokenType(Dialect::Sqlite2, TK2_PLUS, Token::OPERATOR, "+"); - createTokenType(Dialect::Sqlite2, TK2_STAR, Token::OPERATOR, "*"); - createTokenType(Dialect::Sqlite2, TK2_SLASH, Token::OPERATOR, "/"); - createTokenType(Dialect::Sqlite2, TK2_COMMENT, Token::COMMENT, "/* */"); - createTokenType(Dialect::Sqlite2, TK2_EQ, Token::OPERATOR, "="); - createTokenType(Dialect::Sqlite2, TK2_EQ, Token::OPERATOR, "=="); - createTokenType(Dialect::Sqlite2, TK2_LE, Token::OPERATOR, "<="); - createTokenType(Dialect::Sqlite2, TK2_NE, Token::OPERATOR, "<>"); - createTokenType(Dialect::Sqlite2, TK2_NE, Token::OPERATOR, "!="); - createTokenType(Dialect::Sqlite2, TK2_LSHIFT, Token::OPERATOR, "<<"); - createTokenType(Dialect::Sqlite2, TK2_LT, Token::OPERATOR, "<"); - createTokenType(Dialect::Sqlite2, TK2_GE, Token::OPERATOR, ">="); - createTokenType(Dialect::Sqlite2, TK2_RSHIFT, Token::OPERATOR, ">>"); - createTokenType(Dialect::Sqlite2, TK2_GT, Token::OPERATOR, ">"); - createTokenType(Dialect::Sqlite2, TK2_BITOR, Token::OPERATOR, "|"); - createTokenType(Dialect::Sqlite2, TK2_CONCAT, Token::OPERATOR, "||"); - createTokenType(Dialect::Sqlite2, TK2_COMMA, Token::OPERATOR, ","); - createTokenType(Dialect::Sqlite2, TK2_BITAND, Token::OPERATOR, "&"); - createTokenType(Dialect::Sqlite2, TK2_BITNOT, Token::OPERATOR, "~"); - createTokenType(Dialect::Sqlite2, TK2_STRING, Token::STRING, "' '"); - createTokenType(Dialect::Sqlite2, TK2_ID, Token::OTHER, "id"); - createTokenType(Dialect::Sqlite2, TK2_DOT, Token::OPERATOR, "."); - createTokenType(Dialect::Sqlite2, TK2_INTEGER, Token::INTEGER, "1"); - createTokenType(Dialect::Sqlite2, TK2_FLOAT, Token::FLOAT, "1.0"); - createTokenType(Dialect::Sqlite2, TK2_VARIABLE, Token::BIND_PARAM, "?"); - - // Contextual ID tokens - createTokenType(Dialect::Sqlite2, TK2_ID_DB, Token::CTX_DATABASE, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_TAB, Token::CTX_TABLE, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_TAB_NEW, Token::CTX_TABLE_NEW, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_COL, Token::CTX_COLUMN, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_COL_NEW, Token::CTX_COLUMN_NEW, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_COL_TYPE, Token::CTX_COLUMN_TYPE, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_FN, Token::CTX_FUNCTION, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_ERR_MSG, Token::CTX_ERROR_MESSAGE, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_IDX, Token::CTX_INDEX, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_IDX_NEW, Token::CTX_INDEX_NEW, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_VIEW, Token::CTX_VIEW, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_VIEW_NEW, Token::CTX_VIEW_NEW, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_JOIN_OPTS, Token::CTX_JOIN_OPTS, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_CONSTR, Token::CTX_CONSTRAINT, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_FK_MATCH, Token::CTX_FK_MATCH, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_TRANS, Token::CTX_TRANSACTION, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_ALIAS, Token::CTX_ALIAS, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_PRAGMA, Token::CTX_PRAGMA, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_TRIG, Token::CTX_TRIGGER, ""); - createTokenType(Dialect::Sqlite2, TK2_ID_TRIG_NEW, Token::CTX_TRIGGER_NEW, ""); - createTokenType(Dialect::Sqlite2, TK2_ID, Token::CTX_ROWID_KW, "ROWID"); - createTokenType(Dialect::Sqlite2, TK2_ID, Token::CTX_OLD_KW, "OLD"); - createTokenType(Dialect::Sqlite2, TK2_ID, Token::CTX_NEW_KW, "NEW"); - - QHashIterator<QString,int> i2(getKeywords2()); - while (i2.hasNext()) - { - i2.next(); - createTokenType(Dialect::Sqlite2, i2.value(), Token::KEYWORD, i2.key()); + createTokenType(i3.value(), Token::KEYWORD, i3.key()); } } @@ -308,7 +233,7 @@ QString Lexer::detokenize(const TokenPtr& token) case Token::CTX_TRIGGER_NEW: case Token::CTX_VIEW: case Token::CTX_VIEW_NEW: - return token->value.isEmpty() ? wrapObjName(token->value, Dialect::Sqlite3, NameWrapper::DOUBLE_QUOTE) : token->value; + return token->value.isEmpty() ? wrapObjName(token->value, NameWrapper::DOUBLE_QUOTE) : token->value; case Token::CTX_ERROR_MESSAGE: case Token::STRING: return token->value.isEmpty() ? wrapString(token->value) : token->value; @@ -318,10 +243,10 @@ QString Lexer::detokenize(const TokenPtr& token) return token->value; } -TokenList Lexer::tokenize(const QString& sql, Dialect dialect) +TokenList Lexer::tokenize(const QString& sql) { - Lexer lexer(dialect); - return lexer.tokenize(sql); + Lexer lexer; + return lexer.process(sql); } TokenPtr Lexer::getEveryTokenTypePtr(Token *token) @@ -333,13 +258,10 @@ TokenPtr Lexer::getEveryTokenTypePtr(Token *token) return TokenPtr(); } -TokenPtr Lexer::createTokenType(Dialect dialect, int lemonType, Token::Type type, const QString &value) +TokenPtr Lexer::createTokenType(int lemonType, Token::Type type, const QString &value) { TokenPtr tokenPtr = TokenPtr::create(lemonType, type, value, -100, -100); - if (dialect == Dialect::Sqlite2) - everyTokenType2[type] << tokenPtr; - else - everyTokenType3[type] << tokenPtr; + everyTokenType3[type] << tokenPtr; everyTokenTypePtrMap[tokenPtr.data()] = tokenPtr; return tokenPtr; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.h b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.h index 8473844..10db9ce 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.h @@ -2,7 +2,6 @@ #define LEXER_H #include "token.h" -#include "dialect.h" #include <QList> #include <QString> @@ -24,10 +23,9 @@ class API_EXPORT Lexer { public: /** - * @brief Creates lexer for given dialect. - * @param dialect SQLite dialect. + * @brief Creates lexer. */ - Lexer(Dialect dialect); + Lexer(); /** * @brief Releases resources. @@ -39,7 +37,7 @@ class API_EXPORT Lexer * @param sql SQL query to tokenize. * @return List of tokens produced from tokenizing query. */ - TokenList tokenize(const QString& sql); + TokenList process(const QString& sql); /** * @brief Stores given SQL query internally for further processing by the lexer. @@ -138,18 +136,17 @@ class API_EXPORT Lexer static QString detokenize(const TokenPtr& token); /** - * @brief Tokenizes given SQL query with given dialect. + * @brief Tokenizes given SQL query. * @param sql SQL query to tokenize. - * @param dialect SQLite dialect to use when tokenizing. * @return List of tokens from tokenizing. * * This method is a shortcut for: * @code - * Lexer lexer(dialect); + * Lexer lexer; * lexer.tokenize(sql); * @endcode */ - static TokenList tokenize(const QString& sql, Dialect dialect); + static TokenList tokenize(const QString& sql); /** * @brief Translates token pointer into common token shared pointer. @@ -169,19 +166,16 @@ class API_EXPORT Lexer static TokenPtr getEveryTokenTypePtr(Token* token); /** - * @brief Provides token representing semicolon in given SQLite dialect. - * @param dialect Dialect to use. + * @brief Provides token representing semicolon in SQLite dialect. * @return Token representing semicolon. * * This is used by Parser to complete the parsed query in case the input query did not end with semicolon. - * Given the \p dialect it provides proper token for that dialect (they are different by Lemon token ID). */ - static TokenPtr getSemicolonToken(Dialect dialect); + static TokenPtr getSemicolonToken(); private: /** * @brief Creates token for every token type internal tables. - * @param dialect SQLite dialect to create token for. * @param lemonType Lemon token ID for this token type. * @param type SQLiteStudio token type. * @param value Sample value for the token. @@ -191,7 +185,7 @@ class API_EXPORT Lexer * * @see getEveryTokenType() */ - static TokenPtr createTokenType(Dialect dialect, int lemonType, Token::Type type, const QString& value); + static TokenPtr createTokenType(int lemonType, Token::Type type, const QString& value); /** * @brief Current "tolerant mode" flag. @@ -201,11 +195,6 @@ class API_EXPORT Lexer bool tolerant = false; /** - * @brief Lexer's SQLite dialect. - */ - Dialect dialect; - - /** * @brief SQL query to be tokenized with getToken(). * * It's defined with prepare(). @@ -223,13 +212,6 @@ class API_EXPORT Lexer quint64 tokenPosition; /** - * @brief Internal table of every token type for SQLite 2. - * - * @see semicolonTokenSqlite3 - */ - static TokenPtr semicolonTokenSqlite2; - - /** * @brief Internal table of every token type for SQLite 3. * * Internal token type table contains single token per token type, so it can be used to probe the Parser @@ -238,13 +220,6 @@ class API_EXPORT Lexer static TokenPtr semicolonTokenSqlite3; /** - * @brief Internal table of every token type for SQLite 2. - * - * @see everyTokenType3 - */ - static QHash<Token::Type,QSet<TokenPtr> > everyTokenType2; - - /** * @brief Internal table of every token type for SQLite 3. * * Set of tokens representing all token types, including diversification by values for keywords and operators. diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp index 9a0d3d2..65f9222 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp @@ -2,7 +2,6 @@ #include "token.h" #include "keywords.h" #include "sqlite3_parse.h" -#include "sqlite2_parse.h" #include "common/utils.h" #include "common/utils_sql.h" @@ -21,7 +20,7 @@ bool isIdChar(const QChar& c) int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tolerant) { - if (sqliteVersion < 2 || sqliteVersion > 3) + if (sqliteVersion < 3 || sqliteVersion > 3) { qCritical() << "lexerGetToken() called with invalid sqliteVersion:" << sqliteVersion; return 0; @@ -33,7 +32,6 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole return 0; } - bool v3 = sqliteVersion == 3; int i; QChar c; QChar z0 = charAt(z, 0); @@ -43,7 +41,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole if (z0.isSpace()) { for(i=1; charAt(z, i).isSpace(); i++) {} - token->lemonType = v3 ? TK3_SPACE : TK2_SPACE; + token->lemonType = TK3_SPACE; token->type = Token::SPACE; return i; } @@ -52,41 +50,41 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole if (charAt(z, 1) == '-') { for (i=2; !(c = charAt(z, i)).isNull() && c != '\n'; i++) {} - token->lemonType = v3 ? TK3_COMMENT : TK2_COMMENT; + token->lemonType = TK3_COMMENT; token->type = Token::COMMENT; return i; } - token->lemonType = v3 ? TK3_MINUS : TK2_MINUS; + token->lemonType = TK3_MINUS; token->type = Token::OPERATOR; return 1; } if (z0 == '(') { - token->lemonType = v3 ? TK3_LP : TK2_LP; + token->lemonType = TK3_LP; token->type = Token::PAR_LEFT; return 1; } if (z0 == ')') { - token->lemonType = v3 ? TK3_RP : TK2_RP; + token->lemonType = TK3_RP; token->type = Token::PAR_RIGHT; return 1; } if (z0 == ';') { - token->lemonType = v3 ? TK3_SEMI : TK2_SEMI; + token->lemonType = TK3_SEMI; token->type = Token::OPERATOR; return 1; } if (z0 == '+') { - token->lemonType = v3 ? TK3_PLUS : TK2_PLUS; + token->lemonType = TK3_PLUS; token->type = Token::OPERATOR; return 1; } if (z0 == '*') { - token->lemonType = v3 ? TK3_STAR : TK2_STAR; + token->lemonType = TK3_STAR; token->type = Token::OPERATOR; return 1; } @@ -94,14 +92,14 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole { if ( charAt(z, 1) != '*' ) { - token->lemonType = v3 ? TK3_SLASH : TK2_SLASH; + token->lemonType = TK3_SLASH; token->type = Token::OPERATOR; return 1; } if ( charAt(z, 2).isNull() ) { - token->lemonType = v3 ? TK3_COMMENT : TK2_COMMENT; + token->lemonType = TK3_COMMENT; token->type = Token::COMMENT; if (tolerant) token.dynamicCast<TolerantToken>()->invalid = true; @@ -119,19 +117,19 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole if ( c > 0 ) #endif i++; - token->lemonType = v3 ? TK3_COMMENT : TK2_COMMENT; + token->lemonType = TK3_COMMENT; token->type = Token::COMMENT; return i; } if (z0 == '%') { - token->lemonType = v3 ? TK3_REM : TK2_REM; + token->lemonType = TK3_REM; token->type = Token::OPERATOR; return 1; } if (z0 == '=') { - token->lemonType = v3 ? TK3_EQ : TK2_EQ; + token->lemonType = TK3_EQ; token->type = Token::OPERATOR; return 1 + (charAt(z, 1) == '='); } @@ -139,25 +137,25 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole { if ( (c = charAt(z, 1)) == '=' ) { - token->lemonType = v3 ? TK3_LE : TK2_LE; + token->lemonType = TK3_LE; token->type = Token::OPERATOR; return 2; } else if ( c == '>' ) { - token->lemonType = v3 ? TK3_NE : TK2_NE; + token->lemonType = TK3_NE; token->type = Token::OPERATOR; return 2; } else if( c == '<' ) { - token->lemonType = v3 ? TK3_LSHIFT : TK2_LSHIFT; + token->lemonType = TK3_LSHIFT; token->type = Token::OPERATOR; return 2; } else { - token->lemonType = v3 ? TK3_LT : TK2_LT; + token->lemonType = TK3_LT; token->type = Token::OPERATOR; return 1; } @@ -166,19 +164,19 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole { if ( (c = charAt(z, 1)) == '=' ) { - token->lemonType = v3 ? TK3_GE : TK2_GE; + token->lemonType = TK3_GE; token->type = Token::OPERATOR; return 2; } else if ( c == '>' ) { - token->lemonType = v3 ? TK3_RSHIFT : TK2_RSHIFT; + token->lemonType = TK3_RSHIFT; token->type = Token::OPERATOR; return 2; } else { - token->lemonType = v3 ? TK3_GT : TK2_GT; + token->lemonType = TK3_GT; token->type = Token::OPERATOR; return 1; } @@ -187,13 +185,13 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole { if ( charAt(z, 1) != '=' ) { - token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL; + token->lemonType = TK3_ILLEGAL; token->type = Token::INVALID; return 2; } else { - token->lemonType = v3 ? TK3_NE : TK2_NE; + token->lemonType = TK3_NE; token->type = Token::OPERATOR; return 2; } @@ -202,32 +200,32 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole { if( charAt(z, 1) != '|' ) { - token->lemonType = v3 ? TK3_BITOR : TK2_BITOR; + token->lemonType = TK3_BITOR; token->type = Token::OPERATOR; return 1; } else { - token->lemonType = v3 ? TK3_CONCAT : TK2_CONCAT; + token->lemonType = TK3_CONCAT; token->type = Token::OPERATOR; return 2; } } if (z0 == ',') { - token->lemonType = v3 ? TK3_COMMA : TK2_COMMA; + token->lemonType = TK3_COMMA; token->type = Token::OPERATOR; return 1; } if (z0 == '&') { - token->lemonType = v3? TK3_BITAND : TK2_BITAND; + token->lemonType = TK3_BITAND; token->type = Token::OPERATOR; return 1; } if (z0 == '~') { - token->lemonType = v3? TK3_BITNOT : TK2_BITAND; + token->lemonType = TK3_BITNOT; token->type = Token::OPERATOR; return 1; } @@ -248,13 +246,13 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole } if ( c == '\'' ) { - token->lemonType = v3? TK3_STRING : TK2_STRING; + token->lemonType = TK3_STRING; token->type = Token::STRING; return i+1; } else if ( !c.isNull() ) { - token->lemonType = v3 ? TK3_ID : TK2_ID; + token->lemonType = TK3_ID; token->type = Token::OTHER; return i+1; } @@ -262,12 +260,12 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole { if (z0 == '\'') { - token->lemonType = v3 ? TK3_STRING : TK2_STRING; + token->lemonType = TK3_STRING; token->type = Token::STRING; } else { - token->lemonType = v3 ? TK3_ID : TK2_ID; + token->lemonType = TK3_ID; token->type = Token::OTHER; } token.dynamicCast<TolerantToken>()->invalid = true; @@ -275,7 +273,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole } else { - token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL; + token->lemonType = TK3_ILLEGAL; token->type = Token::INVALID; return i; } @@ -284,7 +282,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole { if( !charAt(z, 1).isDigit() ) { - token->lemonType = v3 ? TK3_DOT : TK2_DOT; + token->lemonType = TK3_DOT; token->type = Token::OPERATOR; return 1; } @@ -295,9 +293,9 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole } if (z0.isDigit() || z0 == '.') { - token->lemonType = v3 ? TK3_INTEGER : TK2_INTEGER; + token->lemonType = TK3_INTEGER; token->type = Token::INTEGER; - if (v3 && charAt(z, 0) == '0' && (charAt(z, 1) == 'x' || charAt(z, 1) == 'X') && isHex(charAt(z, 2))) + if (charAt(z, 0) == '0' && (charAt(z, 1) == 'x' || charAt(z, 1) == 'X') && isHex(charAt(z, 2))) { for (i=3; isHex(charAt(z, i)); i++) {} return i; @@ -309,7 +307,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole while ( charAt(z, i).isDigit() ) i++; - token->lemonType = v3 ? TK3_FLOAT : TK2_FLOAT; + token->lemonType = TK3_FLOAT; token->type = Token::FLOAT; } if ( (charAt(z, i) == 'e' || charAt(z, i) == 'E') && @@ -322,12 +320,12 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole while ( charAt(z, i).isDigit() ) i++; - token->lemonType = v3 ? TK3_FLOAT : TK2_FLOAT; + token->lemonType = TK3_FLOAT; token->type = Token::FLOAT; } while ( isIdChar(charAt(z, i)) ) { - token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL; + token->lemonType = TK3_ILLEGAL; token->type = Token::INVALID; i++; } @@ -338,27 +336,27 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole for (i = 1, c = z0; c!=']' && !(c = charAt(z, i)).isNull(); i++) {} if (c == ']') { - token->lemonType = v3 ? TK3_ID : TK2_ID; + token->lemonType = TK3_ID; token->type = Token::OTHER; } else if (tolerant) { - token->lemonType = v3 ? TK3_ID : TK2_ID; + token->lemonType = TK3_ID; token->type = Token::OTHER; token.dynamicCast<TolerantToken>()->invalid = true; } else { - token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL; + token->lemonType = TK3_ILLEGAL; token->type = Token::INVALID; } return i; } if (z0 == '?') { - token->lemonType = v3 ? TK3_VARIABLE : TK2_VARIABLE; + token->lemonType = TK3_VARIABLE; token->type = Token::BIND_PARAM; - for (i=1; charAt(z, i+2).isDigit(); i++) {} + for (i=1; charAt(z, i).isDigit(); i++) {} return i; } if (z0 == '$' || @@ -366,7 +364,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole z0 == ':') { int n = 0; - token->lemonType = v3 ? TK3_VARIABLE : TK2_VARIABLE; + token->lemonType = TK3_VARIABLE; token->type = Token::BIND_PARAM; for (i = 1; !(c = charAt(z, i)).isNull(); i++) { @@ -388,7 +386,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole } else { - token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL; + token->lemonType = TK3_ILLEGAL; token->type = Token::INVALID; } break; @@ -404,15 +402,13 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole } if( n == 0 ) { - token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL; + token->lemonType = TK3_ILLEGAL; token->type = Token::INVALID; } return i; } - if ((z0 == 'x' || - z0 == 'X') && - v3) + if (z0 == 'x' || z0 == 'X') { if ( charAt(z, 1) == '\'' ) { @@ -457,12 +453,9 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole for (i = 1; isIdChar(charAt(z, i)); i++) {} - if (v3) token->lemonType = getKeywordId3(z.mid(0, i)); - else - token->lemonType = getKeywordId2(z.mid(0, i)); - if (token->lemonType == TK3_ID || token->lemonType == TK2_ID) + if (token->lemonType == TK3_ID) token->type = Token::OTHER; else token->type = Token::KEYWORD; @@ -471,11 +464,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole } } - if (v3) - token->lemonType = TK3_ILLEGAL; - else - token->lemonType = TK2_ILLEGAL; - + token->lemonType = TK3_ILLEGAL; token->type = Token::INVALID; return 1; } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h b/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h index 9027d04..d642177 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h @@ -11,16 +11,16 @@ * @brief Low level tokenizer function used by the Lexer. * @param z Query to tokenize. * @param[out] token Token container to fill with values. Can be also a TolerantToken. - * @param sqliteVersion SQLite version, for which the tokenizer should work (2 or 3). + * @param sqliteVersion SQLite version, for which the tokenizer should work (currently only 3). * Version affects the list of recognized keywords, a BLOB expression and an object name wrapper with the grave accent character (`). * @param tolerant If true, then all multi-line and unfinished tokens (strings, comments) * will be reported with invalid=true in TolerantToken, but the token itself will have type like it was finished. * If this is true, then \p token must be of type TolerantToken, otherwise the the method will return 0 and log a critical error. - * @return Lemon token ID (see sqlite2_parse.h and sqlite3_parse.h for possible token IDs). + * @return Lemon token ID (see sqlite3_parse.h for possible token IDs). * * You shouldn't normally need to use this method. Instead of that, use Lexer class, as it provides higher level API. * - * Most of the method code was taken from SQLite tokenizer code. It is modified to support both SQLite 2 and 3 grammas + * Most of the method code was taken from SQLite tokenizer code. It is modified to support both SQLite 3 gramma * and other SQLiteStudio specific features. */ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tolerant = false); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp index 55669a5..b54c786 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp @@ -18,18 +18,8 @@ void sqlite3_parseRestoreParserState(void* saved, void* target); void sqlite3_parseFreeSavedState(void* other); void sqlite3_parseAddToken(void* other, Token* token); -void* sqlite2_parseAlloc(void *(*mallocProc)(size_t)); -void sqlite2_parseFree(void *p, void (*freeProc)(void*)); -void sqlite2_parse(void *yyp, int yymajor, Token* yyminor, ParserContext* parserContext); -void sqlite2_parseTrace(FILE *stream, char *zPrefix); -void* sqlite2_parseCopyParserState(void* other); -void sqlite2_parseRestoreParserState(void* saved, void* target); -void sqlite2_parseFreeSavedState(void* other); -void sqlite2_parseAddToken(void* other, Token* token); - -Parser::Parser(Dialect dialect) +Parser::Parser() { - this->dialect = dialect; init(); } @@ -53,74 +43,44 @@ void Parser::cleanUp() } } -void Parser::fillSqliteDialect() -{ - for (SqliteQueryPtr query : context->parsedQueries) - query->setSqliteDialect(dialect); -} - void *Parser::parseAlloc(void *(*mallocProc)(size_t)) { - if (dialect == Dialect::Sqlite2) - return sqlite2_parseAlloc(mallocProc); - else - return sqlite3_parseAlloc(mallocProc); + return sqlite3_parseAlloc(mallocProc); } void Parser::parseFree(void *p, void (*freeProc)(void *)) { - if (dialect == Dialect::Sqlite2) - sqlite2_parseFree(p, freeProc); - else - sqlite3_parseFree(p, freeProc); + sqlite3_parseFree(p, freeProc); } void Parser::parse(void *yyp, int yymajor, TokenPtr yyminor, ParserContext *parserContext) { - if (dialect == Dialect::Sqlite2) - sqlite2_parse(yyp, yymajor, yyminor.data(), parserContext); - else - sqlite3_parse(yyp, yymajor, yyminor.data(), parserContext); + sqlite3_parse(yyp, yymajor, yyminor.data(), parserContext); } void Parser::parseTrace(FILE *stream, char *zPrefix) { - if (dialect == Dialect::Sqlite2) - sqlite2_parseTrace(stream, zPrefix); - else - sqlite3_parseTrace(stream, zPrefix); + sqlite3_parseTrace(stream, zPrefix); } void *Parser::parseCopyParserState(void *other) { - if (dialect == Dialect::Sqlite2) - return sqlite2_parseCopyParserState(other); - else - return sqlite3_parseCopyParserState(other); + return sqlite3_parseCopyParserState(other); } void Parser::parseRestoreParserState(void *saved, void *target) { - if (dialect == Dialect::Sqlite2) - sqlite2_parseRestoreParserState(saved, target); - else - sqlite3_parseRestoreParserState(saved, target); + sqlite3_parseRestoreParserState(saved, target); } void Parser::parseFreeSavedState(void *other) { - if (dialect == Dialect::Sqlite2) - sqlite2_parseFreeSavedState(other); - else - sqlite3_parseFreeSavedState(other); + sqlite3_parseFreeSavedState(other); } void Parser::parseAddToken(void *other, TokenPtr token) { - if (dialect == Dialect::Sqlite2) - sqlite2_parseAddToken(other, token.data()); - else - sqlite3_parseAddToken(other, token.data()); + sqlite3_parseAddToken(other, token.data()); } bool Parser::parse(const QString &sql, bool ignoreMinorErrors) @@ -134,21 +94,17 @@ bool Parser::parseInternal(const QString &sql, bool lookForExpectedToken) void* pParser = parseAlloc( malloc ); if (debugLemon) { - char* label = nullptr; - if (dialect == Dialect::Sqlite2) - label = const_cast<char*>("[LEMON2]: "); - else - label = const_cast<char*>("[LEMON3]: "); - + char* label = const_cast<char*>("[LEMON3]: "); parseTrace(stderr, label); } + else + parseTrace(nullptr, nullptr); reset(); lexer->prepare(sql); context->setupTokens = !lookForExpectedToken; context->executeRules = !lookForExpectedToken; context->doFallbacks = !lookForExpectedToken; - context->dialect = dialect; TokenPtr token = lexer->getToken(); if (!token.isNull()) @@ -186,17 +142,15 @@ bool Parser::parseInternal(const QString &sql, bool lookForExpectedToken) { if (!endsWithSemicolon) { - token = Lexer::getSemicolonToken(dialect); + token = Lexer::getSemicolonToken(); parse(pParser, token->lemonType, token, context); } qint64 endIdx = sql.length(); - TokenPtr endToken = TokenPtr::create(0, Token::INVALID, QString::null, endIdx, endIdx); + TokenPtr endToken = TokenPtr::create(0, Token::INVALID, QString(), endIdx, endIdx); parse(pParser, 0, endToken, context); } - fillSqliteDialect(); - // Free all non-termials having destructors parseFree(pParser, free); @@ -278,7 +232,7 @@ void Parser::expectedTokenLookup(void* pParser) void Parser::init() { - lexer = new Lexer(dialect); + lexer = new Lexer(); context = new ParserContext(); } @@ -307,16 +261,6 @@ void Parser::setLemonDebug(bool enabled) debugLemon = enabled; } -void Parser::setDialect(Dialect dialect) -{ - if (this->dialect == dialect) - return; - - this->dialect = dialect; - delete lexer; - lexer = new Lexer(dialect); -} - const QList<SqliteQueryPtr>& Parser::getQueries() { return context->getQueries(); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser.h b/SQLiteStudio3/coreSQLiteStudio/parser/parser.h index 8fe25f2..04e9ccb 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parser.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser.h @@ -2,7 +2,7 @@ #define PARSER_H #include "token.h" -#include "../dialect.h" +#undef NDEBUG #include "ast/sqlitequery.h" #include "ast/sqliteexpr.h" @@ -18,7 +18,7 @@ class ParserError; * * Typical use case would be: * @code - * Parser parser(db->getDialect()); + * Parser parser(); * if (parser.parse(queryString)) * { * QList<SqliteQueryPtr> queries = parser.getQueries(); @@ -47,9 +47,7 @@ class ParserError; * Finally, there is a parseExpr() to parse just a SQLite expression * (http://sqlite.org/lang_expr.html). * - * Parser works basing on SQLite grammar defined in sqlite2.y and sqlite3.y files. - * Since there are 2 completly separate grammar definitions, there are 2 dialects - * that the parser works with. + * Parser works basing on SQLite grammar defined in sqlite3.y file. * * This is a high-level API to the Lemon Parser, the original SQLite parser. */ @@ -57,10 +55,9 @@ class API_EXPORT Parser { public: /** - * @brief Creates parser for given SQLite dialect. - * @param dialect SQLite dialect to use. Can be changed later with setDialect(). + * @brief Creates parser for SQLite dialect. */ - Parser(Dialect dialect); + Parser(); /** * @brief Releases internal resources. @@ -78,12 +75,6 @@ class API_EXPORT Parser void setLemonDebug(bool enabled); /** - * @brief Changes dialect used by parser. - * @param dialect Dialect to use. - */ - void setDialect(Dialect dialect); - - /** * @brief Parses given query string. * @param sql SQL query string to parse. Can be multiple queries separated with semicolon. * @param ignoreMinorErrors If true, then parser will ignore minor errors. Detailed descritpion below. @@ -125,7 +116,7 @@ class API_EXPORT Parser * * Example: * @code - * Parser parser(db->getDialect()); + * Parser parser; * SqliteSelectPtr select = parser.parse<SelectPtr>(queryString); * if (!select) * { @@ -257,14 +248,6 @@ class API_EXPORT Parser void cleanUp(); /** - * @brief Propagates dialect to all AST objects. - * - * This is called after successful parsing to set the adequate SQLite dialect - * in all AST objects. - */ - void fillSqliteDialect(); - - /** * @brief Creates Lemon parser. * @return Pointer to Lemon parser. */ @@ -326,11 +309,6 @@ class API_EXPORT Parser void parseAddToken(void* other, TokenPtr token); /** - * @brief Parser's dialect. - */ - Dialect dialect; - - /** * @brief Flag indicating if the Lemon low-level debug messages are enabled. */ bool debugLemon = false; diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp index 9299c52..8b14f07 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp @@ -44,3 +44,34 @@ ParserDeferSubClause::ParserDeferSubClause(SqliteDeferrable deferrable, SqliteIn this->deferrable = deferrable; } + +ParserTermOrLiteral::ParserTermOrLiteral(const QString& name) +{ + value = name; + nameMode = true; +} + +ParserTermOrLiteral::ParserTermOrLiteral(const QVariant& literal) +{ + value = literal; +} + +QString ParserTermOrLiteral::toName() const +{ + return value.toString(); +} + +QVariant ParserTermOrLiteral::toLiteral() const +{ + return value; +} + +bool ParserTermOrLiteral::isName() const +{ + return !value.isNull() && value.type() == QVariant::String; +} + +bool ParserTermOrLiteral::isLiteral() const +{ + return !nameMode; +} diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h b/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h index ae52989..5160b10 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h @@ -9,6 +9,8 @@ #include "ast/sqliteindexedcolumn.h" #include "ast/sqliteforeignkey.h" #include "ast/sqliteorderby.h" +#include "ast/sqlitewindowdefinition.h" +#include "ast/sqlitewith.h" #include <QString> #include <QList> @@ -27,8 +29,8 @@ */ struct ParserFullName { - QString name1 = QString::null; - QString name2 = QString::null; + QString name1 = QString(); + QString name2 = QString(); }; /** @@ -59,7 +61,7 @@ struct ParserStubInsertOrReplace */ struct ParserStubTransDetails { - QString name = QString::null; + QString name = QString(); SqliteBeginTrans::Type type = SqliteBeginTrans::Type::null; bool transactionKw = false; bool toKw = false; @@ -71,6 +73,7 @@ typedef QList<SqliteCreateTable::Constraint*> ParserCreateTableConstraintList; typedef QList<SqliteCreateTable::Column::Constraint*> ParserCreateTableColumnConstraintList; typedef QList<SqliteForeignKey::Condition*> ParserFkConditionList; typedef QList<SqliteExpr*> ParserExprList; +typedef QList<SqliteWith::CommonTableExpression*> ParserCteList; typedef QList<SqliteSelect::Core::ResultColumn*> ParserResultColumnList; typedef QList<SqliteSelect::Core::JoinSourceOther*> ParserOtherSourceList; typedef QList<SqliteOrderBy*> ParserOrderByList; @@ -79,6 +82,7 @@ typedef QPair<QVariant,SqliteExpr*> ParserSetValue; typedef QList<ParserSetValue> ParserSetValueList; typedef QList<SqliteIndexedColumn*> ParserIndexedColumnList; typedef QList<ParserExprList> ParserExprNestedList; +typedef QList<SqliteWindowDefinition*> ParserWindowDefList; /** * @brief Stores parameters for defferable foreign keys. @@ -98,7 +102,7 @@ struct ParserStubAlias { ParserStubAlias(const QString& name, bool asKw); - QString name = QString::null; + QString name = QString(); bool asKw = false; }; @@ -111,7 +115,23 @@ struct ParserIndexedBy explicit ParserIndexedBy(bool indexedBy); bool notIndexedKw = false; - QString indexedBy = QString::null; + QString indexedBy = QString(); +}; + +class ParserTermOrLiteral +{ + public: + explicit ParserTermOrLiteral(const QString& name); + explicit ParserTermOrLiteral(const QVariant& literal); + + QString toName() const; + QVariant toLiteral() const; + bool isName() const; + bool isLiteral() const; + + private: + QVariant value; + bool nameMode = false; }; #endif // PARSER_HELPER_STUBS_H diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp index d9832bc..a9eae82 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp @@ -109,7 +109,7 @@ void ParserContext::flushErrors() else error(QObject::tr("Incomplete query.")); - nextTokenError = QString::null; + nextTokenError = QString(); raiseErrorBeforeNextToken = false; } } @@ -144,7 +144,7 @@ void ParserContext::addManagedToken(TokenPtr token) if (raiseErrorBeforeNextToken) { error(token, nextTokenError); - nextTokenError = QString::null; + nextTokenError = QString(); raiseErrorBeforeNextToken = false; } } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h index 64ce3a3..154fe3f 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h @@ -3,7 +3,6 @@ #include "ast/sqlitequery.h" #include "parser.h" -#include "../dialect.h" #include <QHash> #include <QList> @@ -233,14 +232,6 @@ class ParserContext */ bool ignoreMinorErrors = false; - /** - * @brief Dialect used for the parsing. - * - * This is used by the Lemon parser in various situations, like for example when it strips the object name - * from it's wrapping characters ([], "", ``) - that depends on the dialect. - */ - Dialect dialect; - private: /** * @brief Clears all internal containers and deletes error objects. diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h b/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h index 673f030..bd4462d 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h @@ -64,7 +64,7 @@ class API_EXPORT ParserError /** * @brief Error message. */ - QString message = QString::null; + QString message = QString(); /** * @brief Error start position. diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat b/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat index 961e21e..3b74bbb 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat +++ b/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat @@ -1,8 +1,7 @@ +@echo off set LEMON=C:\utils\lemon.exe rem %LEMON% -l -q -s sqlite3_parse.y +rem %LEMON% -l -p sqlite3_parse.y %LEMON% -l -q sqlite3_parse.y move sqlite3_parse.c sqlite3_parse.cpp - -%LEMON% -l -q sqlite2_parse.y -move sqlite2_parse.c sqlite2_parse.cpp diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh b/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh index 3df47e1..d42f0c1 100755 --- a/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh +++ b/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh @@ -3,6 +3,3 @@ #lemon -l -q -s sqlite3_parse.y lemon -l -q sqlite3_parse.y mv sqlite3_parse.c sqlite3_parse.cpp - -lemon -l -q sqlite2_parse.y -mv sqlite2_parse.c sqlite2_parse.cpp diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.cpp deleted file mode 100644 index ea60ecc..0000000 --- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.cpp +++ /dev/null @@ -1,4662 +0,0 @@ -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -** -** This version of "lempar.c" is modified, slightly, for use by SQLite. -** The only modifications are the addition of a couple of NEVER() -** macros to disable tests that are needed in the case of a general -** LALR(1) grammar but which are always false in the -** specific grammar used by SQLite. -*/ -/* First off, code is included that follows the "include" declaration -** in the input grammar file. */ -#include <stdio.h> - -#include "token.h" -#include "parsercontext.h" -#include "parser/ast/sqlitealtertable.h" -#include "parser/ast/sqliteanalyze.h" -#include "parser/ast/sqliteattach.h" -#include "parser/ast/sqlitebegintrans.h" -#include "parser/ast/sqlitecommittrans.h" -#include "parser/ast/sqlitecopy.h" -#include "parser/ast/sqlitecreateindex.h" -#include "parser/ast/sqlitecreatetable.h" -#include "parser/ast/sqlitecreatetrigger.h" -#include "parser/ast/sqlitecreateview.h" -#include "parser/ast/sqlitecreatevirtualtable.h" -#include "parser/ast/sqlitedelete.h" -#include "parser/ast/sqlitedetach.h" -#include "parser/ast/sqlitedropindex.h" -#include "parser/ast/sqlitedroptable.h" -#include "parser/ast/sqlitedroptrigger.h" -#include "parser/ast/sqlitedropview.h" -#include "parser/ast/sqliteemptyquery.h" -#include "parser/ast/sqliteinsert.h" -#include "parser/ast/sqlitepragma.h" -#include "parser/ast/sqlitereindex.h" -#include "parser/ast/sqliterelease.h" -#include "parser/ast/sqliterollback.h" -#include "parser/ast/sqlitesavepoint.h" -#include "parser/ast/sqliteselect.h" -#include "parser/ast/sqliteupdate.h" -#include "parser/ast/sqlitevacuum.h" -#include "parser/ast/sqliteexpr.h" -#include "parser/ast/sqlitecolumntype.h" -#include "parser/ast/sqliteconflictalgo.h" -#include "parser/ast/sqlitesortorder.h" -#include "parser/ast/sqliteindexedcolumn.h" -#include "parser/ast/sqliteforeignkey.h" -#include "parser_helper_stubs.h" -#include "common/utils_sql.h" -#include <QObject> -#include <QDebug> - -#define assert(X) Q_ASSERT(X) -#define UNUSED_PARAMETER(X) (void)(X) -#define DONT_INHERIT_TOKENS(X) noTokenInheritanceFields << X -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* -** These constants (all generated automatically by the parser generator) -** specify the various kinds of tokens (terminals) that the parser -** understands. -** -** Each symbol here is a terminal symbol in the grammar. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** sqlite2_parseTOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is sqlite2_parseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. If -** zero the stack is dynamically sized using realloc() -** sqlite2_parseARG_SDECL A static variable declaration for the %extra_argument -** sqlite2_parseARG_PDECL A parameter declaration for the %extra_argument -** sqlite2_parseARG_STORE Code to store %extra_argument into yypParser -** sqlite2_parseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 241 -#define YYACTIONTYPE unsigned short int -#define sqlite2_parseTOKENTYPE Token* -typedef union { - int yyinit; - sqlite2_parseTOKENTYPE yy0; - ParserCreateTableConstraintList* yy13; - SqliteSelect::Core::JoinSource* yy31; - ParserStubAlias* yy40; - SqliteExpr::LikeOp* yy41; - ParserCreateTableColumnList* yy42; - SqliteColumnType* yy57; - ParserIndexedColumnList* yy63; - QVariant* yy69; - SqliteCreateTrigger::Scope* yy83; - ParserStubExplain* yy91; - QStringList* yy95; - ParserFullName* yy120; - SqliteSelect::Core::SingleSource* yy121; - ParserOtherSourceList* yy131; - SqliteCreateTable::Column* yy147; - SqliteSelect::Core* yy150; - SqliteCreateTrigger::Event* yy151; - SqliteSelect* yy153; - SqliteForeignKey::Condition* yy187; - SqliteExpr* yy192; - ParserSetValueList* yy201; - SqliteQuery* yy203; - ParserResultColumnList* yy213; - SqliteSelect::Core::JoinOp* yy221; - int* yy226; - ParserExprList* yy231; - ParserOrderByList* yy243; - ParserFkConditionList* yy264; - ParserQueryList* yy270; - bool* yy291; - SqliteCreateTable::Column::Constraint* yy304; - SqliteInitially* yy312; - QString* yy319; - SqliteLimit* yy324; - ParserDeferSubClause* yy329; - ParserStubInsertOrReplace* yy344; - ParserCreateTableColumnConstraintList* yy371; - SqliteCreateTrigger::Time* yy372; - SqliteSelect::CompoundOperator* yy382; - SqliteSortOrder* yy389; - ParserStubTransDetails* yy404; - SqliteCreateTable::Constraint* yy406; - SqliteConflictAlgo* yy418; - SqliteForeignKey::Condition::Reaction* yy424; - SqliteIndexedColumn* yy428; - SqliteSelect::Core::JoinConstraint* yy455; -} YYMINORTYPE; -#ifndef YYSTACKDEPTH -#define YYSTACKDEPTH 100 -#endif -#define sqlite2_parseARG_SDECL ParserContext* parserContext; -#define sqlite2_parseARG_PDECL ,ParserContext* parserContext -#define sqlite2_parseARG_FETCH ParserContext* parserContext = yypParser->parserContext -#define sqlite2_parseARG_STORE yypParser->parserContext = parserContext -#define YYNSTATE 584 -#define YYNRULE 352 -#define YYFALLBACK 1 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -#define GET_CONTEXT yyParser* yypParser = pParser; sqlite2_parseARG_FETCH - -/* The yyzerominor constant is used to initialize instances of -** YYMINORTYPE objects to zero. */ -static const YYMINORTYPE yyzerominor = { 0 }; - -/* Define the yytestcase() macro to be a no-op if is not already defined -** otherwise. -** -** Applications can choose to define yytestcase() in the %include section -** to a macro that can assist in verifying code coverage. For production -** code the yytestcase() macro should be turned off. But it is useful -** for testing. -*/ -#ifndef yytestcase -# define yytestcase(X) -#endif - - -/* Next are the tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -#define YY_ACTTAB_COUNT (1737) -static const YYACTIONTYPE yy_action[] = { - /* 0 */ 338, 191, 186, 242, 476, 511, 576, 193, 332, 16, - /* 10 */ 511, 384, 189, 322, 239, 519, 518, 570, 337, 450, - /* 20 */ 15, 851, 125, 58, 575, 179, 851, 574, 63, 143, - /* 30 */ 401, 581, 328, 26, 84, 569, 114, 322, 573, 519, - /* 40 */ 518, 851, 851, 35, 851, 851, 851, 851, 851, 851, - /* 50 */ 851, 851, 851, 851, 851, 851, 851, 851, 851, 32, - /* 60 */ 33, 851, 851, 851, 851, 320, 379, 34, 240, 238, - /* 70 */ 121, 556, 291, 251, 57, 7, 217, 577, 265, 264, - /* 80 */ 523, 179, 555, 336, 335, 338, 569, 549, 548, 550, - /* 90 */ 271, 569, 10, 724, 199, 297, 203, 489, 459, 332, - /* 100 */ 568, 567, 451, 253, 158, 523, 449, 444, 443, 337, - /* 110 */ 187, 870, 266, 187, 580, 517, 168, 328, 505, 343, - /* 120 */ 143, 235, 490, 108, 101, 489, 523, 164, 35, 531, - /* 130 */ 187, 13, 523, 252, 234, 547, 236, 119, 340, 232, - /* 140 */ 339, 120, 216, 155, 32, 33, 481, 547, 322, 215, - /* 150 */ 519, 518, 34, 714, 456, 477, 320, 367, 547, 478, - /* 160 */ 7, 714, 400, 321, 251, 523, 714, 563, 336, 335, - /* 170 */ 500, 553, 549, 548, 550, 188, 465, 500, 401, 466, - /* 180 */ 366, 365, 552, 364, 293, 435, 39, 39, 39, 38, - /* 190 */ 523, 562, 60, 255, 714, 569, 714, 714, 852, 570, - /* 200 */ 271, 714, 502, 852, 500, 714, 570, 714, 714, 714, - /* 210 */ 714, 523, 569, 178, 531, 422, 13, 523, 44, 45, - /* 220 */ 330, 42, 42, 530, 530, 223, 852, 852, 43, 43, - /* 230 */ 43, 43, 41, 41, 41, 41, 40, 40, 39, 39, - /* 240 */ 39, 38, 199, 297, 203, 55, 236, 92, 340, 232, - /* 250 */ 339, 120, 216, 500, 106, 570, 268, 19, 187, 215, - /* 260 */ 500, 105, 553, 41, 41, 41, 41, 40, 40, 39, - /* 270 */ 39, 39, 38, 552, 40, 40, 39, 39, 39, 38, - /* 280 */ 852, 3, 568, 567, 187, 852, 512, 500, 219, 568, - /* 290 */ 567, 17, 496, 156, 322, 345, 519, 518, 569, 292, - /* 300 */ 44, 45, 330, 42, 42, 530, 530, 223, 852, 852, - /* 310 */ 43, 43, 43, 43, 41, 41, 41, 41, 40, 40, - /* 320 */ 39, 39, 39, 38, 547, 533, 852, 100, 308, 306, - /* 330 */ 305, 852, 448, 447, 418, 418, 316, 245, 568, 567, - /* 340 */ 304, 937, 122, 344, 1, 582, 44, 45, 330, 42, - /* 350 */ 42, 530, 530, 223, 852, 852, 43, 43, 43, 43, - /* 360 */ 41, 41, 41, 41, 40, 40, 39, 39, 39, 38, - /* 370 */ 338, 442, 44, 45, 330, 42, 42, 530, 530, 223, - /* 380 */ 524, 569, 43, 43, 43, 43, 41, 41, 41, 41, - /* 390 */ 40, 40, 39, 39, 39, 38, 5, 9, 524, 781, - /* 400 */ 220, 324, 328, 167, 44, 45, 330, 42, 42, 530, - /* 410 */ 530, 223, 781, 35, 43, 43, 43, 43, 41, 41, - /* 420 */ 41, 41, 40, 40, 39, 39, 39, 38, 8, 32, - /* 430 */ 33, 274, 387, 435, 547, 388, 237, 34, 774, 421, - /* 440 */ 60, 14, 219, 569, 250, 7, 774, 437, 441, 169, - /* 450 */ 523, 524, 569, 336, 335, 285, 781, 549, 548, 550, - /* 460 */ 43, 43, 43, 43, 41, 41, 41, 41, 40, 40, - /* 470 */ 39, 39, 39, 38, 332, 523, 332, 425, 470, 774, - /* 480 */ 560, 774, 774, 850, 337, 426, 337, 455, 850, 613, - /* 490 */ 774, 181, 774, 774, 774, 143, 523, 143, 30, 531, - /* 500 */ 614, 13, 523, 850, 850, 850, 850, 850, 850, 850, - /* 510 */ 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, - /* 520 */ 850, 850, 850, 850, 850, 850, 850, 852, 500, 460, - /* 530 */ 357, 320, 852, 318, 75, 570, 401, 570, 311, 251, - /* 540 */ 569, 251, 446, 445, 570, 358, 359, 44, 45, 330, - /* 550 */ 42, 42, 530, 530, 223, 852, 852, 43, 43, 43, - /* 560 */ 43, 41, 41, 41, 41, 40, 40, 39, 39, 39, - /* 570 */ 38, 338, 44, 45, 330, 42, 42, 530, 530, 223, - /* 580 */ 615, 570, 43, 43, 43, 43, 41, 41, 41, 41, - /* 590 */ 40, 40, 39, 39, 39, 38, 185, 184, 497, 782, - /* 600 */ 199, 297, 203, 328, 360, 538, 96, 488, 97, 570, - /* 610 */ 103, 500, 782, 436, 35, 570, 187, 225, 568, 567, - /* 620 */ 568, 567, 332, 354, 540, 539, 294, 568, 567, 570, - /* 630 */ 32, 33, 337, 356, 482, 355, 569, 85, 34, 759, - /* 640 */ 532, 111, 70, 78, 487, 483, 7, 759, 90, 494, - /* 650 */ 508, 523, 493, 160, 336, 335, 782, 528, 549, 548, - /* 660 */ 550, 532, 440, 434, 568, 567, 118, 54, 332, 919, - /* 670 */ 214, 100, 308, 306, 305, 75, 523, 333, 337, 571, - /* 680 */ 759, 529, 759, 759, 304, 48, 177, 522, 31, 143, - /* 690 */ 29, 759, 568, 567, 759, 759, 159, 523, 568, 567, - /* 700 */ 531, 464, 13, 523, 44, 45, 330, 42, 42, 530, - /* 710 */ 530, 223, 568, 567, 43, 43, 43, 43, 41, 41, - /* 720 */ 41, 41, 40, 40, 39, 39, 39, 38, 463, 570, - /* 730 */ 498, 919, 570, 323, 514, 570, 222, 44, 45, 330, - /* 740 */ 42, 42, 530, 530, 223, 393, 392, 43, 43, 43, - /* 750 */ 43, 41, 41, 41, 41, 40, 40, 39, 39, 39, - /* 760 */ 38, 44, 45, 330, 42, 42, 530, 530, 223, 540, - /* 770 */ 539, 43, 43, 43, 43, 41, 41, 41, 41, 40, - /* 780 */ 40, 39, 39, 39, 38, 583, 1, 44, 45, 330, - /* 790 */ 42, 42, 530, 530, 223, 267, 475, 43, 43, 43, - /* 800 */ 43, 41, 41, 41, 41, 40, 40, 39, 39, 39, - /* 810 */ 38, 256, 568, 567, 420, 568, 567, 163, 568, 567, - /* 820 */ 110, 570, 218, 44, 45, 330, 42, 42, 530, 530, - /* 830 */ 223, 27, 468, 43, 43, 43, 43, 41, 41, 41, - /* 840 */ 41, 40, 40, 39, 39, 39, 38, 486, 547, 44, - /* 850 */ 45, 330, 42, 42, 530, 530, 223, 859, 212, 43, - /* 860 */ 43, 43, 43, 41, 41, 41, 41, 40, 40, 39, - /* 870 */ 39, 39, 38, 44, 47, 330, 42, 42, 530, 530, - /* 880 */ 223, 535, 284, 43, 43, 43, 43, 41, 41, 41, - /* 890 */ 41, 40, 40, 39, 39, 39, 38, 45, 330, 42, - /* 900 */ 42, 530, 530, 223, 568, 567, 43, 43, 43, 43, - /* 910 */ 41, 41, 41, 41, 40, 40, 39, 39, 39, 38, - /* 920 */ 330, 42, 42, 530, 530, 223, 338, 160, 43, 43, - /* 930 */ 43, 43, 41, 41, 41, 41, 40, 40, 39, 39, - /* 940 */ 39, 38, 164, 570, 527, 338, 332, 269, 544, 543, - /* 950 */ 526, 162, 561, 79, 452, 64, 337, 88, 328, 455, - /* 960 */ 570, 209, 385, 272, 205, 357, 204, 139, 525, 35, - /* 970 */ 520, 569, 395, 547, 569, 569, 23, 328, 213, 254, - /* 980 */ 358, 275, 547, 75, 182, 32, 33, 310, 35, 569, - /* 990 */ 361, 66, 164, 34, 160, 396, 398, 317, 397, 293, - /* 1000 */ 570, 7, 862, 516, 32, 33, 523, 570, 538, 336, - /* 1010 */ 335, 522, 34, 549, 548, 550, 25, 4, 289, 338, - /* 1020 */ 7, 471, 395, 547, 12, 523, 568, 567, 336, 335, - /* 1030 */ 302, 523, 549, 548, 550, 75, 570, 404, 338, 276, - /* 1040 */ 538, 104, 108, 568, 567, 396, 398, 76, 397, 293, - /* 1050 */ 523, 328, 523, 570, 65, 531, 500, 13, 523, 101, - /* 1060 */ 185, 184, 35, 570, 172, 171, 170, 197, 290, 503, - /* 1070 */ 328, 523, 75, 570, 531, 301, 13, 523, 32, 33, - /* 1080 */ 380, 35, 10, 568, 567, 479, 34, 490, 540, 539, - /* 1090 */ 568, 567, 570, 325, 7, 211, 666, 32, 33, 523, - /* 1100 */ 179, 423, 336, 335, 570, 34, 549, 548, 550, 80, - /* 1110 */ 569, 570, 490, 7, 480, 489, 391, 570, 523, 568, - /* 1120 */ 567, 336, 335, 338, 523, 549, 548, 550, 255, 497, - /* 1130 */ 570, 262, 584, 106, 215, 484, 568, 567, 380, 500, - /* 1140 */ 312, 391, 202, 523, 296, 523, 568, 567, 531, 198, - /* 1150 */ 13, 523, 569, 413, 345, 328, 568, 567, 532, 569, - /* 1160 */ 474, 570, 307, 570, 523, 495, 35, 531, 53, 13, - /* 1170 */ 523, 496, 860, 456, 473, 568, 567, 570, 413, 532, - /* 1180 */ 570, 485, 32, 33, 407, 439, 10, 568, 567, 500, - /* 1190 */ 34, 489, 730, 570, 568, 567, 431, 403, 7, 52, - /* 1200 */ 568, 567, 570, 523, 582, 234, 336, 335, 338, 407, - /* 1210 */ 549, 548, 550, 568, 567, 18, 490, 570, 303, 489, - /* 1220 */ 497, 570, 403, 389, 390, 287, 570, 502, 523, 730, - /* 1230 */ 730, 570, 201, 570, 200, 424, 187, 569, 332, 51, - /* 1240 */ 328, 376, 569, 371, 568, 567, 568, 567, 337, 523, - /* 1250 */ 99, 35, 531, 124, 13, 523, 492, 368, 497, 148, - /* 1260 */ 568, 567, 570, 568, 567, 82, 376, 32, 33, 350, - /* 1270 */ 2, 570, 568, 567, 570, 34, 568, 567, 570, 73, - /* 1280 */ 179, 259, 570, 7, 862, 568, 567, 417, 523, 338, - /* 1290 */ 569, 336, 335, 22, 491, 549, 548, 550, 416, 69, - /* 1300 */ 568, 567, 371, 522, 568, 567, 570, 415, 405, 568, - /* 1310 */ 567, 261, 21, 523, 568, 567, 568, 567, 196, 368, - /* 1320 */ 378, 328, 411, 67, 542, 544, 543, 6, 569, 350, - /* 1330 */ 258, 406, 35, 502, 523, 399, 377, 531, 394, 13, - /* 1340 */ 523, 71, 338, 569, 108, 568, 567, 409, 32, 33, - /* 1350 */ 536, 544, 543, 456, 568, 567, 34, 568, 567, 81, - /* 1360 */ 386, 568, 567, 50, 7, 568, 567, 570, 281, 523, - /* 1370 */ 374, 383, 336, 335, 328, 115, 549, 548, 550, 263, - /* 1380 */ 544, 543, 309, 544, 543, 538, 219, 286, 179, 568, - /* 1390 */ 567, 381, 278, 179, 523, 195, 569, 372, 569, 277, - /* 1400 */ 363, 32, 33, 569, 501, 569, 351, 49, 457, 34, - /* 1410 */ 373, 538, 353, 102, 352, 523, 370, 7, 531, 260, - /* 1420 */ 13, 523, 523, 569, 257, 336, 335, 174, 332, 549, - /* 1430 */ 548, 550, 408, 160, 507, 245, 579, 157, 337, 570, - /* 1440 */ 538, 241, 332, 538, 332, 515, 332, 523, 332, 77, - /* 1450 */ 568, 567, 337, 342, 337, 569, 337, 112, 337, 180, - /* 1460 */ 332, 456, 332, 147, 11, 145, 456, 151, 523, 150, - /* 1470 */ 337, 531, 337, 13, 523, 194, 332, 369, 332, 332, - /* 1480 */ 74, 152, 332, 161, 566, 569, 337, 565, 337, 337, - /* 1490 */ 564, 332, 337, 522, 559, 557, 332, 224, 558, 249, - /* 1500 */ 144, 337, 341, 149, 270, 332, 337, 522, 332, 522, - /* 1510 */ 332, 522, 146, 522, 332, 337, 554, 248, 337, 551, - /* 1520 */ 337, 434, 568, 567, 337, 522, 247, 522, 332, 246, - /* 1530 */ 332, 141, 187, 546, 229, 133, 332, 17, 337, 319, - /* 1540 */ 337, 522, 332, 522, 522, 332, 337, 522, 228, 132, - /* 1550 */ 332, 140, 337, 334, 192, 337, 522, 131, 227, 332, - /* 1560 */ 337, 522, 279, 142, 569, 24, 130, 332, 332, 337, - /* 1570 */ 522, 129, 569, 522, 362, 522, 332, 337, 337, 522, - /* 1580 */ 127, 332, 332, 226, 569, 46, 337, 59, 135, 134, - /* 1590 */ 220, 337, 337, 522, 545, 522, 346, 136, 38, 332, - /* 1600 */ 36, 522, 138, 137, 314, 521, 569, 522, 572, 337, - /* 1610 */ 522, 534, 326, 504, 337, 522, 183, 499, 569, 315, - /* 1620 */ 128, 569, 569, 569, 522, 61, 469, 569, 432, 569, - /* 1630 */ 210, 28, 522, 522, 300, 166, 569, 513, 569, 295, - /* 1640 */ 569, 522, 375, 331, 569, 569, 522, 522, 221, 569, - /* 1650 */ 208, 109, 569, 569, 510, 570, 176, 83, 569, 107, - /* 1660 */ 569, 472, 244, 56, 522, 454, 569, 430, 453, 522, - /* 1670 */ 429, 428, 427, 243, 419, 98, 207, 95, 206, 288, - /* 1680 */ 298, 20, 94, 153, 93, 91, 414, 68, 123, 72, - /* 1690 */ 283, 402, 382, 117, 89, 87, 86, 116, 175, 280, - /* 1700 */ 347, 349, 173, 233, 113, 126, 230, 509, 541, 470, - /* 1710 */ 506, 537, 458, 282, 154, 410, 273, 190, 348, 438, - /* 1720 */ 467, 462, 329, 461, 578, 231, 62, 938, 37, 412, - /* 1730 */ 165, 433, 938, 938, 938, 327, 299, -}; -static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 4, 8, 195, 10, 80, 25, 5, 14, 156, 202, - /* 10 */ 30, 41, 19, 113, 21, 115, 116, 4, 166, 4, - /* 20 */ 79, 25, 81, 34, 23, 156, 30, 26, 35, 177, - /* 30 */ 37, 72, 36, 53, 54, 166, 43, 113, 37, 115, - /* 40 */ 116, 45, 46, 47, 48, 49, 50, 51, 52, 53, - /* 50 */ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - /* 60 */ 64, 65, 66, 67, 68, 213, 96, 71, 75, 76, - /* 70 */ 77, 16, 220, 221, 85, 79, 156, 76, 63, 64, - /* 80 */ 84, 156, 27, 87, 88, 4, 166, 91, 92, 93, - /* 90 */ 47, 166, 79, 80, 101, 102, 103, 84, 229, 156, - /* 100 */ 87, 88, 87, 110, 161, 109, 91, 92, 93, 166, - /* 110 */ 117, 141, 187, 117, 148, 80, 161, 36, 80, 153, - /* 120 */ 177, 93, 109, 85, 31, 112, 130, 161, 47, 133, - /* 130 */ 117, 135, 136, 90, 106, 192, 93, 94, 95, 96, - /* 140 */ 97, 98, 99, 13, 63, 64, 65, 192, 113, 106, - /* 150 */ 115, 116, 71, 72, 229, 114, 213, 191, 192, 118, - /* 160 */ 79, 80, 21, 220, 221, 84, 85, 80, 87, 88, - /* 170 */ 4, 7, 91, 92, 93, 32, 90, 4, 37, 93, - /* 180 */ 214, 215, 18, 217, 218, 156, 65, 66, 67, 68, - /* 190 */ 109, 162, 163, 100, 113, 166, 115, 116, 25, 4, - /* 200 */ 47, 120, 156, 30, 4, 124, 4, 126, 127, 128, - /* 210 */ 129, 130, 166, 184, 133, 186, 135, 136, 45, 46, - /* 220 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 230 */ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - /* 240 */ 67, 68, 101, 102, 103, 79, 93, 85, 95, 96, - /* 250 */ 97, 98, 99, 87, 81, 4, 210, 79, 117, 106, - /* 260 */ 87, 80, 7, 59, 60, 61, 62, 63, 64, 65, - /* 270 */ 66, 67, 68, 18, 63, 64, 65, 66, 67, 68, - /* 280 */ 25, 79, 87, 88, 117, 30, 84, 87, 156, 87, - /* 290 */ 88, 129, 119, 161, 113, 22, 115, 116, 166, 132, - /* 300 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - /* 310 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - /* 320 */ 65, 66, 67, 68, 192, 130, 25, 94, 95, 96, - /* 330 */ 97, 30, 91, 92, 83, 84, 204, 205, 87, 88, - /* 340 */ 107, 149, 150, 151, 152, 72, 45, 46, 47, 48, - /* 350 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - /* 360 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - /* 370 */ 4, 156, 45, 46, 47, 48, 49, 50, 51, 52, - /* 380 */ 5, 166, 55, 56, 57, 58, 59, 60, 61, 62, - /* 390 */ 63, 64, 65, 66, 67, 68, 79, 48, 23, 72, - /* 400 */ 99, 26, 36, 161, 45, 46, 47, 48, 49, 50, - /* 410 */ 51, 52, 85, 47, 55, 56, 57, 58, 59, 60, - /* 420 */ 61, 62, 63, 64, 65, 66, 67, 68, 79, 63, - /* 430 */ 64, 82, 6, 156, 192, 9, 159, 71, 72, 162, - /* 440 */ 163, 125, 156, 166, 164, 79, 80, 167, 168, 169, - /* 450 */ 84, 76, 166, 87, 88, 29, 129, 91, 92, 93, - /* 460 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - /* 470 */ 65, 66, 67, 68, 156, 109, 156, 180, 181, 113, - /* 480 */ 173, 115, 116, 25, 166, 188, 166, 180, 30, 82, - /* 490 */ 124, 205, 126, 127, 128, 177, 130, 177, 139, 133, - /* 500 */ 82, 135, 136, 45, 46, 47, 48, 49, 50, 51, - /* 510 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - /* 520 */ 62, 63, 64, 65, 66, 67, 68, 25, 4, 80, - /* 530 */ 156, 213, 30, 213, 85, 4, 37, 4, 220, 221, - /* 540 */ 166, 221, 91, 92, 4, 171, 172, 45, 46, 47, - /* 550 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 560 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - /* 570 */ 68, 4, 45, 46, 47, 48, 49, 50, 51, 52, - /* 580 */ 82, 4, 55, 56, 57, 58, 59, 60, 61, 62, - /* 590 */ 63, 64, 65, 66, 67, 68, 63, 64, 167, 72, - /* 600 */ 101, 102, 103, 36, 230, 231, 42, 85, 44, 4, - /* 610 */ 88, 87, 85, 89, 47, 4, 117, 85, 87, 88, - /* 620 */ 87, 88, 156, 90, 91, 92, 156, 87, 88, 4, - /* 630 */ 63, 64, 166, 100, 203, 102, 166, 82, 71, 72, - /* 640 */ 109, 82, 78, 177, 122, 123, 79, 80, 82, 109, - /* 650 */ 85, 84, 112, 222, 87, 88, 129, 21, 91, 92, - /* 660 */ 93, 130, 80, 86, 87, 88, 100, 85, 156, 10, - /* 670 */ 80, 94, 95, 96, 97, 85, 109, 211, 166, 74, - /* 680 */ 113, 93, 115, 116, 107, 120, 216, 221, 138, 177, - /* 690 */ 140, 124, 87, 88, 127, 128, 79, 130, 87, 88, - /* 700 */ 133, 11, 135, 136, 45, 46, 47, 48, 49, 50, - /* 710 */ 51, 52, 87, 88, 55, 56, 57, 58, 59, 60, - /* 720 */ 61, 62, 63, 64, 65, 66, 67, 68, 38, 4, - /* 730 */ 119, 72, 4, 221, 109, 4, 224, 45, 46, 47, - /* 740 */ 48, 49, 50, 51, 52, 39, 40, 55, 56, 57, - /* 750 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - /* 760 */ 68, 45, 46, 47, 48, 49, 50, 51, 52, 91, - /* 770 */ 92, 55, 56, 57, 58, 59, 60, 61, 62, 63, - /* 780 */ 64, 65, 66, 67, 68, 151, 152, 45, 46, 47, - /* 790 */ 48, 49, 50, 51, 52, 105, 80, 55, 56, 57, - /* 800 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - /* 810 */ 68, 157, 87, 88, 83, 87, 88, 161, 87, 88, - /* 820 */ 85, 4, 80, 45, 46, 47, 48, 49, 50, 51, - /* 830 */ 52, 139, 104, 55, 56, 57, 58, 59, 60, 61, - /* 840 */ 62, 63, 64, 65, 66, 67, 68, 122, 192, 45, - /* 850 */ 46, 47, 48, 49, 50, 51, 52, 138, 80, 55, - /* 860 */ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - /* 870 */ 66, 67, 68, 45, 46, 47, 48, 49, 50, 51, - /* 880 */ 52, 176, 228, 55, 56, 57, 58, 59, 60, 61, - /* 890 */ 62, 63, 64, 65, 66, 67, 68, 46, 47, 48, - /* 900 */ 49, 50, 51, 52, 87, 88, 55, 56, 57, 58, - /* 910 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - /* 920 */ 47, 48, 49, 50, 51, 52, 4, 222, 55, 56, - /* 930 */ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - /* 940 */ 67, 68, 161, 4, 80, 4, 156, 170, 171, 172, - /* 950 */ 80, 161, 173, 174, 175, 42, 166, 44, 36, 180, - /* 960 */ 4, 156, 145, 158, 156, 156, 158, 177, 80, 47, - /* 970 */ 114, 166, 191, 192, 166, 166, 100, 36, 80, 156, - /* 980 */ 171, 172, 192, 85, 212, 63, 64, 65, 47, 166, - /* 990 */ 167, 78, 161, 71, 222, 214, 215, 121, 217, 218, - /* 1000 */ 4, 79, 80, 80, 63, 64, 84, 4, 231, 87, - /* 1010 */ 88, 221, 71, 91, 92, 93, 85, 236, 237, 4, - /* 1020 */ 79, 80, 191, 192, 125, 84, 87, 88, 87, 88, - /* 1030 */ 80, 109, 91, 92, 93, 85, 4, 80, 4, 230, - /* 1040 */ 231, 80, 85, 87, 88, 214, 215, 79, 217, 218, - /* 1050 */ 109, 36, 130, 4, 141, 133, 4, 135, 136, 31, - /* 1060 */ 63, 64, 47, 4, 101, 102, 103, 80, 237, 130, - /* 1070 */ 36, 130, 85, 4, 133, 47, 135, 136, 63, 64, - /* 1080 */ 84, 47, 79, 87, 88, 65, 71, 84, 91, 92, - /* 1090 */ 87, 88, 4, 137, 79, 80, 80, 63, 64, 84, - /* 1100 */ 156, 85, 87, 88, 4, 71, 91, 92, 93, 82, - /* 1110 */ 166, 4, 109, 79, 65, 112, 84, 4, 84, 87, - /* 1120 */ 88, 87, 88, 4, 109, 91, 92, 93, 100, 167, - /* 1130 */ 4, 187, 0, 81, 106, 122, 87, 88, 142, 87, - /* 1140 */ 82, 109, 156, 109, 158, 130, 87, 88, 133, 156, - /* 1150 */ 135, 136, 166, 84, 22, 36, 87, 88, 109, 166, - /* 1160 */ 80, 4, 32, 4, 130, 203, 47, 133, 79, 135, - /* 1170 */ 136, 119, 138, 229, 80, 87, 88, 4, 109, 130, - /* 1180 */ 4, 122, 63, 64, 84, 80, 79, 87, 88, 4, - /* 1190 */ 71, 84, 85, 4, 87, 88, 108, 84, 79, 79, - /* 1200 */ 87, 88, 4, 84, 72, 106, 87, 88, 4, 109, - /* 1210 */ 91, 92, 93, 87, 88, 79, 109, 4, 32, 112, - /* 1220 */ 167, 4, 109, 101, 102, 103, 4, 156, 109, 122, - /* 1230 */ 123, 4, 156, 4, 158, 109, 117, 166, 156, 79, - /* 1240 */ 36, 84, 166, 84, 87, 88, 87, 88, 166, 130, - /* 1250 */ 98, 47, 133, 81, 135, 136, 203, 84, 167, 177, - /* 1260 */ 87, 88, 4, 87, 88, 100, 109, 63, 64, 84, - /* 1270 */ 10, 4, 87, 88, 4, 71, 87, 88, 4, 105, - /* 1280 */ 156, 210, 4, 79, 80, 87, 88, 111, 84, 4, - /* 1290 */ 166, 87, 88, 48, 203, 91, 92, 93, 109, 120, - /* 1300 */ 87, 88, 143, 221, 87, 88, 4, 109, 80, 87, - /* 1310 */ 88, 187, 48, 109, 87, 88, 87, 88, 156, 146, - /* 1320 */ 158, 36, 109, 131, 170, 171, 172, 79, 166, 144, - /* 1330 */ 20, 109, 47, 156, 130, 72, 109, 133, 72, 135, - /* 1340 */ 136, 33, 4, 166, 85, 87, 88, 130, 63, 64, - /* 1350 */ 170, 171, 172, 229, 87, 88, 71, 87, 88, 141, - /* 1360 */ 33, 87, 88, 79, 79, 87, 88, 4, 100, 84, - /* 1370 */ 112, 142, 87, 88, 36, 120, 91, 92, 93, 170, - /* 1380 */ 171, 172, 170, 171, 172, 231, 156, 210, 156, 87, - /* 1390 */ 88, 109, 121, 156, 109, 156, 166, 158, 166, 17, - /* 1400 */ 87, 63, 64, 166, 130, 166, 144, 165, 130, 71, - /* 1410 */ 143, 231, 80, 156, 80, 130, 146, 79, 133, 187, - /* 1420 */ 135, 136, 84, 166, 187, 87, 88, 81, 156, 91, - /* 1430 */ 92, 93, 130, 222, 204, 205, 155, 206, 166, 4, - /* 1440 */ 231, 154, 156, 231, 156, 156, 156, 109, 156, 177, - /* 1450 */ 87, 88, 166, 100, 166, 166, 166, 73, 166, 179, - /* 1460 */ 156, 229, 156, 177, 85, 177, 229, 177, 130, 177, - /* 1470 */ 166, 133, 166, 135, 136, 156, 156, 158, 156, 156, - /* 1480 */ 179, 177, 156, 177, 154, 166, 166, 154, 166, 166, - /* 1490 */ 154, 156, 166, 221, 155, 183, 156, 177, 155, 177, - /* 1500 */ 177, 166, 160, 177, 28, 156, 166, 221, 156, 221, - /* 1510 */ 156, 221, 177, 221, 156, 166, 155, 177, 166, 155, - /* 1520 */ 166, 86, 87, 88, 166, 221, 177, 221, 156, 177, - /* 1530 */ 156, 177, 117, 192, 197, 177, 156, 129, 166, 126, - /* 1540 */ 166, 221, 156, 221, 221, 156, 166, 221, 198, 177, - /* 1550 */ 156, 177, 166, 124, 156, 166, 221, 177, 199, 156, - /* 1560 */ 166, 221, 156, 177, 166, 127, 177, 156, 156, 166, - /* 1570 */ 221, 177, 166, 221, 156, 221, 156, 166, 166, 221, - /* 1580 */ 177, 156, 156, 200, 166, 212, 166, 128, 177, 177, - /* 1590 */ 99, 166, 166, 221, 201, 221, 156, 177, 68, 156, - /* 1600 */ 222, 221, 177, 177, 156, 47, 166, 221, 156, 166, - /* 1610 */ 221, 156, 156, 156, 166, 221, 225, 156, 166, 156, - /* 1620 */ 177, 166, 166, 166, 221, 177, 156, 166, 156, 166, - /* 1630 */ 156, 138, 221, 221, 156, 156, 166, 209, 166, 156, - /* 1640 */ 166, 221, 156, 156, 166, 166, 221, 221, 156, 166, - /* 1650 */ 156, 82, 166, 166, 166, 4, 156, 82, 166, 209, - /* 1660 */ 166, 155, 178, 79, 221, 166, 166, 155, 183, 221, - /* 1670 */ 155, 155, 155, 178, 209, 82, 209, 82, 234, 24, - /* 1680 */ 235, 138, 82, 45, 82, 82, 197, 190, 219, 79, - /* 1690 */ 209, 190, 155, 82, 82, 82, 82, 190, 238, 209, - /* 1700 */ 15, 239, 121, 176, 238, 194, 196, 176, 231, 181, - /* 1710 */ 208, 231, 176, 209, 185, 197, 167, 167, 167, 167, - /* 1720 */ 182, 182, 226, 182, 189, 193, 207, 240, 223, 189, - /* 1730 */ 232, 186, 240, 240, 240, 227, 233, -}; -#define YY_SHIFT_USE_DFLT (-101) -#define YY_SHIFT_COUNT (343) -#define YY_SHIFT_MIN (-100) -#define YY_SHIFT_MAX (1685) -static const short yy_shift_ofst[] = { - /* 0 */ 273, -7, 499, -4, 141, 922, 1204, 1119, 533, 533, - /* 10 */ 13, 577, 567, 1034, 1285, 1435, 81, 366, 1015, 941, - /* 20 */ 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, - /* 30 */ 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, - /* 40 */ 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1338, 1107, 43, - /* 50 */ 1278, 1278, 1278, 1278, 997, 997, 1278, 997, 997, 997, - /* 60 */ 524, 173, 1003, 1185, 1173, 1159, 1157, 1113, 1100, 1069, - /* 70 */ 251, 1274, 1274, 1302, 1028, 1278, 1274, 255, 301, 153, - /* 80 */ 1049, 996, 1032, 540, 202, 531, 1270, 1267, 1258, 1227, - /* 90 */ 1229, 1222, 1217, 1213, 1198, 1189, 817, 1176, 731, 1126, - /* 100 */ 1088, 728, 1059, 725, 1052, 1052, 611, 1052, 939, 625, - /* 110 */ 956, 195, 605, 1363, 1363, 1363, 1363, 1363, 1363, 1363, - /* 120 */ 1363, -30, 1132, 167, 1415, 1415, -101, 502, 502, 502, - /* 130 */ 502, 502, 502, 502, 527, 327, 659, 778, 742, 716, - /* 140 */ 692, 359, 828, 804, 804, 851, 873, 873, 405, 405, - /* 150 */ 405, 204, 211, 1, 233, 1, 181, 522, 35, 375, - /* 160 */ -20, 121, -76, -100, -100, 1122, 426, -100, -100, 166, - /* 170 */ 690, 690, 690, 200, 200, 200, 566, 162, 1016, 164, - /* 180 */ 93, 876, 164, 550, 678, 678, 565, 41, 164, 1685, - /* 190 */ 1581, 1685, 1611, 1638, 1614, 1613, 1612, 1353, 1611, 1638, - /* 200 */ 1610, 1603, 1602, 1638, 1408, 1600, 1543, 1655, 1595, 1593, - /* 210 */ 1584, 1353, 1353, 1353, 1353, 1476, 1651, 1584, 1353, 1575, - /* 220 */ 1651, 1569, 1493, 1558, 1530, 1491, 1459, 1429, 1438, 1413, - /* 230 */ 1408, 1415, 1353, 1353, 1476, 1353, 1353, 1379, 1384, 1384, - /* 240 */ 1384, 1353, 1384, -101, -101, -101, -101, -101, -101, -101, - /* 250 */ -101, 458, 15, 913, 349, 963, 564, 987, 706, 957, - /* 260 */ 950, 898, 590, 582, 451, 241, 449, 86, 38, -11, - /* 270 */ 55, 28, -59, 1346, 1262, 1334, 1332, 1313, 1382, 1271, - /* 280 */ 1255, 1282, 1268, 1284, 1218, 1327, 1259, 1308, 1310, 1266, - /* 290 */ 1263, 1228, 1248, 1192, 1264, 1245, 1174, 1179, 1260, 1165, - /* 300 */ 1172, 1099, 1152, 1160, 1186, 1136, 1120, 1089, 1130, 1105, - /* 310 */ 1094, 1080, 1020, 1058, 1027, 1013, 961, 968, 931, 899, - /* 320 */ 931, 923, 856, 719, 888, 870, 864, 735, 617, 636, - /* 330 */ 588, 559, 555, 532, 316, 498, 418, 407, 317, 178, - /* 340 */ 143, 87, 130, -41, -}; -#define YY_REDUCE_USE_DFLT (-194) -#define YY_REDUCE_COUNT (250) -#define YY_REDUCE_MIN (-193) -#define YY_REDUCE_MAX (1552) -static const short yy_reduce_ofst[] = { - /* 0 */ 192, -34, 781, -57, 831, 318, -148, 790, 809, 374, - /* 10 */ 132, 29, 320, 512, 466, 277, 1448, 1443, 1426, 1425, - /* 20 */ 1420, 1412, 1411, 1403, 1394, 1389, 1386, 1380, 1374, 1372, - /* 30 */ 1358, 1354, 1352, 1349, 1340, 1335, 1326, 1323, 1322, 1320, - /* 40 */ 1306, 1304, 1292, 1290, 1288, 1286, 1272, 1082, 1230, 779, - /* 50 */ 1237, 1232, 1124, 944, 1212, 1209, -75, 1180, 1154, 777, - /* 60 */ 280, 431, 286, 823, 1319, 1239, 1162, 1076, 986, 808, - /* 70 */ 805, 1177, 1071, 470, 297, -131, 46, 705, 772, 307, - /* 80 */ 1487, 1500, 1494, 1289, 1492, 1487, 1289, 1289, 1486, 1289, - /* 90 */ 1289, 1289, 1483, 1289, 1289, 1289, 1479, 1478, 1289, 1474, - /* 100 */ 1472, 1470, 1463, 1257, 1091, 1053, 1461, 962, 1457, 1289, - /* 110 */ 1456, 1455, 1452, 1440, 1418, 1406, 1398, 1289, 993, 215, - /* 120 */ -80, 654, 634, 656, 242, -45, -193, 1211, 1211, 1211, - /* 130 */ 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, - /* 140 */ 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, - /* 150 */ 1211, 1211, 1211, 1540, 1545, 1535, 1532, 1519, 1532, 1508, - /* 160 */ 1505, 1211, 1532, 1532, 1532, 1503, 1498, 1532, 1532, 1552, - /* 170 */ 1541, 1539, 1538, 1551, 1550, 1549, 1504, 1518, 1529, 1536, - /* 180 */ 1528, 1502, 1531, 1496, 1480, 1477, 1510, 1511, 1527, 1466, - /* 190 */ 1462, 1460, 1490, 1507, 1465, 1465, 1465, 1537, 1481, 1501, - /* 200 */ 1469, 1465, 1465, 1497, 1489, 1465, 1445, 1444, 1467, 1465, - /* 210 */ 1495, 1517, 1516, 1515, 1512, 1485, 1499, 1484, 1506, 1450, - /* 220 */ 1488, 1428, 1391, 1378, 1211, 1373, 1393, 1383, 1359, 1350, - /* 230 */ 1337, 1341, 1364, 1361, 1312, 1343, 1339, 1342, 1336, 1333, - /* 240 */ 1330, 1281, 1287, 1301, 1280, 1231, 1211, 1211, 1211, 1211, - /* 250 */ 1242, -}; -static const YYACTIONTYPE yy_default[] = { - /* 0 */ 589, 936, 936, 862, 903, 851, 851, 851, 936, 936, - /* 10 */ 730, 936, 851, 851, 851, 936, 851, 851, 851, 851, - /* 20 */ 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, - /* 30 */ 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, - /* 40 */ 851, 851, 851, 851, 851, 851, 851, 841, 724, 608, - /* 50 */ 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, - /* 60 */ 616, 720, 730, 936, 936, 936, 936, 790, 777, 768, - /* 70 */ 936, 800, 800, 783, 679, 936, 800, 756, 752, 936, - /* 80 */ 839, 936, 936, 731, 936, 839, 936, 936, 936, 936, - /* 90 */ 936, 791, 784, 778, 769, 936, 936, 936, 936, 936, - /* 100 */ 936, 936, 936, 936, 720, 720, 936, 720, 936, 936, - /* 110 */ 936, 840, 594, 936, 882, 936, 936, 936, 936, 936, - /* 120 */ 936, 605, 589, 936, 936, 936, 710, 736, 773, 761, - /* 130 */ 863, 856, 857, 855, 852, 852, 852, 852, 852, 852, - /* 140 */ 852, 852, 852, 852, 823, 816, 827, 815, 831, 826, - /* 150 */ 818, 817, 819, 936, 936, 936, 936, 723, 936, 936, - /* 160 */ 936, 820, 936, 789, 698, 936, 910, 693, 601, 618, - /* 170 */ 936, 936, 936, 936, 936, 936, 936, 772, 670, 756, - /* 180 */ 645, 738, 756, 858, 936, 936, 721, 708, 756, 934, - /* 190 */ 931, 934, 739, 683, 739, 739, 739, 681, 739, 683, - /* 200 */ 796, 739, 739, 683, 772, 739, 918, 915, 739, 739, - /* 210 */ 871, 681, 681, 681, 681, 662, 936, 871, 681, 739, - /* 220 */ 936, 739, 936, 852, 821, 752, 762, 748, 760, 757, - /* 230 */ 772, 936, 681, 681, 662, 681, 681, 665, 593, 593, - /* 240 */ 593, 681, 593, 649, 649, 726, 830, 829, 828, 822, - /* 250 */ 629, 864, 936, 936, 936, 936, 936, 936, 936, 936, - /* 260 */ 936, 936, 936, 936, 936, 936, 936, 936, 936, 763, - /* 270 */ 936, 936, 936, 936, 936, 936, 936, 936, 936, 881, - /* 280 */ 936, 936, 936, 936, 936, 936, 914, 913, 936, 936, - /* 290 */ 936, 936, 936, 936, 936, 936, 936, 936, 902, 936, - /* 300 */ 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, - /* 310 */ 936, 936, 936, 936, 936, 936, 936, 936, 758, 936, - /* 320 */ 861, 843, 701, 850, 936, 936, 936, 936, 936, 842, - /* 330 */ 853, 810, 936, 749, 936, 809, 806, 808, 611, 936, - /* 340 */ 936, 936, 936, 936, 586, 590, 935, 933, 932, 930, - /* 350 */ 890, 889, 888, 886, 895, 894, 893, 892, 891, 887, - /* 360 */ 885, 884, 883, 880, 787, 775, 766, 697, 929, 927, - /* 370 */ 928, 879, 877, 878, 696, 695, 692, 691, 690, 869, - /* 380 */ 868, 866, 865, 867, 604, 906, 909, 908, 907, 912, - /* 390 */ 911, 904, 917, 916, 921, 925, 924, 923, 922, 920, - /* 400 */ 901, 795, 794, 792, 797, 788, 793, 780, 786, 785, - /* 410 */ 776, 779, 684, 771, 767, 770, 905, 694, 603, 741, - /* 420 */ 602, 607, 668, 669, 677, 680, 675, 678, 674, 673, - /* 430 */ 672, 676, 671, 667, 610, 609, 623, 621, 622, 620, - /* 440 */ 619, 617, 639, 638, 635, 637, 634, 636, 633, 632, - /* 450 */ 631, 630, 628, 661, 647, 646, 874, 876, 875, 873, - /* 460 */ 872, 654, 653, 659, 658, 657, 656, 652, 655, 651, - /* 470 */ 650, 648, 644, 814, 813, 807, 835, 707, 706, 715, - /* 480 */ 713, 712, 711, 747, 746, 745, 744, 743, 742, 735, - /* 490 */ 733, 729, 728, 734, 732, 727, 719, 717, 718, 716, - /* 500 */ 612, 802, 799, 801, 798, 737, 725, 722, 709, 751, - /* 510 */ 753, 854, 844, 834, 845, 740, 832, 833, 704, 703, - /* 520 */ 702, 853, 850, 846, 926, 838, 849, 837, 836, 825, - /* 530 */ 824, 812, 847, 848, 811, 750, 765, 898, 897, 900, - /* 540 */ 899, 896, 764, 625, 624, 705, 700, 699, 805, 804, - /* 550 */ 803, 643, 755, 754, 642, 664, 663, 660, 641, 640, - /* 560 */ 627, 626, 606, 600, 599, 598, 597, 615, 614, 613, - /* 570 */ 611, 596, 595, 689, 688, 687, 686, 685, 682, 592, - /* 580 */ 591, 588, 587, 585, -}; - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammar, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { - 0, /* $ => nothing */ - 0, /* ILLEGAL => nothing */ - 0, /* COMMENT => nothing */ - 0, /* SPACE => nothing */ - 0, /* ID => nothing */ - 4, /* ABORT => ID */ - 4, /* AFTER => ID */ - 4, /* ASC => ID */ - 4, /* ATTACH => ID */ - 4, /* BEFORE => ID */ - 4, /* BEGIN => ID */ - 4, /* CASCADE => ID */ - 4, /* CLUSTER => ID */ - 4, /* CONFLICT => ID */ - 4, /* COPY => ID */ - 4, /* DATABASE => ID */ - 4, /* DEFERRED => ID */ - 4, /* DELIMITERS => ID */ - 4, /* DESC => ID */ - 4, /* DETACH => ID */ - 4, /* EACH => ID */ - 4, /* END => ID */ - 4, /* EXPLAIN => ID */ - 4, /* FAIL => ID */ - 4, /* FOR => ID */ - 4, /* GLOB => ID */ - 4, /* IGNORE => ID */ - 4, /* IMMEDIATE => ID */ - 4, /* INITIALLY => ID */ - 4, /* INSTEAD => ID */ - 4, /* LIKE => ID */ - 4, /* MATCH => ID */ - 4, /* KEY => ID */ - 4, /* OF => ID */ - 4, /* OFFSET => ID */ - 4, /* PRAGMA => ID */ - 4, /* RAISE => ID */ - 4, /* REPLACE => ID */ - 4, /* RESTRICT => ID */ - 4, /* ROW => ID */ - 4, /* STATEMENT => ID */ - 4, /* TEMP => ID */ - 4, /* TRIGGER => ID */ - 4, /* VACUUM => ID */ - 4, /* VIEW => ID */ -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - YYACTIONTYPE stateno; /* The state-number */ - YYCODETYPE major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ - QList<Token*>* tokens = nullptr; -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ -#ifdef YYTRACKMAXSTACKDEPTH - int yyidxMax; /* Maximum value of yyidx */ -#endif - int yyerrcnt; /* Shifts left before out of the error */ - sqlite2_parseARG_SDECL /* A place to hold %extra_argument */ -#if YYSTACKDEPTH<=0 - int yystksz; /* Current side of the stack */ - yyStackEntry *yystack; /* The parser's stack */ -#else - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -#endif -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -#include <stdio.h> -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -void *sqlite2_parseCopyParserState(void* other) -{ - yyParser *pParser; - yyParser *otherParser = (yyParser*)other; - - // Copy parser - pParser = (yyParser*)malloc((size_t)sizeof(yyParser)); - memcpy(pParser, other, (size_t)sizeof(yyParser)); - -#if YYSTACKDEPTH<=0 - // Copy stack - int stackSize = sizeof(yyStackEntry) * pParser->yystksz; - pParser->yystack = malloc((size_t)stackSize); - memcpy(pParser->yystack, ((yyParser*)other)->yystack, (size_t)stackSize); -#endif - - for (int i = 0; i <= pParser->yyidx; i++) - { - pParser->yystack[i].tokens = new QList<Token*>(); - *(pParser->yystack[i].tokens) = *(otherParser->yystack[i].tokens); - } - - return pParser; -} - -void sqlite2_parseAddToken(void* other, Token* token) -{ - yyParser *otherParser = (yyParser*)other; - if (otherParser->yyidx < 0) - return; // Nothing on stack yet. Might happen when parsing just whitespaces, nothing else. - - otherParser->yystack[otherParser->yyidx].tokens->append(token); -} - -void sqlite2_parseRestoreParserState(void* saved, void* target) -{ - yyParser *pParser = (yyParser*)target; - yyParser *savedParser = (yyParser*)saved; - - for (int i = 0; i <= pParser->yyidx; i++) - delete pParser->yystack[i].tokens; - - memcpy(pParser, saved, (size_t)sizeof(yyParser)); - - for (int i = 0; i <= savedParser->yyidx; i++) - { - pParser->yystack[i].tokens = new QList<Token*>(); - *(pParser->yystack[i].tokens) = *(savedParser->yystack[i].tokens); - } - -#if YYSTACKDEPTH<=0 - // Copy stack - int stackSize = sizeof(yyStackEntry) * pParser->yystksz; - pParser->yystack = relloc(pParser->yystack, (size_t)stackSize); - memcpy(pParser->yystack, ((yyParser*)saved)->yystack, (size_t)stackSize); -#endif -} - -void sqlite2_parseFreeSavedState(void* other) -{ - yyParser *pParser = (yyParser*)other; - for (int i = 0; i <= pParser->yyidx; i++) - delete pParser->yystack[i].tokens; - -#if YYSTACKDEPTH<=0 - free(pParser->yystack); -#endif - free(other); -} - -#ifndef NDEBUG -/* -** Turn parser tracing on by giving a stream to which to write the trace -** and a prompt to preface each trace message. Tracing is turned off -** by making either argument NULL -** -** Inputs: -** <ul> -** <li> A FILE* to which trace output should be written. -** If NULL, then tracing is turned off. -** <li> A prefix string written at the beginning of every -** line of trace output. If NULL, then tracing is -** turned off. -** </ul> -** -** Outputs: -** None. -*/ -void sqlite2_parseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *const yyTokenName[] = { - "$", "ILLEGAL", "COMMENT", "SPACE", - "ID", "ABORT", "AFTER", "ASC", - "ATTACH", "BEFORE", "BEGIN", "CASCADE", - "CLUSTER", "CONFLICT", "COPY", "DATABASE", - "DEFERRED", "DELIMITERS", "DESC", "DETACH", - "EACH", "END", "EXPLAIN", "FAIL", - "FOR", "GLOB", "IGNORE", "IMMEDIATE", - "INITIALLY", "INSTEAD", "LIKE", "MATCH", - "KEY", "OF", "OFFSET", "PRAGMA", - "RAISE", "REPLACE", "RESTRICT", "ROW", - "STATEMENT", "TEMP", "TRIGGER", "VACUUM", - "VIEW", "OR", "AND", "NOT", - "EQ", "NE", "ISNULL", "NOTNULL", - "IS", "BETWEEN", "IN", "GT", - "GE", "LT", "LE", "BITAND", - "BITOR", "LSHIFT", "RSHIFT", "PLUS", - "MINUS", "STAR", "SLASH", "REM", - "CONCAT", "UMINUS", "UPLUS", "BITNOT", - "SEMI", "TRANSACTION", "ID_TRANS", "COMMIT", - "ROLLBACK", "CREATE", "TABLE", "LP", - "RP", "AS", "DOT", "ID_TAB_NEW", - "ID_DB", "COMMA", "ID_COL_NEW", "STRING", - "JOIN_KW", "ID_COL_TYPE", "DEFAULT", "INTEGER", - "FLOAT", "NULL", "CONSTRAINT", "PRIMARY", - "UNIQUE", "CHECK", "REFERENCES", "COLLATE", - "ON", "INSERT", "DELETE", "UPDATE", - "ID_FK_MATCH", "SET", "DEFERRABLE", "FOREIGN", - "ID_CONSTR", "ID_TAB", "DROP", "ID_VIEW_NEW", - "ID_VIEW", "UNION", "ALL", "EXCEPT", - "INTERSECT", "SELECT", "DISTINCT", "ID_ALIAS", - "FROM", "USING", "JOIN", "ID_JOIN_OPTS", - "ORDER", "BY", "GROUP", "HAVING", - "LIMIT", "WHERE", "ID_COL", "INTO", - "VALUES", "VARIABLE", "LIKE_KW", "CASE", - "ID_FN", "ID_ERR_MSG", "WHEN", "THEN", - "ELSE", "INDEX", "ID_IDX_NEW", "ID_IDX", - "ID_PRAGMA", "ID_TRIG_NEW", "ID_TRIG", "error", - "cmd", "input", "cmdlist", "ecmd", - "explain", "cmdx", "trans_opt", "onconf", - "nm", "temp", "fullname", "columnlist", - "conslist_opt", "select", "column", "columnid", - "type", "carglist", "id", "ids", - "typetoken", "typename", "signed", "plus_num", - "minus_num", "ccons", "ccons_nm", "carg", - "sortorder", "expr", "idxlist_opt", "refargs", - "defer_subclause", "refarg", "refact", "init_deferred_pred_opt", - "conslist", "tconscomma", "tcons", "idxlist", - "defer_subclause_opt", "resolvetype", "orconf", "select_stmt", - "oneselect", "multiselect_op", "distinct", "selcollist", - "from", "where_opt", "groupby_opt", "having_opt", - "orderby_opt", "limit_opt", "sclp", "as", - "joinsrc", "singlesrc", "seltablist", "joinop", - "joinconstr_opt", "dbnm", "idlist", "sortlist", - "collate", "nexprlist", "delete_stmt", "update_stmt", - "setlist", "insert_stmt", "insert_cmd", "idlist_opt", - "exprlist", "exprx", "not_opt", "likeop", - "case_operand", "case_exprlist", "case_else", "raisetype", - "uniqueflag", "idxlist_single", "nmnum", "number", - "trigger_time", "trigger_event", "foreach_clause", "when_clause", - "trigger_cmd_list", "trigger_cmd", "database_kw_opt", "key_opt", -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *const yyRuleName[] = { - /* 0 */ "input ::= cmdlist", - /* 1 */ "cmdlist ::= cmdlist ecmd", - /* 2 */ "cmdlist ::= ecmd", - /* 3 */ "ecmd ::= SEMI", - /* 4 */ "ecmd ::= explain cmdx SEMI", - /* 5 */ "explain ::=", - /* 6 */ "explain ::= EXPLAIN", - /* 7 */ "cmdx ::= cmd", - /* 8 */ "cmd ::= BEGIN trans_opt onconf", - /* 9 */ "trans_opt ::=", - /* 10 */ "trans_opt ::= TRANSACTION", - /* 11 */ "trans_opt ::= TRANSACTION nm", - /* 12 */ "trans_opt ::= TRANSACTION ID_TRANS", - /* 13 */ "cmd ::= COMMIT trans_opt", - /* 14 */ "cmd ::= END trans_opt", - /* 15 */ "cmd ::= ROLLBACK trans_opt", - /* 16 */ "cmd ::= CREATE temp TABLE fullname LP columnlist conslist_opt RP", - /* 17 */ "cmd ::= CREATE temp TABLE fullname AS select", - /* 18 */ "cmd ::= CREATE temp TABLE nm DOT ID_TAB_NEW", - /* 19 */ "cmd ::= CREATE temp TABLE ID_DB|ID_TAB_NEW", - /* 20 */ "temp ::= TEMP", - /* 21 */ "temp ::=", - /* 22 */ "columnlist ::= columnlist COMMA column", - /* 23 */ "columnlist ::= column", - /* 24 */ "column ::= columnid type carglist", - /* 25 */ "columnid ::= nm", - /* 26 */ "columnid ::= ID_COL_NEW", - /* 27 */ "id ::= ID", - /* 28 */ "ids ::= ID|STRING", - /* 29 */ "nm ::= id", - /* 30 */ "nm ::= STRING", - /* 31 */ "nm ::= JOIN_KW", - /* 32 */ "type ::=", - /* 33 */ "type ::= typetoken", - /* 34 */ "typetoken ::= typename", - /* 35 */ "typetoken ::= typename LP signed RP", - /* 36 */ "typetoken ::= typename LP signed COMMA signed RP", - /* 37 */ "typename ::= ids", - /* 38 */ "typename ::= typename ids", - /* 39 */ "typename ::= ID_COL_TYPE", - /* 40 */ "signed ::= plus_num", - /* 41 */ "signed ::= minus_num", - /* 42 */ "carglist ::= carglist ccons", - /* 43 */ "carglist ::= carglist ccons_nm ccons", - /* 44 */ "carglist ::= carglist carg", - /* 45 */ "carglist ::=", - /* 46 */ "carg ::= DEFAULT STRING", - /* 47 */ "carg ::= DEFAULT ID", - /* 48 */ "carg ::= DEFAULT INTEGER", - /* 49 */ "carg ::= DEFAULT PLUS INTEGER", - /* 50 */ "carg ::= DEFAULT MINUS INTEGER", - /* 51 */ "carg ::= DEFAULT FLOAT", - /* 52 */ "carg ::= DEFAULT PLUS FLOAT", - /* 53 */ "carg ::= DEFAULT MINUS FLOAT", - /* 54 */ "carg ::= DEFAULT NULL", - /* 55 */ "ccons_nm ::= CONSTRAINT nm", - /* 56 */ "ccons ::= NULL onconf", - /* 57 */ "ccons ::= NOT NULL onconf", - /* 58 */ "ccons ::= PRIMARY KEY sortorder onconf", - /* 59 */ "ccons ::= UNIQUE onconf", - /* 60 */ "ccons ::= CHECK LP expr RP onconf", - /* 61 */ "ccons ::= REFERENCES nm idxlist_opt refargs", - /* 62 */ "ccons ::= defer_subclause", - /* 63 */ "ccons ::= COLLATE id", - /* 64 */ "ccons ::= CHECK LP RP", - /* 65 */ "refargs ::=", - /* 66 */ "refargs ::= refargs refarg", - /* 67 */ "refarg ::= MATCH nm", - /* 68 */ "refarg ::= ON INSERT refact", - /* 69 */ "refarg ::= ON DELETE refact", - /* 70 */ "refarg ::= ON UPDATE refact", - /* 71 */ "refarg ::= MATCH ID_FK_MATCH", - /* 72 */ "refact ::= SET NULL", - /* 73 */ "refact ::= SET DEFAULT", - /* 74 */ "refact ::= CASCADE", - /* 75 */ "refact ::= RESTRICT", - /* 76 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", - /* 77 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", - /* 78 */ "init_deferred_pred_opt ::=", - /* 79 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", - /* 80 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", - /* 81 */ "conslist_opt ::=", - /* 82 */ "conslist_opt ::= COMMA conslist", - /* 83 */ "conslist ::= conslist tconscomma tcons", - /* 84 */ "conslist ::= tcons", - /* 85 */ "tconscomma ::= COMMA", - /* 86 */ "tconscomma ::=", - /* 87 */ "tcons ::= CONSTRAINT nm", - /* 88 */ "tcons ::= PRIMARY KEY LP idxlist RP onconf", - /* 89 */ "tcons ::= UNIQUE LP idxlist RP onconf", - /* 90 */ "tcons ::= CHECK LP expr RP onconf", - /* 91 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", - /* 92 */ "tcons ::= CONSTRAINT ID_CONSTR", - /* 93 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB", - /* 94 */ "tcons ::= CHECK LP RP onconf", - /* 95 */ "defer_subclause_opt ::=", - /* 96 */ "defer_subclause_opt ::= defer_subclause", - /* 97 */ "onconf ::=", - /* 98 */ "onconf ::= ON CONFLICT resolvetype", - /* 99 */ "orconf ::=", - /* 100 */ "orconf ::= OR resolvetype", - /* 101 */ "resolvetype ::= ROLLBACK", - /* 102 */ "resolvetype ::= ABORT", - /* 103 */ "resolvetype ::= FAIL", - /* 104 */ "resolvetype ::= IGNORE", - /* 105 */ "resolvetype ::= REPLACE", - /* 106 */ "cmd ::= DROP TABLE fullname", - /* 107 */ "cmd ::= DROP TABLE nm DOT ID_TAB", - /* 108 */ "cmd ::= DROP TABLE ID_DB|ID_TAB", - /* 109 */ "cmd ::= CREATE temp VIEW nm AS select", - /* 110 */ "cmd ::= CREATE temp VIEW ID_VIEW_NEW", - /* 111 */ "cmd ::= DROP VIEW nm", - /* 112 */ "cmd ::= DROP VIEW ID_VIEW", - /* 113 */ "cmd ::= select_stmt", - /* 114 */ "select_stmt ::= select", - /* 115 */ "select ::= oneselect", - /* 116 */ "select ::= select multiselect_op oneselect", - /* 117 */ "multiselect_op ::= UNION", - /* 118 */ "multiselect_op ::= UNION ALL", - /* 119 */ "multiselect_op ::= EXCEPT", - /* 120 */ "multiselect_op ::= INTERSECT", - /* 121 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", - /* 122 */ "distinct ::= DISTINCT", - /* 123 */ "distinct ::= ALL", - /* 124 */ "distinct ::=", - /* 125 */ "sclp ::= selcollist COMMA", - /* 126 */ "sclp ::=", - /* 127 */ "selcollist ::= sclp expr as", - /* 128 */ "selcollist ::= sclp STAR", - /* 129 */ "selcollist ::= sclp nm DOT STAR", - /* 130 */ "selcollist ::= sclp", - /* 131 */ "selcollist ::= sclp ID_TAB DOT STAR", - /* 132 */ "as ::= AS nm", - /* 133 */ "as ::= ids", - /* 134 */ "as ::= AS ID_ALIAS", - /* 135 */ "as ::= ID_ALIAS", - /* 136 */ "as ::=", - /* 137 */ "from ::=", - /* 138 */ "from ::= FROM joinsrc", - /* 139 */ "joinsrc ::= singlesrc seltablist", - /* 140 */ "joinsrc ::=", - /* 141 */ "seltablist ::= seltablist joinop singlesrc joinconstr_opt", - /* 142 */ "seltablist ::=", - /* 143 */ "singlesrc ::= nm dbnm as", - /* 144 */ "singlesrc ::= LP select RP as", - /* 145 */ "singlesrc ::= LP joinsrc RP as", - /* 146 */ "singlesrc ::=", - /* 147 */ "singlesrc ::= nm DOT", - /* 148 */ "singlesrc ::= nm DOT ID_TAB", - /* 149 */ "singlesrc ::= ID_DB|ID_TAB", - /* 150 */ "singlesrc ::= nm DOT ID_VIEW", - /* 151 */ "singlesrc ::= ID_DB|ID_VIEW", - /* 152 */ "joinconstr_opt ::= ON expr", - /* 153 */ "joinconstr_opt ::= USING LP idlist RP", - /* 154 */ "joinconstr_opt ::=", - /* 155 */ "dbnm ::=", - /* 156 */ "dbnm ::= DOT nm", - /* 157 */ "fullname ::= nm dbnm", - /* 158 */ "joinop ::= COMMA", - /* 159 */ "joinop ::= JOIN", - /* 160 */ "joinop ::= JOIN_KW JOIN", - /* 161 */ "joinop ::= JOIN_KW nm JOIN", - /* 162 */ "joinop ::= JOIN_KW nm nm JOIN", - /* 163 */ "joinop ::= ID_JOIN_OPTS", - /* 164 */ "orderby_opt ::=", - /* 165 */ "orderby_opt ::= ORDER BY sortlist", - /* 166 */ "sortlist ::= sortlist COMMA collate expr sortorder", - /* 167 */ "sortlist ::= expr collate sortorder", - /* 168 */ "collate ::=", - /* 169 */ "collate ::= COLLATE id", - /* 170 */ "sortorder ::= ASC", - /* 171 */ "sortorder ::= DESC", - /* 172 */ "sortorder ::=", - /* 173 */ "groupby_opt ::=", - /* 174 */ "groupby_opt ::= GROUP BY nexprlist", - /* 175 */ "groupby_opt ::= GROUP BY", - /* 176 */ "having_opt ::=", - /* 177 */ "having_opt ::= HAVING expr", - /* 178 */ "limit_opt ::=", - /* 179 */ "limit_opt ::= LIMIT signed", - /* 180 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 181 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 182 */ "cmd ::= delete_stmt", - /* 183 */ "delete_stmt ::= DELETE FROM fullname where_opt", - /* 184 */ "delete_stmt ::= DELETE FROM", - /* 185 */ "delete_stmt ::= DELETE FROM nm DOT", - /* 186 */ "delete_stmt ::= DELETE FROM nm DOT ID_TAB", - /* 187 */ "delete_stmt ::= DELETE FROM ID_DB|ID_TAB", - /* 188 */ "where_opt ::=", - /* 189 */ "where_opt ::= WHERE expr", - /* 190 */ "where_opt ::= WHERE", - /* 191 */ "cmd ::= update_stmt", - /* 192 */ "update_stmt ::= UPDATE orconf fullname SET setlist where_opt", - /* 193 */ "update_stmt ::= UPDATE orconf", - /* 194 */ "update_stmt ::= UPDATE orconf nm DOT", - /* 195 */ "update_stmt ::= UPDATE orconf nm DOT ID_TAB", - /* 196 */ "update_stmt ::= UPDATE orconf ID_DB|ID_TAB", - /* 197 */ "setlist ::= setlist COMMA nm EQ expr", - /* 198 */ "setlist ::= nm EQ expr", - /* 199 */ "setlist ::=", - /* 200 */ "setlist ::= setlist COMMA", - /* 201 */ "setlist ::= setlist COMMA ID_COL", - /* 202 */ "setlist ::= ID_COL", - /* 203 */ "cmd ::= insert_stmt", - /* 204 */ "insert_stmt ::= insert_cmd INTO fullname idlist_opt VALUES LP exprlist RP", - /* 205 */ "insert_stmt ::= insert_cmd INTO fullname idlist_opt select", - /* 206 */ "insert_stmt ::= insert_cmd INTO", - /* 207 */ "insert_stmt ::= insert_cmd INTO nm DOT", - /* 208 */ "insert_stmt ::= insert_cmd INTO ID_DB|ID_TAB", - /* 209 */ "insert_stmt ::= insert_cmd INTO nm DOT ID_TAB", - /* 210 */ "insert_cmd ::= INSERT orconf", - /* 211 */ "insert_cmd ::= REPLACE", - /* 212 */ "idlist_opt ::=", - /* 213 */ "idlist_opt ::= LP idlist RP", - /* 214 */ "idlist ::= idlist COMMA nm", - /* 215 */ "idlist ::= nm", - /* 216 */ "idlist ::=", - /* 217 */ "idlist ::= idlist COMMA ID_COL", - /* 218 */ "idlist ::= ID_COL", - /* 219 */ "exprx ::= NULL", - /* 220 */ "exprx ::= INTEGER", - /* 221 */ "exprx ::= FLOAT", - /* 222 */ "exprx ::= STRING", - /* 223 */ "exprx ::= LP expr RP", - /* 224 */ "exprx ::= id", - /* 225 */ "exprx ::= JOIN_KW", - /* 226 */ "exprx ::= nm DOT nm", - /* 227 */ "exprx ::= nm DOT nm DOT nm", - /* 228 */ "exprx ::= VARIABLE", - /* 229 */ "exprx ::= ID LP exprlist RP", - /* 230 */ "exprx ::= ID LP STAR RP", - /* 231 */ "exprx ::= expr AND expr", - /* 232 */ "exprx ::= expr OR expr", - /* 233 */ "exprx ::= expr LT|GT|GE|LE expr", - /* 234 */ "exprx ::= expr EQ|NE expr", - /* 235 */ "exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", - /* 236 */ "exprx ::= expr PLUS|MINUS expr", - /* 237 */ "exprx ::= expr STAR|SLASH|REM expr", - /* 238 */ "exprx ::= expr CONCAT expr", - /* 239 */ "exprx ::= expr not_opt likeop expr", - /* 240 */ "exprx ::= expr ISNULL|NOTNULL", - /* 241 */ "exprx ::= expr NOT NULL", - /* 242 */ "exprx ::= expr IS not_opt expr", - /* 243 */ "exprx ::= NOT expr", - /* 244 */ "exprx ::= BITNOT expr", - /* 245 */ "exprx ::= MINUS expr", - /* 246 */ "exprx ::= PLUS expr", - /* 247 */ "exprx ::= expr not_opt BETWEEN expr AND expr", - /* 248 */ "exprx ::= expr not_opt IN LP exprlist RP", - /* 249 */ "exprx ::= expr not_opt IN LP select RP", - /* 250 */ "exprx ::= expr not_opt IN nm dbnm", - /* 251 */ "exprx ::= LP select RP", - /* 252 */ "exprx ::= CASE case_operand case_exprlist case_else END", - /* 253 */ "exprx ::= RAISE LP raisetype COMMA nm RP", - /* 254 */ "exprx ::= RAISE LP IGNORE RP", - /* 255 */ "exprx ::= nm DOT", - /* 256 */ "exprx ::= nm DOT nm DOT", - /* 257 */ "exprx ::= expr not_opt BETWEEN expr AND", - /* 258 */ "exprx ::= CASE case_operand case_exprlist case_else", - /* 259 */ "exprx ::= expr not_opt IN LP exprlist", - /* 260 */ "exprx ::= expr not_opt IN ID_DB", - /* 261 */ "exprx ::= expr not_opt IN nm DOT ID_TAB", - /* 262 */ "exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN", - /* 263 */ "exprx ::= nm DOT ID_TAB|ID_COL", - /* 264 */ "exprx ::= nm DOT nm DOT ID_COL", - /* 265 */ "exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP", - /* 266 */ "expr ::= exprx", - /* 267 */ "expr ::=", - /* 268 */ "not_opt ::=", - /* 269 */ "not_opt ::= NOT", - /* 270 */ "likeop ::= LIKE|GLOB", - /* 271 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", - /* 272 */ "case_exprlist ::= WHEN expr THEN expr", - /* 273 */ "case_else ::= ELSE expr", - /* 274 */ "case_else ::=", - /* 275 */ "case_operand ::= exprx", - /* 276 */ "case_operand ::=", - /* 277 */ "exprlist ::= nexprlist", - /* 278 */ "exprlist ::=", - /* 279 */ "nexprlist ::= nexprlist COMMA expr", - /* 280 */ "nexprlist ::= exprx", - /* 281 */ "cmd ::= CREATE uniqueflag INDEX nm ON nm dbnm LP idxlist RP onconf", - /* 282 */ "cmd ::= CREATE uniqueflag INDEX nm dbnm ON ID_TAB", - /* 283 */ "cmd ::= CREATE uniqueflag INDEX nm DOT ID_IDX_NEW", - /* 284 */ "cmd ::= CREATE uniqueflag INDEX ID_DB|ID_IDX_NEW", - /* 285 */ "uniqueflag ::= UNIQUE", - /* 286 */ "uniqueflag ::=", - /* 287 */ "idxlist_opt ::=", - /* 288 */ "idxlist_opt ::= LP idxlist RP", - /* 289 */ "idxlist ::= idxlist COMMA idxlist_single", - /* 290 */ "idxlist ::= idxlist_single", - /* 291 */ "idxlist_single ::= nm sortorder", - /* 292 */ "idxlist_single ::= ID_COL", - /* 293 */ "cmd ::= DROP INDEX fullname", - /* 294 */ "cmd ::= DROP INDEX nm DOT ID_IDX", - /* 295 */ "cmd ::= DROP INDEX ID_DB|ID_IDX", - /* 296 */ "cmd ::= COPY orconf nm dbnm FROM nm USING DELIMITERS STRING", - /* 297 */ "cmd ::= COPY orconf nm dbnm FROM nm", - /* 298 */ "cmd ::= VACUUM", - /* 299 */ "cmd ::= VACUUM nm", - /* 300 */ "cmd ::= PRAGMA ids", - /* 301 */ "cmd ::= PRAGMA nm EQ nmnum", - /* 302 */ "cmd ::= PRAGMA nm LP nmnum RP", - /* 303 */ "cmd ::= PRAGMA nm EQ minus_num", - /* 304 */ "cmd ::= PRAGMA nm LP minus_num RP", - /* 305 */ "cmd ::= PRAGMA nm DOT ID_PRAGMA", - /* 306 */ "cmd ::= PRAGMA ID_DB|ID_PRAGMA", - /* 307 */ "nmnum ::= plus_num", - /* 308 */ "nmnum ::= nm", - /* 309 */ "nmnum ::= ON", - /* 310 */ "nmnum ::= DELETE", - /* 311 */ "nmnum ::= DEFAULT", - /* 312 */ "plus_num ::= PLUS number", - /* 313 */ "plus_num ::= number", - /* 314 */ "minus_num ::= MINUS number", - /* 315 */ "number ::= INTEGER", - /* 316 */ "number ::= FLOAT", - /* 317 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause BEGIN trigger_cmd_list END", - /* 318 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause", - /* 319 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause BEGIN trigger_cmd_list", - /* 320 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON ID_TAB|ID_DB", - /* 321 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm DOT ID_TAB", - /* 322 */ "cmd ::= CREATE temp TRIGGER ID_TRIG_NEW", - /* 323 */ "trigger_time ::= BEFORE", - /* 324 */ "trigger_time ::= AFTER", - /* 325 */ "trigger_time ::= INSTEAD OF", - /* 326 */ "trigger_time ::=", - /* 327 */ "trigger_event ::= DELETE", - /* 328 */ "trigger_event ::= INSERT", - /* 329 */ "trigger_event ::= UPDATE", - /* 330 */ "trigger_event ::= UPDATE OF idlist", - /* 331 */ "foreach_clause ::=", - /* 332 */ "foreach_clause ::= FOR EACH ROW", - /* 333 */ "foreach_clause ::= FOR EACH STATEMENT", - /* 334 */ "when_clause ::=", - /* 335 */ "when_clause ::= WHEN expr", - /* 336 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", - /* 337 */ "trigger_cmd_list ::= trigger_cmd SEMI", - /* 338 */ "trigger_cmd ::= update_stmt", - /* 339 */ "trigger_cmd ::= insert_stmt", - /* 340 */ "trigger_cmd ::= delete_stmt", - /* 341 */ "trigger_cmd ::= select_stmt", - /* 342 */ "raisetype ::= ROLLBACK|ABORT|FAIL", - /* 343 */ "cmd ::= DROP TRIGGER fullname", - /* 344 */ "cmd ::= DROP TRIGGER nm DOT ID_TRIG", - /* 345 */ "cmd ::= DROP TRIGGER ID_DB|ID_TRIG", - /* 346 */ "cmd ::= ATTACH database_kw_opt ids AS ids key_opt", - /* 347 */ "key_opt ::=", - /* 348 */ "key_opt ::= USING ids", - /* 349 */ "database_kw_opt ::= DATABASE", - /* 350 */ "database_kw_opt ::=", - /* 351 */ "cmd ::= DETACH database_kw_opt nm", -}; -#endif /* NDEBUG */ - - -#if YYSTACKDEPTH<=0 -/* -** Try to increase the size of the parser stack. -*/ -static void yyGrowStack(yyParser *p){ - int newSize; - yyStackEntry *pNew; - - newSize = p->yystksz*2 + 100; - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); - if( pNew ){ - p->yystack = pNew; - p->yystksz = newSize; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows to %d entries!\n", - yyTracePrompt, p->yystksz); - } -#endif - } -} -#endif - -/* -** This function allocates a new parser. -** The only argument is a pointer to a function which works like -** malloc. -** -** Inputs: -** A pointer to the function used to allocate memory. -** -** Outputs: -** A pointer to a parser. This pointer is used in subsequent calls -** to sqlite2_parse and sqlite2_parseFree. -*/ -void *sqlite2_parseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; -#ifdef YYTRACKMAXSTACKDEPTH - pParser->yyidxMax = 0; -#endif -#if YYSTACKDEPTH<=0 - pParser->yystack = NULL; - pParser->yystksz = 0; - yyGrowStack(pParser); -#endif - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor( - yyParser *yypParser, /* The parser */ - YYCODETYPE yymajor, /* Type code for object to destroy */ - YYMINORTYPE *yypminor /* The object to be destroyed */ -){ - sqlite2_parseARG_FETCH; - if (parserContext->executeRules) - { - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 148: /* cmd */ - case 151: /* ecmd */ - case 153: /* cmdx */ - case 191: /* select_stmt */ - case 214: /* delete_stmt */ - case 215: /* update_stmt */ - case 217: /* insert_stmt */ - case 237: /* trigger_cmd */ -{ -delete (yypminor->yy203); -} - break; - case 152: /* explain */ -{ -delete (yypminor->yy91); -} - break; - case 154: /* trans_opt */ -{ -delete (yypminor->yy404); -} - break; - case 155: /* onconf */ - case 189: /* resolvetype */ - case 190: /* orconf */ -{ -delete (yypminor->yy418); -} - break; - case 156: /* nm */ - case 163: /* columnid */ - case 166: /* id */ - case 167: /* ids */ - case 169: /* typename */ - case 209: /* dbnm */ -{ -delete (yypminor->yy319); -} - break; - case 157: /* temp */ - case 194: /* distinct */ -{ -delete (yypminor->yy226); -} - break; - case 158: /* fullname */ -{ -delete (yypminor->yy120); -} - break; - case 159: /* columnlist */ -{ -delete (yypminor->yy42); -} - break; - case 160: /* conslist_opt */ - case 184: /* conslist */ -{ -delete (yypminor->yy13); -} - break; - case 161: /* select */ -{ -delete (yypminor->yy153); -} - break; - case 162: /* column */ -{ -delete (yypminor->yy147); -} - break; - case 164: /* type */ - case 168: /* typetoken */ -{ -delete (yypminor->yy57); -} - break; - case 165: /* carglist */ -{ -delete (yypminor->yy371); -} - break; - case 170: /* signed */ - case 171: /* plus_num */ - case 172: /* minus_num */ - case 230: /* nmnum */ - case 231: /* number */ -{ -delete (yypminor->yy69); -} - break; - case 173: /* ccons */ - case 174: /* ccons_nm */ - case 175: /* carg */ -{ -delete (yypminor->yy304); -} - break; - case 176: /* sortorder */ -{ -delete (yypminor->yy389); -} - break; - case 177: /* expr */ - case 197: /* where_opt */ - case 199: /* having_opt */ - case 221: /* exprx */ - case 224: /* case_operand */ - case 226: /* case_else */ -{ -delete (yypminor->yy192); -} - break; - case 178: /* idxlist_opt */ - case 187: /* idxlist */ -{ -delete (yypminor->yy63); -} - break; - case 179: /* refargs */ -{ -delete (yypminor->yy264); -} - break; - case 180: /* defer_subclause */ - case 188: /* defer_subclause_opt */ -{ -delete (yypminor->yy329); -} - break; - case 181: /* refarg */ -{ -delete (yypminor->yy187); -} - break; - case 182: /* refact */ -{ -delete (yypminor->yy424); -} - break; - case 183: /* init_deferred_pred_opt */ -{ -delete (yypminor->yy312); -} - break; - case 185: /* tconscomma */ - case 222: /* not_opt */ - case 228: /* uniqueflag */ - case 238: /* database_kw_opt */ -{ -delete (yypminor->yy291); -} - break; - case 186: /* tcons */ -{ -delete (yypminor->yy406); -} - break; - case 192: /* oneselect */ -{ -delete (yypminor->yy150); -} - break; - case 193: /* multiselect_op */ -{ -delete (yypminor->yy382); -} - break; - case 195: /* selcollist */ - case 202: /* sclp */ -{ -delete (yypminor->yy213); -} - break; - case 196: /* from */ - case 204: /* joinsrc */ -{ -delete (yypminor->yy31); -} - break; - case 198: /* groupby_opt */ - case 213: /* nexprlist */ - case 220: /* exprlist */ - case 225: /* case_exprlist */ -{ -delete (yypminor->yy231); -} - break; - case 200: /* orderby_opt */ - case 211: /* sortlist */ -{ -delete (yypminor->yy243); -} - break; - case 201: /* limit_opt */ -{ -delete (yypminor->yy324); -} - break; - case 203: /* as */ -{ -delete (yypminor->yy40); -} - break; - case 205: /* singlesrc */ -{ -delete (yypminor->yy121); -} - break; - case 206: /* seltablist */ -{ -delete (yypminor->yy131); -} - break; - case 207: /* joinop */ -{ -delete (yypminor->yy221); -} - break; - case 208: /* joinconstr_opt */ -{ -delete (yypminor->yy455); -} - break; - case 210: /* idlist */ - case 219: /* idlist_opt */ -{ -delete (yypminor->yy95); -} - break; - case 212: /* collate */ -{ -if ((yypminor->yy319)) delete (yypminor->yy319); -} - break; - case 216: /* setlist */ -{ -delete (yypminor->yy201); -} - break; - case 218: /* insert_cmd */ -{ -delete (yypminor->yy344); -} - break; - case 223: /* likeop */ -{ -delete (yypminor->yy41); -} - break; - case 229: /* idxlist_single */ -{ -delete (yypminor->yy428); -} - break; - case 232: /* trigger_time */ -{ -delete (yypminor->yy372); -} - break; - case 233: /* trigger_event */ -{ -delete (yypminor->yy151); -} - break; - case 234: /* foreach_clause */ -{ -delete (yypminor->yy83); -} - break; - case 235: /* when_clause */ - case 239: /* key_opt */ -{ -if ((yypminor->yy192)) delete (yypminor->yy192); -} - break; - case 236: /* trigger_cmd_list */ -{ -delete (yypminor->yy270); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } - } -} - -/* -** Pop the parser's stack once. -** -** If there is a destructor routine associated with the token which -** is popped from the stack, then call it. -** -** Return the major token number for the symbol popped. -*/ -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - /* There is no mechanism by which the parser stack can be popped below - ** empty in SQLite. */ - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor(pParser, yymajor, &yytos->minor); - delete yytos->tokens; - yytos->tokens = nullptr; - pParser->yyidx--; - return yymajor; -} - -/* -** Deallocate and destroy a parser. Destructors are all called for -** all stack elements before shutting the parser down. -** -** Inputs: -** <ul> -** <li> A pointer to the parser. This should be a pointer -** obtained from sqlite2_parseAlloc. -** <li> A pointer to a function used to reclaim memory obtained -** from malloc. -** </ul> -*/ -void sqlite2_parseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - /* In SQLite, we never try to destroy a parser that was not successfully - ** created in the first place. */ - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); -#if YYSTACKDEPTH<=0 - free(pParser->yystack); -#endif - (*freeProc)((void*)pParser); -} - -/* -** Return the peak depth of the stack for a parser. -*/ -#ifdef YYTRACKMAXSTACKDEPTH -int sqlite2_parseStackPeak(void *p){ - yyParser *pParser = (yyParser*)p; - return pParser->yyidxMax; -} -#endif - -/* -** Find the appropriate action for a parser given the terminal -** look-ahead token iLookAhead. -** -** If the look-ahead token is YYNOCODE, then check to see if the action is -** independent of the look-ahead. If it is, return the action, otherwise -** return YY_NO_ACTION. -*/ -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - YYCODETYPE iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - GET_CONTEXT; - - if( stateno>YY_SHIFT_COUNT - || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - assert( iLookAhead!=YYNOCODE ); - i += iLookAhead; - if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ - if( iLookAhead>0 ){ -#ifdef YYFALLBACK - YYCODETYPE iFallback; /* Fallback token */ - if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) - && (iFallback = yyFallback[iLookAhead])!=0 - && parserContext->doFallbacks ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif -#ifdef YYWILDCARD - { - int j = i - iLookAhead + YYWILDCARD; - if( -#if YY_SHIFT_MIN+YYWILDCARD<0 - j>=0 && -#endif -#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT - j<YY_ACTTAB_COUNT && -#endif - yy_lookahead[j]==YYWILDCARD - ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]); - } -#endif /* NDEBUG */ - return yy_action[j]; - } - } -#endif /* YYWILDCARD */ - } - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -/* -** Find the appropriate action for a parser given the non-terminal -** look-ahead token iLookAhead. -** -** If the look-ahead token is YYNOCODE, then check to see if the action is -** independent of the look-ahead. If it is, return the action, otherwise -** return YY_NO_ACTION. -*/ -static int yy_find_reduce_action( - int stateno, /* Current state number */ - YYCODETYPE iLookAhead /* The look-ahead token */ -){ - int i; -#ifdef YYERRORSYMBOL - if( stateno>YY_REDUCE_COUNT ){ - return yy_default[stateno]; - } -#else - assert( stateno<=YY_REDUCE_COUNT ); -#endif - i = yy_reduce_ofst[stateno]; - assert( i!=YY_REDUCE_USE_DFLT ); - assert( iLookAhead!=YYNOCODE ); - i += iLookAhead; -#ifdef YYERRORSYMBOL - if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - } -#else - assert( i>=0 && i<YY_ACTTAB_COUNT ); - assert( yy_lookahead[i]==iLookAhead ); -#endif - return yy_action[i]; -} - -/* -** The following routine is called if the stack overflows. -*/ -static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){ - sqlite2_parseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - - UNUSED_PARAMETER(yypMinor); - parserContext->error(QObject::tr("Parser stack overflow")); - sqlite2_parseARG_STORE; /* Suppress warning about unused %extra_argument var */ -} - -/* -** Perform a shift action. -*/ -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; -#ifdef YYTRACKMAXSTACKDEPTH - if( yypParser->yyidx>yypParser->yyidxMax ){ - yypParser->yyidxMax = yypParser->yyidx; - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yyidx>=YYSTACKDEPTH ){ - yyStackOverflow(yypParser, yypMinor); - return; - } -#else - if( yypParser->yyidx>=yypParser->yystksz ){ - yyGrowStack(yypParser); - if( yypParser->yyidx>=yypParser->yystksz ){ - yyStackOverflow(yypParser, yypMinor); - return; - } - } -#endif - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = (YYACTIONTYPE)yyNewState; - yytos->major = (YYCODETYPE)yyMajor; - yytos->minor = *yypMinor; - yytos->tokens = new QList<Token*>(); -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static const struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 149, 1 }, - { 150, 2 }, - { 150, 1 }, - { 151, 1 }, - { 151, 3 }, - { 152, 0 }, - { 152, 1 }, - { 153, 1 }, - { 148, 3 }, - { 154, 0 }, - { 154, 1 }, - { 154, 2 }, - { 154, 2 }, - { 148, 2 }, - { 148, 2 }, - { 148, 2 }, - { 148, 8 }, - { 148, 6 }, - { 148, 6 }, - { 148, 4 }, - { 157, 1 }, - { 157, 0 }, - { 159, 3 }, - { 159, 1 }, - { 162, 3 }, - { 163, 1 }, - { 163, 1 }, - { 166, 1 }, - { 167, 1 }, - { 156, 1 }, - { 156, 1 }, - { 156, 1 }, - { 164, 0 }, - { 164, 1 }, - { 168, 1 }, - { 168, 4 }, - { 168, 6 }, - { 169, 1 }, - { 169, 2 }, - { 169, 1 }, - { 170, 1 }, - { 170, 1 }, - { 165, 2 }, - { 165, 3 }, - { 165, 2 }, - { 165, 0 }, - { 175, 2 }, - { 175, 2 }, - { 175, 2 }, - { 175, 3 }, - { 175, 3 }, - { 175, 2 }, - { 175, 3 }, - { 175, 3 }, - { 175, 2 }, - { 174, 2 }, - { 173, 2 }, - { 173, 3 }, - { 173, 4 }, - { 173, 2 }, - { 173, 5 }, - { 173, 4 }, - { 173, 1 }, - { 173, 2 }, - { 173, 3 }, - { 179, 0 }, - { 179, 2 }, - { 181, 2 }, - { 181, 3 }, - { 181, 3 }, - { 181, 3 }, - { 181, 2 }, - { 182, 2 }, - { 182, 2 }, - { 182, 1 }, - { 182, 1 }, - { 180, 3 }, - { 180, 2 }, - { 183, 0 }, - { 183, 2 }, - { 183, 2 }, - { 160, 0 }, - { 160, 2 }, - { 184, 3 }, - { 184, 1 }, - { 185, 1 }, - { 185, 0 }, - { 186, 2 }, - { 186, 6 }, - { 186, 5 }, - { 186, 5 }, - { 186, 10 }, - { 186, 2 }, - { 186, 7 }, - { 186, 4 }, - { 188, 0 }, - { 188, 1 }, - { 155, 0 }, - { 155, 3 }, - { 190, 0 }, - { 190, 2 }, - { 189, 1 }, - { 189, 1 }, - { 189, 1 }, - { 189, 1 }, - { 189, 1 }, - { 148, 3 }, - { 148, 5 }, - { 148, 3 }, - { 148, 6 }, - { 148, 4 }, - { 148, 3 }, - { 148, 3 }, - { 148, 1 }, - { 191, 1 }, - { 161, 1 }, - { 161, 3 }, - { 193, 1 }, - { 193, 2 }, - { 193, 1 }, - { 193, 1 }, - { 192, 9 }, - { 194, 1 }, - { 194, 1 }, - { 194, 0 }, - { 202, 2 }, - { 202, 0 }, - { 195, 3 }, - { 195, 2 }, - { 195, 4 }, - { 195, 1 }, - { 195, 4 }, - { 203, 2 }, - { 203, 1 }, - { 203, 2 }, - { 203, 1 }, - { 203, 0 }, - { 196, 0 }, - { 196, 2 }, - { 204, 2 }, - { 204, 0 }, - { 206, 4 }, - { 206, 0 }, - { 205, 3 }, - { 205, 4 }, - { 205, 4 }, - { 205, 0 }, - { 205, 2 }, - { 205, 3 }, - { 205, 1 }, - { 205, 3 }, - { 205, 1 }, - { 208, 2 }, - { 208, 4 }, - { 208, 0 }, - { 209, 0 }, - { 209, 2 }, - { 158, 2 }, - { 207, 1 }, - { 207, 1 }, - { 207, 2 }, - { 207, 3 }, - { 207, 4 }, - { 207, 1 }, - { 200, 0 }, - { 200, 3 }, - { 211, 5 }, - { 211, 3 }, - { 212, 0 }, - { 212, 2 }, - { 176, 1 }, - { 176, 1 }, - { 176, 0 }, - { 198, 0 }, - { 198, 3 }, - { 198, 2 }, - { 199, 0 }, - { 199, 2 }, - { 201, 0 }, - { 201, 2 }, - { 201, 4 }, - { 201, 4 }, - { 148, 1 }, - { 214, 4 }, - { 214, 2 }, - { 214, 4 }, - { 214, 5 }, - { 214, 3 }, - { 197, 0 }, - { 197, 2 }, - { 197, 1 }, - { 148, 1 }, - { 215, 6 }, - { 215, 2 }, - { 215, 4 }, - { 215, 5 }, - { 215, 3 }, - { 216, 5 }, - { 216, 3 }, - { 216, 0 }, - { 216, 2 }, - { 216, 3 }, - { 216, 1 }, - { 148, 1 }, - { 217, 8 }, - { 217, 5 }, - { 217, 2 }, - { 217, 4 }, - { 217, 3 }, - { 217, 5 }, - { 218, 2 }, - { 218, 1 }, - { 219, 0 }, - { 219, 3 }, - { 210, 3 }, - { 210, 1 }, - { 210, 0 }, - { 210, 3 }, - { 210, 1 }, - { 221, 1 }, - { 221, 1 }, - { 221, 1 }, - { 221, 1 }, - { 221, 3 }, - { 221, 1 }, - { 221, 1 }, - { 221, 3 }, - { 221, 5 }, - { 221, 1 }, - { 221, 4 }, - { 221, 4 }, - { 221, 3 }, - { 221, 3 }, - { 221, 3 }, - { 221, 3 }, - { 221, 3 }, - { 221, 3 }, - { 221, 3 }, - { 221, 3 }, - { 221, 4 }, - { 221, 2 }, - { 221, 3 }, - { 221, 4 }, - { 221, 2 }, - { 221, 2 }, - { 221, 2 }, - { 221, 2 }, - { 221, 6 }, - { 221, 6 }, - { 221, 6 }, - { 221, 5 }, - { 221, 3 }, - { 221, 5 }, - { 221, 6 }, - { 221, 4 }, - { 221, 2 }, - { 221, 4 }, - { 221, 5 }, - { 221, 4 }, - { 221, 5 }, - { 221, 4 }, - { 221, 6 }, - { 221, 1 }, - { 221, 3 }, - { 221, 5 }, - { 221, 6 }, - { 177, 1 }, - { 177, 0 }, - { 222, 0 }, - { 222, 1 }, - { 223, 1 }, - { 225, 5 }, - { 225, 4 }, - { 226, 2 }, - { 226, 0 }, - { 224, 1 }, - { 224, 0 }, - { 220, 1 }, - { 220, 0 }, - { 213, 3 }, - { 213, 1 }, - { 148, 11 }, - { 148, 7 }, - { 148, 6 }, - { 148, 4 }, - { 228, 1 }, - { 228, 0 }, - { 178, 0 }, - { 178, 3 }, - { 187, 3 }, - { 187, 1 }, - { 229, 2 }, - { 229, 1 }, - { 148, 3 }, - { 148, 5 }, - { 148, 3 }, - { 148, 9 }, - { 148, 6 }, - { 148, 1 }, - { 148, 2 }, - { 148, 2 }, - { 148, 4 }, - { 148, 5 }, - { 148, 4 }, - { 148, 5 }, - { 148, 4 }, - { 148, 2 }, - { 230, 1 }, - { 230, 1 }, - { 230, 1 }, - { 230, 1 }, - { 230, 1 }, - { 171, 2 }, - { 171, 1 }, - { 172, 2 }, - { 231, 1 }, - { 231, 1 }, - { 148, 14 }, - { 148, 11 }, - { 148, 13 }, - { 148, 8 }, - { 148, 10 }, - { 148, 4 }, - { 232, 1 }, - { 232, 1 }, - { 232, 2 }, - { 232, 0 }, - { 233, 1 }, - { 233, 1 }, - { 233, 1 }, - { 233, 3 }, - { 234, 0 }, - { 234, 3 }, - { 234, 3 }, - { 235, 0 }, - { 235, 2 }, - { 236, 3 }, - { 236, 2 }, - { 237, 1 }, - { 237, 1 }, - { 237, 1 }, - { 237, 1 }, - { 227, 1 }, - { 148, 3 }, - { 148, 5 }, - { 148, 3 }, - { 148, 6 }, - { 239, 0 }, - { 239, 2 }, - { 238, 1 }, - { 238, 0 }, - { 148, 3 }, -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -/* -** Perform a reduce action and the shift that must immediately -** follow the reduce. -*/ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - sqlite2_parseARG_FETCH; - SqliteStatement* objectForTokens = 0; - QStringList noTokenInheritanceFields; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, - yyRuleName[yyruleno]); - } -#endif /* NDEBUG */ - - /* Silence complaints from purify about yygotominor being uninitialized - ** in some cases when it is copied into the stack after the following - ** switch. yygotominor is uninitialized when a rule reduces that does - ** not set the value of its left-hand side nonterminal. Leaving the - ** value of the nonterminal uninitialized is utterly harmless as long - ** as the value is never used. So really the only thing this code - ** accomplishes is to quieten purify. - ** - ** 2007-01-16: The wireshark project (www.wireshark.org) reports that - ** without this code, their parser segfaults. I'm not sure what there - ** parser is doing to make this happen. This is the second bug report - ** from wireshark this week. Clearly they are stressing Lemon in ways - ** that it has not been previously stressed... (SQLite ticket #2172) - */ - /*memset(&yygotominor, 0, sizeof(yygotominor));*/ - yygotominor = yyzerominor; - - - if (parserContext->executeRules) - { - switch( yyruleno ){ - /* Beginning here are the reduction cases. A typical example - ** follows: - ** case 0: - ** #line <lineno> <grammarfile> - ** { ... } // User supplied code - ** #line <lineno> <thisfile> - ** break; - */ - case 1: /* cmdlist ::= cmdlist ecmd */ -{parserContext->addQuery(yymsp[0].minor.yy203); DONT_INHERIT_TOKENS("cmdlist");} - break; - case 2: /* cmdlist ::= ecmd */ -{parserContext->addQuery(yymsp[0].minor.yy203);} - break; - case 3: /* ecmd ::= SEMI */ -{yygotominor.yy203 = new SqliteEmptyQuery();} - break; - case 4: /* ecmd ::= explain cmdx SEMI */ -{ - yygotominor.yy203 = yymsp[-1].minor.yy203; - yygotominor.yy203->explain = yymsp[-2].minor.yy91->explain; - yygotominor.yy203->queryPlan = yymsp[-2].minor.yy91->queryPlan; - delete yymsp[-2].minor.yy91; - objectForTokens = yygotominor.yy203; - } - break; - case 5: /* explain ::= */ -{yygotominor.yy91 = new ParserStubExplain(false, false);} - break; - case 6: /* explain ::= EXPLAIN */ -{yygotominor.yy91 = new ParserStubExplain(true, false);} - break; - case 7: /* cmdx ::= cmd */ - case 338: /* trigger_cmd ::= update_stmt */ yytestcase(yyruleno==338); - case 339: /* trigger_cmd ::= insert_stmt */ yytestcase(yyruleno==339); - case 340: /* trigger_cmd ::= delete_stmt */ yytestcase(yyruleno==340); - case 341: /* trigger_cmd ::= select_stmt */ yytestcase(yyruleno==341); -{yygotominor.yy203 = yymsp[0].minor.yy203;} - break; - case 8: /* cmd ::= BEGIN trans_opt onconf */ -{ - yygotominor.yy203 = new SqliteBeginTrans( - yymsp[-1].minor.yy404->transactionKw, - yymsp[-1].minor.yy404->name, - *(yymsp[0].minor.yy418) - ); - delete yymsp[-1].minor.yy404; - delete yymsp[0].minor.yy418; - objectForTokens = yygotominor.yy203; - } - break; - case 9: /* trans_opt ::= */ -{yygotominor.yy404 = new ParserStubTransDetails();} - break; - case 10: /* trans_opt ::= TRANSACTION */ -{ - yygotominor.yy404 = new ParserStubTransDetails(); - yygotominor.yy404->transactionKw = true; - } - break; - case 11: /* trans_opt ::= TRANSACTION nm */ - case 12: /* trans_opt ::= TRANSACTION ID_TRANS */ yytestcase(yyruleno==12); -{ - yygotominor.yy404 = new ParserStubTransDetails(); - yygotominor.yy404->transactionKw = true; - yygotominor.yy404->name = *(yymsp[0].minor.yy319); - delete yymsp[0].minor.yy319; - } - break; - case 13: /* cmd ::= COMMIT trans_opt */ -{ - yygotominor.yy203 = new SqliteCommitTrans( - yymsp[0].minor.yy404->transactionKw, - yymsp[0].minor.yy404->name, - false - ); - delete yymsp[0].minor.yy404; - objectForTokens = yygotominor.yy203; - } - break; - case 14: /* cmd ::= END trans_opt */ -{ - yygotominor.yy203 = new SqliteCommitTrans( - yymsp[0].minor.yy404->transactionKw, - yymsp[0].minor.yy404->name, - true - ); - delete yymsp[0].minor.yy404; - objectForTokens = yygotominor.yy203; - } - break; - case 15: /* cmd ::= ROLLBACK trans_opt */ -{ - yygotominor.yy203 = new SqliteRollback( - yymsp[0].minor.yy404->transactionKw, - yymsp[0].minor.yy404->name - ); - delete yymsp[0].minor.yy404; - objectForTokens = yygotominor.yy203; - } - break; - case 16: /* cmd ::= CREATE temp TABLE fullname LP columnlist conslist_opt RP */ -{ - yygotominor.yy203 = new SqliteCreateTable( - false, - *(yymsp[-6].minor.yy226), - yymsp[-4].minor.yy120->name1, - yymsp[-4].minor.yy120->name2, - *(yymsp[-2].minor.yy42), - *(yymsp[-1].minor.yy13) - ); - delete yymsp[-6].minor.yy226; - delete yymsp[-2].minor.yy42; - delete yymsp[-1].minor.yy13; - delete yymsp[-4].minor.yy120; - objectForTokens = yygotominor.yy203; - } - break; - case 17: /* cmd ::= CREATE temp TABLE fullname AS select */ -{ - yygotominor.yy203 = new SqliteCreateTable( - false, - *(yymsp[-4].minor.yy226), - yymsp[-2].minor.yy120->name1, - yymsp[-2].minor.yy120->name2, - yymsp[0].minor.yy153 - ); - delete yymsp[-4].minor.yy226; - delete yymsp[-2].minor.yy120; - objectForTokens = yygotominor.yy203; - } - break; - case 18: /* cmd ::= CREATE temp TABLE nm DOT ID_TAB_NEW */ -{ yy_destructor(yypParser,157,&yymsp[-4].minor); - yy_destructor(yypParser,156,&yymsp[-2].minor); -} - break; - case 19: /* cmd ::= CREATE temp TABLE ID_DB|ID_TAB_NEW */ - case 110: /* cmd ::= CREATE temp VIEW ID_VIEW_NEW */ yytestcase(yyruleno==110); - case 322: /* cmd ::= CREATE temp TRIGGER ID_TRIG_NEW */ yytestcase(yyruleno==322); -{ yy_destructor(yypParser,157,&yymsp[-2].minor); -} - break; - case 20: /* temp ::= TEMP */ -{yygotominor.yy226 = new int( (yymsp[0].minor.yy0->value.length() > 4) ? 2 : 1 );} - break; - case 21: /* temp ::= */ - case 124: /* distinct ::= */ yytestcase(yyruleno==124); -{yygotominor.yy226 = new int(0);} - break; - case 22: /* columnlist ::= columnlist COMMA column */ -{ - yymsp[-2].minor.yy42->append(yymsp[0].minor.yy147); - yygotominor.yy42 = yymsp[-2].minor.yy42; - DONT_INHERIT_TOKENS("columnlist"); - } - break; - case 23: /* columnlist ::= column */ -{ - yygotominor.yy42 = new ParserCreateTableColumnList(); - yygotominor.yy42->append(yymsp[0].minor.yy147); - } - break; - case 24: /* column ::= columnid type carglist */ -{ - yygotominor.yy147 = new SqliteCreateTable::Column(*(yymsp[-2].minor.yy319), yymsp[-1].minor.yy57, *(yymsp[0].minor.yy371)); - delete yymsp[-2].minor.yy319; - delete yymsp[0].minor.yy371; - objectForTokens = yygotominor.yy147; - } - break; - case 25: /* columnid ::= nm */ - case 26: /* columnid ::= ID_COL_NEW */ yytestcase(yyruleno==26); - case 29: /* nm ::= id */ yytestcase(yyruleno==29); - case 37: /* typename ::= ids */ yytestcase(yyruleno==37); - case 156: /* dbnm ::= DOT nm */ yytestcase(yyruleno==156); - case 169: /* collate ::= COLLATE id */ yytestcase(yyruleno==169); -{yygotominor.yy319 = yymsp[0].minor.yy319;} - break; - case 27: /* id ::= ID */ -{ - yygotominor.yy319 = new QString( - stripObjName( - yymsp[0].minor.yy0->value, - parserContext->dialect - ) - ); - } - break; - case 28: /* ids ::= ID|STRING */ - case 31: /* nm ::= JOIN_KW */ yytestcase(yyruleno==31); -{yygotominor.yy319 = new QString(yymsp[0].minor.yy0->value);} - break; - case 30: /* nm ::= STRING */ -{yygotominor.yy319 = new QString(stripString(yymsp[0].minor.yy0->value));} - break; - case 32: /* type ::= */ -{yygotominor.yy57 = nullptr;} - break; - case 33: /* type ::= typetoken */ -{yygotominor.yy57 = yymsp[0].minor.yy57;} - break; - case 34: /* typetoken ::= typename */ -{ - yygotominor.yy57 = new SqliteColumnType(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy57; - } - break; - case 35: /* typetoken ::= typename LP signed RP */ -{ - yygotominor.yy57 = new SqliteColumnType(*(yymsp[-3].minor.yy319), *(yymsp[-1].minor.yy69)); - delete yymsp[-3].minor.yy319; - delete yymsp[-1].minor.yy69; - objectForTokens = yygotominor.yy57; - } - break; - case 36: /* typetoken ::= typename LP signed COMMA signed RP */ -{ - yygotominor.yy57 = new SqliteColumnType(*(yymsp[-5].minor.yy319), *(yymsp[-3].minor.yy69), *(yymsp[-1].minor.yy69)); - delete yymsp[-5].minor.yy319; - delete yymsp[-3].minor.yy69; - delete yymsp[-1].minor.yy69; - objectForTokens = yygotominor.yy57; - } - break; - case 38: /* typename ::= typename ids */ - case 39: /* typename ::= ID_COL_TYPE */ yytestcase(yyruleno==39); -{ - yymsp[-1].minor.yy319->append(" " + *(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - yygotominor.yy319 = yymsp[-1].minor.yy319; - } - break; - case 40: /* signed ::= plus_num */ - case 41: /* signed ::= minus_num */ yytestcase(yyruleno==41); - case 307: /* nmnum ::= plus_num */ yytestcase(yyruleno==307); - case 312: /* plus_num ::= PLUS number */ yytestcase(yyruleno==312); - case 313: /* plus_num ::= number */ yytestcase(yyruleno==313); -{yygotominor.yy69 = yymsp[0].minor.yy69;} - break; - case 42: /* carglist ::= carglist ccons */ - case 44: /* carglist ::= carglist carg */ yytestcase(yyruleno==44); -{ - yymsp[-1].minor.yy371->append(yymsp[0].minor.yy304); - yygotominor.yy371 = yymsp[-1].minor.yy371; - DONT_INHERIT_TOKENS("carglist"); - } - break; - case 43: /* carglist ::= carglist ccons_nm ccons */ -{ - yymsp[-2].minor.yy371->append(yymsp[-1].minor.yy304); - yymsp[-2].minor.yy371->append(yymsp[0].minor.yy304); - yygotominor.yy371 = yymsp[-2].minor.yy371; - DONT_INHERIT_TOKENS("carglist"); - } - break; - case 45: /* carglist ::= */ -{yygotominor.yy371 = new ParserCreateTableColumnConstraintList();} - break; - case 46: /* carg ::= DEFAULT STRING */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefId(stripObjName( - yymsp[0].minor.yy0->value, - parserContext->dialect - )); - objectForTokens = yygotominor.yy304; - } - break; - case 47: /* carg ::= DEFAULT ID */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefId(stripObjName( - yymsp[0].minor.yy0->value, - parserContext->dialect - )); - objectForTokens = yygotominor.yy304; - - } - break; - case 48: /* carg ::= DEFAULT INTEGER */ - case 49: /* carg ::= DEFAULT PLUS INTEGER */ yytestcase(yyruleno==49); -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(yymsp[0].minor.yy0->value).toLongLong(); - yygotominor.yy304->initDefTerm(val, false); - objectForTokens = yygotominor.yy304; - } - break; - case 50: /* carg ::= DEFAULT MINUS INTEGER */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(yymsp[0].minor.yy0->value).toLongLong(); - yygotominor.yy304->initDefTerm(val, true); - objectForTokens = yygotominor.yy304; - } - break; - case 51: /* carg ::= DEFAULT FLOAT */ - case 52: /* carg ::= DEFAULT PLUS FLOAT */ yytestcase(yyruleno==52); -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(yymsp[0].minor.yy0->value).toDouble(); - yygotominor.yy304->initDefTerm(val, false); - objectForTokens = yygotominor.yy304; - } - break; - case 53: /* carg ::= DEFAULT MINUS FLOAT */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(yymsp[0].minor.yy0->value).toDouble(); - yygotominor.yy304->initDefTerm(val, true); - objectForTokens = yygotominor.yy304; - } - break; - case 54: /* carg ::= DEFAULT NULL */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefTerm(QVariant(), false); - objectForTokens = yygotominor.yy304; - } - break; - case 55: /* ccons_nm ::= CONSTRAINT nm */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefNameOnly(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy304; - } - break; - case 56: /* ccons ::= NULL onconf */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initNull(*(yymsp[0].minor.yy418)); - delete yymsp[0].minor.yy418; - objectForTokens = yygotominor.yy304; - } - break; - case 57: /* ccons ::= NOT NULL onconf */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initNotNull(*(yymsp[0].minor.yy418)); - delete yymsp[0].minor.yy418; - objectForTokens = yygotominor.yy304; - } - break; - case 58: /* ccons ::= PRIMARY KEY sortorder onconf */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initPk(*(yymsp[-1].minor.yy389), *(yymsp[0].minor.yy418), false); - delete yymsp[-1].minor.yy389; - delete yymsp[0].minor.yy418; - objectForTokens = yygotominor.yy304; - } - break; - case 59: /* ccons ::= UNIQUE onconf */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initUnique(*(yymsp[0].minor.yy418)); - delete yymsp[0].minor.yy418; - objectForTokens = yygotominor.yy304; - } - break; - case 60: /* ccons ::= CHECK LP expr RP onconf */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initCheck(yymsp[-2].minor.yy192, *(yymsp[0].minor.yy418)); - delete yymsp[0].minor.yy418; - objectForTokens = yygotominor.yy304; - } - break; - case 61: /* ccons ::= REFERENCES nm idxlist_opt refargs */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initFk(*(yymsp[-2].minor.yy319), *(yymsp[-1].minor.yy63), *(yymsp[0].minor.yy264)); - delete yymsp[-2].minor.yy319; - delete yymsp[0].minor.yy264; - delete yymsp[-1].minor.yy63; - objectForTokens = yygotominor.yy304; - } - break; - case 62: /* ccons ::= defer_subclause */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefer(yymsp[0].minor.yy329->initially, yymsp[0].minor.yy329->deferrable); - delete yymsp[0].minor.yy329; - objectForTokens = yygotominor.yy304; - } - break; - case 63: /* ccons ::= COLLATE id */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initColl(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy304; - } - break; - case 64: /* ccons ::= CHECK LP RP */ -{ - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initCheck(); - objectForTokens = yygotominor.yy304; - parserContext->minorErrorAfterLastToken("Syntax error"); - } - break; - case 65: /* refargs ::= */ -{yygotominor.yy264 = new ParserFkConditionList();} - break; - case 66: /* refargs ::= refargs refarg */ -{ - yymsp[-1].minor.yy264->append(yymsp[0].minor.yy187); - yygotominor.yy264 = yymsp[-1].minor.yy264; - DONT_INHERIT_TOKENS("refargs"); - } - break; - case 67: /* refarg ::= MATCH nm */ -{ - yygotominor.yy187 = new SqliteForeignKey::Condition(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - } - break; - case 68: /* refarg ::= ON INSERT refact */ -{yygotominor.yy187 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::INSERT, *(yymsp[0].minor.yy424)); delete yymsp[0].minor.yy424;} - break; - case 69: /* refarg ::= ON DELETE refact */ -{yygotominor.yy187 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::DELETE, *(yymsp[0].minor.yy424)); delete yymsp[0].minor.yy424;} - break; - case 70: /* refarg ::= ON UPDATE refact */ - case 71: /* refarg ::= MATCH ID_FK_MATCH */ yytestcase(yyruleno==71); -{yygotominor.yy187 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::UPDATE, *(yymsp[0].minor.yy424)); delete yymsp[0].minor.yy424;} - break; - case 72: /* refact ::= SET NULL */ -{yygotominor.yy424 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_NULL);} - break; - case 73: /* refact ::= SET DEFAULT */ -{yygotominor.yy424 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_DEFAULT);} - break; - case 74: /* refact ::= CASCADE */ -{yygotominor.yy424 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::CASCADE);} - break; - case 75: /* refact ::= RESTRICT */ -{yygotominor.yy424 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::RESTRICT);} - break; - case 76: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ -{ - yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(yymsp[0].minor.yy312)); - delete yymsp[0].minor.yy312; - } - break; - case 77: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ -{ - yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::DEFERRABLE, *(yymsp[0].minor.yy312)); - delete yymsp[0].minor.yy312; - } - break; - case 78: /* init_deferred_pred_opt ::= */ -{yygotominor.yy312 = new SqliteInitially(SqliteInitially::null);} - break; - case 79: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ -{yygotominor.yy312 = new SqliteInitially(SqliteInitially::DEFERRED);} - break; - case 80: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ -{yygotominor.yy312 = new SqliteInitially(SqliteInitially::IMMEDIATE);} - break; - case 81: /* conslist_opt ::= */ -{yygotominor.yy13 = new ParserCreateTableConstraintList();} - break; - case 82: /* conslist_opt ::= COMMA conslist */ -{yygotominor.yy13 = yymsp[0].minor.yy13;} - break; - case 83: /* conslist ::= conslist tconscomma tcons */ -{ - yymsp[0].minor.yy406->afterComma = *(yymsp[-1].minor.yy291); - yymsp[-2].minor.yy13->append(yymsp[0].minor.yy406); - yygotominor.yy13 = yymsp[-2].minor.yy13; - delete yymsp[-1].minor.yy291; - DONT_INHERIT_TOKENS("conslist"); - } - break; - case 84: /* conslist ::= tcons */ -{ - yygotominor.yy13 = new ParserCreateTableConstraintList(); - yygotominor.yy13->append(yymsp[0].minor.yy406); - } - break; - case 85: /* tconscomma ::= COMMA */ - case 269: /* not_opt ::= NOT */ yytestcase(yyruleno==269); - case 285: /* uniqueflag ::= UNIQUE */ yytestcase(yyruleno==285); - case 349: /* database_kw_opt ::= DATABASE */ yytestcase(yyruleno==349); -{yygotominor.yy291 = new bool(true);} - break; - case 86: /* tconscomma ::= */ - case 268: /* not_opt ::= */ yytestcase(yyruleno==268); - case 286: /* uniqueflag ::= */ yytestcase(yyruleno==286); - case 350: /* database_kw_opt ::= */ yytestcase(yyruleno==350); -{yygotominor.yy291 = new bool(false);} - break; - case 87: /* tcons ::= CONSTRAINT nm */ -{ - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initNameOnly(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy406; - } - break; - case 88: /* tcons ::= PRIMARY KEY LP idxlist RP onconf */ -{ - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initPk(*(yymsp[-2].minor.yy63), false, *(yymsp[0].minor.yy418)); - delete yymsp[0].minor.yy418; - delete yymsp[-2].minor.yy63; - objectForTokens = yygotominor.yy406; - } - break; - case 89: /* tcons ::= UNIQUE LP idxlist RP onconf */ -{ - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initUnique(*(yymsp[-2].minor.yy63), *(yymsp[0].minor.yy418)); - delete yymsp[0].minor.yy418; - delete yymsp[-2].minor.yy63; - objectForTokens = yygotominor.yy406; - } - break; - case 90: /* tcons ::= CHECK LP expr RP onconf */ -{ - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initCheck(yymsp[-2].minor.yy192, *(yymsp[0].minor.yy418)); - objectForTokens = yygotominor.yy406; - } - break; - case 91: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */ - case 92: /* tcons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==92); - case 93: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB */ yytestcase(yyruleno==93); -{ - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initFk( - *(yymsp[-6].minor.yy63), - *(yymsp[-3].minor.yy319), - *(yymsp[-2].minor.yy63), - *(yymsp[-1].minor.yy264), - yymsp[0].minor.yy329->initially, - yymsp[0].minor.yy329->deferrable - ); - delete yymsp[-3].minor.yy319; - delete yymsp[-1].minor.yy264; - delete yymsp[0].minor.yy329; - delete yymsp[-2].minor.yy63; - delete yymsp[-6].minor.yy63; - objectForTokens = yygotominor.yy406; - } - break; - case 94: /* tcons ::= CHECK LP RP onconf */ -{ - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initCheck(); - objectForTokens = yygotominor.yy406; - parserContext->minorErrorAfterLastToken("Syntax error"); - yy_destructor(yypParser,155,&yymsp[0].minor); -} - break; - case 95: /* defer_subclause_opt ::= */ -{yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);} - break; - case 96: /* defer_subclause_opt ::= defer_subclause */ -{yygotominor.yy329 = yymsp[0].minor.yy329;} - break; - case 97: /* onconf ::= */ - case 99: /* orconf ::= */ yytestcase(yyruleno==99); -{yygotominor.yy418 = new SqliteConflictAlgo(SqliteConflictAlgo::null);} - break; - case 98: /* onconf ::= ON CONFLICT resolvetype */ - case 100: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==100); -{yygotominor.yy418 = yymsp[0].minor.yy418;} - break; - case 101: /* resolvetype ::= ROLLBACK */ - case 102: /* resolvetype ::= ABORT */ yytestcase(yyruleno==102); - case 103: /* resolvetype ::= FAIL */ yytestcase(yyruleno==103); - case 104: /* resolvetype ::= IGNORE */ yytestcase(yyruleno==104); - case 105: /* resolvetype ::= REPLACE */ yytestcase(yyruleno==105); -{yygotominor.yy418 = new SqliteConflictAlgo(sqliteConflictAlgo(yymsp[0].minor.yy0->value));} - break; - case 106: /* cmd ::= DROP TABLE fullname */ -{ - yygotominor.yy203 = new SqliteDropTable(false, yymsp[0].minor.yy120->name1, yymsp[0].minor.yy120->name2); - delete yymsp[0].minor.yy120; - objectForTokens = yygotominor.yy203; - } - break; - case 107: /* cmd ::= DROP TABLE nm DOT ID_TAB */ - case 108: /* cmd ::= DROP TABLE ID_DB|ID_TAB */ yytestcase(yyruleno==108); - case 148: /* singlesrc ::= nm DOT ID_TAB */ yytestcase(yyruleno==148); - case 149: /* singlesrc ::= ID_DB|ID_TAB */ yytestcase(yyruleno==149); - case 150: /* singlesrc ::= nm DOT ID_VIEW */ yytestcase(yyruleno==150); - case 151: /* singlesrc ::= ID_DB|ID_VIEW */ yytestcase(yyruleno==151); - case 186: /* delete_stmt ::= DELETE FROM nm DOT ID_TAB */ yytestcase(yyruleno==186); - case 187: /* delete_stmt ::= DELETE FROM ID_DB|ID_TAB */ yytestcase(yyruleno==187); - case 195: /* update_stmt ::= UPDATE orconf nm DOT ID_TAB */ yytestcase(yyruleno==195); - case 196: /* update_stmt ::= UPDATE orconf ID_DB|ID_TAB */ yytestcase(yyruleno==196); - case 263: /* exprx ::= nm DOT ID_TAB|ID_COL */ yytestcase(yyruleno==263); - case 283: /* cmd ::= CREATE uniqueflag INDEX nm DOT ID_IDX_NEW */ yytestcase(yyruleno==283); - case 284: /* cmd ::= CREATE uniqueflag INDEX ID_DB|ID_IDX_NEW */ yytestcase(yyruleno==284); - case 294: /* cmd ::= DROP INDEX nm DOT ID_IDX */ yytestcase(yyruleno==294); - case 295: /* cmd ::= DROP INDEX ID_DB|ID_IDX */ yytestcase(yyruleno==295); - case 305: /* cmd ::= PRAGMA nm DOT ID_PRAGMA */ yytestcase(yyruleno==305); - case 306: /* cmd ::= PRAGMA ID_DB|ID_PRAGMA */ yytestcase(yyruleno==306); - case 344: /* cmd ::= DROP TRIGGER nm DOT ID_TRIG */ yytestcase(yyruleno==344); - case 345: /* cmd ::= DROP TRIGGER ID_DB|ID_TRIG */ yytestcase(yyruleno==345); -{ yy_destructor(yypParser,156,&yymsp[-2].minor); -} - break; - case 109: /* cmd ::= CREATE temp VIEW nm AS select */ -{ - yygotominor.yy203 = new SqliteCreateView(*(yymsp[-4].minor.yy226), false, *(yymsp[-2].minor.yy319), QString::null, yymsp[0].minor.yy153); - delete yymsp[-4].minor.yy226; - delete yymsp[-2].minor.yy319; - objectForTokens = yygotominor.yy203; - } - break; - case 111: /* cmd ::= DROP VIEW nm */ - case 112: /* cmd ::= DROP VIEW ID_VIEW */ yytestcase(yyruleno==112); -{ - yygotominor.yy203 = new SqliteDropView(false, *(yymsp[0].minor.yy319), QString::null); - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy203; - } - break; - case 113: /* cmd ::= select_stmt */ - case 182: /* cmd ::= delete_stmt */ yytestcase(yyruleno==182); - case 191: /* cmd ::= update_stmt */ yytestcase(yyruleno==191); - case 203: /* cmd ::= insert_stmt */ yytestcase(yyruleno==203); -{ - yygotominor.yy203 = yymsp[0].minor.yy203; - objectForTokens = yygotominor.yy203; - } - break; - case 114: /* select_stmt ::= select */ -{ - yygotominor.yy203 = yymsp[0].minor.yy153; - // since it's used in trigger: - objectForTokens = yygotominor.yy203; - } - break; - case 115: /* select ::= oneselect */ -{ - yygotominor.yy153 = SqliteSelect::append(yymsp[0].minor.yy150); - objectForTokens = yygotominor.yy153; - } - break; - case 116: /* select ::= select multiselect_op oneselect */ -{ - yygotominor.yy153 = SqliteSelect::append(yymsp[-2].minor.yy153, *(yymsp[-1].minor.yy382), yymsp[0].minor.yy150); - delete yymsp[-1].minor.yy382; - objectForTokens = yygotominor.yy153; - } - break; - case 117: /* multiselect_op ::= UNION */ -{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);} - break; - case 118: /* multiselect_op ::= UNION ALL */ -{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);} - break; - case 119: /* multiselect_op ::= EXCEPT */ -{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);} - break; - case 120: /* multiselect_op ::= INTERSECT */ -{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);} - break; - case 121: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ -{ - yygotominor.yy150 = new SqliteSelect::Core( - *(yymsp[-7].minor.yy226), - *(yymsp[-6].minor.yy213), - yymsp[-5].minor.yy31, - yymsp[-4].minor.yy192, - *(yymsp[-3].minor.yy231), - yymsp[-2].minor.yy192, - *(yymsp[-1].minor.yy243), - yymsp[0].minor.yy324 - ); - delete yymsp[-6].minor.yy213; - delete yymsp[-7].minor.yy226; - delete yymsp[-3].minor.yy231; - delete yymsp[-1].minor.yy243; - objectForTokens = yygotominor.yy150; - } - break; - case 122: /* distinct ::= DISTINCT */ -{yygotominor.yy226 = new int(1);} - break; - case 123: /* distinct ::= ALL */ -{yygotominor.yy226 = new int(2);} - break; - case 125: /* sclp ::= selcollist COMMA */ -{yygotominor.yy213 = yymsp[-1].minor.yy213;} - break; - case 126: /* sclp ::= */ -{yygotominor.yy213 = new ParserResultColumnList();} - break; - case 127: /* selcollist ::= sclp expr as */ -{ - SqliteSelect::Core::ResultColumn* obj = - new SqliteSelect::Core::ResultColumn( - yymsp[-1].minor.yy192, - yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->asKw : false, - yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->name : QString::null - ); - - yymsp[-2].minor.yy213->append(obj); - yygotominor.yy213 = yymsp[-2].minor.yy213; - delete yymsp[0].minor.yy40; - objectForTokens = obj; - DONT_INHERIT_TOKENS("sclp"); - } - break; - case 128: /* selcollist ::= sclp STAR */ -{ - SqliteSelect::Core::ResultColumn* obj = - new SqliteSelect::Core::ResultColumn(true); - - yymsp[-1].minor.yy213->append(obj); - yygotominor.yy213 = yymsp[-1].minor.yy213; - objectForTokens = obj; - DONT_INHERIT_TOKENS("sclp"); - } - break; - case 129: /* selcollist ::= sclp nm DOT STAR */ -{ - SqliteSelect::Core::ResultColumn* obj = - new SqliteSelect::Core::ResultColumn( - true, - *(yymsp[-2].minor.yy319) - ); - yymsp[-3].minor.yy213->append(obj); - yygotominor.yy213 = yymsp[-3].minor.yy213; - delete yymsp[-2].minor.yy319; - objectForTokens = obj; - DONT_INHERIT_TOKENS("sclp"); - } - break; - case 130: /* selcollist ::= sclp */ - case 131: /* selcollist ::= sclp ID_TAB DOT STAR */ yytestcase(yyruleno==131); -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy213 = yymsp[0].minor.yy213; - } - break; - case 132: /* as ::= AS nm */ -{ - yygotominor.yy40 = new ParserStubAlias(*(yymsp[0].minor.yy319), true); - delete yymsp[0].minor.yy319; - } - break; - case 133: /* as ::= ids */ - case 134: /* as ::= AS ID_ALIAS */ yytestcase(yyruleno==134); - case 135: /* as ::= ID_ALIAS */ yytestcase(yyruleno==135); -{ - yygotominor.yy40 = new ParserStubAlias(*(yymsp[0].minor.yy319), false); - delete yymsp[0].minor.yy319; - } - break; - case 136: /* as ::= */ -{yygotominor.yy40 = nullptr;} - break; - case 137: /* from ::= */ -{yygotominor.yy31 = nullptr;} - break; - case 138: /* from ::= FROM joinsrc */ -{yygotominor.yy31 = yymsp[0].minor.yy31;} - break; - case 139: /* joinsrc ::= singlesrc seltablist */ -{ - yygotominor.yy31 = new SqliteSelect::Core::JoinSource( - yymsp[-1].minor.yy121, - *(yymsp[0].minor.yy131) - ); - delete yymsp[0].minor.yy131; - objectForTokens = yygotominor.yy31; - } - break; - case 140: /* joinsrc ::= */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy31 = new SqliteSelect::Core::JoinSource(); - objectForTokens = yygotominor.yy31; - } - break; - case 141: /* seltablist ::= seltablist joinop singlesrc joinconstr_opt */ -{ - SqliteSelect::Core::JoinSourceOther* src = - new SqliteSelect::Core::JoinSourceOther(yymsp[-2].minor.yy221, yymsp[-1].minor.yy121, yymsp[0].minor.yy455); - - yymsp[-3].minor.yy131->append(src); - yygotominor.yy131 = yymsp[-3].minor.yy131; - objectForTokens = src; - DONT_INHERIT_TOKENS("seltablist"); - } - break; - case 142: /* seltablist ::= */ -{ - yygotominor.yy131 = new ParserOtherSourceList(); - } - break; - case 143: /* singlesrc ::= nm dbnm as */ -{ - yygotominor.yy121 = new SqliteSelect::Core::SingleSource( - *(yymsp[-2].minor.yy319), - *(yymsp[-1].minor.yy319), - yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->asKw : false, - yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->name : QString::null, - false, - QString::null - ); - delete yymsp[-2].minor.yy319; - delete yymsp[-1].minor.yy319; - delete yymsp[0].minor.yy40; - objectForTokens = yygotominor.yy121; - } - break; - case 144: /* singlesrc ::= LP select RP as */ -{ - yygotominor.yy121 = new SqliteSelect::Core::SingleSource( - yymsp[-2].minor.yy153, - yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->asKw : false, - yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->name : QString::null - ); - delete yymsp[0].minor.yy40; - objectForTokens = yygotominor.yy121; - } - break; - case 145: /* singlesrc ::= LP joinsrc RP as */ -{ - yygotominor.yy121 = new SqliteSelect::Core::SingleSource( - yymsp[-2].minor.yy31, - yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->asKw : false, - yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->name : QString::null - ); - delete yymsp[0].minor.yy40; - objectForTokens = yygotominor.yy121; - } - break; - case 146: /* singlesrc ::= */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy121 = new SqliteSelect::Core::SingleSource(); - objectForTokens = yygotominor.yy121; - } - break; - case 147: /* singlesrc ::= nm DOT */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy121 = new SqliteSelect::Core::SingleSource(); - yygotominor.yy121->database = *(yymsp[-1].minor.yy319); - delete yymsp[-1].minor.yy319; - objectForTokens = yygotominor.yy121; - } - break; - case 152: /* joinconstr_opt ::= ON expr */ -{ - yygotominor.yy455 = new SqliteSelect::Core::JoinConstraint(yymsp[0].minor.yy192); - objectForTokens = yygotominor.yy455; - } - break; - case 153: /* joinconstr_opt ::= USING LP idlist RP */ -{ - yygotominor.yy455 = new SqliteSelect::Core::JoinConstraint(*(yymsp[-1].minor.yy95)); - delete yymsp[-1].minor.yy95; - objectForTokens = yygotominor.yy455; - } - break; - case 154: /* joinconstr_opt ::= */ -{yygotominor.yy455 = nullptr;} - break; - case 155: /* dbnm ::= */ -{yygotominor.yy319 = new QString();} - break; - case 157: /* fullname ::= nm dbnm */ -{ - yygotominor.yy120 = new ParserFullName(); - yygotominor.yy120->name1 = *(yymsp[-1].minor.yy319); - yygotominor.yy120->name2 = *(yymsp[0].minor.yy319); - delete yymsp[-1].minor.yy319; - delete yymsp[0].minor.yy319; - } - break; - case 158: /* joinop ::= COMMA */ -{ - yygotominor.yy221 = new SqliteSelect::Core::JoinOp(true); - objectForTokens = yygotominor.yy221; - } - break; - case 159: /* joinop ::= JOIN */ -{ - yygotominor.yy221 = new SqliteSelect::Core::JoinOp(false); - objectForTokens = yygotominor.yy221; - } - break; - case 160: /* joinop ::= JOIN_KW JOIN */ -{ - yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-1].minor.yy0->value); - objectForTokens = yygotominor.yy221; - } - break; - case 161: /* joinop ::= JOIN_KW nm JOIN */ -{ - yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-2].minor.yy0->value, *(yymsp[-1].minor.yy319)); - delete yymsp[-1].minor.yy319; - objectForTokens = yygotominor.yy221; - } - break; - case 162: /* joinop ::= JOIN_KW nm nm JOIN */ - case 163: /* joinop ::= ID_JOIN_OPTS */ yytestcase(yyruleno==163); -{ - yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-3].minor.yy0->value, *(yymsp[-2].minor.yy319), *(yymsp[-1].minor.yy319)); - delete yymsp[-2].minor.yy319; - delete yymsp[-2].minor.yy319; - objectForTokens = yygotominor.yy221; - } - break; - case 164: /* orderby_opt ::= */ -{yygotominor.yy243 = new ParserOrderByList();} - break; - case 165: /* orderby_opt ::= ORDER BY sortlist */ -{yygotominor.yy243 = yymsp[0].minor.yy243;} - break; - case 166: /* sortlist ::= sortlist COMMA collate expr sortorder */ -{ - SqliteOrderBy* obj; - if (yymsp[-2].minor.yy319) - { - SqliteExpr* coll = new SqliteExpr(); - coll->initCollate(yymsp[-1].minor.yy192, *(yymsp[-2].minor.yy319)); - delete yymsp[-2].minor.yy319; - obj = new SqliteOrderBy(coll, *(yymsp[0].minor.yy389)); - } - else - { - obj = new SqliteOrderBy(yymsp[-1].minor.yy192, *(yymsp[0].minor.yy389)); - } - yymsp[-4].minor.yy243->append(obj); - yygotominor.yy243 = yymsp[-4].minor.yy243; - delete yymsp[0].minor.yy389; - objectForTokens = obj; - DONT_INHERIT_TOKENS("sortlist"); - } - break; - case 167: /* sortlist ::= expr collate sortorder */ -{ - SqliteOrderBy* obj; - if (yymsp[-1].minor.yy319) - { - SqliteExpr* coll = new SqliteExpr(); - coll->initCollate(yymsp[-2].minor.yy192, *(yymsp[-1].minor.yy319)); - delete yymsp[-1].minor.yy319; - obj = new SqliteOrderBy(coll, *(yymsp[0].minor.yy389)); - } - else - { - obj = new SqliteOrderBy(yymsp[-2].minor.yy192, *(yymsp[0].minor.yy389)); - } - yygotominor.yy243 = new ParserOrderByList(); - yygotominor.yy243->append(obj); - delete yymsp[0].minor.yy389; - objectForTokens = obj; - } - break; - case 168: /* collate ::= */ -{yygotominor.yy319 = nullptr;} - break; - case 170: /* sortorder ::= ASC */ -{yygotominor.yy389 = new SqliteSortOrder(SqliteSortOrder::ASC);} - break; - case 171: /* sortorder ::= DESC */ -{yygotominor.yy389 = new SqliteSortOrder(SqliteSortOrder::DESC);} - break; - case 172: /* sortorder ::= */ -{yygotominor.yy389 = new SqliteSortOrder(SqliteSortOrder::null);} - break; - case 173: /* groupby_opt ::= */ - case 278: /* exprlist ::= */ yytestcase(yyruleno==278); -{yygotominor.yy231 = new ParserExprList();} - break; - case 174: /* groupby_opt ::= GROUP BY nexprlist */ - case 277: /* exprlist ::= nexprlist */ yytestcase(yyruleno==277); -{yygotominor.yy231 = yymsp[0].minor.yy231;} - break; - case 175: /* groupby_opt ::= GROUP BY */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy231 = new ParserExprList(); - } - break; - case 176: /* having_opt ::= */ - case 188: /* where_opt ::= */ yytestcase(yyruleno==188); - case 274: /* case_else ::= */ yytestcase(yyruleno==274); - case 276: /* case_operand ::= */ yytestcase(yyruleno==276); - case 334: /* when_clause ::= */ yytestcase(yyruleno==334); - case 347: /* key_opt ::= */ yytestcase(yyruleno==347); -{yygotominor.yy192 = nullptr;} - break; - case 177: /* having_opt ::= HAVING expr */ - case 189: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==189); - case 266: /* expr ::= exprx */ yytestcase(yyruleno==266); - case 273: /* case_else ::= ELSE expr */ yytestcase(yyruleno==273); - case 275: /* case_operand ::= exprx */ yytestcase(yyruleno==275); - case 335: /* when_clause ::= WHEN expr */ yytestcase(yyruleno==335); -{yygotominor.yy192 = yymsp[0].minor.yy192;} - break; - case 178: /* limit_opt ::= */ -{yygotominor.yy324 = nullptr;} - break; - case 179: /* limit_opt ::= LIMIT signed */ -{ - yygotominor.yy324 = new SqliteLimit(*(yymsp[0].minor.yy69)); - delete yymsp[0].minor.yy69; - objectForTokens = yygotominor.yy324; - } - break; - case 180: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ - SqliteExpr* expr1 = new SqliteExpr(); - expr1->initLiteral(*(yymsp[-2].minor.yy69)); - expr1->setParent(yygotominor.yy324); - - SqliteExpr* expr2 = new SqliteExpr(); - expr1->initLiteral(*(yymsp[0].minor.yy69)); - expr1->setParent(yygotominor.yy324); - - yygotominor.yy324 = new SqliteLimit(expr1, expr2, true); - - TokenPtr limitToken = TokenPtr::create(Token::INTEGER, yymsp[-2].minor.yy69->toString()); - parserContext->addManagedToken(limitToken); - expr1->tokens << limitToken; - expr1->tokensMap["term"] << limitToken; - - TokenPtr offsetToken = TokenPtr::create(Token::INTEGER, yymsp[0].minor.yy69->toString()); - parserContext->addManagedToken(offsetToken); - expr2->tokens << offsetToken; - expr2->tokensMap["term"] << offsetToken; - - delete yymsp[-2].minor.yy69; - delete yymsp[0].minor.yy69; - objectForTokens = yygotominor.yy324; - } - break; - case 181: /* limit_opt ::= LIMIT signed COMMA signed */ -{ - SqliteExpr* expr1 = new SqliteExpr(); - expr1->initLiteral(*(yymsp[-2].minor.yy69)); - expr1->setParent(yygotominor.yy324); - - SqliteExpr* expr2 = new SqliteExpr(); - expr1->initLiteral(*(yymsp[0].minor.yy69)); - expr1->setParent(yygotominor.yy324); - - yygotominor.yy324 = new SqliteLimit(expr1, expr2, false); - - TokenPtr limitToken = TokenPtr::create(Token::INTEGER, yymsp[-2].minor.yy69->toString()); - parserContext->addManagedToken(limitToken); - expr1->tokens << limitToken; - expr1->tokensMap["term"] << limitToken; - - TokenPtr offsetToken = TokenPtr::create(Token::INTEGER, yymsp[0].minor.yy69->toString()); - parserContext->addManagedToken(offsetToken); - expr2->tokens << offsetToken; - expr2->tokensMap["term"] << offsetToken; - - delete yymsp[-2].minor.yy69; - delete yymsp[0].minor.yy69; - objectForTokens = yygotominor.yy324; - } - break; - case 183: /* delete_stmt ::= DELETE FROM fullname where_opt */ -{ - yygotominor.yy203 = new SqliteDelete( - yymsp[-1].minor.yy120->name1, - yymsp[-1].minor.yy120->name2, - false, - yymsp[0].minor.yy192, - nullptr - ); - delete yymsp[-1].minor.yy120; - // since it's used in trigger: - objectForTokens = yygotominor.yy203; - } - break; - case 184: /* delete_stmt ::= DELETE FROM */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteDelete* q = new SqliteDelete(); - yygotominor.yy203 = q; - objectForTokens = yygotominor.yy203; - } - break; - case 185: /* delete_stmt ::= DELETE FROM nm DOT */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteDelete* q = new SqliteDelete(); - q->database = *(yymsp[-1].minor.yy319); - yygotominor.yy203 = q; - objectForTokens = yygotominor.yy203; - delete yymsp[-1].minor.yy319; - } - break; - case 190: /* where_opt ::= WHERE */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy192 = new SqliteExpr(); - } - break; - case 192: /* update_stmt ::= UPDATE orconf fullname SET setlist where_opt */ -{ - yygotominor.yy203 = new SqliteUpdate( - *(yymsp[-4].minor.yy418), - yymsp[-3].minor.yy120->name1, - yymsp[-3].minor.yy120->name2, - false, - QString::null, - *(yymsp[-1].minor.yy201), - yymsp[0].minor.yy192, - nullptr - ); - delete yymsp[-4].minor.yy418; - delete yymsp[-3].minor.yy120; - delete yymsp[-1].minor.yy201; - // since it's used in trigger: - objectForTokens = yygotominor.yy203; - } - break; - case 193: /* update_stmt ::= UPDATE orconf */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy203 = new SqliteUpdate(); - objectForTokens = yygotominor.yy203; - delete yymsp[0].minor.yy418; - } - break; - case 194: /* update_stmt ::= UPDATE orconf nm DOT */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteUpdate* q = new SqliteUpdate(); - q->database = *(yymsp[-1].minor.yy319); - yygotominor.yy203 = q; - objectForTokens = yygotominor.yy203; - delete yymsp[-2].minor.yy418; - delete yymsp[-1].minor.yy319; - } - break; - case 197: /* setlist ::= setlist COMMA nm EQ expr */ -{ - yymsp[-4].minor.yy201->append(ParserSetValue(*(yymsp[-2].minor.yy319), yymsp[0].minor.yy192)); - yygotominor.yy201 = yymsp[-4].minor.yy201; - delete yymsp[-2].minor.yy319; - DONT_INHERIT_TOKENS("setlist"); - } - break; - case 198: /* setlist ::= nm EQ expr */ -{ - yygotominor.yy201 = new ParserSetValueList(); - yygotominor.yy201->append(ParserSetValue(*(yymsp[-2].minor.yy319), yymsp[0].minor.yy192)); - delete yymsp[-2].minor.yy319; - } - break; - case 199: /* setlist ::= */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy201 = new ParserSetValueList(); - } - break; - case 200: /* setlist ::= setlist COMMA */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy201 = yymsp[-1].minor.yy201; - } - break; - case 201: /* setlist ::= setlist COMMA ID_COL */ - case 202: /* setlist ::= ID_COL */ yytestcase(yyruleno==202); -{ yy_destructor(yypParser,216,&yymsp[-2].minor); -} - break; - case 204: /* insert_stmt ::= insert_cmd INTO fullname idlist_opt VALUES LP exprlist RP */ -{ - yygotominor.yy203 = new SqliteInsert( - yymsp[-7].minor.yy344->replace, - yymsp[-7].minor.yy344->orConflict, - yymsp[-5].minor.yy120->name1, - yymsp[-5].minor.yy120->name2, - *(yymsp[-4].minor.yy95), - *(yymsp[-1].minor.yy231), - nullptr - ); - delete yymsp[-5].minor.yy120; - delete yymsp[-7].minor.yy344; - delete yymsp[-1].minor.yy231; - delete yymsp[-4].minor.yy95; - // since it's used in trigger: - objectForTokens = yygotominor.yy203; - } - break; - case 205: /* insert_stmt ::= insert_cmd INTO fullname idlist_opt select */ -{ - yygotominor.yy203 = new SqliteInsert( - yymsp[-4].minor.yy344->replace, - yymsp[-4].minor.yy344->orConflict, - yymsp[-2].minor.yy120->name1, - yymsp[-2].minor.yy120->name2, - *(yymsp[-1].minor.yy95), - yymsp[0].minor.yy153, - nullptr - ); - delete yymsp[-2].minor.yy120; - delete yymsp[-4].minor.yy344; - delete yymsp[-1].minor.yy95; - // since it's used in trigger: - objectForTokens = yygotominor.yy203; - } - break; - case 206: /* insert_stmt ::= insert_cmd INTO */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteInsert* q = new SqliteInsert(); - q->replaceKw = yymsp[-1].minor.yy344->replace; - q->onConflict = yymsp[-1].minor.yy344->orConflict; - yygotominor.yy203 = q; - objectForTokens = yygotominor.yy203; - delete yymsp[-1].minor.yy344; - } - break; - case 207: /* insert_stmt ::= insert_cmd INTO nm DOT */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteInsert* q = new SqliteInsert(); - q->replaceKw = yymsp[-3].minor.yy344->replace; - q->onConflict = yymsp[-3].minor.yy344->orConflict; - q->database = *(yymsp[-1].minor.yy319); - yygotominor.yy203 = q; - objectForTokens = yygotominor.yy203; - delete yymsp[-3].minor.yy344; - delete yymsp[-1].minor.yy319; - } - break; - case 208: /* insert_stmt ::= insert_cmd INTO ID_DB|ID_TAB */ -{ yy_destructor(yypParser,218,&yymsp[-2].minor); -} - break; - case 209: /* insert_stmt ::= insert_cmd INTO nm DOT ID_TAB */ -{ yy_destructor(yypParser,218,&yymsp[-4].minor); - yy_destructor(yypParser,156,&yymsp[-2].minor); -} - break; - case 210: /* insert_cmd ::= INSERT orconf */ -{ - yygotominor.yy344 = new ParserStubInsertOrReplace(false, *(yymsp[0].minor.yy418)); - delete yymsp[0].minor.yy418; - } - break; - case 211: /* insert_cmd ::= REPLACE */ -{yygotominor.yy344 = new ParserStubInsertOrReplace(true);} - break; - case 212: /* idlist_opt ::= */ -{yygotominor.yy95 = new QStringList();} - break; - case 213: /* idlist_opt ::= LP idlist RP */ -{yygotominor.yy95 = yymsp[-1].minor.yy95;} - break; - case 214: /* idlist ::= idlist COMMA nm */ -{ - yymsp[-2].minor.yy95->append(*(yymsp[0].minor.yy319)); - yygotominor.yy95 = yymsp[-2].minor.yy95; - delete yymsp[0].minor.yy319; - DONT_INHERIT_TOKENS("idlist"); - } - break; - case 215: /* idlist ::= nm */ -{ - yygotominor.yy95 = new QStringList(); - yygotominor.yy95->append(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - } - break; - case 216: /* idlist ::= */ -{ - parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy95 = new QStringList(); - } - break; - case 217: /* idlist ::= idlist COMMA ID_COL */ - case 218: /* idlist ::= ID_COL */ yytestcase(yyruleno==218); -{ yy_destructor(yypParser,210,&yymsp[-2].minor); -} - break; - case 219: /* exprx ::= NULL */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initNull(); - objectForTokens = yygotominor.yy192; - } - break; - case 220: /* exprx ::= INTEGER */ -{ - yygotominor.yy192 = new SqliteExpr(); - QVariant val = QVariant(yymsp[0].minor.yy0->value).toLongLong(); - yygotominor.yy192->initLiteral(val); - objectForTokens = yygotominor.yy192; - } - break; - case 221: /* exprx ::= FLOAT */ -{ - yygotominor.yy192 = new SqliteExpr(); - QVariant val = QVariant(yymsp[0].minor.yy0->value).toDouble(); - yygotominor.yy192->initLiteral(val); - objectForTokens = yygotominor.yy192; - } - break; - case 222: /* exprx ::= STRING */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initLiteral(QVariant(yymsp[0].minor.yy0->value)); - objectForTokens = yygotominor.yy192; - } - break; - case 223: /* exprx ::= LP expr RP */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initSubExpr(yymsp[-1].minor.yy192); - objectForTokens = yygotominor.yy192; - } - break; - case 224: /* exprx ::= id */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initId(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy192; - } - break; - case 225: /* exprx ::= JOIN_KW */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initId(yymsp[0].minor.yy0->value); - objectForTokens = yygotominor.yy192; - } - break; - case 226: /* exprx ::= nm DOT nm */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initId(*(yymsp[-2].minor.yy319), *(yymsp[0].minor.yy319)); - delete yymsp[-2].minor.yy319; - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy192; - } - break; - case 227: /* exprx ::= nm DOT nm DOT nm */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initId(*(yymsp[-4].minor.yy319), *(yymsp[-2].minor.yy319), *(yymsp[0].minor.yy319)); - delete yymsp[-4].minor.yy319; - delete yymsp[-2].minor.yy319; - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy192; - } - break; - case 228: /* exprx ::= VARIABLE */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initBindParam(yymsp[0].minor.yy0->value); - objectForTokens = yygotominor.yy192; - } - break; - case 229: /* exprx ::= ID LP exprlist RP */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initFunction(yymsp[-3].minor.yy0->value, false, *(yymsp[-1].minor.yy231)); - delete yymsp[-1].minor.yy231; - objectForTokens = yygotominor.yy192; - } - break; - case 230: /* exprx ::= ID LP STAR RP */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initFunction(yymsp[-3].minor.yy0->value, true); - objectForTokens = yygotominor.yy192; - } - break; - case 231: /* exprx ::= expr AND expr */ - case 232: /* exprx ::= expr OR expr */ yytestcase(yyruleno==232); - case 233: /* exprx ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==233); - case 234: /* exprx ::= expr EQ|NE expr */ yytestcase(yyruleno==234); - case 235: /* exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==235); - case 236: /* exprx ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==236); - case 237: /* exprx ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==237); - case 238: /* exprx ::= expr CONCAT expr */ yytestcase(yyruleno==238); -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initBinOp(yymsp[-2].minor.yy192, yymsp[-1].minor.yy0->value, yymsp[0].minor.yy192); - objectForTokens = yygotominor.yy192; - } - break; - case 239: /* exprx ::= expr not_opt likeop expr */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initLike(yymsp[-3].minor.yy192, *(yymsp[-2].minor.yy291), *(yymsp[-1].minor.yy41), yymsp[0].minor.yy192); - delete yymsp[-2].minor.yy291; - delete yymsp[-1].minor.yy41; - objectForTokens = yygotominor.yy192; - } - break; - case 240: /* exprx ::= expr ISNULL|NOTNULL */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initNull(yymsp[-1].minor.yy192, yymsp[0].minor.yy0->value); - objectForTokens = yygotominor.yy192; - } - break; - case 241: /* exprx ::= expr NOT NULL */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initNull(yymsp[-2].minor.yy192, "NOT NULL"); - objectForTokens = yygotominor.yy192; - } - break; - case 242: /* exprx ::= expr IS not_opt expr */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initIs(yymsp[-3].minor.yy192, *(yymsp[-1].minor.yy291), yymsp[0].minor.yy192); - delete yymsp[-1].minor.yy291; - objectForTokens = yygotominor.yy192; - } - break; - case 243: /* exprx ::= NOT expr */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initUnaryOp(yymsp[0].minor.yy192, yymsp[-1].minor.yy0->value); - } - break; - case 244: /* exprx ::= BITNOT expr */ - case 245: /* exprx ::= MINUS expr */ yytestcase(yyruleno==245); - case 246: /* exprx ::= PLUS expr */ yytestcase(yyruleno==246); -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initUnaryOp(yymsp[0].minor.yy192, yymsp[-1].minor.yy0->value); - objectForTokens = yygotominor.yy192; - } - break; - case 247: /* exprx ::= expr not_opt BETWEEN expr AND expr */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initBetween(yymsp[-5].minor.yy192, *(yymsp[-4].minor.yy291), yymsp[-2].minor.yy192, yymsp[0].minor.yy192); - delete yymsp[-4].minor.yy291; - objectForTokens = yygotominor.yy192; - } - break; - case 248: /* exprx ::= expr not_opt IN LP exprlist RP */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initIn(yymsp[-5].minor.yy192, *(yymsp[-4].minor.yy291), *(yymsp[-1].minor.yy231)); - delete yymsp[-4].minor.yy291; - delete yymsp[-1].minor.yy231; - objectForTokens = yygotominor.yy192; - } - break; - case 249: /* exprx ::= expr not_opt IN LP select RP */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initIn(yymsp[-5].minor.yy192, *(yymsp[-4].minor.yy291), yymsp[-1].minor.yy153); - delete yymsp[-4].minor.yy291; - objectForTokens = yygotominor.yy192; - } - break; - case 250: /* exprx ::= expr not_opt IN nm dbnm */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initIn(yymsp[-4].minor.yy192, *(yymsp[-3].minor.yy291), *(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319)); - delete yymsp[-3].minor.yy291; - delete yymsp[-1].minor.yy319; - objectForTokens = yygotominor.yy192; - } - break; - case 251: /* exprx ::= LP select RP */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initSubSelect(yymsp[-1].minor.yy153); - objectForTokens = yygotominor.yy192; - } - break; - case 252: /* exprx ::= CASE case_operand case_exprlist case_else END */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initCase(yymsp[-3].minor.yy192, *(yymsp[-2].minor.yy231), yymsp[-1].minor.yy192); - delete yymsp[-2].minor.yy231; - objectForTokens = yygotominor.yy192; - } - break; - case 253: /* exprx ::= RAISE LP raisetype COMMA nm RP */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initRaise(yymsp[-3].minor.yy0->value, *(yymsp[-1].minor.yy319)); - delete yymsp[-1].minor.yy319; - objectForTokens = yygotominor.yy192; - } - break; - case 254: /* exprx ::= RAISE LP IGNORE RP */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initRaise(yymsp[-1].minor.yy0->value); - objectForTokens = yygotominor.yy192; - } - break; - case 255: /* exprx ::= nm DOT */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initId(*(yymsp[-1].minor.yy319), QString::null, QString::null); - delete yymsp[-1].minor.yy319; - objectForTokens = yygotominor.yy192; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } - break; - case 256: /* exprx ::= nm DOT nm DOT */ -{ - yygotominor.yy192 = new SqliteExpr(); - yygotominor.yy192->initId(*(yymsp[-3].minor.yy319), *(yymsp[-1].minor.yy319), QString::null); - delete yymsp[-3].minor.yy319; - delete yymsp[-1].minor.yy319; - objectForTokens = yygotominor.yy192; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } - break; - case 257: /* exprx ::= expr not_opt BETWEEN expr AND */ -{ - yygotominor.yy192 = new SqliteExpr(); - delete yymsp[-3].minor.yy291; - delete yymsp[-4].minor.yy192; - delete yymsp[-1].minor.yy192; - objectForTokens = yygotominor.yy192; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } - break; - case 258: /* exprx ::= CASE case_operand case_exprlist case_else */ -{ - yygotominor.yy192 = new SqliteExpr(); - delete yymsp[-1].minor.yy231; - delete yymsp[-2].minor.yy192; - delete yymsp[0].minor.yy192; - objectForTokens = yygotominor.yy192; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } - break; - case 259: /* exprx ::= expr not_opt IN LP exprlist */ -{ - yygotominor.yy192 = new SqliteExpr(); - delete yymsp[-3].minor.yy291; - delete yymsp[0].minor.yy231; - delete yymsp[-4].minor.yy192; - objectForTokens = yygotominor.yy192; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } - break; - case 260: /* exprx ::= expr not_opt IN ID_DB */ -{ yy_destructor(yypParser,177,&yymsp[-3].minor); -} - break; - case 261: /* exprx ::= expr not_opt IN nm DOT ID_TAB */ - case 262: /* exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN */ yytestcase(yyruleno==262); -{ yy_destructor(yypParser,177,&yymsp[-5].minor); - yy_destructor(yypParser,156,&yymsp[-2].minor); -} - break; - case 264: /* exprx ::= nm DOT nm DOT ID_COL */ - case 265: /* exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP */ yytestcase(yyruleno==265); -{ yy_destructor(yypParser,156,&yymsp[-4].minor); - yy_destructor(yypParser,156,&yymsp[-2].minor); -} - break; - case 267: /* expr ::= */ -{ - yygotominor.yy192 = new SqliteExpr(); - objectForTokens = yygotominor.yy192; - parserContext->minorErrorAfterLastToken("Syntax error"); - } - break; - case 270: /* likeop ::= LIKE|GLOB */ -{yygotominor.yy41 = new SqliteExpr::LikeOp(SqliteExpr::likeOp(yymsp[0].minor.yy0->value));} - break; - case 271: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ -{ - yymsp[-4].minor.yy231->append(yymsp[-2].minor.yy192); - yymsp[-4].minor.yy231->append(yymsp[0].minor.yy192); - yygotominor.yy231 = yymsp[-4].minor.yy231; - } - break; - case 272: /* case_exprlist ::= WHEN expr THEN expr */ -{ - yygotominor.yy231 = new ParserExprList(); - yygotominor.yy231->append(yymsp[-2].minor.yy192); - yygotominor.yy231->append(yymsp[0].minor.yy192); - } - break; - case 279: /* nexprlist ::= nexprlist COMMA expr */ -{ - yymsp[-2].minor.yy231->append(yymsp[0].minor.yy192); - yygotominor.yy231 = yymsp[-2].minor.yy231; - DONT_INHERIT_TOKENS("nexprlist"); - } - break; - case 280: /* nexprlist ::= exprx */ -{ - yygotominor.yy231 = new ParserExprList(); - yygotominor.yy231->append(yymsp[0].minor.yy192); - } - break; - case 281: /* cmd ::= CREATE uniqueflag INDEX nm ON nm dbnm LP idxlist RP onconf */ -{ - yygotominor.yy203 = new SqliteCreateIndex( - *(yymsp[-9].minor.yy291), - false, - *(yymsp[-7].minor.yy319), - *(yymsp[-5].minor.yy319), - *(yymsp[-4].minor.yy319), - *(yymsp[-2].minor.yy63), - *(yymsp[0].minor.yy418) - ); - delete yymsp[-9].minor.yy291; - delete yymsp[-7].minor.yy319; - delete yymsp[-5].minor.yy319; - delete yymsp[-4].minor.yy319; - delete yymsp[-2].minor.yy63; - delete yymsp[0].minor.yy418; - objectForTokens = yygotominor.yy203; - } - break; - case 282: /* cmd ::= CREATE uniqueflag INDEX nm dbnm ON ID_TAB */ -{ yy_destructor(yypParser,156,&yymsp[-3].minor); -} - break; - case 287: /* idxlist_opt ::= */ -{yygotominor.yy63 = new ParserIndexedColumnList();} - break; - case 288: /* idxlist_opt ::= LP idxlist RP */ -{yygotominor.yy63 = yymsp[-1].minor.yy63;} - break; - case 289: /* idxlist ::= idxlist COMMA idxlist_single */ -{ - yymsp[-2].minor.yy63->append(yymsp[0].minor.yy428); - yygotominor.yy63 = yymsp[-2].minor.yy63; - DONT_INHERIT_TOKENS("idxlist"); - } - break; - case 290: /* idxlist ::= idxlist_single */ -{ - yygotominor.yy63 = new ParserIndexedColumnList(); - yygotominor.yy63->append(yymsp[0].minor.yy428); - } - break; - case 291: /* idxlist_single ::= nm sortorder */ - case 292: /* idxlist_single ::= ID_COL */ yytestcase(yyruleno==292); -{ - SqliteIndexedColumn* obj = - new SqliteIndexedColumn( - *(yymsp[-1].minor.yy319), - QString::null, - *(yymsp[0].minor.yy389) - ); - yygotominor.yy428 = obj; - delete yymsp[0].minor.yy389; - delete yymsp[-1].minor.yy319; - objectForTokens = yygotominor.yy428; - } - break; - case 293: /* cmd ::= DROP INDEX fullname */ -{ - yygotominor.yy203 = new SqliteDropIndex(false, yymsp[0].minor.yy120->name1, yymsp[0].minor.yy120->name2); - delete yymsp[0].minor.yy120; - objectForTokens = yygotominor.yy203; - } - break; - case 296: /* cmd ::= COPY orconf nm dbnm FROM nm USING DELIMITERS STRING */ -{ - yygotominor.yy203 = new SqliteCopy( - *(yymsp[-7].minor.yy418), - *(yymsp[-6].minor.yy319), - *(yymsp[-5].minor.yy319), - *(yymsp[-3].minor.yy319), - yymsp[0].minor.yy0->value - ); - delete yymsp[-7].minor.yy418; - delete yymsp[-6].minor.yy319; - delete yymsp[-5].minor.yy319; - delete yymsp[-3].minor.yy319; - objectForTokens = yygotominor.yy203; - } - break; - case 297: /* cmd ::= COPY orconf nm dbnm FROM nm */ -{ - yygotominor.yy203 = new SqliteCopy( - *(yymsp[-4].minor.yy418), - *(yymsp[-3].minor.yy319), - *(yymsp[-2].minor.yy319), - *(yymsp[0].minor.yy319) - ); - delete yymsp[-4].minor.yy418; - delete yymsp[-3].minor.yy319; - delete yymsp[-2].minor.yy319; - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy203; - } - break; - case 298: /* cmd ::= VACUUM */ -{ - yygotominor.yy203 = new SqliteVacuum(); - objectForTokens = yygotominor.yy203; - } - break; - case 299: /* cmd ::= VACUUM nm */ -{ - yygotominor.yy203 = new SqliteVacuum(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy203; - } - break; - case 300: /* cmd ::= PRAGMA ids */ -{ - yygotominor.yy203 = new SqlitePragma(*(yymsp[0].minor.yy319), QString::null); - delete yymsp[0].minor.yy319; - objectForTokens = yygotominor.yy203; - } - break; - case 301: /* cmd ::= PRAGMA nm EQ nmnum */ - case 303: /* cmd ::= PRAGMA nm EQ minus_num */ yytestcase(yyruleno==303); -{ - yygotominor.yy203 = new SqlitePragma(*(yymsp[-2].minor.yy319), QString::null, *(yymsp[0].minor.yy69), true); - delete yymsp[-2].minor.yy319; - delete yymsp[0].minor.yy69; - objectForTokens = yygotominor.yy203; - } - break; - case 302: /* cmd ::= PRAGMA nm LP nmnum RP */ - case 304: /* cmd ::= PRAGMA nm LP minus_num RP */ yytestcase(yyruleno==304); -{ - yygotominor.yy203 = new SqlitePragma(*(yymsp[-3].minor.yy319), QString::null, *(yymsp[-1].minor.yy69), false); - delete yymsp[-3].minor.yy319; - delete yymsp[-1].minor.yy69; - objectForTokens = yygotominor.yy203; - } - break; - case 308: /* nmnum ::= nm */ -{ - yygotominor.yy69 = new QVariant(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - } - break; - case 309: /* nmnum ::= ON */ - case 310: /* nmnum ::= DELETE */ yytestcase(yyruleno==310); - case 311: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==311); -{yygotominor.yy69 = new QVariant(yymsp[0].minor.yy0->value);} - break; - case 314: /* minus_num ::= MINUS number */ -{ - if (yymsp[0].minor.yy69->type() == QVariant::Double) - *(yymsp[0].minor.yy69) = -(yymsp[0].minor.yy69->toDouble()); - else if (yymsp[0].minor.yy69->type() == QVariant::LongLong) - *(yymsp[0].minor.yy69) = -(yymsp[0].minor.yy69->toLongLong()); - else - Q_ASSERT_X(true, "producing minus number", "QVariant is neither of Double or LongLong."); - - yygotominor.yy69 = yymsp[0].minor.yy69; - } - break; - case 315: /* number ::= INTEGER */ -{yygotominor.yy69 = new QVariant(QVariant(yymsp[0].minor.yy0->value).toLongLong());} - break; - case 316: /* number ::= FLOAT */ -{yygotominor.yy69 = new QVariant(QVariant(yymsp[0].minor.yy0->value).toDouble());} - break; - case 317: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause BEGIN trigger_cmd_list END */ -{ - yygotominor.yy203 = new SqliteCreateTrigger( - *(yymsp[-12].minor.yy226), - false, - *(yymsp[-10].minor.yy319), - *(yymsp[-6].minor.yy319), - *(yymsp[-5].minor.yy319), - *(yymsp[-9].minor.yy372), - yymsp[-8].minor.yy151, - *(yymsp[-4].minor.yy83), - yymsp[-3].minor.yy192, - *(yymsp[-1].minor.yy270), - 2 - ); - delete yymsp[-12].minor.yy226; - delete yymsp[-9].minor.yy372; - delete yymsp[-4].minor.yy83; - delete yymsp[-6].minor.yy319; - delete yymsp[-10].minor.yy319; - delete yymsp[-5].minor.yy319; - delete yymsp[-1].minor.yy270; - objectForTokens = yygotominor.yy203; - } - break; - case 318: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause */ -{ - QList<SqliteQuery *> CL; - - yygotominor.yy203 = new SqliteCreateTrigger( - *(yymsp[-9].minor.yy226), - false, - *(yymsp[-7].minor.yy319), - *(yymsp[-3].minor.yy319), - *(yymsp[-2].minor.yy319), - *(yymsp[-6].minor.yy372), - yymsp[-5].minor.yy151, - *(yymsp[-1].minor.yy83), - yymsp[0].minor.yy192, - CL, - 2 - ); - delete yymsp[-9].minor.yy226; - delete yymsp[-6].minor.yy372; - delete yymsp[-1].minor.yy83; - delete yymsp[-3].minor.yy319; - delete yymsp[-7].minor.yy319; - delete yymsp[-2].minor.yy319; - objectForTokens = yygotominor.yy203; - parserContext->minorErrorAfterLastToken("Syntax error"); - } - break; - case 319: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause BEGIN trigger_cmd_list */ -{ - yygotominor.yy203 = new SqliteCreateTrigger( - *(yymsp[-11].minor.yy226), - false, - *(yymsp[-9].minor.yy319), - *(yymsp[-5].minor.yy319), - *(yymsp[-4].minor.yy319), - *(yymsp[-8].minor.yy372), - yymsp[-7].minor.yy151, - *(yymsp[-3].minor.yy83), - yymsp[-2].minor.yy192, - *(yymsp[0].minor.yy270), - 2 - ); - delete yymsp[-11].minor.yy226; - delete yymsp[-8].minor.yy372; - delete yymsp[-3].minor.yy83; - delete yymsp[-5].minor.yy319; - delete yymsp[-9].minor.yy319; - delete yymsp[-4].minor.yy319; - delete yymsp[0].minor.yy270; - objectForTokens = yygotominor.yy203; - parserContext->minorErrorAfterLastToken("Syntax error"); - } - break; - case 320: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON ID_TAB|ID_DB */ -{ yy_destructor(yypParser,157,&yymsp[-6].minor); - yy_destructor(yypParser,156,&yymsp[-4].minor); - yy_destructor(yypParser,232,&yymsp[-3].minor); - yy_destructor(yypParser,233,&yymsp[-2].minor); -} - break; - case 321: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm DOT ID_TAB */ -{ yy_destructor(yypParser,157,&yymsp[-8].minor); - yy_destructor(yypParser,156,&yymsp[-6].minor); - yy_destructor(yypParser,232,&yymsp[-5].minor); - yy_destructor(yypParser,233,&yymsp[-4].minor); - yy_destructor(yypParser,156,&yymsp[-2].minor); -} - break; - case 323: /* trigger_time ::= BEFORE */ -{yygotominor.yy372 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);} - break; - case 324: /* trigger_time ::= AFTER */ -{yygotominor.yy372 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);} - break; - case 325: /* trigger_time ::= INSTEAD OF */ -{yygotominor.yy372 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);} - break; - case 326: /* trigger_time ::= */ -{yygotominor.yy372 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);} - break; - case 327: /* trigger_event ::= DELETE */ -{ - yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE); - objectForTokens = yygotominor.yy151; - } - break; - case 328: /* trigger_event ::= INSERT */ -{ - yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::INSERT); - objectForTokens = yygotominor.yy151; - } - break; - case 329: /* trigger_event ::= UPDATE */ -{ - yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::UPDATE); - objectForTokens = yygotominor.yy151; - } - break; - case 330: /* trigger_event ::= UPDATE OF idlist */ -{ - yygotominor.yy151 = new SqliteCreateTrigger::Event(*(yymsp[0].minor.yy95)); - delete yymsp[0].minor.yy95; - objectForTokens = yygotominor.yy151; - } - break; - case 331: /* foreach_clause ::= */ -{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);} - break; - case 332: /* foreach_clause ::= FOR EACH ROW */ -{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);} - break; - case 333: /* foreach_clause ::= FOR EACH STATEMENT */ -{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_STATEMENT);} - break; - case 336: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ -{ - yymsp[-2].minor.yy270->append(yymsp[-1].minor.yy203); - yygotominor.yy270 = yymsp[-2].minor.yy270; - DONT_INHERIT_TOKENS("trigger_cmd_list"); - } - break; - case 337: /* trigger_cmd_list ::= trigger_cmd SEMI */ -{ - yygotominor.yy270 = new ParserQueryList(); - yygotominor.yy270->append(yymsp[-1].minor.yy203); - } - break; - case 342: /* raisetype ::= ROLLBACK|ABORT|FAIL */ -{yygotominor.yy0 = yymsp[0].minor.yy0;} - break; - case 343: /* cmd ::= DROP TRIGGER fullname */ -{ - yygotominor.yy203 = new SqliteDropTrigger(false, yymsp[0].minor.yy120->name1, yymsp[0].minor.yy120->name2); - delete yymsp[0].minor.yy120; - objectForTokens = yygotominor.yy203; - } - break; - case 346: /* cmd ::= ATTACH database_kw_opt ids AS ids key_opt */ -{ - SqliteExpr* e1 = new SqliteExpr(); - SqliteExpr* e2 = new SqliteExpr(); - e1->initLiteral(*(yymsp[-3].minor.yy319)); - e2->initLiteral(*(yymsp[-1].minor.yy319)); - yygotominor.yy203 = new SqliteAttach(*(yymsp[-4].minor.yy291), e1, e2, yymsp[0].minor.yy192); - delete yymsp[-4].minor.yy291; - delete yymsp[-3].minor.yy319; - delete yymsp[-1].minor.yy319; - objectForTokens = yygotominor.yy203; - } - break; - case 348: /* key_opt ::= USING ids */ -{ - SqliteExpr* e = new SqliteExpr(); - e->initLiteral(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - yygotominor.yy192 = e; - } - break; - case 351: /* cmd ::= DETACH database_kw_opt nm */ -{ - SqliteExpr* e = new SqliteExpr(); - e->initLiteral(*(yymsp[0].minor.yy319)); - delete yymsp[0].minor.yy319; - yygotominor.yy203 = new SqliteDetach(*(yymsp[-1].minor.yy291), e); - delete yymsp[-1].minor.yy291; - objectForTokens = yygotominor.yy203; - } - break; - default: - /* (0) input ::= cmdlist */ yytestcase(yyruleno==0); - break; - }; - } - assert( yyruleno>=0 && yyruleno<(int)(sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0])) ); - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - - // Store tokens for the rule in parser context - QList<Token*> allTokens; - QList<Token*> allTokensWithAllInherited; - QString keyForTokensMap; - int tokensMapKeyCnt; - if (parserContext->setupTokens) - { - if (objectForTokens) - { - // In case this is a list with recurrent references we need - // to clear tokens before adding the new and extended list. - objectForTokens->tokens.clear(); - } - - QList<Token*> tokens; - for (int i = yypParser->yyidx - yysize + 1; i <= yypParser->yyidx; i++) - { - tokens.clear(); - const char* fieldName = yyTokenName[yypParser->yystack[i].major]; - - // Adding token being subject of this reduction. It's usually not includes in the inherited tokens, - // although if inheriting from simple statements, like "FAIL" or "ROLLBACK", this tends to be redundant with the inherited tokens. - // That's why we're checking if it's not contained in the inherited tokens and add it only then. - if (parserContext->isManagedToken(yypParser->yystack[i].minor.yy0) && !yypParser->yystack[i].tokens->contains(yypParser->yystack[i].minor.yy0)) - tokens += yypParser->yystack[i].minor.yy0; - - tokens += *(yypParser->yystack[i].tokens); - - if (!noTokenInheritanceFields.contains(fieldName)) - { - if (objectForTokens) - { - keyForTokensMap = fieldName; - tokensMapKeyCnt = 2; - while (objectForTokens->tokensMap.contains(keyForTokensMap)) - keyForTokensMap = fieldName + QString::number(tokensMapKeyCnt++); - - objectForTokens->tokensMap[keyForTokensMap] = parserContext->getTokenPtrList(tokens); - } - - allTokens += tokens; - } - else - { - // If field is mentioned only once, then only one occurance of it will be ignored. - // Second one should be inherited. See "anylist" definition for explanation why. - noTokenInheritanceFields.removeOne(fieldName); - } - allTokensWithAllInherited += tokens; - } - if (objectForTokens) - { - objectForTokens->tokens += parserContext->getTokenPtrList(allTokens); - } - } - - // Clear token lists - for (int i = yypParser->yyidx - yysize + 1; i <= yypParser->yyidx; i++) - { - delete yypParser->yystack[i].tokens; - yypParser->yystack[i].tokens = nullptr; - } - - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); - if( yyact < YYNSTATE ){ -#ifdef NDEBUG - /* If we are not debugging and the reduce action popped at least - ** one element off the stack, then we can push the new element back - ** onto the stack here, and skip the stack overflow test in yy_shift(). - ** That gives a significant speed improvement. */ - if( yysize ){ - yypParser->yyidx++; - yymsp -= yysize-1; - yymsp->stateno = (YYACTIONTYPE)yyact; - yymsp->major = (YYCODETYPE)yygoto; - yymsp->minor = yygotominor; - if (parserContext->setupTokens) - *(yypParser->yystack[yypParser->yyidx].tokens) = allTokens; - }else -#endif - { - yy_shift(yypParser,yyact,yygoto,&yygotominor); - if (parserContext->setupTokens) - { - QList<Token*>* tokensPtr = yypParser->yystack[yypParser->yyidx].tokens; - *tokensPtr = allTokensWithAllInherited + *tokensPtr; - } - } - }else{ - assert( yyact == YYNSTATE + YYNRULE + 1 ); - yy_accept(yypParser); - } -} - -/* -** The following code executes when the parse fails -*/ -#ifndef YYNOERRORRECOVERY -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - sqlite2_parseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - sqlite2_parseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -#endif /* YYNOERRORRECOVERY */ - -/* -** The following code executes when a syntax error first occurs. -*/ -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - sqlite2_parseARG_FETCH; -#define TOKEN (yyminor.yy0) - - UNUSED_PARAMETER(yymajor); - parserContext->error(TOKEN, QObject::tr("Syntax error")); - sqlite2_parseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* -** The following is executed when the parser accepts -*/ -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - sqlite2_parseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - sqlite2_parseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "sqlite2_parseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -** <ul> -** <li> A pointer to the parser (an opaque structure.) -** <li> The major token number. -** <li> The minor token number. -** <li> An option argument of a grammar-specified type. -** </ul> -** -** Outputs: -** None. -*/ -void sqlite2_parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - sqlite2_parseTOKENTYPE yyminor /* The value for the token */ - sqlite2_parseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ -#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) - int yyendofinput; /* True if we are at the end of input */ -#endif -#ifdef YYERRORSYMBOL - int yyerrorhit = 0; /* True if yymajor has invoked an error */ -#endif - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ -#if YYSTACKDEPTH<=0 - if( yypParser->yystksz <=0 ){ - /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/ - yyminorunion = yyzerominor; - yyStackOverflow(yypParser, &yyminorunion); - return; - } -#endif - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - yypParser->yystack[0].tokens = new QList<Token*>(); - } - yyminorunion.yy0 = yyminor; -#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) - yyendofinput = (yymajor==0); -#endif - sqlite2_parseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s [%s] (lemon type: %s)\n", - yyTracePrompt, - yyminor->value.toLatin1().data(), - yyminor->typeString().toLatin1().data(), - yyTokenName[yymajor]); } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); - if( yyact<YYNSTATE ){ - yy_shift(yypParser,yyact,yymajor,&yyminorunion); - yypParser->yyerrcnt--; - yymajor = YYNOCODE; - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else{ - assert( yyact == YY_ERROR_ACTION ); -#ifdef YYERRORSYMBOL - int yymx; -#endif -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_reduce_action( - yypParser->yystack[yypParser->yyidx].stateno, - YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 1; // not 3 valid tokens, but 1 - yyerrorhit = 1; -#elif defined(YYNOERRORRECOVERY) - /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to - ** do any kind of error recovery. Instead, simply invoke the syntax - ** error routine and continue going as if nothing had happened. - ** - ** Applications can set this macro (for example inside %include) if - ** they intend to abandon the parse upon the first syntax error seen. - */ - yy_syntax_error(yypParser,yymajor,yyminorunion); - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 1; // not 3 valid tokens, but 1 - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.h b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.h deleted file mode 100644 index 058d397..0000000 --- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.h +++ /dev/null @@ -1,146 +0,0 @@ -#define TK2_ILLEGAL 1 -#define TK2_COMMENT 2 -#define TK2_SPACE 3 -#define TK2_ID 4 -#define TK2_ABORT 5 -#define TK2_AFTER 6 -#define TK2_ASC 7 -#define TK2_ATTACH 8 -#define TK2_BEFORE 9 -#define TK2_BEGIN 10 -#define TK2_CASCADE 11 -#define TK2_CLUSTER 12 -#define TK2_CONFLICT 13 -#define TK2_COPY 14 -#define TK2_DATABASE 15 -#define TK2_DEFERRED 16 -#define TK2_DELIMITERS 17 -#define TK2_DESC 18 -#define TK2_DETACH 19 -#define TK2_EACH 20 -#define TK2_END 21 -#define TK2_EXPLAIN 22 -#define TK2_FAIL 23 -#define TK2_FOR 24 -#define TK2_GLOB 25 -#define TK2_IGNORE 26 -#define TK2_IMMEDIATE 27 -#define TK2_INITIALLY 28 -#define TK2_INSTEAD 29 -#define TK2_LIKE 30 -#define TK2_MATCH 31 -#define TK2_KEY 32 -#define TK2_OF 33 -#define TK2_OFFSET 34 -#define TK2_PRAGMA 35 -#define TK2_RAISE 36 -#define TK2_REPLACE 37 -#define TK2_RESTRICT 38 -#define TK2_ROW 39 -#define TK2_STATEMENT 40 -#define TK2_TEMP 41 -#define TK2_TRIGGER 42 -#define TK2_VACUUM 43 -#define TK2_VIEW 44 -#define TK2_OR 45 -#define TK2_AND 46 -#define TK2_NOT 47 -#define TK2_EQ 48 -#define TK2_NE 49 -#define TK2_ISNULL 50 -#define TK2_NOTNULL 51 -#define TK2_IS 52 -#define TK2_BETWEEN 53 -#define TK2_IN 54 -#define TK2_GT 55 -#define TK2_GE 56 -#define TK2_LT 57 -#define TK2_LE 58 -#define TK2_BITAND 59 -#define TK2_BITOR 60 -#define TK2_LSHIFT 61 -#define TK2_RSHIFT 62 -#define TK2_PLUS 63 -#define TK2_MINUS 64 -#define TK2_STAR 65 -#define TK2_SLASH 66 -#define TK2_REM 67 -#define TK2_CONCAT 68 -#define TK2_UMINUS 69 -#define TK2_UPLUS 70 -#define TK2_BITNOT 71 -#define TK2_SEMI 72 -#define TK2_TRANSACTION 73 -#define TK2_ID_TRANS 74 -#define TK2_COMMIT 75 -#define TK2_ROLLBACK 76 -#define TK2_CREATE 77 -#define TK2_TABLE 78 -#define TK2_LP 79 -#define TK2_RP 80 -#define TK2_AS 81 -#define TK2_DOT 82 -#define TK2_ID_TAB_NEW 83 -#define TK2_ID_DB 84 -#define TK2_COMMA 85 -#define TK2_ID_COL_NEW 86 -#define TK2_STRING 87 -#define TK2_JOIN_KW 88 -#define TK2_ID_COL_TYPE 89 -#define TK2_DEFAULT 90 -#define TK2_INTEGER 91 -#define TK2_FLOAT 92 -#define TK2_NULL 93 -#define TK2_CONSTRAINT 94 -#define TK2_PRIMARY 95 -#define TK2_UNIQUE 96 -#define TK2_CHECK 97 -#define TK2_REFERENCES 98 -#define TK2_COLLATE 99 -#define TK2_ON 100 -#define TK2_INSERT 101 -#define TK2_DELETE 102 -#define TK2_UPDATE 103 -#define TK2_ID_FK_MATCH 104 -#define TK2_SET 105 -#define TK2_DEFERRABLE 106 -#define TK2_FOREIGN 107 -#define TK2_ID_CONSTR 108 -#define TK2_ID_TAB 109 -#define TK2_DROP 110 -#define TK2_ID_VIEW_NEW 111 -#define TK2_ID_VIEW 112 -#define TK2_UNION 113 -#define TK2_ALL 114 -#define TK2_EXCEPT 115 -#define TK2_INTERSECT 116 -#define TK2_SELECT 117 -#define TK2_DISTINCT 118 -#define TK2_ID_ALIAS 119 -#define TK2_FROM 120 -#define TK2_USING 121 -#define TK2_JOIN 122 -#define TK2_ID_JOIN_OPTS 123 -#define TK2_ORDER 124 -#define TK2_BY 125 -#define TK2_GROUP 126 -#define TK2_HAVING 127 -#define TK2_LIMIT 128 -#define TK2_WHERE 129 -#define TK2_ID_COL 130 -#define TK2_INTO 131 -#define TK2_VALUES 132 -#define TK2_VARIABLE 133 -#define TK2_LIKE_KW 134 -#define TK2_CASE 135 -#define TK2_ID_FN 136 -#define TK2_ID_ERR_MSG 137 -#define TK2_WHEN 138 -#define TK2_THEN 139 -#define TK2_ELSE 140 -#define TK2_INDEX 141 -#define TK2_ID_IDX_NEW 142 -#define TK2_ID_IDX 143 -#define TK2_ID_PRAGMA 144 -#define TK2_ID_TRIG_NEW 145 -#define TK2_ID_TRIG 146 diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.y b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.y deleted file mode 100644 index 621d92e..0000000 --- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.y +++ /dev/null @@ -1,2077 +0,0 @@ -%token_prefix TK2_ -%token_type {Token*} -%default_type {Token*} -%extra_argument {ParserContext* parserContext} -%name sqlite2_parse - -%syntax_error { - UNUSED_PARAMETER(yymajor); - parserContext->error(TOKEN, QObject::tr("Syntax error")); -} - -%stack_overflow { - UNUSED_PARAMETER(yypMinor); - parserContext->error(QObject::tr("Parser stack overflow")); -} - -%include { -#include "token.h" -#include "parsercontext.h" -#include "parser/ast/sqlitealtertable.h" -#include "parser/ast/sqliteanalyze.h" -#include "parser/ast/sqliteattach.h" -#include "parser/ast/sqlitebegintrans.h" -#include "parser/ast/sqlitecommittrans.h" -#include "parser/ast/sqlitecopy.h" -#include "parser/ast/sqlitecreateindex.h" -#include "parser/ast/sqlitecreatetable.h" -#include "parser/ast/sqlitecreatetrigger.h" -#include "parser/ast/sqlitecreateview.h" -#include "parser/ast/sqlitecreatevirtualtable.h" -#include "parser/ast/sqlitedelete.h" -#include "parser/ast/sqlitedetach.h" -#include "parser/ast/sqlitedropindex.h" -#include "parser/ast/sqlitedroptable.h" -#include "parser/ast/sqlitedroptrigger.h" -#include "parser/ast/sqlitedropview.h" -#include "parser/ast/sqliteemptyquery.h" -#include "parser/ast/sqliteinsert.h" -#include "parser/ast/sqlitepragma.h" -#include "parser/ast/sqlitereindex.h" -#include "parser/ast/sqliterelease.h" -#include "parser/ast/sqliterollback.h" -#include "parser/ast/sqlitesavepoint.h" -#include "parser/ast/sqliteselect.h" -#include "parser/ast/sqliteupdate.h" -#include "parser/ast/sqlitevacuum.h" -#include "parser/ast/sqliteexpr.h" -#include "parser/ast/sqlitecolumntype.h" -#include "parser/ast/sqliteconflictalgo.h" -#include "parser/ast/sqlitesortorder.h" -#include "parser/ast/sqliteindexedcolumn.h" -#include "parser/ast/sqliteforeignkey.h" -#include "parser_helper_stubs.h" -#include "common/utils_sql.h" -#include <QObject> -#include <QDebug> - -#define assert(X) Q_ASSERT(X) -#define UNUSED_PARAMETER(X) (void)(X) -#define DONT_INHERIT_TOKENS(X) noTokenInheritanceFields << X -} - -// These are extra tokens used by the lexer but never seen by the -// parser. We put them in a rule so that the parser generator will -// add them to the parse.h output file. - -%nonassoc ILLEGAL COMMENT SPACE. - -// The following directive causes tokens ABORT, AFTER, ASC, etc. to -// fallback to ID if they will not parse as their original value. -// This obviates the need for the "id" nonterminal. - -%fallback ID - ABORT AFTER ASC ATTACH BEFORE BEGIN CASCADE CLUSTER CONFLICT - COPY DATABASE DEFERRED DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR - GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY - OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW STATEMENT - TEMP TRIGGER VACUUM VIEW. - -// Define operator precedence early so that this is the first occurance -// of the operator tokens in the grammer. Keeping the operators together -// causes them to be assigned integer values that are close together, -// which keeps parser tables smaller. - -%left OR. -%left AND. -%right NOT. -%left EQ NE ISNULL NOTNULL IS LIKE GLOB BETWEEN IN. -%left GT GE LT LE. -%left BITAND BITOR LSHIFT RSHIFT. -%left PLUS MINUS. -%left STAR SLASH REM. -%left CONCAT. -%right UMINUS UPLUS BITNOT. - -// Input is a single SQL command -%type cmd {SqliteQuery*} -%destructor cmd {delete $$;} - -input ::= cmdlist. - -cmdlist ::= cmdlist ecmd(C). {parserContext->addQuery(C); DONT_INHERIT_TOKENS("cmdlist");} -cmdlist ::= ecmd(C). {parserContext->addQuery(C);} - -%type ecmd {SqliteQuery*} -%destructor ecmd {delete $$;} -ecmd(X) ::= SEMI. {X = new SqliteEmptyQuery();} -ecmd(X) ::= explain(E) cmdx(C) SEMI. { - X = C; - X->explain = E->explain; - X->queryPlan = E->queryPlan; - delete E; - objectForTokens = X; - } - -%type explain {ParserStubExplain*} -%destructor explain {delete $$;} -explain(X) ::= . {X = new ParserStubExplain(false, false);} -explain(X) ::= EXPLAIN. {X = new ParserStubExplain(true, false);} - -%type cmdx {SqliteQuery*} -%destructor cmdx {delete $$;} -cmdx(X) ::= cmd(C). {X = C;} - -///////////////////// Begin and end transactions. //////////////////////////// - -cmd(X) ::= BEGIN trans_opt(TO) onconf(C). { - X = new SqliteBeginTrans( - TO->transactionKw, - TO->name, - *(C) - ); - delete TO; - delete C; - objectForTokens = X; - } - -%type trans_opt {ParserStubTransDetails*} -%destructor trans_opt {delete $$;} -trans_opt(X) ::= . {X = new ParserStubTransDetails();} -trans_opt(X) ::= TRANSACTION. { - X = new ParserStubTransDetails(); - X->transactionKw = true; - } -trans_opt(X) ::= TRANSACTION nm(N). { - X = new ParserStubTransDetails(); - X->transactionKw = true; - X->name = *(N); - delete N; - } -trans_opt ::= TRANSACTION ID_TRANS. {} - -cmd(X) ::= COMMIT trans_opt(T). { - X = new SqliteCommitTrans( - T->transactionKw, - T->name, - false - ); - delete T; - objectForTokens = X; - } -cmd(X) ::= END trans_opt(T). { - X = new SqliteCommitTrans( - T->transactionKw, - T->name, - true - ); - delete T; - objectForTokens = X; - } -cmd(X) ::= ROLLBACK trans_opt(T). { - X = new SqliteRollback( - T->transactionKw, - T->name - ); - delete T; - objectForTokens = X; - } - -///////////////////// The CREATE TABLE statement //////////////////////////// - -cmd(X) ::= CREATE temp(T) TABLE - fullname(N) - LP columnlist(CL) - conslist_opt(CS) RP. { - X = new SqliteCreateTable( - false, - *(T), - N->name1, - N->name2, - *(CL), - *(CS) - ); - delete T; - delete CL; - delete CS; - delete N; - objectForTokens = X; - } -cmd(X) ::= CREATE temp(T) TABLE - fullname(N) - AS select(S). { - X = new SqliteCreateTable( - false, - *(T), - N->name1, - N->name2, - S - ); - delete T; - delete N; - objectForTokens = X; - } -cmd ::= CREATE temp TABLE - nm DOT ID_TAB_NEW. {} -cmd ::= CREATE temp TABLE - ID_DB|ID_TAB_NEW. {} - -%type temp {int*} -%destructor temp {delete $$;} -temp(X) ::= TEMP(T). {X = new int( (T->value.length() > 4) ? 2 : 1 );} -temp(X) ::= . {X = new int(0);} - -%type columnlist {ParserCreateTableColumnList*} -%destructor columnlist {delete $$;} -columnlist(X) ::= columnlist(L) - COMMA column(C). { - L->append(C); - X = L; - DONT_INHERIT_TOKENS("columnlist"); - } -columnlist(X) ::= column(C). { - X = new ParserCreateTableColumnList(); - X->append(C); - } - -%type column {SqliteCreateTable::Column*} -%destructor column {delete $$;} -column(X) ::= columnid(C) type(T) - carglist(L). { - X = new SqliteCreateTable::Column(*(C), T, *(L)); - delete C; - delete L; - objectForTokens = X; - } - -%type columnid {QString*} -%destructor columnid {delete $$;} -columnid(X) ::= nm(N). {X = N;} -columnid ::= ID_COL_NEW. {} - -// An IDENTIFIER can be a generic identifier, or one of several -// keywords. Any non-standard keyword can also be an identifier. - -%type id {QString*} -%destructor id {delete $$;} -id(X) ::= ID(T). { - X = new QString( - stripObjName( - T->value, - parserContext->dialect - ) - ); - } - -// And "ids" is an identifer-or-string. - -%type ids {QString*} -%destructor ids {delete $$;} -ids(X) ::= ID|STRING(T). {X = new QString(T->value);} - -// The name of a column or table can be any of the following: - -%type nm {QString*} -%destructor nm {delete $$;} -nm(X) ::= id(N). {X = N;} -nm(X) ::= STRING(N). {X = new QString(stripString(N->value));} -nm(X) ::= JOIN_KW(N). {X = new QString(N->value);} - -%type type {SqliteColumnType*} -%destructor type {delete $$;} -type(X) ::= . {X = nullptr;} -type(X) ::= typetoken(T). {X = T;} - -%type typetoken {SqliteColumnType*} -%destructor typetoken {delete $$;} -typetoken(X) ::= typename(N). { - X = new SqliteColumnType(*(N)); - delete N; - objectForTokens = X; - } -typetoken(X) ::= typename(N) - LP signed(P) RP. { - X = new SqliteColumnType(*(N), *(P)); - delete N; - delete P; - objectForTokens = X; - } -typetoken(X) ::= typename(N) LP signed(P) - COMMA signed(S) RP. { - X = new SqliteColumnType(*(N), *(P), *(S)); - delete N; - delete P; - delete S; - objectForTokens = X; - } - -%type typename {QString*} -%destructor typename {delete $$;} -typename(X) ::= ids(I). {X = I;} -typename(X) ::= typename(T) ids(I). { - T->append(" " + *(I)); - delete I; - X = T; - } -typename ::= ID_COL_TYPE. {} - -%type signed {QVariant*} -%destructor signed {delete $$;} -signed(X) ::= plus_num(N). {X = N;} -signed(X) ::= minus_num(N). {X = N;} - -%type carglist {ParserCreateTableColumnConstraintList*} -%destructor carglist {delete $$;} -carglist(X) ::= carglist(L) ccons(C). { - L->append(C); - X = L; - DONT_INHERIT_TOKENS("carglist"); - } -carglist(X) ::= carglist(L) ccons_nm(N) - ccons(C). { - L->append(N); - L->append(C); - X = L; - DONT_INHERIT_TOKENS("carglist"); - } -carglist(X) ::= carglist(L) carg(C). { - L->append(C); - X = L; - DONT_INHERIT_TOKENS("carglist"); - } -carglist(X) ::= . {X = new ParserCreateTableColumnConstraintList();} - -%type carg {SqliteCreateTable::Column::Constraint*} -%destructor carg {delete $$;} -carg(X) ::= DEFAULT STRING(S). { - X = new SqliteCreateTable::Column::Constraint(); - X->initDefId(stripObjName( - S->value, - parserContext->dialect - )); - objectForTokens = X; - } -carg(X) ::= DEFAULT ID(I). { - X = new SqliteCreateTable::Column::Constraint(); - X->initDefId(stripObjName( - I->value, - parserContext->dialect - )); - objectForTokens = X; - - } -carg(X) ::= DEFAULT INTEGER(I). { - X = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(I->value).toLongLong(); - X->initDefTerm(val, false); - objectForTokens = X; - } -carg(X) ::= DEFAULT PLUS INTEGER(I). { - X = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(I->value).toLongLong(); - X->initDefTerm(val, false); - objectForTokens = X; - } -carg(X) ::= DEFAULT MINUS INTEGER(I). { - X = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(I->value).toLongLong(); - X->initDefTerm(val, true); - objectForTokens = X; - } -carg(X) ::= DEFAULT FLOAT(F). { - X = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(F->value).toDouble(); - X->initDefTerm(val, false); - objectForTokens = X; - } -carg(X) ::= DEFAULT PLUS FLOAT(F). { - X = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(F->value).toDouble(); - X->initDefTerm(val, false); - objectForTokens = X; - } -carg(X) ::= DEFAULT MINUS FLOAT(F). { - X = new SqliteCreateTable::Column::Constraint(); - QVariant val = QVariant(F->value).toDouble(); - X->initDefTerm(val, true); - objectForTokens = X; - } -carg(X) ::= DEFAULT NULL. { - X = new SqliteCreateTable::Column::Constraint(); - X->initDefTerm(QVariant(), false); - objectForTokens = X; - } - -// In addition to the type name, we also care about the primary key and -// UNIQUE constraints. - -%type ccons_nm {SqliteCreateTable::Column::Constraint*} -%destructor ccons_nm {delete $$;} -ccons_nm(X) ::= CONSTRAINT nm(N). { - X = new SqliteCreateTable::Column::Constraint(); - X->initDefNameOnly(*(N)); - delete N; - objectForTokens = X; - } - -%type ccons {SqliteCreateTable::Column::Constraint*} -%destructor ccons {delete $$;} -ccons(X) ::= NULL onconf(C). { - X = new SqliteCreateTable::Column::Constraint(); - X->initNull(*(C)); - delete C; - objectForTokens = X; - } -ccons(X) ::= NOT NULL onconf(C). { - X = new SqliteCreateTable::Column::Constraint(); - X->initNotNull(*(C)); - delete C; - objectForTokens = X; - } -ccons(X) ::= PRIMARY KEY sortorder(O) - onconf(C). { - X = new SqliteCreateTable::Column::Constraint(); - X->initPk(*(O), *(C), false); - delete O; - delete C; - objectForTokens = X; - } -ccons(X) ::= UNIQUE onconf(C). { - X = new SqliteCreateTable::Column::Constraint(); - X->initUnique(*(C)); - delete C; - objectForTokens = X; - } -ccons(X) ::= CHECK LP expr(E) RP onconf(C). { - X = new SqliteCreateTable::Column::Constraint(); - X->initCheck(E, *(C)); - delete C; - objectForTokens = X; - } -ccons(X) ::= REFERENCES nm(N) - idxlist_opt(I) refargs(A). { - X = new SqliteCreateTable::Column::Constraint(); - X->initFk(*(N), *(I), *(A)); - delete N; - delete A; - delete I; - objectForTokens = X; - } -ccons(X) ::= defer_subclause(D). { - X = new SqliteCreateTable::Column::Constraint(); - X->initDefer(D->initially, D->deferrable); - delete D; - objectForTokens = X; - } -ccons(X) ::= COLLATE id(I). { - X = new SqliteCreateTable::Column::Constraint(); - X->initColl(*(I)); - delete I; - objectForTokens = X; - } -ccons(X) ::= CHECK LP RP. { - X = new SqliteCreateTable::Column::Constraint(); - X->initCheck(); - objectForTokens = X; - parserContext->minorErrorAfterLastToken("Syntax error"); - } - -// The next group of rules parses the arguments to a REFERENCES clause -// that determine if the referential integrity checking is deferred or -// or immediate and which determine what action to take if a ref-integ -// check fails. - -%type refargs {ParserFkConditionList*} -%destructor refargs {delete $$;} -refargs(X) ::= . {X = new ParserFkConditionList();} -refargs(X) ::= refargs(L) refarg(A). { - L->append(A); - X = L; - DONT_INHERIT_TOKENS("refargs"); - } - -%type refarg {SqliteForeignKey::Condition*} -%destructor refarg {delete $$;} -refarg(X) ::= MATCH nm(N). { - X = new SqliteForeignKey::Condition(*(N)); - delete N; - } -refarg(X) ::= ON INSERT refact(R). {X = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::INSERT, *(R)); delete R;} -refarg(X) ::= ON DELETE refact(R). {X = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::DELETE, *(R)); delete R;} -refarg(X) ::= ON UPDATE refact(R). {X = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::UPDATE, *(R)); delete R;} -refarg ::= MATCH ID_FK_MATCH. {} - -%type refact {SqliteForeignKey::Condition::Reaction*} -%destructor refact {delete $$;} -refact(X) ::= SET NULL. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_NULL);} -refact(X) ::= SET DEFAULT. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_DEFAULT);} -refact(X) ::= CASCADE. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::CASCADE);} -refact(X) ::= RESTRICT. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::RESTRICT);} - -%type defer_subclause {ParserDeferSubClause*} -%destructor defer_subclause {delete $$;} -defer_subclause(X) ::= NOT DEFERRABLE - init_deferred_pred_opt(I). { - X = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(I)); - delete I; - } -defer_subclause(X) ::= DEFERRABLE - init_deferred_pred_opt(I). { - X = new ParserDeferSubClause(SqliteDeferrable::DEFERRABLE, *(I)); - delete I; - } - -%type init_deferred_pred_opt {SqliteInitially*} -%destructor init_deferred_pred_opt {delete $$;} -init_deferred_pred_opt(X) ::= . {X = new SqliteInitially(SqliteInitially::null);} -init_deferred_pred_opt(X) ::= INITIALLY - DEFERRED. {X = new SqliteInitially(SqliteInitially::DEFERRED);} -init_deferred_pred_opt(X) ::= INITIALLY - IMMEDIATE. {X = new SqliteInitially(SqliteInitially::IMMEDIATE);} - - -%type conslist_opt {ParserCreateTableConstraintList*} -%destructor conslist_opt {delete $$;} -conslist_opt(X) ::= . {X = new ParserCreateTableConstraintList();} -conslist_opt(X) ::= COMMA conslist(L). {X = L;} - -%type conslist {ParserCreateTableConstraintList*} -%destructor conslist {delete $$;} -conslist(X) ::= conslist(L) tconscomma(CM) - tcons(C). { - C->afterComma = *(CM); - L->append(C); - X = L; - delete CM; - DONT_INHERIT_TOKENS("conslist"); - } -conslist(X) ::= tcons(C). { - X = new ParserCreateTableConstraintList(); - X->append(C); - } - -%type tconscomma {bool*} -%destructor tconscomma {delete $$;} -tconscomma(X) ::= COMMA. {X = new bool(true);} -tconscomma(X) ::= . {X = new bool(false);} - -%type tcons {SqliteCreateTable::Constraint*} -%destructor tcons {delete $$;} -tcons(X) ::= CONSTRAINT nm(N). { - X = new SqliteCreateTable::Constraint(); - X->initNameOnly(*(N)); - delete N; - objectForTokens = X; - } -tcons(X) ::= PRIMARY KEY LP idxlist(L) - RP onconf(C). { - X = new SqliteCreateTable::Constraint(); - X->initPk(*(L), false, *(C)); - delete C; - delete L; - objectForTokens = X; - } -tcons(X) ::= UNIQUE LP idxlist(L) RP - onconf(C). { - X = new SqliteCreateTable::Constraint(); - X->initUnique(*(L), *(C)); - delete C; - delete L; - objectForTokens = X; - } -tcons(X) ::= CHECK LP expr(E) RP onconf(C). { - X = new SqliteCreateTable::Constraint(); - X->initCheck(E, *(C)); - objectForTokens = X; - } -tcons(X) ::= FOREIGN KEY LP idxlist(L) RP - REFERENCES nm(N) idxlist_opt(IL) - refargs(R) defer_subclause_opt(D). { - X = new SqliteCreateTable::Constraint(); - X->initFk( - *(L), - *(N), - *(IL), - *(R), - D->initially, - D->deferrable - ); - delete N; - delete R; - delete D; - delete IL; - delete L; - objectForTokens = X; - } - -tcons ::= CONSTRAINT ID_CONSTR. {} -tcons ::= FOREIGN KEY LP idxlist RP - REFERENCES ID_TAB. {} -tcons(X) ::= CHECK LP RP onconf. { - X = new SqliteCreateTable::Constraint(); - X->initCheck(); - objectForTokens = X; - parserContext->minorErrorAfterLastToken("Syntax error"); - } - -%type defer_subclause_opt {ParserDeferSubClause*} -%destructor defer_subclause_opt {delete $$;} -defer_subclause_opt(X) ::= . {X = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);} -defer_subclause_opt(X) ::= - defer_subclause(D). {X = D;} - -// The following is a non-standard extension that allows us to declare the -// default behavior when there is a constraint conflict. -%type onconf {SqliteConflictAlgo*} -%destructor onconf {delete $$;} -onconf(X) ::= . {X = new SqliteConflictAlgo(SqliteConflictAlgo::null);} -onconf(X) ::= ON CONFLICT resolvetype(R). {X = R;} - -%type orconf {SqliteConflictAlgo*} -%destructor orconf {delete $$;} -orconf(X) ::= . {X = new SqliteConflictAlgo(SqliteConflictAlgo::null);} -orconf(X) ::= OR resolvetype(R). {X = R;} - -%type resolvetype {SqliteConflictAlgo*} -%destructor resolvetype {delete $$;} -resolvetype(X) ::= ROLLBACK(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));} -resolvetype(X) ::= ABORT(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));} -resolvetype(X) ::= FAIL(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));} -resolvetype(X) ::= IGNORE(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));} -resolvetype(X) ::= REPLACE(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));} - -////////////////////////// The DROP TABLE ///////////////////////////////////// - -cmd(X) ::= DROP TABLE fullname(N). { - X = new SqliteDropTable(false, N->name1, N->name2); - delete N; - objectForTokens = X; - } - -cmd ::= DROP TABLE nm DOT - ID_TAB. {} -cmd ::= DROP TABLE ID_DB|ID_TAB. {} - -///////////////////// The CREATE VIEW statement ///////////////////////////// - -cmd(X) ::= CREATE temp(T) VIEW - nm(N) - AS select(S). { - X = new SqliteCreateView(*(T), false, *(N), QString::null, S); - delete T; - delete N; - objectForTokens = X; - } - -cmd ::= CREATE temp VIEW ID_VIEW_NEW. {} - -cmd(X) ::= DROP VIEW nm(N). { - X = new SqliteDropView(false, *(N), QString::null); - delete N; - objectForTokens = X; - } - -cmd ::= DROP VIEW ID_VIEW. {} - -//////////////////////// The SELECT statement ///////////////////////////////// - -cmd(X) ::= select_stmt(S). { - X = S; - objectForTokens = X; - } - -%type select_stmt {SqliteQuery*} -%destructor select_stmt {delete $$;} -select_stmt(X) ::= select(S). { - X = S; - // since it's used in trigger: - objectForTokens = X; - } - -%type select {SqliteSelect*} -%destructor select {delete $$;} -select(X) ::= oneselect(S). { - X = SqliteSelect::append(S); - objectForTokens = X; - } -select(X) ::= select(S1) multiselect_op(O) - oneselect(S2). { - X = SqliteSelect::append(S1, *(O), S2); - delete O; - objectForTokens = X; - } - -%type multiselect_op {SqliteSelect::CompoundOperator*} -%destructor multiselect_op {delete $$;} -multiselect_op(X) ::= UNION. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);} -multiselect_op(X) ::= UNION ALL. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);} -multiselect_op(X) ::= EXCEPT. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);} -multiselect_op(X) ::= INTERSECT. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);} - -%type oneselect {SqliteSelect::Core*} -%destructor oneselect {delete $$;} -oneselect(X) ::= SELECT distinct(D) - selcollist(L) from(F) - where_opt(W) groupby_opt(G) - having_opt(H) - orderby_opt(O) - limit_opt(LI). { - X = new SqliteSelect::Core( - *(D), - *(L), - F, - W, - *(G), - H, - *(O), - LI - ); - delete L; - delete D; - delete G; - delete O; - objectForTokens = X; - } - -%type distinct {int*} -%destructor distinct {delete $$;} -distinct(X) ::= DISTINCT. {X = new int(1);} -distinct(X) ::= ALL. {X = new int(2);} -distinct(X) ::= . {X = new int(0);} - -// selcollist is a list of expressions that are to become the return -// values of the SELECT statement. The "*" in statements like -// "SELECT * FROM ..." is encoded as a special expression with an -// opcode of TK_ALL. - -%type sclp {ParserResultColumnList*} -%destructor sclp {delete $$;} -sclp(X) ::= selcollist(L) COMMA. {X = L;} -sclp(X) ::= . {X = new ParserResultColumnList();} - -%type selcollist {ParserResultColumnList*} -%destructor selcollist {delete $$;} -selcollist(X) ::= sclp(L) expr(E) as(N). { - SqliteSelect::Core::ResultColumn* obj = - new SqliteSelect::Core::ResultColumn( - E, - N ? N->asKw : false, - N ? N->name : QString::null - ); - - L->append(obj); - X = L; - delete N; - objectForTokens = obj; - DONT_INHERIT_TOKENS("sclp"); - } -selcollist(X) ::= sclp(L) STAR. { - SqliteSelect::Core::ResultColumn* obj = - new SqliteSelect::Core::ResultColumn(true); - - L->append(obj); - X = L; - objectForTokens = obj; - DONT_INHERIT_TOKENS("sclp"); - } -selcollist(X) ::= sclp(L) nm(N) DOT STAR. { - SqliteSelect::Core::ResultColumn* obj = - new SqliteSelect::Core::ResultColumn( - true, - *(N) - ); - L->append(obj); - X = L; - delete N; - objectForTokens = obj; - DONT_INHERIT_TOKENS("sclp"); - } -selcollist(X) ::= sclp(L). { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = L; - } -selcollist ::= sclp ID_TAB DOT STAR. {} - -// An option "AS <id>" phrase that can follow one of the expressions that -// define the result set, or one of the tables in the FROM clause. - -%type as {ParserStubAlias*} -%destructor as {delete $$;} -as(X) ::= AS nm(N). { - X = new ParserStubAlias(*(N), true); - delete N; - } -as(X) ::= ids(N). { - X = new ParserStubAlias(*(N), false); - delete N; - } -as ::= AS ID_ALIAS. {} -as ::= ID_ALIAS. {} -as(X) ::= . {X = nullptr;} - -// A complete FROM clause. -%type from {SqliteSelect::Core::JoinSource*} -%destructor from {delete $$;} -from(X) ::= . {X = nullptr;} -from(X) ::= FROM joinsrc(L). {X = L;} - -%type joinsrc {SqliteSelect::Core::JoinSource*} -%destructor joinsrc {delete $$;} -joinsrc(X) ::= singlesrc(S) seltablist(L). { - X = new SqliteSelect::Core::JoinSource( - S, - *(L) - ); - delete L; - objectForTokens = X; - } -joinsrc(X) ::= . { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new SqliteSelect::Core::JoinSource(); - objectForTokens = X; - } - -%type seltablist {ParserOtherSourceList*} -%destructor seltablist {delete $$;} -seltablist(X) ::= seltablist(L) joinop(O) - singlesrc(S) - joinconstr_opt(C). { - SqliteSelect::Core::JoinSourceOther* src = - new SqliteSelect::Core::JoinSourceOther(O, S, C); - - L->append(src); - X = L; - objectForTokens = src; - DONT_INHERIT_TOKENS("seltablist"); - } -seltablist(X) ::= . { - X = new ParserOtherSourceList(); - } - -%type singlesrc {SqliteSelect::Core::SingleSource*} -%destructor singlesrc {delete $$;} -singlesrc(X) ::= nm(N1) dbnm(N2) as(A). { - X = new SqliteSelect::Core::SingleSource( - *(N1), - *(N2), - A ? A->asKw : false, - A ? A->name : QString::null, - false, - QString::null - ); - delete N1; - delete N2; - delete A; - objectForTokens = X; - } -singlesrc(X) ::= LP select(S) RP as(A). { - X = new SqliteSelect::Core::SingleSource( - S, - A ? A->asKw : false, - A ? A->name : QString::null - ); - delete A; - objectForTokens = X; - } -singlesrc(X) ::= LP joinsrc(J) RP as(A). { - X = new SqliteSelect::Core::SingleSource( - J, - A ? A->asKw : false, - A ? A->name : QString::null - ); - delete A; - objectForTokens = X; - } -singlesrc(X) ::= . { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new SqliteSelect::Core::SingleSource(); - objectForTokens = X; - } -singlesrc(X) ::= nm(N) DOT. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new SqliteSelect::Core::SingleSource(); - X->database = *(N); - delete N; - objectForTokens = X; - } - -singlesrc ::= nm DOT ID_TAB. {} -singlesrc ::= ID_DB|ID_TAB. {} -singlesrc ::= nm DOT ID_VIEW. {} -singlesrc ::= ID_DB|ID_VIEW. {} - -%type joinconstr_opt {SqliteSelect::Core::JoinConstraint*} -%destructor joinconstr_opt {delete $$;} -joinconstr_opt(X) ::= ON expr(E). { - X = new SqliteSelect::Core::JoinConstraint(E); - objectForTokens = X; - } -joinconstr_opt(X) ::= USING LP - idlist(L) RP. { - X = new SqliteSelect::Core::JoinConstraint(*(L)); - delete L; - objectForTokens = X; - } -joinconstr_opt(X) ::= . {X = nullptr;} - -%type dbnm {QString*} -%destructor dbnm {delete $$;} -dbnm(X) ::= . {X = new QString();} -dbnm(X) ::= DOT nm(N). {X = N;} - -%type fullname {ParserFullName*} -%destructor fullname {delete $$;} -fullname(X) ::= nm(N1) dbnm(N2). { - X = new ParserFullName(); - X->name1 = *(N1); - X->name2 = *(N2); - delete N1; - delete N2; - } - -%type joinop {SqliteSelect::Core::JoinOp*} -%destructor joinop {delete $$;} -joinop(X) ::= COMMA. { - X = new SqliteSelect::Core::JoinOp(true); - objectForTokens = X; - } -joinop(X) ::= JOIN. { - X = new SqliteSelect::Core::JoinOp(false); - objectForTokens = X; - } -joinop(X) ::= JOIN_KW(K) JOIN. { - X = new SqliteSelect::Core::JoinOp(K->value); - objectForTokens = X; - } -joinop(X) ::= JOIN_KW(K) nm(N) JOIN. { - X = new SqliteSelect::Core::JoinOp(K->value, *(N)); - delete N; - objectForTokens = X; - } -joinop(X) ::= JOIN_KW(K) nm(N1) nm(N2) - JOIN. { - X = new SqliteSelect::Core::JoinOp(K->value, *(N1), *(N2)); - delete N1; - delete N1; - objectForTokens = X; - } - -joinop ::= ID_JOIN_OPTS. {} - -%type orderby_opt {ParserOrderByList*} -%destructor orderby_opt {delete $$;} -orderby_opt(X) ::= . {X = new ParserOrderByList();} -orderby_opt(X) ::= ORDER BY sortlist(L). {X = L;} - -%type sortlist {ParserOrderByList*} -%destructor sortlist {delete $$;} -sortlist(X) ::= sortlist(L) COMMA - collate(C) - expr(E) sortorder(O). { - SqliteOrderBy* obj; - if (C) - { - SqliteExpr* coll = new SqliteExpr(); - coll->initCollate(E, *(C)); - delete C; - obj = new SqliteOrderBy(coll, *(O)); - } - else - { - obj = new SqliteOrderBy(E, *(O)); - } - L->append(obj); - X = L; - delete O; - objectForTokens = obj; - DONT_INHERIT_TOKENS("sortlist"); - } -sortlist(X) ::= expr(E) collate(C) - sortorder(O). { - SqliteOrderBy* obj; - if (C) - { - SqliteExpr* coll = new SqliteExpr(); - coll->initCollate(E, *(C)); - delete C; - obj = new SqliteOrderBy(coll, *(O)); - } - else - { - obj = new SqliteOrderBy(E, *(O)); - } - X = new ParserOrderByList(); - X->append(obj); - delete O; - objectForTokens = obj; - } - -%type collate {QString*} -%destructor collate {if ($$) delete $$;} -collate(X) ::= . {X = nullptr;} -collate(X) ::= COLLATE id(I). {X = I;} - -%type sortorder {SqliteSortOrder*} -%destructor sortorder {delete $$;} -sortorder(X) ::= ASC. {X = new SqliteSortOrder(SqliteSortOrder::ASC);} -sortorder(X) ::= DESC. {X = new SqliteSortOrder(SqliteSortOrder::DESC);} -sortorder(X) ::= . {X = new SqliteSortOrder(SqliteSortOrder::null);} - -%type groupby_opt {ParserExprList*} -%destructor groupby_opt {delete $$;} -groupby_opt(X) ::= . {X = new ParserExprList();} -groupby_opt(X) ::= GROUP BY nexprlist(L). {X = L;} -groupby_opt(X) ::= GROUP BY. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new ParserExprList(); - } -%type having_opt {SqliteExpr*} -%destructor having_opt {delete $$;} -having_opt(X) ::= . {X = nullptr;} -having_opt(X) ::= HAVING expr(E). {X = E;} - -%type limit_opt {SqliteLimit*} -%destructor limit_opt {delete $$;} -limit_opt(X) ::= . {X = nullptr;} -limit_opt(X) ::= LIMIT signed(V). { - X = new SqliteLimit(*(V)); - delete V; - objectForTokens = X; - } -limit_opt(X) ::= LIMIT signed(V1) OFFSET - signed(V2). { - SqliteExpr* expr1 = new SqliteExpr(); - expr1->initLiteral(*(V1)); - expr1->setParent(X); - - SqliteExpr* expr2 = new SqliteExpr(); - expr1->initLiteral(*(V2)); - expr1->setParent(X); - - X = new SqliteLimit(expr1, expr2, true); - - TokenPtr limitToken = TokenPtr::create(Token::INTEGER, V1->toString()); - parserContext->addManagedToken(limitToken); - expr1->tokens << limitToken; - expr1->tokensMap["term"] << limitToken; - - TokenPtr offsetToken = TokenPtr::create(Token::INTEGER, V2->toString()); - parserContext->addManagedToken(offsetToken); - expr2->tokens << offsetToken; - expr2->tokensMap["term"] << offsetToken; - - delete V1; - delete V2; - objectForTokens = X; - } -limit_opt(X) ::= LIMIT signed(V1) COMMA - signed(V2). { - SqliteExpr* expr1 = new SqliteExpr(); - expr1->initLiteral(*(V1)); - expr1->setParent(X); - - SqliteExpr* expr2 = new SqliteExpr(); - expr1->initLiteral(*(V2)); - expr1->setParent(X); - - X = new SqliteLimit(expr1, expr2, false); - - TokenPtr limitToken = TokenPtr::create(Token::INTEGER, V1->toString()); - parserContext->addManagedToken(limitToken); - expr1->tokens << limitToken; - expr1->tokensMap["term"] << limitToken; - - TokenPtr offsetToken = TokenPtr::create(Token::INTEGER, V2->toString()); - parserContext->addManagedToken(offsetToken); - expr2->tokens << offsetToken; - expr2->tokensMap["term"] << offsetToken; - - delete V1; - delete V2; - objectForTokens = X; - } - -/////////////////////////// The DELETE statement ///////////////////////////// - -cmd(X) ::= delete_stmt(S). { - X = S; - objectForTokens = X; - } - -%type delete_stmt {SqliteQuery*} -%destructor delete_stmt {delete $$;} -delete_stmt(X) ::= DELETE FROM fullname(N) - where_opt(W). { - X = new SqliteDelete( - N->name1, - N->name2, - false, - W, - nullptr - ); - delete N; - // since it's used in trigger: - objectForTokens = X; - } - -delete_stmt(X) ::= DELETE FROM. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteDelete* q = new SqliteDelete(); - X = q; - objectForTokens = X; - } -delete_stmt(X) ::= DELETE FROM nm(N) DOT. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteDelete* q = new SqliteDelete(); - q->database = *(N); - X = q; - objectForTokens = X; - delete N; - } -delete_stmt ::= DELETE FROM nm DOT ID_TAB. {} -delete_stmt ::= DELETE FROM ID_DB|ID_TAB. {} - -%type where_opt {SqliteExpr*} -%destructor where_opt {delete $$;} -where_opt(X) ::= . {X = nullptr;} -where_opt(X) ::= WHERE expr(E). {X = E;} -where_opt(X) ::= WHERE. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new SqliteExpr(); - } - - -////////////////////////// The UPDATE command //////////////////////////////// - -cmd(X) ::= update_stmt(S). { - X = S; - objectForTokens = X; - } - -%type update_stmt {SqliteQuery*} -%destructor update_stmt {delete $$;} -update_stmt(X) ::= UPDATE orconf(C) - fullname(N) SET - setlist(L) where_opt(W). { - X = new SqliteUpdate( - *(C), - N->name1, - N->name2, - false, - QString::null, - *(L), - W, - nullptr - ); - delete C; - delete N; - delete L; - // since it's used in trigger: - objectForTokens = X; - } - -update_stmt(X) ::= UPDATE - orconf(C). { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new SqliteUpdate(); - objectForTokens = X; - delete C; - } -update_stmt(X) ::= UPDATE - orconf(C) nm(N) DOT. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteUpdate* q = new SqliteUpdate(); - q->database = *(N); - X = q; - objectForTokens = X; - delete C; - delete N; - } -update_stmt ::= UPDATE orconf nm DOT - ID_TAB. {} -update_stmt ::= UPDATE orconf ID_DB|ID_TAB. {} - -%type setlist {ParserSetValueList*} -%destructor setlist {delete $$;} -setlist(X) ::= setlist(L) COMMA nm(N) EQ - expr(E). { - L->append(ParserSetValue(*(N), E)); - X = L; - delete N; - DONT_INHERIT_TOKENS("setlist"); - } -setlist(X) ::= nm(N) EQ expr(E). { - X = new ParserSetValueList(); - X->append(ParserSetValue(*(N), E)); - delete N; - } -setlist(X) ::= . { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new ParserSetValueList(); - } -setlist(X) ::= setlist(L) COMMA. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = L; - } - -setlist ::= setlist COMMA ID_COL. {} -setlist ::= ID_COL. {} - -////////////////////////// The INSERT command ///////////////////////////////// - -cmd(X) ::= insert_stmt(S). { - X = S; - objectForTokens = X; - } - -%type insert_stmt {SqliteQuery*} -%destructor insert_stmt {delete $$;} -insert_stmt(X) ::= insert_cmd(C) INTO - fullname(N) idlist_opt(I) - VALUES LP exprlist(L) RP. { - X = new SqliteInsert( - C->replace, - C->orConflict, - N->name1, - N->name2, - *(I), - *(L), - nullptr - ); - delete N; - delete C; - delete L; - delete I; - // since it's used in trigger: - objectForTokens = X; - } -insert_stmt(X) ::= insert_cmd(C) INTO - fullname(N) idlist_opt(I) - select(S). { - X = new SqliteInsert( - C->replace, - C->orConflict, - N->name1, - N->name2, - *(I), - S, - nullptr - ); - delete N; - delete C; - delete I; - // since it's used in trigger: - objectForTokens = X; - } - -insert_stmt(X) ::= insert_cmd(C) INTO. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteInsert* q = new SqliteInsert(); - q->replaceKw = C->replace; - q->onConflict = C->orConflict; - X = q; - objectForTokens = X; - delete C; - } -insert_stmt(X) ::= insert_cmd(C) INTO nm(N) - DOT. { - parserContext->minorErrorBeforeNextToken("Syntax error"); - SqliteInsert* q = new SqliteInsert(); - q->replaceKw = C->replace; - q->onConflict = C->orConflict; - q->database = *(N); - X = q; - objectForTokens = X; - delete C; - delete N; - } -insert_stmt ::= insert_cmd INTO - ID_DB|ID_TAB. {} -insert_stmt ::= insert_cmd INTO - nm DOT ID_TAB. {} - -%type insert_cmd {ParserStubInsertOrReplace*} -%destructor insert_cmd {delete $$;} -insert_cmd(X) ::= INSERT orconf(C). { - X = new ParserStubInsertOrReplace(false, *(C)); - delete C; - } -insert_cmd(X) ::= REPLACE. {X = new ParserStubInsertOrReplace(true);} - -%type idlist_opt {QStringList*} -%destructor idlist_opt {delete $$;} -idlist_opt(X) ::= . {X = new QStringList();} -idlist_opt(X) ::= LP idlist(L) RP. {X = L;} - -%type idlist {QStringList*} -%destructor idlist {delete $$;} -idlist(X) ::= idlist(L) COMMA - nm(N). { - L->append(*(N)); - X = L; - delete N; - DONT_INHERIT_TOKENS("idlist"); - } -idlist(X) ::= nm(N). { - X = new QStringList(); - X->append(*(N)); - delete N; - } -idlist(X) ::= . { - parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new QStringList(); - } - -idlist ::= idlist COMMA ID_COL. {} -idlist ::= ID_COL. {} - -/////////////////////////// Expression Processing ///////////////////////////// - -%type exprx {SqliteExpr*} -%destructor exprx {delete $$;} -exprx(X) ::= NULL. { - X = new SqliteExpr(); - X->initNull(); - objectForTokens = X; - } -exprx(X) ::= INTEGER(I). { - X = new SqliteExpr(); - QVariant val = QVariant(I->value).toLongLong(); - X->initLiteral(val); - objectForTokens = X; - } -exprx(X) ::= FLOAT(F). { - X = new SqliteExpr(); - QVariant val = QVariant(F->value).toDouble(); - X->initLiteral(val); - objectForTokens = X; - } -exprx(X) ::= STRING(S). { - X = new SqliteExpr(); - X->initLiteral(QVariant(S->value)); - objectForTokens = X; - } -exprx(X) ::= LP expr(E) RP. { - X = new SqliteExpr(); - X->initSubExpr(E); - objectForTokens = X; - } -exprx(X) ::= id(N). { - X = new SqliteExpr(); - X->initId(*(N)); - delete N; - objectForTokens = X; - } -exprx(X) ::= JOIN_KW(N). { - X = new SqliteExpr(); - X->initId(N->value); - objectForTokens = X; - } -exprx(X) ::= nm(N1) DOT nm(N2). { - X = new SqliteExpr(); - X->initId(*(N1), *(N2)); - delete N1; - delete N2; - objectForTokens = X; - } -exprx(X) ::= nm(N1) DOT nm(N2) DOT nm(N3). { - X = new SqliteExpr(); - X->initId(*(N1), *(N2), *(N3)); - delete N1; - delete N2; - delete N3; - objectForTokens = X; - } -exprx(X) ::= VARIABLE(V). { - X = new SqliteExpr(); - X->initBindParam(V->value); - objectForTokens = X; - } -exprx(X) ::= ID(I) LP exprlist(L) RP. { - X = new SqliteExpr(); - X->initFunction(I->value, false, *(L)); - delete L; - objectForTokens = X; - } -exprx(X) ::= ID(I) LP STAR RP. { - X = new SqliteExpr(); - X->initFunction(I->value, true); - objectForTokens = X; - } -exprx(X) ::= expr(E1) AND(O) expr(E2). { - X = new SqliteExpr(); - X->initBinOp(E1, O->value, E2); - objectForTokens = X; - } -exprx(X) ::= expr(E1) OR(O) expr(E2). { - X = new SqliteExpr(); - X->initBinOp(E1, O->value, E2); - objectForTokens = X; - } -exprx(X) ::= expr(E1) LT|GT|GE|LE(O) - expr(E2). { - X = new SqliteExpr(); - X->initBinOp(E1, O->value, E2); - objectForTokens = X; - } -exprx(X) ::= expr(E1) EQ|NE(O) expr(E2). { - X = new SqliteExpr(); - X->initBinOp(E1, O->value, E2); - objectForTokens = X; - } -exprx(X) ::= expr(E1) - BITAND|BITOR|LSHIFT|RSHIFT(O) - expr(E2). { - X = new SqliteExpr(); - X->initBinOp(E1, O->value, E2); - objectForTokens = X; - } -exprx(X) ::= expr(E1) PLUS|MINUS(O) - expr(E2). { - X = new SqliteExpr(); - X->initBinOp(E1, O->value, E2); - objectForTokens = X; - } -exprx(X) ::= expr(E1) STAR|SLASH|REM(O) - expr(E2). { - X = new SqliteExpr(); - X->initBinOp(E1, O->value, E2); - objectForTokens = X; - } -exprx(X) ::= expr(E1) CONCAT(O) expr(E2). { - X = new SqliteExpr(); - X->initBinOp(E1, O->value, E2); - objectForTokens = X; - } -exprx(X) ::= expr(E1) not_opt(N) likeop(L) - expr(E2). [LIKE_KW] { - X = new SqliteExpr(); - X->initLike(E1, *(N), *(L), E2); - delete N; - delete L; - objectForTokens = X; - } -exprx(X) ::= expr(E) ISNULL|NOTNULL(N). { - X = new SqliteExpr(); - X->initNull(E, N->value); - objectForTokens = X; - } -exprx(X) ::= expr(E) NOT NULL. { - X = new SqliteExpr(); - X->initNull(E, "NOT NULL"); - objectForTokens = X; - } -exprx(X) ::= expr(E1) IS not_opt(N) - expr(E2). { - X = new SqliteExpr(); - X->initIs(E1, *(N), E2); - delete N; - objectForTokens = X; - } -exprx(X) ::= NOT(O) expr(E). { - X = new SqliteExpr(); - X->initUnaryOp(E, O->value); - } -exprx(X) ::= BITNOT(O) expr(E). { - X = new SqliteExpr(); - X->initUnaryOp(E, O->value); - objectForTokens = X; - } -exprx(X) ::= MINUS(O) expr(E). [BITNOT] { - X = new SqliteExpr(); - X->initUnaryOp(E, O->value); - objectForTokens = X; - } -exprx(X) ::= PLUS(O) expr(E). [BITNOT] { - X = new SqliteExpr(); - X->initUnaryOp(E, O->value); - objectForTokens = X; - } -exprx(X) ::= expr(E1) not_opt(N) BETWEEN - expr(E2) AND - expr(E3). [BETWEEN] { - X = new SqliteExpr(); - X->initBetween(E1, *(N), E2, E3); - delete N; - objectForTokens = X; - } -exprx(X) ::= expr(E) not_opt(N) IN LP - exprlist(L) RP. [IN] { - X = new SqliteExpr(); - X->initIn(E, *(N), *(L)); - delete N; - delete L; - objectForTokens = X; - } -exprx(X) ::= expr(E) not_opt(N) IN LP - select(S) RP. [IN] { - X = new SqliteExpr(); - X->initIn(E, *(N), S); - delete N; - objectForTokens = X; - } -exprx(X) ::= expr(E) not_opt(N) IN nm(N1) - dbnm(N2). [IN] { - X = new SqliteExpr(); - X->initIn(E, *(N), *(N1), *(N2)); - delete N; - delete N1; - objectForTokens = X; - } -exprx(X) ::= LP select(S) RP. { - X = new SqliteExpr(); - X->initSubSelect(S); - objectForTokens = X; - } -exprx(X) ::= CASE case_operand(O) - case_exprlist(L) - case_else(E) END. { - X = new SqliteExpr(); - X->initCase(O, *(L), E); - delete L; - objectForTokens = X; - } -exprx(X) ::= RAISE LP raisetype(R) COMMA - nm(N) RP. { - X = new SqliteExpr(); - X->initRaise(R->value, *(N)); - delete N; - objectForTokens = X; - } -exprx(X) ::= RAISE LP IGNORE(R) RP. { - X = new SqliteExpr(); - X->initRaise(R->value); - objectForTokens = X; - } -exprx(X) ::= nm(N1) DOT. { - X = new SqliteExpr(); - X->initId(*(N1), QString::null, QString::null); - delete N1; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } -exprx(X) ::= nm(N1) DOT nm(N2) DOT. { - X = new SqliteExpr(); - X->initId(*(N1), *(N2), QString::null); - delete N1; - delete N2; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } -exprx(X) ::= expr(E1) not_opt(N) BETWEEN - expr(E2) AND. { - X = new SqliteExpr(); - delete N; - delete E1; - delete E2; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } -exprx(X) ::= CASE case_operand(O) - case_exprlist(L) - case_else(E). { - X = new SqliteExpr(); - delete L; - delete O; - delete E; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } -exprx(X) ::= expr(E) not_opt(N) IN LP - exprlist(L). [IN] { - X = new SqliteExpr(); - delete N; - delete L; - delete E; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } -/* -This introduces premature reduce for LP-expr and causes bug #2755 -exprx(X) ::= LP expr(E). { - X = new SqliteExpr(); - X->initSubExpr(E); - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error"); - } -*/ - -exprx ::= expr not_opt IN ID_DB. [IN] {} -exprx ::= expr not_opt IN nm DOT - ID_TAB. [IN] {} -exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN. {} -exprx ::= nm DOT ID_TAB|ID_COL. {} -exprx ::= nm DOT nm DOT ID_COL. {} -exprx ::= RAISE LP raisetype COMMA - ID_ERR_MSG RP. {} - -%type expr {SqliteExpr*} -%destructor expr {delete $$;} -expr(X) ::= exprx(E). {X = E;} -expr(X) ::= . { - X = new SqliteExpr(); - objectForTokens = X; - parserContext->minorErrorAfterLastToken("Syntax error"); - } -%type not_opt {bool*} -%destructor not_opt {delete $$;} -not_opt(X) ::= . {X = new bool(false);} -not_opt(X) ::= NOT. {X = new bool(true);} - -%type likeop {SqliteExpr::LikeOp*} -%destructor likeop {delete $$;} -likeop(X) ::= LIKE|GLOB(T). {X = new SqliteExpr::LikeOp(SqliteExpr::likeOp(T->value));} - -%type case_exprlist {ParserExprList*} -%destructor case_exprlist {delete $$;} -case_exprlist(X) ::= case_exprlist(L) WHEN - expr(E1) THEN expr(E2). { - L->append(E1); - L->append(E2); - X = L; - } -case_exprlist(X) ::= WHEN expr(E1) THEN - expr(E2). { - X = new ParserExprList(); - X->append(E1); - X->append(E2); - } - -%type case_else {SqliteExpr*} -%destructor case_else {delete $$;} -case_else(X) ::= ELSE expr(E). {X = E;} -case_else(X) ::= . {X = nullptr;} - -%type case_operand {SqliteExpr*} -%destructor case_operand {delete $$;} -case_operand(X) ::= exprx(E). {X = E;} -case_operand(X) ::= . {X = nullptr;} - -%type exprlist {ParserExprList*} -%destructor exprlist {delete $$;} -exprlist(X) ::= nexprlist(L). {X = L;} -exprlist(X) ::= . {X = new ParserExprList();} - -%type nexprlist {ParserExprList*} -%destructor nexprlist {delete $$;} -nexprlist(X) ::= nexprlist(L) COMMA - expr(E). { - L->append(E); - X = L; - DONT_INHERIT_TOKENS("nexprlist"); - } -nexprlist(X) ::= exprx(E). { - X = new ParserExprList(); - X->append(E); - } - -///////////////////////////// The CREATE INDEX command /////////////////////// - -cmd(X) ::= CREATE uniqueflag(U) INDEX - nm(N1) ON nm(N2) dbnm(N3) - LP idxlist(L) RP onconf(C). { - X = new SqliteCreateIndex( - *(U), - false, - *(N1), - *(N2), - *(N3), - *(L), - *(C) - ); - delete U; - delete N1; - delete N2; - delete N3; - delete L; - delete C; - objectForTokens = X; - } - -cmd ::= CREATE uniqueflag INDEX nm dbnm - ON ID_TAB. {} -cmd ::= CREATE uniqueflag INDEX nm DOT - ID_IDX_NEW. {} -cmd ::= CREATE uniqueflag INDEX - ID_DB|ID_IDX_NEW. {} - -%type uniqueflag {bool*} -%destructor uniqueflag {delete $$;} -uniqueflag(X) ::= UNIQUE. {X = new bool(true);} -uniqueflag(X) ::= . {X = new bool(false);} - -%type idxlist_opt {ParserIndexedColumnList*} -%destructor idxlist_opt {delete $$;} -idxlist_opt(X) ::= . {X = new ParserIndexedColumnList();} -idxlist_opt(X) ::= LP idxlist(I) RP. {X = I;} - -%type idxlist {ParserIndexedColumnList*} -%destructor idxlist {delete $$;} -idxlist(X) ::= idxlist(L) COMMA - idxlist_single(S). { - L->append(S); - X = L; - DONT_INHERIT_TOKENS("idxlist"); - } -idxlist(X) ::= idxlist_single(S). { - X = new ParserIndexedColumnList(); - X->append(S); - } - -%type idxlist_single {SqliteIndexedColumn*} -%destructor idxlist_single {delete $$;} -idxlist_single(X) ::= nm(N) sortorder(S). { - SqliteIndexedColumn* obj = - new SqliteIndexedColumn( - *(N), - QString::null, - *(S) - ); - X = obj; - delete S; - delete N; - objectForTokens = X; - } - -idxlist_single ::= ID_COL. {} - -///////////////////////////// The DROP INDEX command ///////////////////////// - -cmd(X) ::= DROP INDEX fullname(N). { - X = new SqliteDropIndex(false, N->name1, N->name2); - delete N; - objectForTokens = X; - } - -cmd ::= DROP INDEX nm DOT ID_IDX. {} -cmd ::= DROP INDEX ID_DB|ID_IDX. {} - -///////////////////////////// The COPY command /////////////////////////////// - -cmd(X) ::= COPY orconf(C) nm(N1) dbnm(N2) - FROM nm(N3) USING DELIMITERS - STRING(S). { - X = new SqliteCopy( - *(C), - *(N1), - *(N2), - *(N3), - S->value - ); - delete C; - delete N1; - delete N2; - delete N3; - objectForTokens = X; - } -cmd(X) ::= COPY orconf(C) nm(N1) dbnm(N2) - FROM nm(N3). { - X = new SqliteCopy( - *(C), - *(N1), - *(N2), - *(N3) - ); - delete C; - delete N1; - delete N2; - delete N3; - objectForTokens = X; - } - -///////////////////////////// The VACUUM command ///////////////////////////// - -cmd(X) ::= VACUUM. { - X = new SqliteVacuum(); - objectForTokens = X; - } -cmd(X) ::= VACUUM nm(N). { - X = new SqliteVacuum(*(N)); - delete N; - objectForTokens = X; - } - -///////////////////////////// The PRAGMA command ///////////////////////////// - -cmd(X) ::= PRAGMA ids(I). { - X = new SqlitePragma(*(I), QString::null); - delete I; - objectForTokens = X; - } - -cmd(X) ::= PRAGMA nm(N) EQ nmnum(V). { - X = new SqlitePragma(*(N), QString::null, *(V), true); - delete N; - delete V; - objectForTokens = X; - } -cmd(X) ::= PRAGMA nm(N) LP nmnum(V) RP. { - X = new SqlitePragma(*(N), QString::null, *(V), false); - delete N; - delete V; - objectForTokens = X; - } -cmd(X) ::= PRAGMA nm(N) EQ minus_num(V). { - X = new SqlitePragma(*(N), QString::null, *(V), true); - delete N; - delete V; - objectForTokens = X; - } -cmd(X) ::= PRAGMA nm(N) LP minus_num(V) RP. { - X = new SqlitePragma(*(N), QString::null, *(V), false); - delete N; - delete V; - objectForTokens = X; - } - -cmd ::= PRAGMA nm DOT ID_PRAGMA. {} -cmd ::= PRAGMA ID_DB|ID_PRAGMA. {} - -%type nmnum {QVariant*} -%destructor nmnum {delete $$;} -nmnum(X) ::= plus_num(N). {X = N;} -nmnum(X) ::= nm(N). { - X = new QVariant(*(N)); - delete N; - } -nmnum(X) ::= ON(T). {X = new QVariant(T->value);} -nmnum(X) ::= DELETE(T). {X = new QVariant(T->value);} -nmnum(X) ::= DEFAULT(T). {X = new QVariant(T->value);} - -%type plus_num {QVariant*} -%destructor plus_num {delete $$;} -plus_num(X) ::= PLUS number(N). {X = N;} -plus_num(X) ::= number(N). {X = N;} - -%type minus_num {QVariant*} -%destructor minus_num {delete $$;} -minus_num(X) ::= MINUS number(N). { - if (N->type() == QVariant::Double) - *(N) = -(N->toDouble()); - else if (N->type() == QVariant::LongLong) - *(N) = -(N->toLongLong()); - else - Q_ASSERT_X(true, "producing minus number", "QVariant is neither of Double or LongLong."); - - X = N; - } - -%type number {QVariant*} -%destructor number {delete $$;} -number(X) ::= INTEGER(N). {X = new QVariant(QVariant(N->value).toLongLong());} -number(X) ::= FLOAT(N). {X = new QVariant(QVariant(N->value).toDouble());} - -//////////////////////////// The CREATE TRIGGER command ///////////////////// - -cmd(X) ::= CREATE temp(T) TRIGGER - nm(N) trigger_time(TT) - trigger_event(EV) ON nm(N1) - dbnm(N2) foreach_clause(FC) - when_clause(WC) BEGIN - trigger_cmd_list(CL) END. { - X = new SqliteCreateTrigger( - *(T), - false, - *(N), - *(N1), - *(N2), - *(TT), - EV, - *(FC), - WC, - *(CL), - 2 - ); - delete T; - delete TT; - delete FC; - delete N1; - delete N; - delete N2; - delete CL; - objectForTokens = X; - } - -// Support full parsing when no BEGIN and END are present (for completion helper) -cmd(X) ::= CREATE temp(T) TRIGGER - nm(N) trigger_time(TT) - trigger_event(EV) ON nm(N1) - dbnm(N2) foreach_clause(FC) - when_clause(WC). { - QList<SqliteQuery *> CL; - - X = new SqliteCreateTrigger( - *(T), - false, - *(N), - *(N1), - *(N2), - *(TT), - EV, - *(FC), - WC, - CL, - 2 - ); - delete T; - delete TT; - delete FC; - delete N1; - delete N; - delete N2; - objectForTokens = X; - parserContext->minorErrorAfterLastToken("Syntax error"); - } - -// Support full parsing when no END is present (for completion helper) -cmd(X) ::= CREATE temp(T) TRIGGER - nm(N) trigger_time(TT) - trigger_event(EV) ON nm(N1) - dbnm(N2) foreach_clause(FC) - when_clause(WC) BEGIN - trigger_cmd_list(CL). { - X = new SqliteCreateTrigger( - *(T), - false, - *(N), - *(N1), - *(N2), - *(TT), - EV, - *(FC), - WC, - *(CL), - 2 - ); - delete T; - delete TT; - delete FC; - delete N1; - delete N; - delete N2; - delete CL; - objectForTokens = X; - parserContext->minorErrorAfterLastToken("Syntax error"); - } - -cmd ::= CREATE temp TRIGGER nm - trigger_time trigger_event - ON ID_TAB|ID_DB. {} -cmd ::= CREATE temp TRIGGER nm - trigger_time trigger_event - ON nm DOT ID_TAB. {} -cmd ::= CREATE temp TRIGGER ID_TRIG_NEW. {} - -%type trigger_time {SqliteCreateTrigger::Time*} -%destructor trigger_time {delete $$;} -trigger_time(X) ::= BEFORE. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);} -trigger_time(X) ::= AFTER. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);} -trigger_time(X) ::= INSTEAD OF. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);} -trigger_time(X) ::= . {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);} - -%type trigger_event {SqliteCreateTrigger::Event*} -%destructor trigger_event {delete $$;} -trigger_event(X) ::= DELETE. { - X = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE); - objectForTokens = X; - } -trigger_event(X) ::= INSERT. { - X = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::INSERT); - objectForTokens = X; - } -trigger_event(X) ::= UPDATE. { - X = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::UPDATE); - objectForTokens = X; - } -trigger_event(X) ::= UPDATE OF - idlist(L). { - X = new SqliteCreateTrigger::Event(*(L)); - delete L; - objectForTokens = X; - } - -%type foreach_clause {SqliteCreateTrigger::Scope*} -%destructor foreach_clause {delete $$;} -foreach_clause(X) ::= . {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);} -foreach_clause(X) ::= FOR EACH ROW. {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);} -foreach_clause(X) ::= FOR EACH STATEMENT. {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_STATEMENT);} - -%type when_clause {SqliteExpr*} -%destructor when_clause {if ($$) delete $$;} -when_clause(X) ::= . {X = nullptr;} -when_clause(X) ::= WHEN expr(E). {X = E;} - -%type trigger_cmd_list {ParserQueryList*} -%destructor trigger_cmd_list {delete $$;} -trigger_cmd_list(X) ::= trigger_cmd_list(L) - trigger_cmd(C) SEMI. { - L->append(C); - X = L; - DONT_INHERIT_TOKENS("trigger_cmd_list"); - } -trigger_cmd_list(X) ::= trigger_cmd(C) - SEMI. { - X = new ParserQueryList(); - X->append(C); - } - -%type trigger_cmd {SqliteQuery*} -%destructor trigger_cmd {delete $$;} -trigger_cmd(X) ::= update_stmt(S). {X = S;} -trigger_cmd(X) ::= insert_stmt(S). {X = S;} -trigger_cmd(X) ::= delete_stmt(S). {X = S;} -trigger_cmd(X) ::= select_stmt(S). {X = S;} - -%type raisetype {Token*} -raisetype(X) ::= ROLLBACK|ABORT|FAIL(V). {X = V;} - -//////////////////////// DROP TRIGGER statement ////////////////////////////// -cmd(X) ::= DROP TRIGGER fullname(N). { - X = new SqliteDropTrigger(false, N->name1, N->name2); - delete N; - objectForTokens = X; - } - -cmd ::= DROP TRIGGER nm DOT ID_TRIG. {} -cmd ::= DROP TRIGGER ID_DB|ID_TRIG. {} - -//////////////////////// ATTACH DATABASE file AS name ///////////////////////// -cmd(X) ::= ATTACH database_kw_opt(D) - ids(I1) AS ids(I2) key_opt(K). { - SqliteExpr* e1 = new SqliteExpr(); - SqliteExpr* e2 = new SqliteExpr(); - e1->initLiteral(*(I1)); - e2->initLiteral(*(I2)); - X = new SqliteAttach(*(D), e1, e2, K); - delete D; - delete I1; - delete I2; - objectForTokens = X; - } - -%type key_opt {SqliteExpr*} -%destructor key_opt {if ($$) delete $$;} -key_opt(X) ::= . {X = nullptr;} -key_opt(X) ::= USING ids(I). { - SqliteExpr* e = new SqliteExpr(); - e->initLiteral(*(I)); - delete I; - X = e; - } - -%type database_kw_opt {bool*} -%destructor database_kw_opt {delete $$;} -database_kw_opt(X) ::= DATABASE. {X = new bool(true);} -database_kw_opt(X) ::= . {X = new bool(false);} - - -//////////////////////// DETACH DATABASE name ///////////////////////////////// -cmd(X) ::= DETACH database_kw_opt(D) - nm(N). { - SqliteExpr* e = new SqliteExpr(); - e->initLiteral(*(N)); - delete N; - X = new SqliteDetach(*(D), e); - delete D; - objectForTokens = X; - } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp index ffe6981..c980096 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp @@ -15,6 +15,8 @@ #include "parsercontext.h" #include "parser_helper_stubs.h" #include "common/utils_sql.h" +#include "common/global.h" +#include "common/unused.h" #include "parser/ast/sqlitealtertable.h" #include "parser/ast/sqliteanalyze.h" #include "parser/ast/sqliteattach.h" @@ -50,6 +52,9 @@ #include "parser/ast/sqliteforeignkey.h" #include "parser/ast/sqlitewith.h" #include "parser/ast/sqliteupsert.h" +#include "parser/ast/sqlitewindowdefinition.h" +#include "parser/ast/sqlitefilterover.h" +#include "parser/ast/sqlitenulls.h" #include <QObject> #include <QDebug> #include <limits.h> @@ -107,63 +112,77 @@ ** defined, then do no error processing. */ #define YYCODETYPE unsigned short int -#define YYNOCODE 281 +#define YYNOCODE 321 #define YYACTIONTYPE unsigned short int -#define YYWILDCARD 61 +#define YYWILDCARD 78 #define sqlite3_parseTOKENTYPE Token* typedef union { int yyinit; sqlite3_parseTOKENTYPE yy0; - SqliteCreateTrigger::Scope* yy3; + SqliteWith* yy1; + SqliteLimit* yy4; + ParserDeferSubClause* yy9; + SqliteSelect::Core::JoinSource* yy31; + SqliteExpr::LikeOp* yy40; + SqliteWindowDefinition::Window::Frame* yy41; + ParserCreateTableColumnList* yy42; ParserCreateTableColumnConstraintList* yy51; - QStringList* yy95; + ParserResultColumnList* yy53; + SqliteColumnType* yy57; + SqliteWindowDefinition::Window::Frame::Exclude* yy63; + ParserExprList* yy71; + SqliteCreateTrigger::Scope* yy83; + ParserStubTransDetails* yy84; + ParserStubExplain* yy91; SqliteForeignKey::Condition::Reaction* yy104; - ParserStubInsertOrReplace* yy105; - SqliteIndexedColumn* yy108; - ParserOtherSourceList* yy131; - SqliteCreateTrigger::Time* yy132; - int* yy146; - ParserOrderByList* yy163; - ParserExprNestedList* yy166; - ParserFkConditionList* yy184; - ParserIndexedBy* yy192; + ParserQueryList* yy110; + SqliteCreateTable::Column* yy147; + SqliteCreateTrigger::Event* yy151; ParserStubAlias* yy200; - SqliteSelect::Core::SingleSource* yy201; - ParserCreateTableColumnList* yy202; + ParserSetValueList* yy201; + SqliteSelect::Core::JoinOp* yy221; ParserIndexedColumnList* yy223; - SqliteCreateTable::Column* yy227; - SqliteQuery* yy283; + QVariant* yy229; + SqliteCreateTable::Constraint* yy246; + SqliteFilterOver* yy247; + SqliteFilterOver::Over* yy248; + SqliteWindowDefinition* yy266; + SqliteIndexedColumn* yy268; SqliteSelect::Core::JoinConstraint* yy295; - SqliteSelect::Core::JoinOp* yy301; - SqliteCreateTable::Column::Constraint* yy304; - SqliteSortOrder* yy309; - SqliteSelect::Core* yy310; - SqliteWith* yy321; - ParserDeferSubClause* yy329; - ParserCreateTableConstraintList* yy333; - SqliteConflictAlgo* yy338; - SqliteForeignKey::Condition* yy347; - SqliteExpr* yy352; - ParserFullName* yy360; - ParserResultColumnList* yy373; - SqliteInitially* yy392; - QString* yy399; - ParserStubTransDetails* yy404; - SqliteCreateTable::Constraint* yy406; - ParserStubExplain* yy411; - ParserQueryList* yy430; - bool* yy451; - SqliteSelect::CompoundOperator* yy462; - QVariant* yy469; - SqliteSelect* yy473; - SqliteLimit* yy484; - SqliteSelect::Core::JoinSource* yy511; - SqliteExpr::LikeOp* yy520; - ParserSetValueList* yy521; - SqliteColumnType* yy537; - ParserExprList* yy551; - SqliteCreateTrigger::Event* yy552; - SqliteUpsert* yy560; + ParserWindowDefList* yy299; + SqliteInitially* yy312; + SqliteSelect* yy313; + QString* yy319; + SqliteWindowDefinition::Window* yy334; + SqliteQuery* yy363; + SqliteSelect::CompoundOperator* yy382; + int* yy386; + SqliteFilterOver::Filter* yy397; + SqliteUpsert* yy400; + ParserOrderByList* yy403; + SqliteConflictAlgo* yy418; + SqliteWindowDefinition::Window::Frame::RangeOrRows* yy419; + ParserFullName* yy440; + SqliteSelect::Core::SingleSource* yy441; + SqliteWindowDefinition::Window::Frame::Bound* yy442; + SqliteWith::CommonTableExpression* yy446; + ParserOtherSourceList* yy451; + SqliteCreateTable::Column::Constraint* yy464; + SqliteSelect::Core* yy470; + ParserExprNestedList* yy486; + ParserCreateTableConstraintList* yy493; + ParserStubInsertOrReplace* yy504; + SqliteForeignKey::Condition* yy507; + SqliteExpr* yy512; + SqliteCreateTrigger::Time* yy532; + SqliteSortOrder* yy549; + QStringList* yy575; + SqliteNulls* yy579; + ParserFkConditionList* yy584; + ParserTermOrLiteral* yy590; + ParserIndexedBy* yy592; + ParserCteList* yy593; + bool* yy611; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -172,8 +191,8 @@ typedef union { #define sqlite3_parseARG_PDECL ,ParserContext* parserContext #define sqlite3_parseARG_FETCH ParserContext* parserContext = yypParser->parserContext #define sqlite3_parseARG_STORE yypParser->parserContext = parserContext -#define YYNSTATE 754 -#define YYNRULE 431 +#define YYNSTATE 844 +#define YYNRULE 472 #define YYFALLBACK 1 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2) #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) @@ -245,658 +264,806 @@ static const YYMINORTYPE yyzerominor = { 0 }; ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. */ -#define YY_ACTTAB_COUNT (2384) +#define YY_ACTTAB_COUNT (3037) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 457, 54, 54, 53, 53, 53, 52, 225, 277, 746, - /* 10 */ 280, 445, 57, 57, 57, 57, 32, 55, 55, 55, - /* 20 */ 55, 54, 54, 53, 53, 53, 52, 225, 658, 1062, - /* 30 */ 1062, 63, 746, 165, 57, 57, 57, 57, 450, 55, - /* 40 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225, - /* 50 */ 697, 87, 312, 644, 746, 701, 143, 71, 1062, 1062, - /* 60 */ 45, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, - /* 70 */ 1062, 1062, 652, 1062, 1062, 1062, 1062, 42, 43, 1062, - /* 80 */ 1062, 1062, 1062, 1062, 44, 457, 53, 53, 53, 52, - /* 90 */ 225, 746, 3, 643, 639, 717, 445, 707, 751, 442, - /* 100 */ 720, 1, 717, 455, 293, 454, 623, 720, 719, 718, - /* 110 */ 717, 744, 743, 411, 707, 719, 718, 717, 456, 746, - /* 120 */ 454, 683, 292, 450, 15, 485, 702, 196, 96, 645, - /* 130 */ 1179, 1179, 665, 456, 744, 743, 378, 454, 745, 149, - /* 140 */ 701, 702, 196, 486, 487, 45, 646, 98, 707, 537, - /* 150 */ 456, 473, 10, 707, 658, 698, 744, 743, 702, 196, - /* 160 */ 350, 645, 42, 43, 637, 543, 298, 474, 473, 44, - /* 170 */ 914, 721, 931, 931, 722, 424, 407, 3, 914, 745, - /* 180 */ 329, 87, 707, 746, 442, 914, 138, 717, 455, 401, - /* 190 */ 398, 397, 720, 744, 743, 329, 473, 457, 638, 707, - /* 200 */ 719, 718, 717, 724, 914, 454, 139, 396, 445, 488, - /* 210 */ 690, 92, 410, 349, 307, 1116, 219, 914, 456, 914, - /* 220 */ 914, 744, 743, 914, 746, 241, 702, 99, 914, 914, - /* 230 */ 914, 914, 914, 707, 19, 450, 222, 10, 707, 314, - /* 240 */ 698, 55, 55, 55, 55, 54, 54, 53, 53, 53, - /* 250 */ 52, 225, 701, 427, 746, 454, 746, 45, 152, 102, - /* 260 */ 294, 404, 289, 403, 140, 310, 436, 550, 456, 215, - /* 270 */ 214, 213, 431, 296, 42, 43, 702, 196, 287, 746, - /* 280 */ 671, 44, 977, 746, 580, 744, 743, 426, 138, 3, - /* 290 */ 977, 401, 398, 397, 707, 333, 442, 977, 509, 717, - /* 300 */ 455, 593, 594, 557, 720, 413, 668, 631, 630, 396, - /* 310 */ 351, 707, 719, 718, 717, 521, 977, 457, 509, 365, - /* 320 */ 508, 508, 526, 527, 371, 713, 744, 743, 445, 977, - /* 330 */ 329, 977, 977, 319, 511, 636, 532, 65, 613, 226, - /* 340 */ 977, 977, 977, 977, 64, 707, 15, 977, 703, 10, - /* 350 */ 707, 645, 698, 319, 510, 450, 744, 743, 744, 743, - /* 360 */ 209, 208, 524, 533, 535, 746, 525, 534, 646, 703, - /* 370 */ 714, 609, 701, 52, 225, 61, 470, 45, 516, 620, - /* 380 */ 620, 744, 743, 645, 454, 717, 375, 369, 608, 633, - /* 390 */ 720, 703, 408, 470, 42, 43, 38, 456, 719, 718, - /* 400 */ 717, 44, 962, 746, 714, 702, 196, 358, 605, 3, - /* 410 */ 962, 512, 60, 116, 707, 713, 442, 962, 604, 717, - /* 420 */ 455, 470, 538, 801, 720, 742, 98, 713, 1082, 686, - /* 430 */ 740, 707, 719, 718, 717, 741, 962, 485, 328, 424, - /* 440 */ 409, 687, 582, 224, 1064, 1064, 320, 1171, 297, 962, - /* 450 */ 745, 962, 962, 300, 1171, 486, 360, 91, 12, 329, - /* 460 */ 962, 745, 962, 962, 628, 707, 745, 744, 743, 10, - /* 470 */ 707, 38, 698, 58, 59, 452, 308, 1064, 1064, 710, - /* 480 */ 710, 56, 56, 57, 57, 57, 57, 219, 55, 55, - /* 490 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 563, - /* 500 */ 563, 265, 387, 271, 478, 744, 743, 667, 324, 148, - /* 510 */ 581, 242, 414, 549, 803, 311, 377, 713, 245, 567, - /* 520 */ 73, 361, 690, 745, 1064, 1064, 58, 59, 452, 308, - /* 530 */ 119, 47, 710, 710, 56, 56, 57, 57, 57, 57, - /* 540 */ 406, 55, 55, 55, 55, 54, 54, 53, 53, 53, - /* 550 */ 52, 225, 657, 58, 59, 452, 308, 1064, 1064, 710, - /* 560 */ 710, 56, 56, 57, 57, 57, 57, 334, 55, 55, - /* 570 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 681, - /* 580 */ 687, 443, 224, 581, 1186, 162, 461, 2, 240, 239, - /* 590 */ 680, 285, 466, 73, 721, 41, 745, 722, 96, 58, - /* 600 */ 59, 452, 308, 1064, 1064, 710, 710, 56, 56, 57, - /* 610 */ 57, 57, 57, 96, 55, 55, 55, 55, 54, 54, - /* 620 */ 53, 53, 53, 52, 225, 49, 692, 691, 151, 1063, - /* 630 */ 1063, 602, 58, 59, 452, 308, 1064, 1064, 710, 710, - /* 640 */ 56, 56, 57, 57, 57, 57, 368, 55, 55, 55, - /* 650 */ 55, 54, 54, 53, 53, 53, 52, 225, 1063, 1063, - /* 660 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, - /* 670 */ 1063, 1063, 746, 1063, 1063, 1063, 1063, 1063, 1063, 1063, - /* 680 */ 1063, 1063, 1063, 1063, 1064, 1064, 452, 308, 692, 691, - /* 690 */ 710, 710, 56, 56, 57, 57, 57, 57, 34, 55, - /* 700 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225, - /* 710 */ 713, 95, 709, 58, 59, 452, 308, 1064, 1064, 710, - /* 720 */ 710, 56, 56, 57, 57, 57, 57, 708, 55, 55, - /* 730 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 58, - /* 740 */ 59, 452, 308, 746, 218, 710, 710, 56, 56, 57, - /* 750 */ 57, 57, 57, 150, 55, 55, 55, 55, 54, 54, - /* 760 */ 53, 53, 53, 52, 225, 658, 984, 253, 672, 257, - /* 770 */ 512, 50, 706, 36, 744, 743, 58, 59, 452, 308, - /* 780 */ 746, 984, 710, 710, 56, 56, 57, 57, 57, 57, - /* 790 */ 161, 55, 55, 55, 55, 54, 54, 53, 53, 53, - /* 800 */ 52, 225, 6, 985, 148, 320, 1170, 217, 629, 648, - /* 810 */ 412, 259, 713, 1170, 58, 59, 452, 308, 985, 17, - /* 820 */ 710, 710, 56, 56, 57, 57, 57, 57, 984, 55, - /* 830 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225, - /* 840 */ 498, 986, 299, 394, 16, 744, 743, 657, 1131, 438, - /* 850 */ 96, 58, 59, 452, 308, 745, 986, 710, 710, 56, - /* 860 */ 56, 57, 57, 57, 57, 985, 55, 55, 55, 55, - /* 870 */ 54, 54, 53, 53, 53, 52, 225, 554, 987, 255, - /* 880 */ 337, 211, 744, 743, 383, 498, 658, 354, 695, 694, - /* 890 */ 444, 695, 694, 987, 554, 746, 705, 745, 58, 59, - /* 900 */ 452, 308, 24, 986, 710, 710, 56, 56, 57, 57, - /* 910 */ 57, 57, 112, 55, 55, 55, 55, 54, 54, 53, - /* 920 */ 53, 53, 52, 225, 682, 1131, 58, 59, 452, 308, - /* 930 */ 647, 746, 710, 710, 56, 56, 57, 57, 57, 57, - /* 940 */ 987, 55, 55, 55, 55, 54, 54, 53, 53, 53, - /* 950 */ 52, 225, 457, 1145, 229, 690, 704, 441, 690, 20, - /* 960 */ 571, 598, 46, 445, 58, 59, 452, 308, 572, 139, - /* 970 */ 710, 710, 56, 56, 57, 57, 57, 57, 746, 55, - /* 980 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225, - /* 990 */ 450, 98, 746, 37, 713, 696, 580, 744, 743, 393, - /* 1000 */ 97, 454, 298, 87, 454, 685, 662, 701, 240, 239, - /* 1010 */ 754, 581, 45, 428, 456, 745, 168, 456, 454, 745, - /* 1020 */ 727, 73, 702, 196, 745, 702, 99, 557, 281, 42, - /* 1030 */ 43, 456, 355, 744, 743, 357, 44, 482, 684, 702, - /* 1040 */ 196, 745, 703, 233, 3, 568, 692, 691, 746, 707, - /* 1050 */ 484, 442, 483, 167, 717, 455, 424, 425, 333, 720, - /* 1060 */ 532, 65, 87, 703, 287, 446, 707, 719, 718, 717, - /* 1070 */ 384, 340, 352, 424, 415, 517, 329, 149, 674, 671, - /* 1080 */ 744, 743, 1179, 1179, 297, 703, 72, 533, 535, 746, - /* 1090 */ 383, 534, 423, 329, 744, 743, 713, 745, 363, 752, - /* 1100 */ 707, 382, 440, 745, 10, 707, 714, 698, 149, 8, - /* 1110 */ 374, 745, 58, 59, 452, 308, 434, 376, 710, 710, - /* 1120 */ 56, 56, 57, 57, 57, 57, 98, 55, 55, 55, - /* 1130 */ 55, 54, 54, 53, 53, 53, 52, 225, 517, 166, - /* 1140 */ 714, 662, 681, 422, 324, 278, 454, 617, 273, 279, - /* 1150 */ 744, 743, 231, 680, 745, 437, 746, 673, 745, 456, - /* 1160 */ 228, 745, 651, 58, 59, 452, 308, 702, 204, 710, - /* 1170 */ 710, 56, 56, 57, 57, 57, 57, 650, 55, 55, - /* 1180 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 98, - /* 1190 */ 546, 744, 743, 58, 59, 452, 308, 149, 600, 710, - /* 1200 */ 710, 56, 56, 57, 57, 57, 57, 344, 55, 55, - /* 1210 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 14, - /* 1220 */ 746, 671, 433, 566, 40, 726, 659, 266, 284, 58, - /* 1230 */ 59, 452, 308, 586, 40, 710, 710, 56, 56, 57, - /* 1240 */ 57, 57, 57, 747, 55, 55, 55, 55, 54, 54, - /* 1250 */ 53, 53, 53, 52, 225, 9, 98, 98, 744, 743, - /* 1260 */ 38, 58, 59, 452, 308, 25, 94, 710, 710, 56, - /* 1270 */ 56, 57, 57, 57, 57, 653, 55, 55, 55, 55, - /* 1280 */ 54, 54, 53, 53, 53, 52, 225, 561, 1146, 262, - /* 1290 */ 713, 58, 59, 452, 308, 267, 40, 710, 710, 56, - /* 1300 */ 56, 57, 57, 57, 57, 147, 55, 55, 55, 55, - /* 1310 */ 54, 54, 53, 53, 53, 52, 225, 522, 1144, 746, - /* 1320 */ 614, 98, 744, 743, 58, 59, 452, 308, 723, 98, - /* 1330 */ 710, 710, 56, 56, 57, 57, 57, 57, 146, 55, - /* 1340 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225, - /* 1350 */ 670, 58, 62, 452, 308, 357, 746, 710, 710, 56, - /* 1360 */ 56, 57, 57, 57, 57, 454, 55, 55, 55, 55, - /* 1370 */ 54, 54, 53, 53, 53, 52, 225, 457, 456, 611, - /* 1380 */ 746, 610, 522, 106, 148, 746, 702, 196, 445, 59, - /* 1390 */ 452, 308, 713, 746, 710, 710, 56, 56, 57, 57, - /* 1400 */ 57, 57, 219, 55, 55, 55, 55, 54, 54, 53, - /* 1410 */ 53, 53, 52, 225, 592, 450, 559, 514, 297, 752, - /* 1420 */ 429, 744, 743, 750, 321, 490, 145, 657, 460, 299, - /* 1430 */ 454, 745, 701, 144, 859, 402, 635, 45, 745, 557, - /* 1440 */ 329, 569, 745, 456, 87, 640, 591, 559, 746, 753, - /* 1450 */ 2, 702, 99, 479, 42, 43, 669, 418, 744, 743, - /* 1460 */ 457, 44, 748, 746, 353, 416, 746, 735, 746, 3, - /* 1470 */ 599, 445, 494, 65, 707, 745, 442, 746, 237, 717, - /* 1480 */ 455, 746, 744, 743, 720, 15, 924, 744, 743, 5, - /* 1490 */ 645, 707, 719, 718, 717, 744, 743, 338, 450, 493, - /* 1500 */ 492, 736, 746, 491, 746, 671, 299, 646, 219, 217, - /* 1510 */ 629, 675, 412, 634, 745, 701, 553, 479, 610, 745, - /* 1520 */ 45, 13, 645, 1179, 1179, 707, 463, 746, 347, 10, - /* 1530 */ 707, 746, 698, 716, 454, 746, 662, 42, 43, 381, - /* 1540 */ 632, 232, 627, 457, 44, 495, 1071, 456, 662, 745, - /* 1550 */ 744, 743, 3, 283, 445, 702, 191, 707, 625, 442, - /* 1560 */ 501, 745, 717, 455, 728, 744, 743, 720, 744, 743, - /* 1570 */ 744, 743, 115, 662, 707, 719, 718, 717, 624, 744, - /* 1580 */ 743, 450, 619, 744, 743, 746, 745, 734, 675, 235, - /* 1590 */ 746, 476, 501, 618, 286, 472, 590, 732, 701, 548, - /* 1600 */ 745, 540, 343, 45, 744, 743, 744, 743, 707, 671, - /* 1610 */ 745, 495, 10, 707, 342, 698, 548, 22, 540, 476, - /* 1620 */ 42, 43, 448, 472, 505, 457, 658, 44, 69, 744, - /* 1630 */ 743, 454, 464, 744, 743, 3, 445, 744, 743, 370, - /* 1640 */ 707, 505, 442, 87, 456, 717, 455, 242, 414, 464, - /* 1650 */ 720, 454, 702, 195, 454, 400, 68, 707, 719, 718, - /* 1660 */ 717, 454, 21, 450, 456, 299, 395, 456, 746, 67, - /* 1670 */ 236, 729, 702, 199, 456, 702, 197, 530, 745, 663, - /* 1680 */ 701, 725, 702, 205, 745, 45, 137, 744, 743, 391, - /* 1690 */ 292, 707, 744, 743, 745, 10, 707, 577, 698, 1072, - /* 1700 */ 346, 746, 42, 43, 570, 4, 671, 713, 457, 44, - /* 1710 */ 562, 746, 454, 164, 133, 31, 85, 3, 1074, 445, - /* 1720 */ 83, 30, 707, 29, 442, 456, 671, 717, 455, 671, - /* 1730 */ 28, 454, 720, 702, 203, 715, 671, 454, 746, 707, - /* 1740 */ 719, 718, 717, 454, 456, 341, 450, 675, 745, 746, - /* 1750 */ 456, 82, 702, 206, 454, 733, 456, 339, 702, 210, - /* 1760 */ 81, 454, 541, 701, 702, 244, 447, 456, 45, 542, - /* 1770 */ 744, 743, 372, 707, 456, 702, 309, 10, 707, 745, - /* 1780 */ 698, 664, 702, 202, 660, 42, 43, 671, 731, 270, - /* 1790 */ 457, 536, 44, 230, 745, 454, 529, 745, 531, 149, - /* 1800 */ 3, 445, 745, 744, 743, 707, 671, 442, 456, 713, - /* 1810 */ 717, 455, 671, 744, 743, 720, 702, 194, 671, 655, - /* 1820 */ 712, 454, 707, 719, 718, 717, 454, 89, 450, 671, - /* 1830 */ 523, 264, 745, 457, 456, 128, 671, 11, 261, 456, - /* 1840 */ 744, 743, 702, 180, 445, 701, 76, 702, 171, 160, - /* 1850 */ 45, 744, 743, 654, 169, 504, 707, 120, 481, 356, - /* 1860 */ 10, 707, 454, 698, 480, 103, 746, 42, 43, 462, - /* 1870 */ 671, 450, 596, 746, 44, 456, 216, 269, 642, 219, - /* 1880 */ 746, 268, 3, 702, 179, 234, 93, 707, 701, 442, - /* 1890 */ 745, 332, 744, 455, 212, 749, 671, 720, 331, 454, - /* 1900 */ 158, 671, 454, 739, 707, 719, 718, 717, 737, 258, - /* 1910 */ 42, 43, 456, 507, 256, 456, 738, 44, 503, 157, - /* 1920 */ 702, 193, 745, 702, 198, 3, 459, 745, 88, 713, - /* 1930 */ 707, 392, 442, 155, 18, 717, 455, 671, 707, 454, - /* 1940 */ 720, 454, 10, 707, 458, 698, 746, 707, 719, 718, - /* 1950 */ 717, 105, 456, 250, 456, 227, 746, 454, 142, 421, - /* 1960 */ 702, 327, 702, 326, 249, 153, 316, 730, 744, 743, - /* 1970 */ 456, 745, 745, 225, 671, 744, 743, 671, 702, 325, - /* 1980 */ 454, 707, 744, 743, 109, 10, 707, 313, 698, 243, - /* 1990 */ 454, 315, 156, 456, 622, 159, 454, 649, 87, 51, - /* 2000 */ 104, 702, 178, 456, 626, 35, 454, 700, 242, 456, - /* 2010 */ 745, 702, 100, 641, 671, 20, 671, 702, 177, 456, - /* 2020 */ 303, 299, 304, 454, 301, 454, 520, 702, 176, 430, - /* 2030 */ 454, 713, 671, 746, 745, 317, 456, 154, 456, 302, - /* 2040 */ 454, 39, 677, 456, 702, 174, 702, 173, 744, 743, - /* 2050 */ 432, 702, 192, 456, 454, 671, 345, 288, 744, 743, - /* 2060 */ 587, 702, 172, 746, 454, 671, 746, 456, 699, 454, - /* 2070 */ 745, 671, 746, 48, 330, 702, 200, 456, 439, 254, - /* 2080 */ 70, 671, 456, 499, 560, 702, 201, 238, 223, 252, - /* 2090 */ 702, 184, 745, 496, 597, 454, 746, 454, 671, 435, - /* 2100 */ 671, 454, 745, 675, 117, 671, 746, 745, 456, 118, - /* 2110 */ 456, 359, 454, 746, 456, 671, 702, 183, 702, 182, - /* 2120 */ 746, 417, 702, 181, 713, 456, 414, 454, 746, 671, - /* 2130 */ 454, 621, 454, 702, 185, 744, 743, 454, 746, 671, - /* 2140 */ 456, 746, 454, 456, 671, 456, 746, 141, 702, 188, - /* 2150 */ 456, 702, 101, 702, 187, 456, 746, 612, 702, 186, - /* 2160 */ 454, 746, 565, 702, 190, 744, 743, 454, 744, 743, - /* 2170 */ 671, 420, 671, 456, 744, 743, 671, 528, 746, 405, - /* 2180 */ 456, 702, 189, 746, 456, 607, 556, 671, 702, 175, - /* 2190 */ 578, 746, 702, 74, 746, 558, 746, 606, 744, 743, - /* 2200 */ 348, 282, 671, 745, 290, 671, 275, 671, 744, 743, - /* 2210 */ 552, 603, 671, 602, 745, 744, 743, 671, 601, 745, - /* 2220 */ 547, 576, 744, 743, 515, 246, 713, 518, 323, 335, - /* 2230 */ 744, 743, 366, 575, 506, 671, 583, 584, 745, 468, - /* 2240 */ 744, 743, 671, 744, 743, 745, 671, 574, 744, 743, - /* 2250 */ 136, 573, 745, 564, 86, 453, 295, 276, 744, 743, - /* 2260 */ 322, 135, 390, 744, 743, 385, 263, 502, 745, 745, - /* 2270 */ 745, 114, 134, 221, 467, 469, 260, 251, 745, 745, - /* 2280 */ 744, 743, 247, 500, 274, 744, 743, 672, 373, 745, - /* 2290 */ 745, 248, 388, 744, 743, 745, 744, 743, 744, 743, - /* 2300 */ 27, 132, 555, 113, 745, 84, 131, 130, 163, 497, - /* 2310 */ 90, 380, 379, 539, 545, 111, 129, 489, 367, 519, - /* 2320 */ 110, 127, 364, 80, 362, 126, 79, 125, 124, 78, - /* 2330 */ 77, 676, 123, 122, 26, 477, 336, 23, 475, 108, - /* 2340 */ 66, 107, 661, 471, 121, 465, 305, 170, 693, 689, - /* 2350 */ 679, 291, 451, 598, 399, 666, 207, 551, 656, 272, - /* 2360 */ 544, 386, 318, 711, 688, 7, 220, 33, 678, 585, - /* 2370 */ 306, 389, 449, 75, 595, 589, 588, 616, 615, 87, - /* 2380 */ 1187, 579, 1187, 513, + /* 0 */ 510, 625, 284, 836, 655, 288, 841, 64, 65, 509, + /* 10 */ 339, 626, 501, 795, 795, 62, 62, 63, 63, 63, + /* 20 */ 63, 351, 61, 61, 61, 61, 60, 60, 59, 59, + /* 30 */ 59, 58, 253, 485, 1085, 61, 61, 61, 61, 60, + /* 40 */ 60, 59, 59, 59, 58, 253, 835, 290, 794, 1085, + /* 50 */ 71, 506, 63, 63, 63, 63, 40, 61, 61, 61, + /* 60 */ 61, 60, 60, 59, 59, 59, 58, 253, 805, 635, + /* 70 */ 836, 347, 785, 836, 592, 70, 452, 54, 817, 88, + /* 80 */ 338, 835, 835, 59, 59, 59, 58, 253, 1085, 836, + /* 90 */ 806, 223, 836, 835, 51, 52, 693, 1085, 635, 508, + /* 100 */ 325, 53, 1012, 348, 261, 415, 622, 621, 88, 2, + /* 110 */ 1012, 835, 681, 117, 793, 286, 498, 1012, 324, 807, + /* 120 */ 833, 634, 834, 833, 510, 810, 157, 466, 453, 439, + /* 130 */ 436, 435, 793, 809, 808, 807, 501, 1012, 563, 682, + /* 140 */ 682, 611, 486, 746, 1078, 327, 677, 434, 366, 575, + /* 150 */ 1012, 254, 1012, 1012, 396, 403, 1012, 296, 425, 303, + /* 160 */ 749, 1012, 1012, 1012, 1012, 1012, 793, 274, 456, 793, + /* 170 */ 748, 783, 12, 356, 565, 506, 273, 586, 77, 69, + /* 180 */ 39, 138, 69, 1012, 701, 440, 22, 701, 768, 834, + /* 190 */ 833, 805, 834, 833, 14, 836, 785, 111, 1, 489, + /* 200 */ 798, 54, 702, 804, 835, 702, 587, 589, 834, 833, + /* 210 */ 588, 834, 833, 806, 223, 570, 659, 701, 51, 52, + /* 220 */ 701, 137, 508, 649, 706, 53, 1078, 836, 1029, 1029, + /* 230 */ 21, 412, 386, 2, 1078, 172, 117, 328, 793, 705, + /* 240 */ 498, 1078, 157, 807, 833, 439, 436, 435, 510, 810, + /* 250 */ 392, 75, 443, 188, 421, 250, 793, 809, 808, 807, + /* 260 */ 501, 1078, 784, 434, 1178, 275, 935, 835, 648, 56, + /* 270 */ 455, 366, 687, 686, 1078, 130, 1078, 1078, 174, 121, + /* 280 */ 326, 445, 321, 444, 159, 1078, 1078, 1078, 1078, 811, + /* 290 */ 793, 700, 812, 793, 162, 783, 12, 245, 319, 506, + /* 300 */ 60, 60, 59, 59, 59, 58, 253, 1078, 840, 526, + /* 310 */ 836, 650, 651, 513, 834, 833, 563, 805, 836, 798, + /* 320 */ 785, 717, 805, 23, 611, 54, 527, 526, 158, 257, + /* 330 */ 835, 797, 699, 695, 835, 835, 242, 241, 240, 806, + /* 340 */ 223, 523, 51, 52, 806, 208, 834, 833, 508, 53, + /* 350 */ 1063, 356, 564, 508, 384, 526, 171, 2, 1063, 523, + /* 360 */ 548, 77, 793, 786, 498, 1063, 431, 807, 833, 798, + /* 370 */ 578, 329, 836, 810, 723, 579, 466, 451, 729, 465, + /* 380 */ 793, 809, 808, 807, 835, 1063, 789, 523, 786, 547, + /* 390 */ 546, 388, 788, 545, 502, 475, 497, 366, 1063, 729, + /* 400 */ 1063, 1063, 754, 407, 798, 729, 692, 1160, 1160, 1063, + /* 410 */ 329, 1063, 1063, 76, 793, 635, 117, 793, 516, 783, + /* 420 */ 12, 786, 787, 835, 519, 88, 370, 108, 835, 834, + /* 430 */ 833, 1063, 319, 117, 464, 361, 479, 834, 833, 731, + /* 440 */ 836, 1163, 792, 836, 64, 65, 509, 339, 1160, 1160, + /* 450 */ 795, 795, 62, 62, 63, 63, 63, 63, 781, 61, + /* 460 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253, + /* 470 */ 836, 807, 729, 722, 361, 55, 792, 810, 58, 253, + /* 480 */ 167, 73, 777, 776, 604, 809, 808, 807, 798, 1160, + /* 490 */ 1160, 834, 833, 729, 64, 65, 509, 339, 66, 729, + /* 500 */ 795, 795, 62, 62, 63, 63, 63, 63, 474, 61, + /* 510 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253, + /* 520 */ 836, 770, 836, 798, 712, 771, 64, 65, 509, 339, + /* 530 */ 1160, 1160, 795, 795, 62, 62, 63, 63, 63, 63, + /* 540 */ 765, 61, 61, 61, 61, 60, 60, 59, 59, 59, + /* 550 */ 58, 253, 764, 729, 613, 836, 562, 562, 44, 834, + /* 560 */ 833, 191, 834, 833, 566, 805, 246, 685, 45, 454, + /* 570 */ 482, 365, 1160, 1160, 729, 772, 636, 252, 835, 662, + /* 580 */ 729, 1317, 184, 514, 3, 538, 613, 806, 208, 834, + /* 590 */ 833, 765, 1163, 313, 1163, 661, 508, 393, 835, 357, + /* 600 */ 1269, 742, 792, 764, 539, 540, 835, 1269, 130, 64, + /* 610 */ 65, 509, 339, 1160, 1160, 795, 795, 62, 62, 63, + /* 620 */ 63, 63, 63, 742, 61, 61, 61, 61, 60, 60, + /* 630 */ 59, 59, 59, 58, 253, 818, 792, 769, 158, 834, + /* 640 */ 833, 834, 833, 113, 566, 754, 836, 76, 64, 65, + /* 650 */ 509, 339, 1160, 1160, 795, 795, 62, 62, 63, 63, + /* 660 */ 63, 63, 488, 61, 61, 61, 61, 60, 60, 59, + /* 670 */ 59, 59, 58, 253, 834, 833, 541, 775, 836, 357, + /* 680 */ 1268, 330, 734, 473, 87, 814, 836, 1268, 836, 64, + /* 690 */ 65, 509, 339, 1160, 1160, 795, 795, 62, 62, 63, + /* 700 */ 63, 63, 63, 447, 61, 61, 61, 61, 60, 60, + /* 710 */ 59, 59, 59, 58, 253, 63, 63, 63, 63, 56, + /* 720 */ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58, + /* 730 */ 253, 494, 64, 65, 509, 339, 370, 671, 795, 795, + /* 740 */ 62, 62, 63, 63, 63, 63, 813, 61, 61, 61, + /* 750 */ 61, 60, 60, 59, 59, 59, 58, 253, 811, 1086, + /* 760 */ 571, 812, 190, 488, 309, 834, 833, 312, 591, 64, + /* 770 */ 65, 509, 339, 469, 1086, 795, 795, 62, 62, 63, + /* 780 */ 63, 63, 63, 836, 61, 61, 61, 61, 60, 60, + /* 790 */ 59, 59, 59, 58, 253, 107, 1087, 834, 833, 836, + /* 800 */ 758, 798, 1164, 836, 485, 834, 833, 834, 833, 349, + /* 810 */ 802, 1087, 755, 1086, 78, 836, 468, 835, 64, 65, + /* 820 */ 509, 339, 1086, 571, 795, 795, 62, 62, 63, 63, + /* 830 */ 63, 63, 510, 61, 61, 61, 61, 60, 60, 59, + /* 840 */ 59, 59, 58, 253, 501, 1088, 271, 270, 1214, 836, + /* 850 */ 1087, 78, 603, 493, 791, 64, 65, 509, 339, 1087, + /* 860 */ 1088, 795, 795, 62, 62, 63, 63, 63, 63, 538, + /* 870 */ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58, + /* 880 */ 253, 798, 835, 506, 1167, 777, 776, 20, 539, 398, + /* 890 */ 117, 675, 69, 1022, 580, 581, 409, 701, 337, 1088, + /* 900 */ 78, 753, 834, 833, 785, 391, 780, 779, 1088, 54, + /* 910 */ 8, 835, 167, 576, 745, 702, 805, 620, 834, 833, + /* 920 */ 798, 670, 834, 833, 327, 677, 51, 52, 44, 835, + /* 930 */ 701, 1277, 1277, 53, 834, 833, 390, 112, 806, 223, + /* 940 */ 1229, 2, 1170, 236, 235, 484, 793, 508, 498, 836, + /* 950 */ 282, 807, 833, 1164, 117, 1164, 712, 810, 68, 136, + /* 960 */ 399, 775, 782, 835, 793, 809, 808, 807, 807, 85, + /* 970 */ 714, 836, 835, 504, 810, 466, 467, 42, 576, 775, + /* 980 */ 1277, 1277, 809, 808, 807, 816, 759, 772, 499, 252, + /* 990 */ 86, 19, 767, 643, 442, 832, 366, 470, 793, 111, + /* 1000 */ 798, 793, 830, 783, 12, 27, 64, 65, 509, 339, + /* 1010 */ 836, 831, 795, 795, 62, 62, 63, 63, 63, 63, + /* 1020 */ 836, 61, 61, 61, 61, 60, 60, 59, 59, 59, + /* 1030 */ 58, 253, 50, 1229, 48, 64, 65, 509, 339, 74, + /* 1040 */ 544, 795, 795, 62, 62, 63, 63, 63, 63, 510, + /* 1050 */ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58, + /* 1060 */ 253, 501, 1243, 532, 477, 136, 836, 329, 834, 833, + /* 1070 */ 483, 724, 4, 83, 836, 500, 780, 779, 835, 341, + /* 1080 */ 835, 335, 611, 798, 617, 617, 64, 65, 509, 339, + /* 1090 */ 834, 833, 795, 795, 62, 62, 63, 63, 63, 63, + /* 1100 */ 506, 61, 61, 61, 61, 60, 60, 59, 59, 59, + /* 1110 */ 58, 253, 480, 476, 798, 668, 720, 667, 586, 77, + /* 1120 */ 739, 785, 114, 168, 608, 1172, 54, 532, 6, 834, + /* 1130 */ 833, 265, 310, 756, 836, 744, 311, 481, 615, 834, + /* 1140 */ 833, 78, 608, 51, 52, 835, 1172, 587, 589, 775, + /* 1150 */ 53, 588, 1172, 374, 238, 510, 738, 805, 2, 736, + /* 1160 */ 271, 270, 836, 793, 689, 498, 836, 501, 807, 833, + /* 1170 */ 835, 56, 413, 247, 810, 117, 450, 724, 4, 806, + /* 1180 */ 223, 793, 809, 808, 807, 834, 833, 836, 508, 5, + /* 1190 */ 535, 836, 531, 834, 833, 717, 1172, 414, 836, 777, + /* 1200 */ 776, 729, 798, 537, 1172, 536, 506, 844, 835, 733, + /* 1210 */ 416, 1172, 805, 371, 761, 793, 466, 457, 793, 730, + /* 1220 */ 783, 12, 729, 78, 732, 835, 338, 785, 729, 805, + /* 1230 */ 18, 1172, 54, 798, 806, 118, 395, 366, 597, 835, + /* 1240 */ 718, 786, 835, 508, 1172, 641, 1172, 1172, 549, 51, + /* 1250 */ 52, 806, 118, 834, 833, 1172, 53, 1172, 1172, 737, + /* 1260 */ 508, 317, 17, 305, 2, 381, 786, 259, 111, 793, + /* 1270 */ 837, 498, 666, 713, 807, 833, 835, 1172, 843, 3, + /* 1280 */ 810, 834, 833, 487, 432, 834, 833, 793, 809, 808, + /* 1290 */ 807, 111, 754, 836, 529, 665, 713, 836, 406, 786, + /* 1300 */ 170, 602, 1165, 1277, 1277, 594, 834, 833, 110, 754, + /* 1310 */ 834, 833, 338, 842, 549, 640, 639, 834, 833, 602, + /* 1320 */ 707, 793, 529, 594, 793, 835, 783, 12, 631, 64, + /* 1330 */ 65, 509, 339, 492, 757, 795, 795, 62, 62, 63, + /* 1340 */ 63, 63, 63, 704, 61, 61, 61, 61, 60, 60, + /* 1350 */ 59, 59, 59, 58, 253, 64, 65, 509, 339, 298, + /* 1360 */ 16, 795, 795, 62, 62, 63, 63, 63, 63, 11, + /* 1370 */ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58, + /* 1380 */ 253, 395, 64, 65, 509, 339, 743, 4, 795, 795, + /* 1390 */ 62, 62, 63, 63, 63, 63, 117, 61, 61, 61, + /* 1400 */ 61, 60, 60, 59, 59, 59, 58, 253, 422, 728, + /* 1410 */ 4, 559, 834, 833, 166, 168, 834, 833, 56, 496, + /* 1420 */ 757, 836, 727, 4, 64, 65, 509, 339, 49, 559, + /* 1430 */ 795, 795, 62, 62, 63, 63, 63, 63, 165, 61, + /* 1440 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253, + /* 1450 */ 607, 836, 667, 709, 64, 65, 509, 339, 842, 676, + /* 1460 */ 795, 795, 62, 62, 63, 63, 63, 63, 708, 61, + /* 1470 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253, + /* 1480 */ 164, 46, 725, 4, 64, 65, 509, 339, 163, 674, + /* 1490 */ 795, 795, 62, 62, 63, 63, 63, 63, 696, 61, + /* 1500 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253, + /* 1510 */ 246, 685, 836, 454, 64, 65, 509, 339, 124, 657, + /* 1520 */ 795, 795, 62, 62, 63, 63, 63, 63, 460, 61, + /* 1530 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253, + /* 1540 */ 834, 833, 419, 691, 64, 65, 509, 339, 458, 189, + /* 1550 */ 795, 795, 62, 62, 63, 63, 63, 63, 7, 61, + /* 1560 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253, + /* 1570 */ 834, 833, 726, 4, 64, 65, 509, 339, 690, 316, + /* 1580 */ 795, 795, 62, 62, 63, 63, 63, 63, 15, 61, + /* 1590 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253, + /* 1600 */ 612, 1193, 64, 65, 509, 339, 274, 456, 795, 795, + /* 1610 */ 62, 62, 63, 63, 63, 63, 825, 61, 61, 61, + /* 1620 */ 61, 60, 60, 59, 59, 59, 58, 253, 574, 688, + /* 1630 */ 836, 834, 833, 64, 65, 509, 339, 836, 28, 795, + /* 1640 */ 795, 62, 62, 63, 63, 63, 63, 684, 61, 61, + /* 1650 */ 61, 61, 60, 60, 59, 59, 59, 58, 253, 836, + /* 1660 */ 1244, 64, 65, 509, 339, 683, 836, 795, 795, 62, + /* 1670 */ 62, 63, 63, 63, 63, 510, 61, 61, 61, 61, + /* 1680 */ 60, 60, 59, 59, 59, 58, 253, 501, 1242, 420, + /* 1690 */ 477, 64, 65, 509, 339, 116, 168, 795, 795, 62, + /* 1700 */ 62, 63, 63, 63, 63, 798, 61, 61, 61, 61, + /* 1710 */ 60, 60, 59, 59, 59, 58, 253, 123, 600, 280, + /* 1720 */ 302, 255, 679, 805, 258, 168, 506, 421, 297, 401, + /* 1730 */ 337, 279, 115, 835, 353, 44, 835, 448, 337, 476, + /* 1740 */ 835, 823, 835, 835, 836, 806, 208, 785, 836, 834, + /* 1750 */ 833, 835, 54, 37, 508, 25, 834, 833, 293, 133, + /* 1760 */ 300, 127, 525, 821, 299, 44, 350, 836, 260, 51, + /* 1770 */ 52, 352, 178, 835, 263, 805, 53, 104, 834, 833, + /* 1780 */ 78, 510, 122, 441, 2, 834, 833, 333, 835, 793, + /* 1790 */ 525, 498, 805, 501, 807, 833, 477, 806, 223, 805, + /* 1800 */ 810, 713, 256, 754, 568, 835, 508, 793, 809, 808, + /* 1810 */ 807, 358, 835, 556, 806, 223, 167, 354, 759, 176, + /* 1820 */ 956, 806, 118, 508, 798, 78, 766, 623, 647, 836, + /* 1830 */ 508, 36, 506, 713, 267, 836, 638, 331, 438, 717, + /* 1840 */ 731, 793, 82, 247, 793, 478, 783, 12, 703, 836, + /* 1850 */ 318, 266, 835, 785, 433, 366, 836, 367, 54, 584, + /* 1860 */ 712, 836, 332, 834, 833, 81, 634, 834, 833, 24, + /* 1870 */ 169, 838, 366, 160, 449, 51, 52, 80, 826, 754, + /* 1880 */ 264, 517, 53, 824, 835, 289, 834, 833, 156, 561, + /* 1890 */ 2, 835, 324, 397, 717, 793, 835, 498, 835, 517, + /* 1900 */ 807, 833, 698, 616, 10, 510, 810, 835, 429, 380, + /* 1910 */ 187, 152, 822, 793, 809, 808, 807, 501, 247, 101, + /* 1920 */ 99, 64, 38, 509, 339, 835, 35, 795, 795, 62, + /* 1930 */ 62, 63, 63, 63, 63, 836, 61, 61, 61, 61, + /* 1940 */ 60, 60, 59, 59, 59, 58, 253, 793, 834, 833, + /* 1950 */ 793, 713, 783, 12, 834, 833, 506, 34, 33, 836, + /* 1960 */ 819, 805, 32, 555, 379, 98, 805, 644, 834, 833, + /* 1970 */ 552, 836, 805, 835, 835, 834, 833, 785, 717, 835, + /* 1980 */ 834, 833, 54, 806, 223, 835, 378, 697, 806, 223, + /* 1990 */ 836, 835, 508, 376, 806, 118, 555, 508, 694, 51, + /* 2000 */ 52, 97, 653, 508, 836, 805, 53, 595, 596, 590, + /* 2010 */ 585, 510, 410, 337, 2, 656, 552, 247, 835, 793, + /* 2020 */ 387, 498, 805, 501, 807, 833, 835, 806, 223, 836, + /* 2030 */ 810, 583, 105, 168, 805, 835, 508, 793, 809, 808, + /* 2040 */ 807, 366, 577, 377, 806, 118, 490, 835, 408, 336, + /* 2050 */ 147, 383, 754, 508, 834, 833, 806, 216, 295, 13, + /* 2060 */ 815, 292, 506, 181, 471, 508, 192, 624, 558, 92, + /* 2070 */ 534, 793, 619, 835, 793, 533, 783, 12, 834, 833, + /* 2080 */ 394, 337, 287, 785, 836, 366, 557, 803, 54, 139, + /* 2090 */ 834, 833, 515, 375, 835, 835, 90, 247, 790, 262, + /* 2100 */ 835, 759, 754, 582, 243, 51, 52, 109, 836, 834, + /* 2110 */ 833, 835, 53, 503, 754, 239, 369, 510, 368, 382, + /* 2120 */ 2, 315, 610, 834, 833, 793, 835, 498, 805, 501, + /* 2130 */ 807, 833, 839, 179, 805, 180, 810, 829, 827, 805, + /* 2140 */ 828, 835, 719, 793, 809, 808, 807, 835, 834, 833, + /* 2150 */ 806, 194, 835, 836, 177, 835, 806, 204, 836, 508, + /* 2160 */ 512, 806, 226, 285, 554, 508, 430, 553, 506, 759, + /* 2170 */ 508, 511, 715, 836, 805, 614, 835, 793, 836, 805, + /* 2180 */ 793, 72, 783, 12, 836, 835, 103, 835, 836, 785, + /* 2190 */ 175, 820, 835, 836, 54, 801, 806, 224, 800, 173, + /* 2200 */ 710, 806, 232, 834, 833, 508, 274, 836, 754, 836, + /* 2210 */ 508, 51, 52, 835, 754, 343, 606, 23, 53, 754, + /* 2220 */ 43, 569, 472, 510, 342, 805, 2, 834, 833, 67, + /* 2230 */ 836, 793, 186, 498, 253, 501, 807, 833, 835, 799, + /* 2240 */ 805, 836, 810, 752, 495, 805, 84, 806, 231, 793, + /* 2250 */ 809, 808, 807, 835, 754, 251, 508, 283, 835, 754, + /* 2260 */ 269, 550, 806, 233, 268, 47, 334, 806, 237, 57, + /* 2270 */ 835, 508, 834, 833, 506, 751, 508, 834, 833, 488, + /* 2280 */ 750, 161, 836, 793, 747, 601, 793, 389, 783, 12, + /* 2290 */ 1168, 741, 834, 833, 835, 785, 244, 834, 833, 134, + /* 2300 */ 54, 520, 463, 834, 833, 754, 756, 834, 833, 678, + /* 2310 */ 522, 735, 834, 833, 135, 835, 572, 51, 52, 459, + /* 2320 */ 754, 320, 835, 654, 53, 754, 834, 833, 834, 833, + /* 2330 */ 456, 805, 2, 1170, 835, 680, 835, 793, 551, 498, + /* 2340 */ 160, 560, 807, 833, 835, 663, 669, 510, 810, 834, + /* 2350 */ 833, 542, 664, 806, 272, 793, 809, 808, 807, 501, + /* 2360 */ 834, 833, 508, 446, 65, 509, 339, 385, 322, 795, + /* 2370 */ 795, 62, 62, 63, 63, 63, 63, 805, 61, 61, + /* 2380 */ 61, 61, 60, 60, 59, 59, 59, 58, 253, 793, + /* 2390 */ 835, 660, 793, 276, 783, 12, 760, 372, 506, 806, + /* 2400 */ 340, 834, 833, 632, 659, 805, 835, 716, 508, 314, + /* 2410 */ 307, 754, 805, 404, 658, 637, 835, 618, 835, 785, + /* 2420 */ 630, 360, 835, 835, 54, 835, 835, 806, 230, 155, + /* 2430 */ 629, 521, 628, 346, 806, 203, 508, 805, 507, 627, + /* 2440 */ 154, 51, 52, 508, 835, 308, 835, 359, 53, 30, + /* 2450 */ 835, 835, 102, 510, 428, 132, 2, 754, 835, 806, + /* 2460 */ 221, 793, 423, 498, 153, 501, 807, 833, 508, 249, + /* 2470 */ 294, 805, 810, 291, 281, 835, 805, 411, 277, 793, + /* 2480 */ 809, 808, 807, 835, 835, 754, 835, 835, 278, 835, + /* 2490 */ 306, 835, 754, 806, 225, 426, 31, 151, 806, 364, + /* 2500 */ 609, 835, 508, 131, 506, 100, 150, 508, 605, 149, + /* 2510 */ 185, 106, 418, 793, 599, 148, 793, 754, 783, 12, + /* 2520 */ 417, 593, 129, 128, 405, 785, 402, 146, 573, 96, + /* 2530 */ 54, 145, 400, 95, 144, 94, 143, 93, 142, 30, + /* 2540 */ 543, 141, 29, 530, 518, 26, 126, 51, 52, 373, + /* 2550 */ 528, 754, 524, 805, 53, 125, 754, 140, 805, 193, + /* 2560 */ 79, 778, 2, 344, 774, 763, 835, 793, 721, 498, + /* 2570 */ 491, 835, 834, 833, 711, 806, 363, 183, 810, 323, + /* 2580 */ 806, 362, 182, 655, 508, 793, 809, 808, 807, 508, + /* 2590 */ 437, 234, 598, 304, 424, 509, 339, 301, 355, 795, + /* 2600 */ 795, 62, 62, 63, 63, 63, 63, 9, 61, 61, + /* 2610 */ 61, 61, 60, 60, 59, 59, 59, 58, 253, 793, + /* 2620 */ 796, 773, 793, 762, 783, 12, 642, 805, 248, 345, + /* 2630 */ 427, 41, 505, 754, 805, 740, 652, 91, 754, 567, + /* 2640 */ 835, 805, 646, 78, 673, 645, 836, 835, 672, 806, + /* 2650 */ 220, 1318, 633, 805, 835, 1318, 806, 206, 508, 1318, + /* 2660 */ 805, 1318, 1318, 806, 219, 508, 835, 805, 1318, 1318, + /* 2670 */ 1318, 1318, 508, 835, 1318, 806, 218, 1318, 1318, 805, + /* 2680 */ 835, 805, 806, 205, 508, 1318, 1318, 1318, 1318, 806, + /* 2690 */ 202, 508, 835, 805, 835, 1318, 1318, 1318, 508, 1318, + /* 2700 */ 1318, 806, 119, 806, 201, 1318, 835, 754, 1318, 1318, + /* 2710 */ 508, 1318, 508, 1318, 754, 806, 199, 1318, 1318, 805, + /* 2720 */ 1318, 754, 1318, 1318, 508, 1318, 1318, 1318, 1318, 1318, + /* 2730 */ 1318, 1318, 835, 754, 1318, 1318, 1318, 1318, 1318, 1318, + /* 2740 */ 754, 806, 227, 1318, 1318, 1318, 1318, 754, 1318, 1318, + /* 2750 */ 508, 1318, 1318, 805, 1318, 1318, 805, 1318, 805, 754, + /* 2760 */ 1318, 754, 1318, 1318, 1318, 1318, 835, 1318, 1318, 835, + /* 2770 */ 1318, 835, 805, 754, 1318, 806, 229, 1318, 806, 222, + /* 2780 */ 806, 228, 1318, 1318, 508, 835, 1318, 508, 805, 508, + /* 2790 */ 1318, 1318, 1318, 1318, 806, 217, 1318, 1318, 1318, 754, + /* 2800 */ 805, 835, 1318, 508, 805, 1318, 1318, 1318, 1318, 1318, + /* 2810 */ 806, 214, 1318, 835, 1318, 1318, 1318, 835, 1318, 508, + /* 2820 */ 1318, 1318, 806, 198, 805, 1318, 806, 197, 1318, 1318, + /* 2830 */ 1318, 508, 1318, 754, 1318, 508, 754, 835, 754, 1318, + /* 2840 */ 805, 1318, 1318, 1318, 1318, 1318, 806, 196, 1318, 1318, + /* 2850 */ 1318, 1318, 754, 835, 805, 508, 805, 1318, 1318, 1318, + /* 2860 */ 805, 1318, 806, 195, 1318, 1318, 1318, 835, 754, 835, + /* 2870 */ 1318, 508, 1318, 835, 1318, 805, 806, 207, 806, 212, + /* 2880 */ 754, 1318, 806, 211, 754, 508, 1318, 508, 835, 1318, + /* 2890 */ 805, 508, 805, 1318, 805, 1318, 1318, 806, 120, 1318, + /* 2900 */ 1318, 1318, 1318, 835, 754, 835, 508, 835, 1318, 1318, + /* 2910 */ 1318, 1318, 806, 210, 806, 209, 806, 215, 1318, 805, + /* 2920 */ 754, 508, 1318, 508, 1318, 508, 1318, 1318, 1318, 1318, + /* 2930 */ 1318, 1318, 835, 1318, 754, 1318, 754, 1318, 1318, 1318, + /* 2940 */ 754, 806, 213, 1318, 1318, 1318, 1318, 1318, 1318, 1318, + /* 2950 */ 508, 1318, 1318, 805, 1318, 754, 805, 1318, 1318, 1318, + /* 2960 */ 1318, 1318, 1318, 1318, 1318, 1318, 835, 1318, 1318, 835, + /* 2970 */ 754, 1318, 754, 1318, 754, 806, 200, 1318, 806, 89, + /* 2980 */ 1318, 1318, 1318, 1318, 508, 1318, 1318, 462, 1318, 1318, + /* 2990 */ 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 754, + /* 3000 */ 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, + /* 3010 */ 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, + /* 3020 */ 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, + /* 3030 */ 1318, 1318, 1318, 754, 1318, 1318, 754, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 4, 81, 82, 83, 84, 85, 86, 87, 51, 4, - /* 10 */ 53, 15, 72, 73, 74, 75, 76, 77, 78, 79, - /* 20 */ 80, 81, 82, 83, 84, 85, 86, 87, 193, 33, - /* 30 */ 34, 96, 4, 98, 72, 73, 74, 75, 42, 77, - /* 40 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - /* 50 */ 97, 55, 95, 104, 4, 59, 107, 104, 62, 63, - /* 60 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - /* 70 */ 74, 75, 237, 77, 78, 79, 80, 81, 82, 83, - /* 80 */ 84, 85, 86, 87, 88, 4, 83, 84, 85, 86, - /* 90 */ 87, 4, 96, 144, 145, 106, 15, 101, 89, 103, - /* 100 */ 111, 96, 106, 107, 111, 179, 101, 111, 119, 120, - /* 110 */ 121, 106, 107, 187, 118, 119, 120, 121, 192, 4, - /* 120 */ 179, 97, 129, 42, 96, 179, 200, 201, 104, 101, - /* 130 */ 134, 135, 97, 192, 106, 107, 126, 179, 192, 104, - /* 140 */ 59, 200, 201, 197, 198, 64, 118, 221, 152, 23, - /* 150 */ 192, 101, 156, 157, 193, 159, 106, 107, 200, 201, - /* 160 */ 234, 133, 81, 82, 83, 155, 179, 117, 118, 88, - /* 170 */ 89, 137, 144, 145, 140, 234, 235, 96, 97, 192, - /* 180 */ 254, 55, 101, 4, 103, 104, 109, 106, 107, 112, - /* 190 */ 113, 114, 111, 106, 107, 254, 146, 4, 237, 118, - /* 200 */ 119, 120, 121, 116, 123, 179, 34, 130, 15, 263, - /* 210 */ 264, 96, 254, 64, 256, 89, 255, 136, 192, 138, - /* 220 */ 139, 106, 107, 142, 4, 227, 200, 201, 147, 148, - /* 230 */ 149, 150, 151, 152, 236, 42, 87, 156, 157, 93, - /* 240 */ 159, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 250 */ 86, 87, 59, 30, 4, 179, 4, 64, 109, 110, - /* 260 */ 111, 112, 113, 114, 115, 97, 279, 152, 192, 124, - /* 270 */ 125, 126, 246, 104, 81, 82, 200, 201, 129, 4, - /* 280 */ 254, 88, 89, 4, 105, 106, 107, 64, 109, 96, - /* 290 */ 97, 112, 113, 114, 101, 123, 103, 104, 61, 106, - /* 300 */ 107, 110, 111, 187, 111, 136, 104, 138, 139, 130, - /* 310 */ 234, 118, 119, 120, 121, 50, 123, 4, 61, 54, - /* 320 */ 100, 101, 124, 125, 126, 4, 106, 107, 15, 136, - /* 330 */ 254, 138, 139, 96, 97, 83, 220, 221, 59, 96, - /* 340 */ 147, 148, 149, 150, 142, 152, 96, 154, 5, 156, - /* 350 */ 157, 101, 159, 96, 97, 42, 106, 107, 106, 107, - /* 360 */ 81, 82, 7, 247, 248, 4, 11, 251, 118, 26, - /* 370 */ 118, 28, 59, 86, 87, 96, 101, 64, 113, 33, - /* 380 */ 34, 106, 107, 133, 179, 106, 270, 32, 45, 97, - /* 390 */ 111, 48, 187, 118, 81, 82, 104, 192, 119, 120, - /* 400 */ 121, 88, 89, 4, 152, 200, 201, 58, 19, 96, - /* 410 */ 97, 61, 66, 67, 101, 4, 103, 104, 29, 106, - /* 420 */ 107, 146, 45, 99, 111, 19, 221, 106, 163, 108, - /* 430 */ 24, 118, 119, 120, 121, 29, 123, 179, 190, 234, - /* 440 */ 235, 193, 194, 195, 33, 34, 96, 97, 179, 136, - /* 450 */ 192, 138, 139, 179, 104, 197, 198, 96, 96, 254, - /* 460 */ 147, 192, 149, 150, 97, 152, 192, 106, 107, 156, - /* 470 */ 157, 104, 159, 62, 63, 64, 65, 66, 67, 68, - /* 480 */ 69, 70, 71, 72, 73, 74, 75, 255, 77, 78, - /* 490 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 100, - /* 500 */ 101, 124, 125, 126, 272, 106, 107, 238, 239, 98, - /* 510 */ 179, 134, 135, 152, 99, 184, 154, 106, 169, 188, - /* 520 */ 189, 263, 264, 192, 33, 34, 62, 63, 64, 65, - /* 530 */ 99, 40, 68, 69, 70, 71, 72, 73, 74, 75, - /* 540 */ 83, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 550 */ 86, 87, 141, 62, 63, 64, 65, 66, 67, 68, - /* 560 */ 69, 70, 71, 72, 73, 74, 75, 181, 77, 78, - /* 570 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 9, - /* 580 */ 193, 194, 195, 179, 172, 173, 174, 175, 81, 82, - /* 590 */ 20, 97, 188, 189, 137, 104, 192, 140, 104, 62, - /* 600 */ 63, 64, 65, 33, 34, 68, 69, 70, 71, 72, - /* 610 */ 73, 74, 75, 104, 77, 78, 79, 80, 81, 82, - /* 620 */ 83, 84, 85, 86, 87, 161, 119, 120, 99, 33, - /* 630 */ 34, 122, 62, 63, 64, 65, 66, 67, 68, 69, - /* 640 */ 70, 71, 72, 73, 74, 75, 260, 77, 78, 79, - /* 650 */ 80, 81, 82, 83, 84, 85, 86, 87, 62, 63, - /* 660 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - /* 670 */ 74, 75, 4, 77, 78, 79, 80, 81, 82, 83, - /* 680 */ 84, 85, 86, 87, 33, 34, 64, 65, 119, 120, - /* 690 */ 68, 69, 70, 71, 72, 73, 74, 75, 161, 77, - /* 700 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - /* 710 */ 4, 43, 111, 62, 63, 64, 65, 66, 67, 68, - /* 720 */ 69, 70, 71, 72, 73, 74, 75, 23, 77, 78, - /* 730 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 62, - /* 740 */ 63, 64, 65, 4, 96, 68, 69, 70, 71, 72, - /* 750 */ 73, 74, 75, 104, 77, 78, 79, 80, 81, 82, - /* 760 */ 83, 84, 85, 86, 87, 193, 89, 51, 100, 53, - /* 770 */ 61, 160, 97, 162, 106, 107, 62, 63, 64, 65, - /* 780 */ 4, 104, 68, 69, 70, 71, 72, 73, 74, 75, - /* 790 */ 104, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 800 */ 86, 87, 96, 89, 98, 96, 97, 222, 223, 237, - /* 810 */ 225, 95, 106, 104, 62, 63, 64, 65, 104, 71, - /* 820 */ 68, 69, 70, 71, 72, 73, 74, 75, 151, 77, - /* 830 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - /* 840 */ 101, 89, 179, 97, 96, 106, 107, 141, 12, 98, - /* 850 */ 104, 62, 63, 64, 65, 192, 104, 68, 69, 70, - /* 860 */ 71, 72, 73, 74, 75, 151, 77, 78, 79, 80, - /* 870 */ 81, 82, 83, 84, 85, 86, 87, 101, 89, 163, - /* 880 */ 275, 276, 106, 107, 179, 146, 193, 196, 197, 198, - /* 890 */ 196, 197, 198, 104, 118, 4, 97, 192, 62, 63, - /* 900 */ 64, 65, 38, 151, 68, 69, 70, 71, 72, 73, - /* 910 */ 74, 75, 104, 77, 78, 79, 80, 81, 82, 83, - /* 920 */ 84, 85, 86, 87, 261, 89, 62, 63, 64, 65, - /* 930 */ 237, 4, 68, 69, 70, 71, 72, 73, 74, 75, - /* 940 */ 151, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 950 */ 86, 87, 4, 89, 249, 264, 97, 187, 264, 151, - /* 960 */ 207, 208, 96, 15, 62, 63, 64, 65, 215, 34, - /* 970 */ 68, 69, 70, 71, 72, 73, 74, 75, 4, 77, - /* 980 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - /* 990 */ 42, 221, 4, 123, 4, 97, 105, 106, 107, 64, - /* 1000 */ 98, 179, 179, 55, 179, 97, 179, 59, 81, 82, - /* 1010 */ 0, 179, 64, 143, 192, 192, 96, 192, 179, 192, - /* 1020 */ 188, 189, 200, 201, 192, 200, 201, 187, 179, 81, - /* 1030 */ 82, 192, 183, 106, 107, 25, 88, 110, 97, 200, - /* 1040 */ 201, 192, 5, 211, 96, 213, 119, 120, 4, 101, - /* 1050 */ 123, 103, 125, 96, 106, 107, 234, 235, 123, 111, - /* 1060 */ 220, 221, 55, 26, 129, 28, 118, 119, 120, 121, - /* 1070 */ 97, 246, 245, 234, 235, 101, 254, 104, 97, 254, - /* 1080 */ 106, 107, 134, 135, 179, 48, 96, 247, 248, 4, - /* 1090 */ 179, 251, 187, 254, 106, 107, 106, 192, 179, 89, - /* 1100 */ 152, 97, 279, 192, 156, 157, 118, 159, 104, 269, - /* 1110 */ 270, 192, 62, 63, 64, 65, 98, 110, 68, 69, - /* 1120 */ 70, 71, 72, 73, 74, 75, 221, 77, 78, 79, - /* 1130 */ 80, 81, 82, 83, 84, 85, 86, 87, 164, 96, - /* 1140 */ 152, 179, 9, 238, 239, 179, 179, 97, 179, 183, - /* 1150 */ 106, 107, 183, 20, 192, 187, 4, 97, 192, 192, - /* 1160 */ 249, 192, 118, 62, 63, 64, 65, 200, 201, 68, - /* 1170 */ 69, 70, 71, 72, 73, 74, 75, 133, 77, 78, - /* 1180 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 221, - /* 1190 */ 97, 106, 107, 62, 63, 64, 65, 104, 97, 68, - /* 1200 */ 69, 70, 71, 72, 73, 74, 75, 245, 77, 78, - /* 1210 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 13, - /* 1220 */ 4, 254, 187, 187, 104, 199, 141, 97, 97, 62, - /* 1230 */ 63, 64, 65, 207, 104, 68, 69, 70, 71, 72, - /* 1240 */ 73, 74, 75, 91, 77, 78, 79, 80, 81, 82, - /* 1250 */ 83, 84, 85, 86, 87, 13, 221, 221, 106, 107, - /* 1260 */ 104, 62, 63, 64, 65, 98, 96, 68, 69, 70, - /* 1270 */ 71, 72, 73, 74, 75, 30, 77, 78, 79, 80, - /* 1280 */ 81, 82, 83, 84, 85, 86, 87, 187, 89, 97, - /* 1290 */ 4, 62, 63, 64, 65, 187, 104, 68, 69, 70, - /* 1300 */ 71, 72, 73, 74, 75, 13, 77, 78, 79, 80, - /* 1310 */ 81, 82, 83, 84, 85, 86, 87, 101, 89, 4, - /* 1320 */ 192, 221, 106, 107, 62, 63, 64, 65, 200, 221, - /* 1330 */ 68, 69, 70, 71, 72, 73, 74, 75, 97, 77, - /* 1340 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - /* 1350 */ 203, 62, 63, 64, 65, 25, 4, 68, 69, 70, - /* 1360 */ 71, 72, 73, 74, 75, 179, 77, 78, 79, 80, - /* 1370 */ 81, 82, 83, 84, 85, 86, 87, 4, 192, 216, - /* 1380 */ 4, 218, 166, 99, 98, 4, 200, 201, 15, 63, - /* 1390 */ 64, 65, 106, 4, 68, 69, 70, 71, 72, 73, - /* 1400 */ 74, 75, 255, 77, 78, 79, 80, 81, 82, 83, - /* 1410 */ 84, 85, 86, 87, 14, 42, 101, 97, 179, 89, - /* 1420 */ 234, 106, 107, 171, 104, 179, 97, 141, 176, 179, - /* 1430 */ 179, 192, 59, 97, 97, 35, 83, 64, 192, 187, - /* 1440 */ 254, 104, 192, 192, 55, 144, 46, 132, 4, 174, - /* 1450 */ 175, 200, 201, 101, 81, 82, 203, 99, 106, 107, - /* 1460 */ 4, 88, 179, 4, 214, 104, 4, 91, 4, 96, - /* 1470 */ 97, 15, 220, 221, 101, 192, 103, 4, 239, 106, - /* 1480 */ 107, 4, 106, 107, 111, 96, 97, 106, 107, 96, - /* 1490 */ 101, 118, 119, 120, 121, 106, 107, 246, 42, 247, - /* 1500 */ 248, 179, 4, 251, 4, 254, 179, 118, 255, 222, - /* 1510 */ 223, 261, 225, 97, 192, 59, 216, 165, 218, 192, - /* 1520 */ 64, 96, 133, 134, 135, 152, 274, 4, 128, 156, - /* 1530 */ 157, 4, 159, 152, 179, 4, 179, 81, 82, 252, - /* 1540 */ 137, 214, 97, 4, 88, 101, 160, 192, 179, 192, - /* 1550 */ 106, 107, 96, 97, 15, 200, 201, 101, 97, 103, - /* 1560 */ 101, 192, 106, 107, 102, 106, 107, 111, 106, 107, - /* 1570 */ 106, 107, 17, 179, 118, 119, 120, 121, 97, 106, - /* 1580 */ 107, 42, 97, 106, 107, 4, 192, 179, 261, 38, - /* 1590 */ 4, 118, 133, 97, 97, 118, 6, 179, 59, 101, - /* 1600 */ 192, 101, 245, 64, 106, 107, 106, 107, 152, 254, - /* 1610 */ 192, 167, 156, 157, 245, 159, 118, 96, 118, 146, - /* 1620 */ 81, 82, 158, 146, 101, 4, 193, 88, 96, 106, - /* 1630 */ 107, 179, 101, 106, 107, 96, 15, 106, 107, 245, - /* 1640 */ 101, 118, 103, 55, 192, 106, 107, 134, 135, 118, - /* 1650 */ 111, 179, 200, 201, 179, 38, 96, 118, 119, 120, - /* 1660 */ 121, 179, 96, 42, 192, 179, 38, 192, 4, 96, - /* 1670 */ 237, 179, 200, 201, 192, 200, 201, 89, 192, 152, - /* 1680 */ 59, 179, 200, 201, 192, 64, 115, 106, 107, 64, - /* 1690 */ 129, 152, 106, 107, 192, 156, 157, 116, 159, 160, - /* 1700 */ 214, 4, 81, 82, 118, 12, 254, 4, 4, 88, - /* 1710 */ 103, 4, 179, 98, 123, 71, 142, 96, 97, 15, - /* 1720 */ 128, 71, 101, 71, 103, 192, 254, 106, 107, 254, - /* 1730 */ 71, 179, 111, 200, 201, 179, 254, 179, 4, 118, - /* 1740 */ 119, 120, 121, 179, 192, 17, 42, 261, 192, 4, - /* 1750 */ 192, 153, 200, 201, 179, 91, 192, 154, 200, 201, - /* 1760 */ 128, 179, 135, 59, 200, 201, 179, 192, 64, 155, - /* 1770 */ 106, 107, 22, 152, 192, 200, 201, 156, 157, 192, - /* 1780 */ 159, 179, 200, 201, 179, 81, 82, 254, 91, 179, - /* 1790 */ 4, 89, 88, 183, 192, 179, 47, 192, 89, 104, - /* 1800 */ 96, 15, 192, 106, 107, 101, 254, 103, 192, 106, - /* 1810 */ 106, 107, 254, 106, 107, 111, 200, 201, 254, 179, - /* 1820 */ 117, 179, 118, 119, 120, 121, 179, 39, 42, 254, - /* 1830 */ 39, 163, 192, 4, 192, 123, 254, 96, 95, 192, - /* 1840 */ 106, 107, 200, 201, 15, 59, 95, 200, 201, 143, - /* 1850 */ 64, 106, 107, 146, 96, 103, 152, 93, 97, 37, - /* 1860 */ 156, 157, 179, 159, 97, 191, 4, 81, 82, 36, - /* 1870 */ 254, 42, 127, 4, 88, 192, 240, 179, 144, 255, - /* 1880 */ 4, 183, 96, 200, 201, 206, 206, 101, 59, 103, - /* 1890 */ 192, 278, 106, 107, 276, 178, 254, 111, 278, 179, - /* 1900 */ 90, 254, 179, 178, 118, 119, 120, 121, 49, 179, - /* 1910 */ 81, 82, 192, 183, 179, 192, 178, 88, 183, 180, - /* 1920 */ 200, 201, 192, 200, 201, 96, 178, 192, 182, 4, - /* 1930 */ 101, 60, 103, 180, 104, 106, 107, 254, 152, 179, - /* 1940 */ 111, 179, 156, 157, 185, 159, 4, 118, 119, 120, - /* 1950 */ 121, 8, 192, 10, 192, 12, 4, 179, 179, 179, - /* 1960 */ 200, 201, 200, 201, 21, 56, 23, 186, 106, 107, - /* 1970 */ 192, 192, 192, 87, 254, 106, 107, 254, 200, 201, - /* 1980 */ 179, 152, 106, 107, 41, 156, 157, 44, 159, 257, - /* 1990 */ 179, 48, 49, 192, 118, 52, 179, 179, 55, 255, - /* 2000 */ 57, 200, 201, 192, 64, 160, 179, 223, 134, 192, - /* 2010 */ 192, 200, 201, 144, 254, 151, 254, 200, 201, 192, - /* 2020 */ 230, 179, 229, 179, 232, 179, 164, 200, 201, 148, - /* 2030 */ 179, 106, 254, 4, 192, 92, 192, 94, 192, 231, - /* 2040 */ 179, 149, 117, 192, 200, 201, 200, 201, 106, 107, - /* 2050 */ 147, 200, 201, 192, 179, 254, 214, 179, 106, 107, - /* 2060 */ 118, 200, 201, 4, 179, 254, 4, 192, 233, 179, - /* 2070 */ 192, 254, 4, 150, 131, 200, 201, 192, 205, 179, - /* 2080 */ 96, 254, 192, 183, 132, 200, 201, 262, 87, 179, - /* 2090 */ 200, 201, 192, 183, 179, 179, 4, 179, 254, 205, - /* 2100 */ 254, 179, 192, 261, 99, 254, 4, 192, 192, 243, - /* 2110 */ 192, 168, 179, 4, 192, 254, 200, 201, 200, 201, - /* 2120 */ 4, 225, 200, 201, 4, 192, 135, 179, 4, 254, - /* 2130 */ 179, 243, 179, 200, 201, 106, 107, 179, 4, 254, - /* 2140 */ 192, 4, 179, 192, 254, 192, 4, 99, 200, 201, - /* 2150 */ 192, 200, 201, 200, 201, 192, 4, 202, 200, 201, - /* 2160 */ 179, 4, 100, 200, 201, 106, 107, 179, 106, 107, - /* 2170 */ 254, 179, 254, 192, 106, 107, 254, 118, 4, 123, - /* 2180 */ 192, 200, 201, 4, 192, 202, 118, 254, 200, 201, - /* 2190 */ 179, 4, 200, 201, 4, 166, 4, 210, 106, 107, - /* 2200 */ 31, 179, 254, 192, 202, 254, 179, 254, 106, 107, - /* 2210 */ 118, 204, 254, 122, 192, 106, 107, 254, 202, 192, - /* 2220 */ 118, 202, 106, 107, 100, 179, 106, 118, 205, 183, - /* 2230 */ 106, 107, 179, 202, 118, 254, 210, 117, 192, 179, - /* 2240 */ 106, 107, 254, 106, 107, 192, 254, 202, 106, 107, - /* 2250 */ 99, 202, 192, 243, 182, 179, 179, 179, 106, 107, - /* 2260 */ 205, 99, 205, 106, 107, 179, 179, 133, 192, 192, - /* 2270 */ 192, 182, 99, 243, 100, 118, 179, 179, 192, 192, - /* 2280 */ 106, 107, 179, 146, 267, 106, 107, 100, 27, 192, - /* 2290 */ 192, 179, 268, 106, 107, 192, 106, 107, 106, 107, - /* 2300 */ 160, 99, 229, 62, 192, 217, 99, 99, 250, 167, - /* 2310 */ 96, 123, 229, 217, 253, 182, 99, 165, 243, 229, - /* 2320 */ 182, 99, 243, 219, 60, 99, 219, 99, 99, 219, - /* 2330 */ 219, 152, 99, 99, 271, 18, 243, 271, 243, 99, - /* 2340 */ 273, 99, 152, 243, 99, 16, 228, 226, 264, 264, - /* 2350 */ 203, 203, 258, 208, 204, 242, 212, 229, 244, 244, - /* 2360 */ 229, 244, 177, 193, 193, 226, 265, 259, 193, 193, - /* 2370 */ 224, 266, 218, 241, 209, 209, 209, 200, 200, 55, - /* 2380 */ 280, 213, 280, 277, + /* 0 */ 4, 228, 67, 4, 231, 70, 106, 79, 80, 81, + /* 10 */ 82, 238, 16, 85, 86, 87, 88, 89, 90, 91, + /* 20 */ 92, 110, 94, 95, 96, 97, 98, 99, 100, 101, + /* 30 */ 102, 103, 104, 199, 106, 94, 95, 96, 97, 98, + /* 40 */ 99, 100, 101, 102, 103, 104, 212, 112, 129, 121, + /* 50 */ 88, 55, 89, 90, 91, 92, 93, 94, 95, 96, + /* 60 */ 97, 98, 99, 100, 101, 102, 103, 104, 199, 199, + /* 70 */ 4, 114, 76, 4, 59, 113, 207, 81, 208, 209, + /* 80 */ 199, 212, 212, 100, 101, 102, 103, 104, 160, 4, + /* 90 */ 221, 222, 4, 212, 98, 99, 100, 169, 199, 230, + /* 100 */ 129, 105, 106, 204, 234, 24, 236, 208, 209, 113, + /* 110 */ 114, 212, 285, 244, 118, 180, 120, 121, 147, 123, + /* 120 */ 124, 122, 123, 124, 4, 129, 127, 258, 259, 130, + /* 130 */ 131, 132, 136, 137, 138, 139, 16, 141, 78, 42, + /* 140 */ 43, 207, 308, 309, 24, 318, 319, 148, 279, 65, + /* 150 */ 154, 113, 156, 157, 75, 71, 160, 142, 143, 144, + /* 160 */ 31, 165, 166, 167, 168, 169, 170, 152, 153, 173, + /* 170 */ 41, 175, 176, 113, 114, 55, 250, 243, 244, 113, + /* 180 */ 83, 84, 113, 187, 118, 34, 260, 118, 307, 123, + /* 190 */ 124, 199, 123, 124, 113, 4, 76, 121, 113, 207, + /* 200 */ 4, 81, 136, 118, 212, 136, 272, 273, 123, 124, + /* 210 */ 276, 123, 124, 221, 222, 131, 140, 151, 98, 99, + /* 220 */ 151, 116, 230, 15, 136, 105, 106, 4, 162, 163, + /* 230 */ 296, 297, 81, 113, 114, 116, 244, 121, 118, 151, + /* 240 */ 120, 121, 127, 123, 124, 130, 131, 132, 4, 129, + /* 250 */ 258, 113, 44, 115, 199, 104, 136, 137, 138, 139, + /* 260 */ 16, 141, 114, 148, 180, 186, 115, 212, 60, 121, + /* 270 */ 154, 279, 156, 157, 154, 121, 156, 157, 127, 128, + /* 280 */ 129, 130, 131, 132, 133, 165, 166, 167, 168, 155, + /* 290 */ 170, 121, 158, 173, 124, 175, 176, 113, 147, 55, + /* 300 */ 98, 99, 100, 101, 102, 103, 104, 187, 191, 118, + /* 310 */ 4, 128, 129, 196, 123, 124, 78, 199, 4, 123, + /* 320 */ 76, 199, 199, 169, 207, 81, 135, 136, 43, 274, + /* 330 */ 212, 135, 162, 163, 212, 212, 142, 143, 144, 221, + /* 340 */ 222, 118, 98, 99, 221, 222, 123, 124, 230, 105, + /* 350 */ 106, 113, 114, 230, 146, 164, 121, 113, 114, 136, + /* 360 */ 243, 244, 118, 5, 120, 121, 81, 123, 124, 4, + /* 370 */ 7, 199, 4, 129, 121, 12, 258, 259, 35, 207, + /* 380 */ 136, 137, 138, 139, 212, 141, 114, 164, 30, 272, + /* 390 */ 273, 269, 114, 276, 36, 52, 207, 279, 154, 56, + /* 400 */ 156, 157, 279, 40, 4, 62, 100, 42, 43, 165, + /* 410 */ 199, 167, 168, 160, 170, 199, 244, 173, 301, 175, + /* 420 */ 176, 63, 114, 212, 208, 209, 141, 113, 212, 123, + /* 430 */ 124, 187, 147, 244, 262, 263, 313, 123, 124, 316, + /* 440 */ 4, 26, 136, 4, 79, 80, 81, 82, 83, 84, + /* 450 */ 85, 86, 87, 88, 89, 90, 91, 92, 114, 94, + /* 460 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + /* 470 */ 4, 123, 35, 262, 263, 113, 170, 129, 103, 104, + /* 480 */ 115, 113, 137, 138, 170, 137, 138, 139, 123, 42, + /* 490 */ 43, 123, 124, 56, 79, 80, 81, 82, 51, 62, + /* 500 */ 85, 86, 87, 88, 89, 90, 91, 92, 165, 94, + /* 510 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + /* 520 */ 4, 114, 4, 123, 159, 125, 79, 80, 81, 82, + /* 530 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + /* 540 */ 10, 94, 95, 96, 97, 98, 99, 100, 101, 102, + /* 550 */ 103, 104, 22, 35, 118, 4, 117, 118, 121, 123, + /* 560 */ 124, 113, 123, 124, 78, 199, 245, 246, 121, 248, + /* 570 */ 52, 210, 42, 43, 56, 214, 215, 216, 212, 21, + /* 580 */ 62, 192, 193, 194, 195, 199, 150, 221, 222, 123, + /* 590 */ 124, 10, 177, 199, 179, 37, 230, 203, 212, 113, + /* 600 */ 114, 32, 136, 22, 218, 219, 212, 121, 121, 79, + /* 610 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + /* 620 */ 90, 91, 92, 54, 94, 95, 96, 97, 98, 99, + /* 630 */ 100, 101, 102, 103, 104, 119, 170, 114, 43, 123, + /* 640 */ 124, 123, 124, 121, 78, 279, 4, 160, 79, 80, + /* 650 */ 81, 82, 42, 43, 85, 86, 87, 88, 89, 90, + /* 660 */ 91, 92, 165, 94, 95, 96, 97, 98, 99, 100, + /* 670 */ 101, 102, 103, 104, 123, 124, 290, 291, 4, 113, + /* 680 */ 114, 315, 316, 165, 187, 134, 4, 121, 4, 79, + /* 690 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + /* 700 */ 90, 91, 92, 100, 94, 95, 96, 97, 98, 99, + /* 710 */ 100, 101, 102, 103, 104, 89, 90, 91, 92, 121, + /* 720 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + /* 730 */ 104, 115, 79, 80, 81, 82, 141, 212, 85, 86, + /* 740 */ 87, 88, 89, 90, 91, 92, 221, 94, 95, 96, + /* 750 */ 97, 98, 99, 100, 101, 102, 103, 104, 155, 106, + /* 760 */ 118, 158, 113, 165, 67, 123, 124, 70, 26, 79, + /* 770 */ 80, 81, 82, 38, 121, 85, 86, 87, 88, 89, + /* 780 */ 90, 91, 92, 4, 94, 95, 96, 97, 98, 99, + /* 790 */ 100, 101, 102, 103, 104, 113, 106, 123, 124, 4, + /* 800 */ 114, 4, 26, 4, 199, 123, 124, 123, 124, 112, + /* 810 */ 136, 121, 26, 160, 72, 4, 81, 212, 79, 80, + /* 820 */ 81, 82, 169, 181, 85, 86, 87, 88, 89, 90, + /* 830 */ 91, 92, 4, 94, 95, 96, 97, 98, 99, 100, + /* 840 */ 101, 102, 103, 104, 16, 106, 98, 99, 106, 4, + /* 850 */ 160, 72, 170, 207, 170, 79, 80, 81, 82, 169, + /* 860 */ 121, 85, 86, 87, 88, 89, 90, 91, 92, 199, + /* 870 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + /* 880 */ 104, 4, 212, 55, 177, 137, 138, 14, 218, 219, + /* 890 */ 244, 285, 113, 114, 142, 143, 144, 118, 199, 160, + /* 900 */ 72, 114, 123, 124, 76, 217, 218, 219, 169, 81, + /* 910 */ 113, 212, 115, 118, 309, 136, 199, 207, 123, 124, + /* 920 */ 123, 76, 123, 124, 318, 319, 98, 99, 121, 212, + /* 930 */ 151, 152, 153, 105, 123, 124, 237, 121, 221, 222, + /* 940 */ 13, 113, 114, 98, 99, 115, 118, 230, 120, 4, + /* 950 */ 199, 123, 124, 177, 244, 179, 159, 129, 113, 199, + /* 960 */ 290, 291, 114, 212, 136, 137, 138, 139, 123, 121, + /* 970 */ 159, 4, 212, 174, 129, 258, 259, 141, 183, 291, + /* 980 */ 152, 153, 137, 138, 139, 220, 287, 214, 215, 216, + /* 990 */ 113, 14, 114, 228, 229, 21, 279, 161, 170, 121, + /* 1000 */ 123, 173, 28, 175, 176, 49, 79, 80, 81, 82, + /* 1010 */ 4, 37, 85, 86, 87, 88, 89, 90, 91, 92, + /* 1020 */ 4, 94, 95, 96, 97, 98, 99, 100, 101, 102, + /* 1030 */ 103, 104, 177, 106, 179, 79, 80, 81, 82, 113, + /* 1040 */ 289, 85, 86, 87, 88, 89, 90, 91, 92, 4, + /* 1050 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + /* 1060 */ 104, 16, 106, 118, 19, 199, 4, 199, 123, 124, + /* 1070 */ 310, 311, 312, 57, 4, 217, 218, 219, 212, 255, + /* 1080 */ 212, 257, 207, 4, 117, 118, 79, 80, 81, 82, + /* 1090 */ 123, 124, 85, 86, 87, 88, 89, 90, 91, 92, + /* 1100 */ 55, 94, 95, 96, 97, 98, 99, 100, 101, 102, + /* 1110 */ 103, 104, 19, 68, 4, 239, 114, 241, 243, 244, + /* 1120 */ 46, 76, 115, 121, 118, 35, 81, 182, 83, 123, + /* 1130 */ 124, 263, 199, 117, 4, 114, 203, 44, 207, 123, + /* 1140 */ 124, 72, 136, 98, 99, 212, 56, 272, 273, 291, + /* 1150 */ 105, 276, 62, 302, 303, 4, 61, 199, 113, 66, + /* 1160 */ 98, 99, 4, 118, 114, 120, 4, 16, 123, 124, + /* 1170 */ 212, 121, 297, 280, 129, 244, 310, 311, 312, 221, + /* 1180 */ 222, 136, 137, 138, 139, 123, 124, 4, 230, 80, + /* 1190 */ 128, 4, 299, 123, 124, 199, 106, 128, 4, 137, + /* 1200 */ 138, 35, 123, 141, 114, 143, 55, 0, 212, 32, + /* 1210 */ 144, 121, 199, 201, 135, 170, 258, 259, 173, 54, + /* 1220 */ 175, 176, 56, 72, 61, 212, 199, 76, 62, 199, + /* 1230 */ 14, 141, 81, 123, 221, 222, 29, 279, 172, 212, + /* 1240 */ 170, 5, 212, 230, 154, 135, 156, 157, 118, 98, + /* 1250 */ 99, 221, 222, 123, 124, 165, 105, 167, 168, 166, + /* 1260 */ 230, 114, 14, 199, 113, 269, 30, 203, 121, 118, + /* 1270 */ 108, 120, 36, 214, 123, 124, 212, 187, 194, 195, + /* 1280 */ 129, 123, 124, 270, 114, 123, 124, 136, 137, 138, + /* 1290 */ 139, 121, 279, 4, 136, 59, 214, 4, 286, 63, + /* 1300 */ 270, 118, 26, 152, 153, 118, 123, 124, 113, 279, + /* 1310 */ 123, 124, 199, 106, 184, 212, 213, 123, 124, 136, + /* 1320 */ 261, 170, 164, 136, 173, 212, 175, 176, 134, 79, + /* 1330 */ 80, 81, 82, 306, 307, 85, 86, 87, 88, 89, + /* 1340 */ 90, 91, 92, 261, 94, 95, 96, 97, 98, 99, + /* 1350 */ 100, 101, 102, 103, 104, 79, 80, 81, 82, 207, + /* 1360 */ 14, 85, 86, 87, 88, 89, 90, 91, 92, 14, + /* 1370 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + /* 1380 */ 104, 29, 79, 80, 81, 82, 311, 312, 85, 86, + /* 1390 */ 87, 88, 89, 90, 91, 92, 244, 94, 95, 96, + /* 1400 */ 97, 98, 99, 100, 101, 102, 103, 104, 114, 311, + /* 1410 */ 312, 118, 123, 124, 14, 121, 123, 124, 121, 306, + /* 1420 */ 307, 4, 311, 312, 79, 80, 81, 82, 178, 136, + /* 1430 */ 85, 86, 87, 88, 89, 90, 91, 92, 114, 94, + /* 1440 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + /* 1450 */ 239, 4, 241, 164, 79, 80, 81, 82, 106, 114, + /* 1460 */ 85, 86, 87, 88, 89, 90, 91, 92, 38, 94, + /* 1470 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + /* 1480 */ 114, 178, 311, 312, 79, 80, 81, 82, 114, 114, + /* 1490 */ 85, 86, 87, 88, 89, 90, 91, 92, 162, 94, + /* 1500 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + /* 1510 */ 245, 246, 4, 248, 79, 80, 81, 82, 116, 114, + /* 1520 */ 85, 86, 87, 88, 89, 90, 91, 92, 116, 94, + /* 1530 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + /* 1540 */ 123, 124, 277, 100, 79, 80, 81, 82, 121, 114, + /* 1550 */ 85, 86, 87, 88, 89, 90, 91, 92, 113, 94, + /* 1560 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + /* 1570 */ 123, 124, 311, 312, 79, 80, 81, 82, 114, 114, + /* 1580 */ 85, 86, 87, 88, 89, 90, 91, 92, 113, 94, + /* 1590 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + /* 1600 */ 183, 106, 79, 80, 81, 82, 152, 153, 85, 86, + /* 1610 */ 87, 88, 89, 90, 91, 92, 108, 94, 95, 96, + /* 1620 */ 97, 98, 99, 100, 101, 102, 103, 104, 181, 155, + /* 1630 */ 4, 123, 124, 79, 80, 81, 82, 4, 115, 85, + /* 1640 */ 86, 87, 88, 89, 90, 91, 92, 114, 94, 95, + /* 1650 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 4, + /* 1660 */ 106, 79, 80, 81, 82, 114, 4, 85, 86, 87, + /* 1670 */ 88, 89, 90, 91, 92, 4, 94, 95, 96, 97, + /* 1680 */ 98, 99, 100, 101, 102, 103, 104, 16, 106, 114, + /* 1690 */ 19, 79, 80, 81, 82, 114, 121, 85, 86, 87, + /* 1700 */ 88, 89, 90, 91, 92, 4, 94, 95, 96, 97, + /* 1710 */ 98, 99, 100, 101, 102, 103, 104, 9, 114, 11, + /* 1720 */ 199, 13, 114, 199, 203, 121, 55, 199, 114, 199, + /* 1730 */ 199, 23, 114, 212, 26, 121, 212, 113, 199, 68, + /* 1740 */ 212, 108, 212, 212, 4, 221, 222, 76, 4, 123, + /* 1750 */ 124, 212, 81, 169, 230, 113, 123, 124, 114, 18, + /* 1760 */ 199, 53, 136, 108, 203, 121, 58, 4, 237, 98, + /* 1770 */ 99, 63, 64, 212, 49, 199, 105, 69, 123, 124, + /* 1780 */ 72, 4, 74, 115, 113, 123, 124, 224, 212, 118, + /* 1790 */ 164, 120, 199, 16, 123, 124, 19, 221, 222, 199, + /* 1800 */ 129, 214, 274, 279, 114, 212, 230, 136, 137, 138, + /* 1810 */ 139, 121, 212, 151, 221, 222, 115, 109, 287, 111, + /* 1820 */ 114, 221, 222, 230, 123, 72, 287, 121, 6, 4, + /* 1830 */ 230, 113, 55, 214, 258, 4, 8, 313, 49, 199, + /* 1840 */ 316, 170, 113, 280, 173, 68, 175, 176, 261, 4, + /* 1850 */ 114, 258, 212, 76, 49, 279, 4, 149, 81, 106, + /* 1860 */ 159, 4, 224, 123, 124, 113, 122, 123, 124, 113, + /* 1870 */ 270, 199, 279, 188, 189, 98, 99, 113, 199, 279, + /* 1880 */ 261, 118, 105, 199, 212, 199, 123, 124, 133, 203, + /* 1890 */ 113, 212, 147, 185, 199, 118, 212, 120, 212, 136, + /* 1900 */ 123, 124, 162, 120, 13, 4, 129, 212, 81, 269, + /* 1910 */ 115, 141, 199, 136, 137, 138, 139, 16, 280, 160, + /* 1920 */ 146, 79, 80, 81, 82, 212, 88, 85, 86, 87, + /* 1930 */ 88, 89, 90, 91, 92, 4, 94, 95, 96, 97, + /* 1940 */ 98, 99, 100, 101, 102, 103, 104, 170, 123, 124, + /* 1950 */ 173, 214, 175, 176, 123, 124, 55, 88, 88, 4, + /* 1960 */ 199, 199, 88, 118, 269, 171, 199, 136, 123, 124, + /* 1970 */ 118, 4, 199, 212, 212, 123, 124, 76, 199, 212, + /* 1980 */ 123, 124, 81, 221, 222, 212, 18, 162, 221, 222, + /* 1990 */ 4, 212, 230, 24, 221, 222, 151, 230, 261, 98, + /* 2000 */ 99, 146, 145, 230, 4, 199, 105, 153, 172, 106, + /* 2010 */ 106, 4, 25, 199, 113, 114, 164, 280, 212, 118, + /* 2020 */ 258, 120, 199, 16, 123, 124, 212, 221, 222, 4, + /* 2030 */ 129, 61, 50, 121, 199, 212, 230, 136, 137, 138, + /* 2040 */ 139, 279, 50, 270, 221, 222, 279, 212, 269, 282, + /* 2050 */ 141, 237, 279, 230, 123, 124, 221, 222, 180, 113, + /* 2060 */ 199, 112, 55, 161, 258, 230, 113, 136, 120, 112, + /* 2070 */ 114, 170, 117, 212, 173, 114, 175, 176, 123, 124, + /* 2080 */ 48, 199, 199, 76, 4, 279, 203, 199, 81, 110, + /* 2090 */ 123, 124, 47, 270, 212, 212, 211, 280, 199, 227, + /* 2100 */ 212, 287, 279, 136, 264, 98, 99, 227, 4, 123, + /* 2110 */ 124, 212, 105, 199, 279, 303, 305, 4, 305, 237, + /* 2120 */ 113, 114, 136, 123, 124, 118, 212, 120, 199, 16, + /* 2130 */ 123, 124, 198, 200, 199, 107, 129, 198, 64, 199, + /* 2140 */ 198, 212, 199, 136, 137, 138, 139, 212, 123, 124, + /* 2150 */ 221, 222, 212, 4, 200, 212, 221, 222, 4, 230, + /* 2160 */ 198, 221, 222, 199, 164, 230, 77, 203, 55, 287, + /* 2170 */ 230, 205, 199, 4, 199, 150, 212, 170, 4, 199, + /* 2180 */ 173, 121, 175, 176, 4, 212, 202, 212, 4, 76, + /* 2190 */ 73, 206, 212, 4, 81, 267, 221, 222, 246, 116, + /* 2200 */ 199, 221, 222, 123, 124, 230, 152, 4, 279, 4, + /* 2210 */ 230, 98, 99, 212, 279, 252, 136, 169, 105, 279, + /* 2220 */ 167, 117, 166, 4, 253, 199, 113, 123, 124, 168, + /* 2230 */ 4, 118, 254, 120, 104, 16, 123, 124, 212, 256, + /* 2240 */ 199, 4, 129, 81, 226, 199, 113, 221, 222, 136, + /* 2250 */ 137, 138, 139, 212, 279, 104, 230, 199, 212, 279, + /* 2260 */ 288, 203, 221, 222, 283, 177, 255, 221, 222, 280, + /* 2270 */ 212, 230, 123, 124, 55, 256, 230, 123, 124, 165, + /* 2280 */ 271, 199, 4, 170, 271, 136, 173, 45, 175, 176, + /* 2290 */ 177, 314, 123, 124, 212, 76, 27, 123, 124, 116, + /* 2300 */ 81, 117, 199, 123, 124, 279, 117, 123, 124, 199, + /* 2310 */ 136, 314, 123, 124, 267, 212, 136, 98, 99, 248, + /* 2320 */ 279, 199, 212, 199, 105, 279, 123, 124, 123, 124, + /* 2330 */ 153, 199, 113, 114, 212, 319, 212, 118, 184, 120, + /* 2340 */ 188, 136, 123, 124, 212, 233, 223, 4, 129, 123, + /* 2350 */ 124, 182, 223, 221, 222, 136, 137, 138, 139, 16, + /* 2360 */ 123, 124, 230, 141, 80, 81, 82, 39, 223, 85, + /* 2370 */ 86, 87, 88, 89, 90, 91, 92, 199, 94, 95, + /* 2380 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 170, + /* 2390 */ 212, 225, 173, 199, 175, 176, 170, 203, 55, 221, + /* 2400 */ 222, 123, 124, 199, 140, 199, 212, 170, 230, 199, + /* 2410 */ 199, 279, 199, 199, 223, 233, 212, 267, 212, 76, + /* 2420 */ 223, 226, 212, 212, 81, 212, 212, 221, 222, 116, + /* 2430 */ 223, 199, 223, 199, 221, 222, 230, 199, 199, 223, + /* 2440 */ 116, 98, 99, 230, 212, 199, 212, 226, 105, 171, + /* 2450 */ 212, 212, 202, 4, 226, 202, 113, 279, 212, 221, + /* 2460 */ 222, 118, 199, 120, 116, 16, 123, 124, 230, 267, + /* 2470 */ 199, 199, 129, 199, 199, 212, 199, 33, 199, 136, + /* 2480 */ 137, 138, 139, 212, 212, 279, 212, 212, 199, 212, + /* 2490 */ 294, 212, 279, 221, 222, 295, 177, 116, 221, 222, + /* 2500 */ 252, 212, 230, 79, 55, 240, 116, 230, 252, 116, + /* 2510 */ 275, 113, 141, 170, 278, 116, 173, 279, 175, 176, + /* 2520 */ 252, 240, 202, 202, 267, 76, 267, 116, 252, 242, + /* 2530 */ 81, 116, 77, 242, 116, 242, 116, 242, 116, 171, + /* 2540 */ 289, 116, 298, 20, 17, 298, 116, 98, 99, 267, + /* 2550 */ 267, 279, 267, 199, 105, 116, 279, 116, 199, 249, + /* 2560 */ 300, 291, 113, 251, 291, 224, 212, 118, 266, 120, + /* 2570 */ 284, 212, 123, 124, 268, 221, 222, 255, 129, 224, + /* 2580 */ 221, 222, 255, 231, 230, 136, 137, 138, 139, 230, + /* 2590 */ 225, 235, 252, 268, 268, 81, 82, 251, 197, 85, + /* 2600 */ 86, 87, 88, 89, 90, 91, 92, 249, 94, 95, + /* 2610 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 170, + /* 2620 */ 214, 214, 173, 214, 175, 176, 214, 199, 292, 247, + /* 2630 */ 293, 281, 241, 279, 199, 317, 232, 265, 279, 304, + /* 2640 */ 212, 199, 232, 72, 221, 232, 4, 212, 221, 221, + /* 2650 */ 222, 320, 236, 199, 212, 320, 221, 222, 230, 320, + /* 2660 */ 199, 320, 320, 221, 222, 230, 212, 199, 320, 320, + /* 2670 */ 320, 320, 230, 212, 320, 221, 222, 320, 320, 199, + /* 2680 */ 212, 199, 221, 222, 230, 320, 320, 320, 320, 221, + /* 2690 */ 222, 230, 212, 199, 212, 320, 320, 320, 230, 320, + /* 2700 */ 320, 221, 222, 221, 222, 320, 212, 279, 320, 320, + /* 2710 */ 230, 320, 230, 320, 279, 221, 222, 320, 320, 199, + /* 2720 */ 320, 279, 320, 320, 230, 320, 320, 320, 320, 320, + /* 2730 */ 320, 320, 212, 279, 320, 320, 320, 320, 320, 320, + /* 2740 */ 279, 221, 222, 320, 320, 320, 320, 279, 320, 320, + /* 2750 */ 230, 320, 320, 199, 320, 320, 199, 320, 199, 279, + /* 2760 */ 320, 279, 320, 320, 320, 320, 212, 320, 320, 212, + /* 2770 */ 320, 212, 199, 279, 320, 221, 222, 320, 221, 222, + /* 2780 */ 221, 222, 320, 320, 230, 212, 320, 230, 199, 230, + /* 2790 */ 320, 320, 320, 320, 221, 222, 320, 320, 320, 279, + /* 2800 */ 199, 212, 320, 230, 199, 320, 320, 320, 320, 320, + /* 2810 */ 221, 222, 320, 212, 320, 320, 320, 212, 320, 230, + /* 2820 */ 320, 320, 221, 222, 199, 320, 221, 222, 320, 320, + /* 2830 */ 320, 230, 320, 279, 320, 230, 279, 212, 279, 320, + /* 2840 */ 199, 320, 320, 320, 320, 320, 221, 222, 320, 320, + /* 2850 */ 320, 320, 279, 212, 199, 230, 199, 320, 320, 320, + /* 2860 */ 199, 320, 221, 222, 320, 320, 320, 212, 279, 212, + /* 2870 */ 320, 230, 320, 212, 320, 199, 221, 222, 221, 222, + /* 2880 */ 279, 320, 221, 222, 279, 230, 320, 230, 212, 320, + /* 2890 */ 199, 230, 199, 320, 199, 320, 320, 221, 222, 320, + /* 2900 */ 320, 320, 320, 212, 279, 212, 230, 212, 320, 320, + /* 2910 */ 320, 320, 221, 222, 221, 222, 221, 222, 320, 199, + /* 2920 */ 279, 230, 320, 230, 320, 230, 320, 320, 320, 320, + /* 2930 */ 320, 320, 212, 320, 279, 320, 279, 320, 320, 320, + /* 2940 */ 279, 221, 222, 320, 320, 320, 320, 320, 320, 320, + /* 2950 */ 230, 320, 320, 199, 320, 279, 199, 320, 320, 320, + /* 2960 */ 320, 320, 320, 320, 320, 320, 212, 320, 320, 212, + /* 2970 */ 279, 320, 279, 320, 279, 221, 222, 320, 221, 222, + /* 2980 */ 320, 320, 320, 320, 230, 320, 320, 230, 320, 320, + /* 2990 */ 320, 320, 320, 320, 320, 320, 320, 320, 320, 279, + /* 3000 */ 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, + /* 3010 */ 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, + /* 3020 */ 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, + /* 3030 */ 320, 320, 320, 279, 320, 320, 279, }; -#define YY_SHIFT_USE_DFLT (-81) -#define YY_SHIFT_COUNT (460) -#define YY_SHIFT_MIN (-80) -#define YY_SHIFT_MAX (2329) +#define YY_SHIFT_USE_DFLT (-101) +#define YY_SHIFT_COUNT (513) +#define YY_SHIFT_MIN (-100) +#define YY_SHIFT_MAX (2642) static const short yy_shift_ofst[] = { - /* 0 */ 1330, -4, 1943, 948, 1588, 1621, 1621, 1621, 126, 313, - /* 10 */ 1539, 1704, 1704, 1704, 1704, 1389, 927, 927, 179, 81, - /* 20 */ 193, 1456, 1373, 1704, 1704, 1704, 1704, 1704, 1704, 1704, - /* 30 */ 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, - /* 40 */ 1786, 1704, 1704, 1704, 1704, 1786, 1704, 1704, 1704, 1704, - /* 50 */ 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, - /* 60 */ 1704, 1704, 1829, 891, 28, 377, 891, 2179, 2179, 2179, - /* 70 */ 2179, 507, 507, 321, 411, 250, 1531, 1444, 739, 1459, - /* 80 */ 1523, 361, 1500, 361, 1498, 776, 1315, 668, 399, 2190, - /* 90 */ 2190, 2190, 2190, 935, 2190, 2187, 2179, 321, 1513, 570, - /* 100 */ 570, 864, 279, 149, 50, 275, 252, 1477, 1473, 1352, - /* 110 */ 220, 974, 115, 343, 1216, 343, 5, 1044, 706, 988, - /* 120 */ 2174, 2157, 2152, 2142, 2137, 2134, 2116, 2124, 2109, 1862, - /* 130 */ 2102, 2092, 2068, 2059, 2029, 1952, 2062, 1586, 1581, 1745, - /* 140 */ 1942, 1876, 1869, 1734, 1286, 1286, 1286, 1707, 1085, 1527, - /* 150 */ 1464, 1381, 87, 1462, 265, 1697, 1664, 1376, 1152, 2192, - /* 160 */ 2192, 2192, 1010, 1007, 2324, 2324, 2324, 2324, 2324, -81, - /* 170 */ -81, 491, 651, 651, 651, 651, 651, 651, 651, 651, - /* 180 */ 651, 789, 752, 714, 677, 836, 1229, 1199, 1167, 1131, - /* 190 */ 1101, 1050, 537, 902, 464, 1289, 1262, 1326, 622, 622, - /* 200 */ -60, -38, -38, -38, -38, 164, -80, 77, -11, -11, - /* 210 */ 3, 709, 350, 1400, 1400, 1400, -51, 169, 1037, 346, - /* 220 */ 198, 355, 2120, 1925, 990, 1703, 457, 406, 808, 808, - /* 230 */ 223, 223, 509, 1337, 172, 1133, 223, 870, 1133, 569, - /* 240 */ 569, 202, 34, 611, 287, 2329, 2245, 2242, 2240, 2317, - /* 250 */ 2317, 2234, 2233, 2264, 2229, 2264, 2228, 2264, 2226, 2264, - /* 260 */ 2222, 1871, 1864, 2217, 1871, 2241, 1864, 2188, 2214, 2208, - /* 270 */ 2207, 2241, 1864, 2202, 2140, 2261, 2173, 1871, 2162, 1984, - /* 280 */ 1871, 2151, 1984, 2056, 2056, 2056, 2056, 2169, 1984, 2056, - /* 290 */ 2091, 2056, 2169, 2056, 2056, 2048, 1991, 2005, 1984, 2001, - /* 300 */ 1984, 1923, 1903, 1892, 1881, 1864, 1874, 1845, 1940, 1886, - /* 310 */ 1909, 1830, 1871, 1859, 1859, 1810, 1810, 1810, 1810, -81, - /* 320 */ -81, -81, -81, -81, -81, -81, -81, -81, -81, 596, - /* 330 */ 716, 257, 237, 145, -43, 349, 748, 1320, 1192, 10, - /* 340 */ 1130, 362, 1093, 1004, 973, 746, 494, 191, 389, -7, - /* 350 */ 367, 292, 35, 24, -47, -65, 1833, 1822, 1764, 1751, - /* 360 */ 1767, 1761, 1752, 1758, 1706, 1743, 1741, 1712, 1668, 1791, - /* 370 */ 1695, 1788, 1749, 1750, 1709, 1702, 1627, 1614, 1632, 1603, - /* 380 */ 1728, 1598, 1659, 1652, 1650, 1644, 1592, 1574, 1693, 1591, - /* 390 */ 1615, 1607, 1625, 1561, 1571, 1573, 1628, 1566, 1560, 1497, - /* 400 */ 1532, 1617, 1590, 1521, 1551, 1555, 1496, 1485, 1481, 1461, - /* 410 */ 1386, 1445, 1361, 1403, 1425, 1416, 1393, 1361, 1353, 1358, - /* 420 */ 1284, 1301, 1336, 1329, 1156, 1241, 1245, 1292, 1170, 1156, - /* 430 */ 1242, 1120, 1206, 1060, 1043, 1018, 686, 981, 957, 751, - /* 440 */ 686, 941, 920, 908, 898, 866, 859, 799, 675, 649, - /* 450 */ 648, 704, 601, 529, 431, 415, 324, 243, 168, 146, - /* 460 */ 9, + /* 0 */ 1352, 828, 1151, 1708, 1045, 1777, 1671, 2219, 2219, 2219, + /* 10 */ 1753, 244, 2113, 2343, 2343, 2343, 2343, 2343, 2343, 2449, + /* 20 */ 2343, 742, -4, 120, 2007, 1901, 2343, 2343, 2343, 2343, + /* 30 */ 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, + /* 40 */ 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, + /* 50 */ 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, + /* 60 */ 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 779, + /* 70 */ 1062, 1062, -1, 518, 518, 1744, 66, 15, 1016, 1744, + /* 80 */ 2226, 2226, 2226, 2189, 2226, 748, 748, 2203, 400, 365, + /* 90 */ 151, 69, 1763, 1130, 1852, 1845, 1293, 682, 1187, 682, + /* 100 */ 1183, 1006, 436, 967, 2278, 2237, 2237, 2237, 2237, 285, + /* 110 */ 2237, 2226, 2203, 2203, 400, 1685, 1685, 1454, 530, 530, + /* 120 */ 956, 845, 191, 223, 306, 1626, 1158, 945, 439, 642, + /* 130 */ 314, 1236, 795, 1236, 88, 797, 343, 466, 85, 2184, + /* 140 */ 2174, 2169, 2154, 2000, 1662, 2205, 2104, 2180, 1447, 2149, + /* 150 */ 2080, 1986, 1967, 1417, 2025, 1955, 1931, 1194, 1857, 1831, + /* 160 */ 368, 1825, 1740, 1701, 1701, 1701, 1289, 811, 1070, 437, + /* 170 */ 437, 799, 684, 674, 551, 516, 84, 1655, 1633, 1508, + /* 180 */ 1162, 2203, 1166, 1166, 1207, 1069, 497, 2571, 2571, 2642, + /* 190 */ 2571, 2571, -101, -101, 447, 739, 690, 653, -72, 610, + /* 200 */ 610, 610, 610, 610, 610, 776, 415, 927, 569, 1582, + /* 210 */ 1554, 1523, 1495, 1465, 1435, 1405, 1375, 1345, 1303, 1276, + /* 220 */ 1250, 1007, 1842, 1612, 2284, 2514, 2514, -37, 626, 626, + /* 230 */ 626, 626, -59, 202, 115, 348, 348, -17, 566, 486, + /* 240 */ 208, 208, 208, 170, 1093, 358, 116, 97, 752, 363, + /* 250 */ 1110, 1079, 877, 196, 603, 974, 154, 487, 735, 735, + /* 260 */ 76, 1706, 595, 581, 735, 836, 598, 598, 855, 581, + /* 270 */ 345, 345, 375, 253, 134, 2527, 2441, 2439, 2430, 2523, + /* 280 */ 2523, 2425, 2368, 2422, 2455, 2420, 2455, 2418, 2455, 2415, + /* 290 */ 2455, 2411, 2089, 2048, 2399, 2089, 2424, 2048, 2371, 2398, + /* 300 */ 2393, 2048, 2390, 2424, 2048, 2381, 2319, 2444, 2348, 2089, + /* 310 */ 2324, 2133, 2089, 2313, 2133, 2222, 2222, 2222, 2222, 2328, + /* 320 */ 2133, 2222, 2264, 2222, 2328, 2222, 2222, 2152, 2177, 2183, + /* 330 */ 2269, 2269, 2242, 2242, 2061, 2114, 2088, 2151, 2133, 2162, + /* 340 */ 2130, 2061, 2053, 2056, 2048, 2054, 2083, 2117, 2060, 2089, + /* 350 */ 2074, 2074, 2028, 2028, 2028, 2028, -101, -101, -101, -101, + /* 360 */ -101, -101, -101, -101, -101, -101, 1090, -65, 238, 60, + /* 370 */ 194, 697, 79, -38, 1690, 1644, 1066, 1614, 81, 1604, + /* 380 */ 1575, 1294, 1170, 1147, 183, 558, -29, 1050, 1002, 129, + /* 390 */ 878, 848, 148, 138, 2045, 2032, 1979, 1957, 1961, 1956, + /* 400 */ 1948, 1953, 1902, 1949, 1946, 1909, 1878, 1992, 1912, 1982, + /* 410 */ 1970, 1987, 1904, 1903, 1854, 1836, 1855, 1969, 1968, 1794, + /* 420 */ 1874, 1870, 1869, 1838, 1774, 1759, 1891, 1770, 1795, 1783, + /* 430 */ 1827, 1745, 1755, 1764, 1805, 1756, 1752, 1736, 1729, 1789, + /* 440 */ 1828, 1718, 1668, 1822, 1642, 1725, 1741, 1618, 1584, 1624, + /* 450 */ 1608, 1581, 1551, 1533, 1427, 1474, 1475, 1464, 1445, 1427, + /* 460 */ 1443, 1412, 1402, 1336, 1374, 1366, 1297, 1324, 1430, 1400, + /* 470 */ 1195, 1297, 1355, 1346, 1248, 1216, 1165, 1163, 1177, 1109, + /* 480 */ 1095, 1074, 977, 1021, 926, 830, 816, 807, 873, 787, + /* 490 */ 707, 786, 522, 686, 649, 616, 522, 523, 448, 407, + /* 500 */ 344, 362, 308, 278, 272, 235, 184, 119, 105, -81, + /* 510 */ 38, -43, -89, -100, }; -#define YY_REDUCE_USE_DFLT (-166) -#define YY_REDUCE_COUNT (328) -#define YY_REDUCE_MIN (-165) -#define YY_REDUCE_MAX (2185) +#define YY_REDUCE_USE_DFLT (-228) +#define YY_REDUCE_COUNT (365) +#define YY_REDUCE_MIN (-227) +#define YY_REDUCE_MAX (2757) static const short yy_reduce_ofst[] = { - /* 0 */ 412, 205, 1252, -74, 840, 839, 822, -59, 116, 1186, - /* 10 */ -42, 1251, 825, 76, 26, 905, 258, -54, 832, 1992, - /* 20 */ 1988, 1981, 1963, 1958, 1953, 1951, 1948, 1933, 1922, 1918, - /* 30 */ 1916, 1890, 1885, 1875, 1861, 1851, 1846, 1844, 1827, 1817, - /* 40 */ 1811, 1801, 1778, 1762, 1760, 1723, 1720, 1683, 1647, 1642, - /* 50 */ 1616, 1582, 1575, 1564, 1558, 1552, 1533, 1482, 1475, 1472, - /* 60 */ 1452, 1355, 967, 331, 269, 1287, 404, 1842, 1486, 1327, - /* 70 */ 1250, 694, 691, 248, -39, 1239, 2046, 1910, 1900, 1735, - /* 80 */ 1730, 911, 1698, 705, 1610, 969, 966, 823, 849, 1394, - /* 90 */ 1369, 1357, 962, 753, 827, -13, 663, 387, 585, 1253, - /* 100 */ 1147, 232, 1128, 1026, 2112, 2103, 2076, 1818, 1818, 2098, - /* 110 */ 2097, 2087, 2086, 1300, 2078, 1163, 2077, 1818, 1433, 2076, - /* 120 */ 2060, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 2053, 1818, - /* 130 */ 1818, 1818, 1818, 2027, 1818, 1818, 1818, 2022, 2011, 1915, - /* 140 */ 1878, 1818, 1780, 1779, 693, 572, -165, 1640, 1605, 1602, - /* 150 */ 1587, 1556, 1502, 1492, 386, 1418, 1408, 1322, 1283, 1246, - /* 160 */ 919, 274, 1275, 1108, 1100, 1036, 1035, 968, 770, 605, - /* 170 */ -2, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, - /* 180 */ 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, - /* 190 */ 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, - /* 200 */ 1624, 1624, 1624, 1624, 1624, 1624, 1624, 2168, 2178, 2177, - /* 210 */ 1624, 2106, 2106, 2167, 2166, 2165, 2132, 2146, 2154, 2108, - /* 220 */ 2105, 2101, 2176, 2175, 2171, 2170, 2139, 2185, 2131, 2128, - /* 230 */ 2117, 2115, 2150, 2144, 2145, 2148, 2114, 2113, 2147, 2085, - /* 240 */ 2084, 2118, 2121, 2094, 1624, 2067, 2010, 2100, 2095, 2066, - /* 250 */ 2063, 2093, 2010, 2111, 2010, 2110, 2010, 2107, 2010, 2104, - /* 260 */ 2079, 2138, 2090, 2075, 2133, 2096, 2083, 2061, 2058, 2010, - /* 270 */ 2010, 2088, 2073, 2010, 2024, 2017, 2030, 2089, 2010, 2057, - /* 280 */ 2072, 2010, 2055, 2049, 2045, 2031, 2019, 2026, 2023, 2016, - /* 290 */ 2007, 2002, 1987, 1983, 1955, 1888, 1896, 1866, 1894, 1825, - /* 300 */ 1873, 1835, 1792, 1808, 1790, 1793, 1784, 1732, 1744, 1624, - /* 310 */ 1781, 1759, 1746, 1753, 1739, 1748, 1738, 1725, 1717, 1620, - /* 320 */ 1613, 1618, 1680, 1679, 1636, 1624, 1624, 1624, 1674, + /* 0 */ 389, -131, -8, 117, 1524, 366, 123, 958, 717, 118, + /* 10 */ -66, 1806, 1767, 1823, 1773, 1762, 1600, 1030, 1593, 1576, + /* 20 */ 1013, 875, 2757, 2754, 2720, 2695, 2693, 2691, 2676, 2661, + /* 30 */ 2657, 2655, 2641, 2625, 2605, 2601, 2589, 2573, 2559, 2557, + /* 40 */ 2554, 2520, 2494, 2482, 2480, 2468, 2461, 2454, 2442, 2435, + /* 50 */ 2428, 2359, 2354, 2277, 2272, 2238, 2213, 2206, 2178, 2132, + /* 60 */ 2046, 2041, 2026, 1980, 1975, 1940, 1935, 1929, 1835, 172, + /* 70 */ 670, 386, -130, 866, 760, -101, 211, 1265, 1113, 216, + /* 80 */ 1882, 1814, 1531, 1027, 699, 858, 688, -166, 361, 1737, + /* 90 */ 765, 868, 2194, 2058, 1964, 1883, 1686, 1528, 1561, 55, + /* 100 */ 1521, 1064, 933, 394, 751, 1779, 1695, 1640, 996, -227, + /* 110 */ 122, 1539, 605, -119, 773, 606, -173, 321, 1638, 1563, + /* 120 */ 893, 525, 2289, 2279, 2239, 1888, 1888, 2275, 2274, 2271, + /* 130 */ 2263, 1211, 2246, 876, 1888, 1619, 1261, 2239, 2234, 2232, + /* 140 */ 1888, 1888, 1888, 1888, 1888, 1888, 1888, 2214, 1888, 1888, + /* 150 */ 1888, 1888, 2211, 1888, 1888, 1888, 2210, 2204, 2124, 2122, + /* 160 */ 2110, 2103, 2082, 1587, 1082, 1059, 2001, 1973, 1943, 1171, + /* 170 */ 1111, 1914, 1899, 1888, 1861, 1761, 1012, 1713, 1684, 1679, + /* 180 */ 1672, 1530, 1098, 1075, 1084, 1152, 824, 931, 710, 1103, + /* 190 */ 646, 189, 851, -74, 1817, 1817, 1817, 1817, 1817, 1817, + /* 200 */ 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, + /* 210 */ 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, + /* 220 */ 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, + /* 230 */ 1817, 1817, 1817, 1817, 2416, 2427, 2423, 1817, 2335, 2335, + /* 240 */ 2413, 2410, 2404, 2372, 2318, 2391, 2382, 2350, 2337, 2336, + /* 250 */ 2412, 2409, 2407, 2406, 2358, 2401, 2340, 2346, 2326, 2325, + /* 260 */ 2365, 2356, 2352, 2355, 2306, 2302, 2327, 2322, 2286, 2341, + /* 270 */ 2273, 2270, 1817, 2312, 2310, 2260, 2150, 2285, 2283, 2247, + /* 280 */ 2244, 2282, 2251, 2150, 2295, 2150, 2293, 2150, 2291, 2150, + /* 290 */ 2287, 2259, 2321, 2276, 2257, 2320, 2281, 2268, 2236, 2235, + /* 300 */ 2150, 2256, 2150, 2265, 2248, 2150, 2200, 2196, 2202, 2253, + /* 310 */ 2150, 2228, 2250, 2150, 2221, 2216, 2209, 2207, 2197, 2182, + /* 320 */ 2195, 2191, 2166, 2145, 2112, 2129, 2123, 2016, 2071, 2047, + /* 330 */ 1997, 1977, 2013, 2009, 2019, 2011, 1981, 1972, 2018, 1989, + /* 340 */ 1817, 1983, 1978, 1971, 1963, 1952, 1928, 1985, 1966, 1984, + /* 350 */ 1954, 1933, 1962, 1942, 1939, 1934, 1813, 1811, 1812, 1880, + /* 360 */ 1872, 1840, 1817, 1817, 1817, 1885, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 759, 1074, 1179, 1062, 1179, 1062, 1062, 1062, 1179, 1062, - /* 10 */ 1062, 1062, 1062, 1062, 1062, 931, 1185, 1185, 1185, 1062, - /* 20 */ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, - /* 30 */ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, - /* 40 */ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, - /* 50 */ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, - /* 60 */ 1062, 1062, 1014, 1185, 924, 1185, 1185, 1185, 1185, 1185, - /* 70 */ 1185, 1185, 1185, 804, 920, 931, 1185, 1185, 1185, 1185, - /* 80 */ 1185, 988, 1002, 988, 980, 971, 1185, 1185, 1185, 996, - /* 90 */ 996, 996, 996, 872, 996, 1185, 1185, 1185, 1185, 959, - /* 100 */ 959, 1064, 1185, 796, 1149, 1154, 1012, 1185, 1185, 1185, - /* 110 */ 1185, 1185, 989, 1185, 1185, 1185, 1185, 932, 920, 1012, - /* 120 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, - /* 130 */ 1003, 981, 972, 1185, 1185, 1185, 1185, 1185, 1185, 1185, - /* 140 */ 1185, 1185, 1185, 1185, 920, 920, 920, 1185, 1185, 1185, - /* 150 */ 1185, 1013, 1185, 1185, 793, 1185, 1185, 1185, 765, 1095, - /* 160 */ 1185, 1185, 759, 1179, 1179, 1179, 1179, 1179, 1179, 1172, - /* 170 */ 910, 966, 1068, 1069, 937, 976, 1075, 964, 968, 967, - /* 180 */ 1067, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, - /* 190 */ 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1037, 1049, 1036, - /* 200 */ 1044, 1045, 1048, 1039, 1053, 1038, 1040, 1185, 1185, 1185, - /* 210 */ 1041, 1185, 1185, 1185, 1185, 1185, 923, 894, 1185, 1185, - /* 220 */ 1185, 1123, 1185, 1185, 806, 1185, 908, 768, 975, 975, - /* 230 */ 949, 949, 839, 863, 828, 959, 949, 939, 959, 1185, - /* 240 */ 1185, 921, 908, 1070, 1042, 1163, 940, 940, 940, 1148, - /* 250 */ 1148, 940, 940, 885, 940, 885, 940, 885, 940, 885, - /* 260 */ 940, 790, 975, 940, 790, 876, 975, 1008, 992, 940, - /* 270 */ 940, 876, 975, 940, 1130, 1128, 940, 790, 940, 1083, - /* 280 */ 790, 940, 1083, 874, 874, 874, 874, 855, 1083, 874, - /* 290 */ 839, 874, 855, 874, 874, 940, 1185, 940, 1083, 1089, - /* 300 */ 1083, 965, 953, 963, 960, 975, 1185, 1185, 1064, 1043, - /* 310 */ 787, 858, 790, 776, 776, 764, 764, 764, 764, 1176, - /* 320 */ 1176, 1172, 841, 841, 926, 1052, 1051, 1050, 815, 1076, - /* 330 */ 1185, 1185, 1185, 1185, 1185, 1185, 1097, 1185, 1185, 1185, - /* 340 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, - /* 350 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 760, 1185, 1185, - /* 360 */ 1185, 1185, 1185, 1166, 1185, 1185, 1185, 1185, 1185, 1185, - /* 370 */ 1127, 1126, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, - /* 380 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1115, 1185, - /* 390 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, - /* 400 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1016, - /* 410 */ 1063, 1185, 897, 902, 1185, 1185, 1185, 898, 1185, 1185, - /* 420 */ 1185, 1185, 1185, 1185, 1073, 1185, 1185, 1185, 1185, 961, - /* 430 */ 1185, 954, 1185, 1185, 1185, 1185, 1181, 1185, 1185, 1185, - /* 440 */ 1180, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, - /* 450 */ 1185, 1015, 1065, 1029, 1185, 1028, 1027, 799, 1185, 774, - /* 460 */ 1185, 756, 761, 1165, 1162, 1164, 1159, 1160, 1158, 1161, - /* 470 */ 1157, 1155, 1156, 1153, 1151, 1150, 1152, 1147, 1143, 1103, - /* 480 */ 1101, 1099, 1108, 1107, 1106, 1105, 1104, 1100, 1098, 1102, - /* 490 */ 1096, 999, 978, 969, 892, 1142, 1140, 1141, 1094, 1092, - /* 500 */ 1093, 891, 890, 889, 884, 883, 882, 881, 1169, 1178, - /* 510 */ 1177, 1175, 1174, 1173, 1167, 1168, 1081, 1080, 1078, 1077, - /* 520 */ 1079, 792, 1119, 1122, 1121, 1120, 1125, 1124, 1117, 1129, - /* 530 */ 1134, 1133, 1138, 1137, 1136, 1135, 1132, 1114, 1007, 1006, - /* 540 */ 1004, 1001, 1011, 1010, 1009, 1000, 993, 1005, 983, 991, - /* 550 */ 990, 979, 982, 877, 974, 970, 973, 893, 1118, 888, - /* 560 */ 887, 886, 791, 786, 942, 785, 784, 795, 861, 862, - /* 570 */ 870, 873, 868, 871, 867, 866, 865, 869, 864, 860, - /* 580 */ 798, 797, 805, 854, 832, 830, 829, 833, 846, 845, - /* 590 */ 852, 851, 850, 849, 848, 844, 847, 843, 842, 834, - /* 600 */ 827, 826, 840, 825, 857, 856, 853, 824, 880, 879, - /* 610 */ 878, 875, 823, 822, 821, 820, 819, 818, 1035, 1034, - /* 620 */ 1066, 1057, 1018, 1017, 1056, 1054, 1065, 1055, 1026, 895, - /* 630 */ 905, 904, 903, 900, 901, 915, 913, 912, 911, 948, - /* 640 */ 947, 946, 945, 944, 943, 936, 934, 929, 928, 941, - /* 650 */ 935, 933, 930, 951, 952, 950, 927, 919, 917, 918, - /* 660 */ 916, 998, 995, 997, 994, 938, 925, 922, 909, 956, - /* 670 */ 955, 1063, 1184, 1182, 1183, 1086, 1088, 1091, 1090, 1087, - /* 680 */ 958, 957, 1085, 1084, 1058, 1033, 811, 809, 810, 1111, - /* 690 */ 1110, 1113, 1112, 1109, 813, 812, 808, 807, 1031, 899, - /* 700 */ 896, 1025, 1024, 1139, 1060, 1061, 1023, 1019, 1059, 1047, - /* 710 */ 1046, 1032, 1022, 800, 1020, 1030, 1021, 838, 837, 836, - /* 720 */ 835, 907, 906, 817, 831, 816, 814, 794, 789, 788, - /* 730 */ 783, 781, 778, 780, 777, 782, 779, 775, 773, 772, - /* 740 */ 771, 770, 769, 803, 802, 801, 799, 767, 766, 763, - /* 750 */ 762, 758, 757, 755, + /* 0 */ 849, 1158, 1158, 1277, 1158, 1158, 1158, 1158, 1158, 1158, + /* 10 */ 1277, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, + /* 20 */ 1158, 1277, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, + /* 30 */ 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, + /* 40 */ 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, + /* 50 */ 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, + /* 60 */ 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1029, + /* 70 */ 1316, 1316, 1316, 1293, 1293, 1316, 1022, 1316, 1316, 1316, + /* 80 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 896, 1018, + /* 90 */ 886, 1029, 1316, 1316, 1316, 1316, 1316, 1089, 1103, 1089, + /* 100 */ 1081, 1072, 1316, 1316, 1194, 1097, 1097, 1097, 1097, 969, + /* 110 */ 1097, 1316, 1316, 1316, 1316, 1129, 1128, 1316, 1057, 1057, + /* 120 */ 1160, 1316, 1247, 1252, 1316, 1316, 1316, 1316, 1316, 1316, + /* 130 */ 1090, 1316, 1316, 1316, 1030, 1018, 1293, 1316, 1316, 1316, + /* 140 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1104, + /* 150 */ 1082, 1073, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, + /* 160 */ 1316, 1316, 1316, 1018, 1018, 1018, 1316, 1316, 1316, 1293, + /* 170 */ 1293, 1316, 1316, 1316, 1316, 1316, 883, 1316, 1316, 1316, + /* 180 */ 855, 1316, 1293, 1293, 849, 1277, 1051, 1277, 1277, 891, + /* 190 */ 1277, 1277, 1270, 1008, 1067, 1160, 1160, 1160, 1160, 1035, + /* 200 */ 1077, 1065, 1069, 1171, 1068, 1160, 1160, 1160, 1160, 1160, + /* 210 */ 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160, + /* 220 */ 1160, 1160, 1160, 1160, 1131, 1143, 1130, 1138, 1147, 1139, + /* 230 */ 1142, 1133, 1132, 1134, 1316, 1316, 1316, 1135, 1316, 1316, + /* 240 */ 1316, 1316, 1316, 1021, 1316, 1316, 991, 1316, 1316, 1221, + /* 250 */ 1316, 1316, 898, 1316, 1006, 858, 1076, 1019, 1047, 1047, + /* 260 */ 936, 960, 920, 1057, 1047, 1037, 1051, 1051, 1166, 1057, + /* 270 */ 1316, 1316, 1136, 1019, 1006, 1261, 1038, 1038, 1038, 1246, + /* 280 */ 1246, 1038, 1194, 1038, 982, 1038, 982, 1038, 982, 1038, + /* 290 */ 982, 1038, 880, 1076, 1038, 880, 973, 1076, 1109, 1093, + /* 300 */ 1038, 1076, 1038, 973, 1076, 1038, 1228, 1226, 1038, 880, + /* 310 */ 1038, 1179, 880, 1038, 1179, 971, 971, 971, 971, 952, + /* 320 */ 1179, 971, 936, 971, 952, 971, 971, 1312, 1316, 1038, + /* 330 */ 1303, 1303, 1060, 1060, 1066, 1051, 1316, 1185, 1179, 1160, + /* 340 */ 1137, 1066, 1064, 1061, 1076, 1316, 1038, 877, 955, 880, + /* 350 */ 866, 866, 854, 854, 854, 854, 1274, 1274, 1270, 938, + /* 360 */ 938, 1024, 1146, 1145, 1144, 907, 1159, 1316, 1316, 1316, + /* 370 */ 1316, 1316, 1316, 1195, 1316, 1316, 1316, 1316, 1316, 1316, + /* 380 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, + /* 390 */ 1316, 1316, 1316, 1316, 1316, 850, 1316, 1316, 1316, 1316, + /* 400 */ 1316, 1264, 1316, 1316, 1316, 1316, 1316, 1316, 1225, 1224, + /* 410 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, + /* 420 */ 1316, 1316, 1316, 1316, 1316, 1316, 1213, 1316, 1316, 1316, + /* 430 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, + /* 440 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, + /* 450 */ 1316, 1316, 1316, 1316, 994, 1000, 1316, 1316, 1316, 995, + /* 460 */ 1316, 1316, 1122, 1316, 1316, 1316, 1169, 1316, 1316, 1316, + /* 470 */ 1316, 1062, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, + /* 480 */ 1316, 1316, 1316, 1316, 1316, 1316, 1309, 1052, 1316, 1316, + /* 490 */ 1159, 1316, 1279, 1316, 1316, 1316, 1278, 1316, 1316, 1316, + /* 500 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1123, 1122, 1161, + /* 510 */ 889, 1316, 864, 1316, 846, 851, 1263, 1260, 1262, 1257, + /* 520 */ 1258, 1256, 1259, 1255, 1253, 1254, 1251, 1249, 1248, 1250, + /* 530 */ 1245, 1241, 1201, 1199, 1197, 1206, 1205, 1204, 1203, 1202, + /* 540 */ 1198, 1196, 1200, 1192, 1191, 1100, 1079, 1070, 989, 1240, + /* 550 */ 1238, 1239, 1190, 1188, 1189, 988, 987, 986, 981, 980, + /* 560 */ 979, 978, 1267, 1276, 1275, 1273, 1272, 1271, 1265, 1266, + /* 570 */ 1177, 1176, 1174, 1173, 1175, 882, 1217, 1220, 1219, 1218, + /* 580 */ 1223, 1222, 1215, 1227, 1232, 1231, 1236, 1235, 1234, 1233, + /* 590 */ 1230, 1212, 1108, 1107, 1105, 1102, 1112, 1111, 1110, 1101, + /* 600 */ 1094, 1106, 1084, 1092, 1091, 1080, 1083, 974, 1075, 1071, + /* 610 */ 1074, 990, 1216, 985, 984, 983, 881, 876, 1040, 875, + /* 620 */ 874, 885, 958, 959, 967, 970, 965, 968, 964, 963, + /* 630 */ 962, 966, 961, 957, 888, 887, 897, 951, 934, 923, + /* 640 */ 890, 925, 922, 921, 926, 943, 942, 949, 948, 947, + /* 650 */ 946, 945, 941, 944, 940, 939, 927, 919, 918, 937, + /* 660 */ 917, 954, 953, 950, 916, 977, 976, 975, 972, 915, + /* 670 */ 914, 913, 912, 911, 910, 1157, 1315, 1311, 1314, 1313, + /* 680 */ 1310, 1156, 1162, 1150, 1148, 992, 1003, 1002, 1001, 998, + /* 690 */ 999, 1013, 1011, 1010, 1009, 1046, 1045, 1044, 1043, 1042, + /* 700 */ 1041, 1034, 1032, 1027, 1026, 1033, 1031, 1028, 1049, 1050, + /* 710 */ 1048, 1025, 1017, 1015, 1016, 1014, 1099, 1096, 1098, 1095, + /* 720 */ 1036, 1023, 1020, 1007, 1291, 1289, 1292, 1290, 1288, 1296, + /* 730 */ 1298, 1297, 1302, 1300, 1299, 1295, 1308, 1307, 1306, 1305, + /* 740 */ 1304, 1294, 1301, 1287, 1286, 1285, 1284, 1054, 1059, 1058, + /* 750 */ 1053, 997, 1161, 1149, 1159, 1153, 1282, 1280, 1283, 1182, + /* 760 */ 1184, 1187, 1186, 1183, 1056, 1055, 1181, 1180, 1281, 1152, + /* 770 */ 1127, 903, 901, 902, 1209, 1208, 1211, 1210, 1207, 905, + /* 780 */ 904, 900, 899, 1125, 1121, 1120, 1237, 1154, 1155, 1119, + /* 790 */ 1124, 1117, 1116, 1115, 1141, 1140, 1126, 1118, 892, 996, + /* 800 */ 993, 1151, 1114, 1039, 1113, 933, 932, 931, 930, 929, + /* 810 */ 928, 1005, 1004, 909, 924, 908, 906, 884, 879, 878, + /* 820 */ 873, 871, 868, 870, 867, 872, 869, 865, 863, 862, + /* 830 */ 861, 860, 859, 895, 894, 893, 889, 857, 856, 853, + /* 840 */ 852, 848, 847, 845, }; /* The next table maps tokens into fallback tokens. If a construct @@ -919,6 +1086,7 @@ static const YYCODETYPE yyFallback[] = { 4, /* ABORT => ID */ 4, /* ACTION => ID */ 4, /* AFTER => ID */ + 4, /* ALWAYS => ID */ 4, /* ANALYZE => ID */ 4, /* ASC => ID */ 4, /* ATTACH => ID */ @@ -929,40 +1097,56 @@ static const YYCODETYPE yyFallback[] = { 4, /* CAST => ID */ 4, /* COLUMNKW => ID */ 4, /* CONFLICT => ID */ + 4, /* CURRENT => ID */ 4, /* DATABASE => ID */ 4, /* DEFERRED => ID */ 4, /* DESC => ID */ 4, /* DETACH => ID */ + 4, /* DO => ID */ 4, /* EACH => ID */ 4, /* END => ID */ + 4, /* EXCLUDE => ID */ 4, /* EXCLUSIVE => ID */ 4, /* EXPLAIN => ID */ 4, /* FAIL => ID */ + 4, /* FIRST => ID */ + 4, /* FOLLOWING => ID */ 4, /* FOR => ID */ + 4, /* GENERATED => ID */ + 4, /* GROUPS => ID */ 4, /* IGNORE => ID */ 4, /* IMMEDIATE => ID */ 4, /* INDEXED => ID */ 4, /* INITIALLY => ID */ 4, /* INSTEAD => ID */ + 4, /* LAST => ID */ 4, /* LIKE_KW => ID */ 4, /* MATCH => ID */ 4, /* NO => ID */ + 4, /* NULLS => ID */ + 4, /* OTHERS => ID */ 4, /* PLAN => ID */ 4, /* QUERY => ID */ 4, /* KEY => ID */ 4, /* OF => ID */ 4, /* OFFSET => ID */ + 4, /* PARTITION => ID */ 4, /* PRAGMA => ID */ + 4, /* PRECEDING => ID */ 4, /* RAISE => ID */ + 4, /* RANGE => ID */ 4, /* RECURSIVE => ID */ 4, /* RELEASE => ID */ 4, /* REPLACE => ID */ 4, /* RESTRICT => ID */ 4, /* ROW => ID */ + 4, /* ROWS => ID */ 4, /* ROLLBACK => ID */ 4, /* SAVEPOINT => ID */ 4, /* TEMP => ID */ + 4, /* TIES => ID */ 4, /* TRIGGER => ID */ + 4, /* UNBOUNDED => ID */ 4, /* VACUUM => ID */ 4, /* VIEW => ID */ 4, /* VIRTUAL => ID */ @@ -1123,74 +1307,84 @@ void sqlite3_parseTrace(FILE *TraceFILE, char *zTracePrompt){ static const char *const yyTokenName[] = { "$", "ILLEGAL", "COMMENT", "SPACE", "ID", "ABORT", "ACTION", "AFTER", - "ANALYZE", "ASC", "ATTACH", "BEFORE", - "BEGIN", "BY", "CASCADE", "CAST", - "COLUMNKW", "CONFLICT", "DATABASE", "DEFERRED", - "DESC", "DETACH", "EACH", "END", - "EXCLUSIVE", "EXPLAIN", "FAIL", "FOR", + "ALWAYS", "ANALYZE", "ASC", "ATTACH", + "BEFORE", "BEGIN", "BY", "CASCADE", + "CAST", "COLUMNKW", "CONFLICT", "CURRENT", + "DATABASE", "DEFERRED", "DESC", "DETACH", + "DO", "EACH", "END", "EXCLUDE", + "EXCLUSIVE", "EXPLAIN", "FAIL", "FIRST", + "FOLLOWING", "FOR", "GENERATED", "GROUPS", "IGNORE", "IMMEDIATE", "INDEXED", "INITIALLY", - "INSTEAD", "LIKE_KW", "MATCH", "NO", - "PLAN", "QUERY", "KEY", "OF", - "OFFSET", "PRAGMA", "RAISE", "RECURSIVE", - "RELEASE", "REPLACE", "RESTRICT", "ROW", - "ROLLBACK", "SAVEPOINT", "TEMP", "TRIGGER", - "VACUUM", "VIEW", "VIRTUAL", "WITH", - "WITHOUT", "REINDEX", "RENAME", "CTIME_KW", - "IF", "ANY", "OR", "AND", - "NOT", "IS", "BETWEEN", "IN", - "ISNULL", "NOTNULL", "NE", "EQ", - "GT", "LE", "LT", "GE", - "ESCAPE", "BITAND", "BITOR", "LSHIFT", - "RSHIFT", "PLUS", "MINUS", "STAR", - "SLASH", "REM", "CONCAT", "COLLATE", - "BITNOT", "SEMI", "TRANSACTION", "ID_TRANS", - "COMMIT", "TO", "CREATE", "TABLE", - "LP", "RP", "AS", "DOT", - "ID_TAB_NEW", "ID_DB", "CTX_ROWID_KW", "EXISTS", - "COMMA", "ID_COL_NEW", "STRING", "JOIN_KW", - "ID_COL_TYPE", "CONSTRAINT", "DEFAULT", "NULL", - "PRIMARY", "UNIQUE", "CHECK", "REFERENCES", - "ID_CONSTR", "ID_COLLATE", "ID_TAB", "INTEGER", - "FLOAT", "BLOB", "AUTOINCR", "ON", - "INSERT", "DELETE", "UPDATE", "ID_FK_MATCH", - "SET", "DEFERRABLE", "FOREIGN", "DROP", - "ID_VIEW_NEW", "ID_VIEW", "SELECT", "VALUES", - "UNION", "ALL", "EXCEPT", "INTERSECT", - "DISTINCT", "ID_ALIAS", "FROM", "USING", - "JOIN", "ID_JOIN_OPTS", "ID_IDX", "ORDER", - "GROUP", "HAVING", "LIMIT", "WHERE", - "ID_COL", "INTO", "DO", "NOTHING", - "CASE", "ID_FN", "ID_ERR_MSG", "VARIABLE", - "WHEN", "THEN", "ELSE", "INDEX", - "ID_IDX_NEW", "ID_PRAGMA", "ID_TRIG_NEW", "ID_TRIG", - "ALTER", "ADD", "error", "cmd", + "INSTEAD", "LAST", "LIKE_KW", "MATCH", + "NO", "NULLS", "OTHERS", "PLAN", + "QUERY", "KEY", "OF", "OFFSET", + "PARTITION", "PRAGMA", "PRECEDING", "RAISE", + "RANGE", "RECURSIVE", "RELEASE", "REPLACE", + "RESTRICT", "ROW", "ROWS", "ROLLBACK", + "SAVEPOINT", "TEMP", "TIES", "TRIGGER", + "UNBOUNDED", "VACUUM", "VIEW", "VIRTUAL", + "WITH", "WITHOUT", "REINDEX", "RENAME", + "CTIME_KW", "IF", "ANY", "OR", + "AND", "NOT", "IS", "BETWEEN", + "IN", "ISNULL", "NOTNULL", "NE", + "EQ", "GT", "LE", "LT", + "GE", "ESCAPE", "BITAND", "BITOR", + "LSHIFT", "RSHIFT", "PLUS", "MINUS", + "STAR", "SLASH", "REM", "CONCAT", + "COLLATE", "BITNOT", "SEMI", "TRANSACTION", + "ID_TRANS", "COMMIT", "TO", "CREATE", + "TABLE", "LP", "RP", "AS", + "DOT", "ID_TAB_NEW", "ID_DB", "CTX_ROWID_KW", + "EXISTS", "COMMA", "ID_COL_NEW", "STRING", + "JOIN_KW", "ID_COL_TYPE", "RIGHT_ASSOC", "CONSTRAINT", + "DEFAULT", "NULL", "PRIMARY", "UNIQUE", + "CHECK", "REFERENCES", "ID_CONSTR", "ID_COLLATE", + "ID_TAB", "INTEGER", "FLOAT", "BLOB", + "AUTOINCR", "ON", "INSERT", "DELETE", + "UPDATE", "ID_FK_MATCH", "SET", "DEFERRABLE", + "FOREIGN", "DROP", "ID_VIEW_NEW", "ID_VIEW", + "SELECT", "VALUES", "UNION", "ALL", + "EXCEPT", "INTERSECT", "DISTINCT", "ID_ALIAS", + "FROM", "USING", "JOIN", "ID_JOIN_OPTS", + "ID_IDX", "ORDER", "GROUP", "HAVING", + "LIMIT", "WHERE", "ID_COL", "INTO", + "NOTHING", "ID_FN", "ID_ERR_MSG", "VARIABLE", + "CASE", "WHEN", "THEN", "ELSE", + "INDEX", "ID_IDX_NEW", "ID_PRAGMA", "ID_TRIG_NEW", + "ID_TRIG", "ALTER", "ADD", "WINDOW", + "OVER", "FILTER", "error", "cmd", "input", "cmdlist", "ecmd", "explain", "cmdx", "transtype", "trans_opt", "nm", "savepoint_opt", "temp", "ifnotexists", "fullname", "columnlist", "conslist_opt", "table_options", "select", "column", "columnid", "type", "carglist", - "id", "ids", "typetoken", "typename", - "signed", "plus_num", "minus_num", "ccons", - "term", "expr", "onconf", "sortorder", - "autoinc", "idxlist_opt", "refargs", "defer_subclause", - "refarg", "refact", "init_deferred_pred_opt", "conslist", - "tconscomma", "tcons", "idxlist", "defer_subclause_opt", - "resolvetype", "orconf", "raisetype", "ifexists", - "select_stmt", "with", "selectnowith", "oneselect", - "multiselect_op", "values", "distinct", "selcollist", - "from", "where_opt", "groupby_opt", "having_opt", - "orderby_opt", "limit_opt", "nexprlist", "exprlist", + "id", "id_opt", "ids", "typetoken", + "typename", "signed", "plus_num", "minus_num", + "ccons", "term", "expr", "onconf", + "sortorder", "autoinc", "idxlist_opt", "refargs", + "defer_subclause", "gen_always", "tnm", "refarg", + "refact", "init_deferred_pred_opt", "conslist", "tconscomma", + "tcons", "idxlist", "defer_subclause_opt", "resolvetype", + "orconf", "raisetype", "ifexists", "select_stmt", + "with", "selectnowith", "oneselect", "multiselect_op", + "values", "distinct", "selcollist", "from", + "where_opt", "groupby_opt", "having_opt", "orderby_opt", + "limit_opt", "window_clause", "nexprlist", "exprlist", "sclp", "as", "joinsrc", "singlesrc", "seltablist", "joinop", "joinconstr_opt", "dbnm", - "indexed_opt", "idlist", "sortlist", "delete_stmt", - "update_stmt", "setlist", "idlist_opt", "insert_stmt", - "insert_cmd", "upsert", "exprx", "not_opt", - "case_operand", "case_exprlist", "case_else", "likeop", - "uniqueflag", "idxlist_single", "collate", "nmnum", - "number", "trigger_time", "trigger_event", "foreach_clause", - "when_clause", "trigger_cmd_list", "trigger_cmd", "database_kw_opt", - "key_opt", "kwcolumn_opt", "create_vtab", "vtabarglist", - "vtabarg", "vtabargtoken", "anylist", "wqlist", + "indexed_opt", "idlist", "sortlist", "nulls", + "delete_stmt", "update_stmt", "setlist", "idlist_opt", + "insert_stmt", "insert_cmd", "upsert", "exprx", + "not_opt", "likeop", "case_operand", "case_exprlist", + "case_else", "filter_over", "uniqueflag", "idxlist_single", + "collate", "vinto", "nmnum", "number", + "trigger_time", "trigger_event", "foreach_clause", "when_clause", + "trigger_cmd_list", "trigger_cmd", "database_kw_opt", "key_opt", + "kwcolumn_opt", "create_vtab", "vtabarglist", "vtabarg", + "vtabargtoken", "anylist", "wqlist", "wqcte", + "windowdefn_list", "windowdefn", "window", "frame_opt", + "range_or_rows", "frame_bound_s", "frame_exclude_opt", "frame_bound_e", + "frame_bound", "frame_exclude", "filter_clause", "over_clause", }; #endif /* NDEBUG */ @@ -1244,391 +1438,432 @@ static const char *const yyRuleName[] = { /* 43 */ "columnid ::= nm", /* 44 */ "columnid ::= ID_COL_NEW", /* 45 */ "id ::= ID", - /* 46 */ "ids ::= ID|STRING", - /* 47 */ "nm ::= id", - /* 48 */ "nm ::= STRING", - /* 49 */ "nm ::= JOIN_KW", - /* 50 */ "type ::=", - /* 51 */ "type ::= typetoken", - /* 52 */ "typetoken ::= typename", - /* 53 */ "typetoken ::= typename LP signed RP", - /* 54 */ "typetoken ::= typename LP signed COMMA signed RP", - /* 55 */ "typename ::= ids", - /* 56 */ "typename ::= typename ids", - /* 57 */ "typename ::= ID_COL_TYPE", - /* 58 */ "signed ::= plus_num", - /* 59 */ "signed ::= minus_num", - /* 60 */ "carglist ::= carglist ccons", - /* 61 */ "carglist ::=", - /* 62 */ "ccons ::= CONSTRAINT nm", - /* 63 */ "ccons ::= DEFAULT term", - /* 64 */ "ccons ::= DEFAULT LP expr RP", - /* 65 */ "ccons ::= DEFAULT PLUS term", - /* 66 */ "ccons ::= DEFAULT MINUS term", - /* 67 */ "ccons ::= DEFAULT id", - /* 68 */ "ccons ::= DEFAULT CTIME_KW", - /* 69 */ "ccons ::= NULL onconf", - /* 70 */ "ccons ::= NOT NULL onconf", - /* 71 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", - /* 72 */ "ccons ::= UNIQUE onconf", - /* 73 */ "ccons ::= CHECK LP expr RP", - /* 74 */ "ccons ::= REFERENCES nm idxlist_opt refargs", - /* 75 */ "ccons ::= defer_subclause", - /* 76 */ "ccons ::= COLLATE ids", - /* 77 */ "ccons ::= CONSTRAINT ID_CONSTR", - /* 78 */ "ccons ::= COLLATE ID_COLLATE", - /* 79 */ "ccons ::= REFERENCES ID_TAB", - /* 80 */ "ccons ::= CHECK LP RP", - /* 81 */ "term ::= NULL", - /* 82 */ "term ::= INTEGER", - /* 83 */ "term ::= FLOAT", - /* 84 */ "term ::= STRING|BLOB", - /* 85 */ "autoinc ::=", - /* 86 */ "autoinc ::= AUTOINCR", - /* 87 */ "refargs ::=", - /* 88 */ "refargs ::= refargs refarg", - /* 89 */ "refarg ::= MATCH nm", - /* 90 */ "refarg ::= ON INSERT refact", - /* 91 */ "refarg ::= ON DELETE refact", - /* 92 */ "refarg ::= ON UPDATE refact", - /* 93 */ "refarg ::= MATCH ID_FK_MATCH", - /* 94 */ "refact ::= SET NULL", - /* 95 */ "refact ::= SET DEFAULT", - /* 96 */ "refact ::= CASCADE", - /* 97 */ "refact ::= RESTRICT", - /* 98 */ "refact ::= NO ACTION", - /* 99 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", - /* 100 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", - /* 101 */ "init_deferred_pred_opt ::=", - /* 102 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", - /* 103 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", - /* 104 */ "conslist_opt ::=", - /* 105 */ "conslist_opt ::= COMMA conslist", - /* 106 */ "conslist ::= conslist tconscomma tcons", - /* 107 */ "conslist ::= tcons", - /* 108 */ "tconscomma ::= COMMA", - /* 109 */ "tconscomma ::=", - /* 110 */ "tcons ::= CONSTRAINT nm", - /* 111 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", - /* 112 */ "tcons ::= UNIQUE LP idxlist RP onconf", - /* 113 */ "tcons ::= CHECK LP expr RP onconf", - /* 114 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", - /* 115 */ "tcons ::= CONSTRAINT ID_CONSTR", - /* 116 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB", - /* 117 */ "tcons ::= CHECK LP RP onconf", - /* 118 */ "defer_subclause_opt ::=", - /* 119 */ "defer_subclause_opt ::= defer_subclause", - /* 120 */ "onconf ::=", - /* 121 */ "onconf ::= ON CONFLICT resolvetype", - /* 122 */ "orconf ::=", - /* 123 */ "orconf ::= OR resolvetype", - /* 124 */ "resolvetype ::= raisetype", - /* 125 */ "resolvetype ::= IGNORE", - /* 126 */ "resolvetype ::= REPLACE", - /* 127 */ "cmd ::= DROP TABLE ifexists fullname", - /* 128 */ "cmd ::= DROP TABLE ifexists nm DOT ID_TAB", - /* 129 */ "cmd ::= DROP TABLE ifexists ID_DB|ID_TAB", - /* 130 */ "ifexists ::= IF EXISTS", - /* 131 */ "ifexists ::=", - /* 132 */ "cmd ::= CREATE temp VIEW ifnotexists fullname idxlist_opt AS select", - /* 133 */ "cmd ::= CREATE temp VIEW ifnotexists nm DOT ID_VIEW_NEW", - /* 134 */ "cmd ::= CREATE temp VIEW ifnotexists ID_DB|ID_VIEW_NEW", - /* 135 */ "cmd ::= DROP VIEW ifexists fullname", - /* 136 */ "cmd ::= DROP VIEW ifexists nm DOT ID_VIEW", - /* 137 */ "cmd ::= DROP VIEW ifexists ID_DB|ID_VIEW", - /* 138 */ "cmd ::= select_stmt", - /* 139 */ "select_stmt ::= select", - /* 140 */ "select ::= with selectnowith", - /* 141 */ "selectnowith ::= oneselect", - /* 142 */ "selectnowith ::= selectnowith multiselect_op oneselect", - /* 143 */ "selectnowith ::= values", - /* 144 */ "selectnowith ::= selectnowith COMMA values", - /* 145 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", - /* 146 */ "values ::= VALUES LP nexprlist RP", - /* 147 */ "values ::= values COMMA LP exprlist RP", - /* 148 */ "multiselect_op ::= UNION", - /* 149 */ "multiselect_op ::= UNION ALL", - /* 150 */ "multiselect_op ::= EXCEPT", - /* 151 */ "multiselect_op ::= INTERSECT", - /* 152 */ "distinct ::= DISTINCT", - /* 153 */ "distinct ::= ALL", - /* 154 */ "distinct ::=", - /* 155 */ "sclp ::= selcollist COMMA", - /* 156 */ "sclp ::=", - /* 157 */ "selcollist ::= sclp expr as", - /* 158 */ "selcollist ::= sclp STAR", - /* 159 */ "selcollist ::= sclp nm DOT STAR", - /* 160 */ "selcollist ::= sclp", - /* 161 */ "selcollist ::= sclp ID_TAB DOT STAR", - /* 162 */ "as ::= AS nm", - /* 163 */ "as ::= ids", - /* 164 */ "as ::= AS ID_ALIAS", - /* 165 */ "as ::= ID_ALIAS", - /* 166 */ "as ::=", - /* 167 */ "from ::=", - /* 168 */ "from ::= FROM joinsrc", - /* 169 */ "joinsrc ::= singlesrc seltablist", - /* 170 */ "joinsrc ::=", - /* 171 */ "seltablist ::= seltablist joinop singlesrc joinconstr_opt", - /* 172 */ "seltablist ::=", - /* 173 */ "singlesrc ::= nm dbnm as indexed_opt", - /* 174 */ "singlesrc ::= LP select RP as", - /* 175 */ "singlesrc ::= LP joinsrc RP as", - /* 176 */ "singlesrc ::= nm dbnm LP exprlist RP as", - /* 177 */ "singlesrc ::=", - /* 178 */ "singlesrc ::= nm DOT", - /* 179 */ "singlesrc ::= nm DOT ID_TAB", - /* 180 */ "singlesrc ::= ID_DB|ID_TAB", - /* 181 */ "singlesrc ::= nm DOT ID_VIEW", - /* 182 */ "singlesrc ::= ID_DB|ID_VIEW", - /* 183 */ "joinconstr_opt ::= ON expr", - /* 184 */ "joinconstr_opt ::= USING LP idlist RP", - /* 185 */ "joinconstr_opt ::=", - /* 186 */ "dbnm ::=", - /* 187 */ "dbnm ::= DOT nm", - /* 188 */ "fullname ::= nm dbnm", - /* 189 */ "joinop ::= COMMA", - /* 190 */ "joinop ::= JOIN", - /* 191 */ "joinop ::= JOIN_KW JOIN", - /* 192 */ "joinop ::= JOIN_KW nm JOIN", - /* 193 */ "joinop ::= JOIN_KW nm nm JOIN", - /* 194 */ "joinop ::= ID_JOIN_OPTS", - /* 195 */ "indexed_opt ::=", - /* 196 */ "indexed_opt ::= INDEXED BY nm", - /* 197 */ "indexed_opt ::= NOT INDEXED", - /* 198 */ "indexed_opt ::= INDEXED BY ID_IDX", - /* 199 */ "orderby_opt ::=", - /* 200 */ "orderby_opt ::= ORDER BY sortlist", - /* 201 */ "sortlist ::= sortlist COMMA expr sortorder", - /* 202 */ "sortlist ::= expr sortorder", - /* 203 */ "sortorder ::= ASC", - /* 204 */ "sortorder ::= DESC", - /* 205 */ "sortorder ::=", - /* 206 */ "groupby_opt ::=", - /* 207 */ "groupby_opt ::= GROUP BY nexprlist", - /* 208 */ "groupby_opt ::= GROUP BY", - /* 209 */ "having_opt ::=", - /* 210 */ "having_opt ::= HAVING expr", - /* 211 */ "limit_opt ::=", - /* 212 */ "limit_opt ::= LIMIT expr", - /* 213 */ "limit_opt ::= LIMIT expr OFFSET expr", - /* 214 */ "limit_opt ::= LIMIT expr COMMA expr", - /* 215 */ "cmd ::= delete_stmt", - /* 216 */ "delete_stmt ::= with DELETE FROM fullname indexed_opt where_opt", - /* 217 */ "delete_stmt ::= with DELETE FROM", - /* 218 */ "delete_stmt ::= with DELETE FROM nm DOT", - /* 219 */ "delete_stmt ::= with DELETE FROM nm DOT ID_TAB", - /* 220 */ "delete_stmt ::= with DELETE FROM ID_DB|ID_TAB", - /* 221 */ "where_opt ::=", - /* 222 */ "where_opt ::= WHERE expr", - /* 223 */ "where_opt ::= WHERE", - /* 224 */ "cmd ::= update_stmt", - /* 225 */ "update_stmt ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt", - /* 226 */ "update_stmt ::= with UPDATE orconf", - /* 227 */ "update_stmt ::= with UPDATE orconf nm DOT", - /* 228 */ "update_stmt ::= with UPDATE orconf nm DOT ID_TAB", - /* 229 */ "update_stmt ::= with UPDATE orconf ID_DB|ID_TAB", - /* 230 */ "setlist ::= setlist COMMA nm EQ expr", - /* 231 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", - /* 232 */ "setlist ::= nm EQ expr", - /* 233 */ "setlist ::= LP idlist RP EQ expr", - /* 234 */ "setlist ::=", - /* 235 */ "setlist ::= setlist COMMA", - /* 236 */ "setlist ::= setlist COMMA ID_COL", - /* 237 */ "setlist ::= ID_COL", - /* 238 */ "idlist_opt ::=", - /* 239 */ "idlist_opt ::= LP idlist RP", - /* 240 */ "idlist ::= idlist COMMA nm", - /* 241 */ "idlist ::= nm", - /* 242 */ "idlist ::=", - /* 243 */ "idlist ::= idlist COMMA ID_COL", - /* 244 */ "idlist ::= ID_COL", - /* 245 */ "cmd ::= insert_stmt", - /* 246 */ "insert_stmt ::= with insert_cmd INTO fullname idlist_opt select upsert", - /* 247 */ "insert_stmt ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES", - /* 248 */ "insert_stmt ::= with insert_cmd INTO", - /* 249 */ "insert_stmt ::= with insert_cmd INTO nm DOT", - /* 250 */ "insert_stmt ::= with insert_cmd INTO ID_DB|ID_TAB", - /* 251 */ "insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB", - /* 252 */ "insert_cmd ::= INSERT orconf", - /* 253 */ "insert_cmd ::= REPLACE", - /* 254 */ "upsert ::=", - /* 255 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt", - /* 256 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING", - /* 257 */ "upsert ::= ON CONFLICT DO NOTHING", - /* 258 */ "exprx ::= nm DOT", - /* 259 */ "exprx ::= nm DOT nm DOT", - /* 260 */ "exprx ::= expr not_opt BETWEEN expr AND", - /* 261 */ "exprx ::= CASE case_operand case_exprlist case_else", - /* 262 */ "exprx ::= expr not_opt IN LP exprlist", - /* 263 */ "exprx ::= expr not_opt IN ID_DB", - /* 264 */ "exprx ::= expr not_opt IN nm DOT ID_TAB", - /* 265 */ "exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN", - /* 266 */ "exprx ::= nm DOT ID_TAB|ID_COL", - /* 267 */ "exprx ::= nm DOT nm DOT ID_COL", - /* 268 */ "exprx ::= expr COLLATE ID_COLLATE", - /* 269 */ "exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP", - /* 270 */ "exprx ::= term", - /* 271 */ "exprx ::= CTIME_KW", - /* 272 */ "exprx ::= LP nexprlist RP", - /* 273 */ "exprx ::= id", - /* 274 */ "exprx ::= JOIN_KW", - /* 275 */ "exprx ::= nm DOT nm", - /* 276 */ "exprx ::= nm DOT nm DOT nm", - /* 277 */ "exprx ::= VARIABLE", - /* 278 */ "exprx ::= expr COLLATE ids", - /* 279 */ "exprx ::= CAST LP expr AS typetoken RP", - /* 280 */ "exprx ::= ID LP distinct exprlist RP", - /* 281 */ "exprx ::= ID LP STAR RP", - /* 282 */ "exprx ::= expr AND expr", - /* 283 */ "exprx ::= expr OR expr", - /* 284 */ "exprx ::= expr LT|GT|GE|LE expr", - /* 285 */ "exprx ::= expr EQ|NE expr", - /* 286 */ "exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", - /* 287 */ "exprx ::= expr PLUS|MINUS expr", - /* 288 */ "exprx ::= expr STAR|SLASH|REM expr", - /* 289 */ "exprx ::= expr CONCAT expr", - /* 290 */ "exprx ::= expr not_opt likeop expr", - /* 291 */ "exprx ::= expr not_opt likeop expr ESCAPE expr", - /* 292 */ "exprx ::= expr ISNULL|NOTNULL", - /* 293 */ "exprx ::= expr NOT NULL", - /* 294 */ "exprx ::= expr IS not_opt expr", - /* 295 */ "exprx ::= NOT expr", - /* 296 */ "exprx ::= BITNOT expr", - /* 297 */ "exprx ::= MINUS expr", - /* 298 */ "exprx ::= PLUS expr", - /* 299 */ "exprx ::= expr not_opt BETWEEN expr AND expr", - /* 300 */ "exprx ::= expr not_opt IN LP exprlist RP", - /* 301 */ "exprx ::= LP select RP", - /* 302 */ "exprx ::= expr not_opt IN LP select RP", - /* 303 */ "exprx ::= expr not_opt IN nm dbnm", - /* 304 */ "exprx ::= EXISTS LP select RP", - /* 305 */ "exprx ::= CASE case_operand case_exprlist case_else END", - /* 306 */ "exprx ::= RAISE LP IGNORE RP", - /* 307 */ "exprx ::= RAISE LP raisetype COMMA nm RP", - /* 308 */ "expr ::=", - /* 309 */ "expr ::= exprx", - /* 310 */ "not_opt ::=", - /* 311 */ "not_opt ::= NOT", - /* 312 */ "likeop ::= LIKE_KW|MATCH", - /* 313 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", - /* 314 */ "case_exprlist ::= WHEN expr THEN expr", - /* 315 */ "case_else ::= ELSE expr", - /* 316 */ "case_else ::=", - /* 317 */ "case_operand ::= exprx", - /* 318 */ "case_operand ::=", - /* 319 */ "exprlist ::= nexprlist", - /* 320 */ "exprlist ::=", - /* 321 */ "nexprlist ::= nexprlist COMMA expr", - /* 322 */ "nexprlist ::= exprx", - /* 323 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", - /* 324 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON ID_TAB", - /* 325 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm DOT ID_IDX_NEW", - /* 326 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists ID_DB|ID_IDX_NEW", - /* 327 */ "uniqueflag ::= UNIQUE", - /* 328 */ "uniqueflag ::=", - /* 329 */ "idxlist_opt ::=", - /* 330 */ "idxlist_opt ::= LP idxlist RP", - /* 331 */ "idxlist ::= idxlist COMMA idxlist_single", - /* 332 */ "idxlist ::= idxlist_single", - /* 333 */ "idxlist_single ::= nm collate sortorder", - /* 334 */ "idxlist_single ::= ID_COL", - /* 335 */ "collate ::=", - /* 336 */ "collate ::= COLLATE ids", - /* 337 */ "collate ::= COLLATE ID_COLLATE", - /* 338 */ "cmd ::= DROP INDEX ifexists fullname", - /* 339 */ "cmd ::= DROP INDEX ifexists nm DOT ID_IDX", - /* 340 */ "cmd ::= DROP INDEX ifexists ID_DB|ID_IDX", - /* 341 */ "cmd ::= VACUUM", - /* 342 */ "cmd ::= VACUUM nm", - /* 343 */ "cmd ::= PRAGMA nm dbnm", - /* 344 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", - /* 345 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", - /* 346 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", - /* 347 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", - /* 348 */ "cmd ::= PRAGMA nm DOT ID_PRAGMA", - /* 349 */ "cmd ::= PRAGMA ID_DB|ID_PRAGMA", - /* 350 */ "nmnum ::= plus_num", - /* 351 */ "nmnum ::= nm", - /* 352 */ "nmnum ::= ON", - /* 353 */ "nmnum ::= DELETE", - /* 354 */ "nmnum ::= DEFAULT", - /* 355 */ "plus_num ::= PLUS number", - /* 356 */ "plus_num ::= number", - /* 357 */ "minus_num ::= MINUS number", - /* 358 */ "number ::= INTEGER", - /* 359 */ "number ::= FLOAT", - /* 360 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list END", - /* 361 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause", - /* 362 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list", - /* 363 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON ID_TAB", - /* 364 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm DOT ID_TRIG_NEW", - /* 365 */ "cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW", - /* 366 */ "trigger_time ::= BEFORE", - /* 367 */ "trigger_time ::= AFTER", - /* 368 */ "trigger_time ::= INSTEAD OF", - /* 369 */ "trigger_time ::=", - /* 370 */ "trigger_event ::= DELETE", - /* 371 */ "trigger_event ::= INSERT", - /* 372 */ "trigger_event ::= UPDATE", - /* 373 */ "trigger_event ::= UPDATE OF idlist", - /* 374 */ "foreach_clause ::=", - /* 375 */ "foreach_clause ::= FOR EACH ROW", - /* 376 */ "when_clause ::=", - /* 377 */ "when_clause ::= WHEN expr", - /* 378 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", - /* 379 */ "trigger_cmd_list ::= trigger_cmd SEMI", - /* 380 */ "trigger_cmd_list ::= SEMI", - /* 381 */ "trigger_cmd ::= update_stmt", - /* 382 */ "trigger_cmd ::= insert_stmt", - /* 383 */ "trigger_cmd ::= delete_stmt", - /* 384 */ "trigger_cmd ::= select_stmt", - /* 385 */ "raisetype ::= ROLLBACK|ABORT|FAIL", - /* 386 */ "cmd ::= DROP TRIGGER ifexists fullname", - /* 387 */ "cmd ::= DROP TRIGGER ifexists nm DOT ID_TRIG", - /* 388 */ "cmd ::= DROP TRIGGER ifexists ID_DB|ID_TRIG", - /* 389 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", - /* 390 */ "cmd ::= DETACH database_kw_opt expr", - /* 391 */ "key_opt ::=", - /* 392 */ "key_opt ::= KEY expr", - /* 393 */ "database_kw_opt ::= DATABASE", - /* 394 */ "database_kw_opt ::=", - /* 395 */ "cmd ::= REINDEX", - /* 396 */ "cmd ::= REINDEX nm dbnm", - /* 397 */ "cmd ::= REINDEX ID_COLLATE", - /* 398 */ "cmd ::= REINDEX nm DOT ID_TAB|ID_IDX", - /* 399 */ "cmd ::= REINDEX ID_DB|ID_IDX|ID_TAB", - /* 400 */ "cmd ::= ANALYZE", - /* 401 */ "cmd ::= ANALYZE nm dbnm", - /* 402 */ "cmd ::= ANALYZE nm DOT ID_TAB|ID_IDX", - /* 403 */ "cmd ::= ANALYZE ID_DB|ID_IDX|ID_TAB", - /* 404 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", - /* 405 */ "cmd ::= ALTER TABLE fullname ADD kwcolumn_opt column", - /* 406 */ "cmd ::= ALTER TABLE fullname RENAME TO ID_TAB_NEW", - /* 407 */ "cmd ::= ALTER TABLE nm DOT ID_TAB", - /* 408 */ "cmd ::= ALTER TABLE ID_DB|ID_TAB", - /* 409 */ "kwcolumn_opt ::=", - /* 410 */ "kwcolumn_opt ::= COLUMNKW", - /* 411 */ "cmd ::= create_vtab", - /* 412 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm", - /* 413 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm LP vtabarglist RP", - /* 414 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm DOT ID_TAB_NEW", - /* 415 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists ID_DB|ID_TAB_NEW", - /* 416 */ "vtabarglist ::= vtabarg", - /* 417 */ "vtabarglist ::= vtabarglist COMMA vtabarg", - /* 418 */ "vtabarg ::=", - /* 419 */ "vtabarg ::= vtabarg vtabargtoken", - /* 420 */ "vtabargtoken ::= ANY", - /* 421 */ "vtabargtoken ::= LP anylist RP", - /* 422 */ "anylist ::=", - /* 423 */ "anylist ::= anylist LP anylist RP", - /* 424 */ "anylist ::= anylist ANY", - /* 425 */ "with ::=", - /* 426 */ "with ::= WITH wqlist", - /* 427 */ "with ::= WITH RECURSIVE wqlist", - /* 428 */ "wqlist ::= nm idxlist_opt AS LP select RP", - /* 429 */ "wqlist ::= wqlist COMMA nm idxlist_opt AS LP select RP", - /* 430 */ "wqlist ::= ID_TAB_NEW", + /* 46 */ "id_opt ::= id", + /* 47 */ "id_opt ::=", + /* 48 */ "ids ::= ID|STRING", + /* 49 */ "nm ::= id", + /* 50 */ "nm ::= STRING", + /* 51 */ "nm ::= JOIN_KW", + /* 52 */ "type ::=", + /* 53 */ "type ::= typetoken", + /* 54 */ "typetoken ::= typename", + /* 55 */ "typetoken ::= typename LP signed RP", + /* 56 */ "typetoken ::= typename LP signed COMMA signed RP", + /* 57 */ "typename ::= ids", + /* 58 */ "typename ::= typename ids", + /* 59 */ "typename ::= ID_COL_TYPE", + /* 60 */ "signed ::= plus_num", + /* 61 */ "signed ::= minus_num", + /* 62 */ "carglist ::= carglist ccons", + /* 63 */ "carglist ::=", + /* 64 */ "ccons ::= CONSTRAINT nm", + /* 65 */ "ccons ::= DEFAULT term", + /* 66 */ "ccons ::= DEFAULT LP expr RP", + /* 67 */ "ccons ::= DEFAULT PLUS term", + /* 68 */ "ccons ::= DEFAULT MINUS term", + /* 69 */ "ccons ::= DEFAULT id", + /* 70 */ "ccons ::= DEFAULT CTIME_KW", + /* 71 */ "ccons ::= NULL onconf", + /* 72 */ "ccons ::= NOT NULL onconf", + /* 73 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", + /* 74 */ "ccons ::= UNIQUE onconf", + /* 75 */ "ccons ::= CHECK LP expr RP", + /* 76 */ "ccons ::= REFERENCES nm idxlist_opt refargs", + /* 77 */ "ccons ::= defer_subclause", + /* 78 */ "ccons ::= COLLATE ids", + /* 79 */ "ccons ::= gen_always AS LP expr RP id_opt", + /* 80 */ "ccons ::= CONSTRAINT ID_CONSTR", + /* 81 */ "ccons ::= COLLATE ID_COLLATE", + /* 82 */ "ccons ::= REFERENCES ID_TAB", + /* 83 */ "ccons ::= CHECK LP RP", + /* 84 */ "term ::= NULL", + /* 85 */ "term ::= INTEGER", + /* 86 */ "term ::= FLOAT", + /* 87 */ "term ::= STRING|BLOB", + /* 88 */ "tnm ::= term", + /* 89 */ "tnm ::= nm", + /* 90 */ "gen_always ::= GENERATED ALWAYS", + /* 91 */ "gen_always ::=", + /* 92 */ "autoinc ::=", + /* 93 */ "autoinc ::= AUTOINCR", + /* 94 */ "refargs ::=", + /* 95 */ "refargs ::= refargs refarg", + /* 96 */ "refarg ::= MATCH nm", + /* 97 */ "refarg ::= ON INSERT refact", + /* 98 */ "refarg ::= ON DELETE refact", + /* 99 */ "refarg ::= ON UPDATE refact", + /* 100 */ "refarg ::= MATCH ID_FK_MATCH", + /* 101 */ "refact ::= SET NULL", + /* 102 */ "refact ::= SET DEFAULT", + /* 103 */ "refact ::= CASCADE", + /* 104 */ "refact ::= RESTRICT", + /* 105 */ "refact ::= NO ACTION", + /* 106 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", + /* 107 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", + /* 108 */ "init_deferred_pred_opt ::=", + /* 109 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", + /* 110 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", + /* 111 */ "conslist_opt ::=", + /* 112 */ "conslist_opt ::= COMMA conslist", + /* 113 */ "conslist ::= conslist tconscomma tcons", + /* 114 */ "conslist ::= tcons", + /* 115 */ "tconscomma ::= COMMA", + /* 116 */ "tconscomma ::=", + /* 117 */ "tcons ::= CONSTRAINT nm", + /* 118 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", + /* 119 */ "tcons ::= UNIQUE LP idxlist RP onconf", + /* 120 */ "tcons ::= CHECK LP expr RP onconf", + /* 121 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", + /* 122 */ "tcons ::= CONSTRAINT ID_CONSTR", + /* 123 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB", + /* 124 */ "tcons ::= CHECK LP RP onconf", + /* 125 */ "defer_subclause_opt ::=", + /* 126 */ "defer_subclause_opt ::= defer_subclause", + /* 127 */ "onconf ::=", + /* 128 */ "onconf ::= ON CONFLICT resolvetype", + /* 129 */ "orconf ::=", + /* 130 */ "orconf ::= OR resolvetype", + /* 131 */ "resolvetype ::= raisetype", + /* 132 */ "resolvetype ::= IGNORE", + /* 133 */ "resolvetype ::= REPLACE", + /* 134 */ "cmd ::= DROP TABLE ifexists fullname", + /* 135 */ "cmd ::= DROP TABLE ifexists nm DOT ID_TAB", + /* 136 */ "cmd ::= DROP TABLE ifexists ID_DB|ID_TAB", + /* 137 */ "ifexists ::= IF EXISTS", + /* 138 */ "ifexists ::=", + /* 139 */ "cmd ::= CREATE temp VIEW ifnotexists fullname idxlist_opt AS select", + /* 140 */ "cmd ::= CREATE temp VIEW ifnotexists nm DOT ID_VIEW_NEW", + /* 141 */ "cmd ::= CREATE temp VIEW ifnotexists ID_DB|ID_VIEW_NEW", + /* 142 */ "cmd ::= DROP VIEW ifexists fullname", + /* 143 */ "cmd ::= DROP VIEW ifexists nm DOT ID_VIEW", + /* 144 */ "cmd ::= DROP VIEW ifexists ID_DB|ID_VIEW", + /* 145 */ "cmd ::= select_stmt", + /* 146 */ "select_stmt ::= select", + /* 147 */ "select ::= with selectnowith", + /* 148 */ "selectnowith ::= oneselect", + /* 149 */ "selectnowith ::= selectnowith multiselect_op oneselect", + /* 150 */ "selectnowith ::= values", + /* 151 */ "selectnowith ::= selectnowith COMMA values", + /* 152 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", + /* 153 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt", + /* 154 */ "values ::= VALUES LP nexprlist RP", + /* 155 */ "values ::= values COMMA LP exprlist RP", + /* 156 */ "multiselect_op ::= UNION", + /* 157 */ "multiselect_op ::= UNION ALL", + /* 158 */ "multiselect_op ::= EXCEPT", + /* 159 */ "multiselect_op ::= INTERSECT", + /* 160 */ "distinct ::= DISTINCT", + /* 161 */ "distinct ::= ALL", + /* 162 */ "distinct ::=", + /* 163 */ "sclp ::= selcollist COMMA", + /* 164 */ "sclp ::=", + /* 165 */ "selcollist ::= sclp expr as", + /* 166 */ "selcollist ::= sclp STAR", + /* 167 */ "selcollist ::= sclp tnm DOT STAR", + /* 168 */ "selcollist ::= sclp", + /* 169 */ "selcollist ::= sclp ID_TAB DOT STAR", + /* 170 */ "as ::= AS nm", + /* 171 */ "as ::= ids", + /* 172 */ "as ::= AS ID_ALIAS", + /* 173 */ "as ::= ID_ALIAS", + /* 174 */ "as ::=", + /* 175 */ "from ::=", + /* 176 */ "from ::= FROM joinsrc", + /* 177 */ "joinsrc ::= singlesrc seltablist", + /* 178 */ "joinsrc ::=", + /* 179 */ "seltablist ::= seltablist joinop singlesrc joinconstr_opt", + /* 180 */ "seltablist ::=", + /* 181 */ "singlesrc ::= nm dbnm as indexed_opt", + /* 182 */ "singlesrc ::= LP select RP as", + /* 183 */ "singlesrc ::= LP joinsrc RP as", + /* 184 */ "singlesrc ::= nm dbnm LP exprlist RP as", + /* 185 */ "singlesrc ::=", + /* 186 */ "singlesrc ::= nm DOT", + /* 187 */ "singlesrc ::= nm DOT ID_TAB", + /* 188 */ "singlesrc ::= ID_DB|ID_TAB", + /* 189 */ "singlesrc ::= nm DOT ID_VIEW", + /* 190 */ "singlesrc ::= ID_DB|ID_VIEW", + /* 191 */ "joinconstr_opt ::= ON expr", + /* 192 */ "joinconstr_opt ::= USING LP idlist RP", + /* 193 */ "joinconstr_opt ::=", + /* 194 */ "dbnm ::=", + /* 195 */ "dbnm ::= DOT nm", + /* 196 */ "fullname ::= nm dbnm", + /* 197 */ "joinop ::= COMMA", + /* 198 */ "joinop ::= JOIN", + /* 199 */ "joinop ::= JOIN_KW JOIN", + /* 200 */ "joinop ::= JOIN_KW nm JOIN", + /* 201 */ "joinop ::= JOIN_KW nm nm JOIN", + /* 202 */ "joinop ::= ID_JOIN_OPTS", + /* 203 */ "indexed_opt ::=", + /* 204 */ "indexed_opt ::= INDEXED BY nm", + /* 205 */ "indexed_opt ::= NOT INDEXED", + /* 206 */ "indexed_opt ::= INDEXED BY ID_IDX", + /* 207 */ "orderby_opt ::=", + /* 208 */ "orderby_opt ::= ORDER BY sortlist", + /* 209 */ "sortlist ::= sortlist COMMA expr sortorder nulls", + /* 210 */ "sortlist ::= expr sortorder nulls", + /* 211 */ "sortorder ::= ASC", + /* 212 */ "sortorder ::= DESC", + /* 213 */ "sortorder ::=", + /* 214 */ "nulls ::= NULLS FIRST", + /* 215 */ "nulls ::= NULLS LAST", + /* 216 */ "nulls ::=", + /* 217 */ "groupby_opt ::=", + /* 218 */ "groupby_opt ::= GROUP BY nexprlist", + /* 219 */ "groupby_opt ::= GROUP BY", + /* 220 */ "having_opt ::=", + /* 221 */ "having_opt ::= HAVING expr", + /* 222 */ "limit_opt ::=", + /* 223 */ "limit_opt ::= LIMIT expr", + /* 224 */ "limit_opt ::= LIMIT expr OFFSET expr", + /* 225 */ "limit_opt ::= LIMIT expr COMMA expr", + /* 226 */ "cmd ::= delete_stmt", + /* 227 */ "delete_stmt ::= with DELETE FROM fullname indexed_opt where_opt", + /* 228 */ "delete_stmt ::= with DELETE FROM", + /* 229 */ "delete_stmt ::= with DELETE FROM nm DOT", + /* 230 */ "delete_stmt ::= with DELETE FROM nm DOT ID_TAB", + /* 231 */ "delete_stmt ::= with DELETE FROM ID_DB|ID_TAB", + /* 232 */ "where_opt ::=", + /* 233 */ "where_opt ::= WHERE expr", + /* 234 */ "where_opt ::= WHERE", + /* 235 */ "cmd ::= update_stmt", + /* 236 */ "update_stmt ::= with UPDATE orconf fullname indexed_opt SET setlist from where_opt", + /* 237 */ "update_stmt ::= with UPDATE orconf", + /* 238 */ "update_stmt ::= with UPDATE orconf nm DOT", + /* 239 */ "update_stmt ::= with UPDATE orconf nm DOT ID_TAB", + /* 240 */ "update_stmt ::= with UPDATE orconf ID_DB|ID_TAB", + /* 241 */ "setlist ::= setlist COMMA nm EQ expr", + /* 242 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", + /* 243 */ "setlist ::= nm EQ expr", + /* 244 */ "setlist ::= LP idlist RP EQ expr", + /* 245 */ "setlist ::=", + /* 246 */ "setlist ::= setlist COMMA", + /* 247 */ "setlist ::= setlist COMMA ID_COL", + /* 248 */ "setlist ::= ID_COL", + /* 249 */ "idlist_opt ::=", + /* 250 */ "idlist_opt ::= LP idlist RP", + /* 251 */ "idlist ::= idlist COMMA nm", + /* 252 */ "idlist ::= nm", + /* 253 */ "idlist ::=", + /* 254 */ "idlist ::= idlist COMMA ID_COL", + /* 255 */ "idlist ::= ID_COL", + /* 256 */ "cmd ::= insert_stmt", + /* 257 */ "insert_stmt ::= with insert_cmd INTO fullname idlist_opt select upsert", + /* 258 */ "insert_stmt ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES", + /* 259 */ "insert_stmt ::= with insert_cmd INTO", + /* 260 */ "insert_stmt ::= with insert_cmd INTO nm DOT", + /* 261 */ "insert_stmt ::= with insert_cmd INTO ID_DB|ID_TAB", + /* 262 */ "insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB", + /* 263 */ "insert_cmd ::= INSERT orconf", + /* 264 */ "insert_cmd ::= REPLACE", + /* 265 */ "upsert ::=", + /* 266 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt", + /* 267 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING", + /* 268 */ "upsert ::= ON CONFLICT DO NOTHING", + /* 269 */ "exprx ::= expr not_opt IN ID_DB", + /* 270 */ "exprx ::= expr not_opt IN nm DOT ID_TAB", + /* 271 */ "exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN", + /* 272 */ "exprx ::= tnm DOT ID_TAB|ID_COL", + /* 273 */ "exprx ::= tnm DOT nm DOT ID_COL", + /* 274 */ "exprx ::= expr COLLATE ID_COLLATE", + /* 275 */ "exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP", + /* 276 */ "exprx ::= CTIME_KW", + /* 277 */ "exprx ::= LP nexprlist RP", + /* 278 */ "exprx ::= tnm", + /* 279 */ "exprx ::= tnm DOT nm", + /* 280 */ "exprx ::= tnm DOT nm DOT nm", + /* 281 */ "exprx ::= VARIABLE", + /* 282 */ "exprx ::= expr COLLATE ids", + /* 283 */ "exprx ::= CAST LP expr AS typetoken RP", + /* 284 */ "exprx ::= ID LP distinct exprlist RP", + /* 285 */ "exprx ::= ID LP STAR RP", + /* 286 */ "exprx ::= expr AND expr", + /* 287 */ "exprx ::= expr OR expr", + /* 288 */ "exprx ::= expr LT|GT|GE|LE expr", + /* 289 */ "exprx ::= expr EQ|NE expr", + /* 290 */ "exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", + /* 291 */ "exprx ::= expr PLUS|MINUS expr", + /* 292 */ "exprx ::= expr STAR|SLASH|REM expr", + /* 293 */ "exprx ::= expr CONCAT expr", + /* 294 */ "exprx ::= expr not_opt likeop expr", + /* 295 */ "exprx ::= expr not_opt likeop expr ESCAPE expr", + /* 296 */ "exprx ::= expr ISNULL|NOTNULL", + /* 297 */ "exprx ::= expr NOT NULL", + /* 298 */ "exprx ::= expr IS not_opt expr", + /* 299 */ "exprx ::= NOT expr", + /* 300 */ "exprx ::= BITNOT expr", + /* 301 */ "exprx ::= MINUS expr", + /* 302 */ "exprx ::= PLUS expr", + /* 303 */ "exprx ::= expr not_opt BETWEEN expr AND expr", + /* 304 */ "exprx ::= expr not_opt IN LP exprlist RP", + /* 305 */ "exprx ::= LP select RP", + /* 306 */ "exprx ::= expr not_opt IN LP select RP", + /* 307 */ "exprx ::= expr not_opt IN nm dbnm", + /* 308 */ "exprx ::= EXISTS LP select RP", + /* 309 */ "exprx ::= CASE case_operand case_exprlist case_else END", + /* 310 */ "exprx ::= RAISE LP IGNORE RP", + /* 311 */ "exprx ::= RAISE LP raisetype COMMA nm RP", + /* 312 */ "exprx ::= ID LP distinct exprlist RP filter_over", + /* 313 */ "exprx ::= ID LP STAR RP filter_over", + /* 314 */ "expr ::=", + /* 315 */ "expr ::= exprx", + /* 316 */ "not_opt ::=", + /* 317 */ "not_opt ::= NOT", + /* 318 */ "likeop ::= LIKE_KW|MATCH", + /* 319 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", + /* 320 */ "case_exprlist ::= WHEN expr THEN expr", + /* 321 */ "case_else ::= ELSE expr", + /* 322 */ "case_else ::=", + /* 323 */ "case_operand ::= exprx", + /* 324 */ "case_operand ::=", + /* 325 */ "exprlist ::= nexprlist", + /* 326 */ "exprlist ::=", + /* 327 */ "nexprlist ::= nexprlist COMMA expr", + /* 328 */ "nexprlist ::= exprx", + /* 329 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", + /* 330 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON ID_TAB", + /* 331 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm DOT ID_IDX_NEW", + /* 332 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists ID_DB|ID_IDX_NEW", + /* 333 */ "uniqueflag ::= UNIQUE", + /* 334 */ "uniqueflag ::=", + /* 335 */ "idxlist_opt ::=", + /* 336 */ "idxlist_opt ::= LP idxlist RP", + /* 337 */ "idxlist ::= idxlist COMMA idxlist_single", + /* 338 */ "idxlist ::= idxlist_single", + /* 339 */ "idxlist_single ::= nm collate sortorder", + /* 340 */ "idxlist_single ::= ID_COL", + /* 341 */ "collate ::=", + /* 342 */ "collate ::= COLLATE ids", + /* 343 */ "collate ::= COLLATE ID_COLLATE", + /* 344 */ "cmd ::= DROP INDEX ifexists fullname", + /* 345 */ "cmd ::= DROP INDEX ifexists nm DOT ID_IDX", + /* 346 */ "cmd ::= DROP INDEX ifexists ID_DB|ID_IDX", + /* 347 */ "cmd ::= VACUUM vinto", + /* 348 */ "cmd ::= VACUUM nm vinto", + /* 349 */ "vinto ::= INTO expr", + /* 350 */ "vinto ::=", + /* 351 */ "cmd ::= PRAGMA nm dbnm", + /* 352 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", + /* 353 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", + /* 354 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", + /* 355 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", + /* 356 */ "cmd ::= PRAGMA nm DOT ID_PRAGMA", + /* 357 */ "cmd ::= PRAGMA ID_DB|ID_PRAGMA", + /* 358 */ "nmnum ::= plus_num", + /* 359 */ "nmnum ::= nm", + /* 360 */ "nmnum ::= ON", + /* 361 */ "nmnum ::= DELETE", + /* 362 */ "nmnum ::= DEFAULT", + /* 363 */ "plus_num ::= PLUS number", + /* 364 */ "plus_num ::= number", + /* 365 */ "minus_num ::= MINUS number", + /* 366 */ "number ::= INTEGER", + /* 367 */ "number ::= FLOAT", + /* 368 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list END", + /* 369 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause", + /* 370 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list", + /* 371 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON ID_TAB", + /* 372 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm DOT ID_TRIG_NEW", + /* 373 */ "cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW", + /* 374 */ "trigger_time ::= BEFORE", + /* 375 */ "trigger_time ::= AFTER", + /* 376 */ "trigger_time ::= INSTEAD OF", + /* 377 */ "trigger_time ::=", + /* 378 */ "trigger_event ::= DELETE", + /* 379 */ "trigger_event ::= INSERT", + /* 380 */ "trigger_event ::= UPDATE", + /* 381 */ "trigger_event ::= UPDATE OF idlist", + /* 382 */ "foreach_clause ::=", + /* 383 */ "foreach_clause ::= FOR EACH ROW", + /* 384 */ "when_clause ::=", + /* 385 */ "when_clause ::= WHEN expr", + /* 386 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", + /* 387 */ "trigger_cmd_list ::= trigger_cmd SEMI", + /* 388 */ "trigger_cmd_list ::= SEMI", + /* 389 */ "trigger_cmd ::= update_stmt", + /* 390 */ "trigger_cmd ::= insert_stmt", + /* 391 */ "trigger_cmd ::= delete_stmt", + /* 392 */ "trigger_cmd ::= select_stmt", + /* 393 */ "raisetype ::= ROLLBACK|ABORT|FAIL", + /* 394 */ "cmd ::= DROP TRIGGER ifexists fullname", + /* 395 */ "cmd ::= DROP TRIGGER ifexists nm DOT ID_TRIG", + /* 396 */ "cmd ::= DROP TRIGGER ifexists ID_DB|ID_TRIG", + /* 397 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", + /* 398 */ "cmd ::= DETACH database_kw_opt expr", + /* 399 */ "key_opt ::=", + /* 400 */ "key_opt ::= KEY expr", + /* 401 */ "database_kw_opt ::= DATABASE", + /* 402 */ "database_kw_opt ::=", + /* 403 */ "cmd ::= REINDEX", + /* 404 */ "cmd ::= REINDEX nm dbnm", + /* 405 */ "cmd ::= REINDEX ID_COLLATE", + /* 406 */ "cmd ::= REINDEX nm DOT ID_TAB|ID_IDX", + /* 407 */ "cmd ::= REINDEX ID_DB|ID_IDX|ID_TAB", + /* 408 */ "cmd ::= ANALYZE", + /* 409 */ "cmd ::= ANALYZE nm dbnm", + /* 410 */ "cmd ::= ANALYZE nm DOT ID_TAB|ID_IDX", + /* 411 */ "cmd ::= ANALYZE ID_DB|ID_IDX|ID_TAB", + /* 412 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", + /* 413 */ "cmd ::= ALTER TABLE fullname ADD kwcolumn_opt column", + /* 414 */ "cmd ::= ALTER TABLE fullname RENAME TO ID_TAB_NEW", + /* 415 */ "cmd ::= ALTER TABLE nm DOT ID_TAB", + /* 416 */ "cmd ::= ALTER TABLE ID_DB|ID_TAB", + /* 417 */ "kwcolumn_opt ::=", + /* 418 */ "kwcolumn_opt ::= COLUMNKW", + /* 419 */ "cmd ::= create_vtab", + /* 420 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm", + /* 421 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm LP vtabarglist RP", + /* 422 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm DOT ID_TAB_NEW", + /* 423 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists ID_DB|ID_TAB_NEW", + /* 424 */ "vtabarglist ::= vtabarg", + /* 425 */ "vtabarglist ::= vtabarglist COMMA vtabarg", + /* 426 */ "vtabarg ::=", + /* 427 */ "vtabarg ::= vtabarg vtabargtoken", + /* 428 */ "vtabargtoken ::= ANY", + /* 429 */ "vtabargtoken ::= LP anylist RP", + /* 430 */ "anylist ::=", + /* 431 */ "anylist ::= anylist LP anylist RP", + /* 432 */ "anylist ::= anylist ANY", + /* 433 */ "with ::=", + /* 434 */ "with ::= WITH wqlist", + /* 435 */ "with ::= WITH RECURSIVE wqlist", + /* 436 */ "wqlist ::= wqcte", + /* 437 */ "wqlist ::= wqlist COMMA wqcte", + /* 438 */ "wqlist ::= ID_TAB_NEW", + /* 439 */ "wqcte ::= nm idxlist_opt AS LP select RP", + /* 440 */ "windowdefn_list ::= windowdefn", + /* 441 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", + /* 442 */ "windowdefn ::= nm AS LP window RP", + /* 443 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", + /* 444 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", + /* 445 */ "window ::= ORDER BY sortlist frame_opt", + /* 446 */ "window ::= nm ORDER BY sortlist frame_opt", + /* 447 */ "window ::= frame_opt", + /* 448 */ "window ::= nm frame_opt", + /* 449 */ "frame_opt ::=", + /* 450 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", + /* 451 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", + /* 452 */ "range_or_rows ::= RANGE|ROWS|GROUPS", + /* 453 */ "frame_bound_s ::= frame_bound", + /* 454 */ "frame_bound_s ::= UNBOUNDED PRECEDING", + /* 455 */ "frame_bound_e ::= frame_bound", + /* 456 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", + /* 457 */ "frame_bound ::= expr PRECEDING|FOLLOWING", + /* 458 */ "frame_bound ::= CURRENT ROW", + /* 459 */ "frame_exclude_opt ::=", + /* 460 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", + /* 461 */ "frame_exclude ::= NO OTHERS", + /* 462 */ "frame_exclude ::= CURRENT ROW", + /* 463 */ "frame_exclude ::= GROUP", + /* 464 */ "frame_exclude ::= TIES", + /* 465 */ "window_clause ::= WINDOW windowdefn_list", + /* 466 */ "filter_over ::= filter_clause over_clause", + /* 467 */ "filter_over ::= over_clause", + /* 468 */ "filter_over ::= filter_clause", + /* 469 */ "over_clause ::= OVER LP window RP", + /* 470 */ "over_clause ::= OVER nm", + /* 471 */ "filter_clause ::= FILTER LP WHERE expr RP", }; #endif /* NDEBUG */ @@ -1709,314 +1944,384 @@ static void yy_destructor( ** which appear on the RHS of the rule, but which are not used ** inside the C code. */ - case 171: /* cmd */ - case 174: /* ecmd */ - case 176: /* cmdx */ - case 220: /* select_stmt */ - case 247: /* delete_stmt */ - case 248: /* update_stmt */ - case 251: /* insert_stmt */ - case 270: /* trigger_cmd */ - case 274: /* create_vtab */ -{ -delete (yypminor->yy283); + case 191: /* cmd */ + case 194: /* ecmd */ + case 196: /* cmdx */ + case 243: /* select_stmt */ + case 272: /* delete_stmt */ + case 273: /* update_stmt */ + case 276: /* insert_stmt */ + case 297: /* trigger_cmd */ + case 301: /* create_vtab */ +{ +parser_safe_delete((yypminor->yy363)); } break; - case 175: /* explain */ + case 195: /* explain */ { -delete (yypminor->yy411); +parser_safe_delete((yypminor->yy91)); } break; - case 177: /* transtype */ - case 178: /* trans_opt */ + case 197: /* transtype */ + case 198: /* trans_opt */ { -delete (yypminor->yy404); +parser_safe_delete((yypminor->yy84)); } break; - case 179: /* nm */ - case 186: /* table_options */ - case 189: /* columnid */ - case 192: /* id */ - case 193: /* ids */ - case 195: /* typename */ - case 243: /* dbnm */ - case 262: /* collate */ - case 276: /* vtabarg */ - case 277: /* vtabargtoken */ - case 278: /* anylist */ -{ -delete (yypminor->yy399); + case 199: /* nm */ + case 206: /* table_options */ + case 209: /* columnid */ + case 212: /* id */ + case 213: /* id_opt */ + case 214: /* ids */ + case 216: /* typename */ + case 267: /* dbnm */ + case 288: /* collate */ + case 303: /* vtabarg */ + case 304: /* vtabargtoken */ + case 305: /* anylist */ +{ +parser_safe_delete((yypminor->yy319)); } break; - case 180: /* savepoint_opt */ - case 182: /* ifnotexists */ - case 204: /* autoinc */ - case 212: /* tconscomma */ - case 219: /* ifexists */ - case 255: /* not_opt */ - case 260: /* uniqueflag */ - case 271: /* database_kw_opt */ - case 273: /* kwcolumn_opt */ -{ -delete (yypminor->yy451); + case 200: /* savepoint_opt */ + case 202: /* ifnotexists */ + case 225: /* autoinc */ + case 229: /* gen_always */ + case 235: /* tconscomma */ + case 242: /* ifexists */ + case 280: /* not_opt */ + case 286: /* uniqueflag */ + case 298: /* database_kw_opt */ + case 300: /* kwcolumn_opt */ +{ +parser_safe_delete((yypminor->yy611)); } break; - case 181: /* temp */ - case 226: /* distinct */ + case 201: /* temp */ + case 249: /* distinct */ { -delete (yypminor->yy146); +parser_safe_delete((yypminor->yy386)); } break; - case 183: /* fullname */ + case 203: /* fullname */ { -delete (yypminor->yy360); +parser_safe_delete((yypminor->yy440)); } break; - case 184: /* columnlist */ + case 204: /* columnlist */ { -delete (yypminor->yy202); +parser_safe_delete((yypminor->yy42)); } break; - case 185: /* conslist_opt */ - case 211: /* conslist */ + case 205: /* conslist_opt */ + case 234: /* conslist */ { -delete (yypminor->yy333); +parser_safe_delete((yypminor->yy493)); } break; - case 187: /* select */ - case 222: /* selectnowith */ + case 207: /* select */ + case 245: /* selectnowith */ { -delete (yypminor->yy473); +parser_safe_delete((yypminor->yy313)); } break; - case 188: /* column */ + case 208: /* column */ { -delete (yypminor->yy227); +parser_safe_delete((yypminor->yy147)); } break; - case 190: /* type */ - case 194: /* typetoken */ + case 210: /* type */ + case 215: /* typetoken */ { -delete (yypminor->yy537); +parser_safe_delete((yypminor->yy57)); } break; - case 191: /* carglist */ + case 211: /* carglist */ { -delete (yypminor->yy51); +parser_safe_delete((yypminor->yy51)); } break; - case 196: /* signed */ - case 197: /* plus_num */ - case 198: /* minus_num */ - case 200: /* term */ - case 263: /* nmnum */ - case 264: /* number */ -{ -delete (yypminor->yy469); + case 217: /* signed */ + case 218: /* plus_num */ + case 219: /* minus_num */ + case 221: /* term */ + case 290: /* nmnum */ + case 291: /* number */ +{ +parser_safe_delete((yypminor->yy229)); } break; - case 199: /* ccons */ + case 220: /* ccons */ { -delete (yypminor->yy304); +parser_safe_delete((yypminor->yy464)); } break; - case 201: /* expr */ - case 229: /* where_opt */ - case 231: /* having_opt */ - case 254: /* exprx */ - case 256: /* case_operand */ - case 258: /* case_else */ -{ -delete (yypminor->yy352); + case 222: /* expr */ + case 252: /* where_opt */ + case 254: /* having_opt */ + case 279: /* exprx */ + case 282: /* case_operand */ + case 284: /* case_else */ + case 289: /* vinto */ + case 295: /* when_clause */ + case 299: /* key_opt */ +{ +parser_safe_delete((yypminor->yy512)); } break; - case 202: /* onconf */ - case 216: /* resolvetype */ - case 217: /* orconf */ + case 223: /* onconf */ + case 239: /* resolvetype */ + case 240: /* orconf */ { -delete (yypminor->yy338); +parser_safe_delete((yypminor->yy418)); } break; - case 203: /* sortorder */ + case 224: /* sortorder */ { -delete (yypminor->yy309); +parser_safe_delete((yypminor->yy549)); } break; - case 205: /* idxlist_opt */ - case 214: /* idxlist */ + case 226: /* idxlist_opt */ + case 237: /* idxlist */ { -delete (yypminor->yy223); +parser_safe_delete((yypminor->yy223)); } break; - case 206: /* refargs */ + case 227: /* refargs */ { -delete (yypminor->yy184); +parser_safe_delete((yypminor->yy584)); } break; - case 207: /* defer_subclause */ - case 215: /* defer_subclause_opt */ + case 228: /* defer_subclause */ + case 238: /* defer_subclause_opt */ { -delete (yypminor->yy329); +parser_safe_delete((yypminor->yy9)); } break; - case 208: /* refarg */ + case 230: /* tnm */ { -delete (yypminor->yy347); +parser_safe_delete((yypminor->yy590)); } break; - case 209: /* refact */ + case 231: /* refarg */ { -delete (yypminor->yy104); +parser_safe_delete((yypminor->yy507)); } break; - case 210: /* init_deferred_pred_opt */ + case 232: /* refact */ { -delete (yypminor->yy392); +parser_safe_delete((yypminor->yy104)); } break; - case 213: /* tcons */ + case 233: /* init_deferred_pred_opt */ { -delete (yypminor->yy406); +parser_safe_delete((yypminor->yy312)); } break; - case 221: /* with */ - case 279: /* wqlist */ + case 236: /* tcons */ { -delete (yypminor->yy321); +parser_safe_delete((yypminor->yy246)); } break; - case 223: /* oneselect */ + case 244: /* with */ { -delete (yypminor->yy310); +parser_safe_delete((yypminor->yy1)); } break; - case 224: /* multiselect_op */ + case 246: /* oneselect */ { -delete (yypminor->yy462); +parser_safe_delete((yypminor->yy470)); } break; - case 225: /* values */ + case 247: /* multiselect_op */ { -delete (yypminor->yy166); +parser_safe_delete((yypminor->yy382)); } break; - case 227: /* selcollist */ - case 236: /* sclp */ + case 248: /* values */ { -delete (yypminor->yy373); +parser_safe_delete((yypminor->yy486)); } break; - case 228: /* from */ - case 238: /* joinsrc */ + case 250: /* selcollist */ + case 260: /* sclp */ { -delete (yypminor->yy511); +parser_safe_delete((yypminor->yy53)); } break; - case 230: /* groupby_opt */ - case 234: /* nexprlist */ - case 235: /* exprlist */ - case 257: /* case_exprlist */ + case 251: /* from */ + case 262: /* joinsrc */ { -delete (yypminor->yy551); +parser_safe_delete((yypminor->yy31)); } break; - case 232: /* orderby_opt */ - case 246: /* sortlist */ + case 253: /* groupby_opt */ + case 258: /* nexprlist */ + case 259: /* exprlist */ + case 283: /* case_exprlist */ { -delete (yypminor->yy163); +parser_safe_delete((yypminor->yy71)); } break; - case 233: /* limit_opt */ + case 255: /* orderby_opt */ + case 270: /* sortlist */ { -delete (yypminor->yy484); +parser_safe_delete((yypminor->yy403)); } break; - case 237: /* as */ + case 256: /* limit_opt */ { -delete (yypminor->yy200); +parser_safe_delete((yypminor->yy4)); } break; - case 239: /* singlesrc */ + case 257: /* window_clause */ + case 308: /* windowdefn_list */ { -delete (yypminor->yy201); +parser_safe_delete((yypminor->yy299)); } break; - case 240: /* seltablist */ + case 261: /* as */ { -delete (yypminor->yy131); +parser_safe_delete((yypminor->yy200)); } break; - case 241: /* joinop */ + case 263: /* singlesrc */ { -delete (yypminor->yy301); +parser_safe_delete((yypminor->yy441)); } break; - case 242: /* joinconstr_opt */ + case 264: /* seltablist */ { -delete (yypminor->yy295); +parser_safe_delete((yypminor->yy451)); } break; - case 244: /* indexed_opt */ + case 265: /* joinop */ { -delete (yypminor->yy192); +parser_safe_delete((yypminor->yy221)); } break; - case 245: /* idlist */ - case 250: /* idlist_opt */ - case 275: /* vtabarglist */ + case 266: /* joinconstr_opt */ { -delete (yypminor->yy95); +parser_safe_delete((yypminor->yy295)); } break; - case 249: /* setlist */ + case 268: /* indexed_opt */ { -delete (yypminor->yy521); +parser_safe_delete((yypminor->yy592)); } break; - case 252: /* insert_cmd */ + case 269: /* idlist */ + case 275: /* idlist_opt */ + case 302: /* vtabarglist */ { -delete (yypminor->yy105); +parser_safe_delete((yypminor->yy575)); } break; - case 253: /* upsert */ + case 271: /* nulls */ { -delete (yypminor->yy560); +parser_safe_delete((yypminor->yy579)); } break; - case 259: /* likeop */ + case 274: /* setlist */ { -delete (yypminor->yy520); +parser_safe_delete((yypminor->yy201)); } break; - case 261: /* idxlist_single */ + case 277: /* insert_cmd */ { -delete (yypminor->yy108); +parser_safe_delete((yypminor->yy504)); } break; - case 265: /* trigger_time */ + case 278: /* upsert */ { -delete (yypminor->yy132); +parser_safe_delete((yypminor->yy400)); } break; - case 266: /* trigger_event */ + case 281: /* likeop */ { -delete (yypminor->yy552); +parser_safe_delete((yypminor->yy40)); } break; - case 267: /* foreach_clause */ + case 285: /* filter_over */ { -delete (yypminor->yy3); +parser_safe_delete((yypminor->yy247)); } break; - case 268: /* when_clause */ - case 272: /* key_opt */ + case 287: /* idxlist_single */ { -if ((yypminor->yy352)) delete (yypminor->yy352); +parser_safe_delete((yypminor->yy268)); } break; - case 269: /* trigger_cmd_list */ + case 292: /* trigger_time */ { -delete (yypminor->yy430); +parser_safe_delete((yypminor->yy532)); +} + break; + case 293: /* trigger_event */ +{ +parser_safe_delete((yypminor->yy151)); +} + break; + case 294: /* foreach_clause */ +{ +parser_safe_delete((yypminor->yy83)); +} + break; + case 296: /* trigger_cmd_list */ +{ +parser_safe_delete((yypminor->yy110)); +} + break; + case 306: /* wqlist */ +{ +parser_safe_delete((yypminor->yy593)); +} + break; + case 307: /* wqcte */ +{ +parser_safe_delete((yypminor->yy446)); +} + break; + case 309: /* windowdefn */ +{ +parser_safe_delete((yypminor->yy266)); +} + break; + case 310: /* window */ +{ +parser_safe_delete((yypminor->yy334)); +} + break; + case 311: /* frame_opt */ +{ +parser_safe_delete((yypminor->yy41)); +} + break; + case 312: /* range_or_rows */ +{ +parser_safe_delete((yypminor->yy419)); +} + break; + case 313: /* frame_bound_s */ + case 315: /* frame_bound_e */ +{ +parser_safe_delete((yypminor->yy442)); +} + break; + case 316: /* frame_bound */ +{ +parser_safe_delete((yypminor->yy442));parser_safe_delete((yypminor->yy442));parser_safe_delete((yypminor->yy442)); +} + break; + case 318: /* filter_clause */ +{ +parser_safe_delete((yypminor->yy397)); +} + break; + case 319: /* over_clause */ +{ +parser_safe_delete((yypminor->yy248)); } break; default: break; /* If no destructor action specified: do nothing */ @@ -2197,6 +2502,7 @@ static int yy_find_reduce_action( ** The following routine is called if the stack overflows. */ static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){ + UNUSED(yypMinor); sqlite3_parseARG_FETCH; yypParser->yyidx--; #ifndef NDEBUG @@ -2208,7 +2514,6 @@ static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){ /* Here code is inserted which will execute if the parser ** stack every overflows */ - UNUSED_PARAMETER(yypMinor); parserContext->error(QObject::tr("Parser stack overflow")); sqlite3_parseARG_STORE; /* Suppress warning about unused %extra_argument var */ } @@ -2267,437 +2572,478 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ } yyRuleInfo[] = { - { 172, 1 }, - { 173, 2 }, - { 173, 1 }, - { 174, 1 }, - { 174, 3 }, - { 175, 0 }, - { 175, 1 }, - { 175, 3 }, - { 176, 1 }, - { 171, 3 }, - { 178, 0 }, - { 178, 1 }, - { 178, 2 }, - { 178, 2 }, - { 177, 0 }, - { 177, 1 }, - { 177, 1 }, - { 177, 1 }, - { 171, 2 }, - { 171, 2 }, - { 171, 2 }, - { 180, 1 }, - { 180, 0 }, - { 171, 2 }, - { 171, 3 }, - { 171, 5 }, - { 171, 2 }, - { 171, 3 }, - { 171, 5 }, - { 171, 10 }, - { 171, 7 }, - { 171, 7 }, - { 171, 5 }, - { 186, 0 }, - { 186, 2 }, - { 186, 2 }, - { 182, 0 }, - { 182, 3 }, - { 181, 1 }, - { 181, 0 }, - { 184, 3 }, - { 184, 1 }, - { 188, 3 }, - { 189, 1 }, - { 189, 1 }, { 192, 1 }, + { 193, 2 }, { 193, 1 }, - { 179, 1 }, - { 179, 1 }, - { 179, 1 }, - { 190, 0 }, - { 190, 1 }, { 194, 1 }, - { 194, 4 }, - { 194, 6 }, + { 194, 3 }, + { 195, 0 }, { 195, 1 }, - { 195, 2 }, - { 195, 1 }, - { 196, 1 }, + { 195, 3 }, { 196, 1 }, + { 191, 3 }, + { 198, 0 }, + { 198, 1 }, + { 198, 2 }, + { 198, 2 }, + { 197, 0 }, + { 197, 1 }, + { 197, 1 }, + { 197, 1 }, + { 191, 2 }, + { 191, 2 }, { 191, 2 }, - { 191, 0 }, - { 199, 2 }, - { 199, 2 }, - { 199, 4 }, - { 199, 3 }, - { 199, 3 }, - { 199, 2 }, - { 199, 2 }, - { 199, 2 }, - { 199, 3 }, - { 199, 5 }, - { 199, 2 }, - { 199, 4 }, - { 199, 4 }, - { 199, 1 }, - { 199, 2 }, - { 199, 2 }, - { 199, 2 }, - { 199, 2 }, - { 199, 3 }, - { 200, 1 }, - { 200, 1 }, - { 200, 1 }, { 200, 1 }, - { 204, 0 }, - { 204, 1 }, + { 200, 0 }, + { 191, 2 }, + { 191, 3 }, + { 191, 5 }, + { 191, 2 }, + { 191, 3 }, + { 191, 5 }, + { 191, 10 }, + { 191, 7 }, + { 191, 7 }, + { 191, 5 }, { 206, 0 }, { 206, 2 }, - { 208, 2 }, - { 208, 3 }, - { 208, 3 }, + { 206, 2 }, + { 202, 0 }, + { 202, 3 }, + { 201, 1 }, + { 201, 0 }, + { 204, 3 }, + { 204, 1 }, { 208, 3 }, - { 208, 2 }, - { 209, 2 }, - { 209, 2 }, { 209, 1 }, { 209, 1 }, - { 209, 2 }, - { 207, 3 }, - { 207, 2 }, - { 210, 0 }, - { 210, 2 }, - { 210, 2 }, - { 185, 0 }, - { 185, 2 }, - { 211, 3 }, - { 211, 1 }, { 212, 1 }, - { 212, 0 }, - { 213, 2 }, - { 213, 7 }, - { 213, 5 }, - { 213, 5 }, - { 213, 10 }, - { 213, 2 }, - { 213, 7 }, - { 213, 4 }, - { 215, 0 }, + { 213, 1 }, + { 213, 0 }, + { 214, 1 }, + { 199, 1 }, + { 199, 1 }, + { 199, 1 }, + { 210, 0 }, + { 210, 1 }, { 215, 1 }, - { 202, 0 }, - { 202, 3 }, - { 217, 0 }, - { 217, 2 }, + { 215, 4 }, + { 215, 6 }, { 216, 1 }, + { 216, 2 }, { 216, 1 }, - { 216, 1 }, - { 171, 4 }, - { 171, 6 }, - { 171, 4 }, - { 219, 2 }, - { 219, 0 }, - { 171, 8 }, - { 171, 7 }, - { 171, 5 }, - { 171, 4 }, - { 171, 6 }, - { 171, 4 }, - { 171, 1 }, + { 217, 1 }, + { 217, 1 }, + { 211, 2 }, + { 211, 0 }, + { 220, 2 }, + { 220, 2 }, + { 220, 4 }, + { 220, 3 }, + { 220, 3 }, + { 220, 2 }, + { 220, 2 }, + { 220, 2 }, + { 220, 3 }, + { 220, 5 }, + { 220, 2 }, + { 220, 4 }, + { 220, 4 }, { 220, 1 }, - { 187, 2 }, - { 222, 1 }, - { 222, 3 }, - { 222, 1 }, - { 222, 3 }, - { 223, 9 }, - { 225, 4 }, - { 225, 5 }, - { 224, 1 }, - { 224, 2 }, - { 224, 1 }, - { 224, 1 }, - { 226, 1 }, - { 226, 1 }, - { 226, 0 }, - { 236, 2 }, - { 236, 0 }, - { 227, 3 }, + { 220, 2 }, + { 220, 6 }, + { 220, 2 }, + { 220, 2 }, + { 220, 2 }, + { 220, 3 }, + { 221, 1 }, + { 221, 1 }, + { 221, 1 }, + { 221, 1 }, + { 230, 1 }, + { 230, 1 }, + { 229, 2 }, + { 229, 0 }, + { 225, 0 }, + { 225, 1 }, + { 227, 0 }, { 227, 2 }, - { 227, 4 }, - { 227, 1 }, - { 227, 4 }, - { 237, 2 }, - { 237, 1 }, - { 237, 2 }, - { 237, 1 }, - { 237, 0 }, - { 228, 0 }, + { 231, 2 }, + { 231, 3 }, + { 231, 3 }, + { 231, 3 }, + { 231, 2 }, + { 232, 2 }, + { 232, 2 }, + { 232, 1 }, + { 232, 1 }, + { 232, 2 }, + { 228, 3 }, { 228, 2 }, - { 238, 2 }, + { 233, 0 }, + { 233, 2 }, + { 233, 2 }, + { 205, 0 }, + { 205, 2 }, + { 234, 3 }, + { 234, 1 }, + { 235, 1 }, + { 235, 0 }, + { 236, 2 }, + { 236, 7 }, + { 236, 5 }, + { 236, 5 }, + { 236, 10 }, + { 236, 2 }, + { 236, 7 }, + { 236, 4 }, { 238, 0 }, - { 240, 4 }, + { 238, 1 }, + { 223, 0 }, + { 223, 3 }, { 240, 0 }, - { 239, 4 }, - { 239, 4 }, - { 239, 4 }, - { 239, 6 }, - { 239, 0 }, - { 239, 2 }, - { 239, 3 }, + { 240, 2 }, + { 239, 1 }, { 239, 1 }, - { 239, 3 }, { 239, 1 }, + { 191, 4 }, + { 191, 6 }, + { 191, 4 }, { 242, 2 }, - { 242, 4 }, { 242, 0 }, - { 243, 0 }, - { 243, 2 }, - { 183, 2 }, - { 241, 1 }, - { 241, 1 }, - { 241, 2 }, - { 241, 3 }, - { 241, 4 }, - { 241, 1 }, - { 244, 0 }, - { 244, 3 }, - { 244, 2 }, - { 244, 3 }, - { 232, 0 }, - { 232, 3 }, - { 246, 4 }, - { 246, 2 }, - { 203, 1 }, - { 203, 1 }, - { 203, 0 }, - { 230, 0 }, - { 230, 3 }, - { 230, 2 }, - { 231, 0 }, - { 231, 2 }, - { 233, 0 }, - { 233, 2 }, - { 233, 4 }, - { 233, 4 }, - { 171, 1 }, - { 247, 6 }, - { 247, 3 }, - { 247, 5 }, - { 247, 6 }, - { 247, 4 }, - { 229, 0 }, - { 229, 2 }, - { 229, 1 }, - { 171, 1 }, - { 248, 8 }, - { 248, 3 }, - { 248, 5 }, - { 248, 6 }, - { 248, 4 }, - { 249, 5 }, - { 249, 7 }, - { 249, 3 }, - { 249, 5 }, - { 249, 0 }, - { 249, 2 }, - { 249, 3 }, - { 249, 1 }, - { 250, 0 }, - { 250, 3 }, - { 245, 3 }, + { 191, 8 }, + { 191, 7 }, + { 191, 5 }, + { 191, 4 }, + { 191, 6 }, + { 191, 4 }, + { 191, 1 }, + { 243, 1 }, + { 207, 2 }, { 245, 1 }, - { 245, 0 }, { 245, 3 }, { 245, 1 }, - { 171, 1 }, - { 251, 7 }, - { 251, 7 }, - { 251, 3 }, - { 251, 5 }, - { 251, 4 }, - { 251, 6 }, - { 252, 2 }, - { 252, 1 }, - { 253, 0 }, - { 253, 11 }, - { 253, 8 }, - { 253, 4 }, - { 254, 2 }, - { 254, 4 }, - { 254, 5 }, - { 254, 4 }, - { 254, 5 }, - { 254, 4 }, - { 254, 6 }, - { 254, 1 }, - { 254, 3 }, - { 254, 5 }, - { 254, 3 }, - { 254, 6 }, - { 254, 1 }, - { 254, 1 }, - { 254, 3 }, - { 254, 1 }, - { 254, 1 }, - { 254, 3 }, - { 254, 5 }, - { 254, 1 }, - { 254, 3 }, - { 254, 6 }, - { 254, 5 }, - { 254, 4 }, - { 254, 3 }, - { 254, 3 }, - { 254, 3 }, - { 254, 3 }, - { 254, 3 }, - { 254, 3 }, - { 254, 3 }, - { 254, 3 }, - { 254, 4 }, - { 254, 6 }, - { 254, 2 }, - { 254, 3 }, - { 254, 4 }, - { 254, 2 }, - { 254, 2 }, - { 254, 2 }, - { 254, 2 }, - { 254, 6 }, - { 254, 6 }, - { 254, 3 }, - { 254, 6 }, - { 254, 5 }, - { 254, 4 }, - { 254, 5 }, - { 254, 4 }, - { 254, 6 }, - { 201, 0 }, - { 201, 1 }, - { 255, 0 }, - { 255, 1 }, - { 259, 1 }, - { 257, 5 }, - { 257, 4 }, - { 258, 2 }, - { 258, 0 }, - { 256, 1 }, - { 256, 0 }, - { 235, 1 }, - { 235, 0 }, - { 234, 3 }, - { 234, 1 }, - { 171, 12 }, - { 171, 8 }, - { 171, 7 }, - { 171, 5 }, - { 260, 1 }, + { 245, 3 }, + { 246, 9 }, + { 246, 10 }, + { 248, 4 }, + { 248, 5 }, + { 247, 1 }, + { 247, 2 }, + { 247, 1 }, + { 247, 1 }, + { 249, 1 }, + { 249, 1 }, + { 249, 0 }, + { 260, 2 }, { 260, 0 }, - { 205, 0 }, - { 205, 3 }, - { 214, 3 }, - { 214, 1 }, - { 261, 3 }, + { 250, 3 }, + { 250, 2 }, + { 250, 4 }, + { 250, 1 }, + { 250, 4 }, + { 261, 2 }, { 261, 1 }, - { 262, 0 }, - { 262, 2 }, + { 261, 2 }, + { 261, 1 }, + { 261, 0 }, + { 251, 0 }, + { 251, 2 }, { 262, 2 }, - { 171, 4 }, - { 171, 6 }, - { 171, 4 }, - { 171, 1 }, - { 171, 2 }, - { 171, 3 }, - { 171, 5 }, - { 171, 6 }, - { 171, 5 }, - { 171, 6 }, - { 171, 4 }, - { 171, 2 }, - { 263, 1 }, - { 263, 1 }, - { 263, 1 }, + { 262, 0 }, + { 264, 4 }, + { 264, 0 }, + { 263, 4 }, + { 263, 4 }, + { 263, 4 }, + { 263, 6 }, + { 263, 0 }, + { 263, 2 }, + { 263, 3 }, { 263, 1 }, + { 263, 3 }, { 263, 1 }, - { 197, 2 }, - { 197, 1 }, - { 198, 2 }, - { 264, 1 }, - { 264, 1 }, - { 171, 15 }, - { 171, 12 }, - { 171, 14 }, - { 171, 10 }, - { 171, 7 }, - { 171, 5 }, + { 266, 2 }, + { 266, 4 }, + { 266, 0 }, + { 267, 0 }, + { 267, 2 }, + { 203, 2 }, { 265, 1 }, { 265, 1 }, { 265, 2 }, - { 265, 0 }, - { 266, 1 }, - { 266, 1 }, - { 266, 1 }, - { 266, 3 }, - { 267, 0 }, - { 267, 3 }, + { 265, 3 }, + { 265, 4 }, + { 265, 1 }, { 268, 0 }, + { 268, 3 }, { 268, 2 }, - { 269, 3 }, - { 269, 2 }, - { 269, 1 }, - { 270, 1 }, - { 270, 1 }, - { 270, 1 }, - { 270, 1 }, - { 218, 1 }, - { 171, 4 }, - { 171, 6 }, - { 171, 4 }, - { 171, 6 }, - { 171, 3 }, - { 272, 0 }, - { 272, 2 }, - { 271, 1 }, + { 268, 3 }, + { 255, 0 }, + { 255, 3 }, + { 270, 5 }, + { 270, 3 }, + { 224, 1 }, + { 224, 1 }, + { 224, 0 }, + { 271, 2 }, + { 271, 2 }, { 271, 0 }, - { 171, 1 }, - { 171, 3 }, - { 171, 2 }, - { 171, 4 }, - { 171, 2 }, - { 171, 1 }, - { 171, 3 }, - { 171, 4 }, - { 171, 2 }, - { 171, 6 }, - { 171, 6 }, - { 171, 6 }, - { 171, 5 }, - { 171, 3 }, - { 273, 0 }, - { 273, 1 }, - { 171, 1 }, - { 274, 8 }, - { 274, 11 }, + { 253, 0 }, + { 253, 3 }, + { 253, 2 }, + { 254, 0 }, + { 254, 2 }, + { 256, 0 }, + { 256, 2 }, + { 256, 4 }, + { 256, 4 }, + { 191, 1 }, + { 272, 6 }, + { 272, 3 }, + { 272, 5 }, + { 272, 6 }, + { 272, 4 }, + { 252, 0 }, + { 252, 2 }, + { 252, 1 }, + { 191, 1 }, + { 273, 9 }, + { 273, 3 }, + { 273, 5 }, + { 273, 6 }, + { 273, 4 }, + { 274, 5 }, { 274, 7 }, + { 274, 3 }, { 274, 5 }, - { 275, 1 }, + { 274, 0 }, + { 274, 2 }, + { 274, 3 }, + { 274, 1 }, + { 275, 0 }, { 275, 3 }, - { 276, 0 }, - { 276, 2 }, + { 269, 3 }, + { 269, 1 }, + { 269, 0 }, + { 269, 3 }, + { 269, 1 }, + { 191, 1 }, + { 276, 7 }, + { 276, 7 }, + { 276, 3 }, + { 276, 5 }, + { 276, 4 }, + { 276, 6 }, + { 277, 2 }, { 277, 1 }, - { 277, 3 }, { 278, 0 }, + { 278, 11 }, + { 278, 8 }, { 278, 4 }, - { 278, 2 }, - { 221, 0 }, - { 221, 2 }, - { 221, 3 }, + { 279, 4 }, + { 279, 6 }, + { 279, 1 }, + { 279, 3 }, + { 279, 5 }, + { 279, 3 }, { 279, 6 }, - { 279, 8 }, { 279, 1 }, + { 279, 3 }, + { 279, 1 }, + { 279, 3 }, + { 279, 5 }, + { 279, 1 }, + { 279, 3 }, + { 279, 6 }, + { 279, 5 }, + { 279, 4 }, + { 279, 3 }, + { 279, 3 }, + { 279, 3 }, + { 279, 3 }, + { 279, 3 }, + { 279, 3 }, + { 279, 3 }, + { 279, 3 }, + { 279, 4 }, + { 279, 6 }, + { 279, 2 }, + { 279, 3 }, + { 279, 4 }, + { 279, 2 }, + { 279, 2 }, + { 279, 2 }, + { 279, 2 }, + { 279, 6 }, + { 279, 6 }, + { 279, 3 }, + { 279, 6 }, + { 279, 5 }, + { 279, 4 }, + { 279, 5 }, + { 279, 4 }, + { 279, 6 }, + { 279, 6 }, + { 279, 5 }, + { 222, 0 }, + { 222, 1 }, + { 280, 0 }, + { 280, 1 }, + { 281, 1 }, + { 283, 5 }, + { 283, 4 }, + { 284, 2 }, + { 284, 0 }, + { 282, 1 }, + { 282, 0 }, + { 259, 1 }, + { 259, 0 }, + { 258, 3 }, + { 258, 1 }, + { 191, 12 }, + { 191, 8 }, + { 191, 7 }, + { 191, 5 }, + { 286, 1 }, + { 286, 0 }, + { 226, 0 }, + { 226, 3 }, + { 237, 3 }, + { 237, 1 }, + { 287, 3 }, + { 287, 1 }, + { 288, 0 }, + { 288, 2 }, + { 288, 2 }, + { 191, 4 }, + { 191, 6 }, + { 191, 4 }, + { 191, 2 }, + { 191, 3 }, + { 289, 2 }, + { 289, 0 }, + { 191, 3 }, + { 191, 5 }, + { 191, 6 }, + { 191, 5 }, + { 191, 6 }, + { 191, 4 }, + { 191, 2 }, + { 290, 1 }, + { 290, 1 }, + { 290, 1 }, + { 290, 1 }, + { 290, 1 }, + { 218, 2 }, + { 218, 1 }, + { 219, 2 }, + { 291, 1 }, + { 291, 1 }, + { 191, 15 }, + { 191, 12 }, + { 191, 14 }, + { 191, 10 }, + { 191, 7 }, + { 191, 5 }, + { 292, 1 }, + { 292, 1 }, + { 292, 2 }, + { 292, 0 }, + { 293, 1 }, + { 293, 1 }, + { 293, 1 }, + { 293, 3 }, + { 294, 0 }, + { 294, 3 }, + { 295, 0 }, + { 295, 2 }, + { 296, 3 }, + { 296, 2 }, + { 296, 1 }, + { 297, 1 }, + { 297, 1 }, + { 297, 1 }, + { 297, 1 }, + { 241, 1 }, + { 191, 4 }, + { 191, 6 }, + { 191, 4 }, + { 191, 6 }, + { 191, 3 }, + { 299, 0 }, + { 299, 2 }, + { 298, 1 }, + { 298, 0 }, + { 191, 1 }, + { 191, 3 }, + { 191, 2 }, + { 191, 4 }, + { 191, 2 }, + { 191, 1 }, + { 191, 3 }, + { 191, 4 }, + { 191, 2 }, + { 191, 6 }, + { 191, 6 }, + { 191, 6 }, + { 191, 5 }, + { 191, 3 }, + { 300, 0 }, + { 300, 1 }, + { 191, 1 }, + { 301, 8 }, + { 301, 11 }, + { 301, 7 }, + { 301, 5 }, + { 302, 1 }, + { 302, 3 }, + { 303, 0 }, + { 303, 2 }, + { 304, 1 }, + { 304, 3 }, + { 305, 0 }, + { 305, 4 }, + { 305, 2 }, + { 244, 0 }, + { 244, 2 }, + { 244, 3 }, + { 306, 1 }, + { 306, 3 }, + { 306, 1 }, + { 307, 6 }, + { 308, 1 }, + { 308, 3 }, + { 309, 5 }, + { 310, 5 }, + { 310, 6 }, + { 310, 4 }, + { 310, 5 }, + { 310, 1 }, + { 310, 2 }, + { 311, 0 }, + { 311, 3 }, + { 311, 6 }, + { 312, 1 }, + { 313, 1 }, + { 313, 2 }, + { 315, 1 }, + { 315, 2 }, + { 316, 2 }, + { 316, 2 }, + { 314, 0 }, + { 314, 2 }, + { 317, 2 }, + { 317, 2 }, + { 317, 1 }, + { 317, 1 }, + { 257, 2 }, + { 285, 2 }, + { 285, 1 }, + { 285, 1 }, + { 319, 4 }, + { 319, 2 }, + { 318, 5 }, }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2757,2305 +3103,2557 @@ static void yy_reduce( ** break; */ case 1: /* cmdlist ::= cmdlist ecmd */ -{parserContext->addQuery(yymsp[0].minor.yy283); DONT_INHERIT_TOKENS("cmdlist");} +{parserContext->addQuery(yymsp[0].minor.yy363); DONT_INHERIT_TOKENS("cmdlist");} break; case 2: /* cmdlist ::= ecmd */ -{parserContext->addQuery(yymsp[0].minor.yy283);} +{parserContext->addQuery(yymsp[0].minor.yy363);} break; case 3: /* ecmd ::= SEMI */ -{yygotominor.yy283 = new SqliteEmptyQuery();} +{yygotominor.yy363 = new SqliteEmptyQuery();} break; case 4: /* ecmd ::= explain cmdx SEMI */ { - yygotominor.yy283 = yymsp[-1].minor.yy283; - yygotominor.yy283->explain = yymsp[-2].minor.yy411->explain; - yygotominor.yy283->queryPlan = yymsp[-2].minor.yy411->queryPlan; - delete yymsp[-2].minor.yy411; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = yymsp[-1].minor.yy363; + yygotominor.yy363->explain = yymsp[-2].minor.yy91->explain; + yygotominor.yy363->queryPlan = yymsp[-2].minor.yy91->queryPlan; + delete yymsp[-2].minor.yy91; + objectForTokens = yygotominor.yy363; } break; case 5: /* explain ::= */ -{yygotominor.yy411 = new ParserStubExplain(false, false);} +{yygotominor.yy91 = new ParserStubExplain(false, false);} break; case 6: /* explain ::= EXPLAIN */ -{yygotominor.yy411 = new ParserStubExplain(true, false);} +{yygotominor.yy91 = new ParserStubExplain(true, false);} break; case 7: /* explain ::= EXPLAIN QUERY PLAN */ -{yygotominor.yy411 = new ParserStubExplain(true, true);} +{yygotominor.yy91 = new ParserStubExplain(true, true);} break; case 8: /* cmdx ::= cmd */ - case 381: /* trigger_cmd ::= update_stmt */ yytestcase(yyruleno==381); - case 382: /* trigger_cmd ::= insert_stmt */ yytestcase(yyruleno==382); - case 383: /* trigger_cmd ::= delete_stmt */ yytestcase(yyruleno==383); - case 384: /* trigger_cmd ::= select_stmt */ yytestcase(yyruleno==384); - case 411: /* cmd ::= create_vtab */ yytestcase(yyruleno==411); -{yygotominor.yy283 = yymsp[0].minor.yy283;} + case 389: /* trigger_cmd ::= update_stmt */ yytestcase(yyruleno==389); + case 390: /* trigger_cmd ::= insert_stmt */ yytestcase(yyruleno==390); + case 391: /* trigger_cmd ::= delete_stmt */ yytestcase(yyruleno==391); + case 392: /* trigger_cmd ::= select_stmt */ yytestcase(yyruleno==392); + case 419: /* cmd ::= create_vtab */ yytestcase(yyruleno==419); +{yygotominor.yy363 = yymsp[0].minor.yy363;} break; case 9: /* cmd ::= BEGIN transtype trans_opt */ { - yygotominor.yy283 = new SqliteBeginTrans( - yymsp[-1].minor.yy404->type, - yymsp[0].minor.yy404->transactionKw, - yymsp[0].minor.yy404->name + yygotominor.yy363 = new SqliteBeginTrans( + yymsp[-1].minor.yy84->type, + yymsp[0].minor.yy84->transactionKw, + yymsp[0].minor.yy84->name ); - delete yymsp[0].minor.yy404; - delete yymsp[-1].minor.yy404; - objectForTokens = yygotominor.yy283; + delete yymsp[0].minor.yy84; + delete yymsp[-1].minor.yy84; + objectForTokens = yygotominor.yy363; } break; case 10: /* trans_opt ::= */ case 14: /* transtype ::= */ yytestcase(yyruleno==14); -{yygotominor.yy404 = new ParserStubTransDetails();} +{yygotominor.yy84 = new ParserStubTransDetails();} break; case 11: /* trans_opt ::= TRANSACTION */ { - yygotominor.yy404 = new ParserStubTransDetails(); - yygotominor.yy404->transactionKw = true; + yygotominor.yy84 = new ParserStubTransDetails(); + yygotominor.yy84->transactionKw = true; } break; case 12: /* trans_opt ::= TRANSACTION nm */ case 13: /* trans_opt ::= TRANSACTION ID_TRANS */ yytestcase(yyruleno==13); { - yygotominor.yy404 = new ParserStubTransDetails(); - yygotominor.yy404->transactionKw = true; - yygotominor.yy404->name = *(yymsp[0].minor.yy399); - delete yymsp[0].minor.yy399; + yygotominor.yy84 = new ParserStubTransDetails(); + yygotominor.yy84->transactionKw = true; + yygotominor.yy84->name = *(yymsp[0].minor.yy319); + delete yymsp[0].minor.yy319; } break; case 15: /* transtype ::= DEFERRED */ { - yygotominor.yy404 = new ParserStubTransDetails(); - yygotominor.yy404->type = SqliteBeginTrans::Type::DEFERRED; + yygotominor.yy84 = new ParserStubTransDetails(); + yygotominor.yy84->type = SqliteBeginTrans::Type::DEFERRED; } break; case 16: /* transtype ::= IMMEDIATE */ { - yygotominor.yy404 = new ParserStubTransDetails(); - yygotominor.yy404->type = SqliteBeginTrans::Type::IMMEDIATE; + yygotominor.yy84 = new ParserStubTransDetails(); + yygotominor.yy84->type = SqliteBeginTrans::Type::IMMEDIATE; } break; case 17: /* transtype ::= EXCLUSIVE */ { - yygotominor.yy404 = new ParserStubTransDetails(); - yygotominor.yy404->type = SqliteBeginTrans::Type::EXCLUSIVE; + yygotominor.yy84 = new ParserStubTransDetails(); + yygotominor.yy84->type = SqliteBeginTrans::Type::EXCLUSIVE; } break; case 18: /* cmd ::= COMMIT trans_opt */ { - yygotominor.yy283 = new SqliteCommitTrans( - yymsp[0].minor.yy404->transactionKw, - yymsp[0].minor.yy404->name, + yygotominor.yy363 = new SqliteCommitTrans( + yymsp[0].minor.yy84->transactionKw, + yymsp[0].minor.yy84->name, false ); - delete yymsp[0].minor.yy404; - objectForTokens = yygotominor.yy283; + delete yymsp[0].minor.yy84; + objectForTokens = yygotominor.yy363; } break; case 19: /* cmd ::= END trans_opt */ { - yygotominor.yy283 = new SqliteCommitTrans( - yymsp[0].minor.yy404->transactionKw, - yymsp[0].minor.yy404->name, + yygotominor.yy363 = new SqliteCommitTrans( + yymsp[0].minor.yy84->transactionKw, + yymsp[0].minor.yy84->name, true ); - delete yymsp[0].minor.yy404; - objectForTokens = yygotominor.yy283; + delete yymsp[0].minor.yy84; + objectForTokens = yygotominor.yy363; } break; case 20: /* cmd ::= ROLLBACK trans_opt */ { - yygotominor.yy283 = new SqliteRollback( - yymsp[0].minor.yy404->transactionKw, - yymsp[0].minor.yy404->name + yygotominor.yy363 = new SqliteRollback( + yymsp[0].minor.yy84->transactionKw, + yymsp[0].minor.yy84->name ); - delete yymsp[0].minor.yy404; - objectForTokens = yygotominor.yy283; + delete yymsp[0].minor.yy84; + objectForTokens = yygotominor.yy363; } break; case 21: /* savepoint_opt ::= SAVEPOINT */ case 37: /* ifnotexists ::= IF NOT EXISTS */ yytestcase(yyruleno==37); - case 86: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==86); - case 108: /* tconscomma ::= COMMA */ yytestcase(yyruleno==108); - case 130: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==130); - case 311: /* not_opt ::= NOT */ yytestcase(yyruleno==311); - case 327: /* uniqueflag ::= UNIQUE */ yytestcase(yyruleno==327); - case 393: /* database_kw_opt ::= DATABASE */ yytestcase(yyruleno==393); - case 409: /* kwcolumn_opt ::= */ yytestcase(yyruleno==409); -{yygotominor.yy451 = new bool(true);} + case 90: /* gen_always ::= GENERATED ALWAYS */ yytestcase(yyruleno==90); + case 93: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==93); + case 115: /* tconscomma ::= COMMA */ yytestcase(yyruleno==115); + case 137: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==137); + case 317: /* not_opt ::= NOT */ yytestcase(yyruleno==317); + case 333: /* uniqueflag ::= UNIQUE */ yytestcase(yyruleno==333); + case 401: /* database_kw_opt ::= DATABASE */ yytestcase(yyruleno==401); + case 417: /* kwcolumn_opt ::= */ yytestcase(yyruleno==417); +{yygotominor.yy611 = new bool(true);} break; case 22: /* savepoint_opt ::= */ case 36: /* ifnotexists ::= */ yytestcase(yyruleno==36); - case 85: /* autoinc ::= */ yytestcase(yyruleno==85); - case 109: /* tconscomma ::= */ yytestcase(yyruleno==109); - case 131: /* ifexists ::= */ yytestcase(yyruleno==131); - case 310: /* not_opt ::= */ yytestcase(yyruleno==310); - case 328: /* uniqueflag ::= */ yytestcase(yyruleno==328); - case 394: /* database_kw_opt ::= */ yytestcase(yyruleno==394); - case 410: /* kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==410); -{yygotominor.yy451 = new bool(false);} + case 91: /* gen_always ::= */ yytestcase(yyruleno==91); + case 92: /* autoinc ::= */ yytestcase(yyruleno==92); + case 116: /* tconscomma ::= */ yytestcase(yyruleno==116); + case 138: /* ifexists ::= */ yytestcase(yyruleno==138); + case 316: /* not_opt ::= */ yytestcase(yyruleno==316); + case 334: /* uniqueflag ::= */ yytestcase(yyruleno==334); + case 402: /* database_kw_opt ::= */ yytestcase(yyruleno==402); + case 418: /* kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==418); +{yygotominor.yy611 = new bool(false);} break; case 23: /* cmd ::= SAVEPOINT nm */ { - yygotominor.yy283 = new SqliteSavepoint(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteSavepoint(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy363; } break; case 24: /* cmd ::= RELEASE savepoint_opt nm */ { - yygotominor.yy283 = new SqliteRelease(*(yymsp[-1].minor.yy451), *(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteRelease(*(yymsp[-1].minor.yy611), *(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy363; } break; case 25: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ case 26: /* cmd ::= SAVEPOINT ID_TRANS */ yytestcase(yyruleno==26); { - yygotominor.yy283 = new SqliteRollback( - yymsp[-3].minor.yy404->transactionKw, - *(yymsp[-1].minor.yy451), - *(yymsp[0].minor.yy399) + yygotominor.yy363 = new SqliteRollback( + yymsp[-3].minor.yy84->transactionKw, + *(yymsp[-1].minor.yy611), + *(yymsp[0].minor.yy319) ); - delete yymsp[-1].minor.yy451; - delete yymsp[-3].minor.yy404; - objectForTokens = yygotominor.yy283; + delete yymsp[-1].minor.yy611; + delete yymsp[-3].minor.yy84; + objectForTokens = yygotominor.yy363; } break; case 27: /* cmd ::= RELEASE savepoint_opt ID_TRANS */ case 28: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt ID_TRANS */ yytestcase(yyruleno==28); -{ yy_destructor(yypParser,180,&yymsp[-1].minor); +{ yy_destructor(yypParser,200,&yymsp[-1].minor); } break; case 29: /* cmd ::= CREATE temp TABLE ifnotexists fullname LP columnlist conslist_opt RP table_options */ { - yygotominor.yy283 = new SqliteCreateTable( - *(yymsp[-6].minor.yy451), - *(yymsp[-8].minor.yy146), - yymsp[-5].minor.yy360->name1, - yymsp[-5].minor.yy360->name2, - *(yymsp[-3].minor.yy202), - *(yymsp[-2].minor.yy333), - *(yymsp[0].minor.yy399) + yygotominor.yy363 = new SqliteCreateTable( + *(yymsp[-6].minor.yy611), + *(yymsp[-8].minor.yy386), + yymsp[-5].minor.yy440->name1, + yymsp[-5].minor.yy440->name2, + *(yymsp[-3].minor.yy42), + *(yymsp[-2].minor.yy493), + *(yymsp[0].minor.yy319) ); - delete yymsp[-6].minor.yy451; - delete yymsp[-8].minor.yy146; - delete yymsp[-3].minor.yy202; - delete yymsp[-2].minor.yy333; - delete yymsp[-5].minor.yy360; - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy283; + delete yymsp[-6].minor.yy611; + delete yymsp[-8].minor.yy386; + delete yymsp[-3].minor.yy42; + delete yymsp[-2].minor.yy493; + delete yymsp[-5].minor.yy440; + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy363; } break; case 30: /* cmd ::= CREATE temp TABLE ifnotexists fullname AS select */ { - yygotominor.yy283 = new SqliteCreateTable( - *(yymsp[-3].minor.yy451), - *(yymsp[-5].minor.yy146), - yymsp[-2].minor.yy360->name1, - yymsp[-2].minor.yy360->name2, - yymsp[0].minor.yy473 + yygotominor.yy363 = new SqliteCreateTable( + *(yymsp[-3].minor.yy611), + *(yymsp[-5].minor.yy386), + yymsp[-2].minor.yy440->name1, + yymsp[-2].minor.yy440->name2, + yymsp[0].minor.yy313 ); - delete yymsp[-3].minor.yy451; - delete yymsp[-5].minor.yy146; - delete yymsp[-2].minor.yy360; - objectForTokens = yygotominor.yy283; + delete yymsp[-3].minor.yy611; + delete yymsp[-5].minor.yy386; + delete yymsp[-2].minor.yy440; + objectForTokens = yygotominor.yy363; } break; case 31: /* cmd ::= CREATE temp TABLE ifnotexists nm DOT ID_TAB_NEW */ - case 133: /* cmd ::= CREATE temp VIEW ifnotexists nm DOT ID_VIEW_NEW */ yytestcase(yyruleno==133); - case 364: /* cmd ::= CREATE temp TRIGGER ifnotexists nm DOT ID_TRIG_NEW */ yytestcase(yyruleno==364); -{ yy_destructor(yypParser,181,&yymsp[-5].minor); - yy_destructor(yypParser,179,&yymsp[-2].minor); + case 140: /* cmd ::= CREATE temp VIEW ifnotexists nm DOT ID_VIEW_NEW */ yytestcase(yyruleno==140); + case 372: /* cmd ::= CREATE temp TRIGGER ifnotexists nm DOT ID_TRIG_NEW */ yytestcase(yyruleno==372); +{ yy_destructor(yypParser,201,&yymsp[-5].minor); + yy_destructor(yypParser,199,&yymsp[-2].minor); } break; case 32: /* cmd ::= CREATE temp TABLE ifnotexists ID_DB|ID_TAB_NEW */ - case 134: /* cmd ::= CREATE temp VIEW ifnotexists ID_DB|ID_VIEW_NEW */ yytestcase(yyruleno==134); - case 365: /* cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW */ yytestcase(yyruleno==365); -{ yy_destructor(yypParser,181,&yymsp[-3].minor); + case 141: /* cmd ::= CREATE temp VIEW ifnotexists ID_DB|ID_VIEW_NEW */ yytestcase(yyruleno==141); + case 373: /* cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW */ yytestcase(yyruleno==373); +{ yy_destructor(yypParser,201,&yymsp[-3].minor); } break; case 33: /* table_options ::= */ - case 186: /* dbnm ::= */ yytestcase(yyruleno==186); - case 335: /* collate ::= */ yytestcase(yyruleno==335); - case 418: /* vtabarg ::= */ yytestcase(yyruleno==418); - case 422: /* anylist ::= */ yytestcase(yyruleno==422); -{yygotominor.yy399 = new QString();} + case 194: /* dbnm ::= */ yytestcase(yyruleno==194); + case 341: /* collate ::= */ yytestcase(yyruleno==341); + case 426: /* vtabarg ::= */ yytestcase(yyruleno==426); + case 430: /* anylist ::= */ yytestcase(yyruleno==430); +{yygotominor.yy319 = new QString();} break; case 34: /* table_options ::= WITHOUT nm */ case 35: /* table_options ::= WITHOUT CTX_ROWID_KW */ yytestcase(yyruleno==35); { - if (yymsp[0].minor.yy399->toLower() != "rowid") - parserContext->errorAtToken(QString("Invalid table option: %1").arg(*(yymsp[0].minor.yy399))); + if (yymsp[0].minor.yy319->toLower() != "rowid") + parserContext->errorAtToken(QString("Invalid table option: %1").arg(*(yymsp[0].minor.yy319))); - yygotominor.yy399 = yymsp[0].minor.yy399; + yygotominor.yy319 = yymsp[0].minor.yy319; } break; case 38: /* temp ::= TEMP */ -{yygotominor.yy146 = new int( (yymsp[0].minor.yy0->value.length() > 4) ? 2 : 1 );} +{yygotominor.yy386 = new int( (yymsp[0].minor.yy0->value.length() > 4) ? 2 : 1 );} break; case 39: /* temp ::= */ - case 154: /* distinct ::= */ yytestcase(yyruleno==154); -{yygotominor.yy146 = new int(0);} + case 162: /* distinct ::= */ yytestcase(yyruleno==162); +{yygotominor.yy386 = new int(0);} break; case 40: /* columnlist ::= columnlist COMMA column */ { - yymsp[-2].minor.yy202->append(yymsp[0].minor.yy227); - yygotominor.yy202 = yymsp[-2].minor.yy202; + yymsp[-2].minor.yy42->append(yymsp[0].minor.yy147); + yygotominor.yy42 = yymsp[-2].minor.yy42; DONT_INHERIT_TOKENS("columnlist"); } break; case 41: /* columnlist ::= column */ { - yygotominor.yy202 = new ParserCreateTableColumnList(); - yygotominor.yy202->append(yymsp[0].minor.yy227); + yygotominor.yy42 = new ParserCreateTableColumnList(); + yygotominor.yy42->append(yymsp[0].minor.yy147); } break; case 42: /* column ::= columnid type carglist */ { - yygotominor.yy227 = new SqliteCreateTable::Column(*(yymsp[-2].minor.yy399), yymsp[-1].minor.yy537, *(yymsp[0].minor.yy51)); - delete yymsp[-2].minor.yy399; + yygotominor.yy147 = new SqliteCreateTable::Column(*(yymsp[-2].minor.yy319), yymsp[-1].minor.yy57, *(yymsp[0].minor.yy51)); + delete yymsp[-2].minor.yy319; delete yymsp[0].minor.yy51; - objectForTokens = yygotominor.yy227; + objectForTokens = yygotominor.yy147; } break; case 43: /* columnid ::= nm */ case 44: /* columnid ::= ID_COL_NEW */ yytestcase(yyruleno==44); - case 47: /* nm ::= id */ yytestcase(yyruleno==47); - case 55: /* typename ::= ids */ yytestcase(yyruleno==55); - case 187: /* dbnm ::= DOT nm */ yytestcase(yyruleno==187); - case 336: /* collate ::= COLLATE ids */ yytestcase(yyruleno==336); - case 337: /* collate ::= COLLATE ID_COLLATE */ yytestcase(yyruleno==337); -{yygotominor.yy399 = yymsp[0].minor.yy399;} + case 49: /* nm ::= id */ yytestcase(yyruleno==49); + case 57: /* typename ::= ids */ yytestcase(yyruleno==57); + case 195: /* dbnm ::= DOT nm */ yytestcase(yyruleno==195); + case 342: /* collate ::= COLLATE ids */ yytestcase(yyruleno==342); + case 343: /* collate ::= COLLATE ID_COLLATE */ yytestcase(yyruleno==343); +{yygotominor.yy319 = yymsp[0].minor.yy319;} break; case 45: /* id ::= ID */ { - yygotominor.yy399 = new QString( + yygotominor.yy319 = new QString( stripObjName( - yymsp[0].minor.yy0->value, - parserContext->dialect + yymsp[0].minor.yy0->value ) ); } break; - case 46: /* ids ::= ID|STRING */ - case 49: /* nm ::= JOIN_KW */ yytestcase(yyruleno==49); -{yygotominor.yy399 = new QString(yymsp[0].minor.yy0->value);} + case 46: /* id_opt ::= id */ +{ + yygotominor.yy319 = yymsp[0].minor.yy319; + } + break; + case 47: /* id_opt ::= */ +{ + yygotominor.yy319 = new QString(); + } + break; + case 48: /* ids ::= ID|STRING */ + case 51: /* nm ::= JOIN_KW */ yytestcase(yyruleno==51); +{yygotominor.yy319 = new QString(yymsp[0].minor.yy0->value);} break; - case 48: /* nm ::= STRING */ -{yygotominor.yy399 = new QString(stripString(yymsp[0].minor.yy0->value));} + case 50: /* nm ::= STRING */ +{yygotominor.yy319 = new QString(stripString(yymsp[0].minor.yy0->value));} break; - case 50: /* type ::= */ -{yygotominor.yy537 = nullptr;} + case 52: /* type ::= */ +{yygotominor.yy57 = nullptr;} break; - case 51: /* type ::= typetoken */ -{yygotominor.yy537 = yymsp[0].minor.yy537;} + case 53: /* type ::= typetoken */ +{yygotominor.yy57 = yymsp[0].minor.yy57;} break; - case 52: /* typetoken ::= typename */ + case 54: /* typetoken ::= typename */ { - yygotominor.yy537 = new SqliteColumnType(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy537; + yygotominor.yy57 = new SqliteColumnType(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy57; } break; - case 53: /* typetoken ::= typename LP signed RP */ + case 55: /* typetoken ::= typename LP signed RP */ { - yygotominor.yy537 = new SqliteColumnType(*(yymsp[-3].minor.yy399), *(yymsp[-1].minor.yy469)); - delete yymsp[-3].minor.yy399; - delete yymsp[-1].minor.yy469; - objectForTokens = yygotominor.yy537; + yygotominor.yy57 = new SqliteColumnType(*(yymsp[-3].minor.yy319), *(yymsp[-1].minor.yy229)); + delete yymsp[-3].minor.yy319; + delete yymsp[-1].minor.yy229; + objectForTokens = yygotominor.yy57; } break; - case 54: /* typetoken ::= typename LP signed COMMA signed RP */ + case 56: /* typetoken ::= typename LP signed COMMA signed RP */ { - yygotominor.yy537 = new SqliteColumnType(*(yymsp[-5].minor.yy399), *(yymsp[-3].minor.yy469), *(yymsp[-1].minor.yy469)); - delete yymsp[-5].minor.yy399; - delete yymsp[-3].minor.yy469; - delete yymsp[-1].minor.yy469; - objectForTokens = yygotominor.yy537; + yygotominor.yy57 = new SqliteColumnType(*(yymsp[-5].minor.yy319), *(yymsp[-3].minor.yy229), *(yymsp[-1].minor.yy229)); + delete yymsp[-5].minor.yy319; + delete yymsp[-3].minor.yy229; + delete yymsp[-1].minor.yy229; + objectForTokens = yygotominor.yy57; } break; - case 56: /* typename ::= typename ids */ - case 57: /* typename ::= ID_COL_TYPE */ yytestcase(yyruleno==57); + case 58: /* typename ::= typename ids */ + case 59: /* typename ::= ID_COL_TYPE */ yytestcase(yyruleno==59); { - yymsp[-1].minor.yy399->append(" " + *(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - yygotominor.yy399 = yymsp[-1].minor.yy399; + yymsp[-1].minor.yy319->append(" " + *(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + yygotominor.yy319 = yymsp[-1].minor.yy319; } break; - case 58: /* signed ::= plus_num */ - case 59: /* signed ::= minus_num */ yytestcase(yyruleno==59); - case 350: /* nmnum ::= plus_num */ yytestcase(yyruleno==350); - case 355: /* plus_num ::= PLUS number */ yytestcase(yyruleno==355); - case 356: /* plus_num ::= number */ yytestcase(yyruleno==356); -{yygotominor.yy469 = yymsp[0].minor.yy469;} + case 60: /* signed ::= plus_num */ + case 61: /* signed ::= minus_num */ yytestcase(yyruleno==61); + case 358: /* nmnum ::= plus_num */ yytestcase(yyruleno==358); + case 363: /* plus_num ::= PLUS number */ yytestcase(yyruleno==363); + case 364: /* plus_num ::= number */ yytestcase(yyruleno==364); +{yygotominor.yy229 = yymsp[0].minor.yy229;} break; - case 60: /* carglist ::= carglist ccons */ + case 62: /* carglist ::= carglist ccons */ { - yymsp[-1].minor.yy51->append(yymsp[0].minor.yy304); + yymsp[-1].minor.yy51->append(yymsp[0].minor.yy464); yygotominor.yy51 = yymsp[-1].minor.yy51; DONT_INHERIT_TOKENS("carglist"); } break; - case 61: /* carglist ::= */ + case 63: /* carglist ::= */ {yygotominor.yy51 = new ParserCreateTableColumnConstraintList();} break; - case 62: /* ccons ::= CONSTRAINT nm */ + case 64: /* ccons ::= CONSTRAINT nm */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefNameOnly(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initDefNameOnly(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy464; } break; - case 63: /* ccons ::= DEFAULT term */ + case 65: /* ccons ::= DEFAULT term */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefTerm(*(yymsp[0].minor.yy469)); - delete yymsp[0].minor.yy469; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initDefTerm(*(yymsp[0].minor.yy229)); + delete yymsp[0].minor.yy229; + objectForTokens = yygotominor.yy464; } break; - case 64: /* ccons ::= DEFAULT LP expr RP */ + case 66: /* ccons ::= DEFAULT LP expr RP */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefExpr(yymsp[-1].minor.yy352); - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initDefExpr(yymsp[-1].minor.yy512); + objectForTokens = yygotominor.yy464; } break; - case 65: /* ccons ::= DEFAULT PLUS term */ + case 67: /* ccons ::= DEFAULT PLUS term */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefTerm(*(yymsp[0].minor.yy469), false); - delete yymsp[0].minor.yy469; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initDefTerm(*(yymsp[0].minor.yy229), false); + delete yymsp[0].minor.yy229; + objectForTokens = yygotominor.yy464; } break; - case 66: /* ccons ::= DEFAULT MINUS term */ + case 68: /* ccons ::= DEFAULT MINUS term */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefTerm(*(yymsp[0].minor.yy469), true); - delete yymsp[0].minor.yy469; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initDefTerm(*(yymsp[0].minor.yy229), true); + delete yymsp[0].minor.yy229; + objectForTokens = yygotominor.yy464; } break; - case 67: /* ccons ::= DEFAULT id */ + case 69: /* ccons ::= DEFAULT id */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefId(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initDefId(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy464; } break; - case 68: /* ccons ::= DEFAULT CTIME_KW */ + case 70: /* ccons ::= DEFAULT CTIME_KW */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefCTime(yymsp[0].minor.yy0->value); - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initDefCTime(yymsp[0].minor.yy0->value); + objectForTokens = yygotominor.yy464; } break; - case 69: /* ccons ::= NULL onconf */ + case 71: /* ccons ::= NULL onconf */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initNull(*(yymsp[0].minor.yy338)); - delete yymsp[0].minor.yy338; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initNull(*(yymsp[0].minor.yy418)); + delete yymsp[0].minor.yy418; + objectForTokens = yygotominor.yy464; } break; - case 70: /* ccons ::= NOT NULL onconf */ + case 72: /* ccons ::= NOT NULL onconf */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initNotNull(*(yymsp[0].minor.yy338)); - delete yymsp[0].minor.yy338; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initNotNull(*(yymsp[0].minor.yy418)); + delete yymsp[0].minor.yy418; + objectForTokens = yygotominor.yy464; } break; - case 71: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ + case 73: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initPk(*(yymsp[-2].minor.yy309), *(yymsp[-1].minor.yy338), *(yymsp[0].minor.yy451)); - delete yymsp[-2].minor.yy309; - delete yymsp[0].minor.yy451; - delete yymsp[-1].minor.yy338; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initPk(*(yymsp[-2].minor.yy549), *(yymsp[-1].minor.yy418), *(yymsp[0].minor.yy611)); + delete yymsp[-2].minor.yy549; + delete yymsp[0].minor.yy611; + delete yymsp[-1].minor.yy418; + objectForTokens = yygotominor.yy464; } break; - case 72: /* ccons ::= UNIQUE onconf */ + case 74: /* ccons ::= UNIQUE onconf */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initUnique(*(yymsp[0].minor.yy338)); - delete yymsp[0].minor.yy338; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initUnique(*(yymsp[0].minor.yy418)); + delete yymsp[0].minor.yy418; + objectForTokens = yygotominor.yy464; } break; - case 73: /* ccons ::= CHECK LP expr RP */ + case 75: /* ccons ::= CHECK LP expr RP */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initCheck(yymsp[-1].minor.yy352); - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initCheck(yymsp[-1].minor.yy512); + objectForTokens = yygotominor.yy464; } break; - case 74: /* ccons ::= REFERENCES nm idxlist_opt refargs */ + case 76: /* ccons ::= REFERENCES nm idxlist_opt refargs */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initFk(*(yymsp[-2].minor.yy399), *(yymsp[-1].minor.yy223), *(yymsp[0].minor.yy184)); - delete yymsp[-2].minor.yy399; - delete yymsp[0].minor.yy184; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initFk(*(yymsp[-2].minor.yy319), *(yymsp[-1].minor.yy223), *(yymsp[0].minor.yy584)); + delete yymsp[-2].minor.yy319; + delete yymsp[0].minor.yy584; delete yymsp[-1].minor.yy223; - objectForTokens = yygotominor.yy304; + objectForTokens = yygotominor.yy464; } break; - case 75: /* ccons ::= defer_subclause */ + case 77: /* ccons ::= defer_subclause */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initDefer(yymsp[0].minor.yy329->initially, yymsp[0].minor.yy329->deferrable); - delete yymsp[0].minor.yy329; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initDefer(yymsp[0].minor.yy9->initially, yymsp[0].minor.yy9->deferrable); + delete yymsp[0].minor.yy9; + objectForTokens = yygotominor.yy464; } break; - case 76: /* ccons ::= COLLATE ids */ - case 77: /* ccons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==77); - case 78: /* ccons ::= COLLATE ID_COLLATE */ yytestcase(yyruleno==78); - case 79: /* ccons ::= REFERENCES ID_TAB */ yytestcase(yyruleno==79); + case 78: /* ccons ::= COLLATE ids */ { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initColl(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy304; + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initColl(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy464; } break; - case 80: /* ccons ::= CHECK LP RP */ + case 79: /* ccons ::= gen_always AS LP expr RP id_opt */ + case 80: /* ccons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==80); + case 81: /* ccons ::= COLLATE ID_COLLATE */ yytestcase(yyruleno==81); + case 82: /* ccons ::= REFERENCES ID_TAB */ yytestcase(yyruleno==82); { - yygotominor.yy304 = new SqliteCreateTable::Column::Constraint(); - yygotominor.yy304->initCheck(); - objectForTokens = yygotominor.yy304; + if (!yymsp[0].minor.yy319->isNull() && yymsp[0].minor.yy319->toLower() != "stored" && yymsp[0].minor.yy319->toLower() != "virtual") + parserContext->errorAtToken(QString("Invalid generated column type: %1").arg(*(yymsp[0].minor.yy319))); + + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initGeneratedAs(yymsp[-2].minor.yy512, *(yymsp[-5].minor.yy611), *(yymsp[0].minor.yy319)); + delete yymsp[-5].minor.yy611; + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy464; + } + break; + case 83: /* ccons ::= CHECK LP RP */ +{ + yygotominor.yy464 = new SqliteCreateTable::Column::Constraint(); + yygotominor.yy464->initCheck(); + objectForTokens = yygotominor.yy464; parserContext->minorErrorAfterLastToken("Syntax error"); } break; - case 81: /* term ::= NULL */ -{yygotominor.yy469 = new QVariant();} + case 84: /* term ::= NULL */ +{yygotominor.yy229 = new QVariant();} + break; + case 85: /* term ::= INTEGER */ + case 366: /* number ::= INTEGER */ yytestcase(yyruleno==366); +{yygotominor.yy229 = parserContext->handleNumberToken(yymsp[0].minor.yy0->value);} + break; + case 86: /* term ::= FLOAT */ + case 367: /* number ::= FLOAT */ yytestcase(yyruleno==367); +{yygotominor.yy229 = new QVariant(QVariant(yymsp[0].minor.yy0->value).toDouble());} break; - case 82: /* term ::= INTEGER */ - case 358: /* number ::= INTEGER */ yytestcase(yyruleno==358); -{yygotominor.yy469 = parserContext->handleNumberToken(yymsp[0].minor.yy0->value);} + case 87: /* term ::= STRING|BLOB */ +{yygotominor.yy229 = new QVariant(stripString(yymsp[0].minor.yy0->value));} break; - case 83: /* term ::= FLOAT */ - case 359: /* number ::= FLOAT */ yytestcase(yyruleno==359); -{yygotominor.yy469 = new QVariant(QVariant(yymsp[0].minor.yy0->value).toDouble());} + case 88: /* tnm ::= term */ +{ + yygotominor.yy590 = new ParserTermOrLiteral(*(yymsp[0].minor.yy229)); + delete yymsp[0].minor.yy229; + } break; - case 84: /* term ::= STRING|BLOB */ - case 352: /* nmnum ::= ON */ yytestcase(yyruleno==352); - case 353: /* nmnum ::= DELETE */ yytestcase(yyruleno==353); - case 354: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==354); -{yygotominor.yy469 = new QVariant(yymsp[0].minor.yy0->value);} + case 89: /* tnm ::= nm */ +{ + yygotominor.yy590 = new ParserTermOrLiteral(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + } break; - case 87: /* refargs ::= */ -{yygotominor.yy184 = new ParserFkConditionList();} + case 94: /* refargs ::= */ +{yygotominor.yy584 = new ParserFkConditionList();} break; - case 88: /* refargs ::= refargs refarg */ + case 95: /* refargs ::= refargs refarg */ { - yymsp[-1].minor.yy184->append(yymsp[0].minor.yy347); - yygotominor.yy184 = yymsp[-1].minor.yy184; + yymsp[-1].minor.yy584->append(yymsp[0].minor.yy507); + yygotominor.yy584 = yymsp[-1].minor.yy584; DONT_INHERIT_TOKENS("refargs"); } break; - case 89: /* refarg ::= MATCH nm */ + case 96: /* refarg ::= MATCH nm */ { - yygotominor.yy347 = new SqliteForeignKey::Condition(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; + yygotominor.yy507 = new SqliteForeignKey::Condition(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; } break; - case 90: /* refarg ::= ON INSERT refact */ -{yygotominor.yy347 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::INSERT, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;} + case 97: /* refarg ::= ON INSERT refact */ +{yygotominor.yy507 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::INSERT, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;} break; - case 91: /* refarg ::= ON DELETE refact */ -{yygotominor.yy347 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::DELETE, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;} + case 98: /* refarg ::= ON DELETE refact */ +{yygotominor.yy507 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::DELETE, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;} break; - case 92: /* refarg ::= ON UPDATE refact */ - case 93: /* refarg ::= MATCH ID_FK_MATCH */ yytestcase(yyruleno==93); -{yygotominor.yy347 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::UPDATE, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;} + case 99: /* refarg ::= ON UPDATE refact */ + case 100: /* refarg ::= MATCH ID_FK_MATCH */ yytestcase(yyruleno==100); +{yygotominor.yy507 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::UPDATE, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;} break; - case 94: /* refact ::= SET NULL */ + case 101: /* refact ::= SET NULL */ {yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_NULL);} break; - case 95: /* refact ::= SET DEFAULT */ + case 102: /* refact ::= SET DEFAULT */ {yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_DEFAULT);} break; - case 96: /* refact ::= CASCADE */ + case 103: /* refact ::= CASCADE */ {yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::CASCADE);} break; - case 97: /* refact ::= RESTRICT */ + case 104: /* refact ::= RESTRICT */ {yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::RESTRICT);} break; - case 98: /* refact ::= NO ACTION */ + case 105: /* refact ::= NO ACTION */ {yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::NO_ACTION);} break; - case 99: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ + case 106: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ { - yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(yymsp[0].minor.yy392)); - delete yymsp[0].minor.yy392; + yygotominor.yy9 = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(yymsp[0].minor.yy312)); + delete yymsp[0].minor.yy312; } break; - case 100: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ + case 107: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ { - yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::DEFERRABLE, *(yymsp[0].minor.yy392)); - delete yymsp[0].minor.yy392; + yygotominor.yy9 = new ParserDeferSubClause(SqliteDeferrable::DEFERRABLE, *(yymsp[0].minor.yy312)); + delete yymsp[0].minor.yy312; } break; - case 101: /* init_deferred_pred_opt ::= */ -{yygotominor.yy392 = new SqliteInitially(SqliteInitially::null);} + case 108: /* init_deferred_pred_opt ::= */ +{yygotominor.yy312 = new SqliteInitially(SqliteInitially::null);} break; - case 102: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ -{yygotominor.yy392 = new SqliteInitially(SqliteInitially::DEFERRED);} + case 109: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +{yygotominor.yy312 = new SqliteInitially(SqliteInitially::DEFERRED);} break; - case 103: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ -{yygotominor.yy392 = new SqliteInitially(SqliteInitially::IMMEDIATE);} + case 110: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +{yygotominor.yy312 = new SqliteInitially(SqliteInitially::IMMEDIATE);} break; - case 104: /* conslist_opt ::= */ -{yygotominor.yy333 = new ParserCreateTableConstraintList();} + case 111: /* conslist_opt ::= */ +{yygotominor.yy493 = new ParserCreateTableConstraintList();} break; - case 105: /* conslist_opt ::= COMMA conslist */ -{yygotominor.yy333 = yymsp[0].minor.yy333;} + case 112: /* conslist_opt ::= COMMA conslist */ +{yygotominor.yy493 = yymsp[0].minor.yy493;} break; - case 106: /* conslist ::= conslist tconscomma tcons */ + case 113: /* conslist ::= conslist tconscomma tcons */ { - yymsp[0].minor.yy406->afterComma = *(yymsp[-1].minor.yy451); - yymsp[-2].minor.yy333->append(yymsp[0].minor.yy406); - yygotominor.yy333 = yymsp[-2].minor.yy333; - delete yymsp[-1].minor.yy451; + yymsp[0].minor.yy246->afterComma = *(yymsp[-1].minor.yy611); + yymsp[-2].minor.yy493->append(yymsp[0].minor.yy246); + yygotominor.yy493 = yymsp[-2].minor.yy493; + delete yymsp[-1].minor.yy611; DONT_INHERIT_TOKENS("conslist"); } break; - case 107: /* conslist ::= tcons */ + case 114: /* conslist ::= tcons */ { - yygotominor.yy333 = new ParserCreateTableConstraintList(); - yygotominor.yy333->append(yymsp[0].minor.yy406); + yygotominor.yy493 = new ParserCreateTableConstraintList(); + yygotominor.yy493->append(yymsp[0].minor.yy246); } break; - case 110: /* tcons ::= CONSTRAINT nm */ + case 117: /* tcons ::= CONSTRAINT nm */ { - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initNameOnly(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy406; + yygotominor.yy246 = new SqliteCreateTable::Constraint(); + yygotominor.yy246->initNameOnly(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy246; } break; - case 111: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */ + case 118: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */ { - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initPk(*(yymsp[-3].minor.yy223), *(yymsp[-2].minor.yy451), *(yymsp[0].minor.yy338)); - delete yymsp[-2].minor.yy451; - delete yymsp[0].minor.yy338; + yygotominor.yy246 = new SqliteCreateTable::Constraint(); + yygotominor.yy246->initPk(*(yymsp[-3].minor.yy223), *(yymsp[-2].minor.yy611), *(yymsp[0].minor.yy418)); + delete yymsp[-2].minor.yy611; + delete yymsp[0].minor.yy418; delete yymsp[-3].minor.yy223; - objectForTokens = yygotominor.yy406; + objectForTokens = yygotominor.yy246; } break; - case 112: /* tcons ::= UNIQUE LP idxlist RP onconf */ + case 119: /* tcons ::= UNIQUE LP idxlist RP onconf */ { - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initUnique(*(yymsp[-2].minor.yy223), *(yymsp[0].minor.yy338)); - delete yymsp[0].minor.yy338; + yygotominor.yy246 = new SqliteCreateTable::Constraint(); + yygotominor.yy246->initUnique(*(yymsp[-2].minor.yy223), *(yymsp[0].minor.yy418)); + delete yymsp[0].minor.yy418; delete yymsp[-2].minor.yy223; - objectForTokens = yygotominor.yy406; + objectForTokens = yygotominor.yy246; } break; - case 113: /* tcons ::= CHECK LP expr RP onconf */ + case 120: /* tcons ::= CHECK LP expr RP onconf */ { - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initCheck(yymsp[-2].minor.yy352, *(yymsp[0].minor.yy338)); - objectForTokens = yygotominor.yy406; + yygotominor.yy246 = new SqliteCreateTable::Constraint(); + yygotominor.yy246->initCheck(yymsp[-2].minor.yy512, *(yymsp[0].minor.yy418)); + objectForTokens = yygotominor.yy246; } break; - case 114: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */ - case 115: /* tcons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==115); - case 116: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB */ yytestcase(yyruleno==116); + case 121: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */ + case 122: /* tcons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==122); + case 123: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB */ yytestcase(yyruleno==123); { - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initFk( + yygotominor.yy246 = new SqliteCreateTable::Constraint(); + yygotominor.yy246->initFk( *(yymsp[-6].minor.yy223), - *(yymsp[-3].minor.yy399), + *(yymsp[-3].minor.yy319), *(yymsp[-2].minor.yy223), - *(yymsp[-1].minor.yy184), - yymsp[0].minor.yy329->initially, - yymsp[0].minor.yy329->deferrable + *(yymsp[-1].minor.yy584), + yymsp[0].minor.yy9->initially, + yymsp[0].minor.yy9->deferrable ); - delete yymsp[-3].minor.yy399; - delete yymsp[-1].minor.yy184; - delete yymsp[0].minor.yy329; + delete yymsp[-3].minor.yy319; + delete yymsp[-1].minor.yy584; + delete yymsp[0].minor.yy9; delete yymsp[-2].minor.yy223; delete yymsp[-6].minor.yy223; - objectForTokens = yygotominor.yy406; + objectForTokens = yygotominor.yy246; } break; - case 117: /* tcons ::= CHECK LP RP onconf */ + case 124: /* tcons ::= CHECK LP RP onconf */ { - yygotominor.yy406 = new SqliteCreateTable::Constraint(); - yygotominor.yy406->initCheck(); - objectForTokens = yygotominor.yy406; + yygotominor.yy246 = new SqliteCreateTable::Constraint(); + yygotominor.yy246->initCheck(); + objectForTokens = yygotominor.yy246; parserContext->minorErrorAfterLastToken("Syntax error"); - yy_destructor(yypParser,202,&yymsp[0].minor); + yy_destructor(yypParser,223,&yymsp[0].minor); } break; - case 118: /* defer_subclause_opt ::= */ -{yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);} - break; - case 119: /* defer_subclause_opt ::= defer_subclause */ -{yygotominor.yy329 = yymsp[0].minor.yy329;} - break; - case 120: /* onconf ::= */ - case 122: /* orconf ::= */ yytestcase(yyruleno==122); -{yygotominor.yy338 = new SqliteConflictAlgo(SqliteConflictAlgo::null);} - break; - case 121: /* onconf ::= ON CONFLICT resolvetype */ - case 123: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==123); -{yygotominor.yy338 = yymsp[0].minor.yy338;} - break; - case 124: /* resolvetype ::= raisetype */ - case 125: /* resolvetype ::= IGNORE */ yytestcase(yyruleno==125); - case 126: /* resolvetype ::= REPLACE */ yytestcase(yyruleno==126); -{yygotominor.yy338 = new SqliteConflictAlgo(sqliteConflictAlgo(yymsp[0].minor.yy0->value));} - break; - case 127: /* cmd ::= DROP TABLE ifexists fullname */ -{ - yygotominor.yy283 = new SqliteDropTable(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy360->name1, yymsp[0].minor.yy360->name2); - delete yymsp[-1].minor.yy451; - delete yymsp[0].minor.yy360; - objectForTokens = yygotominor.yy283; - } - break; - case 128: /* cmd ::= DROP TABLE ifexists nm DOT ID_TAB */ - case 129: /* cmd ::= DROP TABLE ifexists ID_DB|ID_TAB */ yytestcase(yyruleno==129); - case 136: /* cmd ::= DROP VIEW ifexists nm DOT ID_VIEW */ yytestcase(yyruleno==136); - case 137: /* cmd ::= DROP VIEW ifexists ID_DB|ID_VIEW */ yytestcase(yyruleno==137); - case 179: /* singlesrc ::= nm DOT ID_TAB */ yytestcase(yyruleno==179); - case 180: /* singlesrc ::= ID_DB|ID_TAB */ yytestcase(yyruleno==180); - case 181: /* singlesrc ::= nm DOT ID_VIEW */ yytestcase(yyruleno==181); - case 182: /* singlesrc ::= ID_DB|ID_VIEW */ yytestcase(yyruleno==182); - case 266: /* exprx ::= nm DOT ID_TAB|ID_COL */ yytestcase(yyruleno==266); - case 325: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm DOT ID_IDX_NEW */ yytestcase(yyruleno==325); - case 326: /* cmd ::= CREATE uniqueflag INDEX ifnotexists ID_DB|ID_IDX_NEW */ yytestcase(yyruleno==326); - case 339: /* cmd ::= DROP INDEX ifexists nm DOT ID_IDX */ yytestcase(yyruleno==339); - case 340: /* cmd ::= DROP INDEX ifexists ID_DB|ID_IDX */ yytestcase(yyruleno==340); - case 348: /* cmd ::= PRAGMA nm DOT ID_PRAGMA */ yytestcase(yyruleno==348); - case 349: /* cmd ::= PRAGMA ID_DB|ID_PRAGMA */ yytestcase(yyruleno==349); - case 387: /* cmd ::= DROP TRIGGER ifexists nm DOT ID_TRIG */ yytestcase(yyruleno==387); - case 388: /* cmd ::= DROP TRIGGER ifexists ID_DB|ID_TRIG */ yytestcase(yyruleno==388); - case 398: /* cmd ::= REINDEX nm DOT ID_TAB|ID_IDX */ yytestcase(yyruleno==398); - case 399: /* cmd ::= REINDEX ID_DB|ID_IDX|ID_TAB */ yytestcase(yyruleno==399); - case 402: /* cmd ::= ANALYZE nm DOT ID_TAB|ID_IDX */ yytestcase(yyruleno==402); - case 403: /* cmd ::= ANALYZE ID_DB|ID_IDX|ID_TAB */ yytestcase(yyruleno==403); - case 407: /* cmd ::= ALTER TABLE nm DOT ID_TAB */ yytestcase(yyruleno==407); - case 408: /* cmd ::= ALTER TABLE ID_DB|ID_TAB */ yytestcase(yyruleno==408); - case 414: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm DOT ID_TAB_NEW */ yytestcase(yyruleno==414); - case 415: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists ID_DB|ID_TAB_NEW */ yytestcase(yyruleno==415); -{ yy_destructor(yypParser,179,&yymsp[-2].minor); + case 125: /* defer_subclause_opt ::= */ +{yygotominor.yy9 = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);} + break; + case 126: /* defer_subclause_opt ::= defer_subclause */ +{yygotominor.yy9 = yymsp[0].minor.yy9;} + break; + case 127: /* onconf ::= */ + case 129: /* orconf ::= */ yytestcase(yyruleno==129); +{yygotominor.yy418 = new SqliteConflictAlgo(SqliteConflictAlgo::null);} + break; + case 128: /* onconf ::= ON CONFLICT resolvetype */ + case 130: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==130); +{yygotominor.yy418 = yymsp[0].minor.yy418;} + break; + case 131: /* resolvetype ::= raisetype */ + case 132: /* resolvetype ::= IGNORE */ yytestcase(yyruleno==132); + case 133: /* resolvetype ::= REPLACE */ yytestcase(yyruleno==133); +{yygotominor.yy418 = new SqliteConflictAlgo(sqliteConflictAlgo(yymsp[0].minor.yy0->value));} + break; + case 134: /* cmd ::= DROP TABLE ifexists fullname */ +{ + yygotominor.yy363 = new SqliteDropTable(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy440->name1, yymsp[0].minor.yy440->name2); + delete yymsp[-1].minor.yy611; + delete yymsp[0].minor.yy440; + objectForTokens = yygotominor.yy363; + } + break; + case 135: /* cmd ::= DROP TABLE ifexists nm DOT ID_TAB */ + case 136: /* cmd ::= DROP TABLE ifexists ID_DB|ID_TAB */ yytestcase(yyruleno==136); + case 143: /* cmd ::= DROP VIEW ifexists nm DOT ID_VIEW */ yytestcase(yyruleno==143); + case 144: /* cmd ::= DROP VIEW ifexists ID_DB|ID_VIEW */ yytestcase(yyruleno==144); + case 187: /* singlesrc ::= nm DOT ID_TAB */ yytestcase(yyruleno==187); + case 188: /* singlesrc ::= ID_DB|ID_TAB */ yytestcase(yyruleno==188); + case 189: /* singlesrc ::= nm DOT ID_VIEW */ yytestcase(yyruleno==189); + case 190: /* singlesrc ::= ID_DB|ID_VIEW */ yytestcase(yyruleno==190); + case 331: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm DOT ID_IDX_NEW */ yytestcase(yyruleno==331); + case 332: /* cmd ::= CREATE uniqueflag INDEX ifnotexists ID_DB|ID_IDX_NEW */ yytestcase(yyruleno==332); + case 345: /* cmd ::= DROP INDEX ifexists nm DOT ID_IDX */ yytestcase(yyruleno==345); + case 346: /* cmd ::= DROP INDEX ifexists ID_DB|ID_IDX */ yytestcase(yyruleno==346); + case 356: /* cmd ::= PRAGMA nm DOT ID_PRAGMA */ yytestcase(yyruleno==356); + case 357: /* cmd ::= PRAGMA ID_DB|ID_PRAGMA */ yytestcase(yyruleno==357); + case 395: /* cmd ::= DROP TRIGGER ifexists nm DOT ID_TRIG */ yytestcase(yyruleno==395); + case 396: /* cmd ::= DROP TRIGGER ifexists ID_DB|ID_TRIG */ yytestcase(yyruleno==396); + case 406: /* cmd ::= REINDEX nm DOT ID_TAB|ID_IDX */ yytestcase(yyruleno==406); + case 407: /* cmd ::= REINDEX ID_DB|ID_IDX|ID_TAB */ yytestcase(yyruleno==407); + case 410: /* cmd ::= ANALYZE nm DOT ID_TAB|ID_IDX */ yytestcase(yyruleno==410); + case 411: /* cmd ::= ANALYZE ID_DB|ID_IDX|ID_TAB */ yytestcase(yyruleno==411); + case 415: /* cmd ::= ALTER TABLE nm DOT ID_TAB */ yytestcase(yyruleno==415); + case 416: /* cmd ::= ALTER TABLE ID_DB|ID_TAB */ yytestcase(yyruleno==416); + case 422: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm DOT ID_TAB_NEW */ yytestcase(yyruleno==422); + case 423: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists ID_DB|ID_TAB_NEW */ yytestcase(yyruleno==423); +{ yy_destructor(yypParser,199,&yymsp[-2].minor); } break; - case 132: /* cmd ::= CREATE temp VIEW ifnotexists fullname idxlist_opt AS select */ + case 139: /* cmd ::= CREATE temp VIEW ifnotexists fullname idxlist_opt AS select */ { - yygotominor.yy283 = new SqliteCreateView(*(yymsp[-6].minor.yy146), *(yymsp[-4].minor.yy451), yymsp[-3].minor.yy360->name1, yymsp[-3].minor.yy360->name2, yymsp[0].minor.yy473, *(yymsp[-2].minor.yy223)); - delete yymsp[-6].minor.yy146; - delete yymsp[-4].minor.yy451; - delete yymsp[-3].minor.yy360; + yygotominor.yy363 = new SqliteCreateView(*(yymsp[-6].minor.yy386), *(yymsp[-4].minor.yy611), yymsp[-3].minor.yy440->name1, yymsp[-3].minor.yy440->name2, yymsp[0].minor.yy313, *(yymsp[-2].minor.yy223)); + delete yymsp[-6].minor.yy386; + delete yymsp[-4].minor.yy611; + delete yymsp[-3].minor.yy440; delete yymsp[-2].minor.yy223; - objectForTokens = yygotominor.yy283; + objectForTokens = yygotominor.yy363; } break; - case 135: /* cmd ::= DROP VIEW ifexists fullname */ + case 142: /* cmd ::= DROP VIEW ifexists fullname */ { - yygotominor.yy283 = new SqliteDropView(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy360->name1, yymsp[0].minor.yy360->name2); - delete yymsp[-1].minor.yy451; - delete yymsp[0].minor.yy360; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteDropView(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy440->name1, yymsp[0].minor.yy440->name2); + delete yymsp[-1].minor.yy611; + delete yymsp[0].minor.yy440; + objectForTokens = yygotominor.yy363; } break; - case 138: /* cmd ::= select_stmt */ - case 215: /* cmd ::= delete_stmt */ yytestcase(yyruleno==215); - case 224: /* cmd ::= update_stmt */ yytestcase(yyruleno==224); - case 245: /* cmd ::= insert_stmt */ yytestcase(yyruleno==245); + case 145: /* cmd ::= select_stmt */ + case 226: /* cmd ::= delete_stmt */ yytestcase(yyruleno==226); + case 235: /* cmd ::= update_stmt */ yytestcase(yyruleno==235); + case 256: /* cmd ::= insert_stmt */ yytestcase(yyruleno==256); { - yygotominor.yy283 = yymsp[0].minor.yy283; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = yymsp[0].minor.yy363; + objectForTokens = yygotominor.yy363; } break; - case 139: /* select_stmt ::= select */ + case 146: /* select_stmt ::= select */ { - yygotominor.yy283 = yymsp[0].minor.yy473; + yygotominor.yy363 = yymsp[0].minor.yy313; // since it's used in trigger: - objectForTokens = yygotominor.yy283; + objectForTokens = yygotominor.yy363; } break; - case 140: /* select ::= with selectnowith */ + case 147: /* select ::= with selectnowith */ { - yygotominor.yy473 = yymsp[0].minor.yy473; - yymsp[0].minor.yy473->setWith(yymsp[-1].minor.yy321); - objectForTokens = yygotominor.yy473; + yygotominor.yy313 = yymsp[0].minor.yy313; + yymsp[0].minor.yy313->setWith(yymsp[-1].minor.yy1); + objectForTokens = yygotominor.yy313; } break; - case 141: /* selectnowith ::= oneselect */ + case 148: /* selectnowith ::= oneselect */ { - yygotominor.yy473 = SqliteSelect::append(yymsp[0].minor.yy310); - objectForTokens = yygotominor.yy473; + yygotominor.yy313 = SqliteSelect::append(yymsp[0].minor.yy470); + objectForTokens = yygotominor.yy313; } break; - case 142: /* selectnowith ::= selectnowith multiselect_op oneselect */ + case 149: /* selectnowith ::= selectnowith multiselect_op oneselect */ { - yygotominor.yy473 = SqliteSelect::append(yymsp[-2].minor.yy473, *(yymsp[-1].minor.yy462), yymsp[0].minor.yy310); - delete yymsp[-1].minor.yy462; - objectForTokens = yygotominor.yy473; + yygotominor.yy313 = SqliteSelect::append(yymsp[-2].minor.yy313, *(yymsp[-1].minor.yy382), yymsp[0].minor.yy470); + delete yymsp[-1].minor.yy382; + objectForTokens = yygotominor.yy313; } break; - case 143: /* selectnowith ::= values */ + case 150: /* selectnowith ::= values */ { - yygotominor.yy473 = SqliteSelect::append(*(yymsp[0].minor.yy166)); - delete yymsp[0].minor.yy166; - objectForTokens = yygotominor.yy473; + yygotominor.yy313 = SqliteSelect::append(*(yymsp[0].minor.yy486)); + delete yymsp[0].minor.yy486; + objectForTokens = yygotominor.yy313; } break; - case 144: /* selectnowith ::= selectnowith COMMA values */ + case 151: /* selectnowith ::= selectnowith COMMA values */ { - yygotominor.yy473 = SqliteSelect::append(yymsp[-2].minor.yy473, SqliteSelect::CompoundOperator::UNION_ALL, *(yymsp[0].minor.yy166)); - delete yymsp[0].minor.yy166; - objectForTokens = yygotominor.yy473; + yygotominor.yy313 = SqliteSelect::append(yymsp[-2].minor.yy313, SqliteSelect::CompoundOperator::UNION_ALL, *(yymsp[0].minor.yy486)); + delete yymsp[0].minor.yy486; + objectForTokens = yygotominor.yy313; } break; - case 145: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ + case 152: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { - yygotominor.yy310 = new SqliteSelect::Core( - *(yymsp[-7].minor.yy146), - *(yymsp[-6].minor.yy373), - yymsp[-5].minor.yy511, - yymsp[-4].minor.yy352, - *(yymsp[-3].minor.yy551), - yymsp[-2].minor.yy352, - *(yymsp[-1].minor.yy163), - yymsp[0].minor.yy484 + yygotominor.yy470 = new SqliteSelect::Core( + *(yymsp[-7].minor.yy386), + *(yymsp[-6].minor.yy53), + yymsp[-5].minor.yy31, + yymsp[-4].minor.yy512, + *(yymsp[-3].minor.yy71), + yymsp[-2].minor.yy512, + *(yymsp[-1].minor.yy403), + yymsp[0].minor.yy4 ); - delete yymsp[-6].minor.yy373; - delete yymsp[-7].minor.yy146; - delete yymsp[-3].minor.yy551; - delete yymsp[-1].minor.yy163; - objectForTokens = yygotominor.yy310; - } + delete yymsp[-6].minor.yy53; + delete yymsp[-7].minor.yy386; + delete yymsp[-3].minor.yy71; + delete yymsp[-1].minor.yy403; + objectForTokens = yygotominor.yy470; + } + break; + case 153: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +{ + yygotominor.yy470 = new SqliteSelect::Core( + *(yymsp[-8].minor.yy386), + *(yymsp[-7].minor.yy53), + yymsp[-6].minor.yy31, + yymsp[-5].minor.yy512, + *(yymsp[-4].minor.yy71), + yymsp[-3].minor.yy512, + *(yymsp[-2].minor.yy299), + *(yymsp[-1].minor.yy403), + yymsp[0].minor.yy4 + ); + delete yymsp[-7].minor.yy53; + delete yymsp[-8].minor.yy386; + delete yymsp[-4].minor.yy71; + delete yymsp[-1].minor.yy403; + delete yymsp[-2].minor.yy299; + objectForTokens = yygotominor.yy470; + } break; - case 146: /* values ::= VALUES LP nexprlist RP */ + case 154: /* values ::= VALUES LP nexprlist RP */ { - yygotominor.yy166 = new ParserExprNestedList(); - yygotominor.yy166->append(*(yymsp[-1].minor.yy551)); - delete yymsp[-1].minor.yy551; + yygotominor.yy486 = new ParserExprNestedList(); + yygotominor.yy486->append(*(yymsp[-1].minor.yy71)); + delete yymsp[-1].minor.yy71; } break; - case 147: /* values ::= values COMMA LP exprlist RP */ + case 155: /* values ::= values COMMA LP exprlist RP */ { - yymsp[-4].minor.yy166->append(*(yymsp[-1].minor.yy551)); - yygotominor.yy166 = yymsp[-4].minor.yy166; - delete yymsp[-1].minor.yy551; + yymsp[-4].minor.yy486->append(*(yymsp[-1].minor.yy71)); + yygotominor.yy486 = yymsp[-4].minor.yy486; + delete yymsp[-1].minor.yy71; DONT_INHERIT_TOKENS("values"); } break; - case 148: /* multiselect_op ::= UNION */ -{yygotominor.yy462 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);} + case 156: /* multiselect_op ::= UNION */ +{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);} break; - case 149: /* multiselect_op ::= UNION ALL */ -{yygotominor.yy462 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);} + case 157: /* multiselect_op ::= UNION ALL */ +{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);} break; - case 150: /* multiselect_op ::= EXCEPT */ -{yygotominor.yy462 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);} + case 158: /* multiselect_op ::= EXCEPT */ +{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);} break; - case 151: /* multiselect_op ::= INTERSECT */ -{yygotominor.yy462 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);} + case 159: /* multiselect_op ::= INTERSECT */ +{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);} break; - case 152: /* distinct ::= DISTINCT */ -{yygotominor.yy146 = new int(1);} + case 160: /* distinct ::= DISTINCT */ +{yygotominor.yy386 = new int(1);} break; - case 153: /* distinct ::= ALL */ -{yygotominor.yy146 = new int(2);} + case 161: /* distinct ::= ALL */ +{yygotominor.yy386 = new int(2);} break; - case 155: /* sclp ::= selcollist COMMA */ -{yygotominor.yy373 = yymsp[-1].minor.yy373;} + case 163: /* sclp ::= selcollist COMMA */ +{yygotominor.yy53 = yymsp[-1].minor.yy53;} break; - case 156: /* sclp ::= */ -{yygotominor.yy373 = new ParserResultColumnList();} + case 164: /* sclp ::= */ +{yygotominor.yy53 = new ParserResultColumnList();} break; - case 157: /* selcollist ::= sclp expr as */ + case 165: /* selcollist ::= sclp expr as */ { SqliteSelect::Core::ResultColumn* obj = new SqliteSelect::Core::ResultColumn( - yymsp[-1].minor.yy352, + yymsp[-1].minor.yy512, yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->asKw : false, - yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString::null + yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString() ); - yymsp[-2].minor.yy373->append(obj); - yygotominor.yy373 = yymsp[-2].minor.yy373; + yymsp[-2].minor.yy53->append(obj); + yygotominor.yy53 = yymsp[-2].minor.yy53; delete yymsp[0].minor.yy200; objectForTokens = obj; DONT_INHERIT_TOKENS("sclp"); } break; - case 158: /* selcollist ::= sclp STAR */ + case 166: /* selcollist ::= sclp STAR */ { SqliteSelect::Core::ResultColumn* obj = new SqliteSelect::Core::ResultColumn(true); - yymsp[-1].minor.yy373->append(obj); - yygotominor.yy373 = yymsp[-1].minor.yy373; + yymsp[-1].minor.yy53->append(obj); + yygotominor.yy53 = yymsp[-1].minor.yy53; objectForTokens = obj; DONT_INHERIT_TOKENS("sclp"); } break; - case 159: /* selcollist ::= sclp nm DOT STAR */ + case 167: /* selcollist ::= sclp tnm DOT STAR */ { SqliteSelect::Core::ResultColumn* obj = new SqliteSelect::Core::ResultColumn( true, - *(yymsp[-2].minor.yy399) + yymsp[-2].minor.yy590->toName() ); - yymsp[-3].minor.yy373->append(obj); - yygotominor.yy373 = yymsp[-3].minor.yy373; - delete yymsp[-2].minor.yy399; + + if (!yymsp[-2].minor.yy590->isName()) + parserContext->errorAtToken("Syntax error <expected name, not literal value>", -3); + + yymsp[-3].minor.yy53->append(obj); + yygotominor.yy53 = yymsp[-3].minor.yy53; + delete yymsp[-2].minor.yy590; objectForTokens = obj; DONT_INHERIT_TOKENS("sclp"); } break; - case 160: /* selcollist ::= sclp */ - case 161: /* selcollist ::= sclp ID_TAB DOT STAR */ yytestcase(yyruleno==161); + case 168: /* selcollist ::= sclp */ + case 169: /* selcollist ::= sclp ID_TAB DOT STAR */ yytestcase(yyruleno==169); { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy373 = yymsp[0].minor.yy373; + yygotominor.yy53 = yymsp[0].minor.yy53; } break; - case 162: /* as ::= AS nm */ + case 170: /* as ::= AS nm */ { - yygotominor.yy200 = new ParserStubAlias(*(yymsp[0].minor.yy399), true); - delete yymsp[0].minor.yy399; + yygotominor.yy200 = new ParserStubAlias(*(yymsp[0].minor.yy319), true); + delete yymsp[0].minor.yy319; } break; - case 163: /* as ::= ids */ - case 164: /* as ::= AS ID_ALIAS */ yytestcase(yyruleno==164); - case 165: /* as ::= ID_ALIAS */ yytestcase(yyruleno==165); + case 171: /* as ::= ids */ + case 172: /* as ::= AS ID_ALIAS */ yytestcase(yyruleno==172); + case 173: /* as ::= ID_ALIAS */ yytestcase(yyruleno==173); { - yygotominor.yy200 = new ParserStubAlias(*(yymsp[0].minor.yy399), false); - delete yymsp[0].minor.yy399; + yygotominor.yy200 = new ParserStubAlias(*(yymsp[0].minor.yy319), false); + delete yymsp[0].minor.yy319; } break; - case 166: /* as ::= */ + case 174: /* as ::= */ {yygotominor.yy200 = nullptr;} break; - case 167: /* from ::= */ -{yygotominor.yy511 = nullptr;} + case 175: /* from ::= */ +{yygotominor.yy31 = nullptr;} break; - case 168: /* from ::= FROM joinsrc */ -{yygotominor.yy511 = yymsp[0].minor.yy511;} + case 176: /* from ::= FROM joinsrc */ +{yygotominor.yy31 = yymsp[0].minor.yy31;} break; - case 169: /* joinsrc ::= singlesrc seltablist */ + case 177: /* joinsrc ::= singlesrc seltablist */ { - yygotominor.yy511 = new SqliteSelect::Core::JoinSource( - yymsp[-1].minor.yy201, - *(yymsp[0].minor.yy131) + yygotominor.yy31 = new SqliteSelect::Core::JoinSource( + yymsp[-1].minor.yy441, + *(yymsp[0].minor.yy451) ); - delete yymsp[0].minor.yy131; - objectForTokens = yygotominor.yy511; + delete yymsp[0].minor.yy451; + objectForTokens = yygotominor.yy31; } break; - case 170: /* joinsrc ::= */ + case 178: /* joinsrc ::= */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy511 = new SqliteSelect::Core::JoinSource(); - objectForTokens = yygotominor.yy511; + yygotominor.yy31 = new SqliteSelect::Core::JoinSource(); + objectForTokens = yygotominor.yy31; } break; - case 171: /* seltablist ::= seltablist joinop singlesrc joinconstr_opt */ + case 179: /* seltablist ::= seltablist joinop singlesrc joinconstr_opt */ { SqliteSelect::Core::JoinSourceOther* src = - new SqliteSelect::Core::JoinSourceOther(yymsp[-2].minor.yy301, yymsp[-1].minor.yy201, yymsp[0].minor.yy295); + new SqliteSelect::Core::JoinSourceOther(yymsp[-2].minor.yy221, yymsp[-1].minor.yy441, yymsp[0].minor.yy295); - yymsp[-3].minor.yy131->append(src); - yygotominor.yy131 = yymsp[-3].minor.yy131; + yymsp[-3].minor.yy451->append(src); + yygotominor.yy451 = yymsp[-3].minor.yy451; objectForTokens = src; DONT_INHERIT_TOKENS("seltablist"); } break; - case 172: /* seltablist ::= */ + case 180: /* seltablist ::= */ { - yygotominor.yy131 = new ParserOtherSourceList(); + yygotominor.yy451 = new ParserOtherSourceList(); } break; - case 173: /* singlesrc ::= nm dbnm as indexed_opt */ + case 181: /* singlesrc ::= nm dbnm as indexed_opt */ { - yygotominor.yy201 = new SqliteSelect::Core::SingleSource( - *(yymsp[-3].minor.yy399), - *(yymsp[-2].minor.yy399), + yygotominor.yy441 = new SqliteSelect::Core::SingleSource( + *(yymsp[-3].minor.yy319), + *(yymsp[-2].minor.yy319), yymsp[-1].minor.yy200 ? yymsp[-1].minor.yy200->asKw : false, - yymsp[-1].minor.yy200 ? yymsp[-1].minor.yy200->name : QString::null, - yymsp[0].minor.yy192 ? yymsp[0].minor.yy192->notIndexedKw : false, - yymsp[0].minor.yy192 ? yymsp[0].minor.yy192->indexedBy : QString::null + yymsp[-1].minor.yy200 ? yymsp[-1].minor.yy200->name : QString(), + yymsp[0].minor.yy592 ? yymsp[0].minor.yy592->notIndexedKw : false, + yymsp[0].minor.yy592 ? yymsp[0].minor.yy592->indexedBy : QString() ); - delete yymsp[-3].minor.yy399; - delete yymsp[-2].minor.yy399; + delete yymsp[-3].minor.yy319; + delete yymsp[-2].minor.yy319; delete yymsp[-1].minor.yy200; - if (yymsp[0].minor.yy192) - delete yymsp[0].minor.yy192; - objectForTokens = yygotominor.yy201; + if (yymsp[0].minor.yy592) + delete yymsp[0].minor.yy592; + objectForTokens = yygotominor.yy441; } break; - case 174: /* singlesrc ::= LP select RP as */ + case 182: /* singlesrc ::= LP select RP as */ { - yygotominor.yy201 = new SqliteSelect::Core::SingleSource( - yymsp[-2].minor.yy473, + yygotominor.yy441 = new SqliteSelect::Core::SingleSource( + yymsp[-2].minor.yy313, yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->asKw : false, - yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString::null + yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString() ); delete yymsp[0].minor.yy200; - objectForTokens = yygotominor.yy201; + objectForTokens = yygotominor.yy441; } break; - case 175: /* singlesrc ::= LP joinsrc RP as */ + case 183: /* singlesrc ::= LP joinsrc RP as */ { - yygotominor.yy201 = new SqliteSelect::Core::SingleSource( - yymsp[-2].minor.yy511, + yygotominor.yy441 = new SqliteSelect::Core::SingleSource( + yymsp[-2].minor.yy31, yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->asKw : false, - yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString::null + yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString() ); delete yymsp[0].minor.yy200; - objectForTokens = yygotominor.yy201; + objectForTokens = yygotominor.yy441; } break; - case 176: /* singlesrc ::= nm dbnm LP exprlist RP as */ + case 184: /* singlesrc ::= nm dbnm LP exprlist RP as */ { - yygotominor.yy201 = new SqliteSelect::Core::SingleSource( - *(yymsp[-5].minor.yy399), - *(yymsp[-4].minor.yy399), + yygotominor.yy441 = new SqliteSelect::Core::SingleSource( + *(yymsp[-5].minor.yy319), + *(yymsp[-4].minor.yy319), yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->asKw : false, - yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString::null, - *(yymsp[-2].minor.yy551) + yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString(), + *(yymsp[-2].minor.yy71) ); - delete yymsp[-5].minor.yy399; - delete yymsp[-4].minor.yy399; + delete yymsp[-5].minor.yy319; + delete yymsp[-4].minor.yy319; delete yymsp[0].minor.yy200; - if (yymsp[-2].minor.yy551) - delete yymsp[-2].minor.yy551; + if (yymsp[-2].minor.yy71) + delete yymsp[-2].minor.yy71; - objectForTokens = yygotominor.yy201; + objectForTokens = yygotominor.yy441; } break; - case 177: /* singlesrc ::= */ + case 185: /* singlesrc ::= */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy201 = new SqliteSelect::Core::SingleSource(); - objectForTokens = yygotominor.yy201; + yygotominor.yy441 = new SqliteSelect::Core::SingleSource(); + objectForTokens = yygotominor.yy441; } break; - case 178: /* singlesrc ::= nm DOT */ + case 186: /* singlesrc ::= nm DOT */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy201 = new SqliteSelect::Core::SingleSource(); - yygotominor.yy201->database = *(yymsp[-1].minor.yy399); - delete yymsp[-1].minor.yy399; - objectForTokens = yygotominor.yy201; + yygotominor.yy441 = new SqliteSelect::Core::SingleSource(); + yygotominor.yy441->database = *(yymsp[-1].minor.yy319); + delete yymsp[-1].minor.yy319; + objectForTokens = yygotominor.yy441; } break; - case 183: /* joinconstr_opt ::= ON expr */ + case 191: /* joinconstr_opt ::= ON expr */ { - yygotominor.yy295 = new SqliteSelect::Core::JoinConstraint(yymsp[0].minor.yy352); + yygotominor.yy295 = new SqliteSelect::Core::JoinConstraint(yymsp[0].minor.yy512); objectForTokens = yygotominor.yy295; } break; - case 184: /* joinconstr_opt ::= USING LP idlist RP */ + case 192: /* joinconstr_opt ::= USING LP idlist RP */ { - yygotominor.yy295 = new SqliteSelect::Core::JoinConstraint(*(yymsp[-1].minor.yy95)); - delete yymsp[-1].minor.yy95; + yygotominor.yy295 = new SqliteSelect::Core::JoinConstraint(*(yymsp[-1].minor.yy575)); + delete yymsp[-1].minor.yy575; objectForTokens = yygotominor.yy295; } break; - case 185: /* joinconstr_opt ::= */ + case 193: /* joinconstr_opt ::= */ {yygotominor.yy295 = nullptr;} break; - case 188: /* fullname ::= nm dbnm */ + case 196: /* fullname ::= nm dbnm */ { - yygotominor.yy360 = new ParserFullName(); - yygotominor.yy360->name1 = *(yymsp[-1].minor.yy399); - yygotominor.yy360->name2 = *(yymsp[0].minor.yy399); - delete yymsp[-1].minor.yy399; - delete yymsp[0].minor.yy399; + yygotominor.yy440 = new ParserFullName(); + yygotominor.yy440->name1 = *(yymsp[-1].minor.yy319); + yygotominor.yy440->name2 = *(yymsp[0].minor.yy319); + delete yymsp[-1].minor.yy319; + delete yymsp[0].minor.yy319; } break; - case 189: /* joinop ::= COMMA */ + case 197: /* joinop ::= COMMA */ { - yygotominor.yy301 = new SqliteSelect::Core::JoinOp(true); - objectForTokens = yygotominor.yy301; + yygotominor.yy221 = new SqliteSelect::Core::JoinOp(true); + objectForTokens = yygotominor.yy221; } break; - case 190: /* joinop ::= JOIN */ + case 198: /* joinop ::= JOIN */ { - yygotominor.yy301 = new SqliteSelect::Core::JoinOp(false); - objectForTokens = yygotominor.yy301; + yygotominor.yy221 = new SqliteSelect::Core::JoinOp(false); + objectForTokens = yygotominor.yy221; } break; - case 191: /* joinop ::= JOIN_KW JOIN */ + case 199: /* joinop ::= JOIN_KW JOIN */ { - yygotominor.yy301 = new SqliteSelect::Core::JoinOp(yymsp[-1].minor.yy0->value); - objectForTokens = yygotominor.yy301; + yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-1].minor.yy0->value); + objectForTokens = yygotominor.yy221; } break; - case 192: /* joinop ::= JOIN_KW nm JOIN */ + case 200: /* joinop ::= JOIN_KW nm JOIN */ { - yygotominor.yy301 = new SqliteSelect::Core::JoinOp(yymsp[-2].minor.yy0->value, *(yymsp[-1].minor.yy399)); - delete yymsp[-1].minor.yy399; - objectForTokens = yygotominor.yy301; + yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-2].minor.yy0->value, *(yymsp[-1].minor.yy319)); + delete yymsp[-1].minor.yy319; + objectForTokens = yygotominor.yy221; } break; - case 193: /* joinop ::= JOIN_KW nm nm JOIN */ - case 194: /* joinop ::= ID_JOIN_OPTS */ yytestcase(yyruleno==194); + case 201: /* joinop ::= JOIN_KW nm nm JOIN */ + case 202: /* joinop ::= ID_JOIN_OPTS */ yytestcase(yyruleno==202); { - yygotominor.yy301 = new SqliteSelect::Core::JoinOp(yymsp[-3].minor.yy0->value, *(yymsp[-2].minor.yy399), *(yymsp[-1].minor.yy399)); - delete yymsp[-2].minor.yy399; - delete yymsp[-2].minor.yy399; - objectForTokens = yygotominor.yy301; + yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-3].minor.yy0->value, *(yymsp[-2].minor.yy319), *(yymsp[-1].minor.yy319)); + delete yymsp[-2].minor.yy319; + objectForTokens = yygotominor.yy221; } break; - case 195: /* indexed_opt ::= */ -{yygotominor.yy192 = nullptr;} + case 203: /* indexed_opt ::= */ +{yygotominor.yy592 = nullptr;} break; - case 196: /* indexed_opt ::= INDEXED BY nm */ + case 204: /* indexed_opt ::= INDEXED BY nm */ { - yygotominor.yy192 = new ParserIndexedBy(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; + yygotominor.yy592 = new ParserIndexedBy(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; } break; - case 197: /* indexed_opt ::= NOT INDEXED */ - case 198: /* indexed_opt ::= INDEXED BY ID_IDX */ yytestcase(yyruleno==198); -{yygotominor.yy192 = new ParserIndexedBy(true);} + case 205: /* indexed_opt ::= NOT INDEXED */ + case 206: /* indexed_opt ::= INDEXED BY ID_IDX */ yytestcase(yyruleno==206); +{yygotominor.yy592 = new ParserIndexedBy(true);} break; - case 199: /* orderby_opt ::= */ -{yygotominor.yy163 = new ParserOrderByList();} + case 207: /* orderby_opt ::= */ +{yygotominor.yy403 = new ParserOrderByList();} break; - case 200: /* orderby_opt ::= ORDER BY sortlist */ -{yygotominor.yy163 = yymsp[0].minor.yy163;} + case 208: /* orderby_opt ::= ORDER BY sortlist */ +{yygotominor.yy403 = yymsp[0].minor.yy403;} break; - case 201: /* sortlist ::= sortlist COMMA expr sortorder */ + case 209: /* sortlist ::= sortlist COMMA expr sortorder nulls */ { - SqliteOrderBy* obj = new SqliteOrderBy(yymsp[-1].minor.yy352, *(yymsp[0].minor.yy309)); - yymsp[-3].minor.yy163->append(obj); - yygotominor.yy163 = yymsp[-3].minor.yy163; - delete yymsp[0].minor.yy309; + SqliteOrderBy* obj = new SqliteOrderBy(yymsp[-2].minor.yy512, *(yymsp[-1].minor.yy549), *(yymsp[0].minor.yy579)); + yymsp[-4].minor.yy403->append(obj); + yygotominor.yy403 = yymsp[-4].minor.yy403; + delete yymsp[-1].minor.yy549; + delete yymsp[0].minor.yy579; objectForTokens = obj; DONT_INHERIT_TOKENS("sortlist"); } break; - case 202: /* sortlist ::= expr sortorder */ + case 210: /* sortlist ::= expr sortorder nulls */ { - SqliteOrderBy* obj = new SqliteOrderBy(yymsp[-1].minor.yy352, *(yymsp[0].minor.yy309)); - yygotominor.yy163 = new ParserOrderByList(); - yygotominor.yy163->append(obj); - delete yymsp[0].minor.yy309; + SqliteOrderBy* obj = new SqliteOrderBy(yymsp[-2].minor.yy512, *(yymsp[-1].minor.yy549), *(yymsp[0].minor.yy579)); + yygotominor.yy403 = new ParserOrderByList(); + yygotominor.yy403->append(obj); + delete yymsp[-1].minor.yy549; + delete yymsp[0].minor.yy579; objectForTokens = obj; } break; - case 203: /* sortorder ::= ASC */ -{yygotominor.yy309 = new SqliteSortOrder(SqliteSortOrder::ASC);} + case 211: /* sortorder ::= ASC */ +{yygotominor.yy549 = new SqliteSortOrder(SqliteSortOrder::ASC);} break; - case 204: /* sortorder ::= DESC */ -{yygotominor.yy309 = new SqliteSortOrder(SqliteSortOrder::DESC);} + case 212: /* sortorder ::= DESC */ +{yygotominor.yy549 = new SqliteSortOrder(SqliteSortOrder::DESC);} break; - case 205: /* sortorder ::= */ -{yygotominor.yy309 = new SqliteSortOrder(SqliteSortOrder::null);} + case 213: /* sortorder ::= */ +{yygotominor.yy549 = new SqliteSortOrder(SqliteSortOrder::null);} break; - case 206: /* groupby_opt ::= */ - case 320: /* exprlist ::= */ yytestcase(yyruleno==320); -{yygotominor.yy551 = new ParserExprList();} + case 214: /* nulls ::= NULLS FIRST */ +{yygotominor.yy579 = new SqliteNulls(SqliteNulls::FIRST);} break; - case 207: /* groupby_opt ::= GROUP BY nexprlist */ - case 319: /* exprlist ::= nexprlist */ yytestcase(yyruleno==319); -{yygotominor.yy551 = yymsp[0].minor.yy551;} + case 215: /* nulls ::= NULLS LAST */ +{yygotominor.yy579 = new SqliteNulls(SqliteNulls::LAST);} break; - case 208: /* groupby_opt ::= GROUP BY */ + case 216: /* nulls ::= */ +{yygotominor.yy579 = new SqliteNulls(SqliteNulls::null);} + break; + case 217: /* groupby_opt ::= */ + case 326: /* exprlist ::= */ yytestcase(yyruleno==326); +{yygotominor.yy71 = new ParserExprList();} + break; + case 218: /* groupby_opt ::= GROUP BY nexprlist */ + case 325: /* exprlist ::= nexprlist */ yytestcase(yyruleno==325); +{yygotominor.yy71 = yymsp[0].minor.yy71;} + break; + case 219: /* groupby_opt ::= GROUP BY */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy551 = new ParserExprList(); + yygotominor.yy71 = new ParserExprList(); } break; - case 209: /* having_opt ::= */ - case 221: /* where_opt ::= */ yytestcase(yyruleno==221); - case 316: /* case_else ::= */ yytestcase(yyruleno==316); - case 318: /* case_operand ::= */ yytestcase(yyruleno==318); - case 376: /* when_clause ::= */ yytestcase(yyruleno==376); - case 391: /* key_opt ::= */ yytestcase(yyruleno==391); -{yygotominor.yy352 = nullptr;} + case 220: /* having_opt ::= */ + case 232: /* where_opt ::= */ yytestcase(yyruleno==232); + case 322: /* case_else ::= */ yytestcase(yyruleno==322); + case 324: /* case_operand ::= */ yytestcase(yyruleno==324); + case 350: /* vinto ::= */ yytestcase(yyruleno==350); + case 384: /* when_clause ::= */ yytestcase(yyruleno==384); + case 399: /* key_opt ::= */ yytestcase(yyruleno==399); +{yygotominor.yy512 = nullptr;} break; - case 210: /* having_opt ::= HAVING expr */ - case 222: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==222); - case 309: /* expr ::= exprx */ yytestcase(yyruleno==309); - case 315: /* case_else ::= ELSE expr */ yytestcase(yyruleno==315); - case 317: /* case_operand ::= exprx */ yytestcase(yyruleno==317); - case 377: /* when_clause ::= WHEN expr */ yytestcase(yyruleno==377); - case 392: /* key_opt ::= KEY expr */ yytestcase(yyruleno==392); -{yygotominor.yy352 = yymsp[0].minor.yy352;} + case 221: /* having_opt ::= HAVING expr */ + case 233: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==233); + case 315: /* expr ::= exprx */ yytestcase(yyruleno==315); + case 321: /* case_else ::= ELSE expr */ yytestcase(yyruleno==321); + case 323: /* case_operand ::= exprx */ yytestcase(yyruleno==323); + case 349: /* vinto ::= INTO expr */ yytestcase(yyruleno==349); + case 385: /* when_clause ::= WHEN expr */ yytestcase(yyruleno==385); + case 400: /* key_opt ::= KEY expr */ yytestcase(yyruleno==400); +{yygotominor.yy512 = yymsp[0].minor.yy512;} break; - case 211: /* limit_opt ::= */ -{yygotominor.yy484 = nullptr;} + case 222: /* limit_opt ::= */ +{yygotominor.yy4 = nullptr;} break; - case 212: /* limit_opt ::= LIMIT expr */ + case 223: /* limit_opt ::= LIMIT expr */ { - yygotominor.yy484 = new SqliteLimit(yymsp[0].minor.yy352); - objectForTokens = yygotominor.yy484; + yygotominor.yy4 = new SqliteLimit(yymsp[0].minor.yy512); + objectForTokens = yygotominor.yy4; } break; - case 213: /* limit_opt ::= LIMIT expr OFFSET expr */ + case 224: /* limit_opt ::= LIMIT expr OFFSET expr */ { - yygotominor.yy484 = new SqliteLimit(yymsp[-2].minor.yy352, yymsp[0].minor.yy352, true); - objectForTokens = yygotominor.yy484; + yygotominor.yy4 = new SqliteLimit(yymsp[-2].minor.yy512, yymsp[0].minor.yy512, true); + objectForTokens = yygotominor.yy4; } break; - case 214: /* limit_opt ::= LIMIT expr COMMA expr */ + case 225: /* limit_opt ::= LIMIT expr COMMA expr */ { - yygotominor.yy484 = new SqliteLimit(yymsp[-2].minor.yy352, yymsp[0].minor.yy352, false); - objectForTokens = yygotominor.yy484; + yygotominor.yy4 = new SqliteLimit(yymsp[-2].minor.yy512, yymsp[0].minor.yy512, false); + objectForTokens = yygotominor.yy4; } break; - case 216: /* delete_stmt ::= with DELETE FROM fullname indexed_opt where_opt */ + case 227: /* delete_stmt ::= with DELETE FROM fullname indexed_opt where_opt */ { - if (yymsp[-1].minor.yy192) + if (yymsp[-1].minor.yy592) { - if (!yymsp[-1].minor.yy192->indexedBy.isNull()) + if (!yymsp[-1].minor.yy592->indexedBy.isNull()) { - yygotominor.yy283 = new SqliteDelete( - yymsp[-2].minor.yy360->name1, - yymsp[-2].minor.yy360->name2, - yymsp[-1].minor.yy192->indexedBy, - yymsp[0].minor.yy352, - yymsp[-5].minor.yy321 + yygotominor.yy363 = new SqliteDelete( + yymsp[-2].minor.yy440->name1, + yymsp[-2].minor.yy440->name2, + yymsp[-1].minor.yy592->indexedBy, + yymsp[0].minor.yy512, + yymsp[-5].minor.yy1 ); } else { - yygotominor.yy283 = new SqliteDelete( - yymsp[-2].minor.yy360->name1, - yymsp[-2].minor.yy360->name2, - yymsp[-1].minor.yy192->notIndexedKw, - yymsp[0].minor.yy352, - yymsp[-5].minor.yy321 + yygotominor.yy363 = new SqliteDelete( + yymsp[-2].minor.yy440->name1, + yymsp[-2].minor.yy440->name2, + yymsp[-1].minor.yy592->notIndexedKw, + yymsp[0].minor.yy512, + yymsp[-5].minor.yy1 ); } - delete yymsp[-1].minor.yy192; + delete yymsp[-1].minor.yy592; } else { - yygotominor.yy283 = new SqliteDelete( - yymsp[-2].minor.yy360->name1, - yymsp[-2].minor.yy360->name2, + yygotominor.yy363 = new SqliteDelete( + yymsp[-2].minor.yy440->name1, + yymsp[-2].minor.yy440->name2, false, - yymsp[0].minor.yy352, - yymsp[-5].minor.yy321 + yymsp[0].minor.yy512, + yymsp[-5].minor.yy1 ); } - delete yymsp[-2].minor.yy360; + delete yymsp[-2].minor.yy440; // since it's used in trigger: - objectForTokens = yygotominor.yy283; + objectForTokens = yygotominor.yy363; } break; - case 217: /* delete_stmt ::= with DELETE FROM */ + case 228: /* delete_stmt ::= with DELETE FROM */ { parserContext->minorErrorBeforeNextToken("Syntax error"); SqliteDelete* q = new SqliteDelete(); - q->with = yymsp[-2].minor.yy321; - yygotominor.yy283 = q; - objectForTokens = yygotominor.yy283; + q->with = yymsp[-2].minor.yy1; + yygotominor.yy363 = q; + objectForTokens = yygotominor.yy363; } break; - case 218: /* delete_stmt ::= with DELETE FROM nm DOT */ + case 229: /* delete_stmt ::= with DELETE FROM nm DOT */ { parserContext->minorErrorBeforeNextToken("Syntax error"); SqliteDelete* q = new SqliteDelete(); - q->with = yymsp[-4].minor.yy321; - q->database = *(yymsp[-1].minor.yy399); - yygotominor.yy283 = q; - objectForTokens = yygotominor.yy283; - delete yymsp[-1].minor.yy399; + q->with = yymsp[-4].minor.yy1; + q->database = *(yymsp[-1].minor.yy319); + yygotominor.yy363 = q; + objectForTokens = yygotominor.yy363; + delete yymsp[-1].minor.yy319; } break; - case 219: /* delete_stmt ::= with DELETE FROM nm DOT ID_TAB */ - case 228: /* update_stmt ::= with UPDATE orconf nm DOT ID_TAB */ yytestcase(yyruleno==228); -{ yy_destructor(yypParser,221,&yymsp[-5].minor); - yy_destructor(yypParser,179,&yymsp[-2].minor); + case 230: /* delete_stmt ::= with DELETE FROM nm DOT ID_TAB */ + case 239: /* update_stmt ::= with UPDATE orconf nm DOT ID_TAB */ yytestcase(yyruleno==239); +{ yy_destructor(yypParser,244,&yymsp[-5].minor); + yy_destructor(yypParser,199,&yymsp[-2].minor); } break; - case 220: /* delete_stmt ::= with DELETE FROM ID_DB|ID_TAB */ - case 229: /* update_stmt ::= with UPDATE orconf ID_DB|ID_TAB */ yytestcase(yyruleno==229); -{ yy_destructor(yypParser,221,&yymsp[-3].minor); + case 231: /* delete_stmt ::= with DELETE FROM ID_DB|ID_TAB */ + case 240: /* update_stmt ::= with UPDATE orconf ID_DB|ID_TAB */ yytestcase(yyruleno==240); +{ yy_destructor(yypParser,244,&yymsp[-3].minor); } break; - case 223: /* where_opt ::= WHERE */ + case 234: /* where_opt ::= WHERE */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy352 = new SqliteExpr(); + yygotominor.yy512 = new SqliteExpr(); } break; - case 225: /* update_stmt ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */ + case 236: /* update_stmt ::= with UPDATE orconf fullname indexed_opt SET setlist from where_opt */ { - yygotominor.yy283 = new SqliteUpdate( - *(yymsp[-5].minor.yy338), - yymsp[-4].minor.yy360->name1, - yymsp[-4].minor.yy360->name2, - yymsp[-3].minor.yy192 ? yymsp[-3].minor.yy192->notIndexedKw : false, - yymsp[-3].minor.yy192 ? yymsp[-3].minor.yy192->indexedBy : QString::null, - *(yymsp[-1].minor.yy521), - yymsp[0].minor.yy352, - yymsp[-7].minor.yy321 + yygotominor.yy363 = new SqliteUpdate( + *(yymsp[-6].minor.yy418), + yymsp[-5].minor.yy440->name1, + yymsp[-5].minor.yy440->name2, + yymsp[-4].minor.yy592 ? yymsp[-4].minor.yy592->notIndexedKw : false, + yymsp[-4].minor.yy592 ? yymsp[-4].minor.yy592->indexedBy : QString(), + *(yymsp[-2].minor.yy201), + yymsp[-1].minor.yy31, + yymsp[0].minor.yy512, + yymsp[-8].minor.yy1 ); - delete yymsp[-5].minor.yy338; - delete yymsp[-4].minor.yy360; - delete yymsp[-1].minor.yy521; - if (yymsp[-3].minor.yy192) - delete yymsp[-3].minor.yy192; + delete yymsp[-6].minor.yy418; + delete yymsp[-5].minor.yy440; + delete yymsp[-2].minor.yy201; + if (yymsp[-4].minor.yy592) + delete yymsp[-4].minor.yy592; // since it's used in trigger: - objectForTokens = yygotominor.yy283; + objectForTokens = yygotominor.yy363; } break; - case 226: /* update_stmt ::= with UPDATE orconf */ + case 237: /* update_stmt ::= with UPDATE orconf */ { parserContext->minorErrorBeforeNextToken("Syntax error"); SqliteUpdate* q = new SqliteUpdate(); - q->with = yymsp[-2].minor.yy321; - yygotominor.yy283 = q; - objectForTokens = yygotominor.yy283; - delete yymsp[0].minor.yy338; + q->with = yymsp[-2].minor.yy1; + yygotominor.yy363 = q; + objectForTokens = yygotominor.yy363; + delete yymsp[0].minor.yy418; } break; - case 227: /* update_stmt ::= with UPDATE orconf nm DOT */ + case 238: /* update_stmt ::= with UPDATE orconf nm DOT */ { parserContext->minorErrorBeforeNextToken("Syntax error"); SqliteUpdate* q = new SqliteUpdate(); - q->with = yymsp[-4].minor.yy321; - q->database = *(yymsp[-1].minor.yy399); - yygotominor.yy283 = q; - objectForTokens = yygotominor.yy283; - delete yymsp[-2].minor.yy338; - delete yymsp[-1].minor.yy399; + q->with = yymsp[-4].minor.yy1; + q->database = *(yymsp[-1].minor.yy319); + yygotominor.yy363 = q; + objectForTokens = yygotominor.yy363; + delete yymsp[-2].minor.yy418; + delete yymsp[-1].minor.yy319; } break; - case 230: /* setlist ::= setlist COMMA nm EQ expr */ + case 241: /* setlist ::= setlist COMMA nm EQ expr */ { - yymsp[-4].minor.yy521->append(ParserSetValue(*(yymsp[-2].minor.yy399), yymsp[0].minor.yy352)); - yygotominor.yy521 = yymsp[-4].minor.yy521; - delete yymsp[-2].minor.yy399; + yymsp[-4].minor.yy201->append(ParserSetValue(*(yymsp[-2].minor.yy319), yymsp[0].minor.yy512)); + yygotominor.yy201 = yymsp[-4].minor.yy201; + delete yymsp[-2].minor.yy319; } break; - case 231: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ + case 242: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ { - yymsp[-6].minor.yy521->append(ParserSetValue(*(yymsp[-3].minor.yy95), yymsp[0].minor.yy352)); - yygotominor.yy521 = yymsp[-6].minor.yy521; - delete yymsp[-3].minor.yy95; + yymsp[-6].minor.yy201->append(ParserSetValue(*(yymsp[-3].minor.yy575), yymsp[0].minor.yy512)); + yygotominor.yy201 = yymsp[-6].minor.yy201; + delete yymsp[-3].minor.yy575; } break; - case 232: /* setlist ::= nm EQ expr */ + case 243: /* setlist ::= nm EQ expr */ { - yygotominor.yy521 = new ParserSetValueList(); - yygotominor.yy521->append(ParserSetValue(*(yymsp[-2].minor.yy399), yymsp[0].minor.yy352)); - delete yymsp[-2].minor.yy399; + yygotominor.yy201 = new ParserSetValueList(); + yygotominor.yy201->append(ParserSetValue(*(yymsp[-2].minor.yy319), yymsp[0].minor.yy512)); + delete yymsp[-2].minor.yy319; } break; - case 233: /* setlist ::= LP idlist RP EQ expr */ + case 244: /* setlist ::= LP idlist RP EQ expr */ { - yygotominor.yy521 = new ParserSetValueList(); - yygotominor.yy521->append(ParserSetValue(*(yymsp[-3].minor.yy95), yymsp[0].minor.yy352)); - delete yymsp[-3].minor.yy95; + yygotominor.yy201 = new ParserSetValueList(); + yygotominor.yy201->append(ParserSetValue(*(yymsp[-3].minor.yy575), yymsp[0].minor.yy512)); + delete yymsp[-3].minor.yy575; } break; - case 234: /* setlist ::= */ + case 245: /* setlist ::= */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy521 = new ParserSetValueList(); + yygotominor.yy201 = new ParserSetValueList(); } break; - case 235: /* setlist ::= setlist COMMA */ + case 246: /* setlist ::= setlist COMMA */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy521 = yymsp[-1].minor.yy521; + yygotominor.yy201 = yymsp[-1].minor.yy201; } break; - case 236: /* setlist ::= setlist COMMA ID_COL */ - case 237: /* setlist ::= ID_COL */ yytestcase(yyruleno==237); -{ yy_destructor(yypParser,249,&yymsp[-2].minor); + case 247: /* setlist ::= setlist COMMA ID_COL */ + case 248: /* setlist ::= ID_COL */ yytestcase(yyruleno==248); +{ yy_destructor(yypParser,274,&yymsp[-2].minor); } break; - case 238: /* idlist_opt ::= */ -{yygotominor.yy95 = new QStringList();} + case 249: /* idlist_opt ::= */ +{yygotominor.yy575 = new QStringList();} break; - case 239: /* idlist_opt ::= LP idlist RP */ -{yygotominor.yy95 = yymsp[-1].minor.yy95;} + case 250: /* idlist_opt ::= LP idlist RP */ +{yygotominor.yy575 = yymsp[-1].minor.yy575;} break; - case 240: /* idlist ::= idlist COMMA nm */ + case 251: /* idlist ::= idlist COMMA nm */ { - yygotominor.yy95 = yymsp[-2].minor.yy95; - *(yygotominor.yy95) << *(yymsp[0].minor.yy399); - delete yymsp[0].minor.yy399; + yygotominor.yy575 = yymsp[-2].minor.yy575; + *(yygotominor.yy575) << *(yymsp[0].minor.yy319); + delete yymsp[0].minor.yy319; } break; - case 241: /* idlist ::= nm */ + case 252: /* idlist ::= nm */ { - yygotominor.yy95 = new QStringList(); - *(yygotominor.yy95) << *(yymsp[0].minor.yy399); - delete yymsp[0].minor.yy399; + yygotominor.yy575 = new QStringList(); + *(yygotominor.yy575) << *(yymsp[0].minor.yy319); + delete yymsp[0].minor.yy319; } break; - case 242: /* idlist ::= */ + case 253: /* idlist ::= */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy95 = new QStringList(); + yygotominor.yy575 = new QStringList(); } break; - case 243: /* idlist ::= idlist COMMA ID_COL */ - case 244: /* idlist ::= ID_COL */ yytestcase(yyruleno==244); -{ yy_destructor(yypParser,245,&yymsp[-2].minor); + case 254: /* idlist ::= idlist COMMA ID_COL */ + case 255: /* idlist ::= ID_COL */ yytestcase(yyruleno==255); +{ yy_destructor(yypParser,269,&yymsp[-2].minor); } break; - case 246: /* insert_stmt ::= with insert_cmd INTO fullname idlist_opt select upsert */ -{ - yygotominor.yy283 = new SqliteInsert( - yymsp[-5].minor.yy105->replace, - yymsp[-5].minor.yy105->orConflict, - yymsp[-3].minor.yy360->name1, - yymsp[-3].minor.yy360->name2, - *(yymsp[-2].minor.yy95), - yymsp[-1].minor.yy473, - yymsp[-6].minor.yy321, - yymsp[0].minor.yy560 + case 257: /* insert_stmt ::= with insert_cmd INTO fullname idlist_opt select upsert */ +{ + yygotominor.yy363 = new SqliteInsert( + yymsp[-5].minor.yy504->replace, + yymsp[-5].minor.yy504->orConflict, + yymsp[-3].minor.yy440->name1, + yymsp[-3].minor.yy440->name2, + *(yymsp[-2].minor.yy575), + yymsp[-1].minor.yy313, + yymsp[-6].minor.yy1, + yymsp[0].minor.yy400 ); - delete yymsp[-3].minor.yy360; - delete yymsp[-5].minor.yy105; - delete yymsp[-2].minor.yy95; + delete yymsp[-3].minor.yy440; + delete yymsp[-5].minor.yy504; + delete yymsp[-2].minor.yy575; // since it's used in trigger: - objectForTokens = yygotominor.yy283; + objectForTokens = yygotominor.yy363; } break; - case 247: /* insert_stmt ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */ + case 258: /* insert_stmt ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */ { - yygotominor.yy283 = new SqliteInsert( - yymsp[-5].minor.yy105->replace, - yymsp[-5].minor.yy105->orConflict, - yymsp[-3].minor.yy360->name1, - yymsp[-3].minor.yy360->name2, - *(yymsp[-2].minor.yy95), - yymsp[-6].minor.yy321 + yygotominor.yy363 = new SqliteInsert( + yymsp[-5].minor.yy504->replace, + yymsp[-5].minor.yy504->orConflict, + yymsp[-3].minor.yy440->name1, + yymsp[-3].minor.yy440->name2, + *(yymsp[-2].minor.yy575), + yymsp[-6].minor.yy1 ); - delete yymsp[-3].minor.yy360; - delete yymsp[-5].minor.yy105; - delete yymsp[-2].minor.yy95; + delete yymsp[-3].minor.yy440; + delete yymsp[-5].minor.yy504; + delete yymsp[-2].minor.yy575; // since it's used in trigger: - objectForTokens = yygotominor.yy283; + objectForTokens = yygotominor.yy363; } break; - case 248: /* insert_stmt ::= with insert_cmd INTO */ + case 259: /* insert_stmt ::= with insert_cmd INTO */ { parserContext->minorErrorBeforeNextToken("Syntax error"); SqliteInsert* q = new SqliteInsert(); - q->replaceKw = yymsp[-1].minor.yy105->replace; - q->onConflict = yymsp[-1].minor.yy105->orConflict; - q->with = yymsp[-2].minor.yy321; - yygotominor.yy283 = q; - objectForTokens = yygotominor.yy283; - delete yymsp[-1].minor.yy105; + q->replaceKw = yymsp[-1].minor.yy504->replace; + q->onConflict = yymsp[-1].minor.yy504->orConflict; + q->with = yymsp[-2].minor.yy1; + yygotominor.yy363 = q; + objectForTokens = yygotominor.yy363; + delete yymsp[-1].minor.yy504; } break; - case 249: /* insert_stmt ::= with insert_cmd INTO nm DOT */ + case 260: /* insert_stmt ::= with insert_cmd INTO nm DOT */ { parserContext->minorErrorBeforeNextToken("Syntax error"); SqliteInsert* q = new SqliteInsert(); - q->replaceKw = yymsp[-3].minor.yy105->replace; - q->onConflict = yymsp[-3].minor.yy105->orConflict; - q->with = yymsp[-4].minor.yy321; - q->database = *(yymsp[-1].minor.yy399); - yygotominor.yy283 = q; - objectForTokens = yygotominor.yy283; - delete yymsp[-3].minor.yy105; - delete yymsp[-1].minor.yy399; - } - break; - case 250: /* insert_stmt ::= with insert_cmd INTO ID_DB|ID_TAB */ -{ yy_destructor(yypParser,221,&yymsp[-3].minor); - yy_destructor(yypParser,252,&yymsp[-2].minor); + q->replaceKw = yymsp[-3].minor.yy504->replace; + q->onConflict = yymsp[-3].minor.yy504->orConflict; + q->with = yymsp[-4].minor.yy1; + q->database = *(yymsp[-1].minor.yy319); + yygotominor.yy363 = q; + objectForTokens = yygotominor.yy363; + delete yymsp[-3].minor.yy504; + delete yymsp[-1].minor.yy319; + } + break; + case 261: /* insert_stmt ::= with insert_cmd INTO ID_DB|ID_TAB */ +{ yy_destructor(yypParser,244,&yymsp[-3].minor); + yy_destructor(yypParser,277,&yymsp[-2].minor); } break; - case 251: /* insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB */ -{ yy_destructor(yypParser,221,&yymsp[-5].minor); - yy_destructor(yypParser,252,&yymsp[-4].minor); - yy_destructor(yypParser,179,&yymsp[-2].minor); + case 262: /* insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB */ +{ yy_destructor(yypParser,244,&yymsp[-5].minor); + yy_destructor(yypParser,277,&yymsp[-4].minor); + yy_destructor(yypParser,199,&yymsp[-2].minor); } break; - case 252: /* insert_cmd ::= INSERT orconf */ -{ - yygotominor.yy105 = new ParserStubInsertOrReplace(false, *(yymsp[0].minor.yy338)); - delete yymsp[0].minor.yy338; - } - break; - case 253: /* insert_cmd ::= REPLACE */ -{yygotominor.yy105 = new ParserStubInsertOrReplace(true);} - break; - case 254: /* upsert ::= */ + case 263: /* insert_cmd ::= INSERT orconf */ { - yygotominor.yy560 = nullptr; + yygotominor.yy504 = new ParserStubInsertOrReplace(false, *(yymsp[0].minor.yy418)); + delete yymsp[0].minor.yy418; } break; - case 255: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ -{ - yygotominor.yy560 = new SqliteUpsert(*(yymsp[-7].minor.yy163), yymsp[-5].minor.yy352, *(yymsp[-1].minor.yy521), yymsp[0].minor.yy352); - delete yymsp[-7].minor.yy163; - delete yymsp[-1].minor.yy521; - objectForTokens = yygotominor.yy560; - } + case 264: /* insert_cmd ::= REPLACE */ +{yygotominor.yy504 = new ParserStubInsertOrReplace(true);} break; - case 256: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ + case 265: /* upsert ::= */ { - yygotominor.yy560 = new SqliteUpsert(*(yymsp[-4].minor.yy163), yymsp[-2].minor.yy352); - delete yymsp[-4].minor.yy163; - objectForTokens = yygotominor.yy560; + yygotominor.yy400 = nullptr; } break; - case 257: /* upsert ::= ON CONFLICT DO NOTHING */ + case 266: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ { - yygotominor.yy560 = new SqliteUpsert(); - objectForTokens = yygotominor.yy560; + yygotominor.yy400 = new SqliteUpsert(*(yymsp[-7].minor.yy403), yymsp[-5].minor.yy512, *(yymsp[-1].minor.yy201), yymsp[0].minor.yy512); + delete yymsp[-7].minor.yy403; + delete yymsp[-1].minor.yy201; + objectForTokens = yygotominor.yy400; } break; - case 258: /* exprx ::= nm DOT */ + case 267: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initId(*(yymsp[-1].minor.yy399), QString::null, QString::null); - delete yymsp[-1].minor.yy399; - objectForTokens = yygotominor.yy352; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: nm.>"); + yygotominor.yy400 = new SqliteUpsert(*(yymsp[-4].minor.yy403), yymsp[-2].minor.yy512); + delete yymsp[-4].minor.yy403; + objectForTokens = yygotominor.yy400; } break; - case 259: /* exprx ::= nm DOT nm DOT */ + case 268: /* upsert ::= ON CONFLICT DO NOTHING */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initId(*(yymsp[-3].minor.yy399), *(yymsp[-1].minor.yy399), QString::null); - delete yymsp[-3].minor.yy399; - delete yymsp[-1].minor.yy399; - objectForTokens = yygotominor.yy352; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: nm.nm.>"); + yygotominor.yy400 = new SqliteUpsert(); + objectForTokens = yygotominor.yy400; } break; - case 260: /* exprx ::= expr not_opt BETWEEN expr AND */ -{ - yygotominor.yy352 = new SqliteExpr(); - delete yymsp[-3].minor.yy451; - delete yymsp[-4].minor.yy352; - delete yymsp[-1].minor.yy352; - objectForTokens = yygotominor.yy352; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: expr not_opt BETWEEN expr AND>"); - } - break; - case 261: /* exprx ::= CASE case_operand case_exprlist case_else */ -{ - yygotominor.yy352 = new SqliteExpr(); - delete yymsp[-1].minor.yy551; - delete yymsp[-2].minor.yy352; - delete yymsp[0].minor.yy352; - objectForTokens = yygotominor.yy352; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: CASE operand exprlist else>"); - } - break; - case 262: /* exprx ::= expr not_opt IN LP exprlist */ -{ - yygotominor.yy352 = new SqliteExpr(); - delete yymsp[-3].minor.yy451; - delete yymsp[0].minor.yy551; - delete yymsp[-4].minor.yy352; - objectForTokens = yygotominor.yy352; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: expr not_opt IN LP exprlist>"); - } - break; - case 263: /* exprx ::= expr not_opt IN ID_DB */ -{ yy_destructor(yypParser,201,&yymsp[-3].minor); + case 269: /* exprx ::= expr not_opt IN ID_DB */ +{ yy_destructor(yypParser,222,&yymsp[-3].minor); } break; - case 264: /* exprx ::= expr not_opt IN nm DOT ID_TAB */ - case 265: /* exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN */ yytestcase(yyruleno==265); -{ yy_destructor(yypParser,201,&yymsp[-5].minor); - yy_destructor(yypParser,179,&yymsp[-2].minor); + case 270: /* exprx ::= expr not_opt IN nm DOT ID_TAB */ + case 271: /* exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN */ yytestcase(yyruleno==271); +{ yy_destructor(yypParser,222,&yymsp[-5].minor); + yy_destructor(yypParser,199,&yymsp[-2].minor); } break; - case 267: /* exprx ::= nm DOT nm DOT ID_COL */ -{ yy_destructor(yypParser,179,&yymsp[-4].minor); - yy_destructor(yypParser,179,&yymsp[-2].minor); + case 272: /* exprx ::= tnm DOT ID_TAB|ID_COL */ +{ yy_destructor(yypParser,230,&yymsp[-2].minor); } break; - case 268: /* exprx ::= expr COLLATE ID_COLLATE */ - case 269: /* exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP */ yytestcase(yyruleno==269); -{ yy_destructor(yypParser,201,&yymsp[-2].minor); + case 273: /* exprx ::= tnm DOT nm DOT ID_COL */ +{ yy_destructor(yypParser,230,&yymsp[-4].minor); + yy_destructor(yypParser,199,&yymsp[-2].minor); } break; - case 270: /* exprx ::= term */ -{ - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initLiteral(*(yymsp[0].minor.yy469)); - delete yymsp[0].minor.yy469; - objectForTokens = yygotominor.yy352; - } - break; - case 271: /* exprx ::= CTIME_KW */ -{ - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initCTime(yymsp[0].minor.yy0->value); - objectForTokens = yygotominor.yy352; - } + case 274: /* exprx ::= expr COLLATE ID_COLLATE */ + case 275: /* exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP */ yytestcase(yyruleno==275); +{ yy_destructor(yypParser,222,&yymsp[-2].minor); +} break; - case 272: /* exprx ::= LP nexprlist RP */ + case 276: /* exprx ::= CTIME_KW */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initRowValue(*(yymsp[-1].minor.yy551)); - delete yymsp[-1].minor.yy551; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initCTime(yymsp[0].minor.yy0->value); + objectForTokens = yygotominor.yy512; } break; - case 273: /* exprx ::= id */ + case 277: /* exprx ::= LP nexprlist RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initId(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initRowValue(*(yymsp[-1].minor.yy71)); + delete yymsp[-1].minor.yy71; + objectForTokens = yygotominor.yy512; } break; - case 274: /* exprx ::= JOIN_KW */ + case 278: /* exprx ::= tnm */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initId(yymsp[0].minor.yy0->value); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + if (yymsp[0].minor.yy590->isLiteral()) + yygotominor.yy512->initLiteral(yymsp[0].minor.yy590->toLiteral()); + else + yygotominor.yy512->initId(yymsp[0].minor.yy590->toName()); + //parserContext->errorBeforeLastToken("Syntax error <expected literal value>"); + + delete yymsp[0].minor.yy590; + objectForTokens = yygotominor.yy512; } break; - case 275: /* exprx ::= nm DOT nm */ + case 279: /* exprx ::= tnm DOT nm */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initId(*(yymsp[-2].minor.yy399), *(yymsp[0].minor.yy399)); - delete yymsp[-2].minor.yy399; - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + if (yymsp[-2].minor.yy590->isName()) + yygotominor.yy512->initId(yymsp[-2].minor.yy590->toName(), *(yymsp[0].minor.yy319)); + else + parserContext->errorAtToken("Syntax error <expected name>", -3); + + delete yymsp[-2].minor.yy590; + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy512; } break; - case 276: /* exprx ::= nm DOT nm DOT nm */ + case 280: /* exprx ::= tnm DOT nm DOT nm */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initId(*(yymsp[-4].minor.yy399), *(yymsp[-2].minor.yy399), *(yymsp[0].minor.yy399)); - delete yymsp[-4].minor.yy399; - delete yymsp[-2].minor.yy399; - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + if (yymsp[-4].minor.yy590->isName()) + yygotominor.yy512->initId(yymsp[-4].minor.yy590->toName(), *(yymsp[-2].minor.yy319), *(yymsp[0].minor.yy319)); + else + parserContext->errorAtToken("Syntax error <expected name>", -5); + + delete yymsp[-4].minor.yy590; + delete yymsp[-2].minor.yy319; + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy512; } break; - case 277: /* exprx ::= VARIABLE */ + case 281: /* exprx ::= VARIABLE */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initBindParam(yymsp[0].minor.yy0->value); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initBindParam(yymsp[0].minor.yy0->value); + objectForTokens = yygotominor.yy512; } break; - case 278: /* exprx ::= expr COLLATE ids */ + case 282: /* exprx ::= expr COLLATE ids */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initCollate(yymsp[-2].minor.yy352, *(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initCollate(yymsp[-2].minor.yy512, *(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy512; } break; - case 279: /* exprx ::= CAST LP expr AS typetoken RP */ + case 283: /* exprx ::= CAST LP expr AS typetoken RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initCast(yymsp[-3].minor.yy352, yymsp[-1].minor.yy537); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initCast(yymsp[-3].minor.yy512, yymsp[-1].minor.yy57); + objectForTokens = yygotominor.yy512; } break; - case 280: /* exprx ::= ID LP distinct exprlist RP */ + case 284: /* exprx ::= ID LP distinct exprlist RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initFunction(yymsp[-4].minor.yy0->value, *(yymsp[-2].minor.yy146), *(yymsp[-1].minor.yy551)); - delete yymsp[-2].minor.yy146; - delete yymsp[-1].minor.yy551; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initFunction(yymsp[-4].minor.yy0->value, *(yymsp[-2].minor.yy386), *(yymsp[-1].minor.yy71)); + delete yymsp[-2].minor.yy386; + delete yymsp[-1].minor.yy71; + objectForTokens = yygotominor.yy512; } break; - case 281: /* exprx ::= ID LP STAR RP */ + case 285: /* exprx ::= ID LP STAR RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initFunction(yymsp[-3].minor.yy0->value, true); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initFunction(yymsp[-3].minor.yy0->value, true); + objectForTokens = yygotominor.yy512; } break; - case 282: /* exprx ::= expr AND expr */ - case 283: /* exprx ::= expr OR expr */ yytestcase(yyruleno==283); - case 284: /* exprx ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==284); - case 285: /* exprx ::= expr EQ|NE expr */ yytestcase(yyruleno==285); - case 286: /* exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==286); - case 287: /* exprx ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==287); - case 288: /* exprx ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==288); - case 289: /* exprx ::= expr CONCAT expr */ yytestcase(yyruleno==289); + case 286: /* exprx ::= expr AND expr */ + case 287: /* exprx ::= expr OR expr */ yytestcase(yyruleno==287); + case 288: /* exprx ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==288); + case 289: /* exprx ::= expr EQ|NE expr */ yytestcase(yyruleno==289); + case 290: /* exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==290); + case 291: /* exprx ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==291); + case 292: /* exprx ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==292); + case 293: /* exprx ::= expr CONCAT expr */ yytestcase(yyruleno==293); { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initBinOp(yymsp[-2].minor.yy352, yymsp[-1].minor.yy0->value, yymsp[0].minor.yy352); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initBinOp(yymsp[-2].minor.yy512, yymsp[-1].minor.yy0->value, yymsp[0].minor.yy512); + objectForTokens = yygotominor.yy512; } break; - case 290: /* exprx ::= expr not_opt likeop expr */ + case 294: /* exprx ::= expr not_opt likeop expr */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initLike(yymsp[-3].minor.yy352, *(yymsp[-2].minor.yy451), *(yymsp[-1].minor.yy520), yymsp[0].minor.yy352); - delete yymsp[-2].minor.yy451; - delete yymsp[-1].minor.yy520; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initLike(yymsp[-3].minor.yy512, *(yymsp[-2].minor.yy611), *(yymsp[-1].minor.yy40), yymsp[0].minor.yy512); + delete yymsp[-2].minor.yy611; + delete yymsp[-1].minor.yy40; + objectForTokens = yygotominor.yy512; } break; - case 291: /* exprx ::= expr not_opt likeop expr ESCAPE expr */ + case 295: /* exprx ::= expr not_opt likeop expr ESCAPE expr */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initLike(yymsp[-5].minor.yy352, *(yymsp[-4].minor.yy451), *(yymsp[-3].minor.yy520), yymsp[-2].minor.yy352, yymsp[0].minor.yy352); - delete yymsp[-4].minor.yy451; - delete yymsp[-3].minor.yy520; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initLike(yymsp[-5].minor.yy512, *(yymsp[-4].minor.yy611), *(yymsp[-3].minor.yy40), yymsp[-2].minor.yy512, yymsp[0].minor.yy512); + delete yymsp[-4].minor.yy611; + delete yymsp[-3].minor.yy40; + objectForTokens = yygotominor.yy512; } break; - case 292: /* exprx ::= expr ISNULL|NOTNULL */ + case 296: /* exprx ::= expr ISNULL|NOTNULL */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initNull(yymsp[-1].minor.yy352, yymsp[0].minor.yy0->value); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initNull(yymsp[-1].minor.yy512, yymsp[0].minor.yy0->value); + objectForTokens = yygotominor.yy512; } break; - case 293: /* exprx ::= expr NOT NULL */ + case 297: /* exprx ::= expr NOT NULL */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initNull(yymsp[-2].minor.yy352, "NOT NULL"); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initNull(yymsp[-2].minor.yy512, "NOT NULL"); + objectForTokens = yygotominor.yy512; } break; - case 294: /* exprx ::= expr IS not_opt expr */ + case 298: /* exprx ::= expr IS not_opt expr */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initIs(yymsp[-3].minor.yy352, *(yymsp[-1].minor.yy451), yymsp[0].minor.yy352); - delete yymsp[-1].minor.yy451; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initIs(yymsp[-3].minor.yy512, *(yymsp[-1].minor.yy611), yymsp[0].minor.yy512); + delete yymsp[-1].minor.yy611; + objectForTokens = yygotominor.yy512; } break; - case 295: /* exprx ::= NOT expr */ + case 299: /* exprx ::= NOT expr */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initUnaryOp(yymsp[0].minor.yy352, yymsp[-1].minor.yy0->value); + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initUnaryOp(yymsp[0].minor.yy512, yymsp[-1].minor.yy0->value); } break; - case 296: /* exprx ::= BITNOT expr */ - case 298: /* exprx ::= PLUS expr */ yytestcase(yyruleno==298); + case 300: /* exprx ::= BITNOT expr */ + case 302: /* exprx ::= PLUS expr */ yytestcase(yyruleno==302); { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initUnaryOp(yymsp[0].minor.yy352, yymsp[-1].minor.yy0->value); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initUnaryOp(yymsp[0].minor.yy512, yymsp[-1].minor.yy0->value); + objectForTokens = yygotominor.yy512; } break; - case 297: /* exprx ::= MINUS expr */ + case 301: /* exprx ::= MINUS expr */ { - yygotominor.yy352 = new SqliteExpr(); - if (yymsp[0].minor.yy352->mode == SqliteExpr::Mode::LITERAL_VALUE && + yygotominor.yy512 = new SqliteExpr(); + if (yymsp[0].minor.yy512->mode == SqliteExpr::Mode::LITERAL_VALUE && parserContext->isCandidateForMaxNegativeNumber() && - yymsp[0].minor.yy352->literalValue == static_cast<qint64>(0L)) + yymsp[0].minor.yy512->literalValue == static_cast<qint64>(0L)) { - yygotominor.yy352->initLiteral(std::numeric_limits<qint64>::min()); - delete yymsp[0].minor.yy352; + yygotominor.yy512->initLiteral(std::numeric_limits<qint64>::min()); + delete yymsp[0].minor.yy512; } else { - yygotominor.yy352->initUnaryOp(yymsp[0].minor.yy352, yymsp[-1].minor.yy0->value); + yygotominor.yy512->initUnaryOp(yymsp[0].minor.yy512, yymsp[-1].minor.yy0->value); } - objectForTokens = yygotominor.yy352; + objectForTokens = yygotominor.yy512; } break; - case 299: /* exprx ::= expr not_opt BETWEEN expr AND expr */ + case 303: /* exprx ::= expr not_opt BETWEEN expr AND expr */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initBetween(yymsp[-5].minor.yy352, *(yymsp[-4].minor.yy451), yymsp[-2].minor.yy352, yymsp[0].minor.yy352); - delete yymsp[-4].minor.yy451; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initBetween(yymsp[-5].minor.yy512, *(yymsp[-4].minor.yy611), yymsp[-2].minor.yy512, yymsp[0].minor.yy512); + delete yymsp[-4].minor.yy611; + objectForTokens = yygotominor.yy512; } break; - case 300: /* exprx ::= expr not_opt IN LP exprlist RP */ + case 304: /* exprx ::= expr not_opt IN LP exprlist RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initIn(yymsp[-5].minor.yy352, *(yymsp[-4].minor.yy451), *(yymsp[-1].minor.yy551)); - delete yymsp[-4].minor.yy451; - delete yymsp[-1].minor.yy551; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initIn(yymsp[-5].minor.yy512, *(yymsp[-4].minor.yy611), *(yymsp[-1].minor.yy71)); + delete yymsp[-4].minor.yy611; + delete yymsp[-1].minor.yy71; + objectForTokens = yygotominor.yy512; } break; - case 301: /* exprx ::= LP select RP */ + case 305: /* exprx ::= LP select RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initSubSelect(yymsp[-1].minor.yy473); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initSubSelect(yymsp[-1].minor.yy313); + objectForTokens = yygotominor.yy512; } break; - case 302: /* exprx ::= expr not_opt IN LP select RP */ + case 306: /* exprx ::= expr not_opt IN LP select RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initIn(yymsp[-5].minor.yy352, *(yymsp[-4].minor.yy451), yymsp[-1].minor.yy473); - delete yymsp[-4].minor.yy451; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initIn(yymsp[-5].minor.yy512, *(yymsp[-4].minor.yy611), yymsp[-1].minor.yy313); + delete yymsp[-4].minor.yy611; + objectForTokens = yygotominor.yy512; } break; - case 303: /* exprx ::= expr not_opt IN nm dbnm */ + case 307: /* exprx ::= expr not_opt IN nm dbnm */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initIn(yymsp[-4].minor.yy352, *(yymsp[-3].minor.yy451), *(yymsp[-1].minor.yy399), *(yymsp[0].minor.yy399)); - delete yymsp[-3].minor.yy451; - delete yymsp[-1].minor.yy399; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initIn(yymsp[-4].minor.yy512, *(yymsp[-3].minor.yy611), *(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319)); + delete yymsp[-3].minor.yy611; + delete yymsp[-1].minor.yy319; + objectForTokens = yygotominor.yy512; } break; - case 304: /* exprx ::= EXISTS LP select RP */ + case 308: /* exprx ::= EXISTS LP select RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initExists(yymsp[-1].minor.yy473); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initExists(yymsp[-1].minor.yy313); + objectForTokens = yygotominor.yy512; } break; - case 305: /* exprx ::= CASE case_operand case_exprlist case_else END */ + case 309: /* exprx ::= CASE case_operand case_exprlist case_else END */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initCase(yymsp[-3].minor.yy352, *(yymsp[-2].minor.yy551), yymsp[-1].minor.yy352); - delete yymsp[-2].minor.yy551; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initCase(yymsp[-3].minor.yy512, *(yymsp[-2].minor.yy71), yymsp[-1].minor.yy512); + delete yymsp[-2].minor.yy71; + objectForTokens = yygotominor.yy512; } break; - case 306: /* exprx ::= RAISE LP IGNORE RP */ + case 310: /* exprx ::= RAISE LP IGNORE RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initRaise(yymsp[-1].minor.yy0->value); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initRaise(yymsp[-1].minor.yy0->value); + objectForTokens = yygotominor.yy512; } break; - case 307: /* exprx ::= RAISE LP raisetype COMMA nm RP */ + case 311: /* exprx ::= RAISE LP raisetype COMMA nm RP */ { - yygotominor.yy352 = new SqliteExpr(); - yygotominor.yy352->initRaise(yymsp[-3].minor.yy0->value, *(yymsp[-1].minor.yy399)); - delete yymsp[-1].minor.yy399; - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initRaise(yymsp[-3].minor.yy0->value, *(yymsp[-1].minor.yy319)); + delete yymsp[-1].minor.yy319; + objectForTokens = yygotominor.yy512; } break; - case 308: /* expr ::= */ + case 312: /* exprx ::= ID LP distinct exprlist RP filter_over */ { - yygotominor.yy352 = new SqliteExpr(); - objectForTokens = yygotominor.yy352; + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initWindowFunction(yymsp[-5].minor.yy0->value, *(yymsp[-3].minor.yy386), *(yymsp[-2].minor.yy71), yymsp[0].minor.yy247); + delete yymsp[-3].minor.yy386; + delete yymsp[-2].minor.yy71; + objectForTokens = yygotominor.yy512; + } + break; + case 313: /* exprx ::= ID LP STAR RP filter_over */ +{ + yygotominor.yy512 = new SqliteExpr(); + yygotominor.yy512->initWindowFunction(yymsp[-4].minor.yy0->value, yymsp[0].minor.yy247); + objectForTokens = yygotominor.yy512; + } + break; + case 314: /* expr ::= */ +{ + yygotominor.yy512 = new SqliteExpr(); + objectForTokens = yygotominor.yy512; parserContext->minorErrorAfterLastToken("Syntax error <expr>"); } break; - case 312: /* likeop ::= LIKE_KW|MATCH */ -{yygotominor.yy520 = new SqliteExpr::LikeOp(SqliteExpr::likeOp(yymsp[0].minor.yy0->value));} + case 318: /* likeop ::= LIKE_KW|MATCH */ +{yygotominor.yy40 = new SqliteExpr::LikeOp(SqliteExpr::likeOp(yymsp[0].minor.yy0->value));} break; - case 313: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ + case 319: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { - yymsp[-4].minor.yy551->append(yymsp[-2].minor.yy352); - yymsp[-4].minor.yy551->append(yymsp[0].minor.yy352); - yygotominor.yy551 = yymsp[-4].minor.yy551; + yymsp[-4].minor.yy71->append(yymsp[-2].minor.yy512); + yymsp[-4].minor.yy71->append(yymsp[0].minor.yy512); + yygotominor.yy71 = yymsp[-4].minor.yy71; } break; - case 314: /* case_exprlist ::= WHEN expr THEN expr */ + case 320: /* case_exprlist ::= WHEN expr THEN expr */ { - yygotominor.yy551 = new ParserExprList(); - yygotominor.yy551->append(yymsp[-2].minor.yy352); - yygotominor.yy551->append(yymsp[0].minor.yy352); + yygotominor.yy71 = new ParserExprList(); + yygotominor.yy71->append(yymsp[-2].minor.yy512); + yygotominor.yy71->append(yymsp[0].minor.yy512); } break; - case 321: /* nexprlist ::= nexprlist COMMA expr */ + case 327: /* nexprlist ::= nexprlist COMMA expr */ { - yymsp[-2].minor.yy551->append(yymsp[0].minor.yy352); - yygotominor.yy551 = yymsp[-2].minor.yy551; + yymsp[-2].minor.yy71->append(yymsp[0].minor.yy512); + yygotominor.yy71 = yymsp[-2].minor.yy71; DONT_INHERIT_TOKENS("nexprlist"); } break; - case 322: /* nexprlist ::= exprx */ + case 328: /* nexprlist ::= exprx */ { - yygotominor.yy551 = new ParserExprList(); - yygotominor.yy551->append(yymsp[0].minor.yy352); + yygotominor.yy71 = new ParserExprList(); + yygotominor.yy71->append(yymsp[0].minor.yy512); } break; - case 323: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + case 329: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { - yygotominor.yy283 = new SqliteCreateIndex( - *(yymsp[-10].minor.yy451), - *(yymsp[-8].minor.yy451), - *(yymsp[-7].minor.yy399), - *(yymsp[-6].minor.yy399), - *(yymsp[-4].minor.yy399), - *(yymsp[-2].minor.yy163), - yymsp[0].minor.yy352 + yygotominor.yy363 = new SqliteCreateIndex( + *(yymsp[-10].minor.yy611), + *(yymsp[-8].minor.yy611), + *(yymsp[-7].minor.yy319), + *(yymsp[-6].minor.yy319), + *(yymsp[-4].minor.yy319), + *(yymsp[-2].minor.yy403), + yymsp[0].minor.yy512 ); - delete yymsp[-8].minor.yy451; - delete yymsp[-10].minor.yy451; - delete yymsp[-7].minor.yy399; - delete yymsp[-6].minor.yy399; - delete yymsp[-4].minor.yy399; - delete yymsp[-2].minor.yy163; - objectForTokens = yygotominor.yy283; + delete yymsp[-8].minor.yy611; + delete yymsp[-10].minor.yy611; + delete yymsp[-7].minor.yy319; + delete yymsp[-6].minor.yy319; + delete yymsp[-4].minor.yy319; + delete yymsp[-2].minor.yy403; + objectForTokens = yygotominor.yy363; } break; - case 324: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON ID_TAB */ -{ yy_destructor(yypParser,179,&yymsp[-3].minor); + case 330: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON ID_TAB */ +{ yy_destructor(yypParser,199,&yymsp[-3].minor); } break; - case 329: /* idxlist_opt ::= */ + case 335: /* idxlist_opt ::= */ {yygotominor.yy223 = new ParserIndexedColumnList();} break; - case 330: /* idxlist_opt ::= LP idxlist RP */ + case 336: /* idxlist_opt ::= LP idxlist RP */ {yygotominor.yy223 = yymsp[-1].minor.yy223;} break; - case 331: /* idxlist ::= idxlist COMMA idxlist_single */ + case 337: /* idxlist ::= idxlist COMMA idxlist_single */ { - yymsp[-2].minor.yy223->append(yymsp[0].minor.yy108); + yymsp[-2].minor.yy223->append(yymsp[0].minor.yy268); yygotominor.yy223 = yymsp[-2].minor.yy223; DONT_INHERIT_TOKENS("idxlist"); } break; - case 332: /* idxlist ::= idxlist_single */ + case 338: /* idxlist ::= idxlist_single */ { yygotominor.yy223 = new ParserIndexedColumnList(); - yygotominor.yy223->append(yymsp[0].minor.yy108); + yygotominor.yy223->append(yymsp[0].minor.yy268); } break; - case 333: /* idxlist_single ::= nm collate sortorder */ - case 334: /* idxlist_single ::= ID_COL */ yytestcase(yyruleno==334); + case 339: /* idxlist_single ::= nm collate sortorder */ + case 340: /* idxlist_single ::= ID_COL */ yytestcase(yyruleno==340); { SqliteIndexedColumn* obj = new SqliteIndexedColumn( - *(yymsp[-2].minor.yy399), - *(yymsp[-1].minor.yy399), - *(yymsp[0].minor.yy309) + *(yymsp[-2].minor.yy319), + *(yymsp[-1].minor.yy319), + *(yymsp[0].minor.yy549) ); - yygotominor.yy108 = obj; - delete yymsp[0].minor.yy309; - delete yymsp[-2].minor.yy399; - delete yymsp[-1].minor.yy399; - objectForTokens = yygotominor.yy108; + yygotominor.yy268 = obj; + delete yymsp[0].minor.yy549; + delete yymsp[-2].minor.yy319; + delete yymsp[-1].minor.yy319; + objectForTokens = yygotominor.yy268; } break; - case 338: /* cmd ::= DROP INDEX ifexists fullname */ + case 344: /* cmd ::= DROP INDEX ifexists fullname */ { - yygotominor.yy283 = new SqliteDropIndex(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy360->name1, yymsp[0].minor.yy360->name2); - delete yymsp[-1].minor.yy451; - delete yymsp[0].minor.yy360; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteDropIndex(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy440->name1, yymsp[0].minor.yy440->name2); + delete yymsp[-1].minor.yy611; + delete yymsp[0].minor.yy440; + objectForTokens = yygotominor.yy363; } break; - case 341: /* cmd ::= VACUUM */ + case 347: /* cmd ::= VACUUM vinto */ { - yygotominor.yy283 = new SqliteVacuum(); - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteVacuum(yymsp[0].minor.yy512); + objectForTokens = yygotominor.yy363; } break; - case 342: /* cmd ::= VACUUM nm */ + case 348: /* cmd ::= VACUUM nm vinto */ { - yygotominor.yy283 = new SqliteVacuum(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteVacuum(*(yymsp[-1].minor.yy319), yymsp[0].minor.yy512); + delete yymsp[-1].minor.yy319; + objectForTokens = yygotominor.yy363; } break; - case 343: /* cmd ::= PRAGMA nm dbnm */ + case 351: /* cmd ::= PRAGMA nm dbnm */ { - yygotominor.yy283 = new SqlitePragma(*(yymsp[-1].minor.yy399), *(yymsp[0].minor.yy399)); - delete yymsp[-1].minor.yy399; - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqlitePragma(*(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319)); + delete yymsp[-1].minor.yy319; + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy363; } break; - case 344: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ - case 346: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ yytestcase(yyruleno==346); + case 352: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ + case 354: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ yytestcase(yyruleno==354); { - yygotominor.yy283 = new SqlitePragma(*(yymsp[-3].minor.yy399), *(yymsp[-2].minor.yy399), *(yymsp[0].minor.yy469), true); - delete yymsp[-3].minor.yy399; - delete yymsp[-2].minor.yy399; - delete yymsp[0].minor.yy469; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqlitePragma(*(yymsp[-3].minor.yy319), *(yymsp[-2].minor.yy319), *(yymsp[0].minor.yy229), true); + delete yymsp[-3].minor.yy319; + delete yymsp[-2].minor.yy319; + delete yymsp[0].minor.yy229; + objectForTokens = yygotominor.yy363; } break; - case 345: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ - case 347: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ yytestcase(yyruleno==347); + case 353: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ + case 355: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ yytestcase(yyruleno==355); { - yygotominor.yy283 = new SqlitePragma(*(yymsp[-4].minor.yy399), *(yymsp[-3].minor.yy399), *(yymsp[-1].minor.yy469), false); - delete yymsp[-4].minor.yy399; - delete yymsp[-3].minor.yy399; - delete yymsp[-1].minor.yy469; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqlitePragma(*(yymsp[-4].minor.yy319), *(yymsp[-3].minor.yy319), *(yymsp[-1].minor.yy229), false); + delete yymsp[-4].minor.yy319; + delete yymsp[-3].minor.yy319; + delete yymsp[-1].minor.yy229; + objectForTokens = yygotominor.yy363; } break; - case 351: /* nmnum ::= nm */ + case 359: /* nmnum ::= nm */ { - yygotominor.yy469 = new QVariant(*(yymsp[0].minor.yy399)); - delete yymsp[0].minor.yy399; + yygotominor.yy229 = new QVariant(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; } break; - case 357: /* minus_num ::= MINUS number */ + case 360: /* nmnum ::= ON */ + case 361: /* nmnum ::= DELETE */ yytestcase(yyruleno==361); + case 362: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==362); +{yygotominor.yy229 = new QVariant(yymsp[0].minor.yy0->value);} + break; + case 365: /* minus_num ::= MINUS number */ { - if (yymsp[0].minor.yy469->type() == QVariant::Double) - *(yymsp[0].minor.yy469) = -(yymsp[0].minor.yy469->toDouble()); - else if (yymsp[0].minor.yy469->type() == QVariant::LongLong) + if (yymsp[0].minor.yy229->type() == QVariant::Double) + *(yymsp[0].minor.yy229) = -(yymsp[0].minor.yy229->toDouble()); + else if (yymsp[0].minor.yy229->type() == QVariant::LongLong) { if (parserContext->isCandidateForMaxNegativeNumber()) - *(yymsp[0].minor.yy469) = std::numeric_limits<qint64>::min(); + *(yymsp[0].minor.yy229) = std::numeric_limits<qint64>::min(); else - *(yymsp[0].minor.yy469) = -(yymsp[0].minor.yy469->toLongLong()); + *(yymsp[0].minor.yy229) = -(yymsp[0].minor.yy229->toLongLong()); } else Q_ASSERT_X(true, "producing minus number", "QVariant is neither of Double or LongLong."); - yygotominor.yy469 = yymsp[0].minor.yy469; - } - break; - case 360: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list END */ -{ - yygotominor.yy283 = new SqliteCreateTrigger( - *(yymsp[-13].minor.yy146), - *(yymsp[-11].minor.yy451), - *(yymsp[-10].minor.yy399), - *(yymsp[-9].minor.yy399), - *(yymsp[-5].minor.yy399), - *(yymsp[-8].minor.yy132), - yymsp[-7].minor.yy552, - *(yymsp[-4].minor.yy3), - yymsp[-3].minor.yy352, - *(yymsp[-1].minor.yy430), + yygotominor.yy229 = yymsp[0].minor.yy229; + } + break; + case 368: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list END */ +{ + yygotominor.yy363 = new SqliteCreateTrigger( + *(yymsp[-13].minor.yy386), + *(yymsp[-11].minor.yy611), + *(yymsp[-10].minor.yy319), + *(yymsp[-9].minor.yy319), + *(yymsp[-5].minor.yy319), + *(yymsp[-8].minor.yy532), + yymsp[-7].minor.yy151, + *(yymsp[-4].minor.yy83), + yymsp[-3].minor.yy512, + *(yymsp[-1].minor.yy110), 3 ); - delete yymsp[-11].minor.yy451; - delete yymsp[-13].minor.yy146; - delete yymsp[-8].minor.yy132; - delete yymsp[-4].minor.yy3; - delete yymsp[-10].minor.yy399; - delete yymsp[-5].minor.yy399; - delete yymsp[-9].minor.yy399; - delete yymsp[-1].minor.yy430; - objectForTokens = yygotominor.yy283; + delete yymsp[-11].minor.yy611; + delete yymsp[-13].minor.yy386; + delete yymsp[-8].minor.yy532; + delete yymsp[-4].minor.yy83; + delete yymsp[-10].minor.yy319; + delete yymsp[-5].minor.yy319; + delete yymsp[-9].minor.yy319; + delete yymsp[-1].minor.yy110; + objectForTokens = yygotominor.yy363; } break; - case 361: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause */ + case 369: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause */ { QList<SqliteQuery *> CL; - yygotominor.yy283 = new SqliteCreateTrigger( - *(yymsp[-10].minor.yy146), - *(yymsp[-8].minor.yy451), - *(yymsp[-7].minor.yy399), - *(yymsp[-6].minor.yy399), - *(yymsp[-2].minor.yy399), - *(yymsp[-5].minor.yy132), - yymsp[-4].minor.yy552, - *(yymsp[-1].minor.yy3), - yymsp[0].minor.yy352, + yygotominor.yy363 = new SqliteCreateTrigger( + *(yymsp[-10].minor.yy386), + *(yymsp[-8].minor.yy611), + *(yymsp[-7].minor.yy319), + *(yymsp[-6].minor.yy319), + *(yymsp[-2].minor.yy319), + *(yymsp[-5].minor.yy532), + yymsp[-4].minor.yy151, + *(yymsp[-1].minor.yy83), + yymsp[0].minor.yy512, CL, 3 ); - delete yymsp[-8].minor.yy451; - delete yymsp[-10].minor.yy146; - delete yymsp[-5].minor.yy132; - delete yymsp[-1].minor.yy3; - delete yymsp[-7].minor.yy399; - delete yymsp[-2].minor.yy399; - delete yymsp[-6].minor.yy399; - objectForTokens = yygotominor.yy283; + delete yymsp[-8].minor.yy611; + delete yymsp[-10].minor.yy386; + delete yymsp[-5].minor.yy532; + delete yymsp[-1].minor.yy83; + delete yymsp[-7].minor.yy319; + delete yymsp[-2].minor.yy319; + delete yymsp[-6].minor.yy319; + objectForTokens = yygotominor.yy363; parserContext->minorErrorAfterLastToken("Syntax error"); } break; - case 362: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list */ -{ - yygotominor.yy283 = new SqliteCreateTrigger( - *(yymsp[-12].minor.yy146), - *(yymsp[-10].minor.yy451), - *(yymsp[-9].minor.yy399), - *(yymsp[-8].minor.yy399), - *(yymsp[-4].minor.yy399), - *(yymsp[-7].minor.yy132), - yymsp[-6].minor.yy552, - *(yymsp[-3].minor.yy3), - yymsp[-2].minor.yy352, - *(yymsp[0].minor.yy430), - 3 + case 370: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list */ +{ + yygotominor.yy363 = new SqliteCreateTrigger( + *(yymsp[-12].minor.yy386), + *(yymsp[-10].minor.yy611), + *(yymsp[-9].minor.yy319), + *(yymsp[-8].minor.yy319), + *(yymsp[-4].minor.yy319), + *(yymsp[-7].minor.yy532), + yymsp[-6].minor.yy151, + *(yymsp[-3].minor.yy83), + yymsp[-2].minor.yy512, + *(yymsp[0].minor.yy110), + 3 ); - delete yymsp[-10].minor.yy451; - delete yymsp[-12].minor.yy146; - delete yymsp[-7].minor.yy132; - delete yymsp[-3].minor.yy3; - delete yymsp[-9].minor.yy399; - delete yymsp[-4].minor.yy399; - delete yymsp[-8].minor.yy399; - delete yymsp[0].minor.yy430; - objectForTokens = yygotominor.yy283; + delete yymsp[-10].minor.yy611; + delete yymsp[-12].minor.yy386; + delete yymsp[-7].minor.yy532; + delete yymsp[-3].minor.yy83; + delete yymsp[-9].minor.yy319; + delete yymsp[-4].minor.yy319; + delete yymsp[-8].minor.yy319; + delete yymsp[0].minor.yy110; + objectForTokens = yygotominor.yy363; parserContext->minorErrorAfterLastToken("Syntax error"); } break; - case 363: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON ID_TAB */ -{ yy_destructor(yypParser,181,&yymsp[-8].minor); - yy_destructor(yypParser,179,&yymsp[-5].minor); - yy_destructor(yypParser,265,&yymsp[-3].minor); - yy_destructor(yypParser,266,&yymsp[-2].minor); + case 371: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON ID_TAB */ +{ yy_destructor(yypParser,201,&yymsp[-8].minor); + yy_destructor(yypParser,199,&yymsp[-5].minor); + yy_destructor(yypParser,292,&yymsp[-3].minor); + yy_destructor(yypParser,293,&yymsp[-2].minor); } break; - case 366: /* trigger_time ::= BEFORE */ -{yygotominor.yy132 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);} + case 374: /* trigger_time ::= BEFORE */ +{yygotominor.yy532 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);} break; - case 367: /* trigger_time ::= AFTER */ -{yygotominor.yy132 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);} + case 375: /* trigger_time ::= AFTER */ +{yygotominor.yy532 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);} break; - case 368: /* trigger_time ::= INSTEAD OF */ -{yygotominor.yy132 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);} + case 376: /* trigger_time ::= INSTEAD OF */ +{yygotominor.yy532 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);} break; - case 369: /* trigger_time ::= */ -{yygotominor.yy132 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);} + case 377: /* trigger_time ::= */ +{yygotominor.yy532 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);} break; - case 370: /* trigger_event ::= DELETE */ + case 378: /* trigger_event ::= DELETE */ { - yygotominor.yy552 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE); - objectForTokens = yygotominor.yy552; + yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE); + objectForTokens = yygotominor.yy151; } break; - case 371: /* trigger_event ::= INSERT */ + case 379: /* trigger_event ::= INSERT */ { - yygotominor.yy552 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::INSERT); - objectForTokens = yygotominor.yy552; + yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::INSERT); + objectForTokens = yygotominor.yy151; } break; - case 372: /* trigger_event ::= UPDATE */ + case 380: /* trigger_event ::= UPDATE */ { - yygotominor.yy552 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::UPDATE); - objectForTokens = yygotominor.yy552; + yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::UPDATE); + objectForTokens = yygotominor.yy151; } break; - case 373: /* trigger_event ::= UPDATE OF idlist */ + case 381: /* trigger_event ::= UPDATE OF idlist */ { - yygotominor.yy552 = new SqliteCreateTrigger::Event(*(yymsp[0].minor.yy95)); - delete yymsp[0].minor.yy95; - objectForTokens = yygotominor.yy552; + yygotominor.yy151 = new SqliteCreateTrigger::Event(*(yymsp[0].minor.yy575)); + delete yymsp[0].minor.yy575; + objectForTokens = yygotominor.yy151; } break; - case 374: /* foreach_clause ::= */ -{yygotominor.yy3 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);} + case 382: /* foreach_clause ::= */ +{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);} break; - case 375: /* foreach_clause ::= FOR EACH ROW */ -{yygotominor.yy3 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);} + case 383: /* foreach_clause ::= FOR EACH ROW */ +{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);} break; - case 378: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + case 386: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { - yymsp[-2].minor.yy430->append(yymsp[-1].minor.yy283); - yygotominor.yy430 = yymsp[-2].minor.yy430; + yymsp[-2].minor.yy110->append(yymsp[-1].minor.yy363); + yygotominor.yy110 = yymsp[-2].minor.yy110; DONT_INHERIT_TOKENS("trigger_cmd_list"); } break; - case 379: /* trigger_cmd_list ::= trigger_cmd SEMI */ + case 387: /* trigger_cmd_list ::= trigger_cmd SEMI */ { - yygotominor.yy430 = new ParserQueryList(); - yygotominor.yy430->append(yymsp[-1].minor.yy283); + yygotominor.yy110 = new ParserQueryList(); + yygotominor.yy110->append(yymsp[-1].minor.yy363); } break; - case 380: /* trigger_cmd_list ::= SEMI */ + case 388: /* trigger_cmd_list ::= SEMI */ { - yygotominor.yy430 = new ParserQueryList(); + yygotominor.yy110 = new ParserQueryList(); parserContext->minorErrorAfterLastToken("Syntax error"); } break; - case 385: /* raisetype ::= ROLLBACK|ABORT|FAIL */ + case 393: /* raisetype ::= ROLLBACK|ABORT|FAIL */ {yygotominor.yy0 = yymsp[0].minor.yy0;} break; - case 386: /* cmd ::= DROP TRIGGER ifexists fullname */ + case 394: /* cmd ::= DROP TRIGGER ifexists fullname */ { - yygotominor.yy283 = new SqliteDropTrigger(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy360->name1, yymsp[0].minor.yy360->name2); - delete yymsp[-1].minor.yy451; - delete yymsp[0].minor.yy360; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteDropTrigger(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy440->name1, yymsp[0].minor.yy440->name2); + delete yymsp[-1].minor.yy611; + delete yymsp[0].minor.yy440; + objectForTokens = yygotominor.yy363; } break; - case 389: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + case 397: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { - yygotominor.yy283 = new SqliteAttach(*(yymsp[-4].minor.yy451), yymsp[-3].minor.yy352, yymsp[-1].minor.yy352, yymsp[0].minor.yy352); - delete yymsp[-4].minor.yy451; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteAttach(*(yymsp[-4].minor.yy611), yymsp[-3].minor.yy512, yymsp[-1].minor.yy512, yymsp[0].minor.yy512); + delete yymsp[-4].minor.yy611; + objectForTokens = yygotominor.yy363; } break; - case 390: /* cmd ::= DETACH database_kw_opt expr */ + case 398: /* cmd ::= DETACH database_kw_opt expr */ { - yygotominor.yy283 = new SqliteDetach(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy352); - delete yymsp[-1].minor.yy451; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteDetach(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy512); + delete yymsp[-1].minor.yy611; + objectForTokens = yygotominor.yy363; } break; - case 395: /* cmd ::= REINDEX */ -{yygotominor.yy283 = new SqliteReindex();} + case 403: /* cmd ::= REINDEX */ +{yygotominor.yy363 = new SqliteReindex();} break; - case 396: /* cmd ::= REINDEX nm dbnm */ - case 397: /* cmd ::= REINDEX ID_COLLATE */ yytestcase(yyruleno==397); + case 404: /* cmd ::= REINDEX nm dbnm */ + case 405: /* cmd ::= REINDEX ID_COLLATE */ yytestcase(yyruleno==405); { - yygotominor.yy283 = new SqliteReindex(*(yymsp[-1].minor.yy399), *(yymsp[0].minor.yy399)); - delete yymsp[-1].minor.yy399; - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteReindex(*(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319)); + delete yymsp[-1].minor.yy319; + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy363; } break; - case 400: /* cmd ::= ANALYZE */ + case 408: /* cmd ::= ANALYZE */ { - yygotominor.yy283 = new SqliteAnalyze(); - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteAnalyze(); + objectForTokens = yygotominor.yy363; } break; - case 401: /* cmd ::= ANALYZE nm dbnm */ + case 409: /* cmd ::= ANALYZE nm dbnm */ { - yygotominor.yy283 = new SqliteAnalyze(*(yymsp[-1].minor.yy399), *(yymsp[0].minor.yy399)); - delete yymsp[-1].minor.yy399; - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy283; + yygotominor.yy363 = new SqliteAnalyze(*(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319)); + delete yymsp[-1].minor.yy319; + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy363; } break; - case 404: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ + case 412: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { - yygotominor.yy283 = new SqliteAlterTable( - yymsp[-3].minor.yy360->name1, - yymsp[-3].minor.yy360->name2, - *(yymsp[0].minor.yy399) + yygotominor.yy363 = new SqliteAlterTable( + yymsp[-3].minor.yy440->name1, + yymsp[-3].minor.yy440->name2, + *(yymsp[0].minor.yy319) ); - delete yymsp[0].minor.yy399; - delete yymsp[-3].minor.yy360; - objectForTokens = yygotominor.yy283; + delete yymsp[0].minor.yy319; + delete yymsp[-3].minor.yy440; + objectForTokens = yygotominor.yy363; } break; - case 405: /* cmd ::= ALTER TABLE fullname ADD kwcolumn_opt column */ + case 413: /* cmd ::= ALTER TABLE fullname ADD kwcolumn_opt column */ { - yygotominor.yy283 = new SqliteAlterTable( - yymsp[-3].minor.yy360->name1, - yymsp[-3].minor.yy360->name2, - *(yymsp[-1].minor.yy451), - yymsp[0].minor.yy227 + yygotominor.yy363 = new SqliteAlterTable( + yymsp[-3].minor.yy440->name1, + yymsp[-3].minor.yy440->name2, + *(yymsp[-1].minor.yy611), + yymsp[0].minor.yy147 ); - delete yymsp[-1].minor.yy451; - delete yymsp[-3].minor.yy360; - objectForTokens = yygotominor.yy283; + delete yymsp[-1].minor.yy611; + delete yymsp[-3].minor.yy440; + objectForTokens = yygotominor.yy363; } break; - case 406: /* cmd ::= ALTER TABLE fullname RENAME TO ID_TAB_NEW */ -{ yy_destructor(yypParser,183,&yymsp[-3].minor); + case 414: /* cmd ::= ALTER TABLE fullname RENAME TO ID_TAB_NEW */ +{ yy_destructor(yypParser,203,&yymsp[-3].minor); } break; - case 412: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + case 420: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { - yygotominor.yy283 = new SqliteCreateVirtualTable( - *(yymsp[-4].minor.yy451), - *(yymsp[-3].minor.yy399), - *(yymsp[-2].minor.yy399), - *(yymsp[0].minor.yy399) + yygotominor.yy363 = new SqliteCreateVirtualTable( + *(yymsp[-4].minor.yy611), + *(yymsp[-3].minor.yy319), + *(yymsp[-2].minor.yy319), + *(yymsp[0].minor.yy319) ); - delete yymsp[-4].minor.yy451; - delete yymsp[-3].minor.yy399; - delete yymsp[-2].minor.yy399; - delete yymsp[0].minor.yy399; - objectForTokens = yygotominor.yy283; + delete yymsp[-4].minor.yy611; + delete yymsp[-3].minor.yy319; + delete yymsp[-2].minor.yy319; + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy363; } break; - case 413: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm LP vtabarglist RP */ + case 421: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm LP vtabarglist RP */ { - yygotominor.yy283 = new SqliteCreateVirtualTable( - *(yymsp[-7].minor.yy451), - *(yymsp[-6].minor.yy399), - *(yymsp[-5].minor.yy399), - *(yymsp[-3].minor.yy399), - *(yymsp[-1].minor.yy95) + yygotominor.yy363 = new SqliteCreateVirtualTable( + *(yymsp[-7].minor.yy611), + *(yymsp[-6].minor.yy319), + *(yymsp[-5].minor.yy319), + *(yymsp[-3].minor.yy319), + *(yymsp[-1].minor.yy575) ); - delete yymsp[-6].minor.yy399; - delete yymsp[-5].minor.yy399; - delete yymsp[-3].minor.yy399; - delete yymsp[-7].minor.yy451; - delete yymsp[-1].minor.yy95; - objectForTokens = yygotominor.yy283; + delete yymsp[-6].minor.yy319; + delete yymsp[-5].minor.yy319; + delete yymsp[-3].minor.yy319; + delete yymsp[-7].minor.yy611; + delete yymsp[-1].minor.yy575; + objectForTokens = yygotominor.yy363; } break; - case 416: /* vtabarglist ::= vtabarg */ + case 424: /* vtabarglist ::= vtabarg */ { - yygotominor.yy95 = new QStringList(); - yygotominor.yy95->append((yymsp[0].minor.yy399)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg - delete yymsp[0].minor.yy399; + yygotominor.yy575 = new QStringList(); + yygotominor.yy575->append((yymsp[0].minor.yy319)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg + delete yymsp[0].minor.yy319; } break; - case 417: /* vtabarglist ::= vtabarglist COMMA vtabarg */ + case 425: /* vtabarglist ::= vtabarglist COMMA vtabarg */ { - yymsp[-2].minor.yy95->append((yymsp[0].minor.yy399)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg - yygotominor.yy95 = yymsp[-2].minor.yy95; - delete yymsp[0].minor.yy399; + yymsp[-2].minor.yy575->append((yymsp[0].minor.yy319)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg + yygotominor.yy575 = yymsp[-2].minor.yy575; + delete yymsp[0].minor.yy319; DONT_INHERIT_TOKENS("vtabarglist"); } break; - case 419: /* vtabarg ::= vtabarg vtabargtoken */ + case 427: /* vtabarg ::= vtabarg vtabargtoken */ { - yymsp[-1].minor.yy399->append(" "+ *(yymsp[0].minor.yy399)); - yygotominor.yy399 = yymsp[-1].minor.yy399; - delete yymsp[0].minor.yy399; + yymsp[-1].minor.yy319->append(" "+ *(yymsp[0].minor.yy319)); + yygotominor.yy319 = yymsp[-1].minor.yy319; + delete yymsp[0].minor.yy319; } break; - case 420: /* vtabargtoken ::= ANY */ + case 428: /* vtabargtoken ::= ANY */ { - yygotominor.yy399 = new QString(yymsp[0].minor.yy0->value); + yygotominor.yy319 = new QString(yymsp[0].minor.yy0->value); } break; - case 421: /* vtabargtoken ::= LP anylist RP */ + case 429: /* vtabargtoken ::= LP anylist RP */ { - yygotominor.yy399 = new QString("("); - yygotominor.yy399->append(*(yymsp[-1].minor.yy399)); - yygotominor.yy399->append(")"); - delete yymsp[-1].minor.yy399; + yygotominor.yy319 = new QString("("); + yygotominor.yy319->append(*(yymsp[-1].minor.yy319)); + yygotominor.yy319->append(")"); + delete yymsp[-1].minor.yy319; } break; - case 423: /* anylist ::= anylist LP anylist RP */ + case 431: /* anylist ::= anylist LP anylist RP */ { - yygotominor.yy399 = yymsp[-3].minor.yy399; - yygotominor.yy399->append("("); - yygotominor.yy399->append(*(yymsp[-1].minor.yy399)); - yygotominor.yy399->append(")"); - delete yymsp[-1].minor.yy399; + yygotominor.yy319 = yymsp[-3].minor.yy319; + yygotominor.yy319->append("("); + yygotominor.yy319->append(*(yymsp[-1].minor.yy319)); + yygotominor.yy319->append(")"); + delete yymsp[-1].minor.yy319; DONT_INHERIT_TOKENS("anylist"); } break; - case 424: /* anylist ::= anylist ANY */ + case 432: /* anylist ::= anylist ANY */ { - yygotominor.yy399 = yymsp[-1].minor.yy399; - yygotominor.yy399->append(yymsp[0].minor.yy0->value); + yygotominor.yy319 = yymsp[-1].minor.yy319; + yygotominor.yy319->append(yymsp[0].minor.yy0->value); DONT_INHERIT_TOKENS("anylist"); } break; - case 425: /* with ::= */ -{yygotominor.yy321 = nullptr;} + case 433: /* with ::= */ +{yygotominor.yy1 = nullptr;} break; - case 426: /* with ::= WITH wqlist */ + case 434: /* with ::= WITH wqlist */ { - yygotominor.yy321 = yymsp[0].minor.yy321; - objectForTokens = yygotominor.yy321; + yygotominor.yy1 = new SqliteWith(); + yygotominor.yy1->cteList = *(yymsp[0].minor.yy593); + delete yymsp[0].minor.yy593; + objectForTokens = yygotominor.yy1; } break; - case 427: /* with ::= WITH RECURSIVE wqlist */ + case 435: /* with ::= WITH RECURSIVE wqlist */ { - yygotominor.yy321 = yymsp[0].minor.yy321; - yygotominor.yy321->recursive = true; - objectForTokens = yygotominor.yy321; + yygotominor.yy1 = new SqliteWith(); + yygotominor.yy1->cteList = *(yymsp[0].minor.yy593); + yygotominor.yy1->recursive = true; + delete yymsp[0].minor.yy593; + objectForTokens = yygotominor.yy1; } break; - case 428: /* wqlist ::= nm idxlist_opt AS LP select RP */ + case 436: /* wqlist ::= wqcte */ { - yygotominor.yy321 = SqliteWith::append(*(yymsp[-5].minor.yy399), *(yymsp[-4].minor.yy223), yymsp[-1].minor.yy473); - delete yymsp[-5].minor.yy399; - delete yymsp[-4].minor.yy223; + yygotominor.yy593 = new ParserCteList(); + yygotominor.yy593->append(yymsp[0].minor.yy446); } break; - case 429: /* wqlist ::= wqlist COMMA nm idxlist_opt AS LP select RP */ + case 437: /* wqlist ::= wqlist COMMA wqcte */ { - yygotominor.yy321 = SqliteWith::append(yymsp[-7].minor.yy321, *(yymsp[-5].minor.yy399), *(yymsp[-4].minor.yy223), yymsp[-1].minor.yy473); - delete yymsp[-5].minor.yy399; - delete yymsp[-4].minor.yy223; + yygotominor.yy593 = yymsp[-2].minor.yy593; + yygotominor.yy593->append(yymsp[0].minor.yy446); DONT_INHERIT_TOKENS("wqlist"); } break; - case 430: /* wqlist ::= ID_TAB_NEW */ + case 438: /* wqlist ::= ID_TAB_NEW */ { parserContext->minorErrorBeforeNextToken("Syntax error"); - yygotominor.yy321 = new SqliteWith(); } break; + case 439: /* wqcte ::= nm idxlist_opt AS LP select RP */ +{ + yygotominor.yy446 = new SqliteWith::CommonTableExpression(*(yymsp[-5].minor.yy319), *(yymsp[-4].minor.yy223), yymsp[-1].minor.yy313); + delete yymsp[-5].minor.yy319; + delete yymsp[-4].minor.yy223; + objectForTokens = yygotominor.yy446; + } + break; + case 440: /* windowdefn_list ::= windowdefn */ +{ + yygotominor.yy299 = new ParserWindowDefList(); + yygotominor.yy299->append(yymsp[0].minor.yy266); + } + break; + case 441: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ +{ + yymsp[-2].minor.yy299->append(yymsp[0].minor.yy266); + yygotominor.yy299 = yymsp[-2].minor.yy299; + DONT_INHERIT_TOKENS("windowdefn_list"); + } + break; + case 442: /* windowdefn ::= nm AS LP window RP */ +{ + yygotominor.yy266 = new SqliteWindowDefinition(*(yymsp[-4].minor.yy319), yymsp[-1].minor.yy334); + delete yymsp[-4].minor.yy319; + objectForTokens = yygotominor.yy266; + } + break; + case 443: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +{ + yygotominor.yy334 = new SqliteWindowDefinition::Window(); + yygotominor.yy334->initPartitionBy(QString(), *(yymsp[-2].minor.yy71), *(yymsp[-1].minor.yy403), yymsp[0].minor.yy41); + delete yymsp[-2].minor.yy71; + delete yymsp[-1].minor.yy403; + objectForTokens = yygotominor.yy334; + } + break; + case 444: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +{ + yygotominor.yy334 = new SqliteWindowDefinition::Window(); + yygotominor.yy334->initPartitionBy(*(yymsp[-5].minor.yy319), *(yymsp[-2].minor.yy71), *(yymsp[-1].minor.yy403), yymsp[0].minor.yy41); + delete yymsp[-2].minor.yy71; + delete yymsp[-5].minor.yy319; + delete yymsp[-1].minor.yy403; + objectForTokens = yygotominor.yy334; + } + break; + case 445: /* window ::= ORDER BY sortlist frame_opt */ +{ + yygotominor.yy334 = new SqliteWindowDefinition::Window(); + yygotominor.yy334->initOrderBy(QString(), *(yymsp[-1].minor.yy403), yymsp[0].minor.yy41); + delete yymsp[-1].minor.yy403; + objectForTokens = yygotominor.yy334; + } + break; + case 446: /* window ::= nm ORDER BY sortlist frame_opt */ +{ + yygotominor.yy334 = new SqliteWindowDefinition::Window(); + yygotominor.yy334->initOrderBy(*(yymsp[-4].minor.yy319), *(yymsp[-1].minor.yy403), yymsp[0].minor.yy41); + delete yymsp[-1].minor.yy403; + delete yymsp[-4].minor.yy319; + objectForTokens = yygotominor.yy334; + } + break; + case 447: /* window ::= frame_opt */ +{ + yygotominor.yy334 = new SqliteWindowDefinition::Window(); + yygotominor.yy334->init(QString(), yymsp[0].minor.yy41); + objectForTokens = yygotominor.yy334; + } + break; + case 448: /* window ::= nm frame_opt */ +{ + yygotominor.yy334 = new SqliteWindowDefinition::Window(); + yygotominor.yy334->init(QString(), yymsp[0].minor.yy41); + delete yymsp[-1].minor.yy319; + objectForTokens = yygotominor.yy334; + } + break; + case 449: /* frame_opt ::= */ +{yygotominor.yy41 = nullptr;} + break; + case 450: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +{ + yygotominor.yy41 = new SqliteWindowDefinition::Window::Frame(*(yymsp[-2].minor.yy419), yymsp[-1].minor.yy442, nullptr, *(yymsp[0].minor.yy63)); + delete yymsp[-2].minor.yy419; + delete yymsp[0].minor.yy63; + objectForTokens = yygotominor.yy41; + } + break; + case 451: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +{ + yygotominor.yy41 = new SqliteWindowDefinition::Window::Frame(*(yymsp[-5].minor.yy419), yymsp[-3].minor.yy442, yymsp[-1].minor.yy442, *(yymsp[0].minor.yy63)); + delete yymsp[-5].minor.yy419; + delete yymsp[0].minor.yy63; + objectForTokens = yygotominor.yy41; + } + break; + case 452: /* range_or_rows ::= RANGE|ROWS|GROUPS */ +{ + yygotominor.yy419 = new SqliteWindowDefinition::Window::Frame::RangeOrRows( + SqliteWindowDefinition::Window::Frame::toRangeOrRows(yymsp[0].minor.yy0->value) + ); + } + break; + case 453: /* frame_bound_s ::= frame_bound */ + case 455: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==455); +{ + yygotominor.yy442 = yymsp[0].minor.yy442; + objectForTokens = yygotominor.yy442; + } + break; + case 454: /* frame_bound_s ::= UNBOUNDED PRECEDING */ + case 456: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==456); + case 458: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==458); +{ + yygotominor.yy442 = new SqliteWindowDefinition::Window::Frame::Bound(nullptr, yymsp[-1].minor.yy0->value + " " + yymsp[0].minor.yy0->value); + objectForTokens = yygotominor.yy442; + } + break; + case 457: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +{ + yygotominor.yy442 = new SqliteWindowDefinition::Window::Frame::Bound(yymsp[-1].minor.yy512, yymsp[0].minor.yy0->value); + objectForTokens = yygotominor.yy442; + } + break; + case 459: /* frame_exclude_opt ::= */ +{ + yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::null + ); + } + break; + case 460: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +{ + yygotominor.yy63 = yymsp[0].minor.yy63; + } + break; + case 461: /* frame_exclude ::= NO OTHERS */ +{ + yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::NO_OTHERS + ); + } + break; + case 462: /* frame_exclude ::= CURRENT ROW */ +{ + yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::CURRENT_ROW + ); + } + break; + case 463: /* frame_exclude ::= GROUP */ +{ + yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::GROUP + ); + } + break; + case 464: /* frame_exclude ::= TIES */ +{ + yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::TIES + ); + } + break; + case 465: /* window_clause ::= WINDOW windowdefn_list */ +{ + yygotominor.yy299 = yymsp[0].minor.yy299; + } + break; + case 466: /* filter_over ::= filter_clause over_clause */ +{ + yygotominor.yy247 = new SqliteFilterOver(yymsp[-1].minor.yy397, yymsp[0].minor.yy248); + objectForTokens = yygotominor.yy247; + } + break; + case 467: /* filter_over ::= over_clause */ +{ + yygotominor.yy247 = new SqliteFilterOver(nullptr, yymsp[0].minor.yy248); + objectForTokens = yygotominor.yy247; + } + break; + case 468: /* filter_over ::= filter_clause */ +{ + yygotominor.yy247 = new SqliteFilterOver(yymsp[0].minor.yy397, nullptr); + objectForTokens = yygotominor.yy247; + } + break; + case 469: /* over_clause ::= OVER LP window RP */ +{ + yygotominor.yy248 = new SqliteFilterOver::Over(yymsp[-1].minor.yy334); + objectForTokens = yygotominor.yy248; + } + break; + case 470: /* over_clause ::= OVER nm */ +{ + yygotominor.yy248 = new SqliteFilterOver::Over(*(yymsp[0].minor.yy319)); + delete yymsp[0].minor.yy319; + objectForTokens = yygotominor.yy248; + } + break; + case 471: /* filter_clause ::= FILTER LP WHERE expr RP */ +{ + yygotominor.yy397 = new SqliteFilterOver::Filter(yymsp[-1].minor.yy512); + objectForTokens = yygotominor.yy397; + } + break; default: /* (0) input ::= cmdlist */ yytestcase(yyruleno==0); break; @@ -5390,4 +5988,4 @@ void sqlite3_parse( } }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); return; -} +}
\ No newline at end of file diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h index 050ebd3..200b09c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h @@ -5,165 +5,185 @@ #define TK3_ABORT 5 #define TK3_ACTION 6 #define TK3_AFTER 7 -#define TK3_ANALYZE 8 -#define TK3_ASC 9 -#define TK3_ATTACH 10 -#define TK3_BEFORE 11 -#define TK3_BEGIN 12 -#define TK3_BY 13 -#define TK3_CASCADE 14 -#define TK3_CAST 15 -#define TK3_COLUMNKW 16 -#define TK3_CONFLICT 17 -#define TK3_DATABASE 18 -#define TK3_DEFERRED 19 -#define TK3_DESC 20 -#define TK3_DETACH 21 -#define TK3_EACH 22 -#define TK3_END 23 -#define TK3_EXCLUSIVE 24 -#define TK3_EXPLAIN 25 -#define TK3_FAIL 26 -#define TK3_FOR 27 -#define TK3_IGNORE 28 -#define TK3_IMMEDIATE 29 -#define TK3_INDEXED 30 -#define TK3_INITIALLY 31 -#define TK3_INSTEAD 32 -#define TK3_LIKE_KW 33 -#define TK3_MATCH 34 -#define TK3_NO 35 -#define TK3_PLAN 36 -#define TK3_QUERY 37 -#define TK3_KEY 38 -#define TK3_OF 39 -#define TK3_OFFSET 40 -#define TK3_PRAGMA 41 -#define TK3_RAISE 42 -#define TK3_RECURSIVE 43 -#define TK3_RELEASE 44 -#define TK3_REPLACE 45 -#define TK3_RESTRICT 46 -#define TK3_ROW 47 -#define TK3_ROLLBACK 48 -#define TK3_SAVEPOINT 49 -#define TK3_TEMP 50 -#define TK3_TRIGGER 51 -#define TK3_VACUUM 52 -#define TK3_VIEW 53 -#define TK3_VIRTUAL 54 -#define TK3_WITH 55 -#define TK3_WITHOUT 56 -#define TK3_REINDEX 57 -#define TK3_RENAME 58 -#define TK3_CTIME_KW 59 -#define TK3_IF 60 -#define TK3_ANY 61 -#define TK3_OR 62 -#define TK3_AND 63 -#define TK3_NOT 64 -#define TK3_IS 65 -#define TK3_BETWEEN 66 -#define TK3_IN 67 -#define TK3_ISNULL 68 -#define TK3_NOTNULL 69 -#define TK3_NE 70 -#define TK3_EQ 71 -#define TK3_GT 72 -#define TK3_LE 73 -#define TK3_LT 74 -#define TK3_GE 75 -#define TK3_ESCAPE 76 -#define TK3_BITAND 77 -#define TK3_BITOR 78 -#define TK3_LSHIFT 79 -#define TK3_RSHIFT 80 -#define TK3_PLUS 81 -#define TK3_MINUS 82 -#define TK3_STAR 83 -#define TK3_SLASH 84 -#define TK3_REM 85 -#define TK3_CONCAT 86 -#define TK3_COLLATE 87 -#define TK3_BITNOT 88 -#define TK3_SEMI 89 -#define TK3_TRANSACTION 90 -#define TK3_ID_TRANS 91 -#define TK3_COMMIT 92 -#define TK3_TO 93 -#define TK3_CREATE 94 -#define TK3_TABLE 95 -#define TK3_LP 96 -#define TK3_RP 97 -#define TK3_AS 98 -#define TK3_DOT 99 -#define TK3_ID_TAB_NEW 100 -#define TK3_ID_DB 101 -#define TK3_CTX_ROWID_KW 102 -#define TK3_EXISTS 103 -#define TK3_COMMA 104 -#define TK3_ID_COL_NEW 105 -#define TK3_STRING 106 -#define TK3_JOIN_KW 107 -#define TK3_ID_COL_TYPE 108 -#define TK3_CONSTRAINT 109 -#define TK3_DEFAULT 110 -#define TK3_NULL 111 -#define TK3_PRIMARY 112 -#define TK3_UNIQUE 113 -#define TK3_CHECK 114 -#define TK3_REFERENCES 115 -#define TK3_ID_CONSTR 116 -#define TK3_ID_COLLATE 117 -#define TK3_ID_TAB 118 -#define TK3_INTEGER 119 -#define TK3_FLOAT 120 -#define TK3_BLOB 121 -#define TK3_AUTOINCR 122 -#define TK3_ON 123 -#define TK3_INSERT 124 -#define TK3_DELETE 125 -#define TK3_UPDATE 126 -#define TK3_ID_FK_MATCH 127 -#define TK3_SET 128 -#define TK3_DEFERRABLE 129 -#define TK3_FOREIGN 130 -#define TK3_DROP 131 -#define TK3_ID_VIEW_NEW 132 -#define TK3_ID_VIEW 133 -#define TK3_SELECT 134 -#define TK3_VALUES 135 -#define TK3_UNION 136 -#define TK3_ALL 137 -#define TK3_EXCEPT 138 -#define TK3_INTERSECT 139 -#define TK3_DISTINCT 140 -#define TK3_ID_ALIAS 141 -#define TK3_FROM 142 -#define TK3_USING 143 -#define TK3_JOIN 144 -#define TK3_ID_JOIN_OPTS 145 -#define TK3_ID_IDX 146 -#define TK3_ORDER 147 -#define TK3_GROUP 148 -#define TK3_HAVING 149 -#define TK3_LIMIT 150 -#define TK3_WHERE 151 -#define TK3_ID_COL 152 -#define TK3_INTO 153 -#define TK3_DO 154 -#define TK3_NOTHING 155 -#define TK3_CASE 156 -#define TK3_ID_FN 157 -#define TK3_ID_ERR_MSG 158 -#define TK3_VARIABLE 159 -#define TK3_WHEN 160 -#define TK3_THEN 161 -#define TK3_ELSE 162 -#define TK3_INDEX 163 -#define TK3_ID_IDX_NEW 164 -#define TK3_ID_PRAGMA 165 -#define TK3_ID_TRIG_NEW 166 -#define TK3_ID_TRIG 167 -#define TK3_ALTER 168 -#define TK3_ADD 169 +#define TK3_ALWAYS 8 +#define TK3_ANALYZE 9 +#define TK3_ASC 10 +#define TK3_ATTACH 11 +#define TK3_BEFORE 12 +#define TK3_BEGIN 13 +#define TK3_BY 14 +#define TK3_CASCADE 15 +#define TK3_CAST 16 +#define TK3_COLUMNKW 17 +#define TK3_CONFLICT 18 +#define TK3_CURRENT 19 +#define TK3_DATABASE 20 +#define TK3_DEFERRED 21 +#define TK3_DESC 22 +#define TK3_DETACH 23 +#define TK3_DO 24 +#define TK3_EACH 25 +#define TK3_END 26 +#define TK3_EXCLUDE 27 +#define TK3_EXCLUSIVE 28 +#define TK3_EXPLAIN 29 +#define TK3_FAIL 30 +#define TK3_FIRST 31 +#define TK3_FOLLOWING 32 +#define TK3_FOR 33 +#define TK3_GENERATED 34 +#define TK3_GROUPS 35 +#define TK3_IGNORE 36 +#define TK3_IMMEDIATE 37 +#define TK3_INDEXED 38 +#define TK3_INITIALLY 39 +#define TK3_INSTEAD 40 +#define TK3_LAST 41 +#define TK3_LIKE_KW 42 +#define TK3_MATCH 43 +#define TK3_NO 44 +#define TK3_NULLS 45 +#define TK3_OTHERS 46 +#define TK3_PLAN 47 +#define TK3_QUERY 48 +#define TK3_KEY 49 +#define TK3_OF 50 +#define TK3_OFFSET 51 +#define TK3_PARTITION 52 +#define TK3_PRAGMA 53 +#define TK3_PRECEDING 54 +#define TK3_RAISE 55 +#define TK3_RANGE 56 +#define TK3_RECURSIVE 57 +#define TK3_RELEASE 58 +#define TK3_REPLACE 59 +#define TK3_RESTRICT 60 +#define TK3_ROW 61 +#define TK3_ROWS 62 +#define TK3_ROLLBACK 63 +#define TK3_SAVEPOINT 64 +#define TK3_TEMP 65 +#define TK3_TIES 66 +#define TK3_TRIGGER 67 +#define TK3_UNBOUNDED 68 +#define TK3_VACUUM 69 +#define TK3_VIEW 70 +#define TK3_VIRTUAL 71 +#define TK3_WITH 72 +#define TK3_WITHOUT 73 +#define TK3_REINDEX 74 +#define TK3_RENAME 75 +#define TK3_CTIME_KW 76 +#define TK3_IF 77 +#define TK3_ANY 78 +#define TK3_OR 79 +#define TK3_AND 80 +#define TK3_NOT 81 +#define TK3_IS 82 +#define TK3_BETWEEN 83 +#define TK3_IN 84 +#define TK3_ISNULL 85 +#define TK3_NOTNULL 86 +#define TK3_NE 87 +#define TK3_EQ 88 +#define TK3_GT 89 +#define TK3_LE 90 +#define TK3_LT 91 +#define TK3_GE 92 +#define TK3_ESCAPE 93 +#define TK3_BITAND 94 +#define TK3_BITOR 95 +#define TK3_LSHIFT 96 +#define TK3_RSHIFT 97 +#define TK3_PLUS 98 +#define TK3_MINUS 99 +#define TK3_STAR 100 +#define TK3_SLASH 101 +#define TK3_REM 102 +#define TK3_CONCAT 103 +#define TK3_COLLATE 104 +#define TK3_BITNOT 105 +#define TK3_SEMI 106 +#define TK3_TRANSACTION 107 +#define TK3_ID_TRANS 108 +#define TK3_COMMIT 109 +#define TK3_TO 110 +#define TK3_CREATE 111 +#define TK3_TABLE 112 +#define TK3_LP 113 +#define TK3_RP 114 +#define TK3_AS 115 +#define TK3_DOT 116 +#define TK3_ID_TAB_NEW 117 +#define TK3_ID_DB 118 +#define TK3_CTX_ROWID_KW 119 +#define TK3_EXISTS 120 +#define TK3_COMMA 121 +#define TK3_ID_COL_NEW 122 +#define TK3_STRING 123 +#define TK3_JOIN_KW 124 +#define TK3_ID_COL_TYPE 125 +#define TK3_RIGHT_ASSOC 126 +#define TK3_CONSTRAINT 127 +#define TK3_DEFAULT 128 +#define TK3_NULL 129 +#define TK3_PRIMARY 130 +#define TK3_UNIQUE 131 +#define TK3_CHECK 132 +#define TK3_REFERENCES 133 +#define TK3_ID_CONSTR 134 +#define TK3_ID_COLLATE 135 +#define TK3_ID_TAB 136 +#define TK3_INTEGER 137 +#define TK3_FLOAT 138 +#define TK3_BLOB 139 +#define TK3_AUTOINCR 140 +#define TK3_ON 141 +#define TK3_INSERT 142 +#define TK3_DELETE 143 +#define TK3_UPDATE 144 +#define TK3_ID_FK_MATCH 145 +#define TK3_SET 146 +#define TK3_DEFERRABLE 147 +#define TK3_FOREIGN 148 +#define TK3_DROP 149 +#define TK3_ID_VIEW_NEW 150 +#define TK3_ID_VIEW 151 +#define TK3_SELECT 152 +#define TK3_VALUES 153 +#define TK3_UNION 154 +#define TK3_ALL 155 +#define TK3_EXCEPT 156 +#define TK3_INTERSECT 157 +#define TK3_DISTINCT 158 +#define TK3_ID_ALIAS 159 +#define TK3_FROM 160 +#define TK3_USING 161 +#define TK3_JOIN 162 +#define TK3_ID_JOIN_OPTS 163 +#define TK3_ID_IDX 164 +#define TK3_ORDER 165 +#define TK3_GROUP 166 +#define TK3_HAVING 167 +#define TK3_LIMIT 168 +#define TK3_WHERE 169 +#define TK3_ID_COL 170 +#define TK3_INTO 171 +#define TK3_NOTHING 172 +#define TK3_ID_FN 173 +#define TK3_ID_ERR_MSG 174 +#define TK3_VARIABLE 175 +#define TK3_CASE 176 +#define TK3_WHEN 177 +#define TK3_THEN 178 +#define TK3_ELSE 179 +#define TK3_INDEX 180 +#define TK3_ID_IDX_NEW 181 +#define TK3_ID_PRAGMA 182 +#define TK3_ID_TRIG_NEW 183 +#define TK3_ID_TRIG 184 +#define TK3_ALTER 185 +#define TK3_ADD 186 +#define TK3_WINDOW 187 +#define TK3_OVER 188 +#define TK3_FILTER 189 diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y index 7e29506..1510c49 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y +++ b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y @@ -12,7 +12,6 @@ } %stack_overflow { - UNUSED_PARAMETER(yypMinor); parserContext->error(QObject::tr("Parser stack overflow")); } @@ -21,6 +20,8 @@ #include "parsercontext.h" #include "parser_helper_stubs.h" #include "common/utils_sql.h" +#include "common/global.h" +#include "common/unused.h" #include "parser/ast/sqlitealtertable.h" #include "parser/ast/sqliteanalyze.h" #include "parser/ast/sqliteattach.h" @@ -56,6 +57,9 @@ #include "parser/ast/sqliteforeignkey.h" #include "parser/ast/sqlitewith.h" #include "parser/ast/sqliteupsert.h" +#include "parser/ast/sqlitewindowdefinition.h" +#include "parser/ast/sqlitefilterover.h" +#include "parser/ast/sqlitenulls.h" #include <QObject> #include <QDebug> #include <limits.h> @@ -78,15 +82,15 @@ // are allowed for fallback if compound selects are disabled, // which is not this case. %fallback ID - ABORT ACTION AFTER ANALYZE ASC ATTACH BEFORE BEGIN BY CASCADE CAST COLUMNKW - CONFLICT DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR - IGNORE IMMEDIATE INDEXED INITIALLY INSTEAD LIKE_KW MATCH NO PLAN - QUERY KEY OF OFFSET PRAGMA RAISE RECURSIVE RELEASE REPLACE RESTRICT ROW ROLLBACK - SAVEPOINT TEMP TRIGGER VACUUM VIEW VIRTUAL WITH WITHOUT + ABORT ACTION AFTER ALWAYS ANALYZE ASC ATTACH BEFORE BEGIN BY CASCADE CAST COLUMNKW + CONFLICT CURRENT DATABASE DEFERRED DESC DETACH DO EACH END EXCLUDE EXCLUSIVE EXPLAIN FAIL FIRST FOLLOWING FOR + GENERATED GROUPS IGNORE IMMEDIATE INDEXED INITIALLY INSTEAD LAST LIKE_KW MATCH NO NULLS OTHERS PLAN + QUERY KEY OF OFFSET PARTITION PRAGMA PRECEDING RAISE RANGE RECURSIVE RELEASE REPLACE RESTRICT ROW ROWS ROLLBACK + SAVEPOINT TEMP TIES TRIGGER UNBOUNDED VACUUM VIEW VIRTUAL WITH WITHOUT REINDEX RENAME CTIME_KW IF . %wildcard ANY. - + // Define operator precedence early so that this is the first occurance // of the operator tokens in the grammer. Keeping the operators together // causes them to be assigned integer values that are close together, @@ -112,7 +116,7 @@ // Input is a single SQL command %type cmd {SqliteQuery*} -%destructor cmd {delete $$;} +%destructor cmd {parser_safe_delete($$);} input ::= cmdlist. @@ -120,7 +124,7 @@ cmdlist ::= cmdlist ecmd(C). {parserContext->addQuery(C); DONT_IN cmdlist ::= ecmd(C). {parserContext->addQuery(C);} %type ecmd {SqliteQuery*} -%destructor ecmd {delete $$;} +%destructor ecmd {parser_safe_delete($$);} ecmd(X) ::= SEMI. {X = new SqliteEmptyQuery();} ecmd(X) ::= explain(E) cmdx(C) SEMI. { X = C; @@ -131,13 +135,13 @@ ecmd(X) ::= explain(E) cmdx(C) SEMI. { } %type explain {ParserStubExplain*} -%destructor explain {delete $$;} +%destructor explain {parser_safe_delete($$);} explain(X) ::= . {X = new ParserStubExplain(false, false);} explain(X) ::= EXPLAIN. {X = new ParserStubExplain(true, false);} explain(X) ::= EXPLAIN QUERY PLAN. {X = new ParserStubExplain(true, true);} %type cmdx {SqliteQuery*} -%destructor cmdx {delete $$;} +%destructor cmdx {parser_safe_delete($$);} cmdx(X) ::= cmd(C). {X = C;} ///////////////////// Begin and end transaction. //////////////////////////// @@ -155,7 +159,7 @@ cmd(X) ::= BEGIN transtype(TT) } %type trans_opt {ParserStubTransDetails*} -%destructor trans_opt {delete $$;} +%destructor trans_opt {parser_safe_delete($$);} trans_opt(X) ::= . {X = new ParserStubTransDetails();} trans_opt(X) ::= TRANSACTION. { X = new ParserStubTransDetails(); @@ -170,7 +174,7 @@ trans_opt(X) ::= TRANSACTION nm(N). { trans_opt ::= TRANSACTION ID_TRANS. {} %type transtype {ParserStubTransDetails*} -%destructor transtype {delete $$;} +%destructor transtype {parser_safe_delete($$);} transtype(X) ::= . {X = new ParserStubTransDetails();} transtype(X) ::= DEFERRED. { X = new ParserStubTransDetails(); @@ -212,7 +216,7 @@ cmd(X) ::= ROLLBACK trans_opt(T). { } %type savepoint_opt {bool*} -%destructor savepoint_opt {delete $$;} +%destructor savepoint_opt {parser_safe_delete($$);} savepoint_opt(X) ::= SAVEPOINT. {X = new bool(true);} savepoint_opt(X) ::= . {X = new bool(false);} @@ -287,7 +291,7 @@ cmd ::= CREATE temp TABLE ifnotexists ID_DB|ID_TAB_NEW. {} %type table_options {QString*} -%destructor table_options {delete $$;} +%destructor table_options {parser_safe_delete($$);} table_options(X) ::= . {X = new QString();} table_options(X) ::= WITHOUT nm(N). { if (N->toLower() != "rowid") @@ -298,17 +302,17 @@ table_options(X) ::= WITHOUT nm(N). { table_options ::= WITHOUT CTX_ROWID_KW. {} %type ifnotexists {bool*} -%destructor ifnotexists {delete $$;} +%destructor ifnotexists {parser_safe_delete($$);} ifnotexists(X) ::= . {X = new bool(false);} ifnotexists(X) ::= IF NOT EXISTS. {X = new bool(true);} %type temp {int*} -%destructor temp {delete $$;} +%destructor temp {parser_safe_delete($$);} temp(X) ::= TEMP(T). {X = new int( (T->value.length() > 4) ? 2 : 1 );} temp(X) ::= . {X = new int(0);} %type columnlist {ParserCreateTableColumnList*} -%destructor columnlist {delete $$;} +%destructor columnlist {parser_safe_delete($$);} columnlist(X) ::= columnlist(L) COMMA column(C). { L->append(C); @@ -326,7 +330,7 @@ columnlist(X) ::= column(C). { // NOT NULL and so forth. %type column {SqliteCreateTable::Column*} -%destructor column {delete $$;} +%destructor column {parser_safe_delete($$);} column(X) ::= columnid(C) type(T) carglist(L). { X = new SqliteCreateTable::Column(*(C), T, *(L)); @@ -336,7 +340,7 @@ column(X) ::= columnid(C) type(T) } %type columnid {QString*} -%destructor columnid {delete $$;} +%destructor columnid {parser_safe_delete($$);} columnid(X) ::= nm(N). {X = N;} columnid ::= ID_COL_NEW. {} @@ -344,16 +348,24 @@ columnid ::= ID_COL_NEW. {} // An IDENTIFIER can be a generic identifier, or one of several // keywords. Any non-standard keyword can also be an identifier. %type id {QString*} -%destructor id {delete $$;} -id(X) ::= ID(T). { +%destructor id {parser_safe_delete($$);} +id(X) ::= ID(T). { X = new QString( stripObjName( - T->value, - parserContext->dialect + T->value ) ); } +%type id_opt {QString*} +%destructor id_opt {parser_safe_delete($$);} +id_opt(X) ::= id(T). { + X = T; + } +id_opt(X) ::= . { + X = new QString(); + } + // Why would INDEXED be defined individually like this? I don't know. // It was like this in the original SQLite grammar, but it doesn't // make any sense, since we have a fallback mechanism for such things. @@ -363,12 +375,12 @@ id(X) ::= ID(T). { // And "ids" is an identifer-or-string. %type ids {QString*} -%destructor ids {delete $$;} +%destructor ids {parser_safe_delete($$);} ids(X) ::= ID|STRING(T). {X = new QString(T->value);} // The name of a column or table can be any of the following: %type nm {QString*} -%destructor nm {delete $$;} +%destructor nm {parser_safe_delete($$);} nm(X) ::= id(N). {X = N;} nm(X) ::= STRING(N). {X = new QString(stripString(N->value));} nm(X) ::= JOIN_KW(N). {X = new QString(N->value);} @@ -377,12 +389,12 @@ nm(X) ::= JOIN_KW(N). {X = new QString(N->value);} // as can be found after the column name in a CREATE TABLE statement. // Multiple tokens are concatenated to form the value of the typetoken. %type type {SqliteColumnType*} -%destructor type {delete $$;} +%destructor type {parser_safe_delete($$);} type(X) ::= . {X = nullptr;} type(X) ::= typetoken(T). {X = T;} %type typetoken {SqliteColumnType*} -%destructor typetoken {delete $$;} +%destructor typetoken {parser_safe_delete($$);} typetoken(X) ::= typename(N). { X = new SqliteColumnType(*(N)); delete N; @@ -405,7 +417,7 @@ typetoken(X) ::= typename(N) LP signed(P) } %type typename {QString*} -%destructor typename {delete $$;} +%destructor typename {parser_safe_delete($$);} typename(X) ::= ids(I). {X = I;} typename(X) ::= typename(T) ids(I). { T->append(" " + *(I)); @@ -415,23 +427,24 @@ typename(X) ::= typename(T) ids(I). { typename ::= ID_COL_TYPE. {} %type signed {QVariant*} -%destructor signed {delete $$;} +%destructor signed {parser_safe_delete($$);} signed(X) ::= plus_num(N). {X = N;} signed(X) ::= minus_num(N). {X = N;} // "carglist" is a list of additional constraints that come after the // column name and column type in a CREATE TABLE statement. %type carglist {ParserCreateTableColumnConstraintList*} -%destructor carglist {delete $$;} -carglist(X) ::= carglist(L) ccons(C). { +%destructor carglist {parser_safe_delete($$);} +carglist(X) ::= carglist(L) ccons(C). + [RIGHT_ASSOC] { L->append(C); X = L; DONT_INHERIT_TOKENS("carglist"); } -carglist(X) ::= . {X = new ParserCreateTableColumnConstraintList();} +carglist(X) ::= . [RIGHT_ASSOC] {X = new ParserCreateTableColumnConstraintList();} %type ccons {SqliteCreateTable::Column::Constraint*} -%destructor ccons {delete $$;} +%destructor ccons {parser_safe_delete($$);} ccons(X) ::= CONSTRAINT nm(N). { X = new SqliteCreateTable::Column::Constraint(); X->initDefNameOnly(*(N)); @@ -528,6 +541,17 @@ ccons(X) ::= COLLATE ids(I). { delete I; objectForTokens = X; } +ccons(X) ::= gen_always(A) AS + LP expr(E) RP id_opt(T). { + if (!T->isNull() && T->toLower() != "stored" && T->toLower() != "virtual") + parserContext->errorAtToken(QString("Invalid generated column type: %1").arg(*(T))); + + X = new SqliteCreateTable::Column::Constraint(); + X->initGeneratedAs(E, *(A), *(T)); + delete A; + delete T; + objectForTokens = X; + } ccons ::= CONSTRAINT ID_CONSTR. {} ccons ::= COLLATE ID_COLLATE. {} @@ -540,15 +564,33 @@ ccons(X) ::= CHECK LP RP. { } %type term {QVariant*} -%destructor term {delete $$;} +%destructor term {parser_safe_delete($$);} term(X) ::= NULL. {X = new QVariant();} term(X) ::= INTEGER(N). {X = parserContext->handleNumberToken(N->value);} term(X) ::= FLOAT(N). {X = new QVariant(QVariant(N->value).toDouble());} -term(X) ::= STRING|BLOB(S). {X = new QVariant(S->value);} +term(X) ::= STRING|BLOB(S). {X = new QVariant(stripString(S->value));} + +// Term Literal or Name. String falls under Term, but can be falled back to Name if necessary in the context. +// On the other hand - if name is ID, it cannot be falled back to Term, as ID is never a Literal value. +%type tnm {ParserTermOrLiteral*} +%destructor tnm {parser_safe_delete($$);} +tnm(X) ::= term(T). { + X = new ParserTermOrLiteral(*(T)); + delete T; + } +tnm(X) ::= nm(N). { + X = new ParserTermOrLiteral(*(N)); + delete N; + } + +%type gen_always {bool*} +%destructor gen_always {parser_safe_delete($$);} +gen_always(X) ::= GENERATED ALWAYS. {X = new bool(true);} +gen_always(X) ::= . {X = new bool(false);} // The optional AUTOINCREMENT keyword %type autoinc {bool*} -%destructor autoinc {delete $$;} +%destructor autoinc {parser_safe_delete($$);} autoinc(X) ::= . {X = new bool(false);} autoinc(X) ::= AUTOINCR. {X = new bool(true);} @@ -557,7 +599,7 @@ autoinc(X) ::= AUTOINCR. {X = new bool(true);} // or immediate and which determine what action to take if a ref-integ // check fails. %type refargs {ParserFkConditionList*} -%destructor refargs {delete $$;} +%destructor refargs {parser_safe_delete($$);} refargs(X) ::= . {X = new ParserFkConditionList();} refargs(X) ::= refargs(L) refarg(A). { L->append(A); @@ -566,7 +608,7 @@ refargs(X) ::= refargs(L) refarg(A). { } %type refarg {SqliteForeignKey::Condition*} -%destructor refarg {delete $$;} +%destructor refarg {parser_safe_delete($$);} refarg(X) ::= MATCH nm(N). { X = new SqliteForeignKey::Condition(*(N)); delete N; @@ -577,7 +619,7 @@ refarg(X) ::= ON UPDATE refact(R). {X = new SqliteForeignKey::Condition refarg ::= MATCH ID_FK_MATCH. {} %type refact {SqliteForeignKey::Condition::Reaction*} -%destructor refact {delete $$;} +%destructor refact {parser_safe_delete($$);} refact(X) ::= SET NULL. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_NULL);} refact(X) ::= SET DEFAULT. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_DEFAULT);} refact(X) ::= CASCADE. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::CASCADE);} @@ -585,7 +627,7 @@ refact(X) ::= RESTRICT. {X = new SqliteForeignKey::Condition refact(X) ::= NO ACTION. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::NO_ACTION);} %type defer_subclause {ParserDeferSubClause*} -%destructor defer_subclause {delete $$;} +%destructor defer_subclause {parser_safe_delete($$);} defer_subclause(X) ::= NOT DEFERRABLE init_deferred_pred_opt(I). { X = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(I)); @@ -598,7 +640,7 @@ defer_subclause(X) ::= DEFERRABLE } %type init_deferred_pred_opt {SqliteInitially*} -%destructor init_deferred_pred_opt {delete $$;} +%destructor init_deferred_pred_opt {parser_safe_delete($$);} init_deferred_pred_opt(X) ::= . {X = new SqliteInitially(SqliteInitially::null);} init_deferred_pred_opt(X) ::= INITIALLY DEFERRED. {X = new SqliteInitially(SqliteInitially::DEFERRED);} @@ -606,12 +648,12 @@ init_deferred_pred_opt(X) ::= INITIALLY IMMEDIATE. {X = new SqliteInitially(SqliteInitially::IMMEDIATE);} %type conslist_opt {ParserCreateTableConstraintList*} -%destructor conslist_opt {delete $$;} +%destructor conslist_opt {parser_safe_delete($$);} conslist_opt(X) ::= . {X = new ParserCreateTableConstraintList();} conslist_opt(X) ::= COMMA conslist(L). {X = L;} %type conslist {ParserCreateTableConstraintList*} -%destructor conslist {delete $$;} +%destructor conslist {parser_safe_delete($$);} conslist(X) ::= conslist(L) tconscomma(CM) tcons(C). { C->afterComma = *(CM); @@ -626,12 +668,12 @@ conslist(X) ::= tcons(C). { } %type tconscomma {bool*} -%destructor tconscomma {delete $$;} +%destructor tconscomma {parser_safe_delete($$);} tconscomma(X) ::= COMMA. {X = new bool(true);} tconscomma(X) ::= . {X = new bool(false);} %type tcons {SqliteCreateTable::Constraint*} -%destructor tcons {delete $$;} +%destructor tcons {parser_safe_delete($$);} tcons(X) ::= CONSTRAINT nm(N). { X = new SqliteCreateTable::Constraint(); X->initNameOnly(*(N)); @@ -691,7 +733,7 @@ tcons(X) ::= CHECK LP RP onconf. { } %type defer_subclause_opt {ParserDeferSubClause*} -%destructor defer_subclause_opt {delete $$;} +%destructor defer_subclause_opt {parser_safe_delete($$);} defer_subclause_opt(X) ::= . {X = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);} defer_subclause_opt(X) ::= defer_subclause(D). {X = D;} @@ -700,17 +742,17 @@ defer_subclause_opt(X) ::= // default behavior when there is a constraint conflict. %type onconf {SqliteConflictAlgo*} -%destructor onconf {delete $$;} +%destructor onconf {parser_safe_delete($$);} onconf(X) ::= . {X = new SqliteConflictAlgo(SqliteConflictAlgo::null);} onconf(X) ::= ON CONFLICT resolvetype(R). {X = R;} %type orconf {SqliteConflictAlgo*} -%destructor orconf {delete $$;} +%destructor orconf {parser_safe_delete($$);} orconf(X) ::= . {X = new SqliteConflictAlgo(SqliteConflictAlgo::null);} orconf(X) ::= OR resolvetype(R). {X = R;} %type resolvetype {SqliteConflictAlgo*} -%destructor resolvetype {delete $$;} +%destructor resolvetype {parser_safe_delete($$);} resolvetype(X) ::= raisetype(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));} resolvetype(X) ::= IGNORE(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));} resolvetype(X) ::= REPLACE(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));} @@ -730,7 +772,7 @@ cmd ::= DROP TABLE ifexists nm DOT cmd ::= DROP TABLE ifexists ID_DB|ID_TAB. {} %type ifexists {bool*} -%destructor ifexists {delete $$;} +%destructor ifexists {parser_safe_delete($$);} ifexists(X) ::= IF EXISTS. {X = new bool(true);} ifexists(X) ::= . {X = new bool(false);} @@ -771,7 +813,7 @@ cmd(X) ::= select_stmt(S). { } %type select_stmt {SqliteQuery*} -%destructor select_stmt {delete $$;} +%destructor select_stmt {parser_safe_delete($$);} select_stmt(X) ::= select(S). { X = S; // since it's used in trigger: @@ -779,7 +821,7 @@ select_stmt(X) ::= select(S). { } %type select {SqliteSelect*} -%destructor select {delete $$;} +%destructor select {parser_safe_delete($$);} select(X) ::= with(W) selectnowith(S). { X = S; S->setWith(W); @@ -787,7 +829,7 @@ select(X) ::= with(W) selectnowith(S). { } %type selectnowith {SqliteSelect*} -%destructor selectnowith {delete $$;} +%destructor selectnowith {parser_safe_delete($$);} selectnowith(X) ::= oneselect(S). { X = SqliteSelect::append(S); objectForTokens = X; @@ -812,7 +854,7 @@ selectnowith(X) ::= selectnowith(S1) objectForTokens = X; } %type oneselect {SqliteSelect::Core*} -%destructor oneselect {delete $$;} +%destructor oneselect {parser_safe_delete($$);} oneselect(X) ::= SELECT distinct(D) selcollist(L) from(F) where_opt(W) groupby_opt(G) @@ -834,9 +876,34 @@ oneselect(X) ::= SELECT distinct(D) delete O; objectForTokens = X; } +oneselect(X) ::= SELECT distinct(D) + selcollist(L) from(F) + where_opt(W) groupby_opt(G) + having_opt(H) + window_clause(WF) + orderby_opt(O) + limit_opt(LI). { + X = new SqliteSelect::Core( + *(D), + *(L), + F, + W, + *(G), + H, + *(WF), + *(O), + LI + ); + delete L; + delete D; + delete G; + delete O; + delete WF; + objectForTokens = X; + } %type values {ParserExprNestedList*} -%destructor values {delete $$;} +%destructor values {parser_safe_delete($$);} values(X) ::= VALUES LP nexprlist(E) RP. { X = new ParserExprNestedList(); X->append(*(E)); @@ -851,31 +918,31 @@ values(X) ::= values(L) COMMA LP } %type multiselect_op {SqliteSelect::CompoundOperator*} -%destructor multiselect_op {delete $$;} +%destructor multiselect_op {parser_safe_delete($$);} multiselect_op(X) ::= UNION. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);} multiselect_op(X) ::= UNION ALL. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);} multiselect_op(X) ::= EXCEPT. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);} multiselect_op(X) ::= INTERSECT. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);} %type distinct {int*} -%destructor distinct {delete $$;} +%destructor distinct {parser_safe_delete($$);} distinct(X) ::= DISTINCT. {X = new int(1);} distinct(X) ::= ALL. {X = new int(2);} distinct(X) ::= . {X = new int(0);} %type sclp {ParserResultColumnList*} -%destructor sclp {delete $$;} +%destructor sclp {parser_safe_delete($$);} sclp(X) ::= selcollist(L) COMMA. {X = L;} sclp(X) ::= . {X = new ParserResultColumnList();} %type selcollist {ParserResultColumnList*} -%destructor selcollist {delete $$;} +%destructor selcollist {parser_safe_delete($$);} selcollist(X) ::= sclp(L) expr(E) as(N). { SqliteSelect::Core::ResultColumn* obj = new SqliteSelect::Core::ResultColumn( E, N ? N->asKw : false, - N ? N->name : QString::null + N ? N->name : QString() ); L->append(obj); @@ -893,12 +960,16 @@ selcollist(X) ::= sclp(L) STAR. { objectForTokens = obj; DONT_INHERIT_TOKENS("sclp"); } -selcollist(X) ::= sclp(L) nm(N) DOT STAR. { +selcollist(X) ::= sclp(L) tnm(N) DOT STAR. { SqliteSelect::Core::ResultColumn* obj = new SqliteSelect::Core::ResultColumn( true, - *(N) + N->toName() ); + + if (!N->isName()) + parserContext->errorAtToken("Syntax error <expected name, not literal value>", -3); + L->append(obj); X = L; delete N; @@ -915,7 +986,7 @@ selcollist ::= sclp ID_TAB DOT STAR. {} // define the result set, or one of the tables in the FROM clause. %type as {ParserStubAlias*} -%destructor as {delete $$;} +%destructor as {parser_safe_delete($$);} as(X) ::= AS nm(N). { X = new ParserStubAlias(*(N), true); delete N; @@ -931,12 +1002,12 @@ as(X) ::= . {X = nullptr;} // A complete FROM clause. %type from {SqliteSelect::Core::JoinSource*} -%destructor from {delete $$;} +%destructor from {parser_safe_delete($$);} from(X) ::= . {X = nullptr;} from(X) ::= FROM joinsrc(L). {X = L;} %type joinsrc {SqliteSelect::Core::JoinSource*} -%destructor joinsrc {delete $$;} +%destructor joinsrc {parser_safe_delete($$);} joinsrc(X) ::= singlesrc(S) seltablist(L). { X = new SqliteSelect::Core::JoinSource( S, @@ -952,7 +1023,7 @@ joinsrc(X) ::= . { } %type seltablist {ParserOtherSourceList*} -%destructor seltablist {delete $$;} +%destructor seltablist {parser_safe_delete($$);} seltablist(X) ::= seltablist(L) joinop(O) singlesrc(S) joinconstr_opt(C). { @@ -969,16 +1040,16 @@ seltablist(X) ::= . { } %type singlesrc {SqliteSelect::Core::SingleSource*} -%destructor singlesrc {delete $$;} +%destructor singlesrc {parser_safe_delete($$);} singlesrc(X) ::= nm(N1) dbnm(N2) as(A) indexed_opt(I). { X = new SqliteSelect::Core::SingleSource( *(N1), *(N2), A ? A->asKw : false, - A ? A->name : QString::null, + A ? A->name : QString(), I ? I->notIndexedKw : false, - I ? I->indexedBy : QString::null + I ? I->indexedBy : QString() ); delete N1; delete N2; @@ -991,7 +1062,7 @@ singlesrc(X) ::= LP select(S) RP as(A). { X = new SqliteSelect::Core::SingleSource( S, A ? A->asKw : false, - A ? A->name : QString::null + A ? A->name : QString() ); delete A; objectForTokens = X; @@ -1000,7 +1071,7 @@ singlesrc(X) ::= LP joinsrc(J) RP as(A). { X = new SqliteSelect::Core::SingleSource( J, A ? A->asKw : false, - A ? A->name : QString::null + A ? A->name : QString() ); delete A; objectForTokens = X; @@ -1011,7 +1082,7 @@ singlesrc(X) ::= nm(N1) dbnm(N2) *(N1), *(N2), A ? A->asKw : false, - A ? A->name : QString::null, + A ? A->name : QString(), *(E) ); delete N1; @@ -1041,7 +1112,7 @@ singlesrc ::= nm DOT ID_VIEW. {} singlesrc ::= ID_DB|ID_VIEW. {} %type joinconstr_opt {SqliteSelect::Core::JoinConstraint*} -%destructor joinconstr_opt {delete $$;} +%destructor joinconstr_opt {parser_safe_delete($$);} joinconstr_opt(X) ::= ON expr(E). { X = new SqliteSelect::Core::JoinConstraint(E); objectForTokens = X; @@ -1055,12 +1126,12 @@ joinconstr_opt(X) ::= USING LP joinconstr_opt(X) ::= . {X = nullptr;} %type dbnm {QString*} -%destructor dbnm {delete $$;} +%destructor dbnm {parser_safe_delete($$);} dbnm(X) ::= . {X = new QString();} dbnm(X) ::= DOT nm(N). {X = N;} %type fullname {ParserFullName*} -%destructor fullname {delete $$;} +%destructor fullname {parser_safe_delete($$);} fullname(X) ::= nm(N1) dbnm(N2). { X = new ParserFullName(); X->name1 = *(N1); @@ -1070,7 +1141,7 @@ fullname(X) ::= nm(N1) dbnm(N2). { } %type joinop {SqliteSelect::Core::JoinOp*} -%destructor joinop {delete $$;} +%destructor joinop {parser_safe_delete($$);} joinop(X) ::= COMMA. { X = new SqliteSelect::Core::JoinOp(true); objectForTokens = X; @@ -1092,7 +1163,6 @@ joinop(X) ::= JOIN_KW(K) nm(N1) nm(N2) JOIN. { X = new SqliteSelect::Core::JoinOp(K->value, *(N1), *(N2)); delete N1; - delete N1; objectForTokens = X; } @@ -1108,7 +1178,7 @@ joinop ::= ID_JOIN_OPTS. {} // normally illegal. The sqlite3SrcListIndexedBy() function // recognizes and interprets this as a special case. %type indexed_opt {ParserIndexedBy*} -%destructor indexed_opt {delete $$;} +%destructor indexed_opt {parser_safe_delete($$);} indexed_opt(X) ::= . {X = nullptr;} indexed_opt(X) ::= INDEXED BY nm(N). { X = new ParserIndexedBy(*(N)); @@ -1119,38 +1189,47 @@ indexed_opt(X) ::= NOT INDEXED. {X = new ParserIndexedBy(true);} indexed_opt ::= INDEXED BY ID_IDX. {} %type orderby_opt {ParserOrderByList*} -%destructor orderby_opt {delete $$;} +%destructor orderby_opt {parser_safe_delete($$);} orderby_opt(X) ::= . {X = new ParserOrderByList();} orderby_opt(X) ::= ORDER BY sortlist(L). {X = L;} // SQLite3 documentation says it's allowed for "COLLATE name" and expr itself handles this. %type sortlist {ParserOrderByList*} -%destructor sortlist {delete $$;} +%destructor sortlist {parser_safe_delete($$);} sortlist(X) ::= sortlist(L) COMMA expr(E) - sortorder(O). { - SqliteOrderBy* obj = new SqliteOrderBy(E, *(O)); + sortorder(O) nulls(N). { + SqliteOrderBy* obj = new SqliteOrderBy(E, *(O), *(N)); L->append(obj); X = L; delete O; + delete N; objectForTokens = obj; DONT_INHERIT_TOKENS("sortlist"); } -sortlist(X) ::= expr(E) sortorder(O). { - SqliteOrderBy* obj = new SqliteOrderBy(E, *(O)); +sortlist(X) ::= expr(E) sortorder(O) + nulls(N). { + SqliteOrderBy* obj = new SqliteOrderBy(E, *(O), *(N)); X = new ParserOrderByList(); X->append(obj); delete O; + delete N; objectForTokens = obj; } %type sortorder {SqliteSortOrder*} -%destructor sortorder {delete $$;} +%destructor sortorder {parser_safe_delete($$);} sortorder(X) ::= ASC. {X = new SqliteSortOrder(SqliteSortOrder::ASC);} sortorder(X) ::= DESC. {X = new SqliteSortOrder(SqliteSortOrder::DESC);} sortorder(X) ::= . {X = new SqliteSortOrder(SqliteSortOrder::null);} +%type nulls {SqliteNulls*} +%destructor nulls {parser_safe_delete($$);} +nulls(X) ::= NULLS FIRST. {X = new SqliteNulls(SqliteNulls::FIRST);} +nulls(X) ::= NULLS LAST. {X = new SqliteNulls(SqliteNulls::LAST);} +nulls(X) ::= . {X = new SqliteNulls(SqliteNulls::null);} + %type groupby_opt {ParserExprList*} -%destructor groupby_opt {delete $$;} +%destructor groupby_opt {parser_safe_delete($$);} groupby_opt(X) ::= . {X = new ParserExprList();} groupby_opt(X) ::= GROUP BY nexprlist(L). {X = L;} groupby_opt(X) ::= GROUP BY. { @@ -1159,12 +1238,12 @@ groupby_opt(X) ::= GROUP BY. { } %type having_opt {SqliteExpr*} -%destructor having_opt {delete $$;} +%destructor having_opt {parser_safe_delete($$);} having_opt(X) ::= . {X = nullptr;} having_opt(X) ::= HAVING expr(E). {X = E;} %type limit_opt {SqliteLimit*} -%destructor limit_opt {delete $$;} +%destructor limit_opt {parser_safe_delete($$);} limit_opt(X) ::= . {X = nullptr;} limit_opt(X) ::= LIMIT expr(E). { X = new SqliteLimit(E); @@ -1194,7 +1273,7 @@ cmd(X) ::= delete_stmt(S). { } %type delete_stmt {SqliteQuery*} -%destructor delete_stmt {delete $$;} +%destructor delete_stmt {parser_safe_delete($$);} delete_stmt(X) ::= with(WI) DELETE FROM fullname(N) indexed_opt(I) @@ -1262,7 +1341,7 @@ delete_stmt ::= with DELETE FROM ID_DB|ID_TAB. {} %type where_opt {SqliteExpr*} -%destructor where_opt {delete $$;} +%destructor where_opt {parser_safe_delete($$);} where_opt(X) ::= . {X = nullptr;} where_opt(X) ::= WHERE expr(E). {X = E;} where_opt(X) ::= WHERE. { @@ -1272,27 +1351,25 @@ where_opt(X) ::= WHERE. { ////////////////////////// The UPDATE command //////////////////////////////// -//%ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT -///cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt orderby_opt(O) limit_opt. -//%endif -//%ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT cmd(X) ::= update_stmt(S). { X = S; objectForTokens = X; } %type update_stmt {SqliteQuery*} -%destructor update_stmt {delete $$;} +%destructor update_stmt {parser_safe_delete($$);} update_stmt(X) ::= with(WI) UPDATE orconf(C) fullname(N) indexed_opt(I) SET - setlist(L) where_opt(W). { + setlist(L) from(F) + where_opt(W). { X = new SqliteUpdate( *(C), N->name1, N->name2, I ? I->notIndexedKw : false, - I ? I->indexedBy : QString::null, + I ? I->indexedBy : QString(), *(L), + F, W, WI ); @@ -1304,7 +1381,6 @@ update_stmt(X) ::= with(WI) UPDATE orconf(C) // since it's used in trigger: objectForTokens = X; } -//%endif update_stmt(X) ::= with(WI) UPDATE orconf(C). { @@ -1332,7 +1408,7 @@ update_stmt ::= with UPDATE orconf ID_DB|ID_TAB. {} %type setlist {ParserSetValueList*} -%destructor setlist {delete $$;} +%destructor setlist {parser_safe_delete($$);} setlist(X) ::= setlist(L) COMMA nm(N) EQ expr(E). { L->append(ParserSetValue(*(N), E)); @@ -1368,12 +1444,12 @@ setlist ::= setlist COMMA ID_COL. {} setlist ::= ID_COL. {} %type idlist_opt {QStringList*} -%destructor idlist_opt {delete $$;} +%destructor idlist_opt {parser_safe_delete($$);} idlist_opt(X) ::= . {X = new QStringList();} idlist_opt(X) ::= LP idlist(L) RP. {X = L;} %type idlist {QStringList*} -%destructor idlist {delete $$;} +%destructor idlist {parser_safe_delete($$);} idlist(X) ::= idlist(L) COMMA nm(N). { X = L; *(X) << *(N); @@ -1400,7 +1476,7 @@ cmd(X) ::= insert_stmt(S). { } %type insert_stmt {SqliteQuery*} -%destructor insert_stmt {delete $$;} +%destructor insert_stmt {parser_safe_delete($$);} insert_stmt(X) ::= with(W) insert_cmd(C) INTO fullname(N) @@ -1471,7 +1547,7 @@ insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB. {} %type insert_cmd {ParserStubInsertOrReplace*} -%destructor insert_cmd {delete $$;} +%destructor insert_cmd {parser_safe_delete($$);} insert_cmd(X) ::= INSERT orconf(C). { X = new ParserStubInsertOrReplace(false, *(C)); delete C; @@ -1480,7 +1556,7 @@ insert_cmd(X) ::= REPLACE. {X = new ParserStubInsertOrReplace(t %type upsert {SqliteUpsert*} -%destructor upsert {delete $$;} +%destructor upsert {parser_safe_delete($$);} upsert(X) ::= . { X = nullptr; @@ -1509,77 +1585,19 @@ upsert(X) ::= ON CONFLICT DO NOTHING. { /////////////////////////// Expression Processing ///////////////////////////// %type exprx {SqliteExpr*} -%destructor exprx {delete $$;} +%destructor exprx {parser_safe_delete($$);} -exprx(X) ::= nm(N1) DOT. { - X = new SqliteExpr(); - X->initId(*(N1), QString::null, QString::null); - delete N1; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: nm.>"); - } -exprx(X) ::= nm(N1) DOT nm(N2) DOT. { - X = new SqliteExpr(); - X->initId(*(N1), *(N2), QString::null); - delete N1; - delete N2; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: nm.nm.>"); - } -exprx(X) ::= expr(E1) not_opt(N) BETWEEN - expr(E2) AND. { - X = new SqliteExpr(); - delete N; - delete E1; - delete E2; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: expr not_opt BETWEEN expr AND>"); - } -exprx(X) ::= CASE case_operand(O) - case_exprlist(L) - case_else(E). { - X = new SqliteExpr(); - delete L; - delete O; - delete E; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: CASE operand exprlist else>"); - } -exprx(X) ::= expr(E) not_opt(N) IN LP - exprlist(L). [IN] { - X = new SqliteExpr(); - delete N; - delete L; - delete E; - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: expr not_opt IN LP exprlist>"); - } -/* -This introduces premature reduce for LP-expr and causes bug #2755 -exprx(X) ::= LP expr(E). { - X = new SqliteExpr(); - X->initSubExpr(E); - objectForTokens = X; - parserContext->minorErrorBeforeNextToken("Syntax error <exprx: LP expr>"); - } -*/ exprx ::= expr not_opt IN ID_DB. [IN] {} exprx ::= expr not_opt IN nm DOT ID_TAB. [IN] {} exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN. {} -exprx ::= nm DOT ID_TAB|ID_COL. {} -exprx ::= nm DOT nm DOT ID_COL. {} +exprx ::= tnm DOT ID_TAB|ID_COL. {} +exprx ::= tnm DOT nm DOT ID_COL. {} exprx ::= expr COLLATE ID_COLLATE. {} exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP. {} -exprx(X) ::= term(T). { - X = new SqliteExpr(); - X->initLiteral(*(T)); - delete T; - objectForTokens = X; - } exprx(X) ::= CTIME_KW(K). { X = new SqliteExpr(); X->initCTime(K->value); @@ -1591,34 +1609,35 @@ exprx(X) ::= LP nexprlist(L) RP. { delete L; objectForTokens = X; } -/* -exprx(X) ::= LP expr(E) RP. { - X = new SqliteExpr(); - X->initSubExpr(E); - objectForTokens = X; - } -*/ -exprx(X) ::= id(N). { +exprx(X) ::= tnm(N1). { X = new SqliteExpr(); - X->initId(*(N)); - delete N; - objectForTokens = X; - } -exprx(X) ::= JOIN_KW(N). { - X = new SqliteExpr(); - X->initId(N->value); + if (N1->isLiteral()) + X->initLiteral(N1->toLiteral()); + else + X->initId(N1->toName()); + //parserContext->errorBeforeLastToken("Syntax error <expected literal value>"); + + delete N1; objectForTokens = X; } -exprx(X) ::= nm(N1) DOT nm(N2). { +exprx(X) ::= tnm(N1) DOT nm(N2). { X = new SqliteExpr(); - X->initId(*(N1), *(N2)); + if (N1->isName()) + X->initId(N1->toName(), *(N2)); + else + parserContext->errorAtToken("Syntax error <expected name>", -3); + delete N1; delete N2; objectForTokens = X; } -exprx(X) ::= nm(N1) DOT nm(N2) DOT nm(N3). { +exprx(X) ::= tnm(N1) DOT nm(N2) DOT nm(N3). { X = new SqliteExpr(); - X->initId(*(N1), *(N2), *(N3)); + if (N1->isName()) + X->initId(N1->toName(), *(N2), *(N3)); + else + parserContext->errorAtToken("Syntax error <expected name>", -5); + delete N1; delete N2; delete N3; @@ -1824,9 +1843,23 @@ exprx(X) ::= RAISE LP raisetype(R) COMMA delete N; objectForTokens = X; } +exprx(X) ::= ID(I) LP distinct(D) + exprlist(E) RP filter_over(F). { + X = new SqliteExpr(); + X->initWindowFunction(I->value, *(D), *(E), F); + delete D; + delete E; + objectForTokens = X; + } +exprx(X) ::= ID(I) LP STAR RP + filter_over(F). { + X = new SqliteExpr(); + X->initWindowFunction(I->value, F); + objectForTokens = X; + } %type expr {SqliteExpr*} -%destructor expr {delete $$;} +%destructor expr {parser_safe_delete($$);} expr(X) ::= . { X = new SqliteExpr(); objectForTokens = X; @@ -1835,16 +1868,16 @@ expr(X) ::= . { expr(X) ::= exprx(E). {X = E;} %type not_opt {bool*} -%destructor not_opt {delete $$;} +%destructor not_opt {parser_safe_delete($$);} not_opt(X) ::= . {X = new bool(false);} not_opt(X) ::= NOT. {X = new bool(true);} %type likeop {SqliteExpr::LikeOp*} -%destructor likeop {delete $$;} +%destructor likeop {parser_safe_delete($$);} likeop(X) ::= LIKE_KW|MATCH(T). {X = new SqliteExpr::LikeOp(SqliteExpr::likeOp(T->value));} %type case_exprlist {ParserExprList*} -%destructor case_exprlist {delete $$;} +%destructor case_exprlist {parser_safe_delete($$);} case_exprlist(X) ::= case_exprlist(L) WHEN expr(E1) THEN expr(E2). { L->append(E1); @@ -1859,22 +1892,22 @@ case_exprlist(X) ::= WHEN expr(E1) THEN } %type case_else {SqliteExpr*} -%destructor case_else {delete $$;} +%destructor case_else {parser_safe_delete($$);} case_else(X) ::= ELSE expr(E). {X = E;} case_else(X) ::= . {X = nullptr;} %type case_operand {SqliteExpr*} -%destructor case_operand {delete $$;} +%destructor case_operand {parser_safe_delete($$);} case_operand(X) ::= exprx(E). {X = E;} case_operand(X) ::= . {X = nullptr;} %type exprlist {ParserExprList*} -%destructor exprlist {delete $$;} +%destructor exprlist {parser_safe_delete($$);} exprlist(X) ::= nexprlist(L). {X = L;} exprlist(X) ::= . {X = new ParserExprList();} %type nexprlist {ParserExprList*} -%destructor nexprlist {delete $$;} +%destructor nexprlist {parser_safe_delete($$);} nexprlist(X) ::= nexprlist(L) COMMA expr(E). { L->append(E); @@ -1919,17 +1952,17 @@ cmd ::= CREATE uniqueflag INDEX ifnotexists %type uniqueflag {bool*} -%destructor uniqueflag {delete $$;} +%destructor uniqueflag {parser_safe_delete($$);} uniqueflag(X) ::= UNIQUE. {X = new bool(true);} uniqueflag(X) ::= . {X = new bool(false);} %type idxlist_opt {ParserIndexedColumnList*} -%destructor idxlist_opt {delete $$;} +%destructor idxlist_opt {parser_safe_delete($$);} idxlist_opt(X) ::= . {X = new ParserIndexedColumnList();} idxlist_opt(X) ::= LP idxlist(I) RP. {X = I;} %type idxlist {ParserIndexedColumnList*} -%destructor idxlist {delete $$;} +%destructor idxlist {parser_safe_delete($$);} idxlist(X) ::= idxlist(L) COMMA idxlist_single(S). { L->append(S); @@ -1942,7 +1975,7 @@ idxlist(X) ::= idxlist_single(S). { } %type idxlist_single {SqliteIndexedColumn*} -%destructor idxlist_single {delete $$;} +%destructor idxlist_single {parser_safe_delete($$);} idxlist_single(X) ::= nm(N) collate(C) sortorder(S). { SqliteIndexedColumn* obj = @@ -1961,7 +1994,7 @@ idxlist_single(X) ::= nm(N) collate(C) idxlist_single ::= ID_COL. {} %type collate {QString*} -%destructor collate {delete $$;} +%destructor collate {parser_safe_delete($$);} collate(X) ::= . {X = new QString();} collate(X) ::= COLLATE ids(I). {X = I;} collate ::= COLLATE ID_COLLATE. {} @@ -1982,16 +2015,22 @@ cmd ::= DROP INDEX ifexists ID_DB|ID_IDX. {} ///////////////////////////// The VACUUM command ///////////////////////////// -cmd(X) ::= VACUUM. { - X = new SqliteVacuum(); +cmd(X) ::= VACUUM vinto(I). { + X = new SqliteVacuum(I); objectForTokens = X; } -cmd(X) ::= VACUUM nm(N). { - X = new SqliteVacuum(*(N)); +cmd(X) ::= VACUUM nm(N) vinto(I). { + X = new SqliteVacuum(*(N), I); delete N; objectForTokens = X; } + +%type vinto {SqliteExpr*} +%destructor vinto {parser_safe_delete($$);} +vinto(X) ::= INTO expr(E). {X = E;} +vinto(X) ::= . {X = nullptr;} + ///////////////////////////// The PRAGMA command ///////////////////////////// cmd(X) ::= PRAGMA nm(N1) dbnm(N2). { @@ -2037,7 +2076,7 @@ cmd ::= PRAGMA nm DOT ID_PRAGMA. {} cmd ::= PRAGMA ID_DB|ID_PRAGMA. {} %type nmnum {QVariant*} -%destructor nmnum {delete $$;} +%destructor nmnum {parser_safe_delete($$);} nmnum(X) ::= plus_num(N). {X = N;} nmnum(X) ::= nm(N). { X = new QVariant(*(N)); @@ -2048,12 +2087,12 @@ nmnum(X) ::= DELETE(T). {X = new QVariant(T->value);} nmnum(X) ::= DEFAULT(T). {X = new QVariant(T->value);} %type plus_num {QVariant*} -%destructor plus_num {delete $$;} +%destructor plus_num {parser_safe_delete($$);} plus_num(X) ::= PLUS number(N). {X = N;} plus_num(X) ::= number(N). {X = N;} %type minus_num {QVariant*} -%destructor minus_num {delete $$;} +%destructor minus_num {parser_safe_delete($$);} minus_num(X) ::= MINUS number(N). { if (N->type() == QVariant::Double) *(N) = -(N->toDouble()); @@ -2071,7 +2110,7 @@ minus_num(X) ::= MINUS number(N). { } %type number {QVariant*} -%destructor number {delete $$;} +%destructor number {parser_safe_delete($$);} number(X) ::= INTEGER(N). {X = parserContext->handleNumberToken(N->value);} number(X) ::= FLOAT(N). {X = new QVariant(QVariant(N->value).toDouble());} @@ -2150,17 +2189,17 @@ cmd(X) ::= CREATE temp(T) TRIGGER when_clause(WC) BEGIN trigger_cmd_list(CL). { X = new SqliteCreateTrigger( - *(T), - *(IE), - *(N1), - *(N2), - *(N), - *(TT), - EV, - *(FC), - WC, - *(CL), - 3 + *(T), + *(IE), + *(N1), + *(N2), + *(N), + *(TT), + EV, + *(FC), + WC, + *(CL), + 3 ); delete IE; delete T; @@ -2183,14 +2222,14 @@ cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW. {} %type trigger_time {SqliteCreateTrigger::Time*} -%destructor trigger_time {delete $$;} +%destructor trigger_time {parser_safe_delete($$);} trigger_time(X) ::= BEFORE. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);} trigger_time(X) ::= AFTER. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);} trigger_time(X) ::= INSTEAD OF. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);} trigger_time(X) ::= . {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);} %type trigger_event {SqliteCreateTrigger::Event*} -%destructor trigger_event {delete $$;} +%destructor trigger_event {parser_safe_delete($$);} trigger_event(X) ::= DELETE. { X = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE); objectForTokens = X; @@ -2211,17 +2250,17 @@ trigger_event(X) ::= UPDATE OF } %type foreach_clause {SqliteCreateTrigger::Scope*} -%destructor foreach_clause {delete $$;} +%destructor foreach_clause {parser_safe_delete($$);} foreach_clause(X) ::= . {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);} foreach_clause(X) ::= FOR EACH ROW. {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);} %type when_clause {SqliteExpr*} -%destructor when_clause {if ($$) delete $$;} +%destructor when_clause {parser_safe_delete($$);} when_clause(X) ::= . {X = nullptr;} when_clause(X) ::= WHEN expr(E). {X = E;} %type trigger_cmd_list {ParserQueryList*} -%destructor trigger_cmd_list {delete $$;} +%destructor trigger_cmd_list {parser_safe_delete($$);} trigger_cmd_list(X) ::= trigger_cmd_list(L) trigger_cmd(C) SEMI. { L->append(C); @@ -2239,7 +2278,7 @@ trigger_cmd_list(X) ::= SEMI. { } %type trigger_cmd {SqliteQuery*} -%destructor trigger_cmd {delete $$;} +%destructor trigger_cmd {parser_safe_delete($$);} trigger_cmd(X) ::= update_stmt(S). {X = S;} trigger_cmd(X) ::= insert_stmt(S). {X = S;} trigger_cmd(X) ::= delete_stmt(S). {X = S;} @@ -2278,12 +2317,12 @@ cmd(X) ::= DETACH database_kw_opt(D) } %type key_opt {SqliteExpr*} -%destructor key_opt {if ($$) delete $$;} +%destructor key_opt {parser_safe_delete($$);} key_opt(X) ::= . {X = nullptr;} key_opt(X) ::= KEY expr(E). {X = E;} %type database_kw_opt {bool*} -%destructor database_kw_opt {delete $$;} +%destructor database_kw_opt {parser_safe_delete($$);} database_kw_opt(X) ::= DATABASE. {X = new bool(true);} database_kw_opt(X) ::= . {X = new bool(false);} @@ -2346,7 +2385,7 @@ cmd ::= ALTER TABLE nm DOT ID_TAB. {} cmd ::= ALTER TABLE ID_DB|ID_TAB. {} %type kwcolumn_opt {bool*} -%destructor kwcolumn_opt {delete $$;} +%destructor kwcolumn_opt {parser_safe_delete($$);} kwcolumn_opt(X) ::= . {X = new bool(true);} kwcolumn_opt(X) ::= COLUMNKW. {X = new bool(false);} @@ -2354,7 +2393,7 @@ kwcolumn_opt(X) ::= COLUMNKW. {X = new bool(false);} cmd(X) ::= create_vtab(C). {X = C;} %type create_vtab {SqliteQuery*} -%destructor create_vtab {delete $$;} +%destructor create_vtab {parser_safe_delete($$);} create_vtab(X) ::= CREATE VIRTUAL TABLE ifnotexists(E) nm(N1) dbnm(N2) USING nm(N3). { @@ -2397,7 +2436,7 @@ create_vtab ::= CREATE VIRTUAL TABLE ID_DB|ID_TAB_NEW. {} %type vtabarglist {QStringList*} -%destructor vtabarglist {delete $$;} +%destructor vtabarglist {parser_safe_delete($$);} vtabarglist(X) ::= vtabarg(A). { X = new QStringList(); X->append((A)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg @@ -2412,7 +2451,7 @@ vtabarglist(X) ::= vtabarglist(L) COMMA } %type vtabarg {QString*} -%destructor vtabarg {delete $$;} +%destructor vtabarg {parser_safe_delete($$);} vtabarg(X) ::= . {X = new QString();} vtabarg(X) ::= vtabarg(A) vtabargtoken(T). { A->append(" "+ *(T)); @@ -2421,7 +2460,7 @@ vtabarg(X) ::= vtabarg(A) vtabargtoken(T). { } %type vtabargtoken {QString*} -%destructor vtabargtoken {delete $$;} +%destructor vtabargtoken {parser_safe_delete($$);} vtabargtoken(X) ::= ANY(A). { X = new QString(A->value); } @@ -2433,7 +2472,7 @@ vtabargtoken(X) ::= LP anylist(L) RP. { } %type anylist {QString*} -%destructor anylist {delete $$;} +%destructor anylist {parser_safe_delete($$);} anylist(X) ::= . {X = new QString();} anylist(X) ::= anylist(L1) LP anylist(L2) RP. { @@ -2452,36 +2491,277 @@ anylist(X) ::= anylist(L) ANY(A). { //////////////////////// COMMON TABLE EXPRESSIONS //////////////////////////// %type with {SqliteWith*} -%type wqlist {SqliteWith*} -%destructor with {delete $$;} -%destructor wqlist {delete $$;} +%destructor with {parser_safe_delete($$);} with(X) ::= . {X = nullptr;} with(X) ::= WITH wqlist(W). { - X = W; + X = new SqliteWith(); + X->cteList = *(W); + delete W; objectForTokens = X; } with(X) ::= WITH RECURSIVE wqlist(W). { - X = W; + X = new SqliteWith(); + X->cteList = *(W); X->recursive = true; + delete W; objectForTokens = X; } -wqlist(X) ::= nm(N) idxlist_opt(IL) AS - LP select(S) RP. { - X = SqliteWith::append(*(N), *(IL), S); - delete N; - delete IL; +%type wqlist {ParserCteList*} +%destructor wqlist {parser_safe_delete($$);} + +wqlist(X) ::= wqcte(C). { + X = new ParserCteList(); + X->append(C); } -wqlist(X) ::= wqlist(WL) COMMA nm(N) - idxlist_opt(IL) AS - LP select(S) RP. { - X = SqliteWith::append(WL, *(N), *(IL), S); - delete N; - delete IL; +wqlist(X) ::= wqlist(W) COMMA wqcte(C). { + X = W; + X->append(C); DONT_INHERIT_TOKENS("wqlist"); } -wqlist(X) ::= ID_TAB_NEW. { +wqlist ::= ID_TAB_NEW. { parserContext->minorErrorBeforeNextToken("Syntax error"); - X = new SqliteWith(); } + +%type wqcte {SqliteWith::CommonTableExpression*} +%destructor wqcte {parser_safe_delete($$);} + +wqcte(X) ::= nm(N) idxlist_opt(IL) AS + LP select(S) RP. { + X = new SqliteWith::CommonTableExpression(*(N), *(IL), S); + delete N; + delete IL; + objectForTokens = X; + } + +//////////////////////// WINDOW FUNCTION EXPRESSIONS ///////////////////////// +// These must be at the end of this file. Specifically, the rules that +// introduce tokens WINDOW, OVER and FILTER must appear last. This causes +// the integer values assigned to these tokens to be larger than all other +// tokens that may be output by the tokenizer except TK_SPACE and TK_ILLEGAL. +// +%type windowdefn_list {ParserWindowDefList*} +%destructor windowdefn_list {parser_safe_delete($$);} + +windowdefn_list(X) ::= windowdefn(W). { + X = new ParserWindowDefList(); + X->append(W); + } +windowdefn_list(X) ::= windowdefn_list(L) + COMMA windowdefn(W). { + L->append(W); + X = L; + DONT_INHERIT_TOKENS("windowdefn_list"); + } + +%type windowdefn {SqliteWindowDefinition*} +%destructor windowdefn {parser_safe_delete($$);} + +windowdefn(X) ::= nm(N) AS LP window(W) RP. { + X = new SqliteWindowDefinition(*(N), W); + delete N; + objectForTokens = X; + } + +%type window {SqliteWindowDefinition::Window*} +%destructor window {parser_safe_delete($$);} + +window(X) ::= PARTITION BY nexprlist(L) + orderby_opt(O) frame_opt(F). { + X = new SqliteWindowDefinition::Window(); + X->initPartitionBy(QString(), *(L), *(O), F); + delete L; + delete O; + objectForTokens = X; + } +window(X) ::= nm(N) PARTITION BY + nexprlist(L) orderby_opt(O) + frame_opt(F). { + X = new SqliteWindowDefinition::Window(); + X->initPartitionBy(*(N), *(L), *(O), F); + delete L; + delete N; + delete O; + objectForTokens = X; + } +window(X) ::= ORDER BY sortlist(S) + frame_opt(F). { + X = new SqliteWindowDefinition::Window(); + X->initOrderBy(QString(), *(S), F); + delete S; + objectForTokens = X; + } +window(X) ::= nm(N) ORDER BY sortlist(S) + frame_opt(F). { + X = new SqliteWindowDefinition::Window(); + X->initOrderBy(*(N), *(S), F); + delete S; + delete N; + objectForTokens = X; + } +window(X) ::= frame_opt(F). { + X = new SqliteWindowDefinition::Window(); + X->init(QString(), F); + objectForTokens = X; + } +window(X) ::= nm(N) frame_opt(F). { + X = new SqliteWindowDefinition::Window(); + X->init(QString(), F); + delete N; + objectForTokens = X; + } + +%type frame_opt {SqliteWindowDefinition::Window::Frame*} +%destructor frame_opt {parser_safe_delete($$);} + +frame_opt(X) ::= . {X = nullptr;} +frame_opt(X) ::= range_or_rows(R) + frame_bound_s(B) + frame_exclude_opt(E). { + X = new SqliteWindowDefinition::Window::Frame(*(R), B, nullptr, *(E)); + delete R; + delete E; + objectForTokens = X; + } +frame_opt(X) ::= range_or_rows(R) BETWEEN + frame_bound_s(BS) AND + frame_bound_e(BE) + frame_exclude_opt(E). { + X = new SqliteWindowDefinition::Window::Frame(*(R), BS, BE, *(E)); + delete R; + delete E; + objectForTokens = X; + } + +%type range_or_rows {SqliteWindowDefinition::Window::Frame::RangeOrRows*} +%destructor range_or_rows {parser_safe_delete($$);} + +range_or_rows(X) ::= RANGE|ROWS|GROUPS(R). { + X = new SqliteWindowDefinition::Window::Frame::RangeOrRows( + SqliteWindowDefinition::Window::Frame::toRangeOrRows(R->value) + ); + } + +%type frame_bound_s {SqliteWindowDefinition::Window::Frame::Bound*} +%destructor frame_bound_s {parser_safe_delete($$);} + +frame_bound_s(X) ::= frame_bound(F). { + X = F; + objectForTokens = X; + } +frame_bound_s(X) ::= UNBOUNDED(U) + PRECEDING(P). { + X = new SqliteWindowDefinition::Window::Frame::Bound(nullptr, U->value + " " + P->value); + objectForTokens = X; + } + +%type frame_bound_e {SqliteWindowDefinition::Window::Frame::Bound*} +%destructor frame_bound_e {parser_safe_delete($$);} + +frame_bound_e(X) ::= frame_bound(F). { + X = F; + objectForTokens = X; + } +frame_bound_e(X) ::= UNBOUNDED(U) + FOLLOWING(F). { + X = new SqliteWindowDefinition::Window::Frame::Bound(nullptr, U->value + " " + F->value); + objectForTokens = X; + } + +%type frame_bound {SqliteWindowDefinition::Window::Frame::Bound*} +%destructor frame_bound {parser_safe_delete($$);} + +frame_bound(X) ::= expr(E) + PRECEDING|FOLLOWING(P). { + X = new SqliteWindowDefinition::Window::Frame::Bound(E, P->value); + objectForTokens = X; + } +frame_bound(X) ::= CURRENT(C) ROW(R). { + X = new SqliteWindowDefinition::Window::Frame::Bound(nullptr, C->value + " " + R->value); + objectForTokens = X; + } + +%type frame_exclude_opt {SqliteWindowDefinition::Window::Frame::Exclude*} +%destructor frame_bound {parser_safe_delete($$);} + +frame_exclude_opt(X) ::= . { + X = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::null + ); + } +frame_exclude_opt(X) ::= EXCLUDE + frame_exclude(F). { + X = F; + } + +%type frame_exclude {SqliteWindowDefinition::Window::Frame::Exclude*} +%destructor frame_bound {parser_safe_delete($$);} + +frame_exclude(X) ::= NO OTHERS. { + X = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::NO_OTHERS + ); + } +frame_exclude(X) ::= CURRENT ROW. { + X = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::CURRENT_ROW + ); + } +frame_exclude(X) ::= GROUP. { + X = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::GROUP + ); + } +frame_exclude(X) ::= TIES. { + X = new SqliteWindowDefinition::Window::Frame::Exclude( + SqliteWindowDefinition::Window::Frame::Exclude::TIES + ); + } + +%type window_clause {ParserWindowDefList*} +%destructor window_clause {parser_safe_delete($$);} + +window_clause(X) ::= WINDOW + windowdefn_list(L). { + X = L; + } + +%type filter_over {SqliteFilterOver*} +%destructor filter_over {parser_safe_delete($$);} + +filter_over(X) ::= filter_clause(F) + over_clause(O). { + X = new SqliteFilterOver(F, O); + objectForTokens = X; + } +filter_over(X) ::= over_clause(O). { + X = new SqliteFilterOver(nullptr, O); + objectForTokens = X; + } +filter_over(X) ::= filter_clause(F). { + X = new SqliteFilterOver(F, nullptr); + objectForTokens = X; + } + +%type over_clause {SqliteFilterOver::Over*} +%destructor over_clause {parser_safe_delete($$);} + +over_clause(X) ::= OVER LP window(W) RP. { + X = new SqliteFilterOver::Over(W); + objectForTokens = X; + } +over_clause(X) ::= OVER nm(N). { + X = new SqliteFilterOver::Over(*(N)); + delete N; + objectForTokens = X; + } + +%type filter_clause {SqliteFilterOver::Filter*} +%destructor filter_clause {parser_safe_delete($$);} + +filter_clause(X) ::= FILTER LP WHERE + expr(E) RP. { + X = new SqliteFilterOver::Filter(E); + objectForTokens = X; + } diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp index 07d1976..faf8c8e 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp @@ -10,40 +10,22 @@ StatementTokenBuilder& StatementTokenBuilder::withKeyword(const QString& value) StatementTokenBuilder& StatementTokenBuilder::withOther(const QString& value) { - return with(Token::OTHER, value); + return withOther(value, true); } -StatementTokenBuilder& StatementTokenBuilder::withOther(const QString& value, Dialect dialect) +StatementTokenBuilder& StatementTokenBuilder::withOther(const QString& value, bool wrapIfNeeded) { - return withOther(wrapObjIfNeeded(value, dialect)); + return with(Token::OTHER, wrapIfNeeded ? wrapObjIfNeeded(value) : value); } -StatementTokenBuilder&StatementTokenBuilder::withStringPossiblyOther(const QString& value, Dialect dialect) +StatementTokenBuilder&StatementTokenBuilder::withStringPossiblyOther(const QString& value) { if (value.contains("\"")) - return withOther(wrapObjIfNeeded(value, dialect)); + return withOther(wrapObjIfNeeded(value)); else return withOther(wrapObjName(value, NameWrapper::DOUBLE_QUOTE)); } -StatementTokenBuilder& StatementTokenBuilder::withOtherList(const QList<QString>& value, Dialect dialect, const QString& separator) -{ - bool first = true; - for (const QString& str : value) - { - if (!first) - { - if (!separator.isEmpty()) - withOperator(separator); - - withSpace(); - } - withOther(str, dialect); - first = false; - } - return *this; -} - StatementTokenBuilder& StatementTokenBuilder::withOtherList(const QList<QString>& value, const QString& separator) { bool first = true; @@ -157,6 +139,12 @@ StatementTokenBuilder& StatementTokenBuilder::withLiteralValue(const QVariant& v if (value.isNull()) return *this; + if (value.userType() == QVariant::String) + { + withString(value.toString()); + return *this; + } + bool ok; if (value.userType() == QVariant::Double) { diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h index 9ccfaa3..c5ec197 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h @@ -4,7 +4,6 @@ #include "token.h" #include "ast/sqliteconflictalgo.h" #include "ast/sqlitesortorder.h" -#include "dialect.h" class SqliteStatement; @@ -33,10 +32,10 @@ class SqliteStatement; * if (ifNotExists) * builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace(); * - * if (dialect == Dialect::Sqlite3 && !database.isNull()) - * builder.withOther(database, dialect).withOperator("."); + * if (!database.isNull()) + * builder.withOther(database).withOperator("."); * - * builder.withOther(view, dialect).withSpace().withKeyword("AS").withStatement(select); + * builder.withOther(view).withSpace().withKeyword("AS").withStatement(select); * * return builder.build(); * } @@ -66,31 +65,29 @@ class StatementTokenBuilder /** * @brief Adds "other" token (some object name, or other word). * @param value Value for the token. - * @param dialect Dialect used for wrapping the value. + * @param wrapIfNeeded Defined whether the value should be wrapped if identified to require wrapping (i.e. is a keyword, or multiword). * @return Reference to the builder for the further building. * - * The \p value is wrapped with the proper wrapper using wrapObjIfNeeded(). - * - * @overload + * This is used for table names, etc. The \p value is quoted just as passed. + * You may want to pass wrapIfNeeded=false if you know that this may be equal to keyword, + * that is allowed as ID too (Lemon's fallback to ID). */ - StatementTokenBuilder& withOther(const QString& value, Dialect dialect); + StatementTokenBuilder& withOther(const QString& value, bool wrapIfNeeded); /** * @brief Adds string using double-quote wrapping. * @param value Value for the token. - * @param dialect Dialect used for wrapping the value if double-quote could not be used. * @return Reference to the builder for the further building. * * The \p value is wrapped with double quote, but if it's not possible then the proper wrapper is used by wrapObjIfNeeded(). * * @overload */ - StatementTokenBuilder& withStringPossiblyOther(const QString& value, Dialect dialect); + StatementTokenBuilder& withStringPossiblyOther(const QString& value); /** * @brief Adds list of "other" tokens. * @param value List of values for tokens. - * @param dialect Dialect used for wrapping values. * @param separator Optional value for separator tokens. * @return Reference to the builder for the further building. * @@ -98,18 +95,6 @@ class StatementTokenBuilder * token between all produced tokens using the \p separator value. To skip separator tokens pass * an empty string as the separator value. */ - StatementTokenBuilder& withOtherList(const QList<QString>& value, Dialect dialect, const QString& separator = ","); - - /** - * @brief Adds list of "other" tokens. - * @param value List of values for tokens. - * @param separator Optional value for separator tokens. - * @return Reference to the builder for the further building. - * - * Works just like the other withOtherList() method, except it doesn't wrap values with wrapObjIfNeeded(). - * - * @overload - */ StatementTokenBuilder& withOtherList(const QList<QString>& value, const QString& separator = ","); /** diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/token.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/token.cpp index cd7e4b0..41980b4 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/token.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/token.cpp @@ -4,7 +4,7 @@ #include <QStringList> Token::Token() - : lemonType(0), type(INVALID), value(QString::null), start(-1), end(-1) + : lemonType(0), type(INVALID), value(QString()), start(-1), end(-1) { } @@ -160,6 +160,28 @@ bool Token::isSeparating() const return false; } +bool Token::isMeaningful() const +{ + switch (type) + { + case Token::BIND_PARAM: + case Token::PAR_LEFT: + case Token::PAR_RIGHT: + case Token::BLOB: + case Token::FLOAT: + case Token::INTEGER: + case Token::INVALID: + case Token::KEYWORD: + case Token::OTHER: + case Token::STRING: + case Token::OPERATOR: + return true; + default: + break; + } + return false; +} + bool Token::isDbObjectType() const { return ((type & TOKEN_TYPE_MASK_DB_OBJECT) == TOKEN_TYPE_MASK_DB_OBJECT); diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/token.h b/SQLiteStudio3/coreSQLiteStudio/parser/token.h index 85c46c1..1088d9e 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/token.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/token.h @@ -113,7 +113,7 @@ struct API_EXPORT Token /** * @brief Creates fully defined token. - * @param lemonType Lemon token ID to use (see sqlite2_parser.h and sqlite3_parser.h). + * @param lemonType Lemon token ID to use (see sqlite3_parser.h). * @param type Token type. * @param value Value of the token. * @param start Start position of the token (index of the first character in the query). @@ -199,6 +199,12 @@ struct API_EXPORT Token bool isSeparating() const; /** + * @brief Tests whether the token represents meaningful type. + * @return true if token is meaningful, like a word, object, string, number, etc. Not comment, not whitespace, not context marker. + */ + bool isMeaningful() const; + + /** * @brief Tests whether this token is representing any kind of database object name. * @return true if the token is the name an object, or false otherwise. * |
