Binary literals

This commit is contained in:
Rafał Grodziński
2025-06-22 13:24:17 +09:00
parent 1ac2db1319
commit 47293b4cf5
5 changed files with 44 additions and 0 deletions

View File

@@ -138,6 +138,14 @@ Expression(ExpressionKind::LITERAL, ValueType::NONE) {
sint32Value = stoi(token->getLexme(), nullptr, 16);
valueType = ValueType::SINT32;
break;
case TokenKind::INTEGER_BIN:
sint32Value = stoi(
token->getLexme().substr(2, token->getLexme().size()-1),
nullptr,
2
);
valueType = ValueType::SINT32;
break;
case TokenKind::REAL:
real32Value = stof(token->getLexme());
valueType = ValueType::REAL32;