From dfca16e5fb6bd14462fef41c8c771e2f758c92d3 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Wed, 18 Feb 2015 15:23:20 +0100 Subject: Registering inline typesystems in document --- src/core/parser/stack/TypesystemHandler.cpp | 14 +++++++++++--- 1 file 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 . */ -#include +#include #include +#include #include #include +#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 = scope().select(); if (domain != nullptr) { domain->reference(typesystem); + } else { + Rooted document = scope().select(); + 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", "")}); -- cgit v1.2.3