Improved .proto conversion.

- Allowed enums to be declared before use.
- Generalized parsing of `required`.
- Reworked escaping of namespaces.
- Escaping field names that are C++ keywords.
- Many smaller fixes.

Change-Id: Ie580de7b70dc208f676f4f71bb0d061808648b8d
Tested: on Linux.
This commit is contained in:
Wouter van Oortmerssen
2017-10-02 15:41:34 -07:00
parent 5b4acf809e
commit 9c3920d0ab
6 changed files with 268 additions and 149 deletions

View File

@@ -85,7 +85,6 @@ std::string FlatCompiler::GetUsageString(const char* program_name) const {
" --gen-mutable Generate accessors that can mutate buffers in-place.\n"
" --gen-onefile Generate single output file for C#.\n"
" --gen-name-strings Generate type name functions for C++.\n"
" --escape-proto-ids Disable appending '_' in namespaces names.\n"
" --gen-object-api Generate an additional object-based API.\n"
" --cpp-ptr-type T Set object API pointer type (default std::unique_ptr)\n"
" --cpp-str-type T Set object API string type (default std::string)\n"
@@ -228,8 +227,6 @@ int FlatCompiler::Compile(int argc, const char** argv) {
binary_files_from = filenames.size();
} else if(arg == "--proto") {
opts.proto_mode = true;
} else if(arg == "--escape-proto-ids") {
opts.escape_proto_identifiers = true;
} else if(arg == "--schema") {
schema_binary = true;
} else if(arg == "-M") {