Implement . string constant for the current label scope (#1499)

This commit is contained in:
Sylvie
2024-09-13 15:20:01 -04:00
committed by GitHub
parent bfb96b038d
commit 122ef95d9c
15 changed files with 133 additions and 23 deletions

View File

@@ -327,8 +327,6 @@ static std::unordered_map<std::string, int, CaseInsensitive, CaseInsensitive> ke
{"POPO", T_(POP_POPO) },
{"OPT", T_(POP_OPT) },
{".", T_(PERIOD) },
};
static bool isWhitespace(int c) {
@@ -1173,6 +1171,10 @@ static Token readIdentifier(char firstChar, bool raw) {
return Token(search->second);
}
// Label scope `.` is the only nonlocal identifier that starts with a dot
if (identifier.find_first_not_of('.') == identifier.npos)
tokenType = T_(ID);
return Token(tokenType, identifier);
}