Skip to content

Commit ea906ad

Browse files
committed
Remove unused (since v3) token/parser versioning. This was a big source
of confusion during the past years.
1 parent 0c27772 commit ea906ad

File tree

5 files changed

+437
-447
lines changed

5 files changed

+437
-447
lines changed

src/dsql/Parser.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,12 @@ namespace
3838

3939
struct KeywordVersion
4040
{
41-
KeywordVersion(int aKeyword, MetaName* aStr, USHORT aVersion)
42-
: keyword(aKeyword),
43-
str(aStr),
44-
version(aVersion)
45-
{
46-
}
41+
KeywordVersion(int aKeyword, MetaName* aStr)
42+
: keyword(aKeyword), str(aStr)
43+
{}
4744

4845
int keyword;
4946
MetaName* str;
50-
USHORT version;
5147
};
5248

5349
class KeywordsMap : public GenericMap<Pair<Left<MetaName, KeywordVersion> > >
@@ -59,7 +55,7 @@ namespace
5955
for (const TOK* token = KEYWORD_getTokens(); token->tok_string; ++token)
6056
{
6157
MetaName* str = FB_NEW_POOL(pool) MetaName(token->tok_string);
62-
put(*str, KeywordVersion(token->tok_ident, str, token->tok_version));
58+
put(*str, KeywordVersion(token->tok_ident, str));
6359
}
6460
}
6561

@@ -76,13 +72,11 @@ namespace
7672

7773

7874
Parser::Parser(MemoryPool& pool, DsqlCompilerScratch* aScratch, USHORT aClientDialect,
79-
USHORT aDbDialect, USHORT aParserVersion, const TEXT* string, size_t length,
80-
SSHORT characterSet)
75+
USHORT aDbDialect, const TEXT* string, size_t length, SSHORT characterSet)
8176
: PermanentStorage(pool),
8277
scratch(aScratch),
8378
client_dialect(aClientDialect),
8479
db_dialect(aDbDialect),
85-
parser_version(aParserVersion),
8680
transformedString(pool),
8781
strMarks(pool),
8882
stmt_ambiguous(false)
@@ -1090,8 +1084,7 @@ int Parser::yylexAux()
10901084
MetaName str(string, p - string);
10911085
KeywordVersion* keyVer = keywordsMap->get(str);
10921086

1093-
if (keyVer && parser_version >= keyVer->version &&
1094-
(keyVer->keyword != COMMENT || lex.prev_keyword == -1))
1087+
if (keyVer && (keyVer->keyword != COMMENT || lex.prev_keyword == -1))
10951088
{
10961089
yylval.metaNamePtr = keyVer->str;
10971090
lex.last_token_bk = lex.last_token;
@@ -1114,7 +1107,7 @@ int Parser::yylexAux()
11141107
Firebird::string str(lex.last_token, 2);
11151108
KeywordVersion* keyVer = keywordsMap->get(str);
11161109

1117-
if (keyVer && parser_version >= keyVer->version)
1110+
if (keyVer)
11181111
{
11191112
++lex.ptr;
11201113
return keyVer->keyword;

src/dsql/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Parser : public Firebird::PermanentStorage
120120

121121
public:
122122
Parser(MemoryPool& pool, DsqlCompilerScratch* aScratch, USHORT aClientDialect,
123-
USHORT aDbDialect, USHORT aParserVersion, const TEXT* string, size_t length,
123+
USHORT aDbDialect, const TEXT* string, size_t length,
124124
SSHORT characterSet);
125125
~Parser();
126126

src/dsql/dsql.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ static inline bool reqTypeWithCursor(DsqlCompiledStatement::Type type)
105105
return false;
106106
}
107107

108-
const USHORT PARSER_VERSION = 2;
109-
110108
#ifdef DSQL_DEBUG
111109
unsigned DSQL_debug = 0;
112110
#endif
@@ -1370,7 +1368,7 @@ static dsql_req* prepareStatement(thread_db* tdbb, dsql_dbb* database, jrd_tra*
13701368
// Parse the SQL statement. If it croaks, return
13711369

13721370
Parser parser(*tdbb->getDefaultPool(), scratch, clientDialect,
1373-
scratch->getAttachment()->dbb_db_SQL_dialect, PARSER_VERSION, text, textLength,
1371+
scratch->getAttachment()->dbb_db_SQL_dialect, text, textLength,
13741372
tdbb->getAttachment()->att_charset);
13751373

13761374
request = parser.parse();

0 commit comments

Comments
 (0)