Skip to content

Commit

Permalink
Better temporary backward compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
asfernandes committed Dec 30, 2024
1 parent 9c65b60 commit 4894def
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
41 changes: 26 additions & 15 deletions src/isql/FrontendLexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,8 @@ FrontendLexer::Token FrontendLexer::getToken()

switch (toupper(*pos))
{
case '(':
token.type = Token::TYPE_OPEN_PAREN;
token.processedText = *pos++;
break;

case ')':
token.type = Token::TYPE_CLOSE_PAREN;
token.processedText = *pos++;
break;

case ',':
token.type = Token::TYPE_COMMA;
token.processedText = *pos++;
break;

case ';':
case '.':
token.type = Token::TYPE_OTHER;
token.processedText = *pos++;
break;
Expand Down Expand Up @@ -237,6 +223,7 @@ FrontendLexer::Token FrontendLexer::getNameToken()
if (const auto optStringToken = getStringToken(); optStringToken.has_value())
return optStringToken.value();

/*** Revert to strict parsing with schemas support branch.
const auto start = pos;
bool first = true;
Expand Down Expand Up @@ -265,6 +252,30 @@ FrontendLexer::Token FrontendLexer::getNameToken()
std::transform(token.processedText.begin(), token.processedText.end(),
token.processedText.begin(), toupper);
return token;
***/

const auto start = pos;

switch (toupper(*pos))
{
case ';':
token.type = Token::TYPE_OTHER;
token.processedText = *pos++;
break;

default:
while (pos != end && !fb_utils::isspace(*pos) && *pos != '.')
++pos;

token.processedText = std::string(start, pos);
std::transform(token.processedText.begin(), token.processedText.end(),
token.processedText.begin(), toupper);
break;
}

token.rawText = std::string(start, pos);

return token;
}

Expand Down
3 changes: 0 additions & 3 deletions src/isql/FrontendLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ class FrontendLexer
TYPE_EOF,
TYPE_STRING,
TYPE_META_STRING,
TYPE_OPEN_PAREN,
TYPE_CLOSE_PAREN,
TYPE_COMMA,
TYPE_OTHER
};

Expand Down
4 changes: 2 additions & 2 deletions src/isql/FrontendParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ FrontendParser::AnyShowNode FrontendParser::parseShow()

if (node.name)
{
if (const auto token = lexer.getNameToken();
if (const auto token = lexer.getToken();
token.type == Token::TYPE_OTHER && token.rawText == ".")
{
node.package = node.name;
Expand Down Expand Up @@ -565,7 +565,7 @@ FrontendParser::AnyShowNode FrontendParser::parseShow()

if (node.name)
{
if (const auto token = lexer.getNameToken();
if (const auto token = lexer.getToken();
token.type == Token::TYPE_OTHER && token.rawText == ".")
{
node.package = node.name;
Expand Down

0 comments on commit 4894def

Please sign in to comment.