From 592c8271364fee6471be333dccbcf30cad9e3655 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 14 Dec 2017 00:50:04 +0100 Subject: -Fix comment --- cli/cmds.txt | 11 ++++++++++- diceparser.cpp | 17 ++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/cli/cmds.txt b/cli/cmds.txt index dfa4b26..f5c7e1e 100644 --- a/cli/cmds.txt +++ b/cli/cmds.txt @@ -4,7 +4,6 @@ 10d10c[>6]+@c[=10] 1+1D10 3d10c[>=5] -3nwod 1+(4*3)D10 2+4/4 2D10*2D20*8 @@ -45,3 +44,13 @@ la 10d[-8--1] 4d6p[4:black]c[>=4]+1d6p[1:white]c6-@c1+1d6p[1:red]c[>=4]+@c6-@c1 10d[0-9] +10d10g10 +1d100 #Comment +1d6;1d8mk1 +1d20;1d10;$1-$2 +1d100i[<50]{"success %1"}{"fail %1"} +2d100i:[<201]{"success %2"}{"fail %2"} +3d100i*[<101]{"Success"}{"Fail"} +3d100i.[%2=0]{"%1 is even"}{"%1 is odd"} +d100+3;d20+8 + diff --git a/diceparser.cpp b/diceparser.cpp index 2db7bcd..4337c46 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -230,6 +230,7 @@ bool DiceParser::readExpression(QString& str,ExecutionNode* & node) { operandNode= ParsingToolBox::getLatestNode(operandNode); }; + return true; } else if(readCommand(str,operandNode)) { @@ -264,12 +265,7 @@ bool DiceParser::readExpression(QString& str,ExecutionNode* & node) return false; } } - if(m_parsingToolbox->readComment(str,result,comment)) - { - m_command.remove(comment); - m_comment = result; - } - return true; + return false; } bool DiceParser::readOptionFromNull(QString& str,ExecutionNode* & node) { @@ -845,6 +841,13 @@ bool DiceParser::readInstructionList(QString& str) } else { + QString result; + QString comment; + if(m_parsingToolbox->readComment(str,result,comment)) + { + m_command.remove(comment); + m_comment = result; + } readInstruction = false; } } @@ -884,7 +887,7 @@ bool DiceParser::readOperator(QString& str,ExecutionNode* previous) { parent = nodeExecOrChild; nodeExecOrChild = nodeExecOrChild->getNextNode(); - qDebug() << node->getPriority() << nodeExecOrChild->getPriority() << "###########"; + //qDebug() << node->getPriority() << nodeExecOrChild->getPriority() << "###########"; } // management of operator priority if((nullptr != nodeExecOrChild)&&(nodeExec != nodeExecOrChild)) -- cgit v1.2.3-70-g09d2