| 725 | } |
| 726 | |
| 727 | flatbuffers::Parser FlatCompiler::GetConformParser( |
| 728 | const FlatCOptions &options) { |
| 729 | flatbuffers::Parser conform_parser; |
| 730 | |
| 731 | // conform parser should check advanced options, |
| 732 | // so, it have to have knowledge about languages: |
| 733 | conform_parser.opts.lang_to_generate = options.opts.lang_to_generate; |
| 734 | |
| 735 | if (!options.conform_to_schema.empty()) { |
| 736 | std::string contents; |
| 737 | if (!flatbuffers::LoadFile(options.conform_to_schema.c_str(), true, |
| 738 | &contents)) { |
| 739 | Error("unable to load schema: " + options.conform_to_schema); |
| 740 | } |
| 741 | |
| 742 | if (flatbuffers::GetExtension(options.conform_to_schema) == |
| 743 | reflection::SchemaExtension()) { |
| 744 | LoadBinarySchema(conform_parser, options.conform_to_schema, contents); |
| 745 | } else { |
| 746 | ParseFile(conform_parser, options.conform_to_schema, contents, |
| 747 | options.conform_include_directories); |
| 748 | } |
| 749 | } |
| 750 | return conform_parser; |
| 751 | } |
| 752 | |
| 753 | std::unique_ptr<Parser> FlatCompiler::GenerateCode(const FlatCOptions &options, |
| 754 | Parser &conform_parser) { |
nothing calls this directly
no test coverage detected