From 0463affed4d6ca08c0554974130aba83af13efa5 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 18 Jan 2015 18:22:51 +0100 Subject: Parsing struct attributes, added ability to reference other typesystems from a typesystem --- src/core/model/Typesystem.cpp | 6 ++++++ src/core/model/Typesystem.hpp | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'src/core/model') diff --git a/src/core/model/Typesystem.cpp b/src/core/model/Typesystem.cpp index 2be564d..6daa7fe 100644 --- a/src/core/model/Typesystem.cpp +++ b/src/core/model/Typesystem.cpp @@ -526,6 +526,7 @@ void Typesystem::doResolve(ResolutionState &state) { continueResolveComposita(constants, constants.getIndex(), state); continueResolveComposita(types, constants.getIndex(), state); + continueResolveReferences(typesystems, state); } bool Typesystem::doValidate(Logger &logger) const @@ -542,6 +543,11 @@ Rooted Typesystem::createStructType(const std::string &name) return structType; } +void Typesystem::includeTypesystem(Handle typesystem) +{ + typesystems.push_back(typesystem); +} + /* Class SystemTypesystem */ SystemTypesystem::SystemTypesystem(Manager &mgr) diff --git a/src/core/model/Typesystem.hpp b/src/core/model/Typesystem.hpp index 1b54a07..803d0e8 100644 --- a/src/core/model/Typesystem.hpp +++ b/src/core/model/Typesystem.hpp @@ -679,8 +679,8 @@ public: */ static Rooted createValidated( Manager &mgr, std::string name, Handle system, - Handle parentStructure, const NodeVector &attributes, - Logger &logger); + Handle parentStructure, + const NodeVector &attributes, Logger &logger); /** * Returns a handle pointing at the parent type. @@ -945,6 +945,11 @@ private: */ NodeVector constants; + /** + * List containing references to other referenced typesystems. + */ + NodeVector typesystems; + protected: void doResolve(ResolutionState &state) override; @@ -958,7 +963,10 @@ public: * @param name is the name of the typesystem. */ Typesystem(Manager &mgr, std::string name) - : Node(mgr, std::move(name)), types(this), constants(this) + : Node(mgr, std::move(name)), + types(this), + constants(this), + typesystems(this) { } @@ -971,6 +979,14 @@ public: */ Rooted createStructType(const std::string &name); + /** + * Adds a reference to the given typesystem class. + * + * @param typesystem is the typesystem that should be added to the + * referenced typesystems list. + */ + void includeTypesystem(Handle typesystem); + /** * Adds the given type to the to the type list. * -- cgit v1.2.3