Convert aos over to flatbuffers
Everything builds, and all the tests pass. I suspect that some entries
are missing from the config files, but those will be found pretty
quickly on startup.
There is no logging or live introspection of queue messages.
Change-Id: I496ee01ed68f202c7851bed7e8786cee30df29f5
diff --git a/aos/json_tokenizer.cc b/aos/json_tokenizer.cc
index 78bf46e..e3aa7ea 100644
--- a/aos/json_tokenizer.cc
+++ b/aos/json_tokenizer.cc
@@ -1,5 +1,7 @@
#include "aos/json_tokenizer.h"
+#include <cerrno>
+
namespace aos {
void Tokenizer::ConsumeWhitespace() {
@@ -267,7 +269,13 @@
ConsumeWhitespace();
- state_ = State::kExpectField;
+ // And then if we encounter the end again, go to the end state.
+ if (Consume("}")) {
+ ConsumeWhitespace();
+ state_ = State::kExpectObjectEnd;
+ } else {
+ state_ = State::kExpectField;
+ }
return TokenType::kStartObject;
} else if (Consume("[")) {
// Values are in arrays. Record and recurse.
@@ -293,6 +301,22 @@
field_value_ = "false";
result = TokenType::kFalseValue;
} else {
+ switch (object_type_.back()) {
+ case ObjectType::kObject:
+ if (Consume("}")) {
+ ConsumeWhitespace();
+ state_ = State::kExpectObjectEnd;
+ return Next();
+ }
+ break;
+ case ObjectType::kArray:
+ if (Consume("]")) {
+ ConsumeWhitespace();
+ state_ = State::kExpectArrayEnd;
+ return Next();
+ }
+ break;
+ }
// Couldn't parse, so we have a syntax error.
fprintf(stderr, "Error line %d, invalid field value.\n", linenumber_);
}