diff options
| author | 2014-12-13 21:44:41 +0100 | |
|---|---|---|
| committer | 2014-12-13 21:44:41 +0100 | |
| commit | 375b75f53251728073b802f3f5b625df0f2ac856 (patch) | |
| tree | b5319b589b26669344a06bbfe9cec81cdc715754 /diceparser.cpp | |
| parent | 226cc9024f9b86891da1c68ca8cf5a1af70b5e9f (diff) | |
| download | OneRoll-375b75f53251728073b802f3f5b625df0f2ac856.tar.gz OneRoll-375b75f53251728073b802f3f5b625df0f2ac856.zip | |
-Add readInstructionOperator
@TODO must be improved.
Diffstat (limited to 'diceparser.cpp')
| -rw-r--r-- | diceparser.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
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()) @@ -378,6 +387,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 { delete node; |