aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceparser.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2018-01-14 02:34:21 +0100
committerRenaud G <renaud@rolisteam.org>2018-01-14 02:34:21 +0100
commit8904bc61ad71f407fbefa4b80793ba424f2ce88b (patch)
tree47b0962c82a45b8cd5291132c7d96ef5cfbe5425 /diceparser.cpp
parent12bfa92a9d35299a2eeb456b11238a6bd9669146 (diff)
downloadOneRoll-8904bc61ad71f407fbefa4b80793ba424f2ce88b.tar.gz
OneRoll-8904bc61ad71f407fbefa4b80793ba424f2ce88b.zip
-rework display
-add support for new output format: SVG, IMAGE, JSON.
Diffstat (limited to 'diceparser.cpp')
-rw-r--r--diceparser.cpp24
1 files changed, 3 insertions, 21 deletions
diff --git a/diceparser.cpp b/diceparser.cpp
index 4337c46..b4dba75 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -158,25 +158,6 @@ bool DiceParser::parseLine(QString str)
m_currentTreeHasSeparator=false;
str = convertAlias(str);
m_command = str;
- /*StartingNode* start = new StartingNode();
- m_startNodes.push_back(start);
- ExecutionNode* newNode = nullptr;
- m_current = start;
-
- bool keepParsing = readExpression(str,newNode);
-
- if(keepParsing)
- {
- m_current->setNextNode(newNode);
- m_current = ParsingToolBox::getLatestNode(m_current);
- keepParsing =!str.isEmpty();
- if(keepParsing)
- {
- // keepParsing =
- readOperator(str,m_current);
- m_current = ParsingToolBox::getLatestNode(m_current);
- }
- }*/
bool hasInstruction = readInstructionList(str);
if((m_errorMap.isEmpty())&&(hasInstruction))
@@ -815,6 +796,7 @@ bool DiceParser::readInstructionList(QString& str)
if(str.isEmpty())
return false;
+ bool hasInstruction = false;
bool readInstruction = true;
while(readInstruction)
{
@@ -822,6 +804,7 @@ bool DiceParser::readInstructionList(QString& str)
bool keepParsing = readExpression(str,startNode);
if(nullptr != startNode)
{
+ hasInstruction = true;
m_startNodes.push_back(startNode);
auto latest = startNode;
if(keepParsing)
@@ -834,7 +817,6 @@ bool DiceParser::readInstructionList(QString& str)
latest = ParsingToolBox::getLatestNode(latest);
}
}
-
if( !str.isEmpty() && readInstructionOperator(str[0]))
{
str=str.remove(0,1);
@@ -856,7 +838,7 @@ bool DiceParser::readInstructionList(QString& str)
readInstruction = false;
}
}
- return true;
+ return hasInstruction;
}
bool DiceParser::readOperator(QString& str,ExecutionNode* previous)