From 13d2715fd8156fa82062a5e21e70812c20513dbe Mon Sep 17 00:00:00 2001 From: skywalker Date: Sat, 29 Jun 2002 13:47:28 +0000 Subject: [PATCH] Added LEX_StringIsAKeyword function to avoid an awkward #include from isql module. --- src/dsql/keywords.h | 7 +++++++ src/dsql/parse.cpp | 19 +++++++++++++++++++ src/dsql/parse.y | 19 +++++++++++++++++++ src/dsql/parse_proto.h | 2 ++ 4 files changed, 47 insertions(+) diff --git a/src/dsql/keywords.h b/src/dsql/keywords.h index 75819ba00a..63a5107239 100644 --- a/src/dsql/keywords.h +++ b/src/dsql/keywords.h @@ -20,6 +20,13 @@ * 2001.08.03 John Bellardo changed LIMIT token to SKIP * 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 one one instance is needed would be best. + * MOD 29-Jun-2002 + */ + {NOT_LSS, "!<", 1}, {NEQ, "!=", 1}, {NOT_GTR, "!>", 1}, diff --git a/src/dsql/parse.cpp b/src/dsql/parse.cpp index 47b524fba4..2d8ea40cbb 100644 --- a/src/dsql/parse.cpp +++ b/src/dsql/parse.cpp @@ -3789,6 +3789,25 @@ static CONST TOK tokens [] = { }; +/* 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 + MOD 29-June-2002 +*/ + +bool LEX_StringIsAToken(const char*in_str) +{ + CONST TOK *tok_ptr = tokens; + while (tok_ptr -> tok_string) { + if (!strcmp(tok_ptr -> tok_string, in_str)) { + return true; + } + ++tok_ptr; + } + return false; +} + + void LEX_dsql_init (void) { /************************************** diff --git a/src/dsql/parse.y b/src/dsql/parse.y index c3127e7d44..abeff311c7 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -3630,6 +3630,25 @@ static CONST TOK tokens [] = { }; +/* 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 + MOD 29-June-2002 +*/ + +bool LEX_StringIsAToken(const char*in_str) +{ + CONST TOK *tok_ptr = tokens; + while (tok_ptr -> tok_string) { + if (!strcmp(tok_ptr -> tok_string, in_str)) { + return true; + } + ++tok_ptr; + } + return false; +} + + void LEX_dsql_init (void) { /************************************** diff --git a/src/dsql/parse_proto.h b/src/dsql/parse_proto.h index 1eaf36edbc..9e098b5418 100644 --- a/src/dsql/parse_proto.h +++ b/src/dsql/parse_proto.h @@ -29,6 +29,8 @@ extern "C" { #endif extern int dsql_yyparse(USHORT, USHORT, USHORT, BOOLEAN *); +extern bool LEX_StringIsAToken(const char*); + extern void LEX_dsql_init(void); extern void LEX_string(TEXT *, USHORT, SSHORT);