diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-08 23:22:37 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-09 01:55:25 +0000 |
commit | 945f0eb76c645a27c5b19466ed7a0b2bfc6cb9c5 (patch) | |
tree | cf39331d93b87baf4edbd8b8c9581e103edc7991 /starmath | |
parent | 3daa6c66eb9a4c334d6f72a8fd4bb09d7360a913 (diff) |
starmath: Prepare messsages for all parsing errors
and kill the unhelpful "unknown" one.
Change-Id: I3137f7e363caeb64d285aacd2e56446148d85353
Reviewed-on: https://gerrit.libreoffice.org/34977
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/starmath.hrc | 10 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 26 | ||||
-rw-r--r-- | starmath/source/smres.src | 33 |
3 files changed, 52 insertions, 17 deletions
diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 1d83abfe61ad..a09ebeca22d9 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -126,13 +126,17 @@ #define STR_TEAL (RID_APP_START + 848) #define RID_ERR_IDENT (RID_APP_START + 920) -#define RID_ERR_UNKNOWN (RID_APP_START + 921) -#define RID_ERR_UNEXPECTEDCHARACTER (RID_APP_START + 922) +#define RID_ERR_UNEXPECTEDCHARACTER (RID_APP_START + 921) +#define RID_ERR_UNEXPECTEDTOKEN (RID_APP_START + 922) #define RID_ERR_LGROUPEXPECTED (RID_APP_START + 923) #define RID_ERR_RGROUPEXPECTED (RID_APP_START + 924) #define RID_ERR_LBRACEEXPECTED (RID_APP_START + 925) #define RID_ERR_RBRACEEXPECTED (RID_APP_START + 926) -// blank: 927 - 931 +#define RID_ERR_PARENTMISMATCH (RID_APP_START + 927) +#define RID_ERR_FONTEXPECTED (RID_APP_START + 928) +#define RID_ERR_SIZEEXPECTED (RID_APP_START + 929) +#define RID_ERR_DOUBLEALIGN (RID_APP_START + 930) +#define RID_ERR_DOUBLESUBSUPSCRIPT (RID_APP_START + 931) #define RID_ERR_POUNDEXPECTED (RID_APP_START + 932) #define RID_ERR_COLOREXPECTED (RID_APP_START + 933) // blank: 934 - 935 diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 329bd9fe4c44..cf1dcc8b4053 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -2340,17 +2340,23 @@ void SmParser::AddError(SmParseError Type, SmNode *pNode) sal_uInt16 nRID; switch (Type) { - case SmParseError::UnexpectedChar: nRID = RID_ERR_UNEXPECTEDCHARACTER; break; - case SmParseError::LgroupExpected: nRID = RID_ERR_LGROUPEXPECTED; break; - case SmParseError::RgroupExpected: nRID = RID_ERR_RGROUPEXPECTED; break; - case SmParseError::LbraceExpected: nRID = RID_ERR_LBRACEEXPECTED; break; - case SmParseError::RbraceExpected: nRID = RID_ERR_RBRACEEXPECTED; break; - case SmParseError::PoundExpected: nRID = RID_ERR_POUNDEXPECTED; break; - case SmParseError::ColorExpected: nRID = RID_ERR_COLOREXPECTED; break; - case SmParseError::RightExpected: nRID = RID_ERR_RIGHTEXPECTED; break; - + case SmParseError::UnexpectedChar: nRID = RID_ERR_UNEXPECTEDCHARACTER; break; + case SmParseError::UnexpectedToken: nRID = RID_ERR_UNEXPECTEDTOKEN; break; + case SmParseError::PoundExpected: nRID = RID_ERR_POUNDEXPECTED; break; + case SmParseError::ColorExpected: nRID = RID_ERR_COLOREXPECTED; break; + case SmParseError::LgroupExpected: nRID = RID_ERR_LGROUPEXPECTED; break; + case SmParseError::RgroupExpected: nRID = RID_ERR_RGROUPEXPECTED; break; + case SmParseError::LbraceExpected: nRID = RID_ERR_LBRACEEXPECTED; break; + case SmParseError::RbraceExpected: nRID = RID_ERR_RBRACEEXPECTED; break; + case SmParseError::ParentMismatch: nRID = RID_ERR_PARENTMISMATCH; break; + case SmParseError::RightExpected: nRID = RID_ERR_RIGHTEXPECTED; break; + case SmParseError::FontExpected: nRID = RID_ERR_FONTEXPECTED; break; + case SmParseError::SizeExpected: nRID = RID_ERR_SIZEEXPECTED; break; + case SmParseError::DoubleAlign: nRID = RID_ERR_DOUBLEALIGN; break; + case SmParseError::DoubleSubsupscript: nRID = RID_ERR_DOUBLESUBSUPSCRIPT; break; default: - nRID = RID_ERR_UNKNOWN; + assert(false); + return; } pErrDesc->m_aText += SM_RESSTR(nRID); diff --git a/starmath/source/smres.src b/starmath/source/smres.src index 69252a553aab..a67c1aad7ae6 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -166,14 +166,14 @@ String RID_ERR_IDENT Text [ en-US ] = "ERROR : " ; }; -String RID_ERR_UNKNOWN +String RID_ERR_UNEXPECTEDCHARACTER { - Text [ en-US ] = "Unknown error occurred" ; + Text [ en-US ] = "Unexpected character" ; }; -String RID_ERR_UNEXPECTEDCHARACTER +String RID_ERR_UNEXPECTEDTOKEN { - Text [ en-US ] = "Unexpected character" ; + Text [ en-US ] = "Unexpected token" ; }; String RID_ERR_LGROUPEXPECTED @@ -196,6 +196,31 @@ String RID_ERR_RBRACEEXPECTED Text [ en-US ] = "')' expected" ; }; +String RID_ERR_PARENTMISMATCH +{ + Text [ en-US ] = "Left and right symbols mismatched" ; +}; + +String RID_ERR_FONTEXPECTED +{ + Text [ en-US ] = "'fixed', 'sans', or 'serif' expected" ; +}; + +String RID_ERR_SIZEEXPECTED +{ + Text [ en-US ] = "'size' followed by an unexpected token" ; +}; + +String RID_ERR_DOUBLEALIGN +{ + Text [ en-US ] = "Double aligning is not allowed" ; +}; + +String RID_ERR_DOUBLESUBSUPSCRIPT +{ + Text [ en-US ] = "Double sub/superscripts is not allowed" ; +}; + String RID_ERR_POUNDEXPECTED { Text [ en-US ] = "'#' expected" ; |