diff --git a/builds/posix/make.shared.targets b/builds/posix/make.shared.targets
index ea500f92a0..5fefbf18b0 100644
--- a/builds/posix/make.shared.targets
+++ b/builds/posix/make.shared.targets
@@ -40,9 +40,11 @@
# MOD 07-Oct-2002
# This rule creates parse.cpp from parse.y
+# With make 4.3 this can be simplified with a simple group target (&:) dependency.
-$(OBJ)/dsql/parse.cpp: $(SRC_ROOT)/include/gen/parse.h
-$(OBJ)/dsql/parse.cpp $(SRC_ROOT)/include/gen/parse.h: $(SRC_ROOT)/dsql/parse.y $(SRC_ROOT)/dsql/btyacc_fb.ske
+$(OBJ)/dsql/parse.cpp $(SRC_ROOT)/include/gen/parse.h: $(OBJ)/.parse-gen-sentinel ;
+
+$(OBJ)/.parse-gen-sentinel: $(SRC_ROOT)/dsql/parse.y $(SRC_ROOT)/dsql/btyacc_fb.ske
sed -n '/%type .*/p' < $< > $(GEN_ROOT)/types.y
sed 's/%type .*//' < $< > $(GEN_ROOT)/y.y
($(BTYACC) -l -d -S $(SRC_ROOT)/dsql/btyacc_fb.ske $(GEN_ROOT)/y.y; echo $$? > $(GEN_ROOT)/y.status) 2>&1 | tee $(GEN_ROOT)/y.txt
@@ -52,7 +54,7 @@ $(OBJ)/dsql/parse.cpp $(SRC_ROOT)/include/gen/parse.h: $(SRC_ROOT)/dsql/parse.y
sed -i -e 's/#define TOK_YY\(.*\)/#define YY\1/' $(GEN_ROOT)/y_tab.h
$(MV) $(GEN_ROOT)/y_tab.h $(SRC_ROOT)/include/gen/parse.h
$(MV) $(GEN_ROOT)/y_tab.c $(OBJ)/dsql/parse.cpp
- touch $(OBJ)/dsql/parse.cpp
+ touch $@
# gpre_meta needs a special boot build since there is no database.
@@ -62,7 +64,7 @@ $(SRC_ROOT)/gpre/gpre_meta.cpp: $(SRC_ROOT)/gpre/gpre_meta.epp
# Explicit dependence on generated header (parser)
-$(OBJ)/dsql/Parser.o $(OBJ)/common/keywords.o $(OBJ)/dsql/dsql.o: $(SRC_ROOT)/include/gen/parse.h
+$(OBJ)/dsql/Parser.o $(OBJ)/dsql/Keywords.o $(OBJ)/dsql/dsql.o: $(SRC_ROOT)/include/gen/parse.h
# Special cases for building cpp from epp
$(OBJ)/dsql/metd.cpp: $(SRC_ROOT)/dsql/metd.epp
diff --git a/builds/win32/msvc15/common.vcxproj b/builds/win32/msvc15/common.vcxproj
index 72499599bf..3d3a267fdf 100644
--- a/builds/win32/msvc15/common.vcxproj
+++ b/builds/win32/msvc15/common.vcxproj
@@ -75,7 +75,6 @@
-
@@ -189,7 +188,6 @@
-
@@ -199,6 +197,7 @@
+
@@ -218,6 +217,7 @@
+
diff --git a/builds/win32/msvc15/common.vcxproj.filters b/builds/win32/msvc15/common.vcxproj.filters
index ea9954db73..0db3a15acb 100644
--- a/builds/win32/msvc15/common.vcxproj.filters
+++ b/builds/win32/msvc15/common.vcxproj.filters
@@ -243,9 +243,6 @@
classes
-
- common
-
common
@@ -581,6 +578,9 @@
headers
+
+ headers
+
headers
@@ -599,15 +599,15 @@
headers
-
- headers
-
headers
headers
+
+ headers
+
headers
diff --git a/builds/win32/msvc15/engine_static.vcxproj b/builds/win32/msvc15/engine_static.vcxproj
index a8bf00b46a..1481b1cb79 100644
--- a/builds/win32/msvc15/engine_static.vcxproj
+++ b/builds/win32/msvc15/engine_static.vcxproj
@@ -47,6 +47,7 @@
+
@@ -201,6 +202,7 @@
+
diff --git a/builds/win32/msvc15/engine_static.vcxproj.filters b/builds/win32/msvc15/engine_static.vcxproj.filters
index 861d5f0b4d..3bf420ac6d 100644
--- a/builds/win32/msvc15/engine_static.vcxproj.filters
+++ b/builds/win32/msvc15/engine_static.vcxproj.filters
@@ -156,6 +156,9 @@
DSQL
+
+ DSQL
+
DSQL
@@ -587,6 +590,9 @@
Header files
+
+ Header files
+
Header files
diff --git a/src/common/ParserTokens.h b/src/common/ParserTokens.h
new file mode 100644
index 0000000000..29fb135b66
--- /dev/null
+++ b/src/common/ParserTokens.h
@@ -0,0 +1,554 @@
+/*
+ * The contents of this file are subject to the Initial
+ * Developer's Public License Version 1.0 (the "License");
+ * you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
+ *
+ * Software distributed under the License is distributed AS IS,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied.
+ * See the License for the specific language governing rights
+ * and limitations under the License.
+ *
+ * The Original Code was created by Mark O'Donohue
+ * for the Firebird Open Source RDBMS project.
+ *
+ * Copyright (c) 2002 Mark O'Donohue
+ * and all contributors signed below.
+ *
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ *
+ * 2005.05.19 Claudio Valderrama: signal tokens that aren't reserved in the
+ * engine thanks to special handling.
+ * Adriano dos Santos Fernandes
+ */
+
+// ASF: Do not add include guards to this file!
+
+// CVC: The latest column indicates whether the token has special handling in
+// the parser. If it does, KEYWORD_stringIsAToken will return false.
+// I discovered isql was being fooled and put double quotes around those
+// special cases unnecessarily.
+
+#ifndef PARSER_TOKEN
+#error PARSER_TOKEN must be defined before inclusion of this file
+#define PARSER_TOKEN(ident, str, nonReserved)
+#endif
+
+PARSER_TOKEN(TOK_NOT_LSS, "!<", false)
+PARSER_TOKEN(TOK_NEQ, "!=", false)
+PARSER_TOKEN(TOK_NOT_GTR, "!>", false)
+PARSER_TOKEN('(', "(", false)
+PARSER_TOKEN(')', ")", false)
+PARSER_TOKEN(',', ",", false)
+PARSER_TOKEN('<', "<", false)
+PARSER_TOKEN(TOK_LEQ, "<=", false)
+PARSER_TOKEN(TOK_NEQ, "<>", false) // Alias of !=
+PARSER_TOKEN('=', "=", false)
+PARSER_TOKEN('>', ">", false)
+PARSER_TOKEN(TOK_GEQ, ">=", false)
+PARSER_TOKEN(TOK_BIND_PARAM, ":=", false)
+PARSER_TOKEN(TOK_ABS, "ABS", true)
+PARSER_TOKEN(TOK_ABSOLUTE, "ABSOLUTE", true)
+PARSER_TOKEN(TOK_ACCENT, "ACCENT", true)
+PARSER_TOKEN(TOK_ACOS, "ACOS", true)
+PARSER_TOKEN(TOK_ACOSH, "ACOSH", true)
+PARSER_TOKEN(TOK_ACTION, "ACTION", true)
+PARSER_TOKEN(TOK_ACTIVE, "ACTIVE", true)
+PARSER_TOKEN(TOK_ADD, "ADD", false)
+PARSER_TOKEN(TOK_ADMIN, "ADMIN", false)
+PARSER_TOKEN(TOK_AFTER, "AFTER", true)
+PARSER_TOKEN(TOK_ALL, "ALL", false)
+PARSER_TOKEN(TOK_ALTER, "ALTER", false)
+PARSER_TOKEN(TOK_ALWAYS, "ALWAYS", true)
+PARSER_TOKEN(TOK_AND, "AND", false)
+PARSER_TOKEN(TOK_ANY, "ANY", false)
+PARSER_TOKEN(TOK_AS, "AS", false)
+PARSER_TOKEN(TOK_ASC, "ASC", true) // Alias of ASCENDING
+PARSER_TOKEN(TOK_ASC, "ASCENDING", true)
+PARSER_TOKEN(TOK_ASCII_CHAR, "ASCII_CHAR", true)
+PARSER_TOKEN(TOK_ASCII_VAL, "ASCII_VAL", true)
+PARSER_TOKEN(TOK_ASIN, "ASIN", true)
+PARSER_TOKEN(TOK_ASINH, "ASINH", true)
+PARSER_TOKEN(TOK_AT, "AT", false)
+PARSER_TOKEN(TOK_ATAN, "ATAN", true)
+PARSER_TOKEN(TOK_ATAN2, "ATAN2", true)
+PARSER_TOKEN(TOK_ATANH, "ATANH", true)
+PARSER_TOKEN(TOK_AUTO, "AUTO", true)
+PARSER_TOKEN(TOK_AUTONOMOUS, "AUTONOMOUS", true)
+PARSER_TOKEN(TOK_AVG, "AVG", false)
+PARSER_TOKEN(TOK_BACKUP, "BACKUP", true)
+PARSER_TOKEN(TOK_BASE64_DECODE, "BASE64_DECODE", true)
+PARSER_TOKEN(TOK_BASE64_ENCODE, "BASE64_ENCODE", true)
+PARSER_TOKEN(TOK_BEFORE, "BEFORE", true)
+PARSER_TOKEN(TOK_BEGIN, "BEGIN", false)
+PARSER_TOKEN(TOK_BETWEEN, "BETWEEN", false)
+PARSER_TOKEN(TOK_BIGINT, "BIGINT", false)
+PARSER_TOKEN(TOK_BIN_AND, "BIN_AND", true)
+PARSER_TOKEN(TOK_BIN_NOT, "BIN_NOT", true)
+PARSER_TOKEN(TOK_BIN_OR, "BIN_OR", true)
+PARSER_TOKEN(TOK_BIN_SHL, "BIN_SHL", true)
+PARSER_TOKEN(TOK_BIN_SHR, "BIN_SHR", true)
+PARSER_TOKEN(TOK_BIN_XOR, "BIN_XOR", true)
+PARSER_TOKEN(TOK_BINARY, "BINARY", false)
+PARSER_TOKEN(TOK_BIND, "BIND", true)
+PARSER_TOKEN(TOK_BIT_LENGTH, "BIT_LENGTH", false)
+PARSER_TOKEN(TOK_BLOB, "BLOB", false)
+PARSER_TOKEN(TOK_BLOB_APPEND, "BLOB_APPEND", true)
+PARSER_TOKEN(TOK_BLOCK, "BLOCK", true)
+PARSER_TOKEN(TOK_BODY, "BODY", true)
+PARSER_TOKEN(TOK_BOOLEAN, "BOOLEAN", false)
+PARSER_TOKEN(TOK_BOTH, "BOTH", false)
+PARSER_TOKEN(TOK_BREAK, "BREAK", true)
+PARSER_TOKEN(TOK_BY, "BY", false)
+PARSER_TOKEN(TOK_CALLER, "CALLER", true)
+PARSER_TOKEN(TOK_CASCADE, "CASCADE", true)
+PARSER_TOKEN(TOK_CASE, "CASE", false)
+PARSER_TOKEN(TOK_CAST, "CAST", false)
+PARSER_TOKEN(TOK_CEIL, "CEIL", true) // Alias of CEILING
+PARSER_TOKEN(TOK_CEIL, "CEILING", true)
+PARSER_TOKEN(TOK_CHAR, "CHAR", false)
+PARSER_TOKEN(TOK_CHAR_LENGTH, "CHAR_LENGTH", false)
+PARSER_TOKEN(TOK_CHAR_TO_UUID, "CHAR_TO_UUID", true)
+PARSER_TOKEN(TOK_CHARACTER, "CHARACTER", false)
+PARSER_TOKEN(TOK_CHARACTER_LENGTH, "CHARACTER_LENGTH", false)
+PARSER_TOKEN(TOK_CHECK, "CHECK", false)
+PARSER_TOKEN(TOK_CLEAR, "CLEAR", true)
+PARSER_TOKEN(TOK_CLOSE, "CLOSE", false)
+PARSER_TOKEN(TOK_COALESCE, "COALESCE", true)
+PARSER_TOKEN(TOK_COLLATE, "COLLATE", false)
+PARSER_TOKEN(TOK_COLLATION, "COLLATION", true)
+PARSER_TOKEN(TOK_COLUMN, "COLUMN", false)
+PARSER_TOKEN(TOK_COMMENT, "COMMENT", false)
+PARSER_TOKEN(TOK_COMMIT, "COMMIT", false)
+PARSER_TOKEN(TOK_COMMITTED, "COMMITTED", true)
+PARSER_TOKEN(TOK_COMMON, "COMMON", true)
+PARSER_TOKEN(TOK_COMPARE_DECFLOAT, "COMPARE_DECFLOAT", true)
+PARSER_TOKEN(TOK_COMPUTED, "COMPUTED", true)
+PARSER_TOKEN(TOK_CONDITIONAL, "CONDITIONAL", true)
+PARSER_TOKEN(TOK_CONNECT, "CONNECT", false)
+PARSER_TOKEN(TOK_CONNECTIONS, "CONNECTIONS", true)
+PARSER_TOKEN(TOK_CONSISTENCY, "CONSISTENCY", true)
+PARSER_TOKEN(TOK_CONSTRAINT, "CONSTRAINT", false)
+PARSER_TOKEN(TOK_CONTAINING, "CONTAINING", true)
+PARSER_TOKEN(TOK_CONTINUE, "CONTINUE", true)
+PARSER_TOKEN(TOK_CORR, "CORR", false)
+PARSER_TOKEN(TOK_COS, "COS", true)
+PARSER_TOKEN(TOK_COSH, "COSH", true)
+PARSER_TOKEN(TOK_COT, "COT", true)
+PARSER_TOKEN(TOK_COUNT, "COUNT", false)
+PARSER_TOKEN(TOK_COUNTER, "COUNTER", true)
+PARSER_TOKEN(TOK_COVAR_POP, "COVAR_POP", false)
+PARSER_TOKEN(TOK_COVAR_SAMP, "COVAR_SAMP", false)
+PARSER_TOKEN(TOK_CREATE, "CREATE", false)
+PARSER_TOKEN(TOK_CROSS, "CROSS", false)
+PARSER_TOKEN(TOK_CRYPT_HASH, "CRYPT_HASH", true)
+PARSER_TOKEN(TOK_CSTRING, "CSTRING", true)
+PARSER_TOKEN(TOK_CTR_BIG_ENDIAN, "CTR_BIG_ENDIAN", true)
+PARSER_TOKEN(TOK_CTR_LENGTH, "CTR_LENGTH", true)
+PARSER_TOKEN(TOK_CTR_LITTLE_ENDIAN, "CTR_LITTLE_ENDIAN", true)
+PARSER_TOKEN(TOK_CUME_DIST, "CUME_DIST", true)
+PARSER_TOKEN(TOK_CURRENT, "CURRENT", false)
+PARSER_TOKEN(TOK_CURRENT_CONNECTION, "CURRENT_CONNECTION", false)
+PARSER_TOKEN(TOK_CURRENT_DATE, "CURRENT_DATE", false)
+PARSER_TOKEN(TOK_CURRENT_ROLE, "CURRENT_ROLE", false)
+PARSER_TOKEN(TOK_CURRENT_TIME, "CURRENT_TIME", false)
+PARSER_TOKEN(TOK_CURRENT_TIMESTAMP, "CURRENT_TIMESTAMP", false)
+PARSER_TOKEN(TOK_CURRENT_TRANSACTION, "CURRENT_TRANSACTION", false)
+PARSER_TOKEN(TOK_CURRENT_USER, "CURRENT_USER", false)
+PARSER_TOKEN(TOK_CURSOR, "CURSOR", false)
+PARSER_TOKEN(TOK_DATABASE, "DATABASE", true)
+PARSER_TOKEN(TOK_DATA, "DATA", true)
+PARSER_TOKEN(TOK_DATE, "DATE", false)
+PARSER_TOKEN(TOK_DATEADD, "DATEADD", true)
+PARSER_TOKEN(TOK_DATEDIFF, "DATEDIFF", true)
+PARSER_TOKEN(TOK_DAY, "DAY", false)
+PARSER_TOKEN(TOK_DDL, "DDL", true)
+PARSER_TOKEN(TOK_DEBUG, "DEBUG", true)
+PARSER_TOKEN(TOK_DEC, "DEC", false)
+PARSER_TOKEN(TOK_DECFLOAT, "DECFLOAT", false)
+PARSER_TOKEN(TOK_DECIMAL, "DECIMAL", false)
+PARSER_TOKEN(TOK_DECLARE, "DECLARE", false)
+PARSER_TOKEN(TOK_DECODE, "DECODE", true)
+PARSER_TOKEN(TOK_DECRYPT, "DECRYPT", true)
+PARSER_TOKEN(TOK_DEFAULT, "DEFAULT", false)
+PARSER_TOKEN(TOK_DEFINER, "DEFINER", true)
+PARSER_TOKEN(TOK_DELETE, "DELETE", false)
+PARSER_TOKEN(TOK_DELETING, "DELETING", false)
+PARSER_TOKEN(TOK_DENSE_RANK, "DENSE_RANK", true)
+PARSER_TOKEN(TOK_DESC, "DESC", true) // Alias of DESCENDING
+PARSER_TOKEN(TOK_DESC, "DESCENDING", true)
+PARSER_TOKEN(TOK_DESCRIPTOR, "DESCRIPTOR", true)
+PARSER_TOKEN(TOK_DETERMINISTIC, "DETERMINISTIC", false)
+PARSER_TOKEN(TOK_DIFFERENCE, "DIFFERENCE", true)
+PARSER_TOKEN(TOK_DISABLE, "DISABLE", true)
+PARSER_TOKEN(TOK_DISCONNECT, "DISCONNECT", false)
+PARSER_TOKEN(TOK_DISTINCT, "DISTINCT", false)
+PARSER_TOKEN(TOK_DO, "DO", true)
+PARSER_TOKEN(TOK_DOMAIN, "DOMAIN", true)
+PARSER_TOKEN(TOK_DOUBLE, "DOUBLE", false)
+PARSER_TOKEN(TOK_DROP, "DROP", false)
+PARSER_TOKEN(TOK_ELSE, "ELSE", false)
+PARSER_TOKEN(TOK_ENABLE, "ENABLE", true)
+PARSER_TOKEN(TOK_ENCRYPT, "ENCRYPT", true)
+PARSER_TOKEN(TOK_END, "END", false)
+PARSER_TOKEN(TOK_ENGINE, "ENGINE", true)
+PARSER_TOKEN(TOK_ENTRY_POINT, "ENTRY_POINT", true)
+PARSER_TOKEN(TOK_ESCAPE, "ESCAPE", false)
+PARSER_TOKEN(TOK_EXCEPTION, "EXCEPTION", true)
+PARSER_TOKEN(TOK_EXCESS, "EXCESS", true)
+PARSER_TOKEN(TOK_EXCLUDE, "EXCLUDE", true)
+PARSER_TOKEN(TOK_EXECUTE, "EXECUTE", false)
+PARSER_TOKEN(TOK_EXISTS, "EXISTS", false)
+PARSER_TOKEN(TOK_EXIT, "EXIT", true)
+PARSER_TOKEN(TOK_EXP, "EXP", true)
+PARSER_TOKEN(TOK_EXTENDED, "EXTENDED", true)
+PARSER_TOKEN(TOK_EXTERNAL, "EXTERNAL", false)
+PARSER_TOKEN(TOK_EXTRACT, "EXTRACT", false)
+PARSER_TOKEN(TOK_FALSE, "FALSE", false)
+PARSER_TOKEN(TOK_FETCH, "FETCH", false)
+PARSER_TOKEN(TOK_FILE, "FILE", true)
+PARSER_TOKEN(TOK_FILTER, "FILTER", false)
+PARSER_TOKEN(TOK_FIRST, "FIRST", true)
+PARSER_TOKEN(TOK_FIRST_DAY, "FIRST_DAY", true)
+PARSER_TOKEN(TOK_FIRST_VALUE, "FIRST_VALUE", true)
+PARSER_TOKEN(TOK_FIRSTNAME, "FIRSTNAME", true)
+PARSER_TOKEN(TOK_FLOAT, "FLOAT", false)
+PARSER_TOKEN(TOK_FLOOR, "FLOOR", true)
+PARSER_TOKEN(TOK_FOLLOWING, "FOLLOWING", true)
+PARSER_TOKEN(TOK_FOR, "FOR", false)
+PARSER_TOKEN(TOK_FOREIGN, "FOREIGN", false)
+PARSER_TOKEN(TOK_FREE_IT, "FREE_IT", true)
+PARSER_TOKEN(TOK_FROM, "FROM", false)
+PARSER_TOKEN(TOK_FULL, "FULL", false)
+PARSER_TOKEN(TOK_FUNCTION, "FUNCTION", false)
+PARSER_TOKEN(TOK_GDSCODE, "GDSCODE", false)
+PARSER_TOKEN(TOK_GENERATED, "GENERATED", true)
+PARSER_TOKEN(TOK_GENERATOR, "GENERATOR", true)
+PARSER_TOKEN(TOK_GEN_ID, "GEN_ID", true)
+PARSER_TOKEN(TOK_GEN_UUID, "GEN_UUID", true)
+PARSER_TOKEN(TOK_GLOBAL, "GLOBAL", false)
+PARSER_TOKEN(TOK_GRANT, "GRANT", false)
+PARSER_TOKEN(TOK_GRANTED, "GRANTED", true)
+PARSER_TOKEN(TOK_GROUP, "GROUP", false)
+PARSER_TOKEN(TOK_HASH, "HASH", true)
+PARSER_TOKEN(TOK_HAVING, "HAVING", false)
+PARSER_TOKEN(TOK_HEX_DECODE, "HEX_DECODE", true)
+PARSER_TOKEN(TOK_HEX_ENCODE, "HEX_ENCODE", true)
+PARSER_TOKEN(TOK_HOUR, "HOUR", false)
+PARSER_TOKEN(TOK_IDENTITY, "IDENTITY", true)
+PARSER_TOKEN(TOK_IDLE, "IDLE", true)
+PARSER_TOKEN(TOK_IF, "IF", true)
+PARSER_TOKEN(TOK_IGNORE, "IGNORE", true)
+PARSER_TOKEN(TOK_IIF, "IIF", true)
+PARSER_TOKEN(TOK_IN, "IN", false)
+PARSER_TOKEN(TOK_INACTIVE, "INACTIVE", true)
+PARSER_TOKEN(TOK_INCLUDE, "INCLUDE", true)
+PARSER_TOKEN(TOK_INCREMENT, "INCREMENT", true)
+PARSER_TOKEN(TOK_INDEX, "INDEX", false)
+PARSER_TOKEN(TOK_INNER, "INNER", false)
+PARSER_TOKEN(TOK_INPUT_TYPE, "INPUT_TYPE", true)
+PARSER_TOKEN(TOK_INSENSITIVE, "INSENSITIVE", false)
+PARSER_TOKEN(TOK_INSERT, "INSERT", false)
+PARSER_TOKEN(TOK_INSERTING, "INSERTING", false)
+PARSER_TOKEN(TOK_INT, "INT", false)
+PARSER_TOKEN(TOK_INT128, "INT128", false)
+PARSER_TOKEN(TOK_INTEGER, "INTEGER", false)
+PARSER_TOKEN(TOK_INTO, "INTO", false)
+PARSER_TOKEN(TOK_INVOKER, "INVOKER", true)
+PARSER_TOKEN(TOK_IS, "IS", false)
+PARSER_TOKEN(TOK_ISOLATION, "ISOLATION", true)
+PARSER_TOKEN(TOK_IV, "IV", true)
+PARSER_TOKEN(TOK_JOIN, "JOIN", false)
+PARSER_TOKEN(TOK_KEY, "KEY", true)
+PARSER_TOKEN(TOK_LAG, "LAG", true)
+PARSER_TOKEN(TOK_LAST, "LAST", true)
+PARSER_TOKEN(TOK_LAST_DAY, "LAST_DAY", true)
+PARSER_TOKEN(TOK_LAST_VALUE, "LAST_VALUE", true)
+PARSER_TOKEN(TOK_LASTNAME, "LASTNAME", true)
+PARSER_TOKEN(TOK_LEAD, "LEAD", true)
+PARSER_TOKEN(TOK_LEADING, "LEADING", false)
+PARSER_TOKEN(TOK_LEAVE, "LEAVE", true)
+PARSER_TOKEN(TOK_LEFT, "LEFT", false)
+PARSER_TOKEN(TOK_LEGACY, "LEGACY", true)
+PARSER_TOKEN(TOK_LENGTH, "LENGTH", true)
+PARSER_TOKEN(TOK_LEVEL, "LEVEL", true)
+PARSER_TOKEN(TOK_LIFETIME, "LIFETIME", true)
+PARSER_TOKEN(TOK_LIKE, "LIKE", false)
+PARSER_TOKEN(TOK_LIMBO, "LIMBO", true)
+PARSER_TOKEN(TOK_LINGER, "LINGER", true)
+PARSER_TOKEN(TOK_LIST, "LIST", true)
+PARSER_TOKEN(TOK_LN, "LN", true)
+PARSER_TOKEN(TOK_LATERAL, "LATERAL", false)
+PARSER_TOKEN(TOK_LOCAL, "LOCAL", false)
+PARSER_TOKEN(TOK_LOCALTIME, "LOCALTIME", false)
+PARSER_TOKEN(TOK_LOCALTIMESTAMP, "LOCALTIMESTAMP", false)
+PARSER_TOKEN(TOK_LOCK, "LOCK", true)
+PARSER_TOKEN(TOK_LOCKED, "LOCKED", true)
+PARSER_TOKEN(TOK_LOG, "LOG", true)
+PARSER_TOKEN(TOK_LOG10, "LOG10", true)
+PARSER_TOKEN(TOK_LONG, "LONG", false)
+PARSER_TOKEN(TOK_LOWER, "LOWER", false)
+PARSER_TOKEN(TOK_LPAD, "LPAD", true)
+PARSER_TOKEN(TOK_LPARAM, "LPARAM", true)
+PARSER_TOKEN(TOK_MAKE_DBKEY, "MAKE_DBKEY", true)
+PARSER_TOKEN(TOK_MANUAL, "MANUAL", true)
+PARSER_TOKEN(TOK_MAPPING, "MAPPING", true)
+PARSER_TOKEN(TOK_MATCHED, "MATCHED", true)
+PARSER_TOKEN(TOK_MATCHING, "MATCHING", true)
+PARSER_TOKEN(TOK_MAXIMUM, "MAX", false)
+PARSER_TOKEN(TOK_MAXVALUE, "MAXVALUE", true)
+PARSER_TOKEN(TOK_MERGE, "MERGE", false)
+PARSER_TOKEN(TOK_MESSAGE, "MESSAGE", true)
+PARSER_TOKEN(TOK_MILLISECOND, "MILLISECOND", true)
+PARSER_TOKEN(TOK_MIDDLENAME, "MIDDLENAME", true)
+PARSER_TOKEN(TOK_MINIMUM, "MIN", false)
+PARSER_TOKEN(TOK_MINUTE, "MINUTE", false)
+PARSER_TOKEN(TOK_MINVALUE, "MINVALUE", true)
+PARSER_TOKEN(TOK_MOD, "MOD", true)
+PARSER_TOKEN(TOK_MODE, "MODE", true)
+PARSER_TOKEN(TOK_MODULE_NAME, "MODULE_NAME", true)
+PARSER_TOKEN(TOK_MONTH, "MONTH", false)
+PARSER_TOKEN(TOK_NAME, "NAME", true)
+PARSER_TOKEN(TOK_NAMES, "NAMES", true)
+PARSER_TOKEN(TOK_NATIONAL, "NATIONAL", false)
+PARSER_TOKEN(TOK_NATIVE, "NATIVE", true)
+PARSER_TOKEN(TOK_NATURAL, "NATURAL", false)
+PARSER_TOKEN(TOK_NCHAR, "NCHAR", false)
+PARSER_TOKEN(TOK_NEXT, "NEXT", true)
+PARSER_TOKEN(TOK_NO, "NO", false)
+PARSER_TOKEN(TOK_NORMALIZE_DECFLOAT, "NORMALIZE_DECFLOAT", true)
+PARSER_TOKEN(TOK_NOT, "NOT", false)
+PARSER_TOKEN(TOK_NTH_VALUE, "NTH_VALUE", true)
+PARSER_TOKEN(TOK_NTILE, "NTILE", true)
+PARSER_TOKEN(TOK_NULLIF, "NULLIF", true)
+PARSER_TOKEN(TOK_NULL, "NULL", false)
+PARSER_TOKEN(TOK_NULLS, "NULLS", true)
+PARSER_TOKEN(TOK_NUMBER, "NUMBER", true)
+PARSER_TOKEN(TOK_NUMERIC, "NUMERIC", false)
+PARSER_TOKEN(TOK_OCTET_LENGTH, "OCTET_LENGTH", false)
+PARSER_TOKEN(TOK_OF, "OF", false)
+PARSER_TOKEN(TOK_OFFSET, "OFFSET", false)
+PARSER_TOKEN(TOK_OLDEST, "OLDEST", true)
+PARSER_TOKEN(TOK_ON, "ON", false)
+PARSER_TOKEN(TOK_ONLY, "ONLY", false)
+PARSER_TOKEN(TOK_OPEN, "OPEN", false)
+PARSER_TOKEN(TOK_OPTIMIZE, "OPTIMIZE", true)
+PARSER_TOKEN(TOK_OPTION, "OPTION", true)
+PARSER_TOKEN(TOK_OR, "OR", false)
+PARSER_TOKEN(TOK_ORDER, "ORDER", false)
+PARSER_TOKEN(TOK_OS_NAME, "OS_NAME", true)
+PARSER_TOKEN(TOK_OTHERS, "OTHERS", true)
+PARSER_TOKEN(TOK_OUTER, "OUTER", false)
+PARSER_TOKEN(TOK_OUTPUT_TYPE, "OUTPUT_TYPE", true)
+PARSER_TOKEN(TOK_OVER, "OVER", false)
+PARSER_TOKEN(TOK_OVERFLOW, "OVERFLOW", true)
+PARSER_TOKEN(TOK_OVERLAY, "OVERLAY", true)
+PARSER_TOKEN(TOK_OVERRIDING, "OVERRIDING", true)
+PARSER_TOKEN(TOK_PACKAGE, "PACKAGE", true)
+PARSER_TOKEN(TOK_PAD, "PAD", true)
+PARSER_TOKEN(TOK_PAGE, "PAGE", true)
+PARSER_TOKEN(TOK_PAGES, "PAGES", true)
+PARSER_TOKEN(TOK_PAGE_SIZE, "PAGE_SIZE", true)
+PARSER_TOKEN(TOK_PARAMETER, "PARAMETER", false)
+PARSER_TOKEN(TOK_PARTITION, "PARTITION", true)
+PARSER_TOKEN(TOK_PASSWORD, "PASSWORD", true)
+PARSER_TOKEN(TOK_PERCENT_RANK, "PERCENT_RANK", true)
+PARSER_TOKEN(TOK_PI, "PI", true)
+PARSER_TOKEN(TOK_PKCS_1_5, "PKCS_1_5", true)
+PARSER_TOKEN(TOK_PLACING, "PLACING", true)
+PARSER_TOKEN(TOK_PLAN, "PLAN", false)
+PARSER_TOKEN(TOK_PLUGIN, "PLUGIN", true)
+PARSER_TOKEN(TOK_POOL, "POOL", true)
+PARSER_TOKEN(TOK_POSITION, "POSITION", false)
+PARSER_TOKEN(TOK_POST_EVENT, "POST_EVENT", false)
+PARSER_TOKEN(TOK_POWER, "POWER", true)
+PARSER_TOKEN(TOK_PRECEDING, "PRECEDING", true)
+PARSER_TOKEN(TOK_PRECISION, "PRECISION", false)
+PARSER_TOKEN(TOK_PRESERVE, "PRESERVE", true)
+PARSER_TOKEN(TOK_PRIMARY, "PRIMARY", false)
+PARSER_TOKEN(TOK_PRIOR, "PRIOR", true)
+PARSER_TOKEN(TOK_PRIVILEGE, "PRIVILEGE", true)
+PARSER_TOKEN(TOK_PRIVILEGES, "PRIVILEGES", true)
+PARSER_TOKEN(TOK_PROCEDURE, "PROCEDURE", false)
+PARSER_TOKEN(TOK_PROTECTED, "PROTECTED", true)
+PARSER_TOKEN(TOK_PUBLICATION, "PUBLICATION", false)
+PARSER_TOKEN(TOK_QUANTIZE, "QUANTIZE", true)
+PARSER_TOKEN(TOK_QUARTER, "QUARTER", true)
+PARSER_TOKEN(TOK_RAND, "RAND", true)
+PARSER_TOKEN(TOK_RANGE, "RANGE", true)
+PARSER_TOKEN(TOK_RANK, "RANK", true)
+PARSER_TOKEN(TOK_DB_KEY, "RDB$DB_KEY", false)
+PARSER_TOKEN(TOK_RDB_ERROR, "RDB$ERROR", false)
+PARSER_TOKEN(TOK_RDB_GET_CONTEXT, "RDB$GET_CONTEXT", false)
+PARSER_TOKEN(TOK_RDB_GET_TRANSACTION_CN, "RDB$GET_TRANSACTION_CN", false)
+PARSER_TOKEN(TOK_RDB_RECORD_VERSION, "RDB$RECORD_VERSION", false)
+PARSER_TOKEN(TOK_RDB_ROLE_IN_USE, "RDB$ROLE_IN_USE", false)
+PARSER_TOKEN(TOK_RDB_SET_CONTEXT, "RDB$SET_CONTEXT", false)
+PARSER_TOKEN(TOK_RDB_SYSTEM_PRIVILEGE, "RDB$SYSTEM_PRIVILEGE", false)
+PARSER_TOKEN(TOK_READ, "READ", true)
+PARSER_TOKEN(TOK_REAL, "REAL", false)
+PARSER_TOKEN(TOK_VERSION, "RECORD_VERSION", false)
+PARSER_TOKEN(TOK_RECREATE, "RECREATE", false)
+PARSER_TOKEN(TOK_RECURSIVE, "RECURSIVE", false)
+PARSER_TOKEN(TOK_REFERENCES, "REFERENCES", false)
+PARSER_TOKEN(TOK_REGR_AVGX, "REGR_AVGX", false)
+PARSER_TOKEN(TOK_REGR_AVGY, "REGR_AVGY", false)
+PARSER_TOKEN(TOK_REGR_COUNT, "REGR_COUNT", false)
+PARSER_TOKEN(TOK_REGR_INTERCEPT, "REGR_INTERCEPT", false)
+PARSER_TOKEN(TOK_REGR_R2, "REGR_R2", false)
+PARSER_TOKEN(TOK_REGR_SLOPE, "REGR_SLOPE", false)
+PARSER_TOKEN(TOK_REGR_SXX, "REGR_SXX", false)
+PARSER_TOKEN(TOK_REGR_SXY, "REGR_SXY", false)
+PARSER_TOKEN(TOK_REGR_SYY, "REGR_SYY", false)
+PARSER_TOKEN(TOK_RELATIVE, "RELATIVE", true)
+PARSER_TOKEN(TOK_RELEASE, "RELEASE", false)
+PARSER_TOKEN(TOK_REPLACE, "REPLACE", true)
+PARSER_TOKEN(TOK_REQUESTS, "REQUESTS", true)
+PARSER_TOKEN(TOK_RESERVING, "RESERV", true) // Alias of RESERVING
+PARSER_TOKEN(TOK_RESERVING, "RESERVING", true)
+PARSER_TOKEN(TOK_RESET, "RESET", true)
+PARSER_TOKEN(TOK_RESETTING, "RESETTING", false)
+PARSER_TOKEN(TOK_RESTART, "RESTART", true)
+PARSER_TOKEN(TOK_RESTRICT, "RESTRICT", true)
+PARSER_TOKEN(TOK_RETAIN, "RETAIN", true)
+PARSER_TOKEN(TOK_RETURN, "RETURN", false)
+PARSER_TOKEN(TOK_RETURNING, "RETURNING", true)
+PARSER_TOKEN(TOK_RETURNING_VALUES, "RETURNING_VALUES", false)
+PARSER_TOKEN(TOK_RETURNS, "RETURNS", false)
+PARSER_TOKEN(TOK_REVERSE, "REVERSE", true)
+PARSER_TOKEN(TOK_REVOKE, "REVOKE", false)
+PARSER_TOKEN(TOK_RIGHT, "RIGHT", false)
+PARSER_TOKEN(TOK_ROLE, "ROLE", true)
+PARSER_TOKEN(TOK_ROLLBACK, "ROLLBACK", false)
+PARSER_TOKEN(TOK_ROUND, "ROUND", true)
+PARSER_TOKEN(TOK_ROW, "ROW", false)
+PARSER_TOKEN(TOK_ROW_COUNT, "ROW_COUNT", false)
+PARSER_TOKEN(TOK_ROW_NUMBER, "ROW_NUMBER", true)
+PARSER_TOKEN(TOK_ROWS, "ROWS", false)
+PARSER_TOKEN(TOK_RPAD, "RPAD", true)
+PARSER_TOKEN(TOK_RSA_DECRYPT, "RSA_DECRYPT", true)
+PARSER_TOKEN(TOK_RSA_ENCRYPT, "RSA_ENCRYPT", true)
+PARSER_TOKEN(TOK_RSA_PRIVATE, "RSA_PRIVATE", true)
+PARSER_TOKEN(TOK_RSA_PUBLIC, "RSA_PUBLIC", true)
+PARSER_TOKEN(TOK_RSA_SIGN_HASH, "RSA_SIGN_HASH", true)
+PARSER_TOKEN(TOK_RSA_VERIFY_HASH, "RSA_VERIFY_HASH", true)
+PARSER_TOKEN(TOK_SALT_LENGTH, "SALT_LENGTH", true)
+PARSER_TOKEN(TOK_SAVEPOINT, "SAVEPOINT", false)
+PARSER_TOKEN(TOK_SCALAR_ARRAY, "SCALAR_ARRAY", true)
+PARSER_TOKEN(TOK_DATABASE, "SCHEMA", false) // Alias of DATABASE
+PARSER_TOKEN(TOK_SCROLL, "SCROLL", false)
+PARSER_TOKEN(TOK_SECOND, "SECOND", false)
+PARSER_TOKEN(TOK_SECURITY, "SECURITY", true)
+PARSER_TOKEN(TOK_SEGMENT, "SEGMENT", true)
+PARSER_TOKEN(TOK_SELECT, "SELECT", false)
+PARSER_TOKEN(TOK_SENSITIVE, "SENSITIVE", false)
+PARSER_TOKEN(TOK_SEQUENCE, "SEQUENCE", true)
+PARSER_TOKEN(TOK_SERVERWIDE, "SERVERWIDE", true)
+PARSER_TOKEN(TOK_SESSION, "SESSION", true)
+PARSER_TOKEN(TOK_SET, "SET", false)
+PARSER_TOKEN(TOK_SHADOW, "SHADOW", true)
+PARSER_TOKEN(TOK_SHARED, "SHARED", true)
+PARSER_TOKEN(TOK_SIGN, "SIGN", true)
+PARSER_TOKEN(TOK_SIGNATURE, "SIGNATURE", true)
+PARSER_TOKEN(TOK_SIMILAR, "SIMILAR", false)
+PARSER_TOKEN(TOK_SIN, "SIN", true)
+PARSER_TOKEN(TOK_SINGULAR, "SINGULAR", true)
+PARSER_TOKEN(TOK_SINH, "SINH", true)
+PARSER_TOKEN(TOK_SIZE, "SIZE", true)
+PARSER_TOKEN(TOK_SKIP, "SKIP", true)
+PARSER_TOKEN(TOK_SMALLINT, "SMALLINT", false)
+PARSER_TOKEN(TOK_SNAPSHOT, "SNAPSHOT", true)
+PARSER_TOKEN(TOK_SOME, "SOME", false)
+PARSER_TOKEN(TOK_SORT, "SORT", true)
+PARSER_TOKEN(TOK_SOURCE, "SOURCE", true)
+PARSER_TOKEN(TOK_SPACE, "SPACE", true)
+PARSER_TOKEN(TOK_SQL, "SQL", true)
+PARSER_TOKEN(TOK_SQLCODE, "SQLCODE", false)
+PARSER_TOKEN(TOK_SQLSTATE, "SQLSTATE", false)
+PARSER_TOKEN(TOK_SQRT, "SQRT", true)
+PARSER_TOKEN(TOK_STABILITY, "STABILITY", true)
+PARSER_TOKEN(TOK_START, "START", false)
+PARSER_TOKEN(TOK_STARTING, "STARTING", true)
+PARSER_TOKEN(TOK_STARTING, "STARTS", true) // Alias of STARTING
+PARSER_TOKEN(TOK_STATEMENT, "STATEMENT", true)
+PARSER_TOKEN(TOK_STATISTICS, "STATISTICS", true)
+PARSER_TOKEN(TOK_STDDEV_POP, "STDDEV_POP", false)
+PARSER_TOKEN(TOK_STDDEV_SAMP, "STDDEV_SAMP", false)
+PARSER_TOKEN(TOK_SUBSTRING, "SUBSTRING", true)
+PARSER_TOKEN(TOK_SUB_TYPE, "SUB_TYPE", true)
+PARSER_TOKEN(TOK_SUM, "SUM", false)
+PARSER_TOKEN(TOK_SUSPEND, "SUSPEND", true)
+PARSER_TOKEN(TOK_SYSTEM, "SYSTEM", true)
+PARSER_TOKEN(TOK_TABLE, "TABLE", false)
+PARSER_TOKEN(TOK_TAGS, "TAGS", true)
+PARSER_TOKEN(TOK_TAN, "TAN", true)
+PARSER_TOKEN(TOK_TANH, "TANH", true)
+PARSER_TOKEN(TOK_TARGET, "TARGET", true)
+PARSER_TOKEN(TOK_TEMPORARY, "TEMPORARY", true)
+PARSER_TOKEN(TOK_THEN, "THEN", false)
+PARSER_TOKEN(TOK_TIES, "TIES", true)
+PARSER_TOKEN(TOK_TIME, "TIME", false)
+PARSER_TOKEN(TOK_TIMESTAMP, "TIMESTAMP", false)
+PARSER_TOKEN(TOK_TIMEOUT, "TIMEOUT", true)
+PARSER_TOKEN(TOK_TIMEZONE_HOUR, "TIMEZONE_HOUR", false)
+PARSER_TOKEN(TOK_TIMEZONE_MINUTE, "TIMEZONE_MINUTE", false)
+PARSER_TOKEN(TOK_TIMEZONE_NAME, "TIMEZONE_NAME", true)
+PARSER_TOKEN(TOK_TO, "TO", false)
+PARSER_TOKEN(TOK_TOTALORDER, "TOTALORDER", true)
+PARSER_TOKEN(TOK_TRAILING, "TRAILING", false)
+PARSER_TOKEN(TOK_TRANSACTION, "TRANSACTION", true)
+PARSER_TOKEN(TOK_TRAPS, "TRAPS", true)
+PARSER_TOKEN(TOK_TRIGGER, "TRIGGER", false)
+PARSER_TOKEN(TOK_TRIM, "TRIM", false)
+PARSER_TOKEN(TOK_TRUE, "TRUE", false)
+PARSER_TOKEN(TOK_TRUNC, "TRUNC", true)
+PARSER_TOKEN(TOK_TRUSTED, "TRUSTED", true)
+PARSER_TOKEN(TOK_TWO_PHASE, "TWO_PHASE", true)
+PARSER_TOKEN(TOK_TYPE, "TYPE", true)
+PARSER_TOKEN(TOK_UNBOUNDED, "UNBOUNDED", false)
+PARSER_TOKEN(TOK_UNCOMMITTED, "UNCOMMITTED", true)
+PARSER_TOKEN(TOK_UNDO, "UNDO", true)
+PARSER_TOKEN(TOK_UNICODE_CHAR, "UNICODE_CHAR", true)
+PARSER_TOKEN(TOK_UNICODE_VAL, "UNICODE_VAL", true)
+PARSER_TOKEN(TOK_UNION, "UNION", false)
+PARSER_TOKEN(TOK_UNIQUE, "UNIQUE", false)
+PARSER_TOKEN(TOK_UNKNOWN, "UNKNOWN", false)
+PARSER_TOKEN(TOK_UPDATE, "UPDATE", false)
+PARSER_TOKEN(TOK_UPDATING, "UPDATING", false)
+PARSER_TOKEN(TOK_UPPER, "UPPER", false)
+PARSER_TOKEN(TOK_USAGE, "USAGE", true)
+PARSER_TOKEN(TOK_USER, "USER", false)
+PARSER_TOKEN(TOK_USING, "USING", false)
+PARSER_TOKEN(TOK_UUID_TO_CHAR, "UUID_TO_CHAR", true)
+PARSER_TOKEN(TOK_VALUE, "VALUE", false)
+PARSER_TOKEN(TOK_VALUES, "VALUES", false)
+PARSER_TOKEN(TOK_VAR_POP, "VAR_POP", false)
+PARSER_TOKEN(TOK_VAR_SAMP, "VAR_SAMP", false)
+PARSER_TOKEN(TOK_VARBINARY, "VARBINARY", false)
+PARSER_TOKEN(TOK_VARCHAR, "VARCHAR", false)
+PARSER_TOKEN(TOK_VARIABLE, "VARIABLE", false)
+PARSER_TOKEN(TOK_VARYING, "VARYING", false)
+PARSER_TOKEN(TOK_VIEW, "VIEW", false)
+PARSER_TOKEN(TOK_WAIT, "WAIT", true)
+PARSER_TOKEN(TOK_WEEK, "WEEK", true)
+PARSER_TOKEN(TOK_WEEKDAY, "WEEKDAY", true)
+PARSER_TOKEN(TOK_WHEN, "WHEN", false)
+PARSER_TOKEN(TOK_WHERE, "WHERE", false)
+PARSER_TOKEN(TOK_WHILE, "WHILE", false)
+PARSER_TOKEN(TOK_WINDOW, "WINDOW", false)
+PARSER_TOKEN(TOK_WITH, "WITH", false)
+PARSER_TOKEN(TOK_WITHOUT, "WITHOUT", false)
+PARSER_TOKEN(TOK_WORK, "WORK", true)
+PARSER_TOKEN(TOK_WRITE, "WRITE", true)
+PARSER_TOKEN(TOK_YEAR, "YEAR", false)
+PARSER_TOKEN(TOK_YEARDAY, "YEARDAY", true)
+PARSER_TOKEN(TOK_ZONE, "ZONE", true)
+PARSER_TOKEN(TOK_NOT_LSS, "^<", false) // Alias of !<
+PARSER_TOKEN(TOK_NEQ, "^=", false) // Alias of !=
+PARSER_TOKEN(TOK_NOT_GTR, "^>", false) // Alias of !>
+PARSER_TOKEN(TOK_CONCATENATE, "||", false)
+PARSER_TOKEN(TOK_NOT_LSS, "~<", false) // Alias of !<
+PARSER_TOKEN(TOK_NEQ, "~=", false) // Alias of !=
+PARSER_TOKEN(TOK_NOT_GTR, "~>", false) // Alias of !>
diff --git a/src/common/keywords.h b/src/common/Token.h
similarity index 79%
rename from src/common/keywords.h
rename to src/common/Token.h
index 914b8ff8a0..9521d8a846 100644
--- a/src/common/keywords.h
+++ b/src/common/Token.h
@@ -19,20 +19,11 @@
* 2001.07.28 John Bellardo added tokens for FIRST and LIMIT
See dsql/parse.y for a chronological list. */
-/*
- * This file is included in parse.y and isql/isql.epp - at some point a
- * smarter way of doing it so only one instance is needed would be best.
- * MOD 29-Jun-2002
- */
-
-struct tok
+struct Token
{
USHORT tok_ident;
const char* tok_string;
bool nonReserved;
};
-typedef tok TOK;
-typedef const TOK* Tokens;
-
-Tokens keywordGetTokens();
+typedef const Token* ConstTokenPtr;
diff --git a/src/common/keywords.cpp b/src/common/keywords.cpp
deleted file mode 100644
index 9b6022cfcc..0000000000
--- a/src/common/keywords.cpp
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- * The contents of this file are subject to the Initial
- * Developer's Public License Version 1.0 (the "License");
- * you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
- *
- * Software distributed under the License is distributed AS IS,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied.
- * See the License for the specific language governing rights
- * and limitations under the License.
- *
- * The Original Code was created by Mark O'Donohue
- * for the Firebird Open Source RDBMS project.
- *
- * Copyright (c) 2002 Mark O'Donohue
- * and all contributors signed below.
- *
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- *
- * 2005.05.19 Claudio Valderrama: signal tokens that aren't reserved in the
- * engine thanks to special handling.
- * Adriano dos Santos Fernandes
- */
-
-#include "firebird.h"
-
-#ifdef HAVE_STRING_H
-#include
-#endif
-
-#define _yacc_defines_yystype
-#include "gen/parse.h"
-#include "keywords.h"
-
-// CVC: The latest column indicates whether the token has special handling in
-// the parser. If it does, KEYWORD_stringIsAToken will return false.
-// I discovered isql was being fooled and put double quotes around those
-// special cases unnecessarily.
-
-static const TOK tokens[] =
-{
- {TOK_NOT_LSS, "!<", false},
- {TOK_NEQ, "!=", false},
- {TOK_NOT_GTR, "!>", false},
- {'(', "(", false},
- {')', ")", false},
- {',', ",", false},
- {'<', "<", false},
- {TOK_LEQ, "<=", false},
- {TOK_NEQ, "<>", false}, // Alias of !=
- {'=', "=", false},
- {'>', ">", false},
- {TOK_GEQ, ">=", false},
- {TOK_BIND_PARAM, ":=", false},
- {TOK_ABS, "ABS", true},
- {TOK_ABSOLUTE, "ABSOLUTE", true},
- {TOK_ACCENT, "ACCENT", true},
- {TOK_ACOS, "ACOS", true},
- {TOK_ACOSH, "ACOSH", true},
- {TOK_ACTION, "ACTION", true},
- {TOK_ACTIVE, "ACTIVE", true},
- {TOK_ADD, "ADD", false},
- {TOK_ADMIN, "ADMIN", false},
- {TOK_AFTER, "AFTER", true},
- {TOK_ALL, "ALL", false},
- {TOK_ALTER, "ALTER", false},
- {TOK_ALWAYS, "ALWAYS", true},
- {TOK_AND, "AND", false},
- {TOK_ANY, "ANY", false},
- {TOK_AS, "AS", false},
- {TOK_ASC, "ASC", true}, // Alias of ASCENDING
- {TOK_ASC, "ASCENDING", true},
- {TOK_ASCII_CHAR, "ASCII_CHAR", true},
- {TOK_ASCII_VAL, "ASCII_VAL", true},
- {TOK_ASIN, "ASIN", true},
- {TOK_ASINH, "ASINH", true},
- {TOK_AT, "AT", false},
- {TOK_ATAN, "ATAN", true},
- {TOK_ATAN2, "ATAN2", true},
- {TOK_ATANH, "ATANH", true},
- {TOK_AUTO, "AUTO", true},
- {TOK_AUTONOMOUS, "AUTONOMOUS", true},
- {TOK_AVG, "AVG", false},
- {TOK_BACKUP, "BACKUP", true},
- {TOK_BASE64_DECODE, "BASE64_DECODE", true},
- {TOK_BASE64_ENCODE, "BASE64_ENCODE", true},
- {TOK_BEFORE, "BEFORE", true},
- {TOK_BEGIN, "BEGIN", false},
- {TOK_BETWEEN, "BETWEEN", false},
- {TOK_BIGINT, "BIGINT", false},
- {TOK_BIN_AND, "BIN_AND", true},
- {TOK_BIN_NOT, "BIN_NOT", true},
- {TOK_BIN_OR, "BIN_OR", true},
- {TOK_BIN_SHL, "BIN_SHL", true},
- {TOK_BIN_SHR, "BIN_SHR", true},
- {TOK_BIN_XOR, "BIN_XOR", true},
- {TOK_BINARY, "BINARY", false},
- {TOK_BIND, "BIND", true},
- {TOK_BIT_LENGTH, "BIT_LENGTH", false},
- {TOK_BLOB, "BLOB", false},
- {TOK_BLOB_APPEND, "BLOB_APPEND", true},
- {TOK_BLOCK, "BLOCK", true},
- {TOK_BODY, "BODY", true},
- {TOK_BOOLEAN, "BOOLEAN", false},
- {TOK_BOTH, "BOTH", false},
- {TOK_BREAK, "BREAK", true},
- {TOK_BY, "BY", false},
- {TOK_CALLER, "CALLER", true},
- {TOK_CASCADE, "CASCADE", true},
- {TOK_CASE, "CASE", false},
- {TOK_CAST, "CAST", false},
- {TOK_CEIL, "CEIL", true}, // Alias of CEILING
- {TOK_CEIL, "CEILING", true},
- {TOK_CHAR, "CHAR", false},
- {TOK_CHAR_LENGTH, "CHAR_LENGTH", false},
- {TOK_CHAR_TO_UUID, "CHAR_TO_UUID", true},
- {TOK_CHARACTER, "CHARACTER", false},
- {TOK_CHARACTER_LENGTH, "CHARACTER_LENGTH", false},
- {TOK_CHECK, "CHECK", false},
- {TOK_CLEAR, "CLEAR", true},
- {TOK_CLOSE, "CLOSE", false},
- {TOK_COALESCE, "COALESCE", true},
- {TOK_COLLATE, "COLLATE", false},
- {TOK_COLLATION, "COLLATION", true},
- {TOK_COLUMN, "COLUMN", false},
- {TOK_COMMENT, "COMMENT", false},
- {TOK_COMMIT, "COMMIT", false},
- {TOK_COMMITTED, "COMMITTED", true},
- {TOK_COMMON, "COMMON", true},
- {TOK_COMPARE_DECFLOAT, "COMPARE_DECFLOAT", true},
- {TOK_COMPUTED, "COMPUTED", true},
- {TOK_CONDITIONAL, "CONDITIONAL", true},
- {TOK_CONNECT, "CONNECT", false},
- {TOK_CONNECTIONS, "CONNECTIONS", true},
- {TOK_CONSISTENCY, "CONSISTENCY", true},
- {TOK_CONSTRAINT, "CONSTRAINT", false},
- {TOK_CONTAINING, "CONTAINING", true},
- {TOK_CONTINUE, "CONTINUE", true},
- {TOK_CORR, "CORR", false},
- {TOK_COS, "COS", true},
- {TOK_COSH, "COSH", true},
- {TOK_COT, "COT", true},
- {TOK_COUNT, "COUNT", false},
- {TOK_COUNTER, "COUNTER", true},
- {TOK_COVAR_POP, "COVAR_POP", false},
- {TOK_COVAR_SAMP, "COVAR_SAMP", false},
- {TOK_CREATE, "CREATE", false},
- {TOK_CROSS, "CROSS", false},
- {TOK_CRYPT_HASH, "CRYPT_HASH", true},
- {TOK_CSTRING, "CSTRING", true},
- {TOK_CTR_BIG_ENDIAN, "CTR_BIG_ENDIAN", true},
- {TOK_CTR_LENGTH, "CTR_LENGTH", true},
- {TOK_CTR_LITTLE_ENDIAN, "CTR_LITTLE_ENDIAN", true},
- {TOK_CUME_DIST, "CUME_DIST", true},
- {TOK_CURRENT, "CURRENT", false},
- {TOK_CURRENT_CONNECTION, "CURRENT_CONNECTION", false},
- {TOK_CURRENT_DATE, "CURRENT_DATE", false},
- {TOK_CURRENT_ROLE, "CURRENT_ROLE", false},
- {TOK_CURRENT_TIME, "CURRENT_TIME", false},
- {TOK_CURRENT_TIMESTAMP, "CURRENT_TIMESTAMP", false},
- {TOK_CURRENT_TRANSACTION, "CURRENT_TRANSACTION", false},
- {TOK_CURRENT_USER, "CURRENT_USER", false},
- {TOK_CURSOR, "CURSOR", false},
- {TOK_DATABASE, "DATABASE", true},
- {TOK_DATA, "DATA", true},
- {TOK_DATE, "DATE", false},
- {TOK_DATEADD, "DATEADD", true},
- {TOK_DATEDIFF, "DATEDIFF", true},
- {TOK_DAY, "DAY", false},
- {TOK_DDL, "DDL", true},
- {TOK_DEBUG, "DEBUG", true},
- {TOK_DEC, "DEC", false},
- {TOK_DECFLOAT, "DECFLOAT", false},
- {TOK_DECIMAL, "DECIMAL", false},
- {TOK_DECLARE, "DECLARE", false},
- {TOK_DECODE, "DECODE", true},
- {TOK_DECRYPT, "DECRYPT", true},
- {TOK_DEFAULT, "DEFAULT", false},
- {TOK_DEFINER, "DEFINER", true},
- {TOK_DELETE, "DELETE", false},
- {TOK_DELETING, "DELETING", false},
- {TOK_DENSE_RANK, "DENSE_RANK", true},
- {TOK_DESC, "DESC", true}, // Alias of DESCENDING
- {TOK_DESC, "DESCENDING", true},
- {TOK_DESCRIPTOR, "DESCRIPTOR", true},
- {TOK_DETERMINISTIC, "DETERMINISTIC", false},
- {TOK_DIFFERENCE, "DIFFERENCE", true},
- {TOK_DISABLE, "DISABLE", true},
- {TOK_DISCONNECT, "DISCONNECT", false},
- {TOK_DISTINCT, "DISTINCT", false},
- {TOK_DO, "DO", true},
- {TOK_DOMAIN, "DOMAIN", true},
- {TOK_DOUBLE, "DOUBLE", false},
- {TOK_DROP, "DROP", false},
- {TOK_ELSE, "ELSE", false},
- {TOK_ENABLE, "ENABLE", true},
- {TOK_ENCRYPT, "ENCRYPT", true},
- {TOK_END, "END", false},
- {TOK_ENGINE, "ENGINE", true},
- {TOK_ENTRY_POINT, "ENTRY_POINT", true},
- {TOK_ESCAPE, "ESCAPE", false},
- {TOK_EXCEPTION, "EXCEPTION", true},
- {TOK_EXCESS, "EXCESS", true},
- {TOK_EXCLUDE, "EXCLUDE", true},
- {TOK_EXECUTE, "EXECUTE", false},
- {TOK_EXISTS, "EXISTS", false},
- {TOK_EXIT, "EXIT", true},
- {TOK_EXP, "EXP", true},
- {TOK_EXTENDED, "EXTENDED", true},
- {TOK_EXTERNAL, "EXTERNAL", false},
- {TOK_EXTRACT, "EXTRACT", false},
- {TOK_FALSE, "FALSE", false},
- {TOK_FETCH, "FETCH", false},
- {TOK_FILE, "FILE", true},
- {TOK_FILTER, "FILTER", false},
- {TOK_FIRST, "FIRST", true},
- {TOK_FIRST_DAY, "FIRST_DAY", true},
- {TOK_FIRST_VALUE, "FIRST_VALUE", true},
- {TOK_FIRSTNAME, "FIRSTNAME", true},
- {TOK_FLOAT, "FLOAT", false},
- {TOK_FLOOR, "FLOOR", true},
- {TOK_FOLLOWING, "FOLLOWING", true},
- {TOK_FOR, "FOR", false},
- {TOK_FOREIGN, "FOREIGN", false},
- {TOK_FREE_IT, "FREE_IT", true},
- {TOK_FROM, "FROM", false},
- {TOK_FULL, "FULL", false},
- {TOK_FUNCTION, "FUNCTION", false},
- {TOK_GDSCODE, "GDSCODE", false},
- {TOK_GENERATED, "GENERATED", true},
- {TOK_GENERATOR, "GENERATOR", true},
- {TOK_GEN_ID, "GEN_ID", true},
- {TOK_GEN_UUID, "GEN_UUID", true},
- {TOK_GLOBAL, "GLOBAL", false},
- {TOK_GRANT, "GRANT", false},
- {TOK_GRANTED, "GRANTED", true},
- {TOK_GROUP, "GROUP", false},
- {TOK_HASH, "HASH", true},
- {TOK_HAVING, "HAVING", false},
- {TOK_HEX_DECODE, "HEX_DECODE", true},
- {TOK_HEX_ENCODE, "HEX_ENCODE", true},
- {TOK_HOUR, "HOUR", false},
- {TOK_IDENTITY, "IDENTITY", true},
- {TOK_IDLE, "IDLE", true},
- {TOK_IF, "IF", true},
- {TOK_IGNORE, "IGNORE", true},
- {TOK_IIF, "IIF", true},
- {TOK_IN, "IN", false},
- {TOK_INACTIVE, "INACTIVE", true},
- {TOK_INCLUDE, "INCLUDE", true},
- {TOK_INCREMENT, "INCREMENT", true},
- {TOK_INDEX, "INDEX", false},
- {TOK_INNER, "INNER", false},
- {TOK_INPUT_TYPE, "INPUT_TYPE", true},
- {TOK_INSENSITIVE, "INSENSITIVE", false},
- {TOK_INSERT, "INSERT", false},
- {TOK_INSERTING, "INSERTING", false},
- {TOK_INT, "INT", false},
- {TOK_INT128, "INT128", false},
- {TOK_INTEGER, "INTEGER", false},
- {TOK_INTO, "INTO", false},
- {TOK_INVOKER, "INVOKER", true},
- {TOK_IS, "IS", false},
- {TOK_ISOLATION, "ISOLATION", true},
- {TOK_IV, "IV", true},
- {TOK_JOIN, "JOIN", false},
- {TOK_KEY, "KEY", true},
- {TOK_LAG, "LAG", true},
- {TOK_LAST, "LAST", true},
- {TOK_LAST_DAY, "LAST_DAY", true},
- {TOK_LAST_VALUE, "LAST_VALUE", true},
- {TOK_LASTNAME, "LASTNAME", true},
- {TOK_LEAD, "LEAD", true},
- {TOK_LEADING, "LEADING", false},
- {TOK_LEAVE, "LEAVE", true},
- {TOK_LEFT, "LEFT", false},
- {TOK_LEGACY, "LEGACY", true},
- {TOK_LENGTH, "LENGTH", true},
- {TOK_LEVEL, "LEVEL", true},
- {TOK_LIFETIME, "LIFETIME", true},
- {TOK_LIKE, "LIKE", false},
- {TOK_LIMBO, "LIMBO", true},
- {TOK_LINGER, "LINGER", true},
- {TOK_LIST, "LIST", true},
- {TOK_LN, "LN", true},
- {TOK_LATERAL, "LATERAL", false},
- {TOK_LOCAL, "LOCAL", false},
- {TOK_LOCALTIME, "LOCALTIME", false},
- {TOK_LOCALTIMESTAMP, "LOCALTIMESTAMP", false},
- {TOK_LOCK, "LOCK", true},
- {TOK_LOCKED, "LOCKED", true},
- {TOK_LOG, "LOG", true},
- {TOK_LOG10, "LOG10", true},
- {TOK_LONG, "LONG", false},
- {TOK_LOWER, "LOWER", false},
- {TOK_LPAD, "LPAD", true},
- {TOK_LPARAM, "LPARAM", true},
- {TOK_MAKE_DBKEY, "MAKE_DBKEY", true},
- {TOK_MANUAL, "MANUAL", true},
- {TOK_MAPPING, "MAPPING", true},
- {TOK_MATCHED, "MATCHED", true},
- {TOK_MATCHING, "MATCHING", true},
- {TOK_MAXIMUM, "MAX", false},
- {TOK_MAXVALUE, "MAXVALUE", true},
- {TOK_MERGE, "MERGE", false},
- {TOK_MESSAGE, "MESSAGE", true},
- {TOK_MILLISECOND, "MILLISECOND", true},
- {TOK_MIDDLENAME, "MIDDLENAME", true},
- {TOK_MINIMUM, "MIN", false},
- {TOK_MINUTE, "MINUTE", false},
- {TOK_MINVALUE, "MINVALUE", true},
- {TOK_MOD, "MOD", true},
- {TOK_MODE, "MODE", true},
- {TOK_MODULE_NAME, "MODULE_NAME", true},
- {TOK_MONTH, "MONTH", false},
- {TOK_NAME, "NAME", true},
- {TOK_NAMES, "NAMES", true},
- {TOK_NATIONAL, "NATIONAL", false},
- {TOK_NATIVE, "NATIVE", true},
- {TOK_NATURAL, "NATURAL", false},
- {TOK_NCHAR, "NCHAR", false},
- {TOK_NEXT, "NEXT", true},
- {TOK_NO, "NO", false},
- {TOK_NORMALIZE_DECFLOAT, "NORMALIZE_DECFLOAT", true},
- {TOK_NOT, "NOT", false},
- {TOK_NTH_VALUE, "NTH_VALUE", true},
- {TOK_NTILE, "NTILE", true},
- {TOK_NULLIF, "NULLIF", true},
- {TOK_NULL, "NULL", false},
- {TOK_NULLS, "NULLS", true},
- {TOK_NUMBER, "NUMBER", true},
- {TOK_NUMERIC, "NUMERIC", false},
- {TOK_OCTET_LENGTH, "OCTET_LENGTH", false},
- {TOK_OF, "OF", false},
- {TOK_OFFSET, "OFFSET", false},
- {TOK_OLDEST, "OLDEST", true},
- {TOK_ON, "ON", false},
- {TOK_ONLY, "ONLY", false},
- {TOK_OPEN, "OPEN", false},
- {TOK_OPTIMIZE, "OPTIMIZE", true},
- {TOK_OPTION, "OPTION", true},
- {TOK_OR, "OR", false},
- {TOK_ORDER, "ORDER", false},
- {TOK_OS_NAME, "OS_NAME", true},
- {TOK_OTHERS, "OTHERS", true},
- {TOK_OUTER, "OUTER", false},
- {TOK_OUTPUT_TYPE, "OUTPUT_TYPE", true},
- {TOK_OVER, "OVER", false},
- {TOK_OVERFLOW, "OVERFLOW", true},
- {TOK_OVERLAY, "OVERLAY", true},
- {TOK_OVERRIDING, "OVERRIDING", true},
- {TOK_PACKAGE, "PACKAGE", true},
- {TOK_PAD, "PAD", true},
- {TOK_PAGE, "PAGE", true},
- {TOK_PAGES, "PAGES", true},
- {TOK_PAGE_SIZE, "PAGE_SIZE", true},
- {TOK_PARAMETER, "PARAMETER", false},
- {TOK_PARTITION, "PARTITION", true},
- {TOK_PASSWORD, "PASSWORD", true},
- {TOK_PERCENT_RANK, "PERCENT_RANK", true},
- {TOK_PI, "PI", true},
- {TOK_PKCS_1_5, "PKCS_1_5", true},
- {TOK_PLACING, "PLACING", true},
- {TOK_PLAN, "PLAN", false},
- {TOK_PLUGIN, "PLUGIN", true},
- {TOK_POOL, "POOL", true},
- {TOK_POSITION, "POSITION", false},
- {TOK_POST_EVENT, "POST_EVENT", false},
- {TOK_POWER, "POWER", true},
- {TOK_PRECEDING, "PRECEDING", true},
- {TOK_PRECISION, "PRECISION", false},
- {TOK_PRESERVE, "PRESERVE", true},
- {TOK_PRIMARY, "PRIMARY", false},
- {TOK_PRIOR, "PRIOR", true},
- {TOK_PRIVILEGE, "PRIVILEGE", true},
- {TOK_PRIVILEGES, "PRIVILEGES", true},
- {TOK_PROCEDURE, "PROCEDURE", false},
- {TOK_PROTECTED, "PROTECTED", true},
- {TOK_PUBLICATION, "PUBLICATION", false},
- {TOK_QUANTIZE, "QUANTIZE", true},
- {TOK_QUARTER, "QUARTER", true},
- {TOK_RAND, "RAND", true},
- {TOK_RANGE, "RANGE", true},
- {TOK_RANK, "RANK", true},
- {TOK_DB_KEY, "RDB$DB_KEY", false},
- {TOK_RDB_ERROR, "RDB$ERROR", false},
- {TOK_RDB_GET_CONTEXT, "RDB$GET_CONTEXT", false},
- {TOK_RDB_GET_TRANSACTION_CN, "RDB$GET_TRANSACTION_CN", false},
- {TOK_RDB_RECORD_VERSION, "RDB$RECORD_VERSION", false},
- {TOK_RDB_ROLE_IN_USE, "RDB$ROLE_IN_USE", false},
- {TOK_RDB_SET_CONTEXT, "RDB$SET_CONTEXT", false},
- {TOK_RDB_SYSTEM_PRIVILEGE, "RDB$SYSTEM_PRIVILEGE", false},
- {TOK_READ, "READ", true},
- {TOK_REAL, "REAL", false},
- {TOK_VERSION, "RECORD_VERSION", false},
- {TOK_RECREATE, "RECREATE", false},
- {TOK_RECURSIVE, "RECURSIVE", false},
- {TOK_REFERENCES, "REFERENCES", false},
- {TOK_REGR_AVGX, "REGR_AVGX", false},
- {TOK_REGR_AVGY, "REGR_AVGY", false},
- {TOK_REGR_COUNT, "REGR_COUNT", false},
- {TOK_REGR_INTERCEPT, "REGR_INTERCEPT", false},
- {TOK_REGR_R2, "REGR_R2", false},
- {TOK_REGR_SLOPE, "REGR_SLOPE", false},
- {TOK_REGR_SXX, "REGR_SXX", false},
- {TOK_REGR_SXY, "REGR_SXY", false},
- {TOK_REGR_SYY, "REGR_SYY", false},
- {TOK_RELATIVE, "RELATIVE", true},
- {TOK_RELEASE, "RELEASE", false},
- {TOK_REPLACE, "REPLACE", true},
- {TOK_REQUESTS, "REQUESTS", true},
- {TOK_RESERVING, "RESERV", true}, // Alias of RESERVING
- {TOK_RESERVING, "RESERVING", true},
- {TOK_RESET, "RESET", true},
- {TOK_RESETTING, "RESETTING", false},
- {TOK_RESTART, "RESTART", true},
- {TOK_RESTRICT, "RESTRICT", true},
- {TOK_RETAIN, "RETAIN", true},
- {TOK_RETURN, "RETURN", false},
- {TOK_RETURNING, "RETURNING", true},
- {TOK_RETURNING_VALUES, "RETURNING_VALUES", false},
- {TOK_RETURNS, "RETURNS", false},
- {TOK_REVERSE, "REVERSE", true},
- {TOK_REVOKE, "REVOKE", false},
- {TOK_RIGHT, "RIGHT", false},
- {TOK_ROLE, "ROLE", true},
- {TOK_ROLLBACK, "ROLLBACK", false},
- {TOK_ROUND, "ROUND", true},
- {TOK_ROW, "ROW", false},
- {TOK_ROW_COUNT, "ROW_COUNT", false},
- {TOK_ROW_NUMBER, "ROW_NUMBER", true},
- {TOK_ROWS, "ROWS", false},
- {TOK_RPAD, "RPAD", true},
- {TOK_RSA_DECRYPT, "RSA_DECRYPT", true},
- {TOK_RSA_ENCRYPT, "RSA_ENCRYPT", true},
- {TOK_RSA_PRIVATE, "RSA_PRIVATE", true},
- {TOK_RSA_PUBLIC, "RSA_PUBLIC", true},
- {TOK_RSA_SIGN_HASH, "RSA_SIGN_HASH", true},
- {TOK_RSA_VERIFY_HASH, "RSA_VERIFY_HASH", true},
- {TOK_SALT_LENGTH, "SALT_LENGTH", true},
- {TOK_SAVEPOINT, "SAVEPOINT", false},
- {TOK_SCALAR_ARRAY, "SCALAR_ARRAY", true},
- {TOK_DATABASE, "SCHEMA", false}, // Alias of DATABASE
- {TOK_SCROLL, "SCROLL", false},
- {TOK_SECOND, "SECOND", false},
- {TOK_SECURITY, "SECURITY", true},
- {TOK_SEGMENT, "SEGMENT", true},
- {TOK_SELECT, "SELECT", false},
- {TOK_SENSITIVE, "SENSITIVE", false},
- {TOK_SEQUENCE, "SEQUENCE", true},
- {TOK_SERVERWIDE, "SERVERWIDE", true},
- {TOK_SESSION, "SESSION", true},
- {TOK_SET, "SET", false},
- {TOK_SHADOW, "SHADOW", true},
- {TOK_SHARED, "SHARED", true},
- {TOK_SIGN, "SIGN", true},
- {TOK_SIGNATURE, "SIGNATURE", true},
- {TOK_SIMILAR, "SIMILAR", false},
- {TOK_SIN, "SIN", true},
- {TOK_SINGULAR, "SINGULAR", true},
- {TOK_SINH, "SINH", true},
- {TOK_SIZE, "SIZE", true},
- {TOK_SKIP, "SKIP", true},
- {TOK_SMALLINT, "SMALLINT", false},
- {TOK_SNAPSHOT, "SNAPSHOT", true},
- {TOK_SOME, "SOME", false},
- {TOK_SORT, "SORT", true},
- {TOK_SOURCE, "SOURCE", true},
- {TOK_SPACE, "SPACE", true},
- {TOK_SQL, "SQL", true},
- {TOK_SQLCODE, "SQLCODE", false},
- {TOK_SQLSTATE, "SQLSTATE", false},
- {TOK_SQRT, "SQRT", true},
- {TOK_STABILITY, "STABILITY", true},
- {TOK_START, "START", false},
- {TOK_STARTING, "STARTING", true},
- {TOK_STARTING, "STARTS", true}, // Alias of STARTING
- {TOK_STATEMENT, "STATEMENT", true},
- {TOK_STATISTICS, "STATISTICS", true},
- {TOK_STDDEV_POP, "STDDEV_POP", false},
- {TOK_STDDEV_SAMP, "STDDEV_SAMP", false},
- {TOK_SUBSTRING, "SUBSTRING", true},
- {TOK_SUB_TYPE, "SUB_TYPE", true},
- {TOK_SUM, "SUM", false},
- {TOK_SUSPEND, "SUSPEND", true},
- {TOK_SYSTEM, "SYSTEM", true},
- {TOK_TABLE, "TABLE", false},
- {TOK_TAGS, "TAGS", true},
- {TOK_TAN, "TAN", true},
- {TOK_TANH, "TANH", true},
- {TOK_TARGET, "TARGET", true},
- {TOK_TEMPORARY, "TEMPORARY", true},
- {TOK_THEN, "THEN", false},
- {TOK_TIES, "TIES", true},
- {TOK_TIME, "TIME", false},
- {TOK_TIMESTAMP, "TIMESTAMP", false},
- {TOK_TIMEOUT, "TIMEOUT", true},
- {TOK_TIMEZONE_HOUR, "TIMEZONE_HOUR", false},
- {TOK_TIMEZONE_MINUTE, "TIMEZONE_MINUTE", false},
- {TOK_TIMEZONE_NAME, "TIMEZONE_NAME", true},
- {TOK_TO, "TO", false},
- {TOK_TOTALORDER, "TOTALORDER", true},
- {TOK_TRAILING, "TRAILING", false},
- {TOK_TRANSACTION, "TRANSACTION", true},
- {TOK_TRAPS, "TRAPS", true},
- {TOK_TRIGGER, "TRIGGER", false},
- {TOK_TRIM, "TRIM", false},
- {TOK_TRUE, "TRUE", false},
- {TOK_TRUNC, "TRUNC", true},
- {TOK_TRUSTED, "TRUSTED", true},
- {TOK_TWO_PHASE, "TWO_PHASE", true},
- {TOK_TYPE, "TYPE", true},
- {TOK_UNBOUNDED, "UNBOUNDED", false},
- {TOK_UNCOMMITTED, "UNCOMMITTED", true},
- {TOK_UNDO, "UNDO", true},
- {TOK_UNICODE_CHAR, "UNICODE_CHAR", true},
- {TOK_UNICODE_VAL, "UNICODE_VAL", true},
- {TOK_UNION, "UNION", false},
- {TOK_UNIQUE, "UNIQUE", false},
- {TOK_UNKNOWN, "UNKNOWN", false},
- {TOK_UPDATE, "UPDATE", false},
- {TOK_UPDATING, "UPDATING", false},
- {TOK_UPPER, "UPPER", false},
- {TOK_USAGE, "USAGE", true},
- {TOK_USER, "USER", false},
- {TOK_USING, "USING", false},
- {TOK_UUID_TO_CHAR, "UUID_TO_CHAR", true},
- {TOK_VALUE, "VALUE", false},
- {TOK_VALUES, "VALUES", false},
- {TOK_VAR_POP, "VAR_POP", false},
- {TOK_VAR_SAMP, "VAR_SAMP", false},
- {TOK_VARBINARY, "VARBINARY", false},
- {TOK_VARCHAR, "VARCHAR", false},
- {TOK_VARIABLE, "VARIABLE", false},
- {TOK_VARYING, "VARYING", false},
- {TOK_VIEW, "VIEW", false},
- {TOK_WAIT, "WAIT", true},
- {TOK_WEEK, "WEEK", true},
- {TOK_WEEKDAY, "WEEKDAY", true},
- {TOK_WHEN, "WHEN", false},
- {TOK_WHERE, "WHERE", false},
- {TOK_WHILE, "WHILE", false},
- {TOK_WINDOW, "WINDOW", false},
- {TOK_WITH, "WITH", false},
- {TOK_WITHOUT, "WITHOUT", false},
- {TOK_WORK, "WORK", true},
- {TOK_WRITE, "WRITE", true},
- {TOK_YEAR, "YEAR", false},
- {TOK_YEARDAY, "YEARDAY", true},
- {TOK_ZONE, "ZONE", true},
- {TOK_NOT_LSS, "^<", false}, // Alias of !<
- {TOK_NEQ, "^=", false}, // Alias of !=
- {TOK_NOT_GTR, "^>", false}, // Alias of !>
- {TOK_CONCATENATE, "||", false},
- {TOK_NOT_LSS, "~<", false}, // Alias of !<
- {TOK_NEQ, "~=", false}, // Alias of !=
- {TOK_NOT_GTR, "~>", false}, // Alias of !>
- {0, NULL, false}
-};
-
-Tokens keywordGetTokens()
-{
- return tokens;
-}
diff --git a/src/dsql/Keywords.cpp b/src/dsql/Keywords.cpp
new file mode 100644
index 0000000000..3eacc232fe
--- /dev/null
+++ b/src/dsql/Keywords.cpp
@@ -0,0 +1,63 @@
+/*
+ * The contents of this file are subject to the Initial
+ * Developer's Public License Version 1.0 (the "License");
+ * you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
+ *
+ * Software distributed under the License is distributed AS IS,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied.
+ * See the License for the specific language governing rights
+ * and limitations under the License.
+ *
+ * The Original Code was created by Adriano dos Santos Fernandes
+ * for the Firebird Open Source RDBMS project.
+ *
+ * Copyright (c) 2023 Adriano dos Santos Fernandes
+ * and all contributors signed below.
+ *
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ */
+
+#include "firebird.h"
+#include "../dsql/Keywords.h"
+#include "../jrd/jrd.h"
+#include "../common/Token.h"
+
+#define _yacc_defines_yystype
+#include "gen/parse.h"
+
+using namespace Firebird;
+using namespace Jrd;
+
+
+#define PARSER_TOKEN(ident, str, nonReserved) \
+ {ident, str, nonReserved},
+
+static const Token tokens[] =
+{
+#include "../common/ParserTokens.h"
+ {0, NULL, false}
+};
+
+
+Keywords* Keywords::Allocator::create()
+{
+ thread_db* tdbb = JRD_get_thread_data();
+ fb_assert(tdbb);
+ Database* dbb = tdbb->getDatabase();
+ fb_assert(dbb);
+
+ return FB_NEW_POOL(*dbb->dbb_permanent) Keywords(*dbb->dbb_permanent);
+}
+
+Keywords::Keywords(MemoryPool& pool)
+ : map(pool)
+{
+ for (auto token = tokens; token->tok_string; ++token)
+ {
+ auto str = FB_NEW_POOL(pool) MetaName(token->tok_string);
+ map.put(*str, {token->tok_ident, str, token->nonReserved});
+ }
+}
diff --git a/src/dsql/Keywords.h b/src/dsql/Keywords.h
new file mode 100644
index 0000000000..58648922d3
--- /dev/null
+++ b/src/dsql/Keywords.h
@@ -0,0 +1,84 @@
+/*
+ * The contents of this file are subject to the Initial
+ * Developer's Public License Version 1.0 (the "License");
+ * you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
+ *
+ * Software distributed under the License is distributed AS IS,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied.
+ * See the License for the specific language governing rights
+ * and limitations under the License.
+ *
+ * The Original Code was created by Adriano dos Santos Fernandes
+ * for the Firebird Open Source RDBMS project.
+ *
+ * Copyright (c) 2023 Adriano dos Santos Fernandes
+ * and all contributors signed below.
+ *
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ */
+
+#ifndef DSQL_KEYWORDS_H
+#define DSQL_KEYWORDS_H
+
+#include "firebird.h"
+#include "../common/classes/alloc.h"
+#include "../common/classes/GenericMap.h"
+#include "../jrd/MetaName.h"
+
+
+namespace Jrd
+{
+ class Keywords final
+ {
+ public:
+ class Allocator final
+ {
+ public:
+ static Keywords* create();
+
+ static void destroy(Keywords* instance)
+ {
+ delete instance;
+ }
+ };
+
+ struct Keyword
+ {
+ int keyword;
+ MetaName* str;
+ bool nonReserved;
+ };
+
+ public:
+ Keywords(MemoryPool& pool);
+
+ ~Keywords()
+ {
+ for (auto& pair : map)
+ delete pair.second.str;
+ }
+
+ auto get(const MetaName& str) const
+ {
+ return map.get(str);
+ }
+
+ auto begin() const
+ {
+ return map.begin();
+ }
+
+ auto end() const
+ {
+ return map.end();
+ }
+
+ private:
+ Firebird::LeftPooledMap map;
+ };
+} // namespace Jrd
+
+#endif // DSQL_KEYWORDS_H
diff --git a/src/dsql/Parser.cpp b/src/dsql/Parser.cpp
index af0f9ab9f4..e9e6908265 100644
--- a/src/dsql/Parser.cpp
+++ b/src/dsql/Parser.cpp
@@ -27,7 +27,6 @@
#include "../dsql/chars.h"
#include "../jrd/jrd.h"
#include "../jrd/DataTypeUtil.h"
-#include "../common/keywords.h"
#include "../jrd/intl_proto.h"
#ifdef HAVE_FLOAT_H
@@ -40,64 +39,6 @@ using namespace Firebird;
using namespace Jrd;
-namespace Jrd
-{
- struct Keyword
- {
- Keyword(int aKeyword, MetaName* aStr)
- : keyword(aKeyword), str(aStr)
- {}
-
- int keyword;
- MetaName* str;
- };
-
- class KeywordsMap : public GenericMap > >
- {
- public:
- explicit KeywordsMap(MemoryPool& pool)
- : GenericMap > >(pool)
- {
- for (const TOK* token = keywordGetTokens(); token->tok_string; ++token)
- {
- MetaName* str = FB_NEW_POOL(pool) MetaName(token->tok_string);
- put(*str, Keyword(token->tok_ident, str));
- }
- }
-
- ~KeywordsMap()
- {
- Accessor accessor(this);
- for (bool found = accessor.getFirst(); found; found = accessor.getNext())
- delete accessor.current()->second.str;
- }
- };
-
- KeywordsMap* KeywordsMapAllocator::create()
- {
- thread_db* tdbb = JRD_get_thread_data();
- fb_assert(tdbb);
- Database* dbb = tdbb->getDatabase();
- fb_assert(dbb);
-
- return FB_NEW_POOL(*dbb->dbb_permanent) KeywordsMap(*dbb->dbb_permanent);
- }
-
- void KeywordsMapAllocator::destroy(KeywordsMap* inst)
- {
- delete inst;
- }
-}
-
-namespace
-{
- const Keyword* getKeyword(Database* dbb, const MetaName& str)
- {
- return dbb->dbb_keywords_map().get(str);
- }
-}
-
-
Parser::Parser(thread_db* tdbb, MemoryPool& pool, MemoryPool* aStatementPool, DsqlCompilerScratch* aScratch,
USHORT aClientDialect, USHORT aDbDialect, const TEXT* string, size_t length, SSHORT characterSet)
: PermanentStorage(pool),
@@ -1267,9 +1208,9 @@ int Parser::yylexAux()
yyabandon(yyposn, -104, isc_dyn_name_longer);
const MetaName str(string, p - string);
- const Keyword* const keyVer = getKeyword(dbb, str);
- if (keyVer && (keyVer->keyword != TOK_COMMENT || lex.prev_keyword == -1))
+ if (const auto keyVer = dbb->dbb_keywords().get(str);
+ keyVer && (keyVer->keyword != TOK_COMMENT || lex.prev_keyword == -1))
{
yylval.metaNamePtr = keyVer->str;
lex.last_token_bk = lex.last_token;
@@ -1290,9 +1231,8 @@ int Parser::yylexAux()
if (lex.last_token + 1 < lex.end && !isspace(UCHAR(lex.last_token[1])))
{
const MetaName str(lex.last_token, 2);
- const Keyword* const keyVer = getKeyword(dbb, str);
- if (keyVer)
+ if (const auto keyVer = dbb->dbb_keywords().get(str))
{
++lex.ptr;
return keyVer->keyword;
diff --git a/src/jrd/Database.h b/src/jrd/Database.h
index e257954ead..87ea2af2bb 100644
--- a/src/jrd/Database.h
+++ b/src/jrd/Database.h
@@ -71,6 +71,7 @@
#include "../common/classes/SyncObject.h"
#include "../common/classes/Synchronize.h"
#include "../jrd/replication/Manager.h"
+#include "../dsql/Keywords.h"
#include "fb_types.h"
@@ -91,14 +92,6 @@ class GarbageCollector;
class CryptoManager;
class KeywordsMap;
-// allocator for keywords table
-class KeywordsMapAllocator
-{
-public:
- static KeywordsMap* create();
- static void destroy(KeywordsMap* inst);
-};
-
// general purpose vector
template
class vec_base : protected pool_alloc
@@ -546,7 +539,7 @@ public:
unsigned dbb_compatibility_index; // datatype backward compatibility level
Dictionary dbb_dic; // metanames dictionary
- Firebird::InitInstance dbb_keywords_map;
+ Firebird::InitInstance dbb_keywords;
// returns true if primary file is located on raw device
bool onRawDevice() const;
diff --git a/src/jrd/KeywordsTable.cpp b/src/jrd/KeywordsTable.cpp
index 397fddde72..9214cde02c 100644
--- a/src/jrd/KeywordsTable.cpp
+++ b/src/jrd/KeywordsTable.cpp
@@ -23,7 +23,7 @@
#include "../jrd/KeywordsTable.h"
#include "../jrd/ini.h"
#include "../jrd/ids.h"
-#include "../common/keywords.h"
+#include "../common/Token.h"
using namespace Jrd;
using namespace Firebird;
@@ -42,16 +42,18 @@ RecordBuffer* KeywordsTable::getRecords(thread_db* tdbb, jrd_rel* relation)
const auto record = recordBuffer->getTempRecord();
- for (const auto* token = keywordGetTokens(); token->tok_string; ++token)
+ for (const auto& token : tdbb->getDatabase()->dbb_keywords())
{
- if (isalpha(token->tok_string[0]))
+ const auto& tokenString = token.first;
+
+ if (isalpha(tokenString[0]))
{
record->nullify();
putField(tdbb, record,
- DumpField(f_keyword_name, VALUE_STRING, strlen(token->tok_string), token->tok_string));
+ DumpField(f_keyword_name, VALUE_STRING, tokenString.length(), tokenString.c_str()));
- const bool reserved = !token->nonReserved;
+ const bool reserved = !token.second.nonReserved;
putField(tdbb, record, DumpField(f_keyword_reserved, VALUE_BOOLEAN, 1, &reserved));
recordBuffer->store(record);
diff --git a/src/yvalve/keywordsStub.cpp b/src/yvalve/keywordsStub.cpp
index afab266bc7..90801406d4 100644
--- a/src/yvalve/keywordsStub.cpp
+++ b/src/yvalve/keywordsStub.cpp
@@ -32,6 +32,15 @@
#include "keywordsStub.h"
+#define PARSER_TOKEN(ident, str, nonReserved) \
+ {MAX_USHORT, str, nonReserved},
+
+static const Token tokens[] =
+{
+#include "../common/ParserTokens.h"
+ {0, NULL, false}
+};
+
// This method is currently used in isql/isql.epp to check if a
// user field is a reserved word, and hence needs to be quoted.
// Obviously a hash table would make this a little quicker.
@@ -41,21 +50,22 @@ extern "C" {
int API_ROUTINE KEYWORD_stringIsAToken(const char* in_str)
{
- for (const TOK* tok_ptr = keywordGetTokens(); tok_ptr->tok_string; ++tok_ptr)
+ for (auto token = tokens; token->tok_string; ++token)
{
- if (!tok_ptr->nonReserved && !strcmp(tok_ptr->tok_string, in_str))
+ if (!token->nonReserved && !strcmp(token->tok_string, in_str))
return true;
}
return false;
}
-Tokens API_ROUTINE KEYWORD_getTokens()
+ConstTokenPtr API_ROUTINE KEYWORD_getTokens()
{
// This function should not be used but appeared in FB3.
- // As long as we keep TOK structure as is we may have it deprecated.
+ // As long as we keep Token structure as is we may have it deprecated.
// Later sooner of all it will be removed at all.
- return keywordGetTokens();
+ // ASF: The tokens will be returned with all tok_ident set to MAX_USHORT.
+ return tokens;
}
}
diff --git a/src/yvalve/keywordsStub.h b/src/yvalve/keywordsStub.h
index f9be731d00..65fdf4f006 100644
--- a/src/yvalve/keywordsStub.h
+++ b/src/yvalve/keywordsStub.h
@@ -19,12 +19,12 @@
* 2001.07.28 John Bellardo added tokens for FIRST and LIMIT
See dsql/parse.y for a chronological list. */
-#include "../common/keywords.h"
+#include "../common/Token.h"
#include "ibase.h"
// These symbols are exported
extern "C"
{
int API_ROUTINE KEYWORD_stringIsAToken(const char*);
- Tokens FB_API_DEPRECATED API_ROUTINE KEYWORD_getTokens();
+ ConstTokenPtr FB_API_DEPRECATED API_ROUTINE KEYWORD_getTokens();
}