mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-08 14:15:17 +00:00
Add --root-type option to flatc [C++, parser, JSON] (#4728)
* Add --root-type option to flatc To select or override a root_type * Add help text from flatc --root-type to Compiler.md doc
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
d215852f52
commit
6621424308
@@ -2432,9 +2432,12 @@ CheckedError Parser::DoParse(const char *source, const char **include_paths,
|
||||
auto root_type = attribute_;
|
||||
EXPECT(kTokenIdentifier);
|
||||
ECHECK(ParseNamespacing(&root_type, nullptr));
|
||||
if (!SetRootType(root_type.c_str()))
|
||||
return Error("unknown root type: " + root_type);
|
||||
if (root_struct_def_->fixed) return Error("root type must be a table");
|
||||
if (opts.root_type.empty()) {
|
||||
if (!SetRootType(root_type.c_str()))
|
||||
return Error("unknown root type: " + root_type);
|
||||
if (root_struct_def_->fixed)
|
||||
return Error("root type must be a table");
|
||||
}
|
||||
EXPECT(';');
|
||||
} else if (IsIdent("file_identifier")) {
|
||||
NEXT();
|
||||
|
||||
Reference in New Issue
Block a user