diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-03-31 23:57:59 +0200 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:19:28 +0200 |
commit | 8c85e1c10085d6d634e35a63f0fc7b68a1b28eff (patch) | |
tree | a09c12c3d0ed3269e6bc1f789da95ef3967b36d1 /src/core/parser/stack/TokenStack.cpp | |
parent | 5aed7c46cff192311a208dc5e9cf7f81a40771a8 (diff) |
Remove "inherit" flag in TokenStack, add tiny unit test for TokenStack, temporarily remove pushTokens and popTokens calls from DocumentChildHandler
Diffstat (limited to 'src/core/parser/stack/TokenStack.cpp')
-rw-r--r-- | src/core/parser/stack/TokenStack.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
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 <http://www.gnu.org/licenses/>. */ -#include "TokenStack.hpp" +#include <cassert> -#include <iostream> +#include "TokenStack.hpp" namespace ousia { namespace parser_stack { -void TokenStack::pushTokens(const std::vector<SyntaxDescriptor> &tokens, - bool inherit) +void TokenStack::pushTokens(const std::vector<SyntaxDescriptor> &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 { |