Add better error to the tokenizer with extra trailing,
This is a pretty easy case to detect and warn about and saves a bunch of
time.
Change-Id: Ib2aa53f811d6c928ecf728749feb4164c2f49d67
diff --git a/aos/json_tokenizer.cc b/aos/json_tokenizer.cc
index ac519c8..2486227 100644
--- a/aos/json_tokenizer.cc
+++ b/aos/json_tokenizer.cc
@@ -249,6 +249,10 @@
if (!ConsumeString(&s)) {
fprintf(stderr, "Error on line %d, expected string for field name.\n",
linenumber_);
+ if (Consume("}")) {
+ fprintf(stderr,
+ "Got '}' instead. Did you add an extra trailing ','?\n");
+ }
return TokenType::kError;
}
field_name_ = ::std::move(s);