aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'diceparser.cpp')
-rw-r--r--diceparser.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/diceparser.cpp b/diceparser.cpp
index 39c9b98..5a13fbd 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -42,6 +42,8 @@
#include "node/mergenode.h"
#include "node/ifnode.h"
#include "node/paintnode.h"
+#include "node/stringnode.h"
+
#define DEFAULT_FACES_NUMBER 10
@@ -174,9 +176,8 @@ bool DiceParser::parseLine(QString str)
if(keepParsing)
{
// keepParsing =
- readOperator(str,m_current);
-
- m_current = getLatestNode(m_current);
+ readOperator(str,m_current);
+ m_current = getLatestNode(m_current);
}
}
@@ -1005,6 +1006,14 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous)//,
node = nodeif;
found = true;
}
+ else
+ {
+ delete nodeif;
+ }
+ }
+ else
+ {
+ delete nodeif;
}
}
@@ -1088,7 +1097,7 @@ QString DiceParser::humanReadableError()
bool DiceParser::readOperand(QString& str,ExecutionNode* & node)
{
qint64 myNumber=1;
-
+ QString resultStr;
if(m_parsingToolbox->readNumber(str,myNumber))
{
NumberNode* numberNode = new NumberNode();
@@ -1097,6 +1106,15 @@ bool DiceParser::readOperand(QString& str,ExecutionNode* & node)
node = numberNode;
return true;
}
+ else if(m_parsingToolbox->readString(str,resultStr))
+ {
+ StringNode* strNode = new StringNode();
+ strNode->setString(resultStr);
+ node = strNode;
+ return true;
+ }
+ ///! @todo Make this operator working
+
return false;
}
void DiceParser::writeDownDotTree(QString filepath)