From 217cffe1036089856f08ad4f89f36fdf01500e2d Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Tue, 31 May 2016 21:05:41 +0300 Subject: [PATCH] Fix non-reserved flag and move the new non-reserved tokens to their proper place at the end of the list. --- src/dsql/parse.y | 4 ++-- src/yvalve/keywords.cpp | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/dsql/parse.y b/src/dsql/parse.y index 5acd19d104..eaa970b984 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -7783,7 +7783,6 @@ non_reserved_word | PASSWORD // | PLAN // | POST_EVENT - | PRIVILEGE | PRIVILEGES | PROTECTED | READ @@ -7803,7 +7802,6 @@ non_reserved_word | STATISTICS | SUB_TYPE | SUSPEND - | SYSTEM | TRANSACTION | UNCOMMITTED // | VARIABLE @@ -7848,6 +7846,8 @@ non_reserved_word | TRUSTED | RDB_ROLE_IN_USE // added in FB 4.0 | RDB_SYSTEM_PRIVILEGE + | PRIVILEGE + | SYSTEM ; %% diff --git a/src/yvalve/keywords.cpp b/src/yvalve/keywords.cpp index e5fb0bda59..837bdb3cfc 100644 --- a/src/yvalve/keywords.cpp +++ b/src/yvalve/keywords.cpp @@ -327,9 +327,9 @@ static const TOK tokens[] = {DB_KEY, "RDB$DB_KEY", false}, {RDB_GET_CONTEXT, "RDB$GET_CONTEXT", true}, {RDB_RECORD_VERSION, "RDB$RECORD_VERSION", false}, - {RDB_ROLE_IN_USE, "RDB$ROLE_IN_USE", false}, + {RDB_ROLE_IN_USE, "RDB$ROLE_IN_USE", true}, {RDB_SET_CONTEXT, "RDB$SET_CONTEXT", true}, - {RDB_SYSTEM_PRIVILEGE, "RDB$SYSTEM_PRIVILEGE", false}, + {RDB_SYSTEM_PRIVILEGE, "RDB$SYSTEM_PRIVILEGE", true}, {READ, "READ", false}, {REAL, "REAL", false}, {VERSION, "RECORD_VERSION", false}, @@ -468,7 +468,7 @@ static const TOK tokens[] = {NOT_LSS, "~<", false}, // Alias of !< {NEQ, "~=", false}, // Alias of != {NOT_GTR, "~>", false}, // Alias of !> - {0, 0, false} + {0, NULL, false} }; // This method is currently used in isql/isql.epp to check if a @@ -480,14 +480,12 @@ extern "C" { int API_ROUTINE KEYWORD_stringIsAToken(const char* in_str) { - const TOK* tok_ptr = tokens; - while (tok_ptr->tok_string) + for (const TOK* tok_ptr = tokens; tok_ptr->tok_string; ++tok_ptr) { - if (!tok_ptr->nonReserved && !strcmp(tok_ptr->tok_string, in_str)) { + if (!tok_ptr->nonReserved && !strcmp(tok_ptr->tok_string, in_str)) return true; - } - ++tok_ptr; } + return false; }