add basic character literals

main
Clyne 6 months ago
parent 3b0bcf5339
commit feb8d30610
Signed by: clyne
GPG Key ID: 3267C8EBF3F9AFC7

@ -70,6 +70,9 @@ std::pair<std::string_view, Token> nextToken(std::string_view sv)
return {extractName(sv.substr(1)), Token::PushVar}; return {extractName(sv.substr(1)), Token::PushVar};
} else if (isdigit(ch) || (ch == '-' && sv.size() > 1 && isdigit(sv[1]))) { } else if (isdigit(ch) || (ch == '-' && sv.size() > 1 && isdigit(sv[1]))) {
return {extractName(sv), Token::Number}; return {extractName(sv), Token::Number};
} else if (ch == '\\' && sv.size() > 1) {
name = std::to_string(static_cast<int>(sv[1]));
return {sv.substr(2), Token::Number};
} else if (isname(ch)) { } else if (isname(ch)) {
return {extractName(sv), Token::Var}; return {extractName(sv), Token::Var};
} }

Loading…
Cancel
Save