crypto improvements

This commit is contained in:
2026-03-05 20:04:20 +01:00
parent af0ae49abe
commit 0dc130b85c
6 changed files with 52 additions and 37 deletions

View File

@@ -55,8 +55,15 @@ impl Analyzer {
format!("tried to redefine constant '{}'", name.lexeme)
);
}
self.constants
.insert(name.lexeme.clone(), value.lexeme.parse().unwrap());
if value.lexeme.starts_with("0x") {
self.constants.insert(
name.lexeme.clone(),
u64::from_str_radix(&value.lexeme[2..], 16).unwrap(),
);
} else {
self.constants
.insert(name.lexeme.clone(), value.lexeme.parse().unwrap());
}
}
Stmt::Block(statements) => {
for stmt in statements {