diff options
| author | 2015-03-31 23:49:35 +0200 | |
|---|---|---|
| committer | 2015-03-31 23:49:35 +0200 | |
| commit | 4c9a68db5423c5d798d178d4dafb5bf8e3228ed1 (patch) | |
| tree | ec42aa463cbdf7ab6e679932c75d93a2a6ab0ead /diceparser.h | |
| parent | fc1de9a59c3d60d87d94e62fea1a44f6fce65237 (diff) | |
| download | OneRoll-4c9a68db5423c5d798d178d4dafb5bf8e3228ed1.tar.gz OneRoll-4c9a68db5423c5d798d178d4dafb5bf8e3228ed1.zip | |
add better error management (not finished yet)
add check for endless loop in validator (not finished yet)
Better helpMe
Diffstat (limited to 'diceparser.h')
| -rw-r--r-- | diceparser.h | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/diceparser.h b/diceparser.h index 22dead1..21a71a6 100644 --- a/diceparser.h +++ b/diceparser.h @@ -33,6 +33,7 @@ #include "booleancondition.h" #include "parsingtoolbox.h" +class ExploseDiceNode; /** * @mainpage DiceParser * @@ -95,10 +96,30 @@ public: * @brief displayResult */ QString displayResult(); - + /** + * @brief readExpression + * @param str + * @param node + * @return + */ bool readExpression(QString& str,ExecutionNode* & node); - + /** + * @brief displayDotTree + */ void displayDotTree(); + + qreal getLastIntegerResult(); + qreal getSumOfDiceResult(); + + QString getLastDiceResult(); + + bool hasIntegerResultNotInFirst(); + bool hasDiceResult(); + QString getDiceCommand(); + bool hasStringResult(); + QString getStringResult(); + + QString humanReadableError(); private: /** @@ -147,7 +168,7 @@ private: * @return */ DiceRollerNode* addRollDiceNode(qint64 faces,ExecutionNode*); - + ExploseDiceNode* addExploseDiceNode(qint64 faces,ExecutionNode* previous); /** * @brief readOperand * @param node @@ -166,12 +187,25 @@ private: * @return */ QList<ExecutionNode::ERROR_CODE> getErrorList(); - + /** + * @brief readInstructionOperator + * @param c + * @return + */ bool readInstructionOperator(QChar c); - + /** + * @brief readNode + * @param str + * @param node + * @return + */ bool readNode(QString& str,ExecutionNode* & node); + ExecutionNode* getLeafNode(); + bool hasResultOfType(Result::RESULT_TYPE,bool notthelast = false); + + private: QMap<QString,DiceOperator>* m_mapDiceOp; QMap<QString,OptionOperator>* m_OptionOp; @@ -179,6 +213,8 @@ private: QMap<QString,QString>* m_aliasMap; QList<QString>* m_commandList; + QMap<ExecutionNode::ERROR_CODE,QString> m_errorMap; + ExecutionNode* m_start; ExecutionNode* m_current; |