Skip to content

Commit 7357355

Browse files
committed
Better temporary backward compatibility.
1 parent d6ad19a commit 7357355

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

src/isql/FrontendLexer.cpp

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -187,22 +187,8 @@ FrontendLexer::Token FrontendLexer::getToken()
187187

188188
switch (toupper(*pos))
189189
{
190-
case '(':
191-
token.type = Token::TYPE_OPEN_PAREN;
192-
token.processedText = *pos++;
193-
break;
194-
195-
case ')':
196-
token.type = Token::TYPE_CLOSE_PAREN;
197-
token.processedText = *pos++;
198-
break;
199-
200-
case ',':
201-
token.type = Token::TYPE_COMMA;
202-
token.processedText = *pos++;
203-
break;
204-
205190
case ';':
191+
case '.':
206192
token.type = Token::TYPE_OTHER;
207193
token.processedText = *pos++;
208194
break;
@@ -237,6 +223,7 @@ FrontendLexer::Token FrontendLexer::getNameToken()
237223
if (const auto optStringToken = getStringToken(); optStringToken.has_value())
238224
return optStringToken.value();
239225

226+
/*** Revert to strict parsing with schemas support branch.
240227
const auto start = pos;
241228
bool first = true;
242229
@@ -265,6 +252,30 @@ FrontendLexer::Token FrontendLexer::getNameToken()
265252
std::transform(token.processedText.begin(), token.processedText.end(),
266253
token.processedText.begin(), toupper);
267254
255+
return token;
256+
***/
257+
258+
const auto start = pos;
259+
260+
switch (toupper(*pos))
261+
{
262+
case ';':
263+
token.type = Token::TYPE_OTHER;
264+
token.processedText = *pos++;
265+
break;
266+
267+
default:
268+
while (pos != end && !fb_utils::isspace(*pos) && *pos != '.')
269+
++pos;
270+
271+
token.processedText = std::string(start, pos);
272+
std::transform(token.processedText.begin(), token.processedText.end(),
273+
token.processedText.begin(), toupper);
274+
break;
275+
}
276+
277+
token.rawText = std::string(start, pos);
278+
268279
return token;
269280
}
270281

src/isql/FrontendLexer.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ class FrontendLexer
3939
TYPE_EOF,
4040
TYPE_STRING,
4141
TYPE_META_STRING,
42-
TYPE_OPEN_PAREN,
43-
TYPE_CLOSE_PAREN,
44-
TYPE_COMMA,
4542
TYPE_OTHER
4643
};
4744

src/isql/FrontendParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ FrontendParser::AnyShowNode FrontendParser::parseShow()
529529

530530
if (node.name)
531531
{
532-
if (const auto token = lexer.getNameToken();
532+
if (const auto token = lexer.getToken();
533533
token.type == Token::TYPE_OTHER && token.rawText == ".")
534534
{
535535
node.package = node.name;
@@ -565,7 +565,7 @@ FrontendParser::AnyShowNode FrontendParser::parseShow()
565565

566566
if (node.name)
567567
{
568-
if (const auto token = lexer.getNameToken();
568+
if (const auto token = lexer.getToken();
569569
token.type == Token::TYPE_OTHER && token.rawText == ".")
570570
{
571571
node.package = node.name;

0 commit comments

Comments
 (0)