diff options
Diffstat (limited to 'starmath/inc/parse.hxx')
-rw-r--r-- | starmath/inc/parse.hxx | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index b010db941832..6eb83500b3d3 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -30,7 +30,6 @@ #include <vector> #include "token.hxx" -#include "error.hxx" class SmBlankNode; class SmBinVerNode; @@ -46,6 +45,50 @@ class SmTextNode; #define DEPTH_LIMIT 1024 +// Those are the errors that the parser may encounter. +enum class SmParseError : uint_fast8_t +{ + None = 0, + UnexpectedChar = 1, + UnexpectedToken = 2, + PoundExpected = 3, + ColorExpected = 4, + LgroupExpected = 5, + RgroupExpected = 6, + LbraceExpected = 7, + RbraceExpected = 8, + ParentMismatch = 9, + RightExpected = 10, + FontExpected = 11, + SizeExpected = 12, + DoubleAlign = 13, + DoubleSubsupscript = 14, + NumberExpected = 15 +}; + +struct SmErrorDesc +{ + SmParseError m_eType; + SmNode* m_pNode; + OUString m_aText; + + SmErrorDesc(SmParseError eType, SmNode* pNode, OUString aText) + : m_eType(eType) + , m_pNode(pNode) + , m_aText(aText) + {} + +}; + +namespace starmathdatabase{ + +// Must be in sync with SmParseError list +extern const char* SmParseErrorDesc[16]; + +OUString getParseErrorDesc(SmParseError err); + +} + class SmParser { OUString m_aBufferString; @@ -148,7 +191,6 @@ public: bool IsExportSymbolNames() const { return m_bExportSymNames; } void SetExportSymbolNames(bool bVal) { m_bExportSymNames = bVal; } - void AddError(SmParseError Type, SmNode *pNode); const SmErrorDesc* NextError(); const SmErrorDesc* PrevError(); const SmErrorDesc* GetError(); |