Don't bother searching the keywordDict for local labels

This commit is contained in:
Rangi42
2025-08-05 10:49:09 -04:00
parent 2cae47a5a2
commit f1fd3abcff

View File

@@ -1202,7 +1202,6 @@ static Token readIdentifier(char firstChar, bool raw) {
// Continue reading while the char is in the identifier charset // Continue reading while the char is in the identifier charset
for (int c = peek(); continuesIdentifier(c); c = nextChar()) { for (int c = peek(); continuesIdentifier(c); c = nextChar()) {
// Write the char to the identifier's name
identifier += c; identifier += c;
// If the char was a dot, the identifier is a local label // If the char was a dot, the identifier is a local label
@@ -1211,8 +1210,8 @@ static Token readIdentifier(char firstChar, bool raw) {
} }
} }
// Attempt to check for a keyword if the identifier is not raw // Attempt to check for a keyword if the identifier is not raw or a local label
if (!raw) { if (!raw && tokenType != T_(LOCAL)) {
if (auto search = keywordDict.find(identifier); search != keywordDict.end()) { if (auto search = keywordDict.find(identifier); search != keywordDict.end()) {
if (search == ldio) { if (search == ldio) {
warning(WARNING_OBSOLETE, "LDIO is deprecated; use LDH"); warning(WARNING_OBSOLETE, "LDIO is deprecated; use LDH");
@@ -2152,12 +2151,10 @@ static Token skipToLeadingIdentifier() {
} }
static Token skipIfBlock(bool toEndc) { static Token skipIfBlock(bool toEndc) {
uint32_t startingDepth = lexer_GetIFDepth();
lexer_SetMode(LEXER_NORMAL); lexer_SetMode(LEXER_NORMAL);
Defer reenableExpansions = scopedDisableExpansions(); Defer reenableExpansions = scopedDisableExpansions();
for (;;) { for (uint32_t startingDepth = lexer_GetIFDepth();;) {
switch (Token token = skipToLeadingIdentifier(); token.type) { switch (Token token = skipToLeadingIdentifier(); token.type) {
case T_(YYEOF): case T_(YYEOF):
return token; return token;