Step 121: add import/external module AST concepts

This commit is contained in:
Bill
2026-02-09 15:00:26 -07:00
parent 664645852d
commit 1fd567fb20
8 changed files with 198 additions and 2 deletions

View File

@@ -80,6 +80,8 @@ private:
addRule("Module", "variables", {"Variable"}, false); // multi-valued
addRule("Module", "targetLanguage", {}, true); // property, not used for AST nodes
addRule("Module", "annotations", {"DerefStrategy", "OptimizationLock", "LangSpecific"}, false); // multi-valued
addRule("Module", "imports", {"Import"}, false); // multi-valued
addRule("Module", "externalModules", {"ExternalModule"}, false); // multi-valued
// Function concept rules
addRule("Function", "parameters", {"Parameter"}, false); // multi-valued
@@ -151,6 +153,17 @@ private:
// Type concepts - no child rules needed as they're leaf nodes for types
// Annotation concepts - no child rules needed as they're leaf nodes for annotations
// External module concepts
addRule("ExternalModule", "signatures", {"TypeSignature"}, false); // multi-valued
addRule("TypeSignature", "returnType",
{"PrimitiveType", "ListType", "SetType", "MapType", "TupleType",
"ArrayType", "OptionalType", "CustomType"},
true);
addRule("TypeSignature", "paramTypes",
{"PrimitiveType", "ListType", "SetType", "MapType", "TupleType",
"ArrayType", "OptionalType", "CustomType"},
false);
}
void addRule(const std::string& parentConcept, const std::string& role, const std::vector<std::string>& allowedConcepts, bool isSingleValued) {
@@ -159,4 +172,4 @@ private:
rule.isSingleValued = isSingleValued;
schema_[parentConcept][role] = rule;
}
};
};