Adds import "path/to/file.flatdata"; support to the schema language.#263
Open
VeaaC wants to merge 30 commits intoheremaps:masterfrom
Open
Adds import "path/to/file.flatdata"; support to the schema language.#263VeaaC wants to merge 30 commits intoheremaps:masterfrom
import "path/to/file.flatdata"; support to the schema language.#263VeaaC wants to merge 30 commits intoheremaps:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Imports are resolved relative to the importing file. Diamond and cyclic imports are handled (deduplication by absolute path, depth-first traversal with visited set).
Code generation uses separate compilation for C++ and Rust: only types from the root file are emitted, with
#includedirectives (C++) orpub use super::..re-exports (Rust) referencing sibling generated modules. Python/Dot/Flatdata generators remain monolithic — all imported types are inlined.Generator CLI gains
--depfileflag producing Makefile-style dependency output. The CMake macro usesDEPFILEon 3.20+; older versions fall back to depending only on the root schema file.Changes:
import_statementruleimporter.py:resolve_imports(path)returns ordered resolved files + import metadatabuilder.py:build_ast_from_file(path)merges multi-file ASTs, tags nodes withsource_fileandis_localSyntaxTreeextended withimports,source_file_map,is_local_node()Engine.from_file(path)class method for file-based compilationfilter_nodes()/get_import_directives()hooks#includefor imports_import_reexports_for_namespace()computessuper::depth based on namespace nesting + directory traversal depthEngine.from_file()definitionparameter fromStructure/Enumeration/Constant/Archive.create()