summaryrefslogtreecommitdiff
path: root/src/core/parser/stack
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-15 20:58:52 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-15 20:58:52 +0100
commitd0afc14f19509ba0d870c10d989151827c9bff57 (patch)
tree51020b0443afd4c813521a157ed59556a6fa8533 /src/core/parser/stack
parentc298f00ef1633a663775fe9a715a249b9f4d255d (diff)
Domains an Typesystems can also be declared inline
Diffstat (limited to 'src/core/parser/stack')
-rw-r--r--src/core/parser/stack/DomainHandler.cpp10
-rw-r--r--src/core/parser/stack/TypesystemHandler.cpp7
2 files changed, 17 insertions, 0 deletions
diff --git a/src/core/parser/stack/DomainHandler.cpp b/src/core/parser/stack/DomainHandler.cpp
index 24a6f1a..a2c8eec 100644
--- a/src/core/parser/stack/DomainHandler.cpp
+++ b/src/core/parser/stack/DomainHandler.cpp
@@ -35,11 +35,21 @@ namespace parser_stack {
bool DomainHandler::start(Variant::mapType &args)
{
+ // Create the Domain node
Rooted<Domain> domain =
context().getProject()->createDomain(args["name"].asString());
domain->setLocation(location());
+ // If the domain is defined inside a document, add the reference to the
+ // document
+ Rooted<Document> document = scope().select<Document>();
+ if (document != nullptr) {
+ document->reference(domain);
+ }
+
+ // Push the typesystem onto the scope, set the POST_HEAD flag to true
scope().push(domain);
+ scope().setFlag(ParserFlag::POST_HEAD, false);
return true;
}
diff --git a/src/core/parser/stack/TypesystemHandler.cpp b/src/core/parser/stack/TypesystemHandler.cpp
index d053699..8fd9525 100644
--- a/src/core/parser/stack/TypesystemHandler.cpp
+++ b/src/core/parser/stack/TypesystemHandler.cpp
@@ -37,6 +37,13 @@ bool TypesystemHandler::start(Variant::mapType &args)
context().getProject()->createTypesystem(args["name"].asString());
typesystem->setLocation(location());
+ // If the typesystem is defined inside a domain, add a reference to the
+ // typesystem to the domain
+ Rooted<Domain> domain = scope().select<Domain>();
+ if (domain != nullptr) {
+ domain->reference(typesystem);
+ }
+
// Push the typesystem onto the scope, set the POST_HEAD flag to true
scope().push(typesystem);
scope().setFlag(ParserFlag::POST_HEAD, false);