diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-18 15:23:20 +0100 |
---|---|---|
committer | Andreas Stöckel <andreas@somweyr.de> | 2015-02-18 15:23:20 +0100 |
commit | dfca16e5fb6bd14462fef41c8c771e2f758c92d3 (patch) | |
tree | b80dac08674287c45ee13caee60f9a8464039b1e /src/core/parser | |
parent | 5288d043aa57d9a4d1ee6806aff080c71c69b06f (diff) |
Registering inline typesystems in document
Diffstat (limited to 'src/core/parser')
-rw-r--r-- | src/core/parser/stack/TypesystemHandler.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/parser/stack/TypesystemHandler.cpp b/src/core/parser/stack/TypesystemHandler.cpp index 727c601..de8ee49 100644 --- a/src/core/parser/stack/TypesystemHandler.cpp +++ b/src/core/parser/stack/TypesystemHandler.cpp @@ -16,11 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <core/model/Typesystem.hpp> +#include <core/model/Document.hpp> #include <core/model/Domain.hpp> +#include <core/model/Typesystem.hpp> #include <core/parser/ParserScope.hpp> #include <core/parser/ParserContext.hpp> +#include "DocumentHandler.hpp" #include "DomainHandler.hpp" #include "State.hpp" #include "TypesystemHandler.hpp" @@ -38,10 +40,16 @@ bool TypesystemHandler::start(Variant::mapType &args) typesystem->setLocation(location()); // If the typesystem is defined inside a domain, add a reference to the - // typesystem to the domain + // typesystem to the domain -- do the same with a document, if no domain + // is found Rooted<Domain> domain = scope().select<Domain>(); if (domain != nullptr) { domain->reference(typesystem); + } else { + Rooted<Document> document = scope().select<Document>(); + if (document != nullptr) { + document->reference(typesystem); + } } // Push the typesystem onto the scope, set the POST_HEAD flag to true @@ -182,7 +190,7 @@ bool TypesystemConstantHandler::start(Variant::mapType &args) namespace States { const State Typesystem = StateBuilder() - .parents({&None, &Domain}) + .parents({&None, &Domain, &Document}) .createdNodeType(&RttiTypes::Typesystem) .elementHandler(TypesystemHandler::create) .arguments({Argument::String("name", "")}); |