diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-03-04 21:43:36 +0100 |
---|---|---|
committer | Andreas Stöckel <andreas@somweyr.de> | 2015-03-04 21:43:36 +0100 |
commit | 2b9ac0c0a26b2c32277f3e17e12f69c2ec27bd4f (patch) | |
tree | d674ca6401944a151867f3affedce26f2a5aa17d /src/core/parser/stack/TokenStack.cpp | |
parent | a0a768b425dd9b5f7f763b6104d263f25a32c96b (diff) |
Prepared implementation of user defined tokens
Diffstat (limited to 'src/core/parser/stack/TokenStack.cpp')
-rw-r--r-- | src/core/parser/stack/TokenStack.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/parser/stack/TokenStack.cpp b/src/core/parser/stack/TokenStack.cpp index ac1d94e..b6fc6e1 100644 --- a/src/core/parser/stack/TokenStack.cpp +++ b/src/core/parser/stack/TokenStack.cpp @@ -18,6 +18,8 @@ #include "TokenStack.hpp" +#include <iostream> + namespace ousia { namespace parser_stack { @@ -26,17 +28,17 @@ void TokenStack::pushTokens(const std::vector<SyntaxDescriptor> &tokens) stack.push_back(tokens); } -void TokenStack::popTokens() { stack.pop_back(); } +void TokenStack::popTokens() { + stack.pop_back(); +} TokenSet TokenStack::tokens() const { - if (stack.empty() && parentStack != nullptr) { - return parentStack->tokens(); - } - TokenSet res; - for (const SyntaxDescriptor &descr : stack.back()) { - descr.insertIntoTokenSet(res); + if (!stack.empty()) { + for (const SyntaxDescriptor &descr : stack.back()) { + descr.insertIntoTokenSet(res); + } } return res; } |