Fix handling of repeated tuple indexing. (#4733)

Per [the
design](https://docs.carbon-lang.dev/docs/design/lexical_conventions/),
`x.1.2` should lex as `(x.1).2`, not as `x.(1.2)`.
This commit is contained in:
Richard Smith
2024-12-21 06:57:14 +00:00
committed by GitHub
parent 266fd6aa75
commit 28602a87c2
10 changed files with 191 additions and 36 deletions
+2 -1
View File
@@ -70,7 +70,8 @@ auto TokenizedBuffer::GetTokenText(TokenIndex token) const -> llvm::StringRef {
if (token_info.kind() == TokenKind::IntLiteral ||
token_info.kind() == TokenKind::RealLiteral) {
std::optional<NumericLiteral> relexed_token =
NumericLiteral::Lex(source_->text().substr(token_info.byte_offset()));
NumericLiteral::Lex(source_->text().substr(token_info.byte_offset()),
token_info.kind() == TokenKind::RealLiteral);
CARBON_CHECK(relexed_token, "Could not reform numeric literal token.");
return relexed_token->text();
}