diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/parser/ParserContext.cpp | 4 | ||||
-rw-r--r-- | src/core/parser/ParserContext.hpp | 6 | ||||
-rw-r--r-- | src/core/resource/ResourceManager.cpp | 19 | ||||
-rw-r--r-- | src/core/resource/ResourceManager.hpp | 16 |
4 files changed, 23 insertions, 22 deletions
diff --git a/src/core/parser/ParserContext.cpp b/src/core/parser/ParserContext.cpp index cc09b5e..b4e2a9a 100644 --- a/src/core/parser/ParserContext.cpp +++ b/src/core/parser/ParserContext.cpp @@ -39,12 +39,12 @@ ParserContext::ParserContext(Registry ®istry, { } -NodeVector<Node> ParserContext::link(const std::string &path, +NodeVector<Node> ParserContext::import(const std::string &path, const std::string mimetype, const std::string rel, const RttiSet &supportedTypes) { - return resourceManager.link(*this, path, mimetype, rel, supportedTypes); + return resourceManager.import(*this, path, mimetype, rel, supportedTypes); } NodeVector<Node> ParserContext::include(const std::string &path, diff --git a/src/core/parser/ParserContext.hpp b/src/core/parser/ParserContext.hpp index f6ae89c..2787225 100644 --- a/src/core/parser/ParserContext.hpp +++ b/src/core/parser/ParserContext.hpp @@ -99,7 +99,7 @@ public: /** * Parses a file with ParserContext and an empty ParserScope. The parsed - * object graph of files that are parsed using the "link" function is + * object graph of files that are parsed using the "import" function is * cached (in contrast to the "include" function). A copy of this parser * context will be passed to the called parser, with the ParserScope * reference stored in the "scope" variable exchanged by an empty scope. @@ -117,12 +117,12 @@ public: * checked, not the actual result. * @return the parsed node or nullptr if something goes wrong. */ - NodeVector<Node> link(const std::string &path, const std::string mimetype, + NodeVector<Node> import(const std::string &path, const std::string mimetype, const std::string rel, const RttiSet &supportedTypes); /** * Parses a file with ParserContext and the current ParserScope. In contrast - * to the "link" function, include() does not cache the parsed node (as it + * to the "import" function, include() does not cache the parsed node (as it * depends on the current ParserScope). * * @param path is the path of the file that should be parsed. diff --git a/src/core/resource/ResourceManager.cpp b/src/core/resource/ResourceManager.cpp index 2e15c85..2484cb2 100644 --- a/src/core/resource/ResourceManager.cpp +++ b/src/core/resource/ResourceManager.cpp @@ -94,20 +94,21 @@ NodeVector<Node> ResourceManager::parse( // We can now try to parse the given file NodeVector<Node> parsedNodes; - try { - // Set the current source id in the logger instance. Note that this - // modifies the logger instance -- the GuardedLogger is just used to - // make sure the default location is popped from the stack again. - GuardedLogger guardedLogger(logger, SourceLocation{sourceId}); + // Set the current source id in the logger instance. Note that this + // modifies the logger instance -- the GuardedLogger is just used to + // make sure the default location is popped from the stack again. + GuardedLogger guardedLogger(logger, SourceLocation{sourceId}); + + try { // Fetch the input stream and create a char reader std::unique_ptr<std::istream> is = resource.stream(); CharReader reader(*is, sourceId); - // Actually parse the input stream, distinguish the LINK and the + // Actually parse the input stream, distinguish the IMPORT and the // INCLUDE mode switch (mode) { - case ParseMode::LINK: { + case ParseMode::IMPORT: { // Create a new, empty parser scope instance and a new parser // context with this instance in place ParserScope innerScope; @@ -183,13 +184,13 @@ NodeVector<Node> ResourceManager::parse( return parsedNodes; } -NodeVector<Node> ResourceManager::link(ParserContext &ctx, +NodeVector<Node> ResourceManager::import(ParserContext &ctx, const std::string &path, const std::string &mimetype, const std::string &rel, const RttiSet &supportedTypes) { - return parse(ctx, path, mimetype, rel, supportedTypes, ParseMode::LINK); + return parse(ctx, path, mimetype, rel, supportedTypes, ParseMode::IMPORT); } NodeVector<Node> ResourceManager::include(ParserContext &ctx, diff --git a/src/core/resource/ResourceManager.hpp b/src/core/resource/ResourceManager.hpp index 559112b..83556aa 100644 --- a/src/core/resource/ResourceManager.hpp +++ b/src/core/resource/ResourceManager.hpp @@ -57,7 +57,7 @@ public: /** * Used internally to set the mode of the Parse function. */ - enum class ParseMode { LINK, INCLUDE }; + enum class ParseMode { IMPORT, INCLUDE }; private: /** @@ -114,8 +114,8 @@ private: /** * Used internally to parse the given resource. Can either operate in the - * "link" or the "include" mode. In the latter case the ParserScope instance - * inside the ParserContext is exchanged with an empty one. + * "import" or the "include" mode. In the latter case the ParserScope + * instance inside the ParserContext is exchanged with an empty one. * * @param ctx is the context that should be passed to the parser. * @param mimetype is the mimetype of the resource that should be parsed @@ -128,7 +128,7 @@ private: * @param supportedTypes contains the types of the returned Node the caller * can deal with. Note that only the types the parser claims to return are * checked, not the actual result. - * @param mode describes whether the file should be included or linked. + * @param mode describes whether the file should be included or imported. * @return the parsed nodes or an empty list if something went wrong. */ NodeVector<Node> parse(ParserContext &ctx, const std::string &path, @@ -160,7 +160,7 @@ public: * checked, not the actual result. * @return the parsed nodes or an empty list if something went wrong. */ - NodeVector<Node> link(ParserContext &ctx, const std::string &path, + NodeVector<Node> import(ParserContext &ctx, const std::string &path, const std::string &mimetype, const std::string &rel, const RttiSet &supportedTypes); @@ -169,9 +169,9 @@ public: * the file using the provided context. As the result of the "include" * function depends on the ParserScope inside the provided ParserContext * instance, the resource has to be parsed every time this function is - * called. This contasts the behaviour of the "link" function, which creates - * a new ParserScope and thus guarantees reproducible results. Logs any - * problem in the logger instance of the given ParserContext. + * called. This contasts the behaviour of the "import" function, which + * creates a new ParserScope and thus guarantees reproducible results. Logs + * any problem in the logger instance of the given ParserContext. * * @param ctx is the context from which the Logger instance will be looked * up. The sourceId specified in the context instance will be used as |