Bring back literals starting with a digit

This commit is contained in:
Joanna Hulboj 2022-12-05 14:26:13 +00:00
parent c21e728bc6
commit 158a213d34
2 changed files with 19 additions and 13 deletions

View File

@ -159,14 +159,20 @@ Token Lexer::nextTokenImpl()
}
}
/// Identifier cannot start with a digit - prepare ErrorWrongNumber (changes for #28967)
/// Try to parse it to a identifier(1identifier_name), otherwise it return ErrorWrongNumber
if (pos < end && isWordCharASCII(*pos))
{
++pos;
while (pos < end && isWordCharASCII(*pos))
++pos;
return Token(TokenType::ErrorWrongNumber, token_begin, pos);
for (const char * iterator = token_begin; iterator < pos; ++iterator)
{
if (!isWordCharASCII(*iterator) && *iterator != '$')
return Token(TokenType::ErrorWrongNumber, token_begin, pos);
}
return Token(TokenType::BareWord, token_begin, pos);
}
return Token(TokenType::Number, token_begin, pos);

View File

@ -132,15 +132,15 @@ select _1000 FROM (SELECT 1 AS _1000) FORMAT Null;
select -_1; -- { serverError UNKNOWN_IDENTIFIER }
select -_1 FROM (SELECT -1 AS _1) FORMAT Null;
select +_1; -- { clientError SYNTAX_ERROR }
select 1__0; -- { clientError SYNTAX_ERROR }
select 10_; -- { clientError SYNTAX_ERROR }
select 1_e5; -- { clientError SYNTAX_ERROR }
select 1e_5; -- { clientError SYNTAX_ERROR }
select 1e_; -- { clientError SYNTAX_ERROR }
select 1__0; -- { serverError UNKNOWN_IDENTIFIER }
select 10_; -- { serverError UNKNOWN_IDENTIFIER }
select 1_e5; -- { serverError UNKNOWN_IDENTIFIER }
select 1e_5; -- { serverError UNKNOWN_IDENTIFIER }
select 1e_; -- { serverError UNKNOWN_IDENTIFIER }
select 1_.; -- { clientError SYNTAX_ERROR }
select 1e_1; -- { clientError SYNTAX_ERROR }
select 0_x2; -- { clientError SYNTAX_ERROR }
select 0b; -- { clientError SYNTAX_ERROR }
select 0x; -- { clientError SYNTAX_ERROR }
select 0x_; -- { clientError SYNTAX_ERROR }
select 0x_1; -- { clientError SYNTAX_ERROR }
select 1e_1; -- { serverError UNKNOWN_IDENTIFIER }
select 0_x2; -- { serverError UNKNOWN_IDENTIFIER }
select 0b; -- { serverError UNKNOWN_IDENTIFIER }
select 0x; -- { serverError UNKNOWN_IDENTIFIER }
select 0x_; -- { serverError UNKNOWN_IDENTIFIER }
select 0x_1; -- { serverError UNKNOWN_IDENTIFIER }