about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-13 21:22:27 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-13 21:22:27 +0200
commit8271d05a889ad0ca35148847d06e6503ad5c121b (patch)
treeb777887bfa12ced99a5d443300973c5ee3414ee3
parent31aa24d204d50acf26746408364b7741303d62a8 (diff)
downloadchawan-8271d05a889ad0ca35148847d06e6503ad5c121b.tar.gz
toml: fix underscore number separator
Underscores should not be added to repr.
Also, was_num should only start as true if the first character is
a number, and must be true after the while loop.
-rw-r--r--src/config/toml.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/config/toml.nim b/src/config/toml.nim
index 8d65de79..bcba3d22 100644
--- a/src/config/toml.nim
+++ b/src/config/toml.nim
@@ -370,7 +370,7 @@ proc consumeNumber(state: var TomlParser, c: char): TomlResult =
       return state.err("invalid number")
     repr &= c
 
-  var was_num = true
+  var was_num = repr.len > 0 and repr[0] in AsciiDigit
   while state.has():
     if isDigit(state.peek(0)):
       repr &= state.consume()