Skip to content

Commit

Permalink
Negative numbers!
Browse files Browse the repository at this point in the history
  • Loading branch information
camdenorrb committed Aug 26, 2021
1 parent 39f4c97 commit 07cc6db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/me/camdenorrb/crescentvm/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object Main {
val code =
"""
fun main() {
println(round(-2.5))
println(-.5)
}
"""
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ object CrescentLexer {
val next = charIterator.next()
val peek = charIterator.peekNext()

if (next == '-' && (peek.isDigit() || (peek == '.' && charIterator.peekNext(2).isDigit()))) {
if (next == '-' && (peek.isDigit() || (peek == '.' && charIterator.peekNext(1).isDigit()))) {
isANumber = true
"-${readNumber(charIterator)}"
}
Expand Down

0 comments on commit 07cc6db

Please sign in to comment.