From 375b75f53251728073b802f3f5b625df0f2ac856 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sat, 13 Dec 2014 21:44:41 +0100 Subject: -Add readInstructionOperator @TODO must be improved. --- diceparser.cpp | 33 ++++++++++++++++++++++++++++++++- diceparser.h | 2 ++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/diceparser.cpp b/diceparser.cpp index f4370f6..8dff994 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -343,11 +343,20 @@ bool DiceParser::readDiceExpression(QString& str,ExecutionNode* & node) } else { - qDebug() << "error" << number << str; returnVal = false; } return returnVal; } +bool DiceParser::readInstructionOperator(QChar c) +{ + if(c == ';') + { + return true; + } + return false; + +} + bool DiceParser::readOperator(QString& str,ExecutionNode* previous) { if(str.isEmpty()) @@ -377,6 +386,28 @@ bool DiceParser::readOperator(QString& str,ExecutionNode* previous) return true; } + } + else if(readInstructionOperator(str[0])) + { + str=str.remove(0,1); + delete node; + ExecutionNode* nodeExec = NULL; + if(readExpression(str,nodeExec)) + { + + // nodeExec = getLatestNode(nodeExec); + + if(NULL==nodeExec) + { + return false; + } + previous->setNextNode(nodeExec); + + return true; + } + + + } else { diff --git a/diceparser.h b/diceparser.h index 9d9027d..81818b9 100644 --- a/diceparser.h +++ b/diceparser.h @@ -139,6 +139,8 @@ private: bool readOperand(QString&,ExecutionNode* & node); + bool readInstructionOperator(QChar c); + private: QMap* m_mapDiceOp; QMap* m_OptionOp; -- cgit v1.2.3-70-g09d2