8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 09:23:03 +01:00

Stay in-sync with Mark's changes and make them win32 friendly.

This commit is contained in:
dimitr 2002-07-30 07:23:40 +00:00
parent f63a970344
commit 4b0c2969b3
2 changed files with 47 additions and 40 deletions

View File

@ -28,7 +28,7 @@
* Contributor(s): * Contributor(s):
* *
* *
* $Id: keywords.cpp,v 1.1 2002-07-29 15:37:51 skywalker Exp $ * $Id: keywords.cpp,v 1.2 2002-07-30 07:23:40 dimitr Exp $
* *
*/ */
@ -42,16 +42,16 @@
#include "dsql.tab.h" #include "dsql.tab.h"
#include "keywords.h" #include "keywords.h"
static CONST TOK tokens [] = { static CONST TOK tokens [] = {
{NOT_LSS, "!<", 1}, {NOT_LSS, "!<", 1},
{NEQ, "!=", 1}, {NEQ, "!=", 1},
{NOT_GTR, "!>", 1}, {NOT_GTR, "!>", 1},
{LPAREN, "(", 1}, {LPAREN, "(", 1},
{RPAREN, ")", 1}, {RPAREN, "}", 1},
{COMMA, ",", 1}, {COMMA, ",", 1},
{LSS, "<", 1}, {LSS, "<", 1},
{LEQ, "<=", 1}, {LEQ, "<=", 1},
{NEQ, "<>", 1}, /* Alias of != */ {NEQ, "<>", 1}, /* Alias of != */
{EQL, "=", 1}, {EQL, "=", 1},
{GTR, ">", 1}, {GTR, ">", 1},
{GEQ, ">=", 1}, {GEQ, ">=", 1},
@ -62,10 +62,10 @@ static CONST TOK tokens [] = {
{AFTER, "AFTER", 1}, {AFTER, "AFTER", 1},
{ALL, "ALL", 1}, {ALL, "ALL", 1},
{ALTER, "ALTER", 1}, {ALTER, "ALTER", 1},
{AND, "AND", 1}, {AND, "AND", 1},
{ANY, "ANY", 1}, {ANY, "ANY", 1},
{AS, "AS", 1}, {AS, "AS", 1},
{ASC, "ASC", 1}, /* Alias of ASCENDING */ {ASC, "ASC", 1}, /* Alias of ASCENDING */
{ASC, "ASCENDING", 1}, {ASC, "ASCENDING", 1},
{AT, "AT", 1}, {AT, "AT", 1},
{AUTO, "AUTO", 1}, {AUTO, "AUTO", 1},
@ -75,7 +75,7 @@ static CONST TOK tokens [] = {
{BEGIN, "BEGIN", 1}, {BEGIN, "BEGIN", 1},
{BETWEEN, "BETWEEN", 1}, {BETWEEN, "BETWEEN", 1},
{BLOB, "BLOB", 1}, {BLOB, "BLOB", 1},
{KW_BREAK, "BREAK", 2}, {KW_BREAK, "BREAK", 2},
{BY, "BY", 1}, {BY, "BY", 1},
{CACHE, "CACHE", 1}, {CACHE, "CACHE", 1},
{CASCADE, "CASCADE", 1}, {CASCADE, "CASCADE", 1},
@ -98,10 +98,10 @@ static CONST TOK tokens [] = {
{CSTRING, "CSTRING", 1}, {CSTRING, "CSTRING", 1},
{CURRENT, "CURRENT", 1}, {CURRENT, "CURRENT", 1},
{CURRENT_DATE, "CURRENT_DATE", 2}, {CURRENT_DATE, "CURRENT_DATE", 2},
{CURRENT_ROLE, "CURRENT_ROLE", 2}, {CURRENT_ROLE, "CURRENT_ROLE", 2},
{CURRENT_TIME, "CURRENT_TIME", 2}, {CURRENT_TIME, "CURRENT_TIME", 2},
{CURRENT_TIMESTAMP, "CURRENT_TIMESTAMP", 2}, {CURRENT_TIMESTAMP, "CURRENT_TIMESTAMP", 2},
{CURRENT_USER, "CURRENT_USER", 2}, {CURRENT_USER, "CURRENT_USER", 2},
{CURSOR, "CURSOR", 1}, {CURSOR, "CURSOR", 1},
{DATABASE, "DATABASE", 1}, {DATABASE, "DATABASE", 1},
{DATE, "DATE", 1}, {DATE, "DATE", 1},
@ -111,10 +111,10 @@ static CONST TOK tokens [] = {
{DECIMAL, "DECIMAL", 1}, {DECIMAL, "DECIMAL", 1},
{DECLARE, "DECLARE", 1}, {DECLARE, "DECLARE", 1},
{DEFAULT, "DEFAULT", 1}, {DEFAULT, "DEFAULT", 1},
{DELETE, "DELETE", 1}, {DELETE, "DELETE", 1},
{DESC, "DESC", 1}, /* Alias of DESCENDING */ {DESC, "DESC", 1}, /* Alias of DESCENDING */
{DESC, "DESCENDING", 1}, {DESC, "DESCENDING", 1},
{KW_DESCRIPTOR, "DESCRIPTOR", 2}, {KW_DESCRIPTOR, "DESCRIPTOR", 2},
{DISTINCT, "DISTINCT", 1}, {DISTINCT, "DISTINCT", 1},
{DO, "DO", 1}, {DO, "DO", 1},
{DOMAIN, "DOMAIN", 1}, {DOMAIN, "DOMAIN", 1},
@ -132,7 +132,7 @@ static CONST TOK tokens [] = {
{EXTRACT, "EXTRACT", 2}, {EXTRACT, "EXTRACT", 2},
{KW_FILE, "FILE", 1}, {KW_FILE, "FILE", 1},
{FILTER, "FILTER", 1}, {FILTER, "FILTER", 1},
{FIRST, "FIRST", 2}, {FIRST, "FIRST", 2},
{KW_FLOAT, "FLOAT", 1}, {KW_FLOAT, "FLOAT", 1},
{FOR, "FOR", 1}, {FOR, "FOR", 1},
{FOREIGN, "FOREIGN", 1}, {FOREIGN, "FOREIGN", 1},
@ -216,9 +216,9 @@ static CONST TOK tokens [] = {
{READ, "READ", 1}, {READ, "READ", 1},
{REAL, "REAL", 1}, {REAL, "REAL", 1},
{VERSION, "RECORD_VERSION", 1}, {VERSION, "RECORD_VERSION", 1},
{RECREATE, "RECREATE", 2}, {RECREATE, "RECREATE", 2},
{REFERENCES, "REFERENCES", 1}, {REFERENCES, "REFERENCES", 1},
{RESERVING, "RESERV", 1}, /* Alias of RESERVING */ {RESERVING, "RESERV", 1}, /* Alias of RESERVING */
{RESERVING, "RESERVING", 1}, {RESERVING, "RESERVING", 1},
{RESTRICT, "RESTRICT", 1}, {RESTRICT, "RESTRICT", 1},
{RETAIN, "RETAIN", 1}, {RETAIN, "RETAIN", 1},
@ -227,8 +227,8 @@ static CONST TOK tokens [] = {
{REVOKE, "REVOKE", 1}, {REVOKE, "REVOKE", 1},
{RIGHT, "RIGHT", 1}, {RIGHT, "RIGHT", 1},
{ROLE, "ROLE", 1}, {ROLE, "ROLE", 1},
{ROLLBACK, "ROLLBACK", 1}, {ROLLBACK, "ROLLBACK", 1},
{DATABASE, "SCHEMA", 1}, /* Alias of DATABASE */ {DATABASE, "SCHEMA", 1}, /* Alias of DATABASE */
{SECOND, "SECOND", 2}, {SECOND, "SECOND", 2},
{SEGMENT, "SEGMENT", 1}, {SEGMENT, "SEGMENT", 1},
{SELECT, "SELECT", 1}, {SELECT, "SELECT", 1},
@ -237,17 +237,17 @@ static CONST TOK tokens [] = {
{SHARED, "SHARED", 1}, {SHARED, "SHARED", 1},
{SINGULAR, "SINGULAR", 1}, {SINGULAR, "SINGULAR", 1},
{SIZE, "SIZE", 1}, {SIZE, "SIZE", 1},
{SKIP, "SKIP", 2}, {SKIP, "SKIP", 2},
{SMALLINT, "SMALLINT", 1}, {SMALLINT, "SMALLINT", 1},
{SNAPSHOT, "SNAPSHOT", 1}, {SNAPSHOT, "SNAPSHOT", 1},
{SOME, "SOME", 1}, {SOME, "SOME", 1},
{SORT, "SORT", 1}, {SORT, "SORT", 1},
{SQLCODE, "SQLCODE", 1}, {SQLCODE, "SQLCODE", 1},
{STABILITY, "STABILITY", 1}, {STABILITY, "STABILITY", 1},
{STARTING, "STARTING", 1}, {STARTING, "STARTING", 1},
{STARTING, "STARTS", 1}, /* Alias of STARTING */ {STARTING, "STARTS", 1}, /* Alias of STARTING */
{STATISTICS, "STATISTICS", 1}, {STATISTICS, "STATISTICS", 1},
{SUBSTRING, "SUBSTRING", 2}, {SUBSTRING, "SUBSTRING", 2},
{SUB_TYPE, "SUB_TYPE", 1}, {SUB_TYPE, "SUB_TYPE", 1},
{SUM, "SUM", 1}, {SUM, "SUM", 1},
{SUSPEND, "SUSPEND", 1}, {SUSPEND, "SUSPEND", 1},
@ -280,18 +280,17 @@ static CONST TOK tokens [] = {
{WITH, "WITH", 1}, {WITH, "WITH", 1},
{WORK, "WORK", 1}, {WORK, "WORK", 1},
{WRITE, "WRITE", 1}, {WRITE, "WRITE", 1},
{YEAR, "YEAR", 2}, {YEAR, "YEAR", 2},
{YEARDAY, "YEARDAY", 2}, {YEARDAY, "YEARDAY", 2},
{NOT_LSS, "^<", 1}, /* Alias of !< */ {NOT_LSS, "^<", 1}, /* Alias of !< */
{NEQ, "^=", 1}, /* Alias of != */ {NEQ, "^=", 1}, /* Alias of != */
{NOT_GTR, "^>", 1}, /* Alias of !> */ {NOT_GTR, "^>", 1}, /* Alias of !> */
{CONCATENATE, "||", 1}, {CONCATENATE, "||", 1},
{NOT_LSS, "~<", 1}, /* Alias of !< */ {NOT_LSS, "~<", 1}, /* Alias of !< */
{NEQ, "~=", 1}, /* Alias of != */ {NEQ, "~=", 1}, /* Alias of != */
{NOT_GTR, "~>", 1}, /* Alias of !> */ {NOT_GTR, "~>", 1}, /* Alias of !> */
{0, 0, 0} {0, 0, 0}
}; };
/* This method is currently used in isql/isql.epp to check if a /* 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. user field is a reserved word, and hence needs to be quoted.
@ -300,7 +299,7 @@ static CONST TOK tokens [] = {
MOD 29-June-2002 MOD 29-June-2002
*/ */
bool KEYWORD_stringIsAToken(const char*in_str) bool KEYWORD_stringIsAToken(const char *in_str)
{ {
CONST TOK *tok_ptr = tokens; CONST TOK *tok_ptr = tokens;
while (tok_ptr -> tok_string) { while (tok_ptr -> tok_string) {
@ -312,7 +311,7 @@ bool KEYWORD_stringIsAToken(const char*in_str)
return false; return false;
} }
const TOK* KEYWORD_getTokens() CONST TOK* KEYWORD_getTokens()
{ {
return tokens; return tokens;
} }

View File

@ -25,13 +25,21 @@
* MOD 29-Jun-2002 * MOD 29-Jun-2002
*/ */
// TMN: Temp hack
#if (defined(WIN32) && defined(CONST))
#undef CONST
#define CONST
#endif
typedef struct tok { typedef struct tok {
USHORT tok_ident; USHORT tok_ident;
CONST SCHAR *tok_string; CONST SCHAR *tok_string;
CONST USHORT tok_version; CONST USHORT tok_version;
} TOK; } TOK;
extern bool KEYWORD_stringIsAToken(const char*); extern "C" {
extern const TOK* KEYWORD_getTokens();
extern bool KEYWORD_stringIsAToken(const char*);
extern CONST TOK* KEYWORD_getTokens();
}