Fixed empty identifier error reporting

This commit is contained in:
Kyler Olsen 2025-11-23 23:50:21 -07:00
parent b2f4b8d850
commit eacef33cf8
1 changed files with 2 additions and 1 deletions

View File

@ -758,11 +758,12 @@ static LexerResult lexer_next(LexerInfo *lexer_info) {
// Identifiers and Booleans // Identifiers and Booleans
if (is_identifier_start(lexer_info)) if (is_identifier_start(lexer_info))
return parse_identifiers_and_booleans(lexer_info, c, start, start_line); return parse_identifiers_and_booleans(lexer_info, c, start, start_line);
if (c == ':') if (c == ':') {
if (far_peek(lexer_info, 1) == ':') if (far_peek(lexer_info, 1) == ':')
return lexer_error(lexer_info, SLS_STR("Invalid identifier literal: empty identifier after '::'."), start, start_line); return lexer_error(lexer_info, SLS_STR("Invalid identifier literal: empty identifier after '::'."), start, start_line);
else else
return lexer_error(lexer_info, SLS_STR("Unexpected single colon ':'."), start, start_line); return lexer_error(lexer_info, SLS_STR("Unexpected single colon ':'."), start, start_line);
}
// Random Characters // Random Characters
SlsStr error_msg = sls_format(SLS_STR("Unexpected character: unexpected '%c' during parsing."), c); SlsStr error_msg = sls_format(SLS_STR("Unexpected character: unexpected '%c' during parsing."), c);