From 46be054ce959e9eea880459af1ad409e91eb04f7 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 19 Apr 2019 13:22:13 +0900 Subject: [PATCH] fix: improve err msg for multiline inline table show "missing curly brace" instead of "missing table key-value separator" --- toml/parser.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/toml/parser.hpp b/toml/parser.hpp index dc749136..f345d3b0 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -1406,10 +1406,16 @@ parse_inline_table(location& loc) return ok(std::make_pair( retval, region(loc, first, loc.iter()))); } + else if(*loc.iter() == '#' || *loc.iter() == '\r' || *loc.iter() == '\n') + { + throw syntax_error(format_underline("[error] " + "toml::parse_inline_table: missing curly brace `}`", + {{std::addressof(loc), "should be `}`"}})); + } else { throw syntax_error(format_underline("[error] " - "toml:::parse_inline_table: missing table separator `,` ", + "toml::parse_inline_table: missing table separator `,` ", {{std::addressof(loc), "should be `,`"}})); } }