8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 15:23:03 +01:00

Better temporary backward compatibility.

This commit is contained in:
Adriano dos Santos Fernandes 2024-12-30 10:39:53 -03:00
parent d6ad19aa07
commit 73573554ef
3 changed files with 28 additions and 20 deletions

View File

@ -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;
@ -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;
@ -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;
}

View File

@ -39,9 +39,6 @@ public:
TYPE_EOF,
TYPE_STRING,
TYPE_META_STRING,
TYPE_OPEN_PAREN,
TYPE_CLOSE_PAREN,
TYPE_COMMA,
TYPE_OTHER
};

View File

@ -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;
@ -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;