diff options
Diffstat (limited to 'src/core/parser/ParserStack.cpp')
-rw-r--r-- | src/core/parser/ParserStack.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/core/parser/ParserStack.cpp b/src/core/parser/ParserStack.cpp index ff2647d..691b9d0 100644 --- a/src/core/parser/ParserStack.cpp +++ b/src/core/parser/ParserStack.cpp @@ -47,17 +47,14 @@ void Handler::child(std::shared_ptr<Handler> handler) HandlerInstance HandlerDescriptor::create(const ParserContext &ctx, std::string name, State parentState, bool isChild, - const Variant &args) const + Variant::mapType &args) const { Handler *h = ctor(ctx, name, targetState, parentState, isChild); // Canonicalize the arguments - Variant arguments = args; - if (argsType != nullptr) { - argsType->build(arguments, ctx.logger); - } + arguments.validateMap(args, ctx.logger, true); - h->start(arguments); + h->start(args); return HandlerInstance(h, this); } @@ -95,7 +92,7 @@ std::set<std::string> ParserStack::expectedCommands(State state) return res; } -void ParserStack::start(std::string name, const Variant &args) +void ParserStack::start(std::string name, Variant::mapType &args) { // Fetch the current handler and the current state const HandlerInstance *h = stack.empty() ? nullptr : &stack.top(); @@ -126,6 +123,12 @@ void ParserStack::start(std::string name, const Variant &args) stack.emplace(descr->create(ctx, name, curState, isChild, args)); } +void ParserStack::start(std::string name, const Variant::mapType &args) +{ + Variant::mapType argsCopy(args); + start(name, argsCopy); +} + void ParserStack::end() { // Check whether the current command could be ended |