summaryrefslogtreecommitdiff
path: root/src/core/parser/ParserStack.hpp
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-23 15:47:59 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-23 15:47:59 +0100
commit18d3637ca02ab69f1ee744fa94c43c243de0f571 (patch)
tree42c859f014ab7dbb7d31a747e0ef3839c77c60fa /src/core/parser/ParserStack.hpp
parent85d72823ef18711fe7a29f5b23cc37b318766332 (diff)
parentaa817d3bfd90aa39b6fd8a915bc78a8bb210cd3d (diff)
Merge branch 'master' of somweyr.de:ousia
Diffstat (limited to 'src/core/parser/ParserStack.hpp')
-rw-r--r--src/core/parser/ParserStack.hpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/core/parser/ParserStack.hpp b/src/core/parser/ParserStack.hpp
index 492ab9c..6296dff 100644
--- a/src/core/parser/ParserStack.hpp
+++ b/src/core/parser/ParserStack.hpp
@@ -42,9 +42,9 @@
#include <core/common/Argument.hpp>
#include "Parser.hpp"
+#include "ParserContext.hpp"
namespace ousia {
-namespace parser {
/**
* The State type alias is used to
@@ -139,7 +139,7 @@ public:
const std::string &name() { return handlerData.name; }
- Scope &scope() { return handlerData.ctx.scope; }
+ ParserScope &scope() { return handlerData.ctx.scope; }
Registry &registry() { return handlerData.ctx.registry; }
@@ -322,6 +322,11 @@ private:
std::stack<HandlerInstance> stack;
/**
+ * Reference at some user defined data.
+ */
+ void *userData;
+
+ /**
* Used internally to get all expected command names for the given state
* (does not work if the current Handler instance allows arbitrary
* children). This function is used to build error messages.
@@ -340,8 +345,9 @@ public:
* corresponding HandlerDescriptor instances.
*/
ParserStack(ParserContext &ctx,
- const std::multimap<std::string, HandlerDescriptor> &handlers)
- : ctx(ctx), handlers(handlers){};
+ const std::multimap<std::string, HandlerDescriptor> &handlers,
+ void *userData = nullptr)
+ : ctx(ctx), handlers(handlers), userData(userData){};
/**
* Returns the state the ParserStack instance currently is in.
@@ -419,9 +425,15 @@ public:
* @return a reference to the parser context.
*/
ParserContext &getContext() { return ctx; }
+
+ /**
+ * Returns the user defined data.
+ *
+ * @return the userData pointer that was given in the constructor.
+ */
+ void *getUserData() { return userData; }
};
}
-}
#endif /* _OUSIA_PARSER_STACK_HPP_ */