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.
This commit is contained in:
Wouter van Oortmerssen
2015-01-16 16:57:04 -08:00
parent e568f17096
commit 6c2dc41e0d
6 changed files with 25 additions and 15 deletions

View File

@@ -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_;