Improve float support

This commit is contained in:
Apache 2024-06-12 23:13:20 -05:00
parent 1f195da2ad
commit ef387fc051
Signed by: apache
GPG key ID: 6B10F3EAF14F4C77

View file

@ -170,18 +170,13 @@ impl Tokenizer {
self.storage.clear(); self.storage.clear();
self.storage.push(c); self.storage.push(c);
continue; continue;
} else if c.is_numeric() || c == '.' {
// Allow numbers to also start with _ for fun
// ______100_0__: 1,000
// TODO: delete this when I expand identifiers to include more symbols
} else if c.is_numeric() || c == '_' || c == '.' {
self.reading_num = true; self.reading_num = true;
self.storage.clear(); self.storage.clear();
if c.is_numeric() { if c.is_numeric() {
self.storage.push(c); self.storage.push(c);
} else if c == '.' { } else if c == '.' {
self.is_float = true;
self.storage.push('0'); self.storage.push('0');
self.storage.push(c); self.storage.push(c);
} }