aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceparser.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2014-01-20 07:52:58 +0100
committerRenaud G <renaud@rolisteam.org>2014-01-20 07:52:58 +0100
commit488a7a8b217f3636b2887257e38e8477041b566e (patch)
tree7ba1c3d71ca6965472d4f5402a77890bef63b9c1 /diceparser.cpp
parent33329db82c9e9be5a21e15f8a61249a0d5f0a178 (diff)
downloadOneRoll-488a7a8b217f3636b2887257e38e8477041b566e.tar.gz
OneRoll-488a7a8b217f3636b2887257e38e8477041b566e.zip
adding parantheses management (unworking yet)
Diffstat (limited to 'diceparser.cpp')
-rw-r--r--diceparser.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/diceparser.cpp b/diceparser.cpp
index ae0cdc6..b7bd952 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -225,6 +225,13 @@ bool DiceParser::readDiceExpression(QString& str,ExecutionNode* & node)
{
int number=1;
bool returnVal=false;
+ if(readParantheses(str))
+ {
+ str=str.remove(0,number.size());
+
+ readDiceExpression();
+
+ }
bool hasRead = readNumber(str,number);
@@ -491,6 +498,16 @@ bool DiceParser::readLogicOperator(QString& str,BooleanCondition::LogicOperator&
return false;
}
+bool DiceParser::readParentheses(QString& str)
+{
+ if(str.startsWith("("))
+ {
+ str=str.remove(0,1);
+ return true;
+ }
+ else
+ return false;
+}
ExecutionNode* DiceParser::addSort(ExecutionNode* e,bool b)
{