diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-07 11:45:49 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-07 11:45:49 +0200 |
commit | 3b33779e013b4720a08ceba92bef50b9e0408903 (patch) | |
tree | 30c4f6e93543669988efcce50d406cdf0b1e145d | |
parent | 257fa69d7e06bd0a6f22dd0394ad5fab1527dad0 (diff) | |
download | chawan-3b33779e013b4720a08ceba92bef50b9e0408903.tar.gz |
toml: fix newline counting in multiline strings
also, replace the todo comment
-rw-r--r-- | src/config/toml.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/config/toml.nim b/src/config/toml.nim index 6064c3d6..dadfcb6f 100644 --- a/src/config/toml.nim +++ b/src/config/toml.nim @@ -186,10 +186,12 @@ proc consumeString(state: var TomlParser, first: char): else: return state.err("invalid escape sequence \\" & c) escape = false elif ml_trim: - if not (c in {'\n', ' ', '\t'}): + if c notin {'\n', ' ', '\t'}: res &= c ml_trim = false else: + if c == '\n': + inc state.line res &= c return ok(res) @@ -504,7 +506,7 @@ proc parseToml*(inputStream: Stream, filename = "<input>"): TomlResult = state.filename = filename while state.has(): if ?state.consumeNoState(): - #TODO what is this for? + # state.node has been set to a KV pair, so now we parse its value. let kvpair = TomlKVPair(state.node) kvpair.value = ?state.consumeValue() while state.has(): |