From 8c85e1c10085d6d634e35a63f0fc7b68a1b28eff Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Tue, 31 Mar 2015 23:57:59 +0200 Subject: Remove "inherit" flag in TokenStack, add tiny unit test for TokenStack, temporarily remove pushTokens and popTokens calls from DocumentChildHandler --- src/core/parser/stack/TokenStack.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/core/parser/stack/TokenStack.cpp') diff --git a/src/core/parser/stack/TokenStack.cpp b/src/core/parser/stack/TokenStack.cpp index 1c26a7c..95424c7 100644 --- a/src/core/parser/stack/TokenStack.cpp +++ b/src/core/parser/stack/TokenStack.cpp @@ -16,18 +16,23 @@ along with this program. If not, see . */ -#include "TokenStack.hpp" +#include -#include +#include "TokenStack.hpp" namespace ousia { namespace parser_stack { -void TokenStack::pushTokens(const std::vector &tokens, - bool inherit) +void TokenStack::pushTokens(const std::vector &tokens) +{ + stack.emplace_back(tokens); + std::sort(stack.back().begin(), stack.back().end()); +} + +void TokenStack::popTokens() { - // TODO: Implement inheritance - stack.push_back(tokens); + assert(!stack.empty() && "too many calls to popTokens"); + stack.pop_back(); } TokenDescriptor TokenStack::lookup(TokenId token) const @@ -48,7 +53,6 @@ TokenDescriptor TokenStack::lookup(TokenId token) const } return res; } -void TokenStack::popTokens() { stack.pop_back(); } TokenSet TokenStack::tokens() const { -- cgit v1.2.3