about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-25 02:00:39 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-25 02:00:39 +0200
commitda3f78eb9333b7076591ca4088b7f26afc7852ef (patch)
tree03d2c8e1275e68473e3d76f2535e1a6323d07e63
parent05429d959e48d50d49b60088c712d7495ecf416f (diff)
downloadchawan-da3f78eb9333b7076591ca4088b7f26afc7852ef.tar.gz
toml: fix bug in multiline string parsing
-rw-r--r--src/config/toml.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/config/toml.nim b/src/config/toml.nim
index 703d7ae5..b26fb553 100644
--- a/src/config/toml.nim
+++ b/src/config/toml.nim
@@ -147,6 +147,9 @@ proc consume(state: var TomlParser): char =
   result = state.buf[state.at]
   inc state.at
 
+proc seek(state: var TomlParser, n: int) =
+  state.at += n
+
 proc reconsume(state: var TomlParser) =
   dec state.at
 
@@ -188,11 +191,13 @@ proc consumeString(state: var TomlParser, first: char):
       let s = state.peek(0, 1)
       if s == "\"\"":
         multiline = true
+        state.seek(2)
   elif first == '\'':
     if state.has(1):
       let s = state.peek(0, 1)
       if s == "''":
         multiline = true
+        state.seek(2)
 
   if multiline:
     let c = state.peek(0)