parser: fix integer literals

This commit is contained in:
2023-09-12 00:46:09 -04:00
parent 1b363dcf56
commit f64a54fa06
4 changed files with 16 additions and 8 deletions

View File

@ -13,11 +13,11 @@ class Parser(source: PeekableSource<Token>, val attribution: NodeAttribution) {
} else {
val integer = it.text.toIntOrNull()
if (integer != null) {
IntegerLiteral(integer)
return@expect IntegerLiteral(integer)
}
val long = it.text.toLongOrNull()
if (long != null) {
LongLiteral(long)
return@expect LongLiteral(long)
}
throw ParseError("Illegal integer value")
}