From b211c02c53f3ed38c7d124d6a74f22ee17df7063 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 6 Feb 2015 16:40:42 +0100 Subject: Removed childHandler, added "*" notation --- src/core/parser/ParserStack.hpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/core/parser/ParserStack.hpp') 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> 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 expectedCommands(const ParserState &state); + std::set 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{}); /** -- cgit v1.2.3