diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-06 16:52:51 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-06 16:52:51 +0100 |
commit | 7fb170a87a4551a048487361b7aaf29963dc7b99 (patch) | |
tree | b2f532ec8e6aa54f475c0e48b3ef5d39b6ee3b6c /src/core/parser/ParserStack.hpp | |
parent | 3ceb415e4f81b50b8e46351e9e586794ebf08644 (diff) | |
parent | b211c02c53f3ed38c7d124d6a74f22ee17df7063 (diff) |
Merge branch 'master' of somweyr.de:ousia
Conflicts:
application/src/plugins/xml/XmlParser.cpp
Diffstat (limited to 'src/core/parser/ParserStack.hpp')
-rw-r--r-- | src/core/parser/ParserStack.hpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/core/parser/ParserStack.hpp b/src/core/parser/ParserStack.hpp index 8561d42..efc4e4a 100644 --- a/src/core/parser/ParserStack.hpp +++ b/src/core/parser/ParserStack.hpp @@ -86,9 +86,8 @@ struct HandlerData { * @param parentState is the state of the parent command. * @param location is the location at which the handler is created. */ - HandlerData(ParserContext &ctx, std::string name, - const ParserState &state, const ParserState &parentState, - const SourceLocation location) + HandlerData(ParserContext &ctx, std::string name, const ParserState &state, + const ParserState &parentState, const SourceLocation location) : ctx(ctx), name(std::move(name)), state(state), @@ -250,14 +249,23 @@ private: std::stack<std::shared_ptr<Handler>> stack; /** - * 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. + * Used internally to get all expected command names for the current state. + * This function is used to build error messages. * - * @param state is the state for which all expected command names should be - * returned. + * @return a set of strings containing the names of the expected commands. */ - std::set<std::string> expectedCommands(const ParserState &state); + std::set<std::string> expectedCommands(); + + /** + * Returns the targetState for a command with the given name that can be + * reached from for the current state. + * + * @param name is the name of the requested command. + * @return nullptr if no target state was found, a pointer at the target + *state + * otherwise. + */ + const ParserState *findTargetState(const std::string &name); public: /** @@ -309,7 +317,7 @@ public: * @param location is the location in the source file at which the command * starts. */ - void start(std::string name, Variant::mapType &args, + void start(const std::string &name, Variant::mapType &args, const SourceLocation &location = SourceLocation{}); /** |