Fix int stuff

This commit is contained in:
Maxwell 2025-04-24 20:14:28 +10:00
parent 73939b3668
commit 96f93ceb49
3 changed files with 7 additions and 10 deletions

BIN
mx

Binary file not shown.

View File

@ -124,17 +124,15 @@ void Parser::processLines() {
else { else {
token.keyword = keywords::VALUE; token.keyword = keywords::VALUE;
// Convert the value based on its type // Convert the value based on its type
if (canDec(ct)) { if (canInt(ct)) {
token.type = valtype::DEC;
token.value.type = valtype::DEC;
token.value.value = stod(ct);
}
else if (canInt(ct)) {
token.type = valtype::INT; token.type = valtype::INT;
token.value.type = valtype::INT; token.value.type = valtype::INT;
token.value.value = stoi(ct); token.value.value = stoi(ct);
} }else if (canDec(ct)) {
else if (ct == "true" || ct == "false") { token.type = valtype::DEC;
token.value.type = valtype::DEC;
token.value.value = stod(ct);
} else if (ct == "true" || ct == "false") {
token.type = valtype::BOOL; token.type = valtype::BOOL;
token.value.type = valtype::BOOL; token.value.type = valtype::BOOL;
token.value.value = (ct == "true"); token.value.value = (ct == "true");

View File

@ -2,5 +2,4 @@ print "dingusify";
let str bingus "heheheha its bingusing time"; let str bingus "heheheha its bingusing time";
print bingus; print bingus;
print 1 + 1; print 1 + 1;
let dec myInt 3; let int myInt 3;
myInt += 69;