summaryrefslogtreecommitdiff
path: root/src/core/parser/Scope.hpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-09 17:09:32 +0100
committerAndreas Stöckel <andreas@somweyr.de>2015-01-09 17:09:32 +0100
commitdd185959b9fff68008d02979fefde602d177ce75 (patch)
treeea005aac74a15015c46abfe939de6a248ffa6af7 /src/core/parser/Scope.hpp
parent7d10e59d822f1e405f1f5ac252db11790a1e9b43 (diff)
Implemented resolve function in Scope class
Diffstat (limited to 'src/core/parser/Scope.hpp')
-rw-r--r--src/core/parser/Scope.hpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/core/parser/Scope.hpp b/src/core/parser/Scope.hpp
index ac0f1fd..d015371 100644
--- a/src/core/parser/Scope.hpp
+++ b/src/core/parser/Scope.hpp
@@ -19,8 +19,9 @@
#ifndef _OUSIA_PARSER_SCOPE_H_
#define _OUSIA_PARSER_SCOPE_H_
-#include <deque>
+#include <vector>
+#include <core/common/Logger.hpp>
#include <core/model/Node.hpp>
/**
@@ -96,7 +97,7 @@ public:
*/
class Scope {
private:
- std::deque<Rooted<Node>> nodes;
+ std::vector<Rooted<Node>> nodes;
public:
/**
@@ -139,6 +140,20 @@ public:
* @return a reference at the leaf node.
*/
Rooted<Node> getLeaf() { return nodes.back(); }
+
+ /**
+ * Tries to resolve a node for the given type and path for all nodes that
+ * are currently in the stack, starting with the topmost node on the stack.
+ *
+ * @param path is the path for which a node should be resolved.
+ * @param type is the type of the node that should be resolved.
+ * @param logger is the logger instance into which resolution problems
+ * should be logged.
+ * @return a reference at a resolved node or nullptr if no node could be
+ * found.
+ */
+ Rooted<Node> resolve(const std::vector<std::string> &path,
+ const RttiBase &type, Logger &logger);
};
/* Class ScopedScope -- inline declaration of some methods */