mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 13:53:38 +00:00
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:
@@ -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_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user