From 1e61708f3609c95a49ef6cff50c3a0d0b98bf90b Mon Sep 17 00:00:00 2001 From: obiwankennedy Date: Tue, 21 Jan 2014 16:35:45 +0100 Subject: Update diceparser.h improvement about parentheses --- diceparser.h | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/diceparser.h b/diceparser.h index 48f2e0d..6e99bcd 100644 --- a/diceparser.h +++ b/diceparser.h @@ -10,6 +10,7 @@ #include "validator.h" #include "range.h" #include "booleancondition.h" +#include "parsingtoolbox.h" /** * @mainpage DiceParser @@ -69,14 +70,10 @@ public: */ void displayResult(); + bool readExpression(QString& str,ExecutionNode* & node); + private: - /** - * @brief readNumber read number in the given str and remove from the string the read character. - * @param str the command line - * @param myNumber reference to the found number - * @return true, succeed to read number, false otherwise. - */ - bool readNumber(QString& str, int& myNumber); + /** * @brief readDice * @param str @@ -103,39 +100,24 @@ private: * @brief setCurrentNode * @param node */ - void setCurrentNode(ExecutionNode* node); + ExecutionNode* getLatestNode(ExecutionNode* node); /** * @brief readOption */ - bool readOption(QString&,ExecutionNode* node, DiceRollerNode* diceNode); + bool readOption(QString&,ExecutionNode* node, bool hasDice = true); - /** - * @brief addSort - * @param b - */ - ExecutionNode* addSort(ExecutionNode*, bool b); - - /** - * @brief readValidator - * @param str - * @param validator - * @return - */ - Validator* readValidator(QString& str); - - - bool readLogicOperator(QString& str,BooleanCondition::LogicOperator& condition); - - bool readParentheses(QString& str); + DiceRollerNode* addRollDiceNode(qint64 faces,ExecutionNode*); private: QMap* m_mapDiceOp; QMap* m_OptionOp; - QMap* m_logicOp; + QMap* m_aliasMap; + ExecutionNode* m_start; ExecutionNode* m_current; QString m_command; + ParsingToolBox* m_parsingToolbox; }; /** -- cgit v1.2.3-70-g09d2