Schemas now support include files.

Bug: 15521443
Change-Id: I2e1ef97e7225a1a0ecf2ca65e31d49d443003747
Tested: on Linux.
This commit is contained in:
Wouter van Oortmerssen
2014-08-19 14:20:05 -07:00
parent 293a8110c4
commit be894f09df
13 changed files with 136 additions and 52 deletions

View File

@@ -249,11 +249,16 @@ class Parser {
// Parse the string containing either schema or JSON data, which will
// populate the SymbolTable's or the FlatBufferBuilder above.
bool Parse(const char *_source);
// filepath indicates the file that _source was loaded from, it is
// used to resolve any include statements.
bool Parse(const char *_source, const char *filepath);
// Set the root type. May override the one set in the schema.
bool SetRootType(const char *name);
// Mark all definitions as already having code generated.
void MarkGenerated();
private:
void Next();
bool IsNext(int t);
@@ -295,6 +300,7 @@ class Parser {
std::vector<std::pair<Value, FieldDef *>> field_stack_;
std::vector<uint8_t> struct_stack_;
std::map<std::string, bool> included_files_;
};
// Utility functions for generators: