Flatc parser support for nullable scalars (#6026)

* Parser support for nullable scalars

* Use older C++ features

* use default element

* Add a test for json, flexbuffers, and null

* test comments and names

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2020-07-16 13:43:47 -07:00
committed by GitHub
parent 33e2d80791
commit 9ecd2e16c2
3 changed files with 108 additions and 2 deletions

View File

@@ -296,6 +296,7 @@ struct FieldDef : public Definition {
shared(false),
native_inline(false),
flexbuffer(false),
nullable(false),
nested_flatbuffer(NULL),
padding(0) {}
@@ -314,6 +315,8 @@ struct FieldDef : public Definition {
bool native_inline; // Field will be defined inline (instead of as a pointer)
// for native tables if field is a struct.
bool flexbuffer; // This field contains FlexBuffer data.
bool nullable; // If True, this field is Null (as opposed to default
// valued).
StructDef *nested_flatbuffer; // This field contains nested FlatBuffer data.
size_t padding; // Bytes to always pad after this field.
};
@@ -927,6 +930,7 @@ class Parser : public ParserState {
bool SupportsAdvancedUnionFeatures() const;
bool SupportsAdvancedArrayFeatures() const;
bool SupportsNullableScalars() const;
Namespace *UniqueNamespace(Namespace *ns);
FLATBUFFERS_CHECKED_ERROR RecurseError();