summaryrefslogtreecommitdiff
path: root/src/core/parser/stack/TokenStack.cpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-03-04 21:43:36 +0100
committerAndreas Stöckel <andreas@somweyr.de>2015-03-04 21:43:36 +0100
commit2b9ac0c0a26b2c32277f3e17e12f69c2ec27bd4f (patch)
treed674ca6401944a151867f3affedce26f2a5aa17d /src/core/parser/stack/TokenStack.cpp
parenta0a768b425dd9b5f7f763b6104d263f25a32c96b (diff)
Prepared implementation of user defined tokens
Diffstat (limited to 'src/core/parser/stack/TokenStack.cpp')
-rw-r--r--src/core/parser/stack/TokenStack.cpp16
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;
}