diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-07 19:57:01 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-07 19:57:01 +0200 |
commit | cfd00bbd38eb6af79055a7d78a6d2db22eb9dfc2 (patch) | |
tree | 549db83bb06b0766d5cfe31b8492c0353ce31c11 | |
parent | 8b35f35bec9b14d33811910cb1e5d78b16843ca0 (diff) | |
download | chawan-cfd00bbd38eb6af79055a7d78a6d2db22eb9dfc2.tar.gz |
toml: complain more on unexpected EOF
-rw-r--r-- | src/config/toml.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/config/toml.nim b/src/config/toml.nim index e9a61708..92520045 100644 --- a/src/config/toml.nim +++ b/src/config/toml.nim @@ -408,7 +408,7 @@ proc consumeArray(state: var TomlParser): TomlResult = of ']': if val != nil: res.a.add(val) - break + return ok(res) of ',': if val == nil: return state.err("comma without element") @@ -419,7 +419,7 @@ proc consumeArray(state: var TomlParser): TomlResult = return state.err("missing comma") state.reconsume() val = ?state.consumeValue() - return ok(res) + return err("unexpected end of file") proc consumeInlineTable(state: var TomlParser): TomlResult = let res = TomlValue(vt: VALUE_TABLE, t: TomlTable()) @@ -496,6 +496,7 @@ proc consumeValue(state: var TomlParser): TomlResult = return state.err("invalid token: " & s) else: return state.err("invalid character in value: " & c) + return state.err("unexpected end of file") proc parseToml*(inputStream: Stream, filename = "<input>"): TomlResult = var state: TomlParser |