diff options
author | Wouter van Oortmerssen <wvo@google.com> | 2015-01-16 16:57:04 -0800 |
---|---|---|
committer | Wouter van Oortmerssen <wvo@google.com> | 2015-01-21 11:18:01 -0800 |
commit | 6c2dc41e0df3d6edc8cd8f452dd7a8ad7ff840c0 (patch) | |
tree | 390cdc78182f1b3699d2e7dadce6b8c8d2cd88d0 /include | |
parent | e568f170963d4d5dff5069e5012a1816185d3d6d (diff) | |
download | flatbuffers-6c2dc41e0df3d6edc8cd8f452dd7a8ad7ff840c0.tar.gz flatbuffers-6c2dc41e0df3d6edc8cd8f452dd7a8ad7ff840c0.tar.bz2 flatbuffers-6c2dc41e0df3d6edc8cd8f452dd7a8ad7ff840c0.zip |
Parser will allow a table or vector to have a trailing comma.
Unless in --strict-json mode.
Also added strict_json option to the parser, which in
addition controls if field names without quotes are allowed.
Change-Id: Id56fe5c780bdb9170958050ffa8fa23cf2babe95
Tested: on Linux.
Diffstat (limited to 'include')
-rw-r--r-- | include/flatbuffers/idl.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h index ffcef78b..54feca9d 100644 --- a/include/flatbuffers/idl.h +++ b/include/flatbuffers/idl.h @@ -266,12 +266,13 @@ struct EnumDef : public Definition { class Parser { public: - Parser(bool proto_mode = false) + Parser(bool strict_json = false, bool proto_mode = false) : root_struct_def(nullptr), source_(nullptr), cursor_(nullptr), line_(1), - proto_mode_(proto_mode) { + proto_mode_(proto_mode), + strict_json_(strict_json) { // Just in case none are declared: namespaces_.push_back(new Namespace()); known_attributes_.insert("deprecated"); @@ -354,6 +355,7 @@ class Parser { int line_; // the current line being parsed int token_; bool proto_mode_; + bool strict_json_; std::string attribute_; std::vector<std::string> doc_comment_; |