aboutsummaryrefslogtreecommitdiff
path: root/src/utils.cc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-10-02 19:59:48 +0200
committerAdrian Kummerlaender2014-10-02 19:59:48 +0200
commitab3a0312247f1467cd1eee81f6b1d22b499a8715 (patch)
tree875815935a92f75714dd301286c5dc35a30bfd96 /src/utils.cc
parent0840f434541b57fbd6d3c9d7b2a8b127cc680912 (diff)
downloadSimpleParser-ab3a0312247f1467cd1eee81f6b1d22b499a8715.tar
SimpleParser-ab3a0312247f1467cd1eee81f6b1d22b499a8715.tar.gz
SimpleParser-ab3a0312247f1467cd1eee81f6b1d22b499a8715.tar.bz2
SimpleParser-ab3a0312247f1467cd1eee81f6b1d22b499a8715.tar.lz
SimpleParser-ab3a0312247f1467cd1eee81f6b1d22b499a8715.tar.xz
SimpleParser-ab3a0312247f1467cd1eee81f6b1d22b499a8715.tar.zst
SimpleParser-ab3a0312247f1467cd1eee81f6b1d22b499a8715.zip
Moved exception based syntax check into buildTree
* invalid expressions typically cause the operator and operand stacks to become unbalanced ** this in turn causes a operator_exception instance to be thrown as soon as the shunting yard implementation in "buildTree" tries to modify the stack _too far_ ** this is not directly visible from the tree construction implementation * the compilation unit local helper methods "pop" and "top" now return "boost::optional<Node*>" instances ** this enables the operator placement errors to be handled where they occur * as a side effect children assignment is now more obvious through correctly named variables * added missing default initialization in lexer implementation
Diffstat (limited to 'src/utils.cc')
-rw-r--r--src/utils.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils.cc b/src/utils.cc
index 256cad8..46617d8 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -66,13 +66,13 @@ PrecedenceLevel precedence(const TokenType token) {
}
std::vector<std::string> lexer(const std::string& term) {
- std::vector<std::string> resultBuffer;
+ std::vector<std::string> resultBuffer{};
- std::string levelBuffer;
- std::string numberBuffer;
- std::string identifierBuffer;
+ std::string levelBuffer{};
+ std::string numberBuffer{};
+ std::string identifierBuffer{};
- TokenType previousToken;
+ TokenType previousToken{};
uint32_t level{0};
for ( auto&& termIter = term.begin();