Small fixes

This commit is contained in:
ala89 2023-11-10 17:50:00 +01:00
parent ede4dea616
commit d3769e5630
2 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ using TokenData = variant<int, string, Type>;
struct Token { struct Token {
TokenType type; TokenType type;
TokenData data; TokenData data { };
}; };
/* /*

View File

@ -128,11 +128,11 @@ vector<Token> tokenize(string str) {
tokens.emplace_back(token); tokens.emplace_back(token);
str.erase(0, 1); str.erase(0, 1);
} }
else if (isspace(str[0])) { else if (isspace(str[0]) || str[0] == '\0') {
str.erase(0, 1); str.erase(0, 1);
} }
else { else {
cerr << "Unknown token: " << str << endl; cerr << "Unknown token: \"" << str << "\"" << endl;
break; break;
} }
} }