mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-20 16:35:06 +00:00
Parser now allows empty tables in JSON
Bug: 16870719 Change-Id: Ia5fdce49a67b1aa621ab1e37a815e2a3293257b6 Tested: on Linux
This commit is contained in:
@@ -191,7 +191,6 @@ static void GenStruct(const StructDef &struct_def, const Table *table,
|
||||
std::string *_text) {
|
||||
std::string &text = *_text;
|
||||
text += "{";
|
||||
text += NewLine(opts.indent_step);
|
||||
int fieldout = 0;
|
||||
StructDef *union_sd = nullptr;
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
@@ -202,8 +201,8 @@ static void GenStruct(const StructDef &struct_def, const Table *table,
|
||||
// The field is present.
|
||||
if (fieldout++) {
|
||||
text += ",";
|
||||
text += NewLine(opts.indent_step);
|
||||
}
|
||||
text += NewLine(opts.indent_step);
|
||||
text.append(indent + opts.indent_step, ' ');
|
||||
OutputIdentifier(fd.name, opts, _text);
|
||||
text += ": ";
|
||||
|
||||
@@ -420,7 +420,7 @@ void Parser::SerializeStruct(const StructDef &struct_def, const Value &val) {
|
||||
uoffset_t Parser::ParseTable(const StructDef &struct_def) {
|
||||
Expect('{');
|
||||
size_t fieldn = 0;
|
||||
for (;;) {
|
||||
if (!IsNext('}')) for (;;) {
|
||||
std::string name = attribute_;
|
||||
if (!IsNext(kTokenStringConstant)) Expect(kTokenIdentifier);
|
||||
auto field = struct_def.fields.Lookup(name);
|
||||
|
||||
Reference in New Issue
Block a user