aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerländer2012-04-22 13:33:50 +0200
committerAdrian Kummerländer2012-04-22 13:33:50 +0200
commit7c83dbbd089e29a420a388e78b14c7cb675f17a1 (patch)
tree3670e3a49066c815352c5239af98a757140c01fb
parent4daed5ebe3e8eae184a96055974ac15a3c55507f (diff)
downloadSimpleParser-7c83dbbd089e29a420a388e78b14c7cb675f17a1.tar
SimpleParser-7c83dbbd089e29a420a388e78b14c7cb675f17a1.tar.gz
SimpleParser-7c83dbbd089e29a420a388e78b14c7cb675f17a1.tar.bz2
SimpleParser-7c83dbbd089e29a420a388e78b14c7cb675f17a1.tar.lz
SimpleParser-7c83dbbd089e29a420a388e78b14c7cb675f17a1.tar.xz
SimpleParser-7c83dbbd089e29a420a388e78b14c7cb675f17a1.tar.zst
SimpleParser-7c83dbbd089e29a420a388e78b14c7cb675f17a1.zip
Fixed a bug which was preventing the lexer from working correctly
-rw-r--r--parser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/parser.cpp b/parser.cpp
index 7ce5cab..0378a3f 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -102,6 +102,10 @@ vector<string> Parser::lexer(string term)
throw parenthese_exception();
}
+ if ( last_priority == 90 && output.size() == 1 ) {
+ output = lexer(output[0]);
+ }
+
return output;
}
@@ -155,7 +159,7 @@ Node* Parser::buildTree(Tree *tree, string term)
if ( tmpLexer.size() == 1 ) {
operandStack.push(
tree->addOperand( NULL,
- strtod( termIter->c_str(), NULL )
+ strtod( tmpLexer[0].c_str(), NULL )
)
);
}